Jump to content

Battery voltage display for charge port


esaj

Recommended Posts

A small (yet another ;)) side-project I decided to do this evening: voltage display that attaches to the charge port of the wheel and powers itself from there. Only works with BMSs that do not have the protection diodes on the charging side, should you want to build one for yourself, you can check with a multimeter, if you don't get a voltage reading between any of the charge port pins, this won't work.

So, I like to see the battery voltage when riding, as it's better indicator (in my opinion) of the battery charge state than the percentage and/or led-bar -based displays. The problem is, the voltage of the battery is high (typically between 47-67.2V), and most of the small "off-the-shelf" -voltage meters are either the "self-powering" -type (2-wires), which draw their own power from the measured line, but will burn somewhere above 35V or so (and shut off somewhere lower than 4V, but that wouldn't be an issue with the batteries ;)). I opted for the typical 0-100V DC -displays you can find from ebay/aliexpress/amazon, but they require their own separate power (4-32V or somewhere like that). Using higher voltage they'll again burn. So the voltage needs to be regulated down to the level that can be used to power the display. There are buck-converters (switching converters) that can bring down the voltage, but they're more costly for high voltages (the cheaper ones again won't work above 35V or 40V input voltage) and take up space (not much, but still a bit "too much"). Enter TL783, a high voltage linear regulator:  http://www.ti.com/lit/ds/symlink/tl783.pdf

It only needs a few components around it (at best, you could get away with two resistors, but I played it "safe" and added a flyback diode and a couple of capacitors, as per the reference implementation), here's the schematic of what I used:

7QImgO0.png

Do note that it's TL783, not LM783, like I wrongly wrote on the schematic. The above circuit will drop the voltage from battery to around 14V (13.75V in theory, I got 14.3V out from mine after finishing). I'm not 100% convinced that the capacitors (especially C2) or the diode are strictly needed in this case (the batteries give pretty steady voltage compared to something like a switching power supply, and I doubt the display will throw large inductive voltage spikes backwards during shutdown ;)). On the other hand they shouldn't hurt either, C1 can at least somewhat slow down the voltage ramp-up on start up. Check the datasheet section 9.2.2.1 about bypass capacitors and 9.2.2.2 about the protection circuitry and D1 & C2.

There are a couple of things that have to be taken into account: first off, as it's a linear regulator, it will dissipate power as it drops the voltage over itself. It's rated for up to 700mA (0.7A), but depending how much voltage you drop over it, you may not be able to draw that much out from it (at least without a heatsink), and you need to draw at least 15mA out of it for the regulated voltage to keep steady.

Then the good news: with TO-220 -package it has fairly low junction-to-ambient -thermal resistance: 19 degrees Celsius per watt without heatsink. That means the the internal junction will be (about) 19 degrees hotter than the ambient temperature around the component for 1 watt power dissipation (and about 38 degrees for 2 watts, 57 for 3 watts etc.). The internal junction can go up to around 150 degrees before it breaks. Compare that to mosfets that can have thermal resistances of >60 degrees per watt (without heatsink)...

Anyway, this is a very low power use, but I wanted to make sure I wouldn't need to heatsink it. For that, I needed to know how much current the display will draw. Pretty straightforward to measure.

VVGAL2R.jpg

As I was testing this (with 12V in the picture above), I found out that the current consumption stays around 17.4mA even when the input voltage goes up (tried until around 30V), so I suspect there's a constant current source (or sink) in the meter (probably for dropping off "excess" voltage). So, the display will draw 17.4mA from the regulator, not bad.

There aren't a lot of components needed for this:

oY7sB8d.jpg

The parts list

  • A female GX16-3 connector
  • TL783
  • 1K and 10k resistors, one piece each (as the display doesn't need accurate voltage, 5% is fine, not much power used, so 1/4 or 1/8W is fine)
  • 0-100V DC display (3-wire version, or if you can find one with 2-wires that "self-powers", then you don't need the circuit at all, just connect the meter to the female GX16-3 and you're done :D)
  • Something to encase the circuit, display and part of the connector to, I used a small plastic case that has probably housed something like an SD-card or whatever
  • A piece of PCB, or you can just solder the component legs together (watch out for overheating the components during soldering and/or short circuits though ;))
  • A couple of pieces of wire, you can actually use the left-overs of cut wires from the display when they are made shorter
  • Optional: 1 x 1uF / 100V (or higher voltage) capacitor, 1 x 10uF / 25V (or higher voltage) capacitor, a diode with 100V or more reverse breakdown, I used 1N4007 (1000V / 1A) as I have hundreds of those...

I decided to use around 12-15V for the display, so the circuitry in the display itself wouldn't get too hot over longer usage periods. That of course leaves more burden on the regulator, as it needs to drop more voltage. The output voltage of the regulator is given by

Vo = Vref * (1 + R2 / R1),  where Vis the output voltage, Vref is the reference voltage between output and adjustment-pin (typically 1.25V, but can be 1.2V at minimum or 1.3V at maximum), R2 is the resistor pulling the adjustment pin to ground and R1 is the resistor between the output and the adjustment pin (over which the 1.25V reference voltage drop will occur).

Using just simple standard resistor values (and I have a lot of 1K & 10K resistors :D), I got the output voltage of 13.75V.

V= 1.25V * (1 + 10000 ohm / 1000 ohm) = 1.25V * 11 = 13.75V.

Next, needed to check that the power dissipation of the regulator doesn't go high enough to require a heatsink (I don't have space for it in that small case, and I don't want it to melt the plastic either ;)).  I knew that the display alone will draw 17.4mA, which should be enough to keep the regulated voltage steady, but needed to calculate the current through the resistor divider too to know the total current:

The output voltage is 13.75V, which must drop over R1 and R2. There's also a (very small) current coming out from the adjustment pin, around 0.1mA (typical 83µA, max 110µA), but I won't take it into account here. Current from the output through resistors R1 & R2 will be:

IR1R2 = 13.75V / 11000 ohm = 0.00125A = 1.25mA.

So the total current through the regulator is around 17.4mA (for display) + 1.25mA (for the resistor voltage divider) and around 0.1mA for the adjustment pin, making total of 18.75mA.

The power dissipation over the regulator canl then be calculated knowing the voltage dropped by it and the current running through it, using the "worst case scenario" of totally full battery (67.2V), the regulator will dissipate:

Preg = (67.2V - 13.75V) * 0.01875A = 53.45V * 0.01875A = 1.00219W

Round that to 1 watt. Not bad, with the junction-to-ambient resistance, it will only heat up around 19 degrees above ambient temperature with full batteries (and even less once the batteries are more exhausted). Even if it got 40 degrees celsius outside, the junction would sit around 60 degrees celsius, not enough to melt or burn things, and far from the critical junction temperature of around 125 degrees. No need for heatsinking.

I won't calculate the powers for the resistors here, with those voltages and 1.25mA of current, they're dissipating a few milliwats (around 1.6 and 16mW ;)), that's why pretty much any resistor wattage is just fine.

I haphazardly put the components on the small piece of PCB I had cut earlier:

aKDPzYa.jpg

Could have done a better job with the positions, actually I was planning on bending that regulator over the diode, but left the legs too short :D

QxBdLTv.jpg

Ahem, not that good solder job this time, but hey, it works ;):

25vRAw5.jpg

I tried ramping up the voltage between around 20V and 38.9V (as high as my home-made supply can go), the actual circuit gives out 14.3V, guess that either the current coming out from the regulator isn't enough to push it to the "theoretical" value of 13.75V or the voltage reference is at the maximum of 1.3V, didn't bother to measure :P. In this use case, slight throw won't matter (the display should still work just fine even at 28V ;)). Also tested that it measures the voltage correctly at this point.

Didn't take pictures of it, but next I cut some holes on the plastic case for the connector and the voltage display, and soldered the display & the connector to the board:

7Tn873Y.jpg

Not pretty and a bit cramped, but I don't care about looks that much ;)

iSHic4g.jpg

It still closes up, even though I couldn't bend the regulator all the way.

Testing:

fiZ4ZFb.jpg

Working just fine. Kept it there for a few minutes to see that the regulator doesn't start to heat up, but didn't notice it getting hot.

Aaand... that's about it! :P

 

Link to comment
Share on other sites

Just looked up what the parts would cost if ordering just for this (I had all the parts already, plus I've ordered them in larger lots, so usually the price per piece is lower then) at the lowest (and with free shipping) I could find. These are not recommendations, I just looked up pretty much the cheapest stuff I could find that still LOOKS ok, but I don't know whether the sellers can be trusted or if the product is as described / as it looks in the pictures, so I take no responsibility if you order any of these from these sellers or elsewhere ;)  Also, keep in mind that I'm a hobbyist in electronics, and dealing with large battery packs can be dangerous etc. etc. :P

 

0.28" 0-100V 3-wire DC-display: 1.25€  http://www.aliexpress.com/item/1PCS-Global-Minimum-Size-23-5X-10-5mm-Wholesale-Brand-New-DC0-DC100V-RED-Digital-Voltage/32521301458.html

  • These are available in different colors for the leds (red, green, blue, yellow) from different sellers, also for bigger lots the price can be < 1€ / piece
  • Do check the voltage ratings from the description, sometimes the item title might say 100V, but the description says something like 4-32V ;), easiest way to distinguish the "correct kind" is that it has three wires (typically black for common ground, red for power, white for measurement)
  • There are also panel-mountable versions with larger display & plastic outer casing, they cost a bit more

GX16-3 connector: 0.94€ per pair: http://www.aliexpress.com/item/1set-GX16-3-Pin-Male-Female-Diameter-16mm-Wire-Panel-Connector-L71-GX16-Circular-Connector-Socket/32658447630.html

Resistors are cheap, but you'll be hard pressed to find single pieces :D  Here's 100-piece sets of 1K and 10K, 0.63€ each:  http://www.aliexpress.com/item/100pcs-1k-ohm-1-4W-1k-Metal-Film-Resistor-1kohm-0-25W-1-ROHS/32577059793.html   http://www.aliexpress.com/store/product/100pcs-10k-ohm-1-4W-10k-Metal-Film-Resistor-10kohm-0-25W-1-ROHS/1361740_32577051768.html

  • If you're "starting out" on electronics, it's best to order a large set with different values. Look for something like "resistor assortment" or such, you can easily find something like a few thousand pieces total of 1% / 0.25W metal films with tens of pieces of each value, and it probably costs something like 5-7€, AND THEY ARE UP TO SPEC, I once wen't through a 2100-piece set, measuring 3-5 pieces from each value, and they were all within 1%

TL783 is the most expensive component of this display, cheapest single piece with TO-220 -casing I could find was 1.62€, BUT it looks like it's cut from somewhere (the legs look a bit too short ;)), so may not be new: http://www.aliexpress.com/item/TL783C-TO-220/32343666716.htm

That small PCBs as the piece I used aren't probably available, but you could get a cheap larger board and cut it with saw or whatever (DON'T GET A FR4/FIBERGLASS-BOARD for cutting, they're hard to cut and will dull your tools):

For wires, you could use pretty much anything (the currents are so low that pretty much any gauge should do :P), even the cuttings from the display wires

Small capacitors are hard to find in single pieces (unless you're looking for something specific, high quality)

Pretty much any diode with high enough reverse break down voltage should do. Some Schottky's can have low reverse breakdown voltages (like 40V), so those won't do.

For encasing, you just have to look for something suitable. Or you could just build it inside your wheel, in which case no encasing is necessary (but you need to cut a hole in the shell for the display). Then you could also take the voltage from the discharge-side, which would work even if the charge-side has protection diodes.

Without the case, the price for the components is around 7€ (if I calculated right), and you're left over with some diodes, capacitors and resistors. I probably didn't pay that much, because I've ordered most of the components in "bulk" (or at least in larger lots), plus you could maybe find them even cheaper; the Aliexpress search-system sucks, searching for something like "voltage meter" or "panel meter" or "voltage display" etc. can give same products from different sellers and some searches find cheaper prices than others ;)  Sometimes the difference can be quite substantial. That's why you often see the item names like "TL783CKC TL783C TL783 TO220" or "PCB Prototype Board Circuit Protoboard Universal Stripboard Prototyping Veroboard" so as many search words as possible would hit the item (if you search for TL783, and the item name only contains TL783C, the search won't find it).

 

 

Link to comment
Share on other sites

Great post @esaj

One trick I use for the perf board is to just score and snap it, rather than try to cut it. If you use a straight edge like a metal ruler and push down against a flat surface like a table, you can get a pretty nice break. You can clean it up with some sandpaper if you want.

To anyone thinking about building this, it's a great first project because it's pretty simple. Don't worry about having some extra parts at the end, you'll use them on some future project. I have lots of components sitting in little storage drawers in my workshop, most electronics have loooong shelf life so an unused diode that's 10 years old is still good. The only thing I am always short on is electrolytic capacitors, but I often steal them from discarded electronics that are only a few years old, like cordless phones or whatever.

Link to comment
Share on other sites

esaj, with all due respect, you might complicate things a little by building an extra step-down circuit. For the regular joe like me a 0-100v mini voltage-meter will suffice.

Below is the one I bought from amazon and it works quite well. Only down side is that it will draw 20 ma of power. So I wire it after the switch.

https://www.amazon.com/gp/aw/d/B00IG1AYEW/ref=yo_ii_img?ie=UTF8&psc=1

Link to comment
Share on other sites

1 hour ago, Philip W said:

esaj, with all due respect, you might complicate things a little by building an extra step-down circuit. For the regular joe like me a 0-100v mini voltage-meter will suffice.

Below is the one I bought from amazon and it works quite well. Only down side is that it will draw 20 ma of power. So I wire it after the switch.

https://www.amazon.com/gp/aw/d/B00IG1AYEW/ref=yo_ii_img?ie=UTF8&psc=1

Yeah, and I did mention that:

  • 0-100V DC display (3-wire version, or if you can find one with 2-wires that "self-powers", then you don't need the circuit at all, just connect the meter to the female GX16-3 and you're done :D)

But where's the fun in that? ;)  Similarly I could have bought a lab-power supply and a function generator, but decided to build my own, not only are they much cheaper (and of course lower quality :D), but I also learned a lot in the process.

1 hour ago, HEC said:

@esaj You've "stolen" my idea as I've ordered bunch of those@ http://www.aliexpress.com/item/Portable-Digital-Voltmeter-DC0-100V-Red-Light-LED-Panel-Voltage-Meter-S7NF-drop-shipping/32522775486.html?spm=2114.13010608.0.80.AZZTiJ 2 weeks ago EXACTLY for this very same purpose :D Thanks for making it easier for me now ;)

Sorry, didn't know that you had the same idea :D Thanks for the link though, that's cheaper than what I found last night (and actually ordered 10 pieces at around 1€/piece, should have searched further... :P).

One thing I didn't mention in the post was that you should (of course) check the polarities for the connector, either from the wheel charge port or from the charger and mark them down so you don't mix up the wiring. ;)

Link to comment
Share on other sites

16 hours ago, esaj said:

So, I like to see the battery voltage when riding, as it's better indicator (in my opinion) of the battery charge state than the percentage and/or led-bar -based displays. The problem is, the voltage of the battery is high (typically between 47-67.2V), and most of the small "off-the-shelf" -voltage meters are either the "self-powering" -type (2-wires), which draw their own power from the measured line, but will burn somewhere above 35V or so (and shut off somewhere lower than 4V, but that wouldn't be an issue with the batteries ;)). I opted for the typical 0-100V DC -displays you can find from ebay/aliexpress/amazon, but they require their own separate power (4-32V or somewhere like that). Using higher voltage they'll again burn. So the voltage needs to be regulated down to the level that can be used to power the display. There are buck-converters (switching converters) that can bring down the voltage, but they're more costly for high voltages (the cheaper ones again won't work above 35V or 40V input voltage) and take up space (not much, but still a bit "too much"). Enter TL783, a high voltage linear regulator:  http://www.ti.com/lit/ds/symlink/tl783.pdf

Frankly - I was actually thinking of "cheating here" and measuring the minimum (with 3 ones) and maximum (with 3 eights) consumption of the voltmeter module and see if that would fit in voltage range 5 - 28V by simply putting some resistor in series for the power line considering the expected current in range of tens of millivolts it shouldn't be that much of the problem. Let's say that current will be about 20 mA and loss of the lets say 40V on the resistor of 2 kOhm we're looking at 0.8 Watts? (did the quick estimate and count in my head hopefully I've not jumped some decimals here)

Link to comment
Share on other sites

2 hours ago, dmethvin said:

I have lots of components sitting in little storage drawers in my workshop, most electronics have loooong shelf life so an unused diode that's 10 years old is still good. The only thing I am always short on is electrolytic capacitors, but I often steal them from discarded electronics that are only a few years old, like cordless phones or whatever.

I've also accumulated a... few components and other things since last November:

5fKt0WW.png

There's six little boxes that are still empty on those cabinets, + I have most of my resistors and a couple of hundred (most of which I got from a friend who said they were too low quality for his synthesizer-projects) potentiometers and other odds and ends in the drawers :P

 

2 minutes ago, HEC said:

Frankly - I was actually thinking of "cheating here" and measuring the minimum (with 3 ones) and maximum (with 3 eights) consumption of the voltmeter module and see if that would fit in voltage range 5 - 28V by simply putting some resistor considering the expected current in range of tens of millivolts it shouldn't be that much of the problem. Let's say that current will be about 20 mA and loss of the lets say 40V on the resistor of 2 kOhm we're looking at 0.8 Watts?

So simply a voltage divider to drop the voltage? 40V drop over a 2k ohm resistor is indeed around 0.8W:

I = 40V / 2000 ohm = 0.02A,  P = 40V * 0.02A = 0.8W

But, there will be some current going through the "low" side resistor of the voltage divider, and that current will also pass through the high-side resistor, so you should take that into account too. Or was that already in your 20mA assumption also?

Link to comment
Share on other sites

1 hour ago, esaj said:

So simply a voltage divider to drop the voltage? 40V drop over a 2k ohm resistor is indeed around 0.8W:

I = 40V / 2000 ohm = 0.02A,  P = 40V * 0.02A = 0.8W

But, there will be some current going through the "low" side resistor of the voltage divider, and that current will also pass through the high-side resistor, so you should take that into account too. Or was that already in your 20mA assumption also?

@HEC Did you mean just a series resistor, or instead a voltage divider with two resistors where you tapped the center? With just a series resistor I'd be concerned that it might not drop enough of the voltage if the meter doesn't draw a relatively constant current, for example at startup. The meter might not tolerate a supply voltage over 40v, even for short durations. You could use a simple resistive voltage divider, but it needs to be "stiff" enough so that it provides a relatively fixed voltage if/when the load varies. Usually that means using more current and generating constant waste heat in the resistors.

If you want a lower component count, maybe use a zener diode? For example, connect two 9v batteries in series temporarily for 18v total, measure the max meter draw, calculate the resistor needed to drop 67 volts to 18 volts at max current, then wire up your resistor and 18v zener. If you have a reliable DC variable power supply rather than batteries, you can set the supply voltage to account for whatever zener values you can find cheaply or that happen to be in your junk drawer. 

@esaj does that sound reasonable?

Link to comment
Share on other sites

19 minutes ago, dmethvin said:

@HEC Did you mean just a series resistor, or instead a voltage divider with two resistors where you tapped the center? With just a series resistor I'd be concerned that it might not drop enough of the voltage if the meter doesn't draw a relatively constant current, for example at startup. The meter might not tolerate a supply voltage over 40v, even for short durations. You could use a simple resistive voltage divider, but it needs to be "stiff" enough so that it provides a relatively fixed voltage if/when the load varies. Usually that means using more current and generating constant waste heat in the resistors.

If you want a lower component count, maybe use a zener diode? For example, connect two 9v batteries in series temporarily for 18v total, measure the max meter draw, calculate the resistor needed to drop 67 volts to 18 volts at max current, then wire up your resistor and 18v zener. If you have a reliable DC variable power supply rather than batteries, you can set the supply voltage to account for whatever zener values you can find cheaply or that happen to be in your junk drawer. 

@esaj does that sound reasonable?

From what I understand, that sounds correct. The meter I have seems to draw constant current of 17.4mA regardless of the voltage (at least between 12-30V or so), so probably there's a constant current source somewhere in the meter, that regulates the voltage at the same time by changing the voltage drop over itself. So there just a simple input-resistor might work, but I don't know if all of the 0-100V meters are similar. The zener would (probably) also keep the voltage in check, but from what I know, it also needs something like a minimum of 10-20mA (or maybe it was less, 1-2mA? Would need to check some datasheets) to keep it's own drop steady, and the drop over the input-resistor, and thus current, will change with to the battery voltage changing as it's being drained (or recharged by regenerative braking or otherwise).

A linear regulator probably is a bit overkill for this simple circuit, but at least it gives a peace of mind of steady output regardless of changing battery voltage ;)

EDIT: TL431's are dirt cheap and precise adjustable voltage references, building a circuit around that would work also. Plus probably there's a load of other options too (constant current sources, mosfet/BJT regulators etc.) :P

Link to comment
Share on other sites

 

18 hours ago, esaj said:

But, there will be some current going through the "low" side resistor of the voltage divider, and that current will also pass through the high-side resistor, so you should take that into account too. Or was that already in your 20mA assumption also?

I was actually thinking of only one resistor in series with the power input of voltmeter module rather the divider. The wide range of the power input and almost constant current shall accommodate this "dirt cheap" solution. Maybe extra capacitor over the whole circuit to cover for plugin-in spikes ...

Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...