Page 1 of 2
How to read an LCD display with a microcontroller?
Posted: Sun Oct 04, 2009 3:09 pm
by ramses
A potential project of mine requires that I read a 3 digit 7 segment display with a microcontroller. How would anyone with electronic experience do this, preferably without using 21 pins and modifying the circuit of the lcd in any way.
Re: How to read an LCD display with a microcontroller?
Posted: Sun Oct 04, 2009 3:31 pm
by Ragnarok
Far from an expert, but you could always give a binary output, then use a converter chip. Minimum number of pins I can see you getting away with is 4.
What you do is tell the chip to give out each digit separately as binary number, and have some circuit that holds the value on each 7 segment display until a new one is fed in. Each number it receives nudges the cycle around to accept the next digit.
So the chip gives out the numbers 2,8,3 (in binary) if it wants to display 283. Refresh a few dozen times a second, and you'd never notice any problem.
If you want minimal external circuitry, you could use 6 pins. 2 to identify the digit (in binary), then 4 to give out the value in binary (or 7 pins if you'd prefer not to have a binary/7 seg converter), then just energise each digit in turn. Like I say, driven fast enough, there wouldn't be any noticeable flicker, although they might appear slightly dim.
EDIT: Although, to run with the top idea, you could get away with one pin, feeding out whether each LED of the 7 seg displays was energised or not in turn... and holding that value until otherwise informed.
More external electronics though.
Posted: Sun Oct 04, 2009 3:45 pm
by ramses
Sorry, I wasn't clear. The LCD is on a separate circuit. I don't want to write anything to the lcd, only read it. If it helps, I am looking to interface with
this rangefinder, without modifying said rangefinder too much. I am assuming the whole thing will be SMT, and I completely fail at doing any work with SMT.
Do you think there will be an access point to the binary that is generated by the rangefinder's microcontroller? Particularly one that is not SMT. I would hate to brick a $110 hunk of electronics.
Posted: Sun Oct 04, 2009 4:00 pm
by Ragnarok
ramses wrote:Do you think there will be an access point to the binary that is generated by the rangefinder's microcontroller?
I'm a little doubtful about that.
Of course, some of what I say can be used to "read", rather than "write" with adaptation.
If you simply had three "one-hot" decade counters and a bank of AND gates, I figure you could do fine with three pins. One for input, one to drive the decade counters, and to make things simpler, one to reset the counters.
Have the decade counters cycle through connecting each of the 21 output pins in turn through the AND gates into the input pin, then have your coding turn that information into a number.
Of course, you still need 21 AND gates for that.
And it assumes the thing uses displays where you can get in and solder in your own connections.
Posted: Sun Oct 04, 2009 4:14 pm
by ramses
yeah, that's also doubtful. Poop. Building one is way to complex and touchy, and buying one with some kind of interface and acceptable range is most likely impossible.
I suppose (a) multiplexer(s) could be used and code written for the decoding, but that still requires soldered connections.
EDIT: I found
this, but I have no idea on how to measure the sub-nanosecond timings required for moderate accuracy at acceptable range(50-250m).
Posted: Sun Oct 04, 2009 4:32 pm
by jimmy101
It's LCD?
I suspect the only practical way to do this would be to use 3x7 phototransistors or photo diodes mounted onto a small circuit board that just sits on top of the display you are trying to read. Basically reproduce the three 7 segment displays in photodetectors.
You can scan the three display digits and get all the data with 9 data bits. Seven for the segments and 2 to mux the three display digits.
The board that carries the detectors might have to be clear if you need ambient light to see the LCD display.
If your processor has enough power you could also use a cheapo ($10) camera and then extract the digits from the video (or still) stream. OK, that would take a pretty powerful processor, a typical single chip computer probably can't handle it.
I seem to recall that to decode a 7-segment display back to BCD (binary coded digits) doesn't require that you read all seven segments. So perhaps you could get away with only reading some of the segments.
Posted: Sun Oct 04, 2009 4:32 pm
by Ragnarok
Multiplexer. That's the damned word. Couldn't for the life of me remember it.
What's this project for exactly? Perhaps there's some way around it.
Posted: Sun Oct 04, 2009 7:30 pm
by ramses
Yeah, I had no idea what you were talking about, then thought of the multiplexer.
Anyway, not to pull a d_hall, but it's classified. Basically, I need the range to be detected and sent to the microcontroller at the touch of a button. Anyway, I don't need to see through the rangefinder after initial sighting, but it wouldn't be a bad thing to be able to.
As to processing the video, I was hoping to use arduino (or a clone thereof), and can't think of how to do anything with video on a 16mhz computer with less than 64k ram. Not to mention, this should be a simple project, which would be drastically complicated by something like analyzing a video feed.
I wish the range was displayed outside of the viewfinder!
EDIT: if I can get inside, I found
this link using eprom's to replace 7 segment led's with nixie tubes.
The only question is that if the display is multiplexed, could I use a single eprom and send each digit to the microcontroller separately, or would the multiplexer driver cycle through the digits too fast for the eprom to send the digit to the microcontroller?
I think I am getting in a little over my head. all this to interface and get a flipping 3 digit number!

Posted: Mon Oct 05, 2009 10:42 am
by TurboSuper
You'd want to read the data lines going into the LCD controller. Make a microcontroller-based logic analyzer of sorts.
Posted: Mon Oct 05, 2009 11:35 am
by Technician1002
LCD displays are not DC displays like a multiplexed LED display. To activate a segment in a display, the backplane and segment are fed an AC signal with the segment X or'ed with the backplane. Segments that are out are driven in phase with the backplane. The digits on some displays are sequenced (multiplexed) and others have the entire display with each segment leading to a pin (non multiplexed) Without knowing the type of display, directly reading the display is difficult. Add in some bias voltages for contrast control for viewing angle and the difficulty in reading the display becomes more difficult as this drive is no longer a simple TTL interface.
A great PDF on this subject is here for the electronics types;
www.atmel.com/dyn/resources/prod_documents/doc2569.pdf
Many dedicated consumer devices have the controller directly bonded to the PC board which includes the LCD driver. If you are lucky, you will be able to find and tap a serial data line between the processor and display driver IC. Until you pop one open and id the chips in it, you don't know what variety of display driver is in it, so a simple connect the red wire to here solution doesn't exist. More needs to be known about what exactly is in the box before it can be connected to.
Probably not in your price range, but units with RS-232 or other machine compatible output are for sale.
http://www.acuitylaser.com/AR4000/senso ... data.shtml
In short if trying to directly read a segment, you will need to remove the bias for contrast and XOR the segment with it's backplane. This will provide the segment on/off signal. Sorry you may have some analog conditioning to do.
Posted: Mon Oct 05, 2009 12:10 pm
by jimmy101
Like Tech said, pulling the actual 7-seg data lines off the circuit is going to be pretty tricky. There's a small chance that the actual guts are nicely laid out and you can get to what you need but chances are all the circuitry to drive the display is in a custom die on the board.
You might be able to find the serial line (which isn't the only way it could be setup) between the actual detector and the display driver. Then you would need to figure out the transfer protocol and get a decoder. Might get lucky and be able to just use a serial encoder/decoder chip since it might be as simple as RS232 or similar.
It's possible the display driver is actually both the driver and an AD converter. Basically a single chip voltmeter that does everything except acquire a suitably conditioned analog signal. That would make the basic board useable in a zillion applications and cut cost by a lot. If that is the case, you could tap your own AD converter onto that line to get the signal. If this was something other than a range finder I would think the chances are good that it's an analog signal. For a range finder … could be a lot of different things, some digital some analog.
Best bet really is to find a suitable setup that already has a useable output.
Posted: Mon Oct 05, 2009 12:20 pm
by Technician1002
@Jimmy101, I highly suspect to to the way the device measures distance by travel time, it is unlikely the output is analog to an A/D converter for display. It is most likely a timing circuit with a digital result in the processor. It is highly unlikely to have an analog voltage related to distance anywhere.
Posted: Mon Oct 05, 2009 6:26 pm
by ramses
yeah, in my experience if the price isn't right next to the add to cart button, it is obscenely expensive.
I also doubt the output is analog, but I suppose there could be one chip on the board that drives the laser and receiver directly and outputs directly to the 7 segment. I wish I could return electronics after I open them and determine if they can be hacked in the way I want.
as to tapping a serial data line, I have had some bad experience tapping SMD size components. (custom xbox controller mod)
Posted: Tue Oct 06, 2009 10:23 am
by jimmy101
Technician1002 wrote:@Jimmy101, I highly suspect to to the way the device measures distance by travel time, it is unlikely the output is analog to an A/D converter for display. It is most likely a timing circuit with a digital result in the processor. It is highly unlikely to have an analog voltage related to distance anywhere.
Maybe, it would be interseting to find out how the laser based range finders work.
Using timing would be tricky since digital timers that are fast enough are far from trivial. Lets see, time of flight for light at a range to target of 100m is 6uS (200m total travel). To get 1% resolution the time resolution would have to be 60nS, roughy 16MHz. That actually isn't too bad and wouldn't be
to difficult to do. 60nS is an order of magnitude or more slower then typical solid state gate delays.
Still, it would be easier to use an analog method instead of a digital timer. For example, start charging a capacitor when the laser is fired, stop charging when the return is detected. Take the voltage on the cap and feed it into a high Z meter (basically a $10 digital voltmeter) and you've got a voltage proportional to range without the need for a ~16MHz timer. The start and stop circuitry would be identical to the digital counter circuitry. The cost of the megahertz timer + display is replaced by a $2 generic digital VOM board with display.
Posted: Tue Oct 06, 2009 11:50 am
by Technician1002
jimmy101 wrote:Technician1002 wrote:@Jimmy101, I highly suspect to to the way the device measures distance by travel time, it is unlikely the output is analog to an A/D converter for display. It is most likely a timing circuit with a digital result in the processor. It is highly unlikely to have an analog voltage related to distance anywhere.
Maybe, it would be interseting to find out how the laser based range finders work.
Using timing would be tricky since digital timers that are fast enough are far from trivial. Lets see, time of flight for light at a range to target of 100m is 6uS (200m total travel). To get 1% resolution the time resolution would have to be 60nS, roughy 16MHz. That actually isn't too bad and wouldn't be
to difficult to do. 60nS is an order of magnitude or more slower then typical solid state gate delays.
Still, it would be easier to use an analog method instead of a digital timer. For example, start charging a capacitor when the laser is fired, stop charging when the return is detected. Take the voltage on the cap and feed it into a high Z meter (basically a $10 digital voltmeter) and you've got a voltage proportional to range without the need for a ~16MHz timer. The start and stop circuitry would be identical to the digital counter circuitry. The cost of the megahertz timer + display is replaced by a $2 generic digital VOM board with display.
That method is not very accurate because of 2 factors, the bias voltage of transistors change with temperature which affects the capacitor constant current source and the dielectric constant of many capacitors drifts with temperature. For accuracy, a crystal timebase with a timebase accuracy of 0.005% is typical. Routine calibration is thus eliminated. I use TDR (Time domain reflectometery) quite often to measure the length of wire on a spool. It is digital. The signal in most wires is slower than the speed of light depending on the insulation (dielectric). Most often it's 67-85% of the speed of light.