How to drive a static LCD display with digital logic and an Arduino / microcontroller.
Code: https://github.com/EEVblog/Arduino-Seven-Segment-LCD
LCD: https://www.digikey.com/products/en?keywords=67-1506-ND
Forum: http://www.eevblog.com/forum/blog/eevblog-1045-how-to-drive-an-lcd/'>http://www.eevblog.com/forum/blog/eevblog-1045-how-to-drive-an-lcd/
EEVblog Main Web Site: http://www.eevblog.com
The 2nd EEVblog Channel: http://www.youtube.com/EEVblog2
Support the EEVblog through Patreon!
http://www.patreon.com/eevblog
Donate With Bitcoin & Other Crypto Currencies!
https://www.eevblog.com/crypto-currency/
EEVblog Amazon Store (Dave gets a cut):
http://astore.amazon.com/eevblogstore-20
T-Shirts: http://teespring.com/stores/eevblog
💗 Likecoin – Coins for Likes: https://likecoin.pro/ @eevblog/dil9/hcq3
Code: https://github.com/EEVblog/Arduino-Seven-Segment-LCD
LCD: https://www.digikey.com/products/en?keywords=67-1506-ND
Forum: http://www.eevblog.com/forum/blog/eevblog-1045-how-to-drive-an-lcd/'>http://www.eevblog.com/forum/blog/eevblog-1045-how-to-drive-an-lcd/
EEVblog Main Web Site: http://www.eevblog.com
The 2nd EEVblog Channel: http://www.youtube.com/EEVblog2
Support the EEVblog through Patreon!
http://www.patreon.com/eevblog
Donate With Bitcoin & Other Crypto Currencies!
https://www.eevblog.com/crypto-currency/
EEVblog Amazon Store (Dave gets a cut):
http://astore.amazon.com/eevblogstore-20
T-Shirts: http://teespring.com/stores/eevblog
💗 Likecoin – Coins for Likes: https://likecoin.pro/ @eevblog/dil9/hcq3
Hi. This is the second video in a series on LCDs and how to drive them. I'll link in the first video down below which talks about LCD technology and how they work and things like that. This one we're going to look at: drive in a static LCD ie.
a non multiplexed LCD Let's get to it. So we saw in the previous video that an LCD is just constructed with what's called a common which is actually more technically called the backplane electrode in there, and then just basically the segment pins. However many segments you've got and this is your typical static, LCD will only have one common on here. So your LCD display is a glass sandwich with some liquid crystals in there and it'll have at least one common pin our comp in which is actually more technically referred to as the backplane electrode.
and then you've got all your other pins which drive your individual segments. In this case, we've got a classic 7 segment display with one common and that's what we use in the practical example coming up. So how do we drive this thing? How easy is it? Well, it could in theory be as easy as this. We'll take a look at two different ways to drive it.
One of them is correct and one of them's incorrect, but still kind of sort of works. but you don't want to do it. So trap for young players coming up. How do we drive it? Well, if we hook our common pin up just to well, 0 volt I'll ground pin and we can simply drive.
put 5 volts on any one of the other pins. A typical LCD driving voltage might be 3 volts to 5 volts something like that, and we can actually turn these segments off and on just with a digital signal. You can drive it with any sort of digital logic, microcontroller, or anything like that, and it will technically work as I'll demonstrate shortly, but this is actually an incorrect way to do it. You do not want to drive this.
Why? Because it will. Let's assume that you have one second on one second off a 50 percent duty cycle. It's going to give you an DC average voltage of in this particular case with a 5 volt drive sagal 2.5 volts if it went up like that, for example, once, 50 percent duty cycle and DC offsets on an LCD will eventually kill them. You do not want to use this method to drive your LCD but it does technically work now.
Some people will try and get around this by driving it with a burst. In this case, you know you could have say a hundred Hertz or something like that to try and get your DC average value lower. But yeah, it's gonna lower it, but you're still going to end up with some DC level on there and it's not gonna really eliminate the problem. Now you can actually kind of use this method to actually drive it correctly, but you've actually got to take this negative for an equal amount like this.
and in this case you do it as a burst like that. So you've got say you know that can be your 100 Hertz burst for example, just you know a low frequency and then on and off and then your DC level. instead of being 2.5 volts, your DC level average DC level becomes zero volts. So this will be the correct way to drive your LCD using this. But the problem is you've got to have a negative 5 volt rail down here and that's gonna ruin your day. If you've just got your digital logic year 3.3 volt digital logic 5 volts. you got an Arduino to drive it some other micro controller to you and you just want to drive your LCD getting that minus 5 volts is a pain in the butt. Anyway, let's go have a little play around with this on the bench and then we'll come back and show you a more elegant solution to solve this problem that doesn't use a negative rail elegant weapon for a more civilized day.
So let's use the example of this same seven segment LCD that we used in the previous video linked in. The datasheet are down below. It's a nominal 5 volt drive static display which means it only has the one common pin which is down in the bottom left corner there and we're just driving one of the segments here. 2 volts per division with a 5 volt TTL signal there.
1 Hertz on off, On off, on off. Simple like that and our ground reference point is there. and as you can see, that works just beautifully. That segments turning off and on.
the contrast is beautiful. Couldn't ask for anything better. You might say you might hook this up to your microcontroller and think hey, I can just drive this with my 5 volt TTL signal or my 3 volt TTL signal. This one will also work down to our 3.3 volts in this particular case and you might think everything's hunky-dory You might design your product around this and it might work for six months, but look at the average DC value.
Of course, because our ground reference is here, the average value is up here like this at 2.5 volt I mean I could just leave this at 5 volts. hook up the pin just potently at 5 volts. Yeah, the segment will come on. but then your average DC value relative to your compen is 5 volts and that's going to eventually kill your LCD.
So while this might work in quote marks, do not drive your LCDs like this. You want and need a zero volt average value for your drive signal. 100 Hertz continuous 100 Hertz square wave and as you can see the segment is on but the contrast isn't that great. Now let's have a look what happens if we actually adjust the DC offset of this signal.
So let's actually shift this down like this. and you can see that if we actually take that 2-0 DC offset. so we've got plus minus 2 and a half volts still 5 volts our peak to peak, you'll see that it's actually niched like that, so the nominal five-volt drive for this particular LCD isn't good enough. Now, if we actually continue to take that down to negative, you'll actually see that come good again.
So that's just the difference that the DC offset can make to the contrast on an LCD. Now you can see that our signal drive level is still exactly the same peak to peak, but it's just not good enough. And it doesn't really matter what you do here when you've got a ground reference here and you're just driving your LCD positive. In this case, I've got a naught point 5 second period so it's flashing over 2 Hertz right every yarn or 0.5 seconds and I've got bursts of a hundred Hertz frequency in there. you're still going to end up with an average value, which is, well, it's not going to be in the middle anymore, but it's still going to be somewhere above zero and that's eventually going to damage your LCD So there's just no way to drive this with your 3.3 volt or 5 volt LCD signal directly as you know it like your regular 0, 2, 3, or 0 to 5 volts. So let me take it up to 8 volts here. For example, the end like it's coming on nice and dark, but you'll see it never switches off. Why? Because look our DC our minimum level here is at minus 4 volts.
There, it should be at 0. We need to drive it both positive and negative with the average value of 0 Because the average value at the moment look is minus 2 volts. it's not actually 0. So if we actually shift our DC level to ground here and this is the correct way to drive at a solid off and on which we could achieve by other methods.
but this way there's no DC offset on the LCD we can't damage it. So I've got to go both positive and negative. but that is a real pain when you're using digital logic to drive this LCD so well she can get away with that using this method. Number 1 Here to drive your city, it requires that negative supply and to get your DC average at 0 so it's not very practical way to do, especially with digital light.
So we're gonna have a look at another method. we'll just call it drive in the comp in driving the common pin and this is basically the industry the more industry standard way to doing it. It's how most of your LCD driving chipsets be they are static ones or your multiplexed ones which we'll have to do another video on because it's more complex actually work. So instead of actually hooking our comping up to ground here, we can actually drive the comp in with a digital signal like this.
And this is just your regular digital signal. Let's say zero volts and 5 volts like this. We're driving that back plane electrode in there and you might think why? well stick with me. It gives you a nice little trick you can do to avoid this negative 5 volt rail up here.
Now you might get a little bit confused by the terminology that industry terminology have com common. You might think Commons Always ground? Well, it doesn't have to be. The LCD is just its own independent floating thing. It's LCD Here, It doesn't care what this pin is hooked up to can be put and hooked up to your circuit.
Comment your 5 volt rail, thousand volt rail, or native thousand Volts. It doesn't matter. it's only the relative difference between the common pin and the segment pins up here that actually matters to the LCD. So we can drive that common pin with. Let's say, 100 Hertz might be a typical wire driving frequency. It's high enough frequency to avoid any visual flicker, but it's low enough not to chew a large amount of power. Do do driving the capacitance. The higher frequency you drive your LCD the more you've got to drive the capacitance, the more reactive current that you're actually going to get through the Capacitance.
of the LCD and the higher the power consumption. That's why your LCD watch can last for years assuming you don't have one of these new Finkles. Stupid idiotic smartwatches can last for years or ten years, or a shelf life of the battery is because the LCDs take practically nothing because they're only switching at, you know, a hundred Hertz or something like that. So if we drive in the common pin with the hundred Hertz What does that achieve Well achieves a neat trick.
and Beno Avoid the 5l trail. Let me show you how how do we turn the segments off and on? Well, You could leave the segments off just by having these pins floating of course, a tri-state output on your driver for example. Then, in theory your segments would stay off because there's no voltage difference between those. The pins are just floating.
but because as you saw in the previous video, how just the electric field picked up by my body I could touch the pins and cause those segments to turn on and stay on due to their capacity, charge, and things like that. you don't just want to leave these pins open because they could eventually build up charge on them and then turn on actually drift on that you always want to drive them, so in this case, if you wanted them off, it could simply just tie them all like that. No problems whatsoever if they're all at the same level, there's no difference between the common pin and the Sigma pins and the segment's will stay off. Oh Worries.
But let's say you wanted to drive segment I here. How do you do it? Wow. It's easy. you use an invert.
You'll notice that we don't have an inverter down here. It's just a drive-in gate. But if we hook an inverter up there and the same hundred Hertz signal here. but we invert the phase, let's take a look at the resultant waveform.
So if we draw two separate waveforms of the waveform on the segment pin here in blue and the waveform on the comp in here relative to our circuit ground zero volts. here, this is important. You'll see that they're out of phase because one's the inverse of the other, but they're still 0 to 5 volt TTL CMOS type levels. There's no negative thing involved, but if you look at it from the perspective of the LCD here, if you actually take the difference between these 2 out of phase signals relative to not circuit ground anymore because circuit ground doesn't matter, Remember, the LCD only cares about the difference between the common pin and the segment pin - if you take the comp in as a reference bingo, it's actually going positive negative according to the LCD. As far as it sees it, it's flipping polarity relative to the common pen. So the average value as far as the LCDs concerned is zero relative to the common. There is zero DC offset. So your aren't violating the issue with driving your LCD by having a DC offset on the common pen and we're driving this effectively with a single 5 volt 3.3 volt TTL the CMOS digital source.
Winner Winner chicken dinner. But I hear you saying Dave How do we actually drive this with a real micro controller or a digital logic or whatnot with yeah, you just hardwired this in. Well, we don't have to hardwire these things in, of course you could. and if you, just if you didn't want your display to change, you've always wanted to display the one thing you could actually hardwire it like that is get rid of our inverter here like this.
And if you remember our digital logic fundamentals which I'll have to link in at the end of this and down below, how can we actually what sort of gate can we use to control this sort of thing? Aha, that gives us a controlled inversion. Your good old X XOR Exclusive or gate. So this is your segment in and this hooks up to here like this. So if you feed a logic 0 here 0 volts into your Xor gate like this, it's going to work just like a buffer here.
It's not going to invert this at all. so your signal here is going to equal your signal here like this. So the segment will be off because there's no difference between the segment and the comp in there. not out of fur.
Then we're not driving them out of phase. we're driving them in phase. They're effectively like shorting that pin to that pin. It's exactly the same.
But if you put a logic one here Bingo. The XOR becomes an inverter and it get out of phase signal. Tada, we've got now Got logic control of driving the comp in like this from a single logic rail circuit. Be it a microcontroller, 74 series, 4000 series logic, and Arduino a micro? Whatever it is, you can drive it with a single logic just by doing out of phase waveforms.
Awesome. And of course you would do that for as many segments as you're having there, you just need those controlled XOR gates in there. Or if you're driving this from a microcontroller, for example, an intelligent logic device, you would just hook these straight up to the pins and then you can generate the required in phase and out of phase signals directly on your microcontroller pins. You just have to be careful if you had a lot of segments here and they were hooked up to different ports on your microcontroller.
For example, there might be a small delay time if you change one port and then change the other, but micros are so fast relative to the the quite low you know hundred Hertz update rate that it really is not going to affect the DC offset thing at all. Really. So it's it's just an academic interest. So there you have it, it's that easy. Just drive them out of phase. I Know this might be a bit like it might sound a bit hard. Let's go to the bench demonstrate the thing. Alright, let's give this a bow.
I've got a seven for hCAT six classic exclusive or gate here and you can follow the warring playing along at home if you want. But what I've got here is this powered from five volts and the gate on pins one, two and three here is just a driver for the common pin. I've got the second pin there just strapped over to ground there so it's just acting as a buffer and I'm also feeding that same 100 Hertz signal on pin number one there over to the second exclusive or gate on pins are four, five and six there and the output of that actually drive in a segment on the LCD and I've got to power it up. We've got five volts.
we're feeding in our hundred Hertz square wave. There it is and you'll see that the signal on both pins there are in phase. so the top one is the common one, the yellow and the green one down there is the segment. Check out the weird effect when I put my hand I'm just capacitively coupled in my hand which is picking up all sorts of common mode noise and crap.
Anyway, if you hook it up to a one there, it inverts the phase, segment turns on, you connect it to ground. There's no inversion in the phase, it's the same signal. The pins are effectively tied together, segment turns off. That's it.
That's how you properly drive a static LCD with a TTL signal. a different signal that we actually saw on the whiteboard There, we can actually subtract channel one from channel two. We've got the operator as negative. So we get in the difference between one and two here and we're at a five volt per division scale.
There is no segment turned on because the waveforms are in phase, so there's no difference signal as zero volts difference, zero volt offset, or difference between those, the segment and the common. But if we strap that pen over the positive there, bingo the zero signal. The ground effectively, as far as the LCDs concerned, is smack in the middle there. and it actually goes up by five volts and down by five volts.
So it's actually 10 volts total. so you actually get a greater voltage to drive it. So if you've got an LCD that needs a you know a higher voltage then other ones a drive signal. this is a neat way to get both that 10 volt peak-to-peak from a 5-volt logic level.
So if you used a 3.3 volt logic circuit, you would actually get a six point six volt peak-to-peak signal, which will drive practically any LCD at a very large contrast. No worries whatsoever. And if you're wondering how to do this with a microcontroller or in this case an Arduino um, I've got a we know uno tied onto the back of this thing. We're counting from 0 to 10. That's it. And you'll notice that there's no driving circuitry whatsoever. We've just hooked to the LCD directly on to the pins of the micro here. So the common goes to a pin.
They're all on the same port, which means you can just switch them all at once. It's easy and but you don't have to do that and you could do this with as many pins as you want wanted with a static LCD Um, and that's all there is to it. and we just drive the pins in phase or out of phase like we did before. And for those playing along at home, here's the firmware: David Wrote it Oh while I edited the video is gonna do it, but I Just got him to hack it together in a couple of minutes.
and there it is. And there's the bitwise exclusive or operator there it is. byte port vell. It basically just inverts it or not.
Air controlled inversion for each particular segment that's on. That's all there is to it. Easy peasy, Lemon Squeezy. So there you go.
Don't be afraid to either. design your own LCD As we're going to wha see in future videos in this series or using off-the-shelf one and drive it with your our Deaver digital logic microcontroller or whatever. They're pretty easy to do at least the static drive version. The multiplexed one will have to require a separate video.
Once you go to multiplex it, you can do it with a microcontroller and discrete logic, but it just gets a bit harder because you have different bias levels and things like that and in that case from multiplex ones. I'd Recommend going to a proper LCD driver chip or a microcontroller that has a proper LCD driver built-in So anyway, if you liked the video, please give it a big thumbs up. And as always discussed down below and there's end card video thingies at the end we can watch more videos I Highly recommend you do so. Yes, they stick around.
There will be future episodes in this series where we design a custom LCD Anyway, maybe liked it. Catch you next time.
why are there so crazy LCD waveforms with multiple voltage levels if this is all that needs to be done? 🤔
Hello, I need a specially designed monochrome tn screen, I want to have it produced, but I cannot have it produced because I do not know how to draw or design it. Can you help me?
@EEVblog, Was there a follow up video to explain multiplexed LCD, or contrast control?
Very instructive, thanks.
That video is just perfect 👌
Sir I have speedometer with lcd display 58 pin . I want to modified but I know how to connect 58 pin to lcd display. Is there driver board able to convert 58 pin to work 5 inch lcd. display.
Sir I love your tutorial.
could we get a video on driving in multiplex mode pls? with 1/2 bias… 1/3 bias.. etc
hgsheikh hello aap Jo display ke bare mein maloom hai dete Hain vah maloomat agar English ki vajah se hindi mein iska anuvad Karke screenshot aaega kyunki ham bhi use display ke liye kam karte hain aur digital Meter mein kam karte hain to Aapka bada hi shukriya Hoga thank u
Dave . You save me hard work– Thank you very much…
Thank you so much for making this. It's so clear and to the point.
Thank you so much. I got a new one and was figuring out how to drive it. This helped me a lot
Thanks Dave
Drive LCD what does that mean
Contrast can be implemented by connecting a 10k pot to 0/5V and using its wiper to drive open collector logic.
salam aleykum . siz edc8066c1p5a lcd programlaya bilersiniz? men inanmiram.
Love the way you make hard things easier to understand!! Thank you Dave !
I get the end result with DC inverted by the gate but in the early stages of the video, if you shift the offset and then have a DC signal going positive to negative, is that not now an AC signal and not DC anymore?
this is the best freaking vblog ever on the web
make sense for beginner like me. thanks mr. dave.
your explaination answer many question of mine.
Awesome video.