Différences entre versions de « Rasp-Hack-Afficheur-LCD-Breadboard »

De MCHobby - Wiki
Sauter à la navigation Sauter à la recherche
Ligne 20 : Ligne 20 :
  
 
== Brochage du LCD ==     
 
== Brochage du LCD ==     
# Ground
+
# La masse (Ground/GND)
# VCC - 5v not 3.3v
+
# VCC - l'alimentation 5v (et non du 3.3v!)
# Contrast adjustment (VO) from potentiometer
+
# Ajustement du contraste (VO) depuis un potentiomètre
# Register Select (RS). RS=0: Command, RS=1: Data
+
# Register Select (RS, registre de sélection). RS=0: mode commande, RS=1: mode donnée (''Data'')
# Read/Write (R/W). R/W=0: Write, R/W=1: Read (we won't use this pin)
+
# Read/Write (R/W, Lecture/Ecriture).<br />R/W=0: Ecriture (''Write''), R/W=1: Lecture (''Read'').<br />Nous n'utiliserons pas cette broche.
# Clock (Enable). Falling edge triggered
+
# Clock (Enable, activée). Activation lorsque le signal passe du niveau haut à bas (''Falling edge triggered'').
# Bit 0 (Not used in 4-bit operation)
+
# Bit 0 (non utilisé en mode 4-bit)
# Bit 1 (Not used in 4-bit operation)
+
# Bit 1 (non utilisé en mode 4-bit)
# Bit 2 (Not used in 4-bit operation)
+
# Bit 2 (non utilisé en mode 4-bit)
# Bit 3 (Not used in 4-bit operation)
+
# Bit 3 (non utilisé en mode 4-bit)
 
# Bit 4
 
# Bit 4
 
# Bit 5
 
# Bit 5
 
# Bit 6
 
# Bit 6
 
# Bit 7
 
# Bit 7
# Backlight LED Anode (+)
+
# Anode (+) de la LED du rétro-éclairage
# Backlight LED Cathode (-)
+
# Cathode (-) de la LED du rétro-éclairage
  
 
== Diagramme de câblage ==
 
== Diagramme de câblage ==

Version du 29 janvier 2013 à 21:38

Afficheur LCD

Rasp-Hack-Afficheur-LCD-Montage-01.jpg

Lorsque vous rencontrez un afficheur LCD qui dispose d'un connecteur 16 broches comme celui ci, il y a de fortes chances pour que celui-ci utilise un contrôleur d'affichage HD44780. Ces dispositifs fournissent habituellement le même brochage (même organisation de broches/same pinouts) ce qui fait qu'il est relativement aisé de travailler avec eux.

L'afficheur LCD utilise une interface parallèle, ce qui signifie que nous aurons besoin de plusieurs broches de notre Raspberry PI pour le contrôler. Dans ce tutoriel, nous allons utiliser 4 broches de données (mode 4-bit) et deux broches de contrôle.

Les data pins (broche de données) parlent d'elles même. Elles envoent les données vers l'afficheur (en plaçant leurs états a haut/bas... high/low en anglais). Nous allons uniquement utiliser le mode d'écriture pour afficher du texte et n'allons pas lire de données stockées dans la mémoire du LCD.

La broche register select (registre de sélection) a deux utilisation. Lorsqu'elle est placée sur LOW (niveau bas) il est possible d'envoyer des commandes au LCD (comme positionner le curseur ou effacer l'écran). Cela est identifier comme écrire vers le registre d'instruction/de commande ('writing to the command register). Lorsqu'elle est placée au niveau HIGH (haut) le registre de sélection passe en mode donnée (data mode) qui sera utilisé pour envoyer des données à l'écran.

La broche read/write (lecture/écriture) sera placée et niveau bas (LOW)... indiquant ainsi que nous ne ferons que des opérations d'écriture (write) sur l'afficheur LCD.

La broche enable (activer) sera positionnée pour écrire des données dans les registres.

Brochage du LCD

  1. La masse (Ground/GND)
  2. VCC - l'alimentation 5v (et non du 3.3v!)
  3. Ajustement du contraste (VO) depuis un potentiomètre
  4. Register Select (RS, registre de sélection). RS=0: mode commande, RS=1: mode donnée (Data)
  5. Read/Write (R/W, Lecture/Ecriture).
    R/W=0: Ecriture (Write), R/W=1: Lecture (Read).
    Nous n'utiliserons pas cette broche.
  6. Clock (Enable, activée). Activation lorsque le signal passe du niveau haut à bas (Falling edge triggered).
  7. Bit 0 (non utilisé en mode 4-bit)
  8. Bit 1 (non utilisé en mode 4-bit)
  9. Bit 2 (non utilisé en mode 4-bit)
  10. Bit 3 (non utilisé en mode 4-bit)
  11. Bit 4
  12. Bit 5
  13. Bit 6
  14. Bit 7
  15. Anode (+) de la LED du rétro-éclairage
  16. Cathode (-) de la LED du rétro-éclairage

Diagramme de câblage

Rasp-Hack-Afficheur-LCD-Montage-02.jpg

First, connect the cobber power pins to the breadboard power rail. +5.0V from the cobbler goes to the red striped rail (red wire) and GND from the cobbler goes to the blue striped rail (black wire)

In order to send data to the LCD we are going to wire it up as follows

  • Pin #1 of the LCD goes to ground (black wire)
  • Pin #2 of the LCD goes to +5V (red wire)
  • Pin #3 (Vo) connects to the middle of the potentiometer (orange wire)
  • Pin #4 (RS) connects to the Cobber #25 (yellow wire)
  • Pin #5 (RW) goes to ground (black wire)
  • Pin #6 (EN) connects to cobber #24 (green wire)
  • Skip LCD Pins #7, #8, #9 and #10
  • Pin #11 (D4) connects to cobber #23 (blue wire)
  • Pin #12 (D5) connects to cobber #17 (violet wire)
  • Pin #13 (D6) connects to cobber #21 (gray wire)
  • Pin #14 (D7) connects to cobber #22 (white wire)
  • Pin #15 (LED +) goes to +5V (red wire)
  • Pin #16 (LED -) goes to ground (black wire)

Then connect up the potentiometer, the left pin connects to ground (black wire) and the right pin connects to +5V (red wire)

Schéma

Rasp-Hack-Afficheur-LCD-Montage-03.png

Afficheur LCD 5V et Pi 3.3v

The raspberry Pi GPIOs are designed for 3.3v, but our LCD is a 5v device. It's fine to use a 5v display, but only if we are sending data out of the Pi. We are not going to use the 3.3v power rail on the cobbler and we will tie the RW (read/write) pin of the display to GND as we do not want the display sending sending a 5v signal into the Pi.

N'inverser les connexion!

Préparer le LCD

Before you start, make sure you have a strip of 0.1" male header and a 10K potentiometer. All Adafruit Character LCDs come with these parts so you should be good to go.

Rasp-Hack-Afficheur-LCD-Montage-LCD-01.jpg

Most LCDs have a strip of 16 pins on the top, if the header is a little longer, just break it off until its the right length

Rasp-Hack-Afficheur-LCD-Montage-LCD-02.jpg

Next you'll need to solder the header to the LCD.You must do this, it is not OK to just try to 'press fit' the LCD!

Rasp-Hack-Afficheur-LCD-Montage-LCD-03.jpg

Start by connecting the 5V and GND wires from the cobbler to the breadboard. Then connect pins #1, #2 and #15, #16 to the breadboard power rails as shown. The backlight should come on. If it doesn't, check the wiring!

Rasp-Hack-Afficheur-LCD-Montage-LCD-04.jpg

Rasp-Hack-Afficheur-LCD-Montage-LCD-05.jpg

Next, wire up the contrast potentiometer as shown above, with the middle pin connecting to LCD pin #3 and the other two pins going to 5V and ground.

Twist the potentiometer until you see the first line of the LCD fill with boxes. If you don't see the boxes, check your wiring!

Rasp-Hack-Afficheur-LCD-Montage-LCD-06.jpg

Finish the wiring for the RS, RW, EN, D4, D5, D6, and D7 pins as shown in the diagram up top

Rasp-Hack-Afficheur-LCD-Montage-LCD-07.jpg

That's it! Now you're ready to run the python script to draw text on the screen!


Source: Character LCD with Raspberry Pi or BeagleBone Black écrit par Tony Dicola pour Adafruit Industries.

Traduit avec l'autorisation d'AdaFruit Industries - Translated with the permission from Adafruit Industries - www.adafruit.com

Toute référence, mention ou extrait de cette traduction doit être explicitement accompagné du texte suivant : «  Traduction par MCHobby (www.MCHobby.be) - Vente de kit et composants » avec un lien vers la source (donc cette page) et ce quelque soit le média utilisé.

L'utilisation commercial de la traduction (texte) et/ou réalisation, même partielle, pourrait être soumis à redevance. Dans tous les cas de figures, vous devez également obtenir l'accord du(des) détenteur initial des droits. Celui de MC Hobby s'arrêtant au travail de traduction proprement dit.