Différences entre versions de « RASP-RDIOWIFI-PI-LCD »

De MCHobby - Wiki
Sauter à la navigation Sauter à la recherche
Ligne 3 : Ligne 3 :
 
{{traduction}}
 
{{traduction}}
  
 +
= Configuration de l'écran LCD =
  
 +
Si vous n'avez pas encore assemblé l'écran au Raspberry Pi, voici le guide d'assemblage.
  
 +
 +
Pour le Raspberry Pi Modèle A: l'écran LCD Pi Plate est normalement assemblé avec une cale en caoutchouc à proximité d'un coin pour la stabilité au sommet du Raspberry Pi. Cette cale repose sur la prise Ethernet, qui est seulement présente sur la carte Model B.
 +
Pour le modèle A il faudra trouver une alternative appropriée à cette cale isolante. Un bouchon de liège ou de plastique à la bonne taille peut faire l'affaire.
 +
Pour le fun, vous pouvez aussi utiliser une brique Lego comme support.
 +
 +
Le Raspberry Pi doit être arrêté et débranché de l'alimentation lors de la connexion de l'écran LCD. Si elle est en cours d'exécution, exécutez la commande pour l'arrêter avant de le débrancher, comme indiqué au bas de la page précédente.
 +
 +
Alignez les 26 broches sur la plaque LCD et Raspberry Pi, et installer la plaque en appuyant vers le bas doucement mais fermement.
 +
 +
Branchez le Raspberry Pi. Le voyant d'alimentation rouge devrait apparaître. Sinon, il pourrait y avoir une erreur de soudure sur la carte de l'écran LCD.
 +
 +
Attendre 30 secondes à une minute pour que le Raspberry Pi soit complètement démarré et soit accessible depuis le réseau. À ce stade, vous devriez être en mesure de se connecter à partir d'un terminal sur ssh, e.g .:
 +
 +
 +
Align the 26-pin headers on the LCD plate and Raspberry Pi, and install the plate by pressing straight down gently.
 +
 +
Connect power to the Raspberry Pi. The red power light should come on. If not, there might be a soldering mistake on the LCD Pi Plate board.
 +
 +
Allow 30 seconds to a minute for the Raspberry Pi to fully boot and situate itself on the network. At this point, you should be able to log in from a terminal over ssh, e.g.:
 +
 +
ssh pi@192.168.0.6 (or whatever address the system reported during the configuration process)
 +
 +
If you previously installed netatalk (optional), and if you changed the Raspberry Pi’s default hostname, you might be able to use:
 +
 +
ssh pi@pandora.local
 +
If you receive a response that the connection timed out or the hostname cannot be resolved, connect a monitor and keyboard and work through the “Initial System Configuration” steps again; it’s most likely a typo in the wireless setup.
 +
You should be successfully logged into the system at this point.
 +
 +
First, let’s test the LCD and buttons:
 +
 +
cd Python-WiFi-Radio
 +
sudo python Adafruit_CharLCDPlate.py
 +
 +
If using an RGB-backlit LCD, the program should cycle through different backlight colors (with the Blue & White LCD, it will flash on and off a few times). Then it will ask you to try pressing buttons.
 +
 +
Adjust the Contrast dial (using a small screwdriver if necessary) until the text is sharp and legible.
 +
 +
When finished, press Control+C to exit. The LCD is ready!
 +
Next, let’s try our radio software:
 +
 +
sudo python PiPhi.py
 +
 +
This is our own “wrapper” for pianobar, allowing us to use the LCD and buttons to interact with that program. If all goes well, the system should report its network address, fetch a list of stations from the Pandora server and start playing. If not, refer to the Troubleshooting page.
 +
 +
With only a few buttons available, we’ve condensed only the most essential functions to this program. If you need to configure your Pandora account (such as adding new stations to the list), use a web browser to access the Pandora web site.
 +
 +
From left to right, the button functions are:
 +
Play/Pause (tap once to pause, again to play, or hold for three seconds to exit the program).
 +
Station select (brings up a menu — can then use the up and down buttons to pick a station — press this button again to activate, or the Play/Pause button to cancel).
 +
Volume Up/Down (two buttons, one above the other)
 +
Next Track
 +
Take a moment to experiment with the buttons and familiarize yourself with their use. If everything seems to be working, we’ll do some final configuration to make the system truly standalone. To exit from the PiPhi program, hold down Select (the leftmost button) for 3+ seconds.
 +
Final Configuration and Auto-Start
 +
First, cd to the directory with the PiPhi.py script (you should already be there if you've followed the steps till now!) and edit the PiPhi.py script:
 +
 +
nano PiPhi.py
 +
 +
Two lines near the start of the code (around line 26) are of interest:
 +
Copy Code
 +
RGB_LCD      = False # Set to 'True' if using color backlit LCD
 +
HALT_ON_EXIT = False # Set to 'True' to shut down system when exiting
 +
If you’ve opted for an RGB-backlit LCD, change the first of these lines to:
 +
Copy Code
 +
RGB_LCD = True
 +
Since our goal is a standalone system with no keyboard or monitor, we need some way to issue an orderly shutdown (Linux systems don’t like it when you just pull the plug). To make the 3-second button press shut down the system (rather than just exit to a command line prompt), change the second line to:
 +
Copy Code
 +
HALT_ON_EXIT = True
 +
Nearly there! Now we just need to set up the system to start our program upon booting.
 +
 +
sudo nano /etc/rc.local
 +
 +
Before the final “exit 0” line, insert these two lines:
 +
Copy Code
 +
cd /home/pi/Python-WiFi-Radio
 +
python PiPhi.py &
 +
If you downloaded or otherwise placed the radio software in a different location, the first line should be changed accordingly. “sudo” isn’t necessary here because the rc.local script is already run as root.
 +
 +
Reboot the system to test the startup function:
 +
 +
sudo reboot
 +
 +
After 30 seconds to a minute, you should see the backlight turn on and music will begin. If not, connect to the system using ssh and confirm the configuration steps above.
  
  
 
{{RASP-RDIOWIFI-PI-TRAILER}}
 
{{RASP-RDIOWIFI-PI-TRAILER}}

Version du 25 avril 2016 à 11:09


MCHobby investit du temps et de l'argent dans la réalisation de traduction et/ou documentation. C'est un travail long et fastidieux réalisé dans l'esprit Open-Source... donc gratuit et librement accessible.
SI vous aimez nos traductions et documentations ALORS aidez nous à en produire plus en achetant vos produits chez MCHobby.

Configuration de l'écran LCD

Si vous n'avez pas encore assemblé l'écran au Raspberry Pi, voici le guide d'assemblage.


Pour le Raspberry Pi Modèle A: l'écran LCD Pi Plate est normalement assemblé avec une cale en caoutchouc à proximité d'un coin pour la stabilité au sommet du Raspberry Pi. Cette cale repose sur la prise Ethernet, qui est seulement présente sur la carte Model B. Pour le modèle A il faudra trouver une alternative appropriée à cette cale isolante. Un bouchon de liège ou de plastique à la bonne taille peut faire l'affaire. Pour le fun, vous pouvez aussi utiliser une brique Lego comme support.

Le Raspberry Pi doit être arrêté et débranché de l'alimentation lors de la connexion de l'écran LCD. Si elle est en cours d'exécution, exécutez la commande pour l'arrêter avant de le débrancher, comme indiqué au bas de la page précédente.

Alignez les 26 broches sur la plaque LCD et Raspberry Pi, et installer la plaque en appuyant vers le bas doucement mais fermement.

Branchez le Raspberry Pi. Le voyant d'alimentation rouge devrait apparaître. Sinon, il pourrait y avoir une erreur de soudure sur la carte de l'écran LCD.

Attendre 30 secondes à une minute pour que le Raspberry Pi soit complètement démarré et soit accessible depuis le réseau. À ce stade, vous devriez être en mesure de se connecter à partir d'un terminal sur ssh, e.g .:


Align the 26-pin headers on the LCD plate and Raspberry Pi, and install the plate by pressing straight down gently.

Connect power to the Raspberry Pi. The red power light should come on. If not, there might be a soldering mistake on the LCD Pi Plate board.

Allow 30 seconds to a minute for the Raspberry Pi to fully boot and situate itself on the network. At this point, you should be able to log in from a terminal over ssh, e.g.:

ssh pi@192.168.0.6 (or whatever address the system reported during the configuration process)

If you previously installed netatalk (optional), and if you changed the Raspberry Pi’s default hostname, you might be able to use:

ssh pi@pandora.local If you receive a response that the connection timed out or the hostname cannot be resolved, connect a monitor and keyboard and work through the “Initial System Configuration” steps again; it’s most likely a typo in the wireless setup. You should be successfully logged into the system at this point.

First, let’s test the LCD and buttons:

cd Python-WiFi-Radio sudo python Adafruit_CharLCDPlate.py

If using an RGB-backlit LCD, the program should cycle through different backlight colors (with the Blue & White LCD, it will flash on and off a few times). Then it will ask you to try pressing buttons.

Adjust the Contrast dial (using a small screwdriver if necessary) until the text is sharp and legible.

When finished, press Control+C to exit. The LCD is ready! Next, let’s try our radio software:

sudo python PiPhi.py

This is our own “wrapper” for pianobar, allowing us to use the LCD and buttons to interact with that program. If all goes well, the system should report its network address, fetch a list of stations from the Pandora server and start playing. If not, refer to the Troubleshooting page.

With only a few buttons available, we’ve condensed only the most essential functions to this program. If you need to configure your Pandora account (such as adding new stations to the list), use a web browser to access the Pandora web site.

From left to right, the button functions are: Play/Pause (tap once to pause, again to play, or hold for three seconds to exit the program). Station select (brings up a menu — can then use the up and down buttons to pick a station — press this button again to activate, or the Play/Pause button to cancel). Volume Up/Down (two buttons, one above the other) Next Track Take a moment to experiment with the buttons and familiarize yourself with their use. If everything seems to be working, we’ll do some final configuration to make the system truly standalone. To exit from the PiPhi program, hold down Select (the leftmost button) for 3+ seconds. Final Configuration and Auto-Start First, cd to the directory with the PiPhi.py script (you should already be there if you've followed the steps till now!) and edit the PiPhi.py script:

nano PiPhi.py

Two lines near the start of the code (around line 26) are of interest: Copy Code RGB_LCD = False # Set to 'True' if using color backlit LCD HALT_ON_EXIT = False # Set to 'True' to shut down system when exiting If you’ve opted for an RGB-backlit LCD, change the first of these lines to: Copy Code RGB_LCD = True Since our goal is a standalone system with no keyboard or monitor, we need some way to issue an orderly shutdown (Linux systems don’t like it when you just pull the plug). To make the 3-second button press shut down the system (rather than just exit to a command line prompt), change the second line to: Copy Code HALT_ON_EXIT = True Nearly there! Now we just need to set up the system to start our program upon booting.

sudo nano /etc/rc.local

Before the final “exit 0” line, insert these two lines: Copy Code cd /home/pi/Python-WiFi-Radio python PiPhi.py & If you downloaded or otherwise placed the radio software in a different location, the first line should be changed accordingly. “sudo” isn’t necessary here because the rc.local script is already run as root.

Reboot the system to test the startup function:

sudo reboot

After 30 seconds to a minute, you should see the backlight turn on and music will begin. If not, connect to the system using ssh and confirm the configuration steps above.



Source: Raspberry Pi WiFi Radio créé par Phillip Burgess pour www.adafruit.com

Traduit , corrigé et augmenté par Antoine Wrotny (PYRANOID) pour MCHobby SPRL 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.

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