Let's Make Robots!

Capturing Data from 7-Segment Display

Something I've wanted to do for a while is to be able to digitize the data from cheap sensors with a 7-segment display.

I decided to give it a try with some USB charge meters.

I purchased four of these meters.

I opened up one of the blue ones and probed the pins to see how the 7-segments were wired.

The display was controlled with anodes for each of the 8 (includind decimal point) segments and each digit was controlled with a single cathode. There were 12 pins cotrolling the LEDs but I didn't want to use 12 I/O pins to monitor the display so I used a couple 74HC165 parallel to serial shift registers.

I initially wrote a driver in Spin but It was clear the segments were on for a very short amount of time so I switched over to assembly.

The code still never "sees" a "v" so I'm not sure if I have a bad connection somewhere or if the voltage levels from the display don't trigger the '165 chips.

I added some pull-up resistors to the pins in hopes of getting better logic states to capture. I think the pull-up helped.

I had some resistor networks which made the job of attaching a bunch of pull-ups a lot easier.

Since I now had access to both the current and the voltage, I could compute the Watts. I could also use a microcontroller to keep track of time and add time dependent parameters to my new meter.

I took Ladvien's advice and used an OLED from ITead Studio. Since the OLED uses 3.3V and draws less then 20mA when displaying a bit of text, I plugged the OLED display directly in the QuickStart's header and powered the display from an I/O pin.

I'm using the display in SPI mode since the object I found for the display used SPI. (I had tried adapting the object to I2C but my I2C version didn't work as well as the SPI code.)


I was powering the above meter and QuickStart from four AA NiMH in the black battery box. The OLED is displaying the data from the meter (top left) and the time dependent parameters.

I'm not sure if this is a practical way of reading current and voltage but it was something I'd been wanting to try.

Comment viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.

I knew the propeller did not have ADC but this is.....  Different!

Except as a learning exercise I am not sure I see the point. As a learning exercise I say well done.

This was one of those dumb ideas I couldn't get rid of.

I have a bunch of these sorts of cheap meters and I've often wished they had a digital output so I could log the data.

As I said in the last sentence of the blog, I wasn't sure this was a practical way to measure voltage and current with a microcontroller but I think there are some sensors with 7-segment displays which don't have an easy to interface counterpart in the same price range as the versions with 7-segment displays. For example there are some relatively inexpensive blood oxygen monitors with 7-segment displays. Similar monitors with digital output are much more expensive (at least they were the last time I checked). In this case it would be less expensive to tap into the 7-segment display than to purchase a monitor with digital output. There are probably other sensors where the only inexpensive alternative are versions with 7-segment displays (though I can't think of any others right now). This technique should allow these devices to be monitored with a microcontroller.

While there may be some practical applications for this technique, the main reason I did this was because I couldn't get the idea out of my head.

If an "earworm" is a song you can't get out of ones head, maybe this should be called a "brainworm" since it was an idea I couldn't get out of my head. (There's probably a real name for this sort of thing.)