Minifigure Meter Circuit Overview

Ever since my multimeter reviews, I’ve wanted to make my own multimeter. Yet, there is no practical reason to make what can be purchased for so little. Instead, I concentrated on functionality that didn’t seem to exist in the marketplace: standard resistance sorting.

The printed circuit board is fairly small, 50 mm x 38 mm (2 inches by 1.5 inches).

MiniMeter circuit board

Minifigure Multimeter circuit board.

1. The heart of the meter is an Atmel ATmega168. (I could squeeze it into an ATmega88 if necessary.) Rather than performing calculations, this microcontroller executes simple commands from the .NET application, because it is easier to program and debug .NET than embedded C.

2. Six 0.1% precision resistors (10 MΩ, 1 MΩ, 100 kΩ, 10 kΩ, and a pair of 2 kΩ resistors to make 1 kΩ) are individually enabled in series with the unknown resistor during measurement.

For example, if the application tells the microcontroller to turn on 100 kΩ and read the voltage, and the result is 2.5 V out of 5 V, then the unknown resistor is also 100 kΩ, as the voltage has been evenly divided between the two resistances. The application’s algorithm finds the known resistance that most evenly divides the voltage and then uses the ratio to calculate the unknown resistor.

3. A Molex connector attaches the wires from the minifigures. This allows the board to be installed and removed, without soldering or desoldering.

4. A Microchip MCP6S22 dual-input programmable gain amplifier (PGA) connects to the unknown and known resistors. This chip has an extremely high input impedance (10,000,000,000,000 Ω), which means it has little effect on the voltage it is measuring. Additionally, the chip can amplify the voltage by up to 32 times, to measure small voltages. The output of this chip connects to the microcontroller, which benefits from a solid signal to measure.

5. Serial header for communicating to the computer.

6. Analog input pins. A0 is used for the measurement from the MCP6S22. A1, A2, and A5 measure the output pins from the microcontroller that power the resistors, in order to measure the source voltage that is being divided. When the pins turn on, they’ll provide slightly less than 5 V, due to voltage loss of the internal transistors. The resulting resistance calculation is made more accurate by including the actual voltage being divided, rather than assuming 5 V.

7. Capacitors to decrease circuit noise.

8. An 18.432 MHz crystal to clock the microcontroller. This frequency divides nicely to common baud rates. The meter communicates to the PC at 115200 baud.

9. A 1 kilohm resistor in series with ground connects to the bottom of the battery being tested. This protects against too much current if the battery being tested is placed upside down.

USB Communication

Previously, my devices used old DB9 RS232 ports. For this project, I wanted the convenience of hot-pluggable use-any-modern-computer-of-your-choice USB.

There are Atmel microcontrollers with USB pins. But, I didn’t have much room on the PCB and I didn’t want to spend time learning the particulars of USB. So, I took the lazy but wise approach of buying an off-the-shelf component to handle USB.

Specifically, I purchased a FDTI TTL-232R-5V cable. Not only is it a USB cable, but it has circuitry built into the USB connector to translate 5 V standard microcontroller serial signals. Additionally, it provides a regulated 5 V power supply, which saves me from having to include those parts on the board as well.

FDTI TTL 232R 5V USB to 5 volt serial cable

FDTI TTL 232R 5V USB to 5 volt serial cable. Yup, the circuitry is hidden within a standard size connector.

The other end of the cable has a connector with 0.1-inch spaced sockets. Not only does this make it simple for hobbyists to use their customary tenth-inch spaced headers, but the cable can be disconnected and other power supplies/communication connected instead. This was useful for me when debugging with the Atmel STK500 programming board.

FDTI USB serial cable connecting to one tenth inch headers

FDTI USB serial cable connecting to one-tenth inch headers.

However, I did make a mistake when reading the data sheets. In their diagram, the TX and RX wires are labeled from the computer’s point of view, not the microcontroller’s point of view. If you connect them to the wrong traces when designing your circuit board, you can use a tiny slotted screwdriver to pop the sockets out of the connector and swap the wires. Guess how I know that?

Noise Issues

Accuracy is critical when making a meter. Since the Minifigure Multimeter converts the measured values into standard values, the device can get away with approximate readings. But, if a cheap imported $5 meter can be accurate, so can my DIY meter.

Looking at the oscilloscope traces, I saw at least 7.5 mV of electrical noise.

0.0075 V / 5 V = 0.15% inaccuracy with no gain
(0.0075 V * 32 gain) / 5 V = 4.8% inaccuracy at full gain
Noise reduction oscilloscope trace

Noise oscilloscope trace.

To reduce noise, I did four things:

The oscilloscope is unable to measure voltages lower than 2 mV, so the actual noise reduction may be even greater. While I am confident that the floating input was the most likely cause, the golden rule of noise reduction is to prevent all noise at its source. In this case, the long leads of a through-hole resistor resting in the unshielded arms of a Lego minifigure is a difficult problem to solve. The touch of my finger when holding the resistor in place during measurement is a greater source of electrical noise than the 7.5 mV previously conquered.

Copper Foil

I’m not trying to discount the advantage of a metal shield to reduce noise. In this project, a thin piece of copper foil isolates the underside of the circuit board, and serves as the ground for the bottom of the battery being tested. The copper is press molded onto the Lego studs and secured in place with circuit board standoff screws.

Copper foil shield and ground for cell voltage testing

Copper foil shield and ground for cell voltage testing.

Results

The minifigure meter turned out better than expected. For purposes of sorting resistors, it is fast and correct from 10 Ω to 10,000,000 Ω. If it were to display actual values, the accuracy would be similar to mid-range multimeters, although the measured value bounces around more due to a lack of a low-pass filter.

The minifigures are delightful, and do not suffer physically or aesthetically from the machining. All of the Lego parts can be detached and rearranged; no adhesive was needed.

Microsoft .NET and the FDTI drivers worked perfectly out of the box. Kudos to Microchip’s MCP6S22, which is spectacular. I got to spend most of my time working on my software, rather than figuring out other people’s components or bugs.

If I make a next-generation board, this project has already given me ideas on changes that would enhance accuracy, increase resolution, and add features such a LED testing. Sometimes, no matter how much initial thought you put into it, you learn more by trying something than you ever do by pondering.