Cortex battery checker

At worlds, my team was giving our alliance partners a battery checker. Plenty of people liked the design, and since I always planned to publish the design, here you go. I’ll add more details later (limited internet access).
Here is the board: OSH Park ~
Photo of the finished device and internals attached.
Measures open circuit voltage, internal resistance and voltage under load (1A, 50ms/1s pulses)

1 Like

Looks awesome! Looking forward to reading about the technical details :slight_smile:

Usage (internal resistance view)

OK, unwinding after the VRC (before IQ ;-)) at the pool.
Attached are the schematics and top+bottom placement plan. BOM is below:

Qty Value          Device         Parts
1                  BEAD0603       B1
2   1n/10V         C0603          C4, C5
2   1u/16V         C0603          C3, C6
1   7R5            R2512P         R4
2   10k            R0603          R1, R5
3   82R            R0603          R6, R7, R8
1   82k            R0603          R2
2   100R           R0603          R9, R10
1   100mR          R-SENSE        R3
2   100n/10V       C0603          C1, C2
1   ATTINY861-20MU ATTINY861-20MU U2
2   DMN2015        DMN2015        Q1, Q2
1   JSS-2030       7SEG3          U$3
1   MIC5213C5      MIC5213C5      U1
2   PAD            PAD            GN, VBAT
6   TP1R           TP1R           GND, MISO, MOSI, RST, SCK, VCC

Firmware will follow
RintMeter,v1.2-top.pdf (13.8 KB)
RintMeter-sch,v1.2.pdf (16.5 KB)
RintMeter,v1.2-bot.pdf (20.1 KB)

Firmware source code (compiles on my Linux with avr-gcc, I can post a .hex if necessary) (9.38 KB)

The technical details are fully spelled out in the source, but let me some of that here:

 RIntMeter - internal resistance meter for VRC batteries.

 Measures the input voltage w/o load, then once again under
 50ms long 1A current burst.
 Based on the voltage drop, it computes and displays the internal battery resistance.
 After the initial display, it keeps showing the under-the-load voltage.

 Supplied from the measured battery through SC-70 LDO, the thermal budget allows
 for 220mW of losses. At 9.3V max considered input voltage, 3.3Vcc, 20mA LED current,
 3mA CPU supply current and 3mA LDO ground current, the loss is expected at 166mW,
 causing at most 75C increase in the LDO package temperature.
 Real loss would be smaller due to LED display brightness modulation.

 The central ATTiny461 uses single-ended ADC to measure the voltage
 and an amplified differential ADC to resolve current passing through
 a 100mR shunt. ADC inputs are assigned as follows:
  * ADC0 (PA0): Input voltage, scaled by 9.2:1 (82k vs. 10k voltage divider, 1nF filter)
  * ADC1 (PA1): Positive side of the 100mR current shunt
  * ADC2 (PA2): Negative side of the current shunt, using Kelvin connect
 The ADC uses the internal 1.1V voltage reference with no external decoupling.

  * PA3 is used to drive the shunt FET during the under-load measurement.

 For current measurements, 8x(ADC1-ADC2) setup measures 800mV/1A with about 1.4mA/lsb
 resolution and 1.4A limit, though it is constructed to consume less than that for input
 battery voltage of <10.5V

 Voltage input measures 10mV/lsb, so a 100mR of internal resistance would be observed
 as 10lsb (100mV) drop at 1A of load. 10mR is then the resolution of Rint measurement
 (before decimation)

 The values are displayed on a 3-digit 7-segment display using time multiplex.
 Common Anodes are driven by port A, while segment cathodes mostly use port B:
  * PA4: LSB Anode
  * PA5: xSB Anode
  * PA6: MSB Anode
  * PA7: Segment H  (dot)
  * PB0: Segment A  (top)				(MOSI)
  * PB1: Segment F  (upper left)			(MISO)
  * PB2: Segment B  (upper right)			(SCK)
  * PB3: Segment E  (lower left)
  * PB4: Segment D  (bottom)
  * PB5: Segment C  (lower right)
  * PB6: Segment G  (middle)
 PB7 is left used as a Reset pin (and brought to the programming pad).

 The firmware performs LED brightness modulation. Since each anode uses only one common
 resistor, different digits require different on-times to compensate varying current.
 This modulation happens by changing the on-time of each digits multiplexing
 timeslot. During the measurements, the firmware might blank the display altogether
 to reduce the measurement error caused by the parasitic current draw.

 The firmware starts by setting up all the peripherals and timers, then switches
 to an interrupt driven multiplexing loop with sleep enabled for all the idle time.

 The multiplexing happens at 250Hz rate, ADC runs synchronously to benefit from

 adc sleep mode. The main 250Hz loop is divided into 4 4ms timeslots:
  1. ADC
  2. Display MSB
  3. Display xSB
  4. display LSB
 The ADC slot could be further distributed between measuring:
  1a. Voltage.
  1b. diff offset
  1c. Current
  1d. Current correction

User visible workflow:
1. Start
2. Keep measuring voltage, displaying updated value every tick with decimated values in between for 2s
   (Display in volts, such as "8.34", the user will see the decimal dot)
3. Blank the display
4. Measure interleaved current/voltage for 50ms under load
5. Display the internal resistance for 1.5s
   (display in milliohms, such as "120", no decimal dot expected)
6. Keep displaying the voltage under load - 50ms load every 1s for 0.4W of average power loss

License: it’s yours, just don’t claim you invented it.
I haven’t “invented” it either since it’s all straightforward usage of electronics and programming basics.
And most importantly, I hope good portion of HS VRC students would be able to design such a thing on their own or at least understand this design.

Obviously no warranty and if your soldering, code changes or usage out of the design envelope causes smoke, it’s your smoke.

I mean you can buy a voltmeter module on amazon for less than 5 bucks for cheap and chop up an old battery charger to make one…

Yes, you can.

  1. Will you learn anything buying things?
  2. Will the voltmeter module measure internal resistance?
  3. Will it also measure voltage under load and let you observe how does it decay?
  4. Will it fit on your keychain and rock your team number on the back, imprinted into the envelope (for which I am yet to publish the customizable openscad design)?

I definitely think you’re missing the point. This is not only a really useful project (it does so much more than just measure voltage), but if you spent the time even just building one, you’d be able to learn so many real-world engineering skills.

I definitely LOVE how you managed to design and build your own tester, and it looks amazing, but you just can’t beat this price

My BOM is under $5, half of that for the thin SMD mount LED display and most of the rest for the load and antiparallel switches. So I am paying for the form factor, ability to measure the internal resistance and foolproofing (my first version didn’t have a reversible LDO and only one power switch, this design will survive reverse polarity with no problem and could be coded to survive significant overvoltage).
If you subtract that, the minimum for measuring voltage would be an MCU (attiny261 would be enough, <40 cents a piece), the cheapest LDO (like 17 cents) and the cheapest LED display (much less than the 2.50 a piece I paid for my special order, .80 even on digikey). The passives are for cents and less.

Time investment is much more of the issue, but: hobby.

Cost analysis is part of the engineering and if you do it right, bean counters won’t come to replace your carefully selected and justified part with something cheaper that will cause you unnecessary headaches.


It is very impressive what you have done!

Did you solder those SMD components at home?

Last time I checked, it was way too costly to have things like that fabricated somewhere (in less than 1000+ quantities) at reasonable prices. We thought about doing something similar, but unfortunately didn’t. :frowning: Only a couple of prototypes with off the shelf $1 3-digit volt meters, but it takes too long to assemble everything by hand…

These are awesome! And a great keepsake for the lucky teams that competed with you!

Yes, did it all home, about 30 pieces.
I have had a laser cut steel stencil (, $17) designed for 4 boards at once and I 3d printed a frame to help aligning the stencil.
I have placed all the components by hand, it took me almost 3 hours to place and hot air the back sides.
I actually plan to see how much would a small batch go for wiith the seeedstudio, but I’ll have to modify the design a little for manufacturability (fiducials, spacing, component selection).