Arduino LCD Brightness












0















I've made this small device that uses a ultrasonic sensor to tell how far away an object is and display it on a 16x2 display.



Here's the code:



#include <LiquidCrystal.h>

int Contrast=100;
LiquidCrystal lcd(12, 11, 5, 4, 3, 2);

const int trigPin = 7;
const int echoPin = 8;
// defining variables
long duration;
int distance;
void setup() {
pinMode(trigPin, OUTPUT); // Sets the trigPin as an Output
pinMode(echoPin, INPUT); // Sets the echoPin as an Input
Serial.begin(9600); // Starts the serial communication
analogWrite(6, Contrast);

lcd.begin(16, 2);
lcd.clear();
}
void loop() {

// Clears the trigPin
digitalWrite(trigPin, LOW);
delayMicroseconds(2);
// Sets the trigPin on HIGH state for 10 micro seconds
digitalWrite(trigPin, HIGH);
delayMicroseconds(10);
digitalWrite(trigPin, LOW);
// Reads the echoPin, returns the sound wave travel time in microseconds
duration = pulseIn(echoPin, HIGH);
// Calculating the distance
distance = duration / 29 / 2;
// Prints the distance on the Serial Monitor
Serial.print("Distance: ");
Serial.println(distance);
lcd.setCursor(0, 0);
lcd.print("Distance: ");

lcd.setCursor(0, 1);
lcd.print(distance);
delay(100);
lcd.clear();
}


Every thing works fine apart from the fact that the lcd backlight is too dim(barely visible). I tried looking online but is there any way i can get max brightness without a potentiometer? I do have resistors , can i use them somehow?










share|improve this question













migrated from stackoverflow.com Nov 27 '18 at 17:39


This question came from our site for professional and enthusiast programmers.



















  • What happens if you change int Contrast to 200?

    – VE7JRO
    Nov 27 '18 at 17:58






  • 1





    Please share your wiring diagram so we can help you. Contract control is usually done using a potentiometer, but can vary depending on the LCD model.

    – Andre Courchesne
    Nov 28 '18 at 3:37
















0















I've made this small device that uses a ultrasonic sensor to tell how far away an object is and display it on a 16x2 display.



Here's the code:



#include <LiquidCrystal.h>

int Contrast=100;
LiquidCrystal lcd(12, 11, 5, 4, 3, 2);

const int trigPin = 7;
const int echoPin = 8;
// defining variables
long duration;
int distance;
void setup() {
pinMode(trigPin, OUTPUT); // Sets the trigPin as an Output
pinMode(echoPin, INPUT); // Sets the echoPin as an Input
Serial.begin(9600); // Starts the serial communication
analogWrite(6, Contrast);

lcd.begin(16, 2);
lcd.clear();
}
void loop() {

// Clears the trigPin
digitalWrite(trigPin, LOW);
delayMicroseconds(2);
// Sets the trigPin on HIGH state for 10 micro seconds
digitalWrite(trigPin, HIGH);
delayMicroseconds(10);
digitalWrite(trigPin, LOW);
// Reads the echoPin, returns the sound wave travel time in microseconds
duration = pulseIn(echoPin, HIGH);
// Calculating the distance
distance = duration / 29 / 2;
// Prints the distance on the Serial Monitor
Serial.print("Distance: ");
Serial.println(distance);
lcd.setCursor(0, 0);
lcd.print("Distance: ");

lcd.setCursor(0, 1);
lcd.print(distance);
delay(100);
lcd.clear();
}


Every thing works fine apart from the fact that the lcd backlight is too dim(barely visible). I tried looking online but is there any way i can get max brightness without a potentiometer? I do have resistors , can i use them somehow?










share|improve this question













migrated from stackoverflow.com Nov 27 '18 at 17:39


This question came from our site for professional and enthusiast programmers.



















  • What happens if you change int Contrast to 200?

    – VE7JRO
    Nov 27 '18 at 17:58






  • 1





    Please share your wiring diagram so we can help you. Contract control is usually done using a potentiometer, but can vary depending on the LCD model.

    – Andre Courchesne
    Nov 28 '18 at 3:37














0












0








0








I've made this small device that uses a ultrasonic sensor to tell how far away an object is and display it on a 16x2 display.



Here's the code:



#include <LiquidCrystal.h>

int Contrast=100;
LiquidCrystal lcd(12, 11, 5, 4, 3, 2);

const int trigPin = 7;
const int echoPin = 8;
// defining variables
long duration;
int distance;
void setup() {
pinMode(trigPin, OUTPUT); // Sets the trigPin as an Output
pinMode(echoPin, INPUT); // Sets the echoPin as an Input
Serial.begin(9600); // Starts the serial communication
analogWrite(6, Contrast);

lcd.begin(16, 2);
lcd.clear();
}
void loop() {

// Clears the trigPin
digitalWrite(trigPin, LOW);
delayMicroseconds(2);
// Sets the trigPin on HIGH state for 10 micro seconds
digitalWrite(trigPin, HIGH);
delayMicroseconds(10);
digitalWrite(trigPin, LOW);
// Reads the echoPin, returns the sound wave travel time in microseconds
duration = pulseIn(echoPin, HIGH);
// Calculating the distance
distance = duration / 29 / 2;
// Prints the distance on the Serial Monitor
Serial.print("Distance: ");
Serial.println(distance);
lcd.setCursor(0, 0);
lcd.print("Distance: ");

lcd.setCursor(0, 1);
lcd.print(distance);
delay(100);
lcd.clear();
}


Every thing works fine apart from the fact that the lcd backlight is too dim(barely visible). I tried looking online but is there any way i can get max brightness without a potentiometer? I do have resistors , can i use them somehow?










share|improve this question














I've made this small device that uses a ultrasonic sensor to tell how far away an object is and display it on a 16x2 display.



Here's the code:



#include <LiquidCrystal.h>

int Contrast=100;
LiquidCrystal lcd(12, 11, 5, 4, 3, 2);

const int trigPin = 7;
const int echoPin = 8;
// defining variables
long duration;
int distance;
void setup() {
pinMode(trigPin, OUTPUT); // Sets the trigPin as an Output
pinMode(echoPin, INPUT); // Sets the echoPin as an Input
Serial.begin(9600); // Starts the serial communication
analogWrite(6, Contrast);

lcd.begin(16, 2);
lcd.clear();
}
void loop() {

// Clears the trigPin
digitalWrite(trigPin, LOW);
delayMicroseconds(2);
// Sets the trigPin on HIGH state for 10 micro seconds
digitalWrite(trigPin, HIGH);
delayMicroseconds(10);
digitalWrite(trigPin, LOW);
// Reads the echoPin, returns the sound wave travel time in microseconds
duration = pulseIn(echoPin, HIGH);
// Calculating the distance
distance = duration / 29 / 2;
// Prints the distance on the Serial Monitor
Serial.print("Distance: ");
Serial.println(distance);
lcd.setCursor(0, 0);
lcd.print("Distance: ");

lcd.setCursor(0, 1);
lcd.print(distance);
delay(100);
lcd.clear();
}


Every thing works fine apart from the fact that the lcd backlight is too dim(barely visible). I tried looking online but is there any way i can get max brightness without a potentiometer? I do have resistors , can i use them somehow?







lcd






share|improve this question













share|improve this question











share|improve this question




share|improve this question










asked Nov 15 '18 at 18:50









Shell1500Shell1500

1




1




migrated from stackoverflow.com Nov 27 '18 at 17:39


This question came from our site for professional and enthusiast programmers.









migrated from stackoverflow.com Nov 27 '18 at 17:39


This question came from our site for professional and enthusiast programmers.















  • What happens if you change int Contrast to 200?

    – VE7JRO
    Nov 27 '18 at 17:58






  • 1





    Please share your wiring diagram so we can help you. Contract control is usually done using a potentiometer, but can vary depending on the LCD model.

    – Andre Courchesne
    Nov 28 '18 at 3:37



















  • What happens if you change int Contrast to 200?

    – VE7JRO
    Nov 27 '18 at 17:58






  • 1





    Please share your wiring diagram so we can help you. Contract control is usually done using a potentiometer, but can vary depending on the LCD model.

    – Andre Courchesne
    Nov 28 '18 at 3:37

















What happens if you change int Contrast to 200?

– VE7JRO
Nov 27 '18 at 17:58





What happens if you change int Contrast to 200?

– VE7JRO
Nov 27 '18 at 17:58




1




1





Please share your wiring diagram so we can help you. Contract control is usually done using a potentiometer, but can vary depending on the LCD model.

– Andre Courchesne
Nov 28 '18 at 3:37





Please share your wiring diagram so we can help you. Contract control is usually done using a potentiometer, but can vary depending on the LCD model.

– Andre Courchesne
Nov 28 '18 at 3:37










1 Answer
1






active

oldest

votes


















0














The back light of the LCD is just an LED connected through a resistors on the A (15) and K (16) pins on the display. The LED doesn't require an external resistor since according to the datasheet there is a build in resistor on the board itself. If you aren't using any external resistors and applying a constant voltage of 5V and the screen is still dim than this means that the led is most likely dead and you would need to replace the back light panel.



If you are talking about the contrasts of the display. Than I would recommend you to hook up the contrast pin to a PWM pin on the Arduino and by using analogWite to tune the display in order to get the desired value of contrast.






share|improve this answer
























  • Most character LCDs have a series resistor but not all. It is a manufacturing option, Typically LCDs available for the hobby market do, but this should be confirmed prior to use.

    – Rudy
    Dec 28 '18 at 19:36













Your Answer






StackExchange.ifUsing("editor", function () {
return StackExchange.using("schematics", function () {
StackExchange.schematics.init();
});
}, "cicuitlab");

StackExchange.ready(function() {
var channelOptions = {
tags: "".split(" "),
id: "540"
};
initTagRenderer("".split(" "), "".split(" "), channelOptions);

StackExchange.using("externalEditor", function() {
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled) {
StackExchange.using("snippets", function() {
createEditor();
});
}
else {
createEditor();
}
});

function createEditor() {
StackExchange.prepareEditor({
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: false,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: null,
bindNavPrevention: true,
postfix: "",
imageUploader: {
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
},
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
});


}
});














draft saved

draft discarded


















StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2farduino.stackexchange.com%2fquestions%2f58251%2farduino-lcd-brightness%23new-answer', 'question_page');
}
);

Post as a guest















Required, but never shown

























1 Answer
1






active

oldest

votes








1 Answer
1






active

oldest

votes









active

oldest

votes






active

oldest

votes









0














The back light of the LCD is just an LED connected through a resistors on the A (15) and K (16) pins on the display. The LED doesn't require an external resistor since according to the datasheet there is a build in resistor on the board itself. If you aren't using any external resistors and applying a constant voltage of 5V and the screen is still dim than this means that the led is most likely dead and you would need to replace the back light panel.



If you are talking about the contrasts of the display. Than I would recommend you to hook up the contrast pin to a PWM pin on the Arduino and by using analogWite to tune the display in order to get the desired value of contrast.






share|improve this answer
























  • Most character LCDs have a series resistor but not all. It is a manufacturing option, Typically LCDs available for the hobby market do, but this should be confirmed prior to use.

    – Rudy
    Dec 28 '18 at 19:36


















0














The back light of the LCD is just an LED connected through a resistors on the A (15) and K (16) pins on the display. The LED doesn't require an external resistor since according to the datasheet there is a build in resistor on the board itself. If you aren't using any external resistors and applying a constant voltage of 5V and the screen is still dim than this means that the led is most likely dead and you would need to replace the back light panel.



If you are talking about the contrasts of the display. Than I would recommend you to hook up the contrast pin to a PWM pin on the Arduino and by using analogWite to tune the display in order to get the desired value of contrast.






share|improve this answer
























  • Most character LCDs have a series resistor but not all. It is a manufacturing option, Typically LCDs available for the hobby market do, but this should be confirmed prior to use.

    – Rudy
    Dec 28 '18 at 19:36
















0












0








0







The back light of the LCD is just an LED connected through a resistors on the A (15) and K (16) pins on the display. The LED doesn't require an external resistor since according to the datasheet there is a build in resistor on the board itself. If you aren't using any external resistors and applying a constant voltage of 5V and the screen is still dim than this means that the led is most likely dead and you would need to replace the back light panel.



If you are talking about the contrasts of the display. Than I would recommend you to hook up the contrast pin to a PWM pin on the Arduino and by using analogWite to tune the display in order to get the desired value of contrast.






share|improve this answer













The back light of the LCD is just an LED connected through a resistors on the A (15) and K (16) pins on the display. The LED doesn't require an external resistor since according to the datasheet there is a build in resistor on the board itself. If you aren't using any external resistors and applying a constant voltage of 5V and the screen is still dim than this means that the led is most likely dead and you would need to replace the back light panel.



If you are talking about the contrasts of the display. Than I would recommend you to hook up the contrast pin to a PWM pin on the Arduino and by using analogWite to tune the display in order to get the desired value of contrast.







share|improve this answer












share|improve this answer



share|improve this answer










answered Nov 28 '18 at 18:22









Coder_foxCoder_fox

39519




39519













  • Most character LCDs have a series resistor but not all. It is a manufacturing option, Typically LCDs available for the hobby market do, but this should be confirmed prior to use.

    – Rudy
    Dec 28 '18 at 19:36





















  • Most character LCDs have a series resistor but not all. It is a manufacturing option, Typically LCDs available for the hobby market do, but this should be confirmed prior to use.

    – Rudy
    Dec 28 '18 at 19:36



















Most character LCDs have a series resistor but not all. It is a manufacturing option, Typically LCDs available for the hobby market do, but this should be confirmed prior to use.

– Rudy
Dec 28 '18 at 19:36







Most character LCDs have a series resistor but not all. It is a manufacturing option, Typically LCDs available for the hobby market do, but this should be confirmed prior to use.

– Rudy
Dec 28 '18 at 19:36




















draft saved

draft discarded




















































Thanks for contributing an answer to Arduino Stack Exchange!


  • Please be sure to answer the question. Provide details and share your research!

But avoid



  • Asking for help, clarification, or responding to other answers.

  • Making statements based on opinion; back them up with references or personal experience.


To learn more, see our tips on writing great answers.




draft saved


draft discarded














StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2farduino.stackexchange.com%2fquestions%2f58251%2farduino-lcd-brightness%23new-answer', 'question_page');
}
);

Post as a guest















Required, but never shown





















































Required, but never shown














Required, but never shown












Required, but never shown







Required, but never shown

































Required, but never shown














Required, but never shown












Required, but never shown







Required, but never shown







Popular posts from this blog

The Sandy Post

Danny Elfman

Pages that link to "Head v. Amoskeag Manufacturing Co."