Tutorial Part Two - For those who wish to add an LCDDISCLAIMER: Since the following instructions involve wiring something to your Pi there is a risk of damaging your Pi if you wire something wrong. I take no responsibility if you damage your Pi while following this tutorial. If followed correctly this tutorial should be quite safe for your Pi.
Skill level: Intermediate, requires soldering
Time: Varies, it really depends on your experience level. For someone used to doing this stuff it shouldn't be more than an hour.
Equipment & materials:
This will really depend on how you're planning on mounting the display but you'll basically need a 16x2 hd44780 LCD screen, wire, pin headers, and of course a soldering iron. If you want to play it safe you can start with a reusable breadboard and reusable jumper cables (look on ebay for dupont breadboard cables). All of this stuff can be obtained even cheaper if you look on ebay and dx.com but for ease of use I'll just provide links to Adafruit products if you want to get them all in one place.
16x2 LCD display using the hd44780 chipset - Very common, available on ebay for $5
*Note if ordering a display do not get the EL or "Electro Luminescent" backlight because these require way more power.
Here's a link to one at Adafruit if you get this one it comes with the 16pin header strip and potentiometer
16 Pin Single Row Male Header with 0.1" pitch (2.54mm)
- These typically come in longer lengths and you simply break off what you need
- If you are buying the display from Adafruit via the link above it already comes with the header you need.
560ohm 1/4 watt resistor
- Not required if you're buying the LCD from Adafruit
- Some cheap Chinese displays do not have a current limiting resistor installed for the LED backlight, this resistor is only needed for those. Since it's just about impossible to tell until you actually apply power to the LCD it's a good idea to wire one in first just to be safe, if the backlight is very dim then you can remove it.
28 Gauge Wire - Rainbow ribbon isn't necessary but it is handy
Here is an Adafruit link
Dupont Breadboard Cables - Female/Female (Optional)
- Alternative to the above 28 gauge wire. I highly recommend these for prototyping even if you're not using a breadboard.
- Look on ebay for these, they're cheap I got 100 cables 20cm long in 5 colours for $9
26 Pin Dual Row Female Header with 0.1" pitch ( 2.54mm) for 0.025" square pins
- I used an 80pin one from dx.com and just cut it down with a dremel
Bread board (Optional)
- Adafruit link
Wiring the LCDClick here for a full size pdf of the wiring diagram
It is especially important when wiring up the LCD that pin 5 of the LCD be connected to ground, this is the R/W pin and it is 5V. Connecting this to any other pin on the Pi will damage your Pi!! Since we're only writing to the LCD we don't need this pin so we're shorting it to ground.
Note that in the wiring diagram there is a 560 ohm resistor between LCD Pin 15 and pin 1 on the potentiometer, this is due to the fact that some cheaper LCD displays do not come with a current limiting resistor for the backlight LED. Installing a resistor around 560 ohms will ensure the LCD does not draw too much current from the Pi, if you install it and the display's backlight is barely on then your LCD already has a current limiting resistor and it is safe to remove the one we added.
Once you've triple checked your wiring plug in your usb wifi dongle and usb keyboard, connect the Pi to a display and apply power to your Pi. There shouldn't be any smoke or fire if you've done everything correctly :) There will be no display on the LCD screen yet, adjust the potentiometer until you can just see the start of black boxes.
If your Pi fails to boot at this point go back and re-check your wiring, if it still doesn't boot then it could be that your power supply isn't powerful enough (you should be using a 5V 700mA supply). Even if your supply says it's 700mA or higher it's not uncommon for cheap no-name supplies to lie, try using a name brand cell phone charger for a smartphone (ie Samsung, Blackberry etc), obviously it'll need to have a micro usb end. You can also try booting with just the LCD screen installed but no wifi dongle or usb keyboard, if it boots then this confirms that the power supply isn't strong enough.
If you've double checked your wiring and ensured your Pi is good but it still isn't booting it may also be a good idea to remove all wiring from the header on the Pi and ensure that it is still working.
Note: Depending on the LCD you chose you may find that the potentiometer used to adjust the contrast is unnecessary and that LCD pin 3 can simply be shorted to ground instead. In my experience the yellow screens with black letters do not need a pot but blue screens with white letters do.
Installing LCD Proc
Before we start we need to check what version of raspberry pi you have.
This command will return a number corresponding to the version of Pi that you have, this will become important later when we are configuring the GPIO pins.
The main reason we need to know this is because on model B rev 1 boards pin 13 on the Pi's pin header relates to GPIO #21, on model B rev 2 boards and model A boards pin 13 is GPIO #27
If your pi returns either:
0x2 and 0x3 Then you'll follow rev 1 GPIO mapping.
If your pi returns 0x4, 0x5, 0x6, 0x7, 0x8, 0x9, 0xD, 0xE, 0xF or higher you'll follow rev 2 GPIO mapping.
Now we're ready to update packages and install lcdproc
Stop LCDd service just in case it started automatically after installing
Get custom drivers for using lcdproc with the GPIO on the Raspberry Pi, put them in a folder at /home/pi/lcd_extra_drivers
Backup then edit the LCDd.conf file
Find Driver=curses (not the one in the description at the top of the file that has a # in front of it) and change it to:
Remember when using nano you can search for words by pressing ctrl+w
Find the lines
#Hello=" Welcome to"
Remove the # from the start and change the text to
Find the lines
#GoodBye="Thanks for using"
Remove the # from the start and change the text to
Find the line
And remove the # from the front
Search again for hd44780
Change the line ConnectionType to =rpi
IMPORTANT!! If you have a rev 1 Pi D6 should be 21, if you have a rev 2 it should be 27
Edit your lines so they look like the following:
For Rev 1 GPIO
For Rev 2 GPIO
Find the line Size=20x4
And change it to:
Now save the file and exit (Press ctrl+x, then y, then hit enter)
Restart lcd proc
Now we write our lcd display script
PASTEBIN IS BEING WEIRD AND ADDING 4 SPACES TO THE START OF EVERY LINE, INSTEAD RIGHT CLICK ON "DOWNLOAD RAW" AND OPEN THE LINK IN A NEW TAB THEN COPY/PASTE. SORRY I'LL WORK ON GETTING THIS FIXED ASAP. Test the script
You should see info come up on your screen that scrolls
Press ctrl c to end the program, you'll get a few lines of info after that will end with "KeyboardInterrupt" just ignore this it's fine
Now we must go back and uncomment the lcd lines in our rc.local script
There should be two lines in the document like this:
#python /etc/mpc_lcd_info.py& #start lcd script that displays mpd info
Remove the # from in front of it then save and exit the file.
Congrats, you should now have a working PiFi-Mini with an LCD display. From here you can choose to leave it as is and run it to your stereo or do what I did and incorporate it into a box with it's own speakers and amp.