Arduino LCD
To follow along, you will need an Arduino, we will be using a Uno
You will also need
- 16x2 LCD (16 pin type)
- A strip of 16 Header pins
- A breadboard
- A 10k Trimmer
- Some Jumper wires
This should be straight forward, the pins are detailed in the software too.
The screen will need the header pins soldering in, so you can connect it to the breadboard. If you don't have headers, you can solder wire jumpers to the LCD instead.
The Software
Add the code to your Arduino IDE, plug the Arduino in via USB, and flash the code across
Here is the code;
/*
This Block is not used by the Arduino, it is detail of how to build the circuit
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
* 10K resistor:
* ends to +5V and ground
* wiper to LCD VO pin (pin 3)
* LCD A to +5v
* LCD K to 0v
*/
#include <LiquidCrystal.h> // This tells Arduino we want to use a Library, this one is a standard library, included with the software
// <- This means "comment" and lets the Arduino know text after these is for "Human" use only
// initialize the library with the numbers of the interface pins
LiquidCrystal lcd(12, 11, 5, 4, 3, 2);
void setup() {
// set up the LCD's number of columns and rows:
lcd.begin(16, 2);
}
void loop() {
lcd.setCursor(0,0); //Cursor to 1st position of top row
lcd.print(" Mallinson "); // Place your own text inside the brackets and inside double quotes
lcd.setCursor(0,1); //Cursor to 1st position on bottom row
lcd.print(" 16 x 2 LCD");
}
Some Notes
- Some screens won't have a backlight, and some need an external resistor. The screens we sell have an internal resistor and are lit by putting +5v on pin 15,and connecting pin 16 to 0v
- The 10k trimmer is used to adjust "Contrast". If you can't see your message straight away, turn the middle of the trimmer until you can.
- If this is the first time you have connected an Arduino, your computer will install drivers, let this stage finish before flashing the software
- You will need to solder pins onto the LCD, or you could solder cables instead, for a remote screen
No comments:
Post a Comment