Hi Everyone
I am working on an automatic time-based turn ON-OFF relay project and it uses an 16x2 LCD display.
I want the LCD to turn off after a while in order to save energy, to do so I connected the power VCC pin of the LCD to digital pin 6 in the Arduino, whenever a time counter in the sketch reached 0, the pin would be set to LOW and the display would turn OFF (the same was done for the backlight but in a different PIN to control each one separately).
This configuration was working as expected but last night suddenly the LCD started showing gibberish when I would upload the sketch to the ATMEGA Microcontroller.
I couldn't think of any way I could have messed something up since everything was working fine and it have do so for several days now, until last night, I even let the Arduino running for around 72 hours in a row since the Monitor's USB to which it is connected are always on.
Here is everything I have tried:
- I replaced the LCD with another one thinking that maybe the LCD's microcontroller was fried, same result with new LCD.
- I rewired the entire thing and used different Arduino pins, no changes.
- I used a different Arduino board entirely, same thing.
- I connected the USB from USB 2 to USB 3 thinking that maybe the amperage was not enough for all things connected, still same.
- I created a new sketch to ONLY show a message on the LCD, here's when I noticed something:
When I connect the VCC pin of the LCD to the Digital Pin of the Arduino and upload the sketch, things don't work, however, if I connect the VCC pin of the LCD to the 5V of the Arduino it does work!, it works if the VCC pin of the LCD is connected to 5V directly to the Arduino board or to the side of the breadboard (the side of the breadboard connected to the Arduino 5V output).
I read the output voltage of the Arduino pin and it read 4.8 V I know is a little low but I think it should be enough to power the display, right?
This is the code I'm using, as you can see is the most basic program for an LCD:
#include <LiquidCrystal.h>
LiquidCrystal lcd(12, 11, 5, 4, 3, 2);
void setup() {
// put your setup code here, to run once:
Serial.begin(9600);
int lcdPow = 6;
pinMode(lcdPow, OUTPUT);
digitalWrite(lcdPow, HIGH);
lcd.begin(16, 2);
lcd.clear();
lcd.print("Hi there");
}
void loop() {
}
Thanks to everyone reading this and trying to help me figure out what is going on, I wish you happy holidays, love you all!
Regards
Keyzo