Basic Tilt Sensor Tutorial

Current Part:

PIC 18F452
20 MHz Crystal
Tilt Sensor
10uF Capacitor
2x 10kΩ Resistor
100Ω Resistor Network (330Ω is ok too)
Breadboard Wire
9v Connector
Battery Holder

Parts List Details
           Some of the parts listed above might not be familiar to you, so I've gone ahead and written a little more information below about the more important parts.

PIC 18F452
           This simple microcontroller will be used to take input from the tilt sensor and display output on the LED Bar. It's a standard 8 bit microcontroller.

           To load the firmware onto the PIC we will need to use what is called a 'programmer'. This PICkit programmer is one of my favorites and most versatile as it can program many different types of PIC microcontrollers.

20 MHz Crystal and 10kΩ Resistors
           The 20 MHz crystal means the PIC will execute instructions at 5 MHz. This is more than fast enough for our system. The 10k resistors wil be used as pull up resistors for the PIC's MCLR pin and for the tilt sensor.

Tilt Sensor
           This is the basic tilt sensor. Inside of the metal cylinder there is a small ball that touches two metal contacts which means 'not tilted'. When tilted the ball no longer touches both contacts which means 'tilted'!

           This is a 10 LED, LED Bar, however we'll only be using 8 LEDs since the PIC's output ports are 8 bits wide.

Jumper Wires & Breadboard
           I prefer to use a breadboard with the projects in my articles because they offer maximum flexibilty with circuit design with minimal downtown between changes. In addition to the breadboard you will need jumper wire to get everything connected together.