Best and cheapest solution to digitally control LCD contrast

My KS0108 driven LCD's need a negative voltage of between the range of ~-10v to -5v. How can I control this voltage via pwm on a mega? I'd first pass the pwm signal through a low pass filter, but then how would I go about efficiently getting up to -10 volts. Inverting amplifiers?

Thanks,

--Big Pete

Use a potentiometer.

... but then how would I go about efficiently getting up to -10 volts.

There is a reference to a solution in reply #11 in this forum --> LCD Display not working - Interfacing - Arduino Forum; but the link is no longer valid. Perhaps you could do some creative searching and come up with the diagram anyway.

Don

An interesting approach to generating the -10V, is to use a MAX232.

It just dawned on me that the KS0108 is for a GLCD.

Since most (all ??) GLCDs require a negative voltage for the contrast many of the modules already have a built-in negative supply, typically available on pin 17 or pin 18. Did you check yours?

Don

floresta:
It just dawned on me that the KS0108 is for a GLCD.

Indeed it is. {Not magic, he cited it.}

floresta:
Since most (all ??) GLCDs require a negative voltage for the contrast many of the modules already have a built-in negative supply, typically available on pin 17 or pin 18. Did you check yours?

Pin 19 actually, according to the manual and application note. :smiley:

Nothing more needed than a 10k potentiometer.

Pin 19 actually, according to the manual and application note.

What makes you think he is using an ERM19264?

Don

floresta:
What makes you think he is using an ERM19264?

Heh, heh - I was being sneaky! That's what he cited in his other postings.

This discussion seems to be mostly missing the original topic of s/w control of the contrast using PWM.
While I haven't done it , it would seem doable using an FET transistor like a 2n7000 along
with a low pass filter / RC circuit that connects its low side (FET source) to Vee instead of ground.

--- bill

This discussion seems to be mostly missing the original topic of s/w control of the contrast using PWM.

That was only one of the two topics posed in the original post. If you look at my first reply you can easily tell which one I was referring to. On the other hand ....

Don

floresta:

This discussion seems to be mostly missing the original topic of s/w control of the contrast using PWM.

That was only one of the two topics posed in the original post. If you look at my first reply you can easily tell which one I was referring to. On the other hand ....

Don

Yep, the potentiometer comments seemed out of place to me, since this is about digital control.

From my reading of the topic and original post
I only see only one topic, and that was as the title asks,
essentially how to cheaply do s/w control of contrast.
The first post does talk about using an approach of smoothing out the PWM single with a filter, and
then asks how to use that filtered variable positive voltage to create the larger
ranged voltage that also has to be negative.
My thought is that this is not a hard requirement; the real desire is to be able to do
as the title suggests: cheaply control the contrast in s/w
So my understanding is that it isn't about multiple topics and that the final solution
doesn't necessarily have to be anything like what was mentioned in the original post.

My comment was to consider an alternate approach.
Since ks0108 already has the negative voltage, try to use it rather than re-create it.
So I'd use Vee as part of a filter or rc circuit to create the variable voltage in the needed range
rather than create a variable positive voltage
that then has to be converted again to the needed range.

--- bill

bperrybap:
Yep, the potentiometer comments seemed out of place to me, since this is about digital control.

Not at all. If the potentiometer is adjusted with the fingers, then that would be "digital" control. :smiley:

I frequently observe that a surgeon performing some dissection with a (single) finger is employing "digital technology". They don't always appreciate my sense of humour. :frowning:

My actual concern was the misunderstanding that there would be a need to control the contrast voltage using PWM as the contrast is a "set and forget" function. Unless something happens such as variation of the supply voltage, in which case that is what should be controlled.

Paul__B:
My actual concern was the misunderstanding that there would be a need to control the contrast voltage using PWM as the contrast is a "set and forget" function. Unless something happens such as variation of the supply voltage, in which case that is what should be controlled.

I don't find it to be "set and forget" as I do often see varying supply voltage.
This is particularly true when using batteries.
I also see that the contrast can vary quite a bit on these ks0108 displays
depending on the USB cable used because the back-lights draw so much current,
often 500+ ma, that you end up with voltage drop that can vary depending on the cable
and its length.

I have a custom shield that I built and I also see voltage variation depending
on which base Arduino board I I use as some boards use on board power powesupplies,
diodes, or voltage regulators which also create voltage drops.
So when moving the shield between Arduino base boards, the contrast will change.

I use a pot, and adjust it to make the adjustment to compensate.

--- bill

The obvious approach there, would be to use an Ultra-LDO (albeit negative voltage) regulator to set the contrast voltage - which depends solely on the contrast voltage and not the supply to the driver chip.

I've found that LCD contrast changes with temperature, too.