i_c_lcd_display
Differences
This shows you the differences between two versions of the page.
| Next revision | Previous revision | ||
| i_c_lcd_display [2016/08/01 19:42] – created walkeradmin | i_c_lcd_display [2016/08/02 07:33] (current) – walkeradmin | ||
|---|---|---|---|
| Line 1: | Line 1: | ||
| ====== I²C LCD Display ====== | ====== I²C LCD Display ====== | ||
| + | \\ | ||
| + | \\ | ||
| + | LCDs are a great way to display simple information (like an IP address) without going to the expense of a full LCD panel, or connecting a monitor. For my previous LCD I used a 2 line LCD in 4 bit mode, this is a very simple implementation, | ||
| + | \\ | ||
| + | Another way to connect an LCD is to use the I2C interface. This only requires a total of 4 wires, two for the data, 2 for power. You can buy LCDs with built in I2C adapters, I got mine from eBay, I can't really link it because the links to eBay items seem to die fairly quickly.\\ | ||
| + | \\ | ||
| + | If you do a search for something like this: | ||
| + | Yellow Green Serial IIC/I2C/TWI 2004 20X4 Character LCD Module For Arduino | ||
| + | \\ | ||
| + | Then you should find what you are looking for.\\ | ||
| + | \\ | ||
| + | Here is the description for what I purchased (obviously you can ignore the Arduino references)\\ | ||
| + | \\ | ||
| + | |||
| + | Yellow Green Serial IIC/I2C/TWI 2004 20X4 Character LCD Module For Arduino | ||
| + | \\ | ||
| + | Dedicated IIC control for Arduino, it only takes two IO | ||
| + | | ||
| + | Adjustable contrast, the backlight control to provide library | ||
| + | | ||
| + | High quality LCD screen, Yellow Green, clear display | ||
| + | | ||
| + | IIC bus control, it only takes two IO ports | ||
| + | | ||
| + | Backlight control, you can control via a jumper, you can also program control | ||
| + | | ||
| + | Adjustable display contrast | ||
| + | | ||
| + | 5V power supply, the device address 0x27 | ||
| + | | ||
| + | Compatible to Arduino | ||
| + | \\ | ||
| + | There are many of these available on eBay in 2016, and they average around £3.50-£4.00\\ | ||
| + | \\ | ||
| + | Here is one connected to a Pi Zero (1.3)\\ | ||
| + | \\ | ||
| + | {{: | ||
| + | \\ | ||
| + | The most tricky part of getting any LCD to run is finding a driver/ | ||
| + | \\ | ||
| + | https:// | ||
| + | \\ | ||
| + | This guide assumes that you have installed Raspbian (or equivalent) and updated everything with the following commands: | ||
| + | \\ | ||
| + | sudo apt-get update | ||
| + | sudo apt-get upgrade | ||
| + | \\ | ||
| + | On the LCD the four connections will be labelled something like: | ||
| + | \\ | ||
| + | LCD R-Pi | ||
| + | | ||
| + | GND (Ov) Pin 6 | ||
| + | VCC (5v) Pin 2 | ||
| + | SDA Pin 3 (GPIO2) | ||
| + | SCL Pin 5 (GPIO3) | ||
| + | \\ | ||
| + | You need to ensure that the I2C pins are active: | ||
| + | \\ | ||
| + | sudo raspi-config | ||
| + | Advanced Options | ||
| + | I2C | ||
| + | | ||
| + | Where you see the message - Would you like the ARM I2C interface to be enabled? | ||
| + | | ||
| + | Select Yes, then exit this menu system | ||
| + | | ||
| + | Reboot for the changes to take effect | ||
| + | \\ | ||
| + | Once the OS is installed and the LCD is connected, the libraries can be installed: | ||
| + | \\ | ||
| + | Ensure you are in your home folder (probably / | ||
| + | \\ | ||
| + | From the command line: | ||
| + | \\ | ||
| + | git clone https:// | ||
| + | | ||
| + | cd lcd | ||
| + | | ||
| + | sudo sh install.sh (RPi will auto reboot) | ||
| + | \\ | ||
| + | \\ | ||
| + | If you can't find the repository - these files may help - {{ : | ||
| + | \\ | ||
| + | \\ | ||
| + | Once the Pi has rebooted: | ||
| + | \\ | ||
| + | Navigate to your home folder (probably /home/pi) | ||
| + | cd lcd | ||
| + | edit lcddriver.py to ensure the ADDRESS = 0x27 is the correct address (some are 0x20) | ||
| + | | ||
| + | You can find the LCD address by using a tool called i2cdetect | ||
| + | \\ | ||
| + | I found this guide by doing this YouTube search: | ||
| + | \\ | ||
| + | Raspberry Pi - Mini LCD Display Tutorial by TheRaspberryPiGuy | ||
| + | \\ | ||
| + | To start the demo LCD code: | ||
| + | \\ | ||
| + | sudo python lcd_lcd.py | ||
| + | \\ | ||
| + | You should now have some text on the LCD\\ | ||
| + | \\ | ||
i_c_lcd_display.1470080545.txt.gz · Last modified: (external edit)
