Arduino voltmeter using LCD

Hi all, I'm new here.

I'm trying to make a voltmeter using LCD 16x2 as the display.

The problem is, the backlight is showing but there's no any display at all.
My wiring is as the following:
LCD RS pin to digital pin 12
LCD Enable pin to digital pin 11
LCD D4 pin to digital pin 5
LCD D5 pin to digital pin 4
LCD D6 pin to digital pin 3
LCD D7 pin to digital pin 2
LCD R/W pin to ground
Positive on the battery to Analog 0
Negative on the battery to GND.
(I used a 9V battery for the first attempt)

and I use this sketch

/*
  The circuit:
* LCD RS pin to digital pin 12
* LCD Enable pin to digital pin 11
* LCD D4 pin to digital pin 5
* LCD D5 pin to digital pin 4
* LCD D6 pin to digital pin 3
* LCD D7 pin to digital pin 2
* LCD R/W pin to ground
*/

// include the library code:
#include <LiquidCrystal.h> //Fire up the library.
int val = 0;


LiquidCrystal lcd(12, 11, 5, 4, 3, 2);

void setup() {
  // set up the LCD's number of columns and rows:
  lcd.begin(16, 2);
  //Prints stuff.
  pinMode(A0, INPUT);
  lcd.setCursor(4,0); //Col 4, Row 0
  lcd.print("SBTS");  
  lcd.setCursor(0,1); //Col 0, Row 1
  lcd.print("Volts:");   //Unit goes here.
}

void loop() {
  lcd.setCursor(7,1); //Col 7, Row 1
  lcd.print(analogRead(0)/204.6); //Converts arduino's 0-1023 to 0.00-5.00
  delay(100); 
}

help please? :slight_smile:

At the beginning of your code, you have a print "SBTS" . If it displays that, then there is a problem in your loop section. If nothing ever prints, then you need to set your LCD contrast. I suggest, instead of using a POT for the contrast, Use the PWM pin for your 3rd pin on the LCD ( the one that sets contrast ). Set the value of the pin to somewhere around 40 to 50.

Applying 9v to A0? Did I understand that correctly?
5v is absolute max.

To debug your code, first make the LCD display some things. Then add the fancy stuff.