I have Sainsmart's 3.2" display. It's nice but I can't adjust the backlight with code, only manually with the trimmer pot, that is located on the "adapter shield".

The backlight is made of 5 (not sure) LEDs which are controlled by the trimmer pot, which is wired on the 3.3v pin of the Arduino Mega. I have no idea about current required for those LEDs (I have a multimeter, but can't measure because I can't place the sensors, I first need some male-female wires...) but it shouldn't be more than 40mA since it's the max current that can be drawn from the 3.3v pin.

So I thought I could maybe desolder and remove the trimmer pot, and solder a wire where the trimmer pot's output was (the middle pad), to the Arduino pin 8 (or any other PWM pin), with maybe a resistor in between. So I could control the brightness with analogWrite. A picture is worth 100 words:

So before I try and fry my Arduino or the display, or both...few questions

1) Will it work at all? If not, please tell me why.

2) Do I really need a resistor, if I use this code (obviously not tested, and I'm planning to use the SoftPWM library anyway):

There is no backlight control other than the trimmer pot, so I have to find a solution

With out understanding of what the trimmer does, you cannot have a solution: the trimmer could be outputting a signal that the display uses to change backlight, or it could be the resistance in the backlighting leds....

Getting the datasheet or the schematic is your quickest and surest solution.

Yes this, I'm pretty sure: the trimmer's input is 3.3V, output is LED-A pin, which probably stand for LED Anode. If I put a wire between LED-A (pin19) and GND (pin 1), the backlights turns OFF.

And to add to that: in the datasheet of the SSD1289 controller, there is not a single word about backlight, however there is code to turn ON/OFF the display, I tried it and does what it says, turn ON/OFF the display, but doesn't have any effect on the backlight.

Yes this, I'm pretty sure: the trimmer's input is 3.3V, output is LED-A pin, which probably stand for LED Anode.

So the trimmer is essentially a voltage divider feeding the backlight - not a particularly good technique for implementing an LED.

Quote

If I put a wire between LED-A (pin19) and GND (pin 1), the backlights turns OFF.

This is not a good practice, especially for some settings of the trimmer.

Quote

And to add to that: in the datasheet of the SSD1289 controller, there is not a single word about backlight...

That is because the controller is designed to deal with the presentation of information on the LCD itself and the backlight is more or less an add-on to the LCD to make that information more legible.

The trimmer is part of the shield that goes between the display and the Arduino and the apparently non-existent documentation for that shield should explain its operation and perhaps other options. By now you should have figured out why the distributors that provide good support seem to charge more for their products than those who provide minimal support.

I agree with the other poster that this is a terrible design. The LED(s) probably suck in a lot of current. For the trimmer approach to work, its resistance has to be fairly small.

Do you know if the wiper goes to the LED or one of the terminals goes to the LED? Essentially you want to know if the trimmer is used as a variable resistor.

Quote

which probably stand for LED Anode.

Yes. That's correct.

Quote

If I put a wire between LED-A (pin19) and GND (pin 1), the backlights turns OFF.

If the trimmer is used as a divider and the wiper is at the top, you have just shorted the power supply.

I think you can use a pwm pin to power the led and software control the duty cycle. That requires some resistance on the led, and some limit on how much current the led can draw. If the timmer is wired in right, you can use it. Otherwise, you can cut the trace and wire in a resistor.

Do you know if the wiper goes to the LED or one of the terminals goes to the LED? Essentially you want to know if the trimmer is used as a variable resistor.

The wiper goes to the LED. It's shown right there in his original post.

Quote

If the trimmer is used as a divider and the wiper is at the top, you have just shorted the power supply.

And you probably burned out the trimmer just before you got to the top. But it does indeed turn the backlight off, either way!

Quote

That requires some resistance on the led ...

Which should be present in any design including one using the unmodified shield. There may be one on the PC board that holds the LCD, but don't count on it.

Quote

If the timmer is wired in right, you can use it. Otherwise, you can cut the trace and wire in a resistor.

That is essentially what he proposed in his original post except he planned to remove the trimmer instead of cutting traces.

Don

EDIT: Wouldn't he be better off leaving the trimmer in place, cutting the trace between the top (right hand end) of the trimmer and the 3.3v pin, and moving his resistor connection over from the wiper to the top of the trimmer?

Wouldn't he be better off leaving the trimmer in place, cutting the trace between the top (right hand end) of the trimmer and the 3.3v pin, and moving his resistor connection over from the wiper to the top of the trimmer?

I would actually cut the trace and put in a resistor.

Another approach that requires minimum pcb work is to lift the underside of that trimmer, and connect it to the pwm output. The led is the dimmest when the trimmer is in the middle. This approach may not work if the trimmer's value is too small.