digital bicycle speedometer using dynamo
DESCRIPTION
RoboticsTRANSCRIPT
Digital Bicycle Speedometer
By
Nitish Kumar Aerospace 4th year IIST
Concept for measuring speedRPM of wheel is measured by using IR sensor which is mounted in such a way that whenever one rotation is completed an interrupt is generated which keeps on increasing by one till another interrupt for one second is generated (using TIMERS). On 1sec interrupt counter for rotation is set zero and RPM is calculated using formula
Diameter of wheel is assumed to be 29 inch wheels/ISO 622 i.e. 0.7366 m
Figure 1 Black & white ring
This black & white ring will we attached to the wheel by fixing it on spokes and sensor will face this ring for sensing rotation. The black portion of this ring will absorb the IR light while white portion while white portion will reflect it, hence two regions will we detected. In this way we will detect the rotation of wheel.
Construction for IR sensorFigure 2 Components Required
S.No1 2 3 4 5 6 7 8 9
ItemNE555N C1 & C2 POT IR LED R1 R2 TSOP1738 Capacitor Resistor
Value10 nf 4.7 k 470 22 4.7 f 100
Quantity1 2 1 1 1 1 1 1 1
Figure 3 Schematic for IR Transmitter
Figure 4 Schematic for IR ReceiverThe POT shown in figure 1 is adjusted in such a way that the square wave generated lies between 37 to 42 kHz so that the IR led glows in this frequency range.
Working of SensorWhen IR light of above frequency falls on TSOP1738 then its output becomes low and when it is not receiving any light then its output is high. So this transmission cause change from high to low which is sensed by microcontroller by using interrupt.
Figure 5 Fabricated IR Sensor
Figure 6 Assembled sensor
Construction for Display unitFor displaying the speed I have used 16x2 LCD which is connected to microcontroller port through the circuit shown below
Figure 7 LCD Pins
Figure 8 LCD is connected in 4 bit mode
Figure 9 Fabricated LCD Connector
Figure 10 LCD & Connector
Power Supply UnitOverview of circuit
Figure 11 4-Bridge Rectifier circuit for Rectification
Figure 12 Components Required
S.No 1 2 3 4
Item LM7805 Capcitor C1 & C2 1N4007 Some wires
Value 100 f
Quantity 1 2 4
Voltage regulator circuit
Figure 13 Fabricated 5v SupplyThis circuit provides the 5 v input supply for microcontroller and LCD
4-Bridge Rectifire circuit
Figure 14 Fabricated 4-bridge circuitThis circuit provides the DC supply to the voltage regulator
Program/***************************************************** This program was produced by the CodeWizardAVR V2.05.0 Professional Automatic Program Generator Copyright 1998-2010 Pavel Haiduc, HP InfoTech s.r.l. http://www.hpinfotech.com
Project : Speedometer Version : 1.0 Date : 2/29/2012 Author : Nitish Kumar Company : IIST
Comments: The Fuse bits must be set as follows HIGH=D9 LOW=E1 The above fuse setting is for 1MHz 1.Sensor used is IR 2.Interrupt 0 is used to sense one rotation 3.Timer 1 is used for 1s time base 4.PORTB is connected to LCD
Chip type Program type
: ATmega32L : Application
AVR Core Clock frequency: 1.000000 MHz Memory model External RAM size Data Stack size : Small :0 : 512
*****************************************************/
#include #include
// Alphanumeric LCD Module functions #include
// Declare your global variables here
int count=0; int rpm=0; int rps=0; int speed=0; int distance=0; int dis_count=0; # define M_PI 3.14159265358979323846
void lcd_int( int val,unsigned int field_length) { /*************************************************************** This function writes a integer type value to LCD module
Arguments: 1)int val : Value to print
2)unsigned int field_length : total length of field in which the value is printed must be between 1-5 if it is -1 the field length is no of digits in the val
****************************************************************/
unsigned char str[5]={0,0,0,0,0}; unsigned int i=4,j=0; while(val) {
str[i]=val%10; val=val/10; i--; } if(field_length==-1) while(str[j]==0) j++; else j=5-field_length;
if(val