Thursday 30 November 2017

Digital Odometer Using Atmega8

    In this project we will be using a reed switch to count the number of rotations of the wheel and thereby calculating the distance traveled. The micro-controller used is Atmega8 @ 8Mhz. The result is displayed in a 16x2 LCD. The coding is done using Arduino IDE. (How to program Atmega8 @ 8Mhz using Arduino IDE is illustrated in my friend's blog- Achu's blog ).

 
Reed Switch
   The reed switch is an electrical switch operated by an applied magnetic field. It was invented at Bell Telephone Laboratories in 1936 by W. B. Ellwood. It consists of a pair of contacts on ferrous metal reeds in a hermetically sealed glass envelope. The contacts may be normally open, closing when a magnetic field is present, or normally closed and opening when a magnetic field is applied. The switch may be actuated by a coil, making a reed relay, or by bringing a magnet near to the switch. Once the magnet is pulled away from the switch, the reed switch will go back to its original position.
                                       

    So if we know the diameter (D) of the wheel the distance traveled in one rotation is equal to the circumference of the wheel (π*D). So each time the reed switch is closed it is assumed that the wheel has completed one rotation and so has traveled a distance equal to the circumference of the wheel.

    The varying frequency signal should be decoded to get the number of rotations which is done in the code. 

Circuit Diagrams:

Reed Switch Circuit

Atmega8 LCD Interface

                So now we are all set with the hardware part now lets start coding...