Simple ebike 'fuel gauge'

Get all your technical information about electric bikes here.
User avatar
Jeremy Harris
10 GW
10 GW
Posts: 4568
Joined: Oct 23, 2007 4:15 pm
Location: Salisbury, UK

Re: Simple ebike 'fuel gauge'

Post by Jeremy Harris » Nov 08, 2010 4:49 pm

I'd suggest using the LM3914 rather than the 3915, as the 3914 has a linear response. I'm pretty sure the 3915 has a logarithmic response and is intended for VU meters.

You used to be able to get these chips bonded to a small bargraph display, which made them nice an easy to use. As far as I can recall they worked well, I think the only downside if the relatively high current they draw, which may present a problem if powering the meter from the controller +5V supply.

There are some nice LED arrays you can use with the 3914 chip. These look interesting: http://www.ledtronics.com/products/cat3.aspx?P=C60D59

Jeremy
Please ask questions on the forum, rather than by PM, as it helps others and you'll get a better range of answers.

User avatar
gwhy!
100 kW
100 kW
Posts: 1230
Joined: Jan 13, 2009 8:32 am
Location: UK, Bristol

Re: Simple ebike 'fuel gauge'

Post by gwhy! » Nov 08, 2010 5:20 pm

Thats wierd, when I was looking earlier at the farnell site today the chip I was looking at was ( Im sure ) the 3914 but when I looked for bargraph drivers when I got home the 3915 was the only one that came up at under £2, The one I found eariler when I was looking was £1.70... Jeremy your quite right, a log response would not be any good .
:? Just went on the farnell site again and got different results again.. whats that all about :D

Edit:
Yes the current driving the leds would be quite high, But the nice thing about these chips they will operate in dot mode or bar mode, so if run in dot mode this will keep current down to a minimum.

Edit:
Ok I just found it again in farnell ( I thought I was going mad :shock: ) £1.77 http://www.farnell.com/datasheets/9057.pdf This is the one LM3914 ( it was under led driver catagory and not under led bargraph drivers )

heathyoung
1 MW
1 MW
Posts: 1670
Joined: May 27, 2009 2:01 am
Location: Newcastle, Australia

Re: Simple ebike 'fuel gauge'

Post by heathyoung » Nov 08, 2010 6:56 pm

Farnell (or element14 as they call themselves now) have a very poor search engine, and very weird pricing (for identical components sometimes 50% difference - even with the same manufacturer and type!)
GNG offroad build on Craftworks DHR with 12S2P lipo. Light, balanced, powerful, able to climb a tree.
Project Vectrii (2) - status - Finished. Nope. 38S Leaf cells are next. Now have 2 of them - Averages 50Wh/Klm

keyne
100 W
100 W
Posts: 202
Joined: May 18, 2009 8:58 pm
Location: New Zealand

Re: Simple ebike 'fuel gauge'

Post by keyne » Nov 08, 2010 11:18 pm

you could swap the ina122 for a ina199 to allow for regen if you needed it.

User avatar
Jeremy Harris
10 GW
10 GW
Posts: 4568
Joined: Oct 23, 2007 4:15 pm
Location: Salisbury, UK

Re: Simple ebike 'fuel gauge'

Post by Jeremy Harris » Nov 09, 2010 3:15 am

keyne wrote:you could swap the ina122 for a ina199 to allow for regen if you needed it.
Not quite, as the CM range for the 199 only goes down to -.3V and the shunt can see peaks that are higher than this at peak regen current. The other snag is that the circuit as it stands is unidirectional.

The easy way to make it regen capable is to just remove the INA122 and replace it with one of the LEM sensors. These have a nice, bidirectional output that is already conditioned, so it will interface directly to the A/D port with no need for any extra gain. I gave the circuit I used for making a watt meter using one of these here: https://endless-sphere.com/forums/viewto ... 15#p319318 and some photos of a unit I built using it here: https://endless-sphere.com/forums/viewto ... ay#p219880

For those looking to use the LM3914 display chip, I've spotted this PCB that might be an easy way to make a display module: http://cgi.ebay.com/10-LED-Bargraph-dis ... 3474947226

Jeremy
Please ask questions on the forum, rather than by PM, as it helps others and you'll get a better range of answers.

User avatar
marty
10 MW
10 MW
Posts: 2002
Joined: Apr 19, 2007 5:44 pm
Location: Buffalo, New York USA
Contact:

Re: Simple ebike 'fuel gauge'

Post by marty » Nov 10, 2010 9:37 am

Jeremy Harris wrote:......There's a reset button on the controller that if pushed at power on resets the gauge to 'full'......
Jeremy
Cycle Analyst works the same way, I copy from http://ebike.ca/drainbrain/CycleAnalyst ... Vers22.pdf
1.2 Resetting
After you have recharged the battery pack, you should reset the trip
statistics (Ah, Distance, and Time) to clear them all to zero. This is
done by pressing and holding the right button for 1 second, until the
message “Reset” shows up across the display.

My cell phone has no reset button for the battery fuel gauge. My laptop has no reset button for the battery fuel gauge. My Bionx Electric Bicycle has no reset button for the battery fuel gauge. I would like for my Electric Bicycle Project # 2 to have no reset button for the battery fuel gauge.

See picture of The BionX Console
Image

Still unfinished Electric Bicycle Project # 2 will use a GBP Battery Co / 48V 20Ah Li-ion battery.

Will this work with my battery? I don't care if it is not real accurate.
Curtis Model 906 Battery Discharge Indicator

http://www.curtisinstruments.com/index. ... y&catID=15
Image
Data Sheet
50020_906_RevH3[1].pdf
Data Sheet
(5.83 MiB) Downloaded 109 times
Manual
53015_906_Manual_Rev_F[1].pdf
Manual
(404.4 KiB) Downloaded 96 times
D E S C R I P T I O N
Model 906 is an inexpensive, one piece, easy to install
battery fuel gauge. It is completely solid state and provides
a reliable, accurate, and easy to read display of battery
state-of-charge. Model 906 is available in six panel mount
packages and a printed circuit board mounted module for
custom dash panel applications.

A P P L I C A T I O N
This battery fuel gauge features Curtis patented technology
and is ideal for golf cars, commercial cleaning equipment,
mobility aids, electric bicycles, electric marine motors,
medical devices, and similar equipment.

• Three possible reset methods:
1. Open Circuit Reset (OCR): Upon reconnection of a
battery the gauge will reset if it measures 2.09 volts/
cell or higher (example “B” profile) (for units with
memory option).
2. High Voltage Reset (HVR): Gauge must measure
>2.35 volts per cell for 6 continuous minutes during
charging (example “B” profile).
3. Charge Tracking Reset (CTR): Display tracks charge
level during opportunity charging (requires gauge to
be connected to battery when charging).
MARTY
Volt Electric Vehicles
http://www.voltev.com

User avatar
Jeremy Harris
10 GW
10 GW
Posts: 4568
Joined: Oct 23, 2007 4:15 pm
Location: Salisbury, UK

Re: Simple ebike 'fuel gauge'

Post by Jeremy Harris » Nov 10, 2010 10:57 am

The Curtis gauge only works on lead acid batteries and is really only a logging voltmeter - it only measure pack voltage and uses this to guess the remaining capacity. This sort of works for lead acid, because the terminal voltage is a reasonable indicator of state-of-charge, but unfortunately doesn't work with lithum cells, where the voltage can stay virtually constant through the main part of the discharge cycle.

If you want reset on full charge then I think the code could be adapted to do it easily enough. What's needed is a reliable indication of full charge, which means taking a bunch of measurements of a pack to see how the terminal voltage comes up to maximum over the charge cycle and then deciding on a foolproof way to determine this (something like a test for 'has the pack been over 4.15V per cell for ten minutes?' might do the job. It also means that the unit needs to be on when the pack is charging, so that it can detect full charge and reset itself.

Jeremy
Please ask questions on the forum, rather than by PM, as it helps others and you'll get a better range of answers.

John in CR
100 GW
100 GW
Posts: 13760
Joined: May 20, 2008 12:58 am
Location: Paradise

Re: Simple ebike 'fuel gauge'

Post by John in CR » Nov 10, 2010 11:45 am

Something I thought and forgot to post earlier is that Jeremy's early retirement is a great thing for ebiking, so thank you Jeremy from all of us. I can't wait to see the other nagging issues that get resolved. If someone decides to make a go at producing these to sell with a price below $30/ea I'll commit to buy 5 or 10.

Alternatively if the parts price is really low I can find someone locally to make a bunch of them. Skilled labor is quite cheap here, and there are lots of electronics repair shops, because things get repaired here instead of just thrown away and recycled like in the US, so finding someone should be easy.

I found out yesterday that one exception is suspension forks. Unless it's a normal servicing type repair, they send them directly to the metal recycler. Hopefully I can pick some up with breaks in the dropouts that I can recycle into good ebike forks for 2wds.

John

User avatar
Jeremy Harris
10 GW
10 GW
Posts: 4568
Joined: Oct 23, 2007 4:15 pm
Location: Salisbury, UK

Re: Simple ebike 'fuel gauge'

Post by Jeremy Harris » Nov 10, 2010 11:57 am

Thanks John, just give me a gentle nudge if I start posting too much................. :D

I'm stuck waiting for stuff for the new bathroom to arrive at the moment, so have time to tinker, but come this time next week I suspect I'll be otherwise occupied.

I like the idea that there are still places in the world where they repair stuff. It really pains me to throw anything away, especially if it has parts that can be re-used, or if it can be repaired. SWMBO just throws things away for the most trivial of reasons, which means I have to keep a watchful eye on the bins and go and rescue anything that might come in handy. The snag with this is that I have an attic and workshop full of stuff that 'may come in handy' and upwards of half a dozen projects on the go at any one time.

I wish I were more interested in production of stuff, but I never have been. Once I've got something working I like to move on to another project, rather than spend time manufacturing more of them.

Good news about the local fork situation - you might be able to set up a Costa Rican used sus fork export business....................

Jeremy
Please ask questions on the forum, rather than by PM, as it helps others and you'll get a better range of answers.

John in CR
100 GW
100 GW
Posts: 13760
Joined: May 20, 2008 12:58 am
Location: Paradise

Re: Simple ebike 'fuel gauge'

Post by John in CR » Nov 10, 2010 1:17 pm

You posting too much isn't possible. I love learning new stuff. ES is like e-bike university and there's so much interesting stuff going on that there's no dead time to bicker, so more than any online community I've seen people generally get along wonderfully. At least that's the explanation I've come up with. 8)

John

User avatar
Jeremy Harris
10 GW
10 GW
Posts: 4568
Joined: Oct 23, 2007 4:15 pm
Location: Salisbury, UK

Re: Simple ebike 'fuel gauge'

Post by Jeremy Harris » Nov 10, 2010 2:21 pm

Thanks again, John. Like you, I'm pleasantly surprised as to how well everyone gets on here. Other forums I've been on over the years have usually had fairly regular bouts of flaming, here we rarely seem to have anything other than the odd technical disagreement.

Back on topic, I ran the battery down on the folder to the point where the gauge was showing five 'bars', which should mean that I'd used between about 4 and 4.5Ah from the pack. I've just finished charging the pack and it took 4.2 Ah before the charger cut-off.

As an aside, as a newcomer to LiPo I am pleasantly surprised at both the performance of these cheap Zippy cells and the way they stay in balance. I plugged the Cellog into the pack before I charged it and it showed a maximum cell-to-cell imbalance of just 12mV, much better than the Headways I've been using for the past couple of years.

Jeremy
Please ask questions on the forum, rather than by PM, as it helps others and you'll get a better range of answers.

User avatar
spinningmagnets
100 GW
100 GW
Posts: 10719
Joined: Dec 21, 2007 10:27 pm
Location: Ft Riley, NE Kansas

Re: Simple ebike 'fuel gauge'

Post by spinningmagnets » Nov 10, 2010 3:18 pm

"Plus one" on what John said, I will commit to buying 2 at any price under $30 ea (cash up front, to buy the parts). AmberWolf expressed 'some' interest, perhaps if others chimed in with enough commitments to make a batch? I would be glad to do it myself, but I am a caveman with electronics and would certainly ruin the first batch.

Edit: What I mean is, after I ruined the first batch, I wouldn't know where to start to find out exactly what part I had screwed up...

Once I had a working sample in-hand and one to dissect, it might be a different story...(I finally bought a soldering iron)

And...thanks again Jeremy, for starting this thread.
Last edited by spinningmagnets on Nov 10, 2010 6:40 pm, edited 1 time in total.

User avatar
gwhy!
100 kW
100 kW
Posts: 1230
Joined: Jan 13, 2009 8:32 am
Location: UK, Bristol

Re: Simple ebike 'fuel gauge'

Post by gwhy! » Nov 10, 2010 4:34 pm

Same here Jeremy,
You have been a great asset to this forum.

I finally have some picaxe chips to play with :mrgreen: ...

Dependant on how I get on ( the design may change slightly for my purposes ( I need a few more functions ) but it will also contain the original function of Jeremy's ) and time permitting. I will be willing to make extra pcb's to send out to peeps as a one off along with a programmed chip should anyone want it , but this will be at least a few weeks away yet ( maybe not even until after Christmas ).

User avatar
amberwolf
100 GW
100 GW
Posts: 23922
Joined: Aug 17, 2009 6:43 am
Location: Phoenix, AZ, USA, Earth, Sol, Local Bubble, Orion Arm, Milky Way, Local Group
Contact:

Re: Simple ebike 'fuel gauge'

Post by amberwolf » Nov 10, 2010 10:22 pm

Jeremy Harris wrote: What's needed is a reliable indication of full charge, which means taking a bunch of measurements of a pack to see how the terminal voltage comes up to maximum over the charge cycle and then deciding on a foolproof way to determine this (something like a test for 'has the pack been over 4.15V per cell for ten minutes?' might do the job.
If there is a BMS on the pack that has an HVC signal for end-of-charge, you could use that signal for reset, but that would (like the current method of setting capacity for the meter) be an individual-bike way of doing things, and fairly DIY.

User avatar
GrayKard
10 kW
10 kW
Posts: 585
Joined: Jul 15, 2009 8:27 pm
Location: San Antonio, Texas USA

Re: Simple ebike 'fuel gauge'

Post by GrayKard » Nov 13, 2010 11:11 pm

gwhy! wrote:Same here Jeremy,
You have been a great asset to this forum.

I finally have some picaxe chips to play with :mrgreen: ...

Dependant on how I get on ( the design may change slightly for my purposes ( I need a few more functions ) but it will also contain the original function of Jeremy's ) and time permitting. I will be willing to make extra pcb's to send out to peeps as a one off along with a programmed chip should anyone want it , but this will be at least a few weeks away yet ( maybe not even until after Christmas ).
I've been following this thread with interest. An easy to read fuel gauge is just what I need. I have to wear reading glasses so when I'm on the bike I can't make out the turnigy info on the fly I have to stop to read it.

Put me down for at least one please. :D

Gary

NRG
10 mW
10 mW
Posts: 20
Joined: Oct 26, 2009 12:29 pm

Re: Simple ebike 'fuel gauge'

Post by NRG » Nov 17, 2010 4:28 am

This is such a neat idea Jeremy I decided to give it a go. I've had to lay the cct out on some strip board so its not as neat as your layout but I think it'll fit inside the controller still. Circuit wise I'm OK with for building but I'm having a devil of a job programming, well actually, communication with the Picaxe-08M.

I'm not sure what I'm doing wrong. I've read the manual, used the serial input resistor network and made sure Tx/Rx from the Silicon Labs CP210x USB UART device I'm using are going to the correct in / out on the -08M but still no comms.

I've tested the USB bridge via Hyperterminal, linking Rx/Tx and characters are echoed back and with local echo on I get two for every key-press so I know its working. I've tried the E-Crazyman cable, same issue.

In the s/w I've selected the correct Picaxe at 4Mhz, the comm port and also followed the on-screen test.....but here is where it gets interesting. The blurb on how to test says the voltage on serial in should be between 0v and -1v and toggling the 'screen LED' should change this....well, I'm reading 3.3v on serial in which drops to 0v when the LED is toggled.......I also see this when I attempt to programme the Picaxe.

Can't think of what else to try....I even bread boarded the device with the programming cct to make sure I'd not mucked up the strip board layout but the issue remains.

sjacome
10 mW
10 mW
Posts: 30
Joined: Oct 23, 2009 6:34 pm

Re: Simple ebike 'fuel gauge'

Post by sjacome » Nov 17, 2010 8:44 am

hi there. nice post jeremy, fuel gauge is a cool ebike gadget.

Those picaxe's can be a powerfull cheap tool if used right.

I recomend interested people to check maxim-ic power management products - they have fuel gauges (some with coloumb counters), battery monitors and protectors IC's.

Just register in their website and start ordering free samples!!! great support from tech team and explicit datasheets!!

I got lot's of IC's from them - RTC's, digital temperature sensors, 8 segment led display controllers, lipo battery chargers etc... all free and no problems with spam or other anoing stuff (got sample supercaps from copper-bussman and they are a pain in the ....)

If u master TWI - two wire interface u can easily design a complete battery management solution with maxim-ic products.

They are even developing a high power brushless controler IC but no datasheet available yet (its only for credited developers) but some guys like doctorbass and alike surely will have it if email them.

keep up the good work

NRG
10 mW
10 mW
Posts: 20
Joined: Oct 26, 2009 12:29 pm

Re: Simple ebike 'fuel gauge'

Post by NRG » Nov 17, 2010 9:40 am

OK got it working, neither of the two USB to serial devices I had operated correctly.

Luckily I had in my spares box an old USB to DB9 converter from Belkin I think that uses the Prolific chip set. Using a Female DB9 I was able to connect to the Picaxe chip and testing the comm port gave -0.5v to 5v on toggle of the screen LED. Simple test program from the manual works and flashes the LED on my bread board....now to to try my cct on the strip board.....

NRG
10 mW
10 mW
Posts: 20
Joined: Oct 26, 2009 12:29 pm

Re: Simple ebike 'fuel gauge'

Post by NRG » Nov 17, 2010 3:26 pm

Jeremy, what resistor values did you use for the meter PD? Thanks.

User avatar
Jeremy Harris
10 GW
10 GW
Posts: 4568
Joined: Oct 23, 2007 4:15 pm
Location: Salisbury, UK

Re: Simple ebike 'fuel gauge'

Post by Jeremy Harris » Nov 17, 2010 3:31 pm

NRG wrote:OK got it working, neither of the two USB to serial devices I had operated correctly.

Luckily I had in my spares box an old USB to DB9 converter from Belkin I think that uses the Prolific chip set. Using a Female DB9 I was able to connect to the Picaxe chip and testing the comm port gave -0.5v to 5v on toggle of the screen LED. Simple test program from the manual works and flashes the LED on my bread board....now to to try my cct on the strip board.....
Glad you got it sorted. I guess I was lucky as the USB-serial converter I have uses the Prolific chip.

I'm impressed with the Picaxe as an easy way to get into playing with microcontrollers, although they are limited by using integer math only, being a bit slow and not having a great deal of programme storage space.

NRG,

I can't recall off the top of my head, but I know I needed to get the meter voltage down to just less than 1V for around 4.5V or so output from the PWM D/A converter. You could just fit a trim pot of around 50k or so to the output and adjust it to just get full scale with the full capacity PWM rate being outputted.

Jeremy
Please ask questions on the forum, rather than by PM, as it helps others and you'll get a better range of answers.

User avatar
gwhy!
100 kW
100 kW
Posts: 1230
Joined: Jan 13, 2009 8:32 am
Location: UK, Bristol

Re: Simple ebike 'fuel gauge'

Post by gwhy! » Nov 17, 2010 6:03 pm

I finished my display for the meter, I used a 10 bar led with driver and using it in dot mode. As I wanted to also monitor the lipo voltage ( as a backup ) I had a couple of these kicking around:
batt-monitor-6S.jpg
batt-monitor-6S.jpg (36.54 KiB) Viewed 1890 times
So I thought I would add this in the mix I removed the buzzer and have used the on board leds as backlights for the bar led 8) , for anyone who dont know what these bat monitors do , it shows a steady blue light, flashing blue, steady red then flashing red dependant on the lipo voltage. I will post some pics up tomorrow of the finished display. Total cost of parts with the lipo monitor was about £8, the led driver chip and bar leds were very easy to put together for anyone who wants to go down this route.

User avatar
gwhy!
100 kW
100 kW
Posts: 1230
Joined: Jan 13, 2009 8:32 am
Location: UK, Bristol

Re: Simple ebike 'fuel gauge'

Post by gwhy! » Nov 18, 2010 3:43 pm

Here are some pics of my dot display and the box that it will be going into:
dot volt meter chipless.jpg
dot volt meter chipless.jpg (102.87 KiB) Viewed 1907 times
dot volt meter1.jpg
dot volt meter1.jpg (70.59 KiB) Viewed 1907 times
dot volt meter lit.jpg
dot volt meter lit.jpg (53.88 KiB) Viewed 1907 times
The box is a bit tatty but when its lit up it looks really cool, like I said in my previous post the bar display is backlit from the tiny lipo monitor, blue and red 8) .
small display boxed.jpg
small display boxed.jpg (78.49 KiB) Viewed 1906 times

NRG
10 mW
10 mW
Posts: 20
Joined: Oct 26, 2009 12:29 pm

Re: Simple ebike 'fuel gauge'

Post by NRG » Nov 19, 2010 3:15 am

I've managed to finish my version of Jeremy's battery meter but it may not fit inside the controller. All seems to work but I've not yet fitted it to the bike.

Jeremy, is there any calibration needed for the shunt? Also, the reset switch clears NVRAM for the accumulated Ah? and lastly what is amps cause full scale meter deflection? Is it 30? Just wanting to see if I understood your notes in the programming, many thanks....I will post some pics when I *know* its working!

Oh, BTW I settled on 62K / 18K for the PD in the meter box, I had worked out 68K / 18K but the -08M was only outputting 4v not 4.5...

Many thanks.

User avatar
Jeremy Harris
10 GW
10 GW
Posts: 4568
Joined: Oct 23, 2007 4:15 pm
Location: Salisbury, UK

Re: Simple ebike 'fuel gauge'

Post by Jeremy Harris » Nov 19, 2010 3:40 am

NRG,

You may need to adjust some values if the shunt isn't as accurate as it could be. I worked on the basis of the shunt being about 5mohm, using measured values of current through the one on my controller board to get an example A/D value for the current. One small error can come from the +5V supply, as the A/D in the Picaxe uses the supply as a reference. If your controller +5V supply is off then you may need to adjust values.

The current display is set for 30A max on mine.

gwhy,

That display looks neat and has the overwhelming appeal of being much cheaper than the meter I used. The one thing to watch is that the low battery indication method I used (driving the meter into overload mode by applying more than 1V to it) may not work with the bargraph, so may need to be disabled or modified in the code. I like the idea of including the LVC warning in the meter.

Jeremy
Please ask questions on the forum, rather than by PM, as it helps others and you'll get a better range of answers.

User avatar
otas
1 W
1 W
Posts: 50
Joined: Nov 10, 2010 6:30 pm

Re: Simple ebike 'fuel gauge'

Post by otas » Nov 22, 2010 3:16 pm

I would like to register my interest in making this fuel gauge meter. I hope that I have something positive to bring to this group/concept. I can make a small batches of thingymigics. Hope it is not like taking coal to Newcastle, with so many interested parties. I have had the LED bar display in my plane as a MAC trim position display. I did not like it for two reasons. Poor visibility in the sun and relative small dimensions. I made discrete LED display of the trim and electric flap position indicator. I preffer spacing of the individual LEDs with gaps, to achieve registration in the peripheral vision rather than the need to look at it directly. And I use the Picaxe in some of my light strobe devices.

So here is an outline of my concept:
1. discrete multicolour 10 LED dispaly of the current - green, yellow, red
2. discrete multicolour 10 LED display of the power remaining - green, yellow, red
3. separate yellow LED to indicate less than 10% power remaining
4. reset button to press after the battery charge
5. 4-6 wire connector RJ11 or RJ14
This would be mounted in a small box say 50x50x20mm or 50x80x25 on handlebars with wire going to the battery/controller.
The Voltage would be selected by option link to say 24, 36, 48 and 72V with trimpot for a fine adj.
The Current gain will have trimpot for the max. scale adjustment.

There will be a separate current shunt inserted in the battery connection to reduce the DIY demand to tap the existing controller shunt. The purists, who would not like to loose some 0.15V on the external shunt will be able to solder sensor wires directly onto the controller shunt. This way the need for a programming the Picaxe chip would be minimised and the final configuration easily done DIY.

I would appreciate your comments to the general concept, what to add, or take away.
I am not very fast, and I have already few projects going on, so I cannot promise to have it ready yesterday.
otto

Post Reply