Raspberry Pi with Pimoroni Speaker Phat and motion sensor that plays a 20 second song to indicate length of hand washing. NOTE: This is a SOLDERING project! I do not recommend this project for someone without prior soldering experience.
Materials:
- Raspberry Pi Zero with Headers - https://amzn.to/2NncxP4
- or Raspberry Pi 3B, 3B+ (3A, or 4) - https://amzn.to/2O9SxiO
- MicroSD card - https://amzn.to/2Nq5AN9
- Motion Sensor - https://amzn.to/32OPMaA
- Keyboard/Mouse/Monitor
- Pimoroni Speaker PHAT
Solder Iron
Solder
Solder Holder
-
Soldering Skills
-
Raspbian OS Setup on a microSD card - https://youtu.be/2Jfv9NO6J2Q
-
Assemble Pimoroni Speaker pHat and solder - https://learn.pimoroni.com/tutorial/sandyj/assembling-speaker-phat
-
If you are using a Raspberry Pi Zero W, solder all GPIO header pins.
-
Solder wires to pins 2, 4, and 11 of the Speaker Phat.
-
Solder or attach as shown in the diagram the PIR motion sensor.
-
Install Pimoroni SPEAKER PHAT software
curl -sS https://get.pimoroni.com/speakerphat | bash
-
Hit 'y' twice and reboot when prompted. (Yes, you want the full install.)
[More info about Pimoroni SpeakerpHat here - https://github.com/pimoroni/speaker-phat ]
- Test your install by playing a test file
vlc /home/pi/Pimoroni/speakerphat/test/test.mp3
If sound plays, you can move onto the next step. If not, sudo apt-get install vlc
-
Install VLC for Python
sudo pip install python-vlc
-
Git Clone this repository -
git clone https://github.com/carolinedunn/Handwashing_Timer_Music
-
Go into the directory you just created
cd Handwashing_Timer_Music
-
Test your setup by playing some music
python test_music.py
- If Music plays, then go to the next step, if not then go back and troubleshoot. -
Run the script!
python pir.py
-
Wave your hand over the motion sensor. If music plays, move to the next step, otherwise, go back and trouble shoot.
This step is optional if you'd like for this python script to run at boot.
-
Open a Terminal
-
Enter
sudo nano /home/pi/.bashrc
-
Arrow down to the bottom of the file.
-
Enter the following at the bottom of the .bashrc
python /home/pi/Handwashing_Timer_Music/pir.py
- Ctrl-X to exit
- 'y' to Save
- Reboot your Raspberry Pi.