Changing backlight control pin

The LCD and Keypad Shield gives you a handy 16-character by 2-line display, 5 buttons and a controllable backlight.
Post Reply
andrewduncan
Posts: 24
Joined: Tue Dec 06, 2011 1:42 am
Location: Melbourne, AU

Changing backlight control pin

Post by andrewduncan » Thu Dec 08, 2011 9:26 pm

I want to change the backlight control pin on the 16x2 LCD shield. This is a part of getting the shield working together with the USBDroid. The problem I am having is working out how I can remove the backlight control from pin D3. The links to wire up other pins to the backlight control are easy to find, but I can't work out how to remove the control from pin D3. Is LINK2 connected and just need to be cut, or is there another connection to pin D3. I could just remove pin D3 from the LCD shield, but I am sure there must be a neater solution.

Thanks Andrew

LukeW
Posts: 91
Joined: Tue Nov 01, 2011 10:14 am

Re: Changing backlight control pin

Post by LukeW » Mon Dec 12, 2011 3:27 am

There is a copper track running through the middle of the "LINK2" (which maybe labelled as "D3" on the board) pads on the board, you can sever this track to disconnect it.

Then you can short out one of those other unconnected alternative pads to link the backlight control signal to one of the other Arduino pins which is unused in your configuration, so it doesn't conflict with anything else in your particular hardware configuration. I think on the board silkscreen they are all labelled with their Arduino pin numbers.

andrewduncan
Posts: 24
Joined: Tue Dec 06, 2011 1:42 am
Location: Melbourne, AU

Re: Changing backlight control pin

Post by andrewduncan » Mon Dec 12, 2011 3:51 am

Thanks Luke. That makes sense. It is labelled D3. I just couldn't see the copper track, I guess it is under the silkscreen. Thanks for your detailed answer. I am going to use one of the analog pins (A1) for the backlight. Thanks again.

Andrew

moonerj2
Posts: 11
Joined: Sun Jun 08, 2014 11:44 pm

Re: Changing backlight control pin

Post by moonerj2 » Fri Jun 13, 2014 6:37 am

once pin d3 is changed, do you need change any code? or setup the display differently?

angusgr
Freetronics Staff
Freetronics Staff
Posts: 853
Joined: Tue Apr 09, 2013 11:19 pm
Location: Melbourne, Australia
Contact:

Re: Changing backlight control pin

Post by angusgr » Sun Jun 15, 2014 11:25 pm

Hi moonerj3,

The backlight is on by default (pin 3 has a pullup resistor.) So by default it's turned on, even if it's not referred to in the sketch at all.

If you cut the connection and move it to another pin, the pullup resistor may become disconnected so you may need to drive that pin high with digitalWrite() so that the backlight comes on.

Here's a quick example sketch that turns the backlight on as part of setup(), then flashes it as part of loop(). Changing the "#define BACKLIGHT_PIN" line allows you to use a different pin.

Code: Select all

#include <Wire.h>
#include <LiquidCrystal.h>

#define BACKLIGHT_PIN 3

LiquidCrystal lcd( 8, 9, 4, 5, 6, 7 );

void setup()
{
  /* Set up backlight pin and turn on */
  pinMode(BACKLIGHT_PIN, OUTPUT);
  digitalWrite(BACKLIGHT_PIN, HIGH);
  lcd.begin(16, 2);
  lcd.print("hello, world!");
}

void loop()
{
  /* Blink the backlight off and on! */
  digitalWrite(BACKLIGHT_PIN, LOW);
  delay(1000);
  digitalWrite(BACKLIGHT_PIN, HIGH);
  delay(1000);
}

Post Reply

Who is online

Users browsing this forum: No registered users and 2 guests