background image

Adafruit 16x2 Character LCD + Keypad for Raspberry Pi

Created by lady ada

Last updated on 2014-07-24 04:15:09 AM EDT

Summary of Contents for i2c 16x2 RGB Pi Plate

Page 1: ...Adafruit 16x2 Character LCD Keypad for Raspberry Pi Created by lady ada Last updated on 2014 07 24 04 15 09 AM EDT ...

Page 2: ... 5 Male Header Pins 6 Printed Circuit Board 7 Raspberry Pi Plate Header 8 Bumper Additional Assembly Model B Protection Usage Setting up your Pi for I2C Using the example Python code Testing the Library Adjusting Contrast Using the library code Download Adafruit Industries https learn adafruit com adafruit 16x2 character lcd plus keypad for raspberry pi Page 2 of 32 ...

Page 3: ...y RGB negative http adafru it 399 and RGB positive http adafru it 398 Unfortunately these LCDs do require quite a few digital pins 6 to control the LCD and then perhaps another 3 to control the RGB backlight for a total of 9 pins That s nearly all the GPIO available on a Raspberry Pi Adafruit Industries https learn adafruit com adafruit 16x2 character lcd plus keypad for raspberry pi Page 3 of 32 ...

Page 4: ...s AND 5 keypad pins using only the two I2C pins on the Pi The best part is you don t really lose those two pins either since you can stick i2c based sensors RTCs etc and have them share the I2C bus This is a super slick way to add a display without all the wiring hassle Adafruit Industries https learn adafruit com adafruit 16x2 character lcd plus keypad for raspberry pi Page 4 of 32 ...

Page 5: ... out our Stacking Header you can fit an IDC cable over it if the Plate is assembled with this part http adafru it 1112 WARNING The new Raspberry Pi model B with 4 USB ports overlaps closely with backlight resistor leads on the char LCD plate You will need to cover the USB port and back of resistors with electrical tape to protect them from touching See more details and pictures on the assembly pag...

Page 6: ...a little more stable than before 1 Resistors There is a total of 3 resistors in this kit For resistors labeled RED and BLUE on the PCB they are 1 4W 5 220 ohm resistors Red Red Brown Gold For the resistor labeled GREEN on the PCB it is a 1 4W 5 330 ohm resistor Orange Orange Brown Gold 2 Potentiometer There is one 10k trim potentiometer This part will go in the spot labeled Contrast 3 Pushbuttons ...

Page 7: ...d Circuit Board There will be one PCB in the kit as shown above 7 Raspberry Pi Plate Header There will be one extra tall 26 pin female header for plugging into the Pi 8 Bumper There will be one rubber bumper as shown above Additional You ll want an LCD to place into the shield This isn t included by default since a lot of people already have LCDs they may want to use We do sell these in packs howe...

Page 8: ...ight or have no backlight at all We carry Negative type http adafru it 399 or Positive type http adafru it 398 LCDs as well as Blue and White LCDs http adafru it 181 Adafruit Industries https learn adafruit com adafruit 16x2 character lcd plus keypad for raspberry pi Page 8 of 32 ...

Page 9: ...p your soldering iron and make sure you re ready to go We ll start with the first resistor GREEN which has orange orange brown gold bands on it This resistor acts as the backlight control resistor for the green backlight pin Bend the resistor into a staple and slide it into the slot marked GREEN on the PCB Resistors do not have a direction so you can put it in either way and it ll work find Adafru...

Page 10: ...up and ready solder in both leads of the resistor To do this heat up the round ring pad and the wire lead at the same time for 2 or 3 seconds then dip the end of the solder into the heated joint to melt it in Then remove the solder and the soldering iron Adafruit Industries https learn adafruit com adafruit 16x2 character lcd plus keypad for raspberry pi Page 10 of 32 ...

Page 11: ...s of the resistor This keeps them from shorting to something else Use diagonal or flush cutters to clip the wires right above where the solder joint ends Adafruit Industries https learn adafruit com adafruit 16x2 character lcd plus keypad for raspberry pi Page 11 of 32 ...

Page 12: ...ime The two 220 ohm resistors RED and BLUE named because they are the backlight series resistors for the RGB backlights on the LCDs These resistors are colored Red Red Brown Gold Adafruit Industries https learn adafruit com adafruit 16x2 character lcd plus keypad for raspberry pi Page 12 of 32 ...

Page 13: ...Solder the resistors just like you did with the first one Adafruit Industries https learn adafruit com adafruit 16x2 character lcd plus keypad for raspberry pi Page 13 of 32 ...

Page 14: ...d be able to make talking back to your project easy These are connected to the I2C port expander chip so they require no extra pins on the Pi our library does the work of reading whether they are pressed All the buttons are the same and they should snap nicely into place Press down onto each button until it snaps in and sits flat against the PCB Adafruit Industries https learn adafruit com adafrui...

Page 15: ...t so the buttons are on the RIGHT side instead of the left The buttons snap in the same but they re on the right Adafruit Industries https learn adafruit com adafruit 16x2 character lcd plus keypad for raspberry pi Page 15 of 32 ...

Page 16: ...s are sticking out Solder each leg taking care not to accidentally short two button legs together The ones for the directional pads are very close Adafruit Industries https learn adafruit com adafruit 16x2 character lcd plus keypad for raspberry pi Page 16 of 32 ...

Page 17: ...es in the same way just in the middle Flip over the PCB and solder in the three legs of the potentiometer We re nearly done Now we will place the I2C port expander chip Double check that it has the MCP23017 E SP marking on it This is a 16 pin expander chip that uses the i2c bus That means you can send it commands using the i2c pins on an Pi and control 16 more digital pins 5 of those pins go to th...

Page 18: ... make absolutely sure you ve got it in the right way Once you are sure press the chip into place We recently adjusted the kit so the chip is more to the left its the same alignment just shifted over Adafruit Industries https learn adafruit com adafruit 16x2 character lcd plus keypad for raspberry pi Page 18 of 32 ...

Page 19: ...Flip over the PCB and solder in the 28 pins of the port expander Adafruit Industries https learn adafruit com adafruit 16x2 character lcd plus keypad for raspberry pi Page 19 of 32 ...

Page 20: ...e the bumper from the backing and attach it on the underneath so its right over the Ethernet jack when the PCB is plugged in On kits where the buttons are on the left put it right below the contrast pot as shown This will keep the pot from touching the Ethernet jack On kits where the buttons are on the right put it right next to the buttons it shouldnt overlap any button legs sitting flat Adafruit...

Page 21: ...Place the 2x13 header onto your Pi and slide the plate on top it should fit perfectly Adafruit Industries https learn adafruit com adafruit 16x2 character lcd plus keypad for raspberry pi Page 21 of 32 ...

Page 22: ... down with tape to get it sitting flat against the Pi Solder in one pin we suggest the top right then check if the plate is sitting flat If not heat up the joint with one hand while stabilizing with the other until its right Then solder the other 25 pins Adafruit Industries https learn adafruit com adafruit 16x2 character lcd plus keypad for raspberry pi Page 22 of 32 ...

Page 23: ...isplay you ll need 18 for a blue white you ll need 16 Place the header into the remaining slot with the long ends of the pins sticking UP If you have only 16 pins leave the two rightmost pads empty Adafruit Industries https learn adafruit com adafruit 16x2 character lcd plus keypad for raspberry pi Page 23 of 32 ...

Page 24: ...o rows of connectors or one row If its a two row connector LCD we do not use the bottom row just continue using the LCD as it will fit just fine The LCD should snap in against the buttons Solder all the pins Adafruit Industries https learn adafruit com adafruit 16x2 character lcd plus keypad for raspberry pi Page 24 of 32 ...

Page 25: ...g the new Raspberry Pi model B with 4 USB ports you will need to take some extra steps to ensure the backlight resistor leads do not touch the USB ports and short out See the steps below for more details Adafruit Industries https learn adafruit com adafruit 16x2 character lcd plus keypad for raspberry pi Page 25 of 32 ...

Page 26: ...ure it is advised to cover the USB port and resistor leads in a few layers of electrical tape Be sure to cut the resistor leads as short as possible with flush cutters and try to ensure there are no sharp edges from the cut leads or solder See the photo below with arrows pointing to the two locations you should place electrical tape Note that if you are using a Raspberry Pi model A or B i e Pi wit...

Page 27: ...t s it You re done soldering now you just have to run the code in the Usage section next Adafruit Industries https learn adafruit com adafruit 16x2 character lcd plus keypad for raspberry pi Page 27 of 32 ...

Page 28: ...of the file Then save and reboot to enable the hardware I2C driver Before you can get started with I2C on the Pi you ll need to run through a couple quick steps from the console Just enter the following commands to add SMBus support which includes I2C to Python i2c tools isn t strictly required but it s a useful package since you can use it to scan for any I2C or SMBus devices connected to your bo...

Page 29: ...r the older library it can still be found at its home on GitHub http adafru it dK9 For new projects try using the newer library described here The easiest way to get the code onto your Pi is to hook up an Ethernet cable and clone it directly using git which is installed by default on most distros Simply run the following commands from an appropriate location ex home pi Testing the Library sudo apt...

Page 30: ...usage of the character LCD plate class The basic usage is to import the library and create an instance of the Adafruit_CharLCDPlate class The char LCD plate class is smart enough to know how to talk to the character LCD plate without any configuration or parameters Once you have an instance of the Adafruit_CharLCDPlate class there are a few functions you can call to interact with the display messa...

Page 31: ... Adafruit Industries https learn adafruit com adafruit 16x2 character lcd plus keypad for raspberry pi Page 31 of 32 ...

Page 32: ...ruit s Pi Python codebase http adafru it aOg Check the Usage page for how to install the example python code directly from your Pi using git Adafruit Industries Last Updated 2014 07 24 04 15 24 AM EDT Page 32 of 32 ...

Reviews: