# Driving a raw LCD

I was hoping I could drive the raw lcd by somehow using one of my Arduinos. I am using a lcd on a rangefinder and have figured out the following. The raw lcd is 24 pins, 8 of which are com pins and 16 which are data pins. Using the circuit that used to drive the lcd, I also discovered that one whole cycle through all 8 com pins takes about 32 milliseconds. I have done some looking into lcd controllers with a 1/8 duty cycle but I am still confused. I have already made a chart showing which com/data pin combinations turns on what segment on the display. I can individually drive a segment by connecting the com to 2.5v and the data pin to an alternating 0v-5v source, but I’m hoping I can independently drive all segments with the data coming from the arduino. I’m not sure if you can directly drive a raw lcd with an arduino or not, but the simplest solution would be best.

• Is your driver HD44780? May 19, 2021 at 5:29
• What is the resolution of the LCD ? Perhaps the segments are multiplexed in time. You have to drive each segment one after another in quick succession to give the feeling that the segments are all active at the same time. Is there a part number on the LCD ?
– AJN
May 19, 2021 at 5:50
• LCD panels use digital signals, but the signals are not binary ... multiple voltage levels are involved ... an LCD segment cannot be exposed to net DC voltage on the average ... this prevents segment failure May 19, 2021 at 6:20
• No, there isn’t any part number, and I was watching videos and yes, the lcd needs a net voltage of zero to not to permanently polarize the crystals, breaking the lcd. May 19, 2021 at 15:13

I assume (from your wording) that you are trying to drive a muliplexed LCD directly from binary GPIO pins. That might not be totally impossible, but it is certainly not the simplest solution which you deem the best.

Driving a multimplexed LCD directly requires continuously driving the LCD with interesting waveforms, which are not just 0 and 1, but also inbetween (often just 1 level inbetween, but I am not sure about that). You might be able to do this with a GPIO pin and a resistor divider, switching the pin between 0, 1 and input. Read your LCD datasheet carefully to check whether this is sufficient.

If this works, it will require constant attention from your CPU, so doing anything else beside driving the LCD will be an interesting challenge.

Note that there are microcontrollers that have the hardware support to do drive a multiplexed LCD directly, but the Arduino's chip is not one of these.

By all means, the simplest solution is to use an LCD with a (built-in) driver chip.

• Yes, thank you, the thing is that the lcd is built into my rangefinder and all there is is a 24 pin FPC coming out of it, and so I was looking for maybe a lcd driver that I could control with my arduino or if that wouldn’t work somehow drive it with an arduino. I am planning to use multiple arduino ATmega328 chips on a pcb working together for my project and have already figured out how that will work, the only problem now is figuring out how to drive the lcd. I wouldn’t mind using an entire chip(wouldn’t have to be a ATmega328) to control the lcd. May 19, 2021 at 13:01
• There are some PIC micro-controllers that have a built-in hardware preipheral for directly driving LCDs. But that would require you to learn and program and entirely different MC. May 19, 2021 at 14:56
• I have used one of the small pic controllers before, but I did some research and it looks like they only have an interface to drive lcds with a built in driver, not raw lcds May 19, 2021 at 15:15
• @MiguelFlores-Acton stm32duino has support for STM32L053 and STM32L073, which have raw LCD drivers in them. I recommend Nucleo L073RZ for the large flash, board support in stm32duino and an Arduino-compatible header (3.3V only). As an extra bonus, those Nucleos are cheap May 19, 2021 at 15:33
• Thanks, I looked into the nucleo board and it looks like it would be able to control the lcd. The only problem is that I’m hoping to make this into a pcb, so is there a way to take the necessary components of this microcontroller and put them on you own designed pcb along with the other circuitry I have. May 19, 2021 at 18:06

I have figured out how to control the LCD with my Arduino using this code. I also used 10k resistors connected from every pin to 2.5v to prevent static. So all you have to do to turn on a segment is you would set booleans in the array to true. So if I wanted to turn on the segment that corresponds to com 4 and data pin 5, I would just say pins[3][4] = true and it will stay on until you turn it off. The only downside is that the segments aren't super dark, but it is fairly well lit and I'd say for its simplicity it works well.

const byte comPins[] = {2, 3, 4, 5, 6, 7, 8, 9};
const byte regPins[] = {22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37};
bool pins[8][16];
void setup() {
}
void loop() {
for (byte com = 0; com < 8; com++) {
setCom(com, true, true);
setPins(com, LOW);
delayMicroseconds(1500);
setPins(com, HIGH);
setCom(com, true, false);
delayMicroseconds(1500);
setCom(com, false, false);
}
}
void setPins(byte com, boolean onState) {
for (byte i = 0; i < 16; i++) {
if (pins[com][i]) {
pinMode(regPins[i], OUTPUT);
digitalWrite(regPins[i], onState);
} else {
pinMode(regPins[i], INPUT);
}
}
}
void setCom(byte line, boolean active, boolean state) {
if (active) {
pinMode(comPins[line], OUTPUT);
digitalWrite(comPins[line], state);
} else {
pinMode(comPins[line], INPUT);
}
}