User Tools

Site Tools


products:i2cspilcdbackpack:index.html

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revision Previous revision
Next revision
Previous revision
products:i2cspilcdbackpack:index.html [2010/11/02 01:22]
ladyada
products:i2cspilcdbackpack:index.html [2016/01/28 18:05] (current)
Line 1: Line 1:
  
 +====== Introduction ======
 +
 +{{  /​products/​i2cspilcdbackpack/​i2cconnect_t.jpg ​ |/​products/​i2cspilcdbackpack/​i2cconnect.jpg}}
 +
 +LCDs are a fun and easy way to have your microcontroller project talk back to you. Character LCDs are common, and easy to get, available in tons of colors and sizes. [[http://​www.ladyada.net/​learn/​lcd/​charlcd.html|We'​ve written tutorials on using character LCDs with an Arduino]] (or similar microcontroller) but find that the number of pins necessary to control the LCD can be restrictive,​ especially with ambitious projects. We wanted to make a '​backpack'​ (add-on circuit) that would reduce the number of pins without a lot of expense. ​
 +
 +By using simple i2c and SPI input/​output expanders we have reduced the number of pins (only 2 pins are needed for i2c) while still making it easy to interface with the LCD. For Arduino users, we provide a easy-to-use library that is backwards compatible with projects using the '6 pin' wiring.
 +
 +{{  /​products/​i2cspilcdbackpack/​i2cwire_t.jpg ​ |/​products/​i2cspilcdbackpack/​i2cwire.jpg}}
 +
 +For advanced users, this project can be used for general purpose I/O expansion, the MCP23008 has 8 i/o pins (7 are connected) with optional pullups, the SPI 74HC595 has 7 outputs.
 +
 +Assembled and tested backpacks are available for purchase for only $10 in the Adafruit shop!
  
 ====== Which LCD to use ====== ====== Which LCD to use ======
Line 71: Line 84:
 That's it! That's it!
  
-===== Connect with I2C =====+====== Connect with I2C ======
  
 The first option we'll show is how to use the i2c interface on the backpack. We'll be showing how to connect with an Arduino, for other microcontrollers please see our MCP23008 library code for the commands to send to the i2c i/o expander. I2c is nice because it only uses two pins, and you can put multiple i2c devices on the same two pins. So for example, you could have up to 7 LCD backpacks+LCDs all on two pins! The bad news is that you have to use the '​hardware'​ i2c pins that are only on **Analog 4 & 5**. You can't change those pins and you can't use them for reading analog data. If you absolutely need those two pins, use SPI (see below) The first option we'll show is how to use the i2c interface on the backpack. We'll be showing how to connect with an Arduino, for other microcontrollers please see our MCP23008 library code for the commands to send to the i2c i/o expander. I2c is nice because it only uses two pins, and you can put multiple i2c devices on the same two pins. So for example, you could have up to 7 LCD backpacks+LCDs all on two pins! The bad news is that you have to use the '​hardware'​ i2c pins that are only on **Analog 4 & 5**. You can't change those pins and you can't use them for reading analog data. If you absolutely need those two pins, use SPI (see below)
Line 95: Line 108:
   LiquidCrystal lcd(3);   LiquidCrystal lcd(3);
  
-===== Connect with SPI =====+====== Connect with SPI ======
  
 Another option for connecting is to use **SPI**, which is a simpler protocol. The good news about SPI is that its very simple and you can use **any** 3 pins to connect. You can share the **data** and **clock** pins with another device as long as they remain outputs, the **latch** pin should only be used for the backpack. So if you wanted 3 LCDs, for example, they would all have the same **data** and **clock** pins, but the **latch** pin would be different, for 5 pins total. Another option for connecting is to use **SPI**, which is a simpler protocol. The good news about SPI is that its very simple and you can use **any** 3 pins to connect. You can share the **data** and **clock** pins with another device as long as they remain outputs, the **latch** pin should only be used for the backpack. So if you wanted 3 LCDs, for example, they would all have the same **data** and **clock** pins, but the **latch** pin would be different, for 5 pins total.
  
-The first think you will need to do is to enable SPI. To do this, solder the **SPI Enable** solder jumper by heating up the pads with a soldering iron and soldering a blob onto both pins+The first thing you will need to do is to enable SPI. To do this, solder the **SPI Enable** solder jumper by heating up the pads with a soldering iron and soldering a blob onto both pins
  
 {{  :​products:​i2cspilcdbackpack:​spiump.jpg ​ |}} {{  :​products:​i2cspilcdbackpack:​spiump.jpg ​ |}}
Line 109: Line 122:
 {{  :​products:​i2cspilcdbackpack:​spiwire_t.jpg ​ |:​products:​i2cspilcdbackpack:​spiwire.jpg}} {{  :​products:​i2cspilcdbackpack:​spiwire_t.jpg ​ |:​products:​i2cspilcdbackpack:​spiwire.jpg}}
  
-Download and install the new LiquidCrystal library (scroll to the bottom of the page for download links and instructions) Load up the HelloWorld_SPI example sketch in the new LiquidCrystal library. If you don't see the HelloWorld_SOU ​example go through the process of installing the new library again, make sure you quit and restart. Upload the sketch. You should see the backlight turn on when the Arduino resets. If you don't see any characters, adjust the Contrast trim potentiometer with a mini-screwdriver until you see the text clearly ​+Download and install the new LiquidCrystal library (scroll to the bottom of the page for download links and instructions) Load up the HelloWorld_SPI example sketch in the new LiquidCrystal library. If you don't see the HelloWorld_SPI ​example go through the process of installing the new library again, make sure you quit and restart. Upload the sketch. You should see the backlight turn on when the Arduino resets. If you don't see any characters, adjust the Contrast trim potentiometer with a mini-screwdriver until you see the text clearly ​
  
 {{  :​products:​i2cspilcdbackpack:​spiconnect_t.jpg ​ |:​products:​i2cspilcdbackpack:​spiconnect.jpg}} {{  :​products:​i2cspilcdbackpack:​spiconnect_t.jpg ​ |:​products:​i2cspilcdbackpack:​spiconnect.jpg}}
  
-===== Download =====+====== Download ​======
  
-==== Arduino Library ====+===== Arduino Library ​=====
  
 We made a modification to the LiquidCrystal library so you can use it for i2c, spi or straight-up-6-pin connections. ​ [[http://​github.com/​adafruit/​LiquidCrystal|You can get the modified library that supports SPI/i2c from GitHub.]] We made a modification to the LiquidCrystal library so you can use it for i2c, spi or straight-up-6-pin connections. ​ [[http://​github.com/​adafruit/​LiquidCrystal|You can get the modified library that supports SPI/i2c from GitHub.]]
Line 128: Line 141:
 If you have a hankering to use the backpack as a general purpose i2c expander, you should use the plain [[http://​github.com/​adafruit/​MCP23008-library|MCP23008 library, also at github]]. Its for more advanced users, by the way. If you have a hankering to use the backpack as a general purpose i2c expander, you should use the plain [[http://​github.com/​adafruit/​MCP23008-library|MCP23008 library, also at github]]. Its for more advanced users, by the way.
  
 +==== Optimized i2c library ====
 +
 +**FalconFour** posted up a [[http://​forums.adafruit.com/​viewtopic.php?​f=19&​t=21586&​p=113177|ultra-optimized high-speed i2c library, check it out for better performance!]]
  
 +===== Hardware files =====
  
 +[[http://​github.com/​adafruit/​i2c-SPI-LCD-backpack|Eagle CAD format schematic and board layout file (as well as a PNG of the schematic) are all available in the GitHub repository]]
/home/ladyada/public_html/wiki/data/attic/products/i2cspilcdbackpack/index.html.1288660932.txt.gz · Last modified: 2016/01/28 18:05 (external edit)