Modifications

Sauter à la navigation Sauter à la recherche
2 525 octets ajoutés ,  31 décembre 2016 à 11:41
Ligne 164 : Ligne 164 :  
* La broche gauche sur la masse/GND/ground (fil noir)
 
* La broche gauche sur la masse/GND/ground (fil noir)
 
* La broche droite raccordée à +5V (fil rouge)
 
* La broche droite raccordée à +5V (fil rouge)
 +
 +
= MCP23017 IO Expander + LCD =
 +
== A propos du MCP23017 ==
 +
One problem with using a character LCD is that you give up a lot of GPIO pins to talk to the LCD. Four pins are used to send data, two pins are used for write and clock signals, and another pin or three are used for the backlight for a total of ~6-9 total pins! On a platform like the Raspberry Pi model A/B with only a dozen or so GPIO pins you can quickly run out of pins for other parts of your project. However with chips like the MCP23008 or {{pl|218|MCP23017}} you can easily add extra GPIO pins to your development board through an I2C interface!
 +
 +
If you aren't familiar with the MCP230xx series of chips, there's [[Rasp-Hack-MCP230XX|a great guide that describes their usage with a Raspberry Pi]]. Note that you don't need to install the library or code from the guide, it's only provided for reference.
 +
 +
== Câblage ==
 +
To use an MCP230xx chip with a character LCD you will need to wire the MCP chip to your board's I2C pins, and then wire the LCD to the MCP chip. Below are examples of wiring an MCP23017 to the Raspberry Pi or BeagleBone Black.
 +
 +
If you'd like to use an MCP23008 instead of the MCP23017 the wiring is similar, however consult the MCP23008 datasheet to see which pins are for power, ground, I2C, and GPIO.
 +
 +
Wire your MCP23017 and LCD as follows:
 +
 +
{{ADFImage|Rasp-Hack-Afficheur-LCD-Breadboard-a20.png}}
 +
 +
* Connect Pi 3.3V power to the power rail of the breadboard, and connect the MCP VDD and RESET to 3V power. Be careful to connect the 3.3 volt and not 5 volt power to these pins!
 +
* Connect Pi ground to the ground rail of the breadboard, and connect the MCP VSS and address pins, one outer lead of the potentiometer, the LCD ground, and the LCD R/W pin to the ground rail.
 +
* Connect Pi 5V power to the other outer lead of the potentiometer, LCD power, and LCD backlight+ pins. Note that 5 volt and not 3.3 volt power is used to power the LCD!
 +
* Connect the middle pin of the potentiometer to the LCD contrast/V0 pin.
 +
* Connect Pi I2C SCL to MCP I2C SCL.
 +
* Connect Pi I2C SDA to MCP I2C SDA.
 +
* Connect MCP GPIOA0 to LCD RS.
 +
* Connect MCP GPIOA1 to LCD EN/clock enable.
 +
* Connect MCP GPIOA2 to LCD DB4.
 +
* Connect MCP GPIOA3 to LCD DB5.
 +
* Connect MCP GPIOA4 to LCD DB6.
 +
* Connect MCP GPIOA5 to LCD DB7
 +
* Connect MCP GPIOA6 to LCD -R/red backlight.
 +
* Connect MCP GPIOA7 to LCD -G/green backlight.
 +
* Connect MCP GPIOB0 to LCD -B/blue backlight.
 +
 +
{{ambox|text=Make sure you've enabled I2C on the Raspberry Pi if you haven't done so already.}}
       
{{Rasp-Hack-Afficheur-LCD-TRAILER}}
 
{{Rasp-Hack-Afficheur-LCD-TRAILER}}
29 910

modifications

Menu de navigation