0nyx175
Posts: 43
Joined: Thu Feb 26, 2015 8:12 pm

LCD 16x2

Tue Apr 14, 2015 9:01 pm

Hi guys. I'm quite new to the hardware side of the Raspberry pi. I bought myself a cheap 16x2 LCD screen and there seems to be quite a lot of contradictory information on the web about how to wire one up - some people suggest using cobblers, some people say you have to solder, some people say you dont and i'd like some advice. Can anyone recommend any good resources for someone relatively new to all of this on how to wire up a 16x2 lcd screen?

DavidMS
Posts: 139
Joined: Fri May 25, 2012 8:48 pm
Contact: Website

Re: LCD 16x2

Tue Apr 14, 2015 9:39 pm

Try http://andypi.co.uk/?p=351 - there is an artical in I think issue 19 or Magpi magazine on this

or

https://learn.adafruit.com/character-lc ... ack/wiring

note both of these were written for earlier Pi models with the 26 connector but this is not an issue as the first 26 pins of the 40 connector are unchanged
http://meanderingpi.wordpress.com/
11 Raspberry Pi's and counting....

User avatar
DougieLawson
Posts: 38463
Joined: Sun Jun 16, 2013 11:19 pm
Location: A small cave in deepest darkest Basingstoke, UK
Contact: Website Twitter

Re: LCD 16x2

Wed Apr 15, 2015 12:18 am

0nyx175 wrote:Hi guys. I'm quite new to the hardware side of the Raspberry pi. I bought myself a cheap 16x2 LCD screen and there seems to be quite a lot of contradictory information on the web about how to wire one up - some people suggest using cobblers, some people say you have to solder, some people say you dont and i'd like some advice. Can anyone recommend any good resources for someone relatively new to all of this on how to wire up a 16x2 lcd screen?
Rule #1: you need a 10K variable resistor (aka a 10K pot) with either end wired to 5V0 and GND and the wiper wired to Vee
Rule #2: solder a set of header pins into your LCD so you can use it on a breadboard

Vcc wired to 5V0 (pin#2 or pin#4 on the RPi)
GND to any GND pin on the RPi
Vee see rule #1
RS wired to a GPIO pin
R/W wired to GND
E wired to a GPIO pin
D0 left disconnected
D1 left disconnected
D2 left disconnected
D3 left disconnected
D4 wired to a GPIO
D5 wired to a GPIO
D6 wired to a GPIO
D7 wired to a GPIO
A+ wired to a GPIO (I'd use GPIO18 then you can use PWM to dim the display or you can just wire it to Vcc)
K- wired to a 560ohm resistor with the other end wired to GND

https://github.com/adafruit/Adafruit-Ra ... ython-Code
If you use that Adafruit Python CharLCD library it has:

Code: Select all

     def __init__(self, pin_rs=25, pin_e=24, pins_db=[23, 17, 21, 22], GPIO=None):
as the default pin assignments.
Note: Any requirement to use a crystal ball or mind reading will result in me ignoring your question.

I'll do your homework for you for a suitable fee.

Any DMs sent on Twitter will be answered next month.
All non-medical doctors are on my foes list.

User avatar
Douglas6
Posts: 4848
Joined: Sat Mar 16, 2013 5:34 am
Location: Chicago, IL

Re: LCD 16x2

Wed Apr 15, 2015 12:36 am

And yes, you will need to solder either wires or (better) header pins to the display board's pinout through-holes, if that has not been done. Often the pins are soldered to the bottom of the board so that it can be plugged directly into a solderless breadboard. Or you can solder the pins to the top and use female-female jumper wires to connect to the Pi. [EDIT: Oooops, just noticed DougieLawson already covered this in rule #2]

User avatar
B.Goode
Posts: 9827
Joined: Mon Sep 01, 2014 4:03 pm
Location: UK

Re: LCD 16x2

Wed Apr 15, 2015 9:47 am

0nyx175 wrote:I bought myself a cheap 16x2 LCD screen and there seems to be quite a lot of contradictory information on the web about how to wire one up - some people suggest using cobblers, some people say you have to solder, some people say you dont and i'd like some advice.
My take would be that there are multiple ways of solving the problem: the advice is not necessarily contradictory, it just reflects people's varying experience and preferences. Options are good - they allow you to think about the best solution for your own particular requirements.
Can anyone recommend any good resources for someone relatively new to all of this on how to wire up a 16x2 lcd screen?
Using an adaptor like this one is another alternative. http://www.ebay.co.uk/itm/MyPiFi-LCD-Ad ... 1717479495

User avatar
FTrevorGowen
Forum Moderator
Forum Moderator
Posts: 5548
Joined: Mon Mar 04, 2013 6:12 pm
Location: Bristol, U.K.
Contact: Website

Re: LCD 16x2

Wed Apr 15, 2015 12:20 pm

FWIW, There a few more 4-bit**/8-bit examples here:
http://www.cpmspectrepi.webspace.virgin ... alLCD.html
http://www.cpmspectrepi.webspace.virgin ... ut2p1.html
but note that the interface timings vary:
http://www.cpmspectrepi.webspace.virgin ... gData.html
and level shifters are in use:
http://www.cpmspectrepi.webspace.virgin ... dules.html
(Alternatively you could use an I2C or serial backpack, which require less GPIO's:
http://www.cpmspectrepi.webspace.virgin ... plays.html
sections 6,7,8 & 9 thereof)
Trev.
** One of which is very similar to @DougieLawson's example.
Still running Raspbian Jessie or Stretch on some older Pi's (an A, B1, 2xB2, B+, P2B, 3xP0, P0W, 2xP3A+, P3B+, P3B, B+, and a A+) but Buster on the P4B's. See: https://www.cpmspectrepi.uk/raspberry_pi/raspiidx.htm

User avatar
DougieLawson
Posts: 38463
Joined: Sun Jun 16, 2013 11:19 pm
Location: A small cave in deepest darkest Basingstoke, UK
Contact: Website Twitter

Re: LCD 16x2

Wed Apr 15, 2015 1:47 pm

I've just swapped my HD44780 to a smaller breadboard so because I had a camera handy.

Image

It's wired with E=gpio16 RS=gpio26 D4=gpio13 D5=gpio6 D6=gpio5 and D7=gpio12
Note: Any requirement to use a crystal ball or mind reading will result in me ignoring your question.

I'll do your homework for you for a suitable fee.

Any DMs sent on Twitter will be answered next month.
All non-medical doctors are on my foes list.

Return to “HATs and other add-ons”