6502.org Forum  Projects  Code  Documents  Tools  Forum
It is currently Sat Nov 23, 2024 11:13 pm

All times are UTC




Post new topic Reply to topic  [ 12 posts ] 
Author Message
PostPosted: Wed Oct 30, 2024 6:57 pm 
Offline
User avatar

Joined: Wed Aug 17, 2005 12:07 am
Posts: 1250
Location: Soddy-Daisy, TN USA
My design is using 5V logic. I have an LCD (40x4) that has 5V input. However, the data sheet specifies the LED backlight anode is +3.5V.

Since this is only to power the LED, and I didn't want to do level converters, I thought I could simply use a two resistor voltage divider.

R1 = 240 Ohm
R2 = 600 Ohm

Gives +3.571 according to https://ohmslawcalculator.com/voltage-d ... calculator.

Will this work or is there a better way?

Thanks!

LCD:
https://newhavendisplay.com/content/spe ... TMI-JT.pdf


Attachments:
Screenshot from 2024-10-30 14-53-37.png
Screenshot from 2024-10-30 14-53-37.png [ 127.77 KiB | Viewed 135 times ]

_________________
Cat; the other white meat.
Top
 Profile  
Reply with quote  
PostPosted: Wed Oct 30, 2024 7:27 pm 
Offline

Joined: Mon Jan 19, 2004 12:49 pm
Posts: 988
Location: Potsdam, DE
That's probably not going to work - the backlight is an LED (or more than one) which wants, according to the data sheet you linked, between 20 and 80mA. For precision voltage, you'll need either a transistor used as a voltage follower, or a single-chip adjustable voltage regulator - remember in either case your pass transistor/regulator is dissipating potentially 80mA at 1.5 or so volts, so 120mW, and make accommodation on the PCB accordingly. Or a switch mode part will dissipate a lot less heat internally.

(Or the easy approach: assume that the display will eat, say, 50mA. Arrange a resistor (of sufficient power rating, see above) to drop 1.5v at 50mA; 1.5v/50mA = 30 ohms. Connect that between your 5v and the LED input and with nothing from their to ground. Power will be around 75mW. A higher resistor will reduce the current and give a dimmer backlight; a lower value for brighter.)


Neil


Top
 Profile  
Reply with quote  
PostPosted: Wed Oct 30, 2024 7:56 pm 
Offline
User avatar

Joined: Fri Aug 30, 2002 1:09 am
Posts: 8546
Location: Southern California
cbmeeks, your resistor voltage divider will only give that voltage output when there's no load on it.  It will be like a 3.57V supply in series with 1/(1/240+1/600)=171Ω.  Even if you short it to ground, the max current will be less than 21mA.  The LEDs probably need more current than you're thinking too.  I made a couple of in-house programmers for work recently with 4x20 intelligent character LCDs with backlights, and they needed a couple hundred mA to get decent brightness.  If you just do a series resistor, that would be approximately (5V-3.5V)/200mA=7.5Ω, and it would dissipate (5V-3.5V)*200mA=300mW.  That's what I would recommend, a 7.5Ω (give or take) resistor, rated for at least a half watt.  LEDs' voltage/current curve makes it far less than ideal to just feed the backlight with a straight voltage regulator—although if you're feeding it from batteries and need maximum battery life, a switching regulator operating in a constant-current mode would be good, not throwing away some of the energy by just warming up a resistor.

_________________
http://WilsonMinesCo.com/ lots of 6502 resources
The "second front page" is http://wilsonminesco.com/links.html .
What's an additional VIA among friends, anyhow?


Top
 Profile  
Reply with quote  
PostPosted: Wed Oct 30, 2024 8:16 pm 
Offline
User avatar

Joined: Wed Aug 17, 2005 12:07 am
Posts: 1250
Location: Soddy-Daisy, TN USA
Oh wow. I'm glad I asked!

I will go back and study what you guys are saying. I will probably order the LCD before I make the boards too and just wire it up on a breadboard.

That could have been a costly mistake since a big reason for this design is that I want to use that large LCD.

Thanks!!

_________________
Cat; the other white meat.


Top
 Profile  
Reply with quote  
PostPosted: Wed Oct 30, 2024 8:25 pm 
Offline
User avatar

Joined: Wed Aug 17, 2005 12:07 am
Posts: 1250
Location: Soddy-Daisy, TN USA
GARTHWILSON wrote:
although if you're feeding it from batteries and need maximum battery life, a switching regulator operating in a constant-current mode would be good, not throwing away some of the energy by just warming up a resistor.


I like the idea of a LDO voltage regulator.

Maybe something like this?

https://www.mouser.com/ProductDetail/Mi ... Mb9Q%3D%3D

Drop out voltage is 1.1V so if I feed it 5V, that would be 3.9V but it says 3.6V output.
Also, seems it can supply 250mA.

_________________
Cat; the other white meat.


Top
 Profile  
Reply with quote  
PostPosted: Wed Oct 30, 2024 8:37 pm 
Offline

Joined: Mon Jan 19, 2004 12:49 pm
Posts: 988
Location: Potsdam, DE
Garth, the datasheet says Imax for the backlight is 80mA, hence my calculation or 30 ohms for 50mA. 200mA will likely severely reduce the life of the LEDs, or toast them immediately.

cbm, a resistor is the simplest and cheapest way to drive your LEDs. Get a handful and see which give you the brightness you prefer: 47R, 39R, 33R, 27R, 22R, 18R in order of increasing brightness (and current). As Garth points out, driving an LED from a voltage regulator isn't an ideal way to do it (I'm afraid I wrote that original paragraph before I read the datasheet!).

Neil


Top
 Profile  
Reply with quote  
PostPosted: Wed Oct 30, 2024 8:43 pm 
Offline
User avatar

Joined: Fri Aug 30, 2002 1:09 am
Posts: 8546
Location: Southern California
Again, I would not recommend giving the LED backlight a regulated voltage.  LEDs are not linear devices like a resistor is.  A small increase in voltage will produce a huge increase in current.  The desired current through it will probably produce around 3.6V across it, but that will vary with temperature, and also the current may make a huge jump between 3.6V and 3.9V.  The knee of the voltage/current curve is not as sharp as that of a zener diode, but you still need to control the current, not the voltage.

Quote:
Garth, the datasheet says Imax for the backlight is 80mA, hence my calculation or 30 ohms for 50mA. 200mA will likely severely reduce the life of the LEDs, or toast them immediately.

Ok, well, I haven't looked at the data sheet for the particular LCD; but 50mA for the ones I used (which may have been older, from when LEDs were less efficient) was definitely not adequate, and would have almost required the user to cup his hand over the LCD to read it easily.  I got several of these for a song a few years ago, and they might have been sitting on a shelf for many years already, and I just used what I had on hand.

_________________
http://WilsonMinesCo.com/ lots of 6502 resources
The "second front page" is http://wilsonminesco.com/links.html .
What's an additional VIA among friends, anyhow?


Top
 Profile  
Reply with quote  
PostPosted: Wed Oct 30, 2024 9:00 pm 
Offline

Joined: Tue Sep 03, 2002 12:58 pm
Posts: 336
This is a good example of how some background electronics knowledge is essential for reading a datasheet, and how some datasheets are not written all that well.

It says in a few places that the backlight is an LED, and it is white. If you have some experience with LEDs, you'll recognise 3.5V as a reasonable value for the voltage drop of a white LED, so it is reasonable to guess that it's just an LED connected between the two pins (also, it looks just like the thousand other small character LCDs out there, with the same sort of interface and same set of commands, and every single one of those that I've ever used has an LED connected between those two pins as their backlight).

So you want to power it like any other LED. LEDs convert current into light. If you want a stable brightness, then you have to provide a stable current. Fortunately, the voltage drop across an LED is constant enough over the range of current that you'd reasonably use. You can just subtract that from the supply voltage, and use Ohm's law to work out what resistor you need to get the right current - as barnacle has done for you.

So even though the datasheet appears to say "supply 3.5V to this pin", and a voltage regulator sounds like a reasonable way to do that, it's completely wrong. The only way you'd know it's wrong is from experience and a bit of reading between the lines. You actually want a roughly stable current of roughly the right amount, and a simple resistor is perfectly adequate for that.


Top
 Profile  
Reply with quote  
PostPosted: Wed Oct 30, 2024 9:13 pm 
Offline
User avatar

Joined: Wed Aug 17, 2005 12:07 am
Posts: 1250
Location: Soddy-Daisy, TN USA
OHHH!!!

DUH. That makes a lot more sense. It's literally an LED like any other LED I've connected to breadboards a million times. Obviously, I need to do a little math but more than likely, I will just try some common R values and see what brightness I like. In fact, I have some smaller, cheaper LCD's that I can experiment with. Those 40x4's are expensive!!

Thanks again!

_________________
Cat; the other white meat.


Top
 Profile  
Reply with quote  
PostPosted: Thu Oct 31, 2024 8:06 am 
Offline
User avatar

Joined: Fri Nov 09, 2012 5:54 pm
Posts: 1431
Sorry for being late to the party.

I think the best for driving a LED would be a constant current source.


Top
 Profile  
Reply with quote  
PostPosted: Thu Oct 31, 2024 9:31 am 
Offline
User avatar

Joined: Fri Aug 30, 2002 1:09 am
Posts: 8546
Location: Southern California
ttlworks wrote:
Sorry for being late to the party.

I think the best for driving a LED would be a constant current source.

I like figure 2 the most there, except that I would turn it around if the only power supply available is 5V, because the 741's (and similar, like the LM358's) inputs don't operate within 1.5V of Vcc, and the output won't operate within 1.2V of Vcc, whereas they do operate all the way down to ground.  (The output's pulling-down current falls way off when you get below 0.6V; but if you don't need much current, like a few µA, it'll go down to a few mV.)  So here's my revision (drawn on the back of a literal envelope I pulled out of the trash in front of me):
Attachment:
LEDcurrReg.gif
LEDcurrReg.gif [ 17.12 KiB | Viewed 86 times ]

The IC is one section the common LM358 dual op amp.  It's similar to the '741.  The transistor's hfe hardly matters.  The values shown will give you about 46mA, with the exact amount depending mostly on parts' tolerances and the op amp's input offset voltage error.  R3, R4, and the capacitor are there to prevent putting another pole in the transfer function and losing the phase margin and getting an oscillator.  It may not be necessary, kind of a belt-plus-suspenders thing, but experience causes me to automatically just put them in for applications of this kind.  I still prefer just the simple resistor recommended further upthread though.

_________________
http://WilsonMinesCo.com/ lots of 6502 resources
The "second front page" is http://wilsonminesco.com/links.html .
What's an additional VIA among friends, anyhow?


Top
 Profile  
Reply with quote  
PostPosted: Thu Oct 31, 2024 9:46 am 
Offline
User avatar

Joined: Wed Feb 14, 2018 2:33 pm
Posts: 1488
Location: Scotland
cbmeeks wrote:
My design is using 5V logic. I have an LCD (40x4) that has 5V input. However, the data sheet specifies the LED backlight anode is +3.5V.

Since this is only to power the LED, and I didn't want to do level converters, I thought I could simply use a two resistor voltage divider.

R1 = 240 Ohm
R2 = 600 Ohm

Gives +3.571 according to https://ohmslawcalculator.com/voltage-d ... calculator.

Will this work or is there a better way?

Thanks!

LCD:
https://newhavendisplay.com/content/spe ... TMI-JT.pdf


I think you might be overthinking it a little.

These displays are just the common controller + LCD with an LED backlight. There is nothing special about the backlight - it's a panel made up from multiple LEDs wired in parallel (or sometimes 2 rows of 2 LEDs in series).

So it's just an LED and like all LEDs all you need is a single series resistor. You use Ohms law to calculate it, or like me, you get lazy and go online to e.g.

https://ledcalculator.net/#p=5&v=3.5&c=64&n=1&o=w

and pick a 24Ω resistor (based on the typical current of the panel from the data sheet; 64mA in the range from 20 to 80mA).

With modern microcontrollers then what I do is drive the panel from a GPIO pin via PWM. Pick a resistor so that when the output is on it's driven to the max. brightness I then use PWM it to make it dimmer or turn it off. (Might need a little transistor or mosfet for the current though as some GPIO pins can't supply that current).

This is slightly harder but not impossible via a 1000Hz interrupt to a 65xx if it's running at (say) 8Mhz or more. I do this on my boards to give a pulsed heartbeat effect via an LED connected to the CB2 output.

-Gordon

_________________
--
Gordon Henderson.
See my Ruby 6502 and 65816 SBC projects here: https://projects.drogon.net/ruby/


Top
 Profile  
Reply with quote  
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 12 posts ] 

All times are UTC


Who is online

Users browsing this forum: No registered users and 32 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to: