0% found this document useful (0 votes)
13 views

Lesson 10 Tilt Ball Switch

Uploaded by

cejek20
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
13 views

Lesson 10 Tilt Ball Switch

Uploaded by

cejek20
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 7

Lesson 10 Tilt Ball Switch

Introduction

In this lesson, you will learn how to use a tilt ball switch in order to detect small
angle of inclination.

Hardware Required

 1 * RexQualis UNO R3

 1 * Breadboard

 2 * 220ohm Resistors

 1 * Tilt Ball switch

 1 * 5MM LED

 4 * M-M Jumper Wires

Principle

Tilt Ball switch

Tilt Switch with internal ball that will switch to ON state of approx. 15 degrees
tilt. Also great for sensing excessive vibration

Material: Housing and cover: PE heat shrinkable tubing

Ball: Stainless steel

Shape: Round

Color: Black

Contact Rating:12V
Contact Resistance: <10 ohm

Insulation Resistance:>10M ohm

Capacitance:5PF

Code interpretation

const int LedPin=8;//the led attach to

void setup()

pinMode(LedPin,OUTPUT);//initialize the LedPin as an output

void loop()

int i;

while(1)

i=analogRead(5);//Read the simulation 5 voltage value

if(i>1000)//If it's greater than 512 (2.5v)


{

digitalWrite(LedPin,HIGH);//turn led on

else

digitalWrite(LedPin,LOW);//turn led off

Experimental Procedures

Step 1:Build the circuit


Schematic Diagram
Step 2:Open the code:Tilt_Ball_Switch_Code
Step 3: Attach Arduino UNO R3 board to your computer via
USB cable and check that the 'Board Type' and 'Serial Port' are
set correctly.

Step 4: Upload the code to the RexQualis UNO R3 board.

Then, You can control the LED by controlling the balance of the
Tilt Ball Switch.
If it isn’t working, make sure you have assembled the circuit
correctly, verified and uploaded the code to your board. For
how to upload the code and install the library, check Lesson 0
Preface.

You might also like