But: transformer un vieux poste radio a lampes HS des années 60/70 récupéré en vide grenier en poste mp3 avec un raspberry Pi.
Au niveau Matériel :
– un vieux poste radio a lampes HS des années 60/70
– un Raspberry Pi
– un ampli 2.1 20W
– 3 HP 5W
– un Afficheur 128×128 pixels
– deux encodeurs rotatifs
– un disque dur SSD avec adaptateur USB
– horloge RTC en I2C
– bande de led RGB
– deux alimentations 220v/5V ( une pour la partie Audio , l’autre pour la partie “numérique” 5A) et conneteur alimentation et interrupteur M/A
– un ventilateur 5V avec grille
– un disque dur SSD ( dans mon cas un 120Go)
ou trouvez les divers éléments :
1 x Raspberry Pi
2 x 3-inch-Full-Range-Speaker-4ohm-5W
1 x 4-Pouces Haut-Parleur-4-Ohm-15-W graves
1x Ampli 2.1 20W 5V
2 x Encodeur rotatif
1 x Horloge I2C
2 x alimentation 220v -5v 3A
2 x câble USB
1 x câble réseau
1 x ventilateur 5v+1 x grille 60mm
1 x interrupteur + 1 x connecteur alimentation
Au niveau logiciel :
– Raspbian lite dernière version
– daemon mpd
– python3
– scripts divers ( gestion des encodeurs rotatif en émulation clavier UP,DOWN,LEFT,RIGHT,ENTER,PLAUY/PAUSE).
Photos de la transformation :
bon j’avoue en étant électronicien / informaticien , je déteste la partie “mécanique” ( boitier et autre ) , c’est donc mon beau-frère qui s’occupe de cette partie en plus ayant son Fablab perso il a tous les outils nécessaire
pour remplacer la lampe de “l’Œil magique” un afficheur 1.44” SPI de 128×128 pixels qui permettra d’afficher divers menu et aussi la pochette de la piste en cours a base de st7735 / ili9163

câblage des GPIO ( provisoire)
Name |
Usage |
Board |
Usage |
Name |
3.3V |
RTC.VCC |
01 | | 02 |
LED.VCC |
5V |
GPIO02 |
RTC.SDA |
03 | | 04 |
LCD.VCC |
5V |
GPIO03 |
RTC.SCL |
05 | | 06 |
|
GND |
GPIO04 |
|
07 | | 08 |
U_TXD |
GPIO14 |
GND |
RTC.GND |
09 | | 10 |
U_RXD |
GPIO15 |
GPIO17 |
ENC1.B |
11 | | 12 |
SPI1_CE0 |
GPIO18 |
GPIO27 |
ENC1.A |
13 | | 14 |
LCD.GND |
GND |
GPIO22 |
ENC1.SW |
15 | | 16 |
LCD.LED |
GPIO23 |
3.3V |
|
17 | | 18 |
LCD.A0 |
GPIO24 |
GPIO10 |
LCD.SDA |
19 | | 20 |
|
GND |
GPIO09 |
|
21 | | 22 |
LCD.RST |
GPIO25 |
GPIO11 |
LCD.SCK |
23 | | 24 |
LCD.CS |
GPIO08 |
GND |
ENC1.GND |
25 | | 26 |
|
GPIO07 |
ID_SD0 |
* |
27 | | 28 |
* |
ID_SC1 |
GPIO05 |
ENC2.A |
29 | | 30 |
FAN.GND |
GND |
GPIO06 |
ENC2.B |
31 | | 32 |
FAN.PWM |
GPIO12 |
GPIO13 |
ENC2.SW |
33 | | 34 |
LED.GND |
GND |
GPIO19 |
SPI1_MISO |
35 | | 36 |
|
GPIO16 |
GPIO26 |
|
37 | | 38 |
LED.DI |
GPIO20 |
GND |
ENC2.GND |
39 | | 40 |
SPI1_SCLK |
GPIO21 |
installation logicielle , j’ai décidé de me passer de carte SD sur le Raspberry et booter directement sur le SSD ( voir article frambroise 314 )
j’ai fait 3 partions sur le hdd (/dev/sda1 vfat 100M , /dev/sda2 ext4 8Go , /dev/sda3 ext4 le reste du disque pour stockage des fichiers audios )
mon /etc/fstab
proc /proc proc defaults 0 0
PARTUUID=0c9f0562-01 /boot vfat defaults 0 2
PARTUUID=0c9f0562-02 / ext4 defaults,noatime 0 1
PARTUUID=0c9f0562-03 /var/lib/mpd ext4 defaults,noatime 0 1
une fois raspbian lite installé et le raspberry pi en route on commence a installer les paquets nécessaire :
sudo apt install python3-pygame python-pygame python-spidev python3-spidev
sudo apt install mpd python-pip python3-pip
sudo apt install evtest telnet samba lame flac faad vorbis-tools
sudo apt install mc alsa-utils libmpdclient-dev cython
pip install python-uinput
pip install python-mpd2
pip3 install python-mpd2
fichier a créer / modifier
- /etc/modprobe.d/fbtft.conf
options fbtft_device name=fb_ili9163 gpios=reset:25,dc:24,led:23 speed=40000000 rotate=90 bgr=1 custom=1 fps=60
- /etc/modules-load.d/fbtft.conf
spi-bcm2835
fbtft_device
- /etc/modules-load.d/RotaryKey.conf
uinput
logiciels a installer /compiler , je met tous dans /opt/scripts
cd /opt
mkdir scripts
cd /opt/scripts
- Automatic library-wide shuffle for mpd ( gestion playlist aléatoire )
git clone https://github.com/joshkunz/ashuffle.git
cd ashuffle/
make
sudo make install
git clone https://github.com/jameh/mpd-album-art.git
cd mpd-album-art
sudo python3 setup.py install
- gestion du clavier virtuel depuis les 2 encodeurs rotatifs
- /opt/scripts/RadioKey.py ( script pour gerer le “clavier”) pour l’instant un seul encodeur géré UP,DOWN,ENTER
#!/usr/bin/env python
import RPi.GPIO as GPIO
import uinput
from time import sleep
# version PCB
pin_a1 = 37 #GPIO 13
pin_b1 = 35 #GPIO 19
pin_sw1= 33 #GPIO 26
pin_a2 = 36 #GPIO 16
pin_b2 = 38 #GPIO 20
pin_sw2= 40 #GPIO 21
GPIO.setmode(GPIO.BOARD)
GPIO.setup(pin_a1, GPIO.IN, pull_up_down=GPIO.PUD_UP)
GPIO.setup(pin_b1, GPIO.IN, pull_up_down=GPIO.PUD_UP)
GPIO.setup(pin_sw1, GPIO.IN, pull_up_down=GPIO.PUD_UP)
GPIO.setup(pin_a2, GPIO.IN, pull_up_down=GPIO.PUD_UP)
GPIO.setup(pin_b2, GPIO.IN, pull_up_down=GPIO.PUD_UP)
GPIO.setup(pin_sw2, GPIO.IN, pull_up_down=GPIO.PUD_UP)
device = uinput.Device([uinput.KEY_UP, uinput.KEY_DOWN,uinput.KEY_ENTER,uinput.KEY_PLAYPAUSE,uinput.KEY_LEFT,uinput.KEY_RIGHT])
seq_a1 = seq_b1 = seq_sw1=0
seq_a2 = seq_b2 = seq_sw2=0
def on_Sw(pin):
sw = GPIO.input(pin_sw2)
if sw == 0:
device.emit_click(uinput.KEY_ENTER)
sw = GPIO.input(pin_sw1)
if sw == 0:
device.emit_click(uinput.KEY_PLAYPAUSE)
def on_edge1(pin):
global seq_a1, seq_b1
a1 = GPIO.inp