AA AAA Battery tester, Arduino Nano, OLED

AA AAA Battery tester, Arduino Nano, OLED

Description

You can test the voltage of AA and AAA batteries with this thing. 9V battery as power source. Quite a bit of tinkering is required... Requires: * Arduino Nano * 0,96" OLED display * 9V battery * wires * metal clips * hot glue * small power switch Be aware, different manufacturers of the Arduino have slightly different measurements. Measure before printing... * Save code to Nano * Glue some kind of metal clips for the test batteries in place * Glue OLED Screen in place * Connect 9V battery (-) to power switch * Connect 9V battery (+) to Nano VIN * Connect AA battery (-) to AAA battery (-) * Connect Nano A0 to Nano D2 to AA/AAA Batteries (+). * Connect Nano GND to OLED GND to power switch to AA/AAA Batteries (-) * Connect OLED VCC to Nano 5V * Connect OLED SDA to Nano A4 * Connect OLED SCL to Nano A5 * Put printed reset button below the Nano * Put/Glue Nano in place * Glue power switch somewhere and cut out a piece of the case It's a pretty tight fit. Upscale everything on Z axis if needed. You could connect AREF to 3.3V for even more precise results (code change required). Code (replace brackets in first two lines): <pre> #include (bracket open)U8g2lib.h(bracket close) #include (bracket open)Wire.h(bracket close) U8G2_SSD1306_128X64_NONAME_F_HW_I2C u8g2(U8G2_R0, U8X8_PIN_NONE); int sensorPin = A0; int sensorValue = 0; float voltage = 0; void setup() { u8g2.begin(); u8g2_prepare(); pinMode(2, OUTPUT); digitalWrite(2, LOW); } void loop() { sensorValue = analogRead(sensorPin); voltage = (float) 5 / 1023 * sensorValue; String voltageStr = String(voltage); u8g2.clearBuffer(); u8g2_prepare(); u8g2.drawStr(18, 10, voltageStr.c_str()); u8g2.sendBuffer(); delay(500); } void u8g2_prepare() { u8g2.setFont(u8g2_font_logisoso38_tn); u8g2.setFontRefHeightExtendedText(); u8g2.setDrawColor(1); u8g2.setFontPosTop(); u8g2.setFontDirection(0); }</pre>

Statistics

Likes

0

Downloads

1

Category

Electronics