Speedometer & Odometer

July 25, 2009 by admin
Filed under: Uncategorized 

Speedometer/ Odometer Using AT89S52 & AT24C04 with complete ‘C’ code

Picture showing Speed, Distance covered

Picture showing Speed, Distance covered

This is very useful project. This article tell you how to design your own digital speedometer for your motor bike.

Project is bulit using AT89S52 microcontrroller which is basically an 8052 derivative by ATMEL, The concept behind the project is that we can count the number of revolution of wheel by just putting a megnetic sensor like reed switch or hall sensor. First i generate a delay one second using sim[ple for loop technique with a crystal value of 11.0592 MHz.  I turn on the timer1 of AT89S52 for one second as counter and turned it off by pulling TR1=0. in this way i got the number of pulses coming in a second , which directly refelects tyhe speed in Km/sec or Mt/sec. This let you know the speed of your vehicle.

speedometer cum odometer by deveshsamaiya

Errata- Plz connect EA pin no. 31 to Vcc,and use Pull ups of 10K on I2C lines… it is not shown in Schematic

To make a digital Odometer i used a Non Volatile Memory EEPROM AT24C04 which has a storage of 4KB. EEPROM is used to store the total distance covered by the vehicle since the speedometer is installed. The content of  EEPROM is updated after every 100meter distance.

Total two timers of 8052 is used in the design.You can download the complete source code below. If yoiu have any queries or your speedometer/Odometer isn’t working contact me at devesh@electroons.com

DownLoad complete source code and schematic files here

DownLoad Datasheet of Serial EEPROM by Atmel

DownLoad I2C Specifications by Philips

Comments

34 Comments on Speedometer & Odometer

  1. AM Tahir on Fri, 2nd Oct 2009 2:21 am
  2. A use full schematic for education but there is not source code it will be batter if source code and assambler or compliler information will be attache with this schemaic
    Thank you

  3. admin on Fri, 2nd Oct 2009 2:35 am
  4. ok tahir…
    I think You have downloaded the rar file that file does not content the source code but you can download the tar.gz archive it has all codes

  5. Abdul Majeed Tahir on Sun, 11th Oct 2009 10:59 pm
  6. Hello,
    I need use 93C56 or 93C46 for this project,
    is this schematic and code is will also work for 93Cxxx
    |Thank you
    AM Tahir

  7. Torq on Mon, 19th Oct 2009 4:02 pm
  8. Man, this is awesome job. I just look speedometer like this. I will look cool on my CBR. 10q

  9. avinash on Mon, 9th Nov 2009 2:48 pm
  10. It is very good project to work on. it will enhance our working with electronics components.
    but their is no pcb layout of this project is attached with this file.

  11. avinash on Mon, 9th Nov 2009 2:49 pm
  12. i want to see its PCB layout.

  13. admin on Mon, 9th Nov 2009 3:23 pm
  14. i tested this project successfully on general purpose PCB and it worked fine…for robustness..you can design your own…

  15. yogesh on Sat, 14th Nov 2009 1:42 am
  16. i wnt 2 reset my digital speedometer can u help me.

  17. yogesh on Sat, 14th Nov 2009 1:58 am
  18. how 2 change odometer reading .

  19. admin on Sat, 14th Nov 2009 2:55 am
  20. you can reset the reading to zero by pressing the push button at P1_4 pin if you are using my code. Just short the P1_4 for a moment and your distance reading will start from zero again.

  21. ciprianno on Mon, 16th Nov 2009 7:47 pm
  22. This is a very interesting project.I will try to build this speedometer-odometer for my car.
    I’m a beginner in AVR programing, and i don’t now very well to modify the source code .
    What i need to modify in the program for my car – the whell radius is around 31.8 cm at 100 cm circumference?
    And another question, how to count and display a total trip km in five digit – like this 99999 km?
    Thanks alot!

  23. admin on Tue, 17th Nov 2009 12:36 am
  24. ok ill try to mail you the modified code, with 5 digit display.

  25. ermes on Tue, 17th Nov 2009 6:55 pm
  26. This board could working only at odometer, on two lines display?
    In the attach files is the .hex of the microcontroller but i can’t find program for EEPROM, only a .C file, how to convert this file in .hex?
    I tried with AVR STUDIO but appears many errors .

  27. ciprianno on Wed, 18th Nov 2009 4:51 am
  28. Thank you very much.
    Errata : My circumference of wheel is aound 100 cm, and the radius is 15,5 cm .
    One rotation of wheel is one meter trip.

  29. admin on Wed, 18th Nov 2009 7:47 am
  30. @ermes.
    AVR studio wont work this project is on AT89S52 which is 8051 derivative, use Keil or SDCC for this program. And you just connect EEPROM as per connection diagram given , No need any separate File for eeprom. Controller will itself address the memory.

  31. ermes on Wed, 18th Nov 2009 8:58 am
  32. Ok. Thank’s. I will try with one of this programs.
    It is possible that this circuit to work only like a odometer or a speedo?

  33. ciprianno on Wed, 18th Nov 2009 9:10 am
  34. The AT89S52 is compatible with AT89S8252?
    I ask because my ISP programmer work only with PonyProg, and PonyProg has only AT89S8252.

  35. admin on Wed, 18th Nov 2009 9:15 am
  36. No Ponyprog will not program AT89S52. use this
    http://www.kmitl.ac.th/~kswichit/cheapcable/

  37. ciprianno on Mon, 23rd Nov 2009 1:56 pm
  38. I have problems with microcontroller. After switching off and turn on again, the display wont work, appear o single line. If i re-write the micro, the problem dissapear but reapper after turn off power suplly and put on agin.

  39. admin on Mon, 23rd Nov 2009 4:29 pm
  40. have you made the power on RC reset circuitry properly?? If so check whether EA/Vpp is connected to Vcc or not.

  41. ciprianno on Sun, 29th Nov 2009 7:42 am
  42. Yes , I made properly all circuits.
    After turn off the power supply the micro won’t work, i need to rewrite-it every time.
    I don’t now what’s happening.

  43. abhinav on Mon, 7th Dec 2009 9:37 am
  44. thanks sir………….that was fantastic project……..
    what should i need to do in program if my car’s wheel have 151.6 cm circumference
    and radius is 48.26 cm……?
    pls sir reply as soon as possible.
    my email id is abheenav911@gmail.com

  45. abhinav on Mon, 7th Dec 2009 9:40 am
  46. and i am using at89s52.

  47. yamuna on Mon, 11th Jan 2010 10:12 am
  48. This is a great project for beginners. we’ve taken this as our major project. So could you please tell us what changes have to be made for at82c2051 and eeprom 24c02

  49. yamuna on Mon, 11th Jan 2010 10:14 am
  50. arun on Fri, 12th Feb 2010 11:36 pm
  51. can you please tell which software is used to program this ic.also can you give the schematic for implementing in PIC

  52. admin on Tue, 16th Feb 2010 6:08 am
  53. i used ASIM’s ISP loader to program IC. No i dont work on PIC till now

  54. Fransiskus Eko on Tue, 11th May 2010 11:43 pm
  55. ” Thanks for your knowledge-share, and I hope You can give me more info about code or website sources, to make me feel fully about microcontroller especially 8051 in c programming “. Bless You all

  56. admin on Wed, 12th May 2010 2:29 am
  57. prabhat on Sat, 22nd May 2010 4:49 am
  58. i need the programming of speedo meter cum odo meter

  59. Uttam Dutta on Fri, 18th Jun 2010 7:23 am
  60. It is very interesting and useful project.
    I have two specific question
    (1) if we omit 12C Eprom (hardware wise) will LCD show running speed or it will produce error (in that case I don’t wish to see the total distance covered by the vehicle
    (2) Is this circuit will produce reliable and stable stable speed or rpm in lower as well as higher speed or rpm ?
    (3) I am not able to understand the speed calculation part, it needs the diameter of the wheel
    One pulse will be equal to “∏ X d” cm (if dia. expressed in cm.) Then where rhe rpm counting and Km/hr counting in the program.

    Please reply
    Regards,
    Uttam Dutta

  61. tibbu on Mon, 12th Jul 2010 8:51 am
  62. what is the purpose of showing “240″ at the end of first row of LCD ??

  63. admin on Tue, 13th Jul 2010 7:21 am
  64. its showing the timer counter status..this project is not ready to use as speedometer you must be aware of 8051 programming to customize it according to your needs…

  65. Amit on Thu, 22nd Jul 2010 8:40 pm
  66. How to auto increment the write locations(without page write) in eprom. How to check whether memory is full or not ? And how to read from eprom in your project. Can you post the code or example for the three cases.

Tell me what you're thinking...
and oh, if you want a pic to show with your comment, go get a gravatar!





Anti-Spam Protection by WP-SpamFree