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.
-
\$\begingroup\$ Is your driver HD44780? \$\endgroup\$– tlfong01May 19, 2021 at 5:29
-
1\$\begingroup\$ 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 ? \$\endgroup\$– AJNMay 19, 2021 at 5:50
-
2\$\begingroup\$ 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 \$\endgroup\$– jsotolaMay 19, 2021 at 6:20
-
\$\begingroup\$ 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. \$\endgroup\$– Miguel Flores-ActonMay 19, 2021 at 15:13
2 Answers
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.
-
\$\begingroup\$ 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. \$\endgroup\$ May 19, 2021 at 13:01
-
\$\begingroup\$ 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. \$\endgroup\$ May 19, 2021 at 14:56
-
\$\begingroup\$ 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 \$\endgroup\$ May 19, 2021 at 15:15
-
\$\begingroup\$ @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 \$\endgroup\$– jaskijMay 19, 2021 at 15:33
-
\$\begingroup\$ 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. \$\endgroup\$ 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);
}
}