Go Down

Topic: Backlighting an LCD keypad shield from SainSmart (Read 3 times) previous topic - next topic

prefect

Documentation says: backlight control is on pin 10 on a Mega.

I can write the LCD using (8,9,4,5,6,7) as pins for the display.

now comes the difficult one: make that "readable": the display is a blue backlit one, without the backlight, you cannot really read it.

I tried to:
  pinMode(10, OUTPUT);

Then in seconds range I flipped the digital value:
   digitalWrite(10, ((millis()/1000) & 1) ? HIGH : LOW); 

I tried to find the correct pin for a while until I found it to be 10. Then I tried analogue or PWM.

All of a sudden it worked. The LCD was blinking bright. For a minute or two. Do not ask me why.

And then never again. Tried again on another Ardu, nothing. It turns out that when the Shield is on, the pin 10 is not altering between 0 and 5V as I would expect, but between something like 0.1 and 0.9.

when I pull the shield off the Ardu, levels are fine.

There is a transistor tied to pin 10. Please don't tell me I killed that with software? It is soldered under the LCD.

Help!

The whole code:
(Just the slightly tweaked demo code)

#include <LiquidCrystal.h>

// initialize the library with the numbers of the interface pins
// LiquidCrystal lcd(12, 11, 5, 4, 3, 2);
LiquidCrystal lcd(8, 9, 4, 5, 6, 7);

#define BL 10

void setup() {
 
  // set up the LCD's number of columns and rows:
  lcd.begin(16, 2);
  // Print a message to the LCD.
  lcd.print("Adrian");
  pinMode(BL, OUTPUT);
  // Below line was an attemp, had that in 0 and 255, just in case some PWM would have kicked in
  // analogWrite(BL, 0);
}

void loop() {
  // set the cursor to column 0, line 1
  // (note: line 1 is the second row, since counting begins with 0):
  lcd.setCursor(0, 1);
  // print the number of seconds since reset:
  lcd.print(millis()/1000);

  // To be sure, I let 13 blink simultaneously with the LCD
  digitalWrite(13, ((millis()/1000) & 1) ? HIGH : LOW); 
  digitalWrite(BL, ((millis()/1000) & 1) ? HIGH : LOW); 
}



bperrybap

There are a number of shields out there that have a broken hardware design
on the backlight control circuit.
With those designs, I believe it is possible to destroy the AVR chip or at least the D10 pin in software.
I wrote a post about it:
http://arduino.cc/forum/index.php/topic,96747.0.html

--- bill

Go Up