Close
0%
0%

B.A.T.T.E.R.Y - A diy battery tester

A diy Battery-like AA battery tester.

Public Chat
Similar projects worth following
B.A.T.T.E.R.Y. (Basically A Toy That Embodies Rechargeable Yet-again-batteries) is a portable ESP32 + OLED AA battery tester housed in a hand-cut cardboard shell. It uses eFuse ADC calibration, 32× oversampling, and a moving-average filter to give trustworthy readings — and reacts to the battery's health.

The Battery Drawer Problem

Every maker has one. That drawer. You know the drawer. It sits in the kitchen, or the garage, or the shadowy recesses of your workbench, and inside it lies a primordial soup of loose AA batteries — some fresh, some dead, some so old they have crusty white rings around the negative terminal that look like geological formations. You pick one up. Is it good? Is it bad? You hold it to your tongue like a heathen, get a tiny tingle, and decide it must be fine. Then you put it in your kid's toy, and the toy dies a slow, sad, bleeping death three hours later.

I decided to solve this problem. Badly. On purpose.

And so B.A.T.T.E.R.Y. was born — Basically A Toy That Embodies Rechargeable Yet-again-batteries. The name is deliberately clunky, intentionally over-punctuated, and almost impossible to say out loud without sounding like you've had a stroke. It is, in short, the perfect name for a project whose entire reason for existing is a single, dumb, beautiful pun.

How It Works

The measurement is conceptually simple. A fresh AA alkaline battery sits at around 1.5–1.6 V. A dead one reads around 1.0 V or lower. The ESP32's ADC reads 0–3.3 V at 12-bit resolution, so a 1.5 V signal lands comfortably in range — no voltage divider needed. The AA's positive terminal goes directly to GPIO 34, the negative terminal to GND.
The hard part is the ADC itself. The ESP32's ADC is notoriously noisy and non-linear, especially at the top of its range. A fresh 1.5 V battery can read as 1.65 V or 1.7 V on a bare ADC read — making it look overcharged, which is obviously wrong. B.A.T.T.E.R.Y. solves this with four stacked techniques:
  1. eFuse calibration — Reads the factory-burned Vref on your specific ESP32 chip via esp_adc_cal. Each chip is individually calibrated at the factory; using that data is non-negotiable for accurate readings.
  2. 32× oversampling with min/max rejection — Takes 32 ADC readings, throws out the highest and lowest, averages the remaining 30. Kills transient spikes from the sample-and-hold capacitor charging off low-ESR fresh cells.
  3. 10-sample moving average — On top of the batched reads, smooths the output so the display doesn't jitter.
  4. 0.1 µF ceramic capacitor on GPIO 34 — The hardware fix. Sits physically close to the ESP32 and absorbs sampling spikes before they reach the ADC. Without it, fresh batteries still read wrong even with all the software fixes above(learnt it the wrong way ;) ).

The 0.1 µF cap is the most overlooked piece. It's also the cheapest. Solder it anyway.

The Display Pipeline

Voltage is mapped to a percentage (1.0 V = 0%, 1.6 V = 100%, linear interpolation between) and a status enum:

Voltage range              Status
< 0.2 V                  No Battery
0.2 V – 1.05 V           Replace
1.05 V – 1.35 V          Low Worried
1.35 V – 1.6 V+          Good Happy

 

The Critical Wiring Rule

The single most important sentence in this entire project: the internal 9 V system battery, the external AA being tested, and the ESP32 itself must all share a common ground. Voltage is always a difference between two points. If the AA's negative terminal isn't tied to the ESP32's ground, the reading will be garbage — either wildly fluctuating, stuck at zero, or floating up to a random voltage that means absolutely nothing. Every ground in this project meets at the ESP32's GND pin.

The Enclosure — Cardboard Is Correct

You can absolutely 3D-print a slick enclosure for this project. People have. People will. But I'm here to argue that cardboard is the correct material, both aesthetically and philosophically.

The project is a joke — a battery shaped battery tester. If you build it in a sleek black anodized aluminum case, the joke dies. It becomes a Tool. A Product. A Serious Object. But if you build it in a hand-cut cardboard shell wrapped in mismatched colored paper, with a wonky window cut out for the OLED and the AA holder hot-glued to the front like a growth, the joke lands. It looks like a child's drawing of a robot...

Read more »

SmartSelect_20260702_192214_YouTube.jpg

JPEG Image - 346.03 kB - 07/08/2026 at 12:09

Preview

20260630_200218.jpg

JPEG Image - 1.24 MB - 07/08/2026 at 12:09

Preview

20260702_173147.jpg

JPEG Image - 1.74 MB - 07/08/2026 at 12:09

Preview

20260630_152613.jpg

JPEG Image - 1.90 MB - 07/08/2026 at 12:09

Preview

20260630_194627.jpg

JPEG Image - 2.05 MB - 07/08/2026 at 12:09

Preview

  • 1 × Esp32 Main microcontroller of the project
  • 1 × Jumper wires To connect everything up
  • 1 × 0.96 oled To display everything
  • 1 × 9V battery To power everything

  • 1
    Bill of Materials

    Electronics

    • ESP32 x1 - Microcontroller — runs the ADC pipeline and OLED render loop
    • 0.96" I2C OLED display, SSD1306, 128×64 x1 - Displays battery health, voltage, and status
    • 9V battery x1 - System power source
    • 0.1µF ceramic capacitor - Decouples ADC sampling spikes on GPIO 34

    Enclosure Materials

    • Corrugated cardboard sheet - Main enclosure body
    • Colored paper (yellow, brown, or any color of choice) - Outer wrap and trim
    • White school glue (PVA) or hot-glue gun - Assembly
    • Ruler, pencil, scissors, box cutter - Cutting and marking
    • Black marker or acrylic paint - Detailing and trim

    Software

    • Arduino IDE v2.x - Code editor and uploader
    • U8g2 library (by Oliver Kraus) - OLED display driver
    • ESP32 Arduino core (includes esp_adc_cal) - ADC calibration driver
    • Lopaka (lopaka.app, browser-based) - Pixel UI editor — used to design the UI
  • 2
    Wiring

    All grounds in this project must connect to the ESP32 GND pin:

    • OLED GND
    • AA holder negative terminal
    • 9V snap negative wire

    Voltage is measured as a difference between two points. If the AA's negative terminal is not tied to the ESP32's ground, the reading will be garbage.

    The 0.1µF Capacitor

    The ESP32's ADC uses an internal sample-and-hold capacitor that charges in a fraction of a microsecond. When reading a fresh AA (low internal resistance), this causes a brief voltage spike — a 1.6V battery can sample as 2.5V or 3V. The 0.1µF ceramic cap acts as a local energy reservoir, absorbing the spikes before they reach the ADC.

    Solder the capacitor as close to the ESP32's GPIO 34 pin as physically possible. Do not skip this component.

    NOTE : The first version i made, I didn't connect this Capacitor and got random flicker on a fully charged battery. Wasted a whole day trying to fix it in software but didn't work. So it's a hardware only fix : (

  • 3
    Software Setup

    4.1 Install the Arduino IDE

    Download and install Arduino IDE v2.x from arduino.cc.

    4.2 Add ESP32 Board Support

    1. Open Arduino IDE → File → Preferences
    2. In Additional Board Manager URLs, paste:
    https://raw.githubusercontent.com/espressif/arduino-esp32/gh-pages/package_esp32_index.json 

    Open Tools → Board → Boards Manager

    Search for esp32 and install esp32 by Espressif Systems.

    4.3 Install the U8g2 Library

    1. Open Tools → Manage Libraries
    2. Search for U8g2
    3. Install U8g2 by Oliver Kraus (any recent version)

    4.4 Select the Board

    1. Tools → Board → ESP32 Arduino → select your board (e.g., ESP32 Dev Module)
    2. Tools → Port → select the COM port (Windows) or /dev/ttyUSB* (Mac/Linux) where the ESP32 is connected
    3. Tools → Upload Speed → 921600

View all 7 instructions

Enjoy this project?

Share

Discussions

Similar Projects

Does this project spark your interest?

Become a member to follow this project and never miss any updates