Go Down

Topic: Backlight control by PWM help (Read 1 time) previous topic - next topic

matiLanza

Hey guys i have a 20x4 LCD which i am matching with a web4robot serial backpack

i want the LCD backlight to be controlled by my pin 3... can anyone help me out here with the code? i can post the code or something maybe you guys can review it and see how to add the backlight control
any volunteers ?  :D

RuggedCircuits

I don't think the code is going to be a big problem -- basically just call analogWrite() with the value that you want.

The bigger question is what hardware you had in mind for interfacing pin 3 with the backlight LED. Here is our suggestion:

http://ruggedcircuits.com/html/circuit__30.html

--
The Rugged Motor Driver: two H-bridges, more power than an L298, fully protected

matiLanza

Really? i didnt know controlling the backlight led would require such a circuit

matiLanza

well now i guess i have a diffferent question, as for the pins from the backpack that go into the 16 pins of the LCD.. do i remove the 15 and 16 and wire them for the PWM control from pin 3 or do i leave them in and solder wires of the back or something ? does the backpack need the pins ? im a little confused as why they wouldnt have a backlight pin on the backpack

http://www.web4robot.com/files/SerialLCDCtrl.pdf

sync

http://forums.adafruit.com/viewtopic.php?f=25&t=16478

Code: [Select]
                               LCD Pin 16          +5V
                                |                   |     
                                |                   |     
                       1k      /               LCD Pin 15         
Arduino digital pin -/\/\/\---| npn
                               \
                                |
                                |
                               GND

matiLanza

okay so basical a 1k from pin 3 to pin 16 on the display and the must be grounded...put the pin 16 on 5v

but still doesnt answer the question of does the head pins need to be removed from 15 and 16 on the backpack?

liudr

I used the same circuit with 2K resistor.

matiLanza

what do i do with the headers for those pins? pull them out ?

liudr


what do i do with the headers for those pins? pull them out ?


A picture of the module would be nice.

I assume you meant the headers on the LCD module. Pulling them out will be very difficult if the entire row is soldered on and then the LCD is soldered on to a backpack or PCB. You can try this if you want:

User a desoldering iron or solder wick to remove solder from the LCD side and the back pack side. Then use pliers to squeeze the pins up and pull them up until they come out. The plastic holding the pins is not very strong so you can use the pliers to squeeze the pins if all solder is removed.

A back up plan is to seek the trace on the PCB and see if you can cut them. Chances are that one of them probably is connected to a ground plane, a bit hard to cut.

matiLanza

Nothing is in place or soldered, im just not sure if the backpack will function with out the pins and or if i should leave them in...the backpack states The LDC backlight and contrast may be adjusted under program control to compensate for
differing lighting conditions and viewing angles. so im guessing it can be but im not sure how

liudr

I'm glad I read that manual. On page 8 it has two commands to set back light brightness and set contrast so there is no need for external circuit to do either, just use commands.

Go Up