hi. my recent project has an issue with the LCD. i don't like to use the potentiometer so i connected it to the ground rail. but now however i tried it is way more brighter than the text.it is a 16x2 LCD display. i just want it to display text on the screen without those boxes around it that is bright with the same color as the text !! boxes: white, text: white , background: blue!!!! i asked a lot
#include<LiquidCrystal.h>
LiquidCrystal lcd(12, 11, 5, 4, 3, 2);
float lightValue;
int j;
void setup() {
// put your setup code here, to run once:
Serial.begin(9600);
lcd.begin(16,2);
pinMode(A0,INPUT);
}
void loop() {
// put your main code here, to run repeatedly:
lightValue=analogRead(A0);
Serial.println(lightValue);
lcd.setCursor(0,0);
lcd.print(lightValue);
lcd.setCursor(0,1);
lcd.print("light level");
}
Try a 1K resistor from LCD pin 3 (contrast) to ground. If that does not work to your satisfaction, temporarily connect a pot from ground to pin 3, adjust the pot to get the contrast that you want, remove the pot, measure the pot resistance and replace the pot with a fixed resistor of the closest value to the measured value.
hi. thankyou so much for the reply. i actually tried beyond that. i connected it to a pwm pin but the text was still not visible. the problem is that in the lcd display, there are pixelated boxes 16x2 . it shouldn't be visible at all. but mine is very bright . the boxes are brighter than the lcd which is very annoying. can we use an oled display instead? it saves a lot of pins too.
Hi,
Why don't you like using a pot?
You are using a small trimpot?
Can I suggest you use a pot.
Adjust it to your requirements.
Then remove the pot and replace it with a potential divider of the measured values from the pot made up from fixed value resistors.
The use of a potentiometer is a long-standing blunder in these project circuits. The correct component is a resistor between pin 3 and ground only. A potentiometer - wired as a variable resistor - can be used to assess the correct resistor value - generally less than 1k.
Using PWM is nonsense. You end up setting a value that is essentially zero.
hello everyone who tried to help me:) .... 2 days ago i tried what ground fungus said of using 1k resistor which i already did. but it wasn't enough ... so i added a few more resistors which ad up to 2.68k. then it worked.!!!!but i changed it to 2 k after i added the gas sensor(which consumed a lot of power). Thankyou soo much to everyone who helped me and you all were right but i didn't use a pot cuz my project is having a structure.
Keep in mind that the resistance needed for optimal contrast of the pixels can vary depending on voltage and somewhat based on temperature.
If these will not vary much, then you can use a simple fixed resistor.
If not, you will need a pot to make adjustments accordingly.
Hi,
Can you please post a copy of your circuit, in CAD or a picture of a hand drawn circuit in jpg, png?
Most of the simple gas sensors consume more current than rated by an Arduino controller.
MathewsJoby:
2 days ago I tried what ground fungus said of using 1k resistor which I already did. but it wasn't enough ... so i added a few more resistors which ad up to 2.68k. then it worked.!!!!but i changed it to 2 k after i added the gas sensor(which consumed a lot of power).
lastchancename: That's a big red flag.
It sounds like your power source is sagging when the gas sensor is added,
It certainly does and gas sensors require substantial current for the heater. You cannot use an Arduino - certainly not a basic UNO/ Nano/ Pro Mini/ Leonardo - as any form of power source for any such component.
That said, requiring a resistor greater than 1k to ground pin 3 of the LCD suggests that your initial 5 V supply is in fact, quite excessive, perhaps approaching 6 V.