Author Topic: Dashboard display for electric scooter  (Read 5763 times)

jimkirk

  • Newbie
  • *
  • Posts: 6
Dashboard display for electric scooter
« on: September 04, 2013, 08:21:01 pm »
I have a Zuumcraft electric scooter http://zuumcraft.com/.  I recently upgraded the battery (from 51 volt 10 Amp-hour Lithium Ion to 51 volt 15 Amp-Hour LiFePO4) and wanted to be able to monitor the state of charge to estimate the range. 


Used a Digispark and the LCD shield as the heart of the system.  A simple resistor divider on the 51 volt battery into an ADC gives good enough accuracy for my needs.  Being a Lithium Iron Phosphate battery, the voltage versus state of charge is very non-linear.  After characterizing the battery discharge characteristics with an electronic load, I used a great free program called Eureqa to fit a simple function to the data.    http://creativemachines.cornell.edu/eureqa


The display is zero to 16 asterisks to display the "fuel" gauge as a simple bar graph.


With an entire line left in the display, why not add a speedometer and odometer?


I used a Melexis Hall effect gear tooth sensor http://melexis.com/Hall-Effect-Sensor-ICs/Special-Purpose-Hall-ICs/MLX90217-3.aspx to detect some cut-outs in the brake disk and converted counts to distance.  Measuring the time period using pulseIn(HIGH) plus pulseIn(LOW) gives the speed and accumulating the number of pulses gives the distance after appropriate conversion factors for wheel size.


Every so often I save the odometer count to EEPROM so the distance isn't lost when power is removed.  When power is re-applied I read the EEPROM plus half the save interval so on average no distance is lost.  With the 100K write/erase cycle life it should last over 10,000 miles.  Also added a reset button, and since the DC/DC converter I use for power puts out 2 amps at 5 volts, I even added a USB 1 amp charging port so I can power a smart phone mounted next to it and have Google Maps displayed.

I built a case by layering 3 mm thick laser cut plexiglass, same for the mount for the Hall sensor.  The main unit clamps on to the handle bar.  The picture don't show up too well, since I used black plexi, but you can make out the display area and button on the main unit in the photo.

I think it turned out pretty nice, the Digispark made for a compact size and inexpensive, and the code uses 5,948 bytes out of 6,012.


digistump

  • Administrator
  • Hero Member
  • *****
  • Posts: 1465
Re: Dashboard display for electric scooter
« Reply #1 on: September 04, 2013, 10:04:13 pm »
Nice work! I love how nice this looks in the case - and the use of the EEPROM - people are too careful with the EEPROMs in my opinion - they are quite durable!

defragster

  • Sr. Member
  • ****
  • Posts: 467
Re: Dashboard display for electric scooter
« Reply #2 on: September 04, 2013, 11:58:54 pm »
 Nice work indeed.  Good to know the 10K EEPROM writes are generous and stable to count on.
 Funny how code has bloated since computers ran on (2) 360KB floppies! Having taught myself TRS-80 basic, my first job out of school was interpreted gw-basic in 64KB - had to delete comments to finish the task of recording penicillin powder weights as well as showing bar graphs etc on the PC and a remote washable RS-232 terminal in the fill room.  Still haven’t forgotten my first review … “Poor commenting”.  Luckily this is compiled and comments go away.
 I’m just finding Arduino since my wife the Librarian had it come up as a teen activity.  Library book “Arduino Workshop” showed up today and having seen this forum entry page 3 caught my eye with a gold embossed version of this running on an internal combustion engine powered Duemilanove.
 http://makezine.com/2010/07/01/arduino-based-scooter-computer/
 

Bluebie

  • Sr. Member
  • ****
  • Posts: 486
Re: Dashboard display for electric scooter
« Reply #3 on: September 11, 2013, 07:18:18 pm »
Yes, the 100k writes for eeprom is the bare minimum atmel promises. Usually you can write at least one million times before you get a single bit of the eeprom fail to work. I suggest this: Write the odometer value over the entire eeprom, repeatedly, then when you read it on startup, go through the eeprom reading each value, and once you see the same value repeated three times, consider that the correct one. Then once a bit fails, it is unlikely to fail in the same position in the following few bytes again, so it is likely the program will skip past the bad words and continue on using good bits until the entire eeprom is destroyed - This should make the life of the eeprom be very very long indeed.


Flash drives in computers similarly detect broken bits and move data around them, to boost the life of the drive quite a lot. The flash memory chips are only rated for about 10k, but by having a few spare gigabytes to transplant in on top of broken bits, they've made flash drives practical. ^_^