Introduction: Airplay Receiver With a Turntable Look
I just turned the Raspberry Pi into an airplay receiver, which has a LP turntable look. Every time the music (streaming for iphone etc. to the airplay receiver) starts, the LP turntable begin rotating; and it will stop rotating when the music stops.
Just for fun :)
Step 1: Install Shairport and Some Additional Scripts
First install shairport on your Raspberry Pi. There is a bunch of tutorials on the web, for example, this one. The steps of installation will be omitted here.
After the installation, let's do the tweaking part.
Edit the startup script:
sudo nano /etc/init.d/shairport
Change the DAEMON_ARGS line as follows:
DAEMON_ARGS="--daemon --pidfile $PIDFILE --log $LOGFILE -B '/bin/bcmd.py' -E '/bin/ecmd.py' -M $MDIR "
Which means, the script /bin/bcmd.py will be executed when the airplay receiver starts playing, and the script /bin/ecmd.py will be executed when it stops.
Then let's create bcmd.py and ecmd.py.
#! /usr/bin/python import os os.system("/usr/local/bin/gpio write 0 1");
#! /usr/bin/python import os os.system("/usr/local/bin/gpio write 0 0");
Edit /etc/rc.local and add the following lines, which will set the gpio #0 and #1 with mode OUTPUT and signal 0 every time the system starts up.
/usr/local/bin/gpio mode 0 OUTPUT /usr/local/bin/gpio write 0 0 /usr/local/bin/gpio mode 1 OUTPUT /usr/local/bin/gpio write 1 0
OK, we just finish the software part. Let's proceed to the hardware part.
Step 2: Prepare the Following Parts
- Prepare the following parts:
one low-speed DC motor (40 rpm)
one L9110 DC motor driver board
one plastic geer wheel that fits the DC motor
some LP record as you like
Step 3: Attach the Motor to Some Fixed Surface
Attach the motor to some fixed surface. I attached it to a discarded iphone dock here.
Step 4: Stick the Geer Wheel to the Back of Your LP Record
Stick the geer wheel to the back of your LP record
Step 5: Connect All the Parts Together
Connect the DC motor, the motor driver, Raspberry Pi GPIOs as the picture shows.
Step 6: Install the LP Record to the Motor
Finally install the LP record to the motor by fitting the geer and the motor shaft.
Now power on your raspberry pi, stream your music to the airplay receiver and enjoy!