Normally, digital speedometers

Similar documents
S.Sirish Kumar CIRCUIT DIAGRAM

Digital temperature controllers

5100/5150/5200 Bicycle Troubleshooting Manual. Version 2; Date:

TMS320F241 DSP Boards for Power-electronics Applications

Ocean Controls KT-5221 Modbus IO Module

Seminar Report Railway Gate Control 1. INTRODUCTION

Programmable Control Introduction

Controlling DC Brush Motor using MD10B or MD30B. Version 1.2. Aug Cytron Technologies Sdn. Bhd.

Construction. sunil kumar Electromechanical energy meters. Parts List

International Journal of Advance Engineering and Research Development. Wireless Control of Dc Motor Using RF Communication

3.3V regulator. JA H-bridge. Doc: page 1 of 7

PS2-SMC-06 Servo Motor Controller Interface

Microcontroller interfacing

The Skiidometer. Hardware Description By: Adam Lee ; Etec474; Prof. Morton; WWU

Many people in their spare time try to find interesting activities to do to keep them

Induction Motor Protection using Micro Controller

INF8574 GENERAL DESCRIPTION

ZKit-51-RD2, 8051 Development Kit

GF of 9 THE GADGET FREAK FILES CASE #165. Analog Clock Measures Time in Meters

I. INTRODUCTION II. LITERATURE REVIEW

BIDIRECTIONAL ROTATION OF AN INDUCTION MOTOR WITH A REMOTE CONTROL DEVICE

Electronic Components

REACTIVE POWER COMPENSATION IN DISTRIBUTION SYSTEM

I2C Demonstration Board I 2 C-bus Protocol

Introduction. Circuit diagram

EE 308 Lab Spring 2009

Application Note. I C s f o r M o t o r C o n t r o l. Evaluation board for the TDA5143/TDA5144. Report No: EIE/AN R. Galema

Analog Inputs and Outputs

Xicor Real Time Clock Family Users Guide. New Devices Integrate Crystal Compensation Circuitry AN of 8.

DS1307/DS X 8 Serial Real Time Clock

GROUP NO:-19 SWARUP HARICHANDAN SATYA PRAKASH PRADHAN SUBHENDU KUMAR TARAI DHANANJAYA NAYAK SUCHISMITA DAS MANOJ KUMAR MOHANTY

Circuit Board Assembly Instructions

LBI-38392C IC DATA MAINTENANCE MANUAL LOGIC BOARD U707 OCTAL DATA LATCH 19D902172G1 & G2 TABLE OF CONTENTS

MAKEVMA502 BASIC DIY KIT WITH ATMEGA2560 FOR ARDUINO USER MANUAL

Houngninou 2. Abstract

DIY KIT 141. Multi-Mode Timer

MICROCONTROLLER BASED SPEED SYNCHRONIZATION OF MULTIPLE DC MOTORS IN TEXTILE APPLICATIONS

AVL-10000T AUDIO VIDEO LINK TRANSMITTER TECHNICAL MANUAL

νµθωερτψυιοπασδφγηϕκλζξχϖβνµθωερτ ψυιοπασδφγηϕκλζξχϖβνµθωερτψυιοπα σδφγηϕκλζξχϖβνµθωερτψυιοπασδφγηϕκ χϖβνµθωερτψυιοπασδφγηϕκλζξχϖβνµθ

UNITED MOTORS SERVICE D IV ISIO N OF GENERAL M O TO RS C O R P O R A T IO N. General Offices - Detroit AUTO RADIO BULLETIN

CHAPTER 2 VSI FED INDUCTION MOTOR DRIVE

Project Ideas. For some interesting sensors, have a look at

DTMF Controlled Robot

Amplifier, Product Design

Motion control plays. Microcontroller-based DC Motor Controller. KS Project Manual. a vital role in industrial

DS1307ZN. 64 X 8 Serial Real Time Clock

THEORY OF OPERATION. TM308EUL for Cobra Nov 06,2006

LBI-39061A. Installation Manual. DTMF Encoder 344A4209P23 (MHDE5U) ericssonz

Introduction. Theory of Operation

SMARTALPHA RF TRANSCEIVER

ADVANCED SAFETY APPLICATIONS FOR RAILWAY CROSSING

UNITED MOTORS SERVICE D IV ISIO N OF GENERAL M O TO RS C O R P O R A T IO N. General Offices - Detroit AUTO RADIO BULLETIN

The Guitar Chord Learning System

MD04-24Volt 20Amp H Bridge Motor Drive

Ocean Controls KT-5198 Dual Bidirectional DC Motor Speed Controller

INSTANT ROBOT SHIELD (AXE408)

AN2158. Designing with the MC68HC908JL/JK Microcontroller Family. Introduction. Semiconductor Products Sector Application Note

Imaging serial interface ROM

RB-Dev-03 Devantech CMPS03 Magnetic Compass Module

UNITED MOTORS SERVICE AUTO RADIO BULLETIN

AAØZZ Control Board for Si570 Daughtercard

International Journal of Advanced Research in Electrical, Electronics and Instrumentation Engineering. (An ISO 3297: 2007 Certified Organization)

The Speech Based Floor Cleaning Robot

Object Detection for Collision Avoidance in ITS

EL7302. Hardware Design Guide

EXEMPLAR FOR EXCELLENCE

Cleaning Robot Working at Height Final. Fan-Qi XU*

Single Channel Loop Detector

2.0 Discussion: 2.1 Approach:

Intelligent Traffic Light Controller

Robotic Development Kit. Powered using ATMEL technology

DDS VFO 2 CONSTRUCTION MANUAL. DDS VFO 2 Construction Manual Issue 1 Page 1

Implementation Details of an Automatic Monitoring System Used on a Vodafone Radiocommunication Base Station

S-Pixie QRP Kit. Student Manual. Revision V 1-0

EEE3410 Microcontroller Applications Department of Electrical Engineering Lecture 11 Motor Control

10 2 2,13,15,16,46 27, non-inductive ,26,

Four Quadrant Speed Control of DC Motor with the Help of AT89S52 Microcontroller

The Allen-Bradley Servo Interface Module (Cat. No SF1) when used with the Micro Controller (Cat. No UC1) can control single axis

Maintenance Manual ERICSSONZ LBI-31552E

Sonic Distance Sensors

Automatic Monitoring of a Vodafone Radiocommunication Base Station

RFID Door Unlocking System

Course Introduction. Content 20 pages 3 questions. Learning Time 30 minutes

Applications. Operating Modes. Description. Part Number Description Package. Many to one. One to one Broadcast One to many

DEC-001 Installation Instructions

Introduction to the Arduino Kit

Two Hour Robot. Lets build a Robot.

REPAIRING THE RM KL400 LINEAR AMPLIFIER.

Using Z8 Encore! XP MCU for RMS Calculation

Electronics Design Laboratory Lecture #9. ECEN 2270 Electronics Design Laboratory

MAINTENANCE MANUAL DIGITAL SELECTOR MODULE 19D902519G1 INCLUDING DIGITAL SELECTOR 1 (150 BAUD DATA) AND DIGITAL SELECTOR 2 (9600 Hz CLOCK)

HANDS-ON LAB INSTRUCTION SHEET MODULE 3 CAPACITORS, TIME CONSTANTS AND TRANSISTOR GAIN

Microcontroller Based Electric Expansion Valve Controller for Air Conditioning System

Master Op-Doc/Test Plan

QLG1 GPS Receiver kit

2010 VCE VET Electrotechnology: GA 2: Examination

VCE VET INTEGRATED TECHNOLOGIES

Appendix 1. Basic Electronics. The PIC Hardware. Using Transistors (Basic Electronics)

International Journal of Applied Sciences, Engineering and Management ISSN , Vol. 06, No. 02, March 2017, pp

HB-25 Motor Controller (#29144)

Transcription:

Microcontroller-based Speedometer-Cum-Odometer ARUN KUMAR VADLA Normally, digital speedometers are found only in luxury cars and high-end motorbikes. Even if your motorbike has a mechanical speedometer, what will you do when it gets damaged? First, you need to replace the mechanical worm gear and then the cable. Anyway, we describe here how to build a digital speedometer-cumodometer for your motorbike. The circuit uses a microcontroller, an LCD display and some commonly available components. It is a better alternative to the mechanical speedometer and even a beginner with minimal skill level can assemble it. The features of the digital speedo- sani theo meter-cum-odometer are: 1. Digital readout 2. Speed displayed in km/hour 3. Distance traveled displayed in kilometres Fig. 1: Circuit of microcontroller-based speedometer-cum-odometer 6 0 November 2 0 0 8 electronics for you w w w. e f y m a g. c o m

Construction 4. Readings saved in non-volatile memory (EEPROM) 5. Reliability due to use of the microcontroller 6. No mechanical wear and tear 7. Home-brewed speed transducer/ sensor 8. Self reset to zero after completion of 99,999.9 km 9. Easy to build and fix onto the bike Calculations You first need to know the radius of the bike s front wheel. The calculations here are based on Hero Honda s Splendor model. The radius of the front wheel is 30 cm. (This can vary with the brand or model.) Circumference of the wheel= 2πr (where r is in cm) = 2 3.14 30 = 188.4 cm or 1.884 metres Speed. Let s assume that in 1 second the wheel completes one revolution. In other words, in one second, the bike has covered 1.88 metres. Therefore the speed in km/hour: N 1.88 3600/1000 = N 6.784 or N 6.8 where N is the number of revolutions per second. 6.8 is a constant and only N varies; for example, if N is 5, the speed equals 5x6.8= 34 km/hour. Distance. The odometer is updated every 100 metres. To cover 100 metres, the wheel is required to make approximately 53 revolutions (100/1.88). The microcontroller takes care of the tasks of revolutions counting, speed calculation, conversion and display of results. Circuit description The circuit of the microcontroller-based digital speedometer-cum-odometer is shown in Fig. 1. The functions of various components used in the circuit are described below. Microcontroller. A 20-pin AT89C2051 microcontroller from Atmel is used here because of its low pin count, affordability and compatibility with CISC-based 8051 family. All the available pins of the microcontroller are utilised in the project. This microcontroller features 2 kb of Flash, 128 bytes of RAM, 15 input/output (I/O) lines, two 16-bit timers/counters, a five-vector twolevel interrupt architecture, a full-duplex serial port, a precision analogue comparator, on-chip oscillator and clock circuitry. LCD module. To display the speed and distance traveled, we have used a 16x2 a l p h a n u m e r i c LCD based on HD44780 controller. The backlight feature of the LCD allows data to be visible even at night. The pin configuration and features of this LCD have earlier Fig. 2: Flow-chart of the program been published in several issues of EFY. S e r i a l EEPROM. The readings of the d i s t a n c e traveled are s a v e d i n an external serial EEP- ROM. Here, a 2 4 C 0 2 serial EEP- ROM based on Philips Fig. 3: Arrangement of reed switch and magnet on the front wheel of motor bike I 2 C protocol w w w. e f y m a g. c o m electronics for you N o v e m b e r 2 0 0 8 61

Parts List Semiconductors: IC1-7805 5V regulator IC2 - AT89C2051 microcontroller IC3-4N35 optocoupler IC4-24C02 EEPROM D1-1N4007 rectifier diode LED1-5mm light-emitting diode Resistors (all ¼-watt, ±5% carbon): R1-8.2-kilo-ohm R2-R6-10-kilo-ohm R7-330-ohm R8-1-kilo-ohm R9-47-ohm VR1-4.7-kilo-ohm preset Capacitors: C1-1000µF, 25V electrolytic C2-100µF, 16V electrolytic C3-0.1µF ceramic C4, C5-33pF ceramic C6-10µF, 16V electrolytic Miscellaneous: CON1-2-pin SIP male connector S1, S2 - SPST on / off switch S3 - Reed switch LCD1-16x2 EL1602 LCD module - 12MHz crystal X TAL1 Fig. 4: The materials required to build a PVC contraption Fig. 5: Reed switch and magnet fixed on the front wheel of motor bike is used. I 2 C bus protocol. The I 2 C bus consists of two active wires and a ground connection. The active wires, serial data line (SDA) and serial clock line (SCL) are bidirectional. Every device hooked up to the bus has its own unique address, no matter whether it is an MCU, LCD driver, memory or ASIC. Each of these chips can act as a receiver and/or transmitter, depending on the functionality. Obviously, an LCD driver is only a receiver, while a memory or I/O chip can be both transmitter and receiver. The I 2 C bus is a multi-master bus. This means that more than one IC capable of initiating a data transfer can be connected to it. The I 2 C protocol specification states that the IC that initiates a data transfer on the bus is considered the bus master. Bus masters are generally microcontrollers. Consequently, all the other ICs are regarded as bus slaves at that instant. Let s assume that the MCU wants to send data to one of its slaves. First, the MCU will issue a START condition. This acts as an attention signal to all of the connected devices. All ICs on the bus will listen to the bus for incoming data. Then the MCU sends the address of the device it wants to access, along with an indication whether the access is a read or write operation. Having received the address, all ICs will compare it with their own address. If it doesn t match, they simply wait until the bus is released by the stop condition. If the address matches, the chip will produce a response called acknowledge signal. We have used write operation in this project. Once the MCU receives the acknowledge signal, it can start transmitting or receiving data. In our case, the MCU will transmit data. When all is done, the MCU will issue the stop condition. This signals that the bus has been released and that the connected ICs may expect another transmission to start any moment. 6 2 November 2 0 0 8 electronics for you w w w. e f y m a g. c o m

Construction We have several states on the bus: start, address, acknowledge, data and stop. These are all unique conditions on the bus. In our project, the microcontroller is the master and the serial EEPROM is the slave. The readings are periodically stored in the EEPROM and the previous reading is retrieved from the EEPROM each time the bike is started. Speed sensor. For this project, we make use of a simple home-made speed transducer. The rotation of the wheel is sensed by the combined action of a reed switch and a magnet fixed on the wheel. The sensor sends a pulse to the microcontroller each time a revolution is made. Optocoupler. An optocoupler is used to counter the effects of bouncing when the contact of reed switch is closed. Power supply. The power supply for various parts of the circuit is drawn from the vehicle s 12V battery after reducing it to 5V using a three-terminal voltage. Software The Init_EEPROM and Speedo source codes of this project are written in Assembly language. These are compiled using an open-source ASEM-51 assembler to generate the Init_EEPROM.hex and Speedo.hex files. The hex files are burnt into the microcontroller chip. Two internal timers of the microcontroller are configured as 8-bit counters to count the number of pulses generated by the speed sensor. One timer is used to measure the distance and the other for speed calculation. A software delay of one second is generated after the speed counter is triggered. The speed count value is obtained from the counter registers. To speed up the process, a look-up data table is stored in the ROM that helps the microcontroller to convert the number of pulses into the corresponding speed values. The program flow-chart is shown Fig. 6: Speedometer-cum-odometer unit on a bike s handle bar in Fig. 2. The distance counter is incremented every 100 metres. The wheel has to make 53 revolutions to achieve this. The distance counter is loaded with an initial value of 203 (255-53+1) and is incremented on each revolution. After 53 counts, the timer overflows and generates an interrupt to notify the microcontroller that 100 metres are covered. In the interrupt service routine, the microcontroller updates the corresponding DS1 distance variable. Instead of saving distance variables after each cycle, the microcontroller saves these readings when the vehicle is at halt (speed is 00.0 km/hour). In other words, when the vehicle is stopped at traffic signals or before the ignition key is turned off, the last reading is saved to the EEPROM. The same reading is again retrieved from the EEPROM when the bike is turned on next time and the readings are updated for each trip. Construction The reed switch and a magnet need to be fixed on the front wheel of the motor bike (Hero Honda s Splendor). A small circular magnet (about 2 cm in diametre), normally used in speakers of small toys, can be used. Fix the magnet to the central drum of the wheel just below the spokes connected to the drum. Secure the magnet using hot glue or Araldite. For fixing the reed switch, a PVC pipe contraption needs to be made so that the magnet and reed switch are aligned as shown in Fig. 3. The materials required to build the contraption are shown in Fig. 4. Cut a 3.2cm diameter PVC pipe measuring 15.2 cm in length perpendicularly into two halves. Use only one half of the PVC pipe. Mount and secure the reed switch using Araldite and cable ties on the plastic handle (normally used in emergency lights). Once it dries up, solder two wires to the two opposite end leads of the reed switch. Fix the plastic handle on the half cut PVC pipe using screws. Now, place the pipe on the front shock-absorber fork such that reed switch faces towards the magnet. Connect a multimeter, set in continuity mode, to the two wires coming from the reed switch. Rotate the wheel slowly and see whether the reed switch closes when the w w w. e f y m a g. c o m electronics for you N o v e m b e r 2 0 0 8 63

Fig. 7: Actual-size, single-side PCB for the microcontroller-based digital speedometer-cum-odometer Fig. 8: Component layout for the PCB magnet passes across it. If it does, the multimeter will give a continuity beep. When the magnet moves away from the reed switch, the beep will stop, indicating that the reed switch is open. Make a few trials to find the optimal position for mounting and fixing the PVC pipe such that the reed switch works smoothly. Mark the location on the front shock-absorber fork. N o w y o u can fix the PVC pipe contraption to the shock-absorber fork using hot glue as shown in Fig. 5. Use liberal amount of hot glue to secure it to the pipe. Carefully route the two wires up to the bike s handle bar using cable ties to secure the wire. This completes the sensor mounting part. The main circuit and the LCD module can be housed in suitable plastic enclosures, which are readily available in electronic projects shops. These enclosures s h o u l d h a v e precut slot for easy mounting of the LCD panel. If such boxes are not available, you can use the plastic boxes of electronic chokes by suitably removing some portions for the LCD panel. Power supply can be taken either directly from the bike s 12V battery or tapped from the console which houses horn, headlight and indicator light switches. For this, you need to remove the switch console and identify positive wire and ground wire using a multimeter. When carrying out this step, remember to turn the ignition key to on position. Solder a 60cm two-core wire to the positive and negative terminals inside the switch console. The advantage of taking supply from the switch console is that the ignition key controls the power supply to the main unit without having a separate on-off switch. An actual-size, single-side PCB layout of the microcontroller-based speedometer-cum-odometer is shown in Fig. 7 and its component layout in Fig. 8. Testing After all the components are soldered on the PCB, program the microcontroller with Init_EEPROM.hex file and place the microcontroller in a 20-pin IC base and switch on the circuit. In the first line of the LCD, INIT_EEPROM appears. After five seconds, 00000.0 is displayed in the second line. This process erases any previous data and sets the initial readings in the EEPROM to zero. Now switch off the supply and program the microcontroller with speedo.hex main file. After programming, place the microcontroller back in the circuit and switch on the supply. The LCD will show Kms: 00000.0 in the first line and Speed- Kms/Hr: 00.0 in the second line. Now, the unit is ready to mount on your bike. Connect the two wires coming from the reed switch and the power supply wires to the main unit. Mount the unit at the centre of the bike s handle bar on top of the U clamps that secure the handle bar to the chassis. You can use cable ties to accomplish this. Mounting arrangement of the unit is shown in Fig. 6. Now start the bike, take a test ride and if connections are correct, the speed and the distance will be displayed on the LCD. A protective cover like polythene can be used for the main unit on rainy days. EFY note. The source codes for this article have been included in this month s EFY-CD. 6 4 November 2 0 0 8 electronics for you w w w. e f y m a g. c o m