Introduction: Raspberry Pi Rain Box

I find the sound of rain really soothing, and wanted a device to just play rain sounds for me. I figured the Raspberry Pi would be perfect for this. So I wrote a Python script that selects a random number, and, based on the number, selects a rain sound to play. After that, I stuck it in a hobby project box from Radioshack, wired with some old speakers and it was done! Soothing rain sounds for me! What's great about this setup is that the Raspberry Pi is still usable even though this script runs at start up, so you can have rain running while you work with your Pi if you'd rather not have it in a box. Also, this is a pretty cheap project, so its great for a weekend project that doesn't break the bank!

Note: Important points will be in bold!

Second Note: This Instructable will be divided into two parts, software and hardware, which will cover two separate aspects of the project.

Third Note: Please look at all pictures! Many contain important image notes, though the points mentioned are stated in the steps.

Here's a video of it working!


Step 1: Tools and Materials

Tools:
  • Drill w/ assorted drill bit sizes
  • Wire Cutters
  • Electrical Tape and/or Heat Shrink Tubing
  • Soldering Iron/Solder
  • Screwdriver
  • Optional: Dremel with drill bits
Materials:
  • Large Flip Switch
  • 5V Regulator (Radioshack) 
  • 7x5x3" Hobby Project Box (Radioshack)
  • Computer Speakers (Any cheap/old ones will do, just make sure they have an amplifier inside and an audio)
  • Wire
  • Raspberry Pi
  • Small Computer Fan (The one I used is rated at 5V)
  • Micro USB Cable
That's it! Only a few parts to assemble! Total cost excluding the Raspberry Pi should be around 20-30 dollars, USD, depending on certain varying parts and where they are obtained.

Step 2: Software - Part 1

So, to begin, download the Python script rain.py included on the intro page, and place it in the /home/pi directory. Pygame was used in this project, so IDLE needs to be used instead of IDLE 3, since Pygame, as of right now, only works on Python 2, but it should be unnecessary to note unless changes to the program are needed. We also need to download some rain music files. I downloaded some long free rain mp3 files from here:  

https://archive.org/details/Sounds_of_Nature_Collection

After relabeling your mp3 files as Rain1, Rain2, and Rain3, place them in the /home/pi directory also. It may be necessary to expand the file system in order to make room for the mp3 files, which can be done by modifying settings in the config menu. Do this by typing  raspi-config in the terminal. Extra if/else statements and rain mp3 files can be added for more variety, or any extra sounds you like!

Step 3: Software - Part 2

In order to have the music play at boot up, the file rc.local needs to be changed. Its located in the /etc folder. Type in sudo nano /etc/rc.local in order to modify it. Two lines of code need to be added. amixer set PCM -- 1000, and python /home/pi/rain.py & 
The '&' symbol is very important! It allows the script to run in the background, otherwise the RPi will not be able to run anything else and the SD card will need to be reflashed! That finishes the software part!

Step 4: Hardware - Part 1

To start the hardware part of this project, the speakers need to be taken apart. When taking apart the speakers, wires may have to be cut, so be sure to make a note of which connections go where! Next, layout the speakers and the switch on the lid of the box (picture 2) and mark with a permanent marker. We'll have to drill some holes for these next.

Step 5: Hardware - Part 2

Next, drill a hole for the switch, double checking that the switch will stay firmly in place in the hole. If you have a washer to go over the switch, check that it holds the switch firmly. A speaker hole layout was drilled with my Dremel using small Dremel drill bits, but a drill should work fine as well. To do this, I drilled two separate crosses. One with two holes on the four sides of the center hole, and the other cross with three holes on all four sides of the center hole. Now install both the speakers and switch. Secure the switch with either hot glue or a washer, and secure the speakers with either hot glue or screws. I found hot glue to work fine for both the speakers and the switch in a pinch.

Step 6: Hardware - Part 3

At this point the speaker and audio jack connections can be remade, so referring to your notes made on where each connection is, solder the speakers and audio jack back to the audio amp circuit board, covering connections where necessary. Now is a good time to check that powering up your speakers and plugging in an audio source will play through the speakers. After checking that the speakers work fine, a hole in front of the box needs to be drilled for the volume control knob. Drill the hole, making sure that the knob can turn freely in the hole. Also, I recommend drilling this hole as low as possible on the box since I had a difficult time concerning room in the box with the speakers and circuit board. So, drill the hole lower and eventually the board will be glued in place in the bottom of the box to secure it.

Step 7: Hardware - Part 4

Now we're ready to power up the system and install everything in the box. Before soldering everything, be sure to drill a small hole in the back of the box in order to string the power cord through, I also tied a knot in it so that no electronics are being pulled on. Follow the included schematic to solder all the power connections. The 5V regulator gets hot, so a small hole in the back of the box is needed for the fan exhaust. I put this all the way to the opposite side of the power cord hole. I also cut a snippet of metal I had laying around to act as a heat sink which I screwed the regulator on to. The fan and 5V regulator need to be glued in the box in such a way that the fan is free to blow, blows ACROSS the regulator and out the small exhaust hole in the back of the box (refer to picture). Almost done! Put everything in the box, making sure that a.) all connections are made and the audio jack is plugged in to the Raspberry Pi, b.) the fan is free to blow air, c.) the audio amplifier is glued in the bottom of the box to prevent movement  d.) all connections are covered! Finally, screw the lid on with the included screws.


Well, that about wraps it up! Enjoy the rain!

Supercharged Contest

Participated in the
Supercharged Contest

Raspberry Pi Contest

Participated in the
Raspberry Pi Contest