Projects / Battery safety checker for toys

Battery safety checker for toys

Beginner1 hGuided buildReviewed

Build it step by step

0 of 7 done
  1. NANO

    Wire the display

    Connect I2C and check it shows text.

  2. NANO

    Wire the voltage input

    Connect the cell to A0 and GND with the load resistor to D4.

  3. NANODS18B2027.0°C

    Add the sensor

    Fix the DS18B20 against the cell with tape.

  4. NANO

    Test a fresh cell

    Expect about 1.5 V and a low internal resistance.

  5. NANO

    Test a used cell

    Expect lower voltage and a higher resistance.

  6. NANO

    Check a rechargeable cell

    Note NiMH reads near 1.2 to 1.4 V.

  7. NANO

    Sort the cells

    Separate good, weak and spent cells for the toy box.

In short

How do you build a battery safety checker for toys?

A quick tester checks single AA or AAA cells for voltage, internal resistance and heat. You need Arduino Nano, DS18B20 Temperature Sensor, Resistor 4.7 kΩ, SSD1306 OLED Display, Resistor 100 Ω, Battery holder 2 × AA, Breadboard 830 Tie Points and Jumper wires male to male (40 pcs, 20 cm). It takes 7 steps and about 60 minutes.

Level
Beginner
Time
About 60 min
Parts
8

Parts list

Tick what you already own. It saves to My Garage, so “Build with what I have” knows.

Wiring

FromToWhy
Cell under test +Nano A0 and one end of the 100 Ω resistorVoltage sense and load
Cell under test -Nano GNDGround
100 Ω resistor other endNano D4Pin switches the load on
DS18B20 pin 1Nano GNDGround
DS18B20 pin 2Nano D2 and 4.7 kΩ resistor to 5VTemperature data
DS18B20 pin 3Nano 5VPower
OLED VCC and GNDNano 5V and GNDPower
OLED SDA and SCLNano A4 and A5I2C

Code

Test only single AA or AAA cells of 1.5 V (alkaline) or 1.2 V (NiMH) here. Never connect a lithium-ion or Li-po cell, a damaged cell, a swollen cell or anything above 3.3 V, because the 100 Ω load and the analogue pin are only meant for small voltages. A cell that is swollen, leaking or hot should not be tested at all: put it aside and take it to a battery recycling point, never to the bin. The tester measures voltage with no load, then briefly with a 100 Ω load which draws about 15 mA, and from the drop works out the internal resistance; a worn cell drops much more. Tape the DS18B20 to the side of the cell to see if it warms. Arduino IDE, board "Arduino Nano" (processor ATmega328P, or ATmega328P (Old Bootloader) for clones).

Runs on a virtual Arduino Nano in your browser, with sliders for the sensors. Happy with it? Verify and upload to your real board from the same page (Chrome or Edge on a computer).

// Libraries: OneWire, DallasTemperature, Adafruit SSD1306 and GFX.
#include <OneWire.h>
#include <DallasTemperature.h>
#include <Wire.h>
#include <Adafruit_GFX.h>
#include <Adafruit_SSD1306.h>

OneWire ow(2);
DallasTemperature ds(&ow);
Adafruit_SSD1306 oled(128, 64, &Wire, -1);
const byte SENSE = A0, LOAD_PIN = 4;
const float LOAD_OHMS = 100.0;

float readV() {
  long s = 0;
  for (int i = 0; i < 32; i++) { s += analogRead(SENSE); delay(2); }
  return (s / 32.0) * 5.0 / 1023.0;
}

void setup() {
  pinMode(LOAD_PIN, INPUT);                 // load off
  ds.begin();
  oled.begin(SSD1306_SWITCHCAPVCC, 0x3C);
  oled.setTextColor(WHITE);
}

void loop() {
  pinMode(LOAD_PIN, INPUT);
  delay(200);
  float voc = readV();                      // open-circuit voltage
  pinMode(LOAD_PIN, OUTPUT); digitalWrite(LOAD_PIN, LOW);   // 100 ohm load across the cell for a moment
  delay(300);
  float vload = readV();
  pinMode(LOAD_PIN, INPUT);
  float amps = vload / LOAD_OHMS;
  float rint = (amps > 0.001) ? (voc - vload) / amps : 0;   // internal resistance in ohms
  ds.requestTemperatures();
  float tc = ds.getTempCByIndex(0);

  const char *verdict = "OK";
  if (voc > 3.3) verdict = "NOT A SINGLE CELL";
  else if (voc < 1.2) verdict = "LOW, replace";
  else if (rint > 1.5) verdict = "WEAK, high resistance";
  if (tc > 45) verdict = "HOT, remove it";

  oled.clearDisplay(); oled.setTextSize(1); oled.setCursor(0, 0);
  oled.print("Open "); oled.print(voc, 2); oled.println(" V");
  oled.print("Load "); oled.print(vload, 2); oled.println(" V");
  oled.print("Rint "); oled.print(rint, 2); oled.println(" ohm");
  oled.print("Temp "); oled.print(tc, 1); oled.println(" C");
  oled.setCursor(0, 50); oled.print(verdict);
  oled.display();
  delay(1500);
}

Test checklist

What you should see at each check. If a reading is far off, stop and use the troubleshooting list.

CheckExpected
Fresh alkaline cellAbout 1.5 V and a small internal resistance
Old cellLower voltage or high resistance flag
Two cells in seriesNOT A SINGLE CELL warning
Warm cellTemperature rising

If it does not work

Reads zero

Check the cell polarity and A0.

Resistance reads nonsense

Poor contacts; press the cell firmly.

Temperature reads -127

Check the 4.7 kΩ pull-up.

Display blank

Check the I2C address 0x3C.

Still stuck? Find the fault step by step with your multimeter →

Ask Lark AI

Common questions

What parts do I need for the battery safety checker for toys?

Arduino Nano, DS18B20 Temperature Sensor, Resistor 4.7 kΩ, SSD1306 OLED Display, Resistor 100 Ω, Battery holder 2 × AA, Breadboard 830 Tie Points and Jumper wires male to male (40 pcs, 20 cm).

How long does the battery safety checker for toys take to build?

About 60 minutes for a beginner maker, in 7 steps.

How do I know the battery safety checker for toys works?

Fresh alkaline cell: About 1.5 V and a small internal resistance. Old cell: Lower voltage or high resistance flag. Two cells in series: NOT A SINGLE CELL warning.

Reads zero: what should I check?

Check the cell polarity and A0.

Resistance reads nonsense: what should I check?

Poor contacts; press the cell firmly.

Temperature reads -127: what should I check?

Check the 4.7 kΩ pull-up.

Display blank: what should I check?

Check the I2C address 0x3C.