Analog Tester

Sometimes I need to read an analog value but don’t want to tether to a computer, load the Arduino IDE, and open Serial Monitor.

The solution involves an Arduino Pro Mini, a 4-segment display, a battery and some spring terminals, all hot melt glued to an AA battery pack.

The spring terminals expose a GND, 5V, and 2x A0 inputs. This allows easy pairings of an analog device along with your preference of pull-up or pull-down resistor.

Since the range of analog value readings is 0-1023, an inexpensive 4-digit display fits the bill perfectly.

Both A0 inputs go to the same A0 pin since that’s often hooked up to both the resistor and the analog device.

Now, I can test values of photo-resistors, electret mics, infrared diodes, potentiometers, and anything else that has an analog output suited for reading by an Arduino.

Code

The code is very simple.

First, install the library “TM1637 by Avishay Orpaz” through the Arduino IDE’s library manager:

TM1637 by Avishay Orpaz

Or, get it from GitHub: https://github.com/avishorp/TM1637

Arduino Sketch

// library:  https://github.com/avishorp/TM1637
#include <TM1637Display.h> 

#define APIN A0 // Analog input pin
#define CLK 5 // TM1637 CLK pin to D5
#define DIO 4 // TM1637 DIO pin to D4

TM1637Display display(CLK, DIO);

void setup(){  
  display.setBrightness(5); // range is 1 to 7
}

void loop(){
  // read the analog value and display it
  // (false indicates no leading zeroes)
  display.showNumberDec(analogRead(APIN), false); // 0...1023
  delay(100); // wait 100ms
}

Parts & Links

  • Arduino Pro Mini (5v, 16Mhz) [Amazon]
  • TM1637 4-digit 7-segment display [Amazon]
  • Spring terminals [Amazon]
  • Through-hole perf board [Amazon]
  • 4x AA battery pack w/ switch [Amazon]

Now, I can keep this handy, whether I’m at my computer, the soldering area counter, or my garage.