Introduction: FridgePi : Leftovers Never Sounded So Good
Runner Up in the
Raspberry Pi Contest 2017
For years I've been Air Playing music from the iPhone to a stereo setup in the basement, with speakers wired back up into the kitchen. It works well enough, but drained my phone's battery and limited the content to my iTunes library or some web radio streams that were a bit of a pain to select and get playing.
A Raspberry Pi powered touch screen portal to the world of internet radio and beyond!
As Sparky the fridge magnet fire dog says, Don't forget to plan your fire escape and practice it with your whole family!
Step 1: Step 1: Why Walk When We Can Dance? Tappa Tappa Tappa...
Sure I could have just stuck an iPad or Android tablet to the side of our fridge, but where's the fun in that!?
Plus, seeing my wife roll her eyes at yet another of my Pi projects is priceless. :)
9 years ago when we moved into our house we had to cut down a small, dead, limbless maple tree that was left by the builders to qualify our lot as treed.
I saved some of the wood from that tree, knowing someday, just maybe I'd have a Pi project I could use it in... and here we are! A nice piece of wood from our first home history being made into the frame for the touch screen and Pi.
I hoped to give the frame a weathered board look, to match a really nice coat hook project my wife did.
I cut the length of maple board into two even boards and staggered them a few inches so the edges weren't uniform.
I created the opening for the touch screen by measuring the screen, including the position of the 4 screw tabs and drilling a pilot hole for my jigsaw blade, then cutting out the rectangle shape of the screen.
I drilled down on the two pieces of wood where the screen's screw tabs aligned just deep enough so that when installed, the screen's glass would sit slightly recessed from the surface of the wood (I wanted to put a wood edge frame around the edge of the screen).
I used my plunge router with a straight bit to remove maple from the two boards where the Pi would sit.
I set the depth so that the Pi would sit flush with the back of the maple boards so the GPIO pins wouldn't contact anything and still have enough maple on the front side to be strong.
Since the areas of the wood that were being removed were not going to be seen once the electronics were installed, I didn't spend a lot of time or effort making the cutting pretty.
Plus it was -19c in my garage. So this was done pretty quickly. :)
Step 2: Step 2: Leaving Your Pi Out in the Elements...
The second step was to give the frame some character.
My wife had built a really nice coat hook hanger months before (see photo), so I thought I'd mimic her design and built the holder in it's image.
I like the weathered barn board look, but I really don't want diesel / feces saturated barn boards stuck to the side of my kitchen fridge, so I opted to create a fake weathered frame for the project.
It's actually really easy.
Select the wood for your frame.
Since the Pi itself would be sitting fairly close to the surface of the board, I opted to use hardwood (maple).
Since we had a maple tree taken down the our backyard, I used the wood from that tree.
Thus giving a personal angle to the project
Select a few colours of paint, then brush the colours onto the boards. Don't go too crazy covering every inch of the board. Just brush on sections as shown in the photos.
I found white(ish), a blue and a grey worked well.
HINT: use paint you already own, or, buy small sample cans to save $$$.
Let the paint dry, then lightly sand off layers of paint in section, creating a weathered / worn look.
Step 3: Step 3: Scruffy Looking Pi Herder...
Once the paint was sanded off, creating the weathered illusion, it was time to join the two boards together.
I used a dowel screw at one end to secure the frame boards together, at the other end I used a wood screw that would not be seen once mounted to the fridge.
Pre-drill the screw holes with the appropriate sized bits to avoid splitting the wood.
After the paint was dried, sanded and drilled, I applied a dark stain to both boards using a cloth.
This gave the frame a classic look. Again, this is totally open to your own esthetics. You can choose to stain your frame dark, light or not at all.
Step 4: Step 4: Check Check and Recheck Clearances
Once dried (24h plus). I set the touch screen into the frame to check depth and positioning.
So far so good!
The 7" screen sits 1mm or so blow the surface of the maple board surface.
The Pi itself sits inside the rear hollowed our section of the board and the HDMI cable connection routes nicely between the PI and the screen.
Don't forget to peel off the protective film prior to attaching the edge frame in the next step! :)
Step 5: Step 5: Magnets Have Complex Relationships, Attractive or Repelling...
After verifying the positioning of the screen and the cables, I secured the touchscreen in place with 4 small screws.
I used good ol' PL construction adhesive to attache the mitered maple edge frame, stained with the same stain as the wood, around the screen.
Since the screen's screw tab holes are larger, I opted to place a wood frame around the screen, covering the holes and any other imperfections of the screen placement.
The only caveat was that two of the screws holes extended past the edge of the edge frame. No big deal, as I simply covered theses two spots with hardwood plugs, also stained dark. In hindsight, I should place two more hardwood plugs on the other side of the screen, creating symmetry.
Live and learn. :)
Since the FridgePi was going to be living on the side of our kitchen fridge, I choose magnets as the means to attach it to the fridge.
Magnets are non-destructive, and (if you collect enough old electronic junk like I do), free!
Old 3.5" hard drives are a goldmine for extremely powerful, large surface area plate magnets.
The ones pictured have fields so strong, they can stay attached to opposite sides of my hand.
They also may have the added bonus of including screw mounting holes.
Step 6: Step 6: Music Makes the Network Grow Fonder
So now that the interface (FridgePi) side of the project id done, I setup a Pi with Volumio installed to act as the actual music streaming server.
You can check out the free Volumio software here: https://volumio.org/
I setup a Pi 3 with a 16mb SanDisk micro SD card and installed the Volumio image into to.
I used a HiFiBerry DAC Plus connected to the GPIO and RCA out to my 1994 JVC stereo receiver that is wired to speakers throughout our house.
Our music is stored on a Synology 1515+ and Volumio allows for AirPlay as well as thousands of web radio streams, which is good, because I love listening to Nectarine Demoscene Radio www.scenemusic.net
My wife does not... :)
I set the JVC amp to a decent MAX volume level, then configured the Pi running Volumio to access my network shared iTunes and (more importantly) DemoScene music folders on my Synology NAS.
I gave the Volumio Pi a static IP address then let it sit headless, connected to my basement network switch.
Step 7: Step 7: a NANOing We Will Go...
After configuring the Volumio Pi server, I setup the Pi that would be the main interface and be stuck the side side of our fridge.
The first thing I did was install the latest Raspbian (Stretch) from the Raspberry Pi website.
On the first boot, you'll notice the screen image quality looks like garbage. No worries! We just need to manually define the optimal resolution of 800x400 (note, your touch screen optimal resolution may be different).
Do this by editing your config.txt file in the /boot directory:
sudo nano /boot/config.txt
Add the following:
hdmi_cvt=800 480 60 6 0 0
Save and reboot the Pi.
That should look better. :)
Auto Start Chromium
Then, I had to set it to automatically start x, and login with the default user "pi".
Once the system was automatically logging in and starting the GUI, I set it to automatically load the Chromium web browser in full-screen mode on startup and directed it to the Volumio Pi server.
To do this, I did the following (remember, this is Stretch):
sudo nano /home/pi/.config/lxsession/LXDE-pi/autostart
Add the folliwing line:
@lxterminal -e chromium-browser --start-fullscreen --incognito 10.0.1.27
Where 10.0.1.27 would be your own volumio server address of course.
Remove the Cursor
Having the mouse cursor on the screen at all times is annoying, so to remove it, we use a little utility called unclutter.
Install unclutter using the terminal:
sudo apt-get install unclutter
Then, if it didn't do it by itself, simply edit your autostart file once again:
sudo nano /home/pi/.config/lxsession/LXDE-pi/autostart
@unclutter -idle 0
Now you'll only see a cursor briefly when you actually touch the screen.
Flip your touchscreen coordinates
IF you need to rotate your display upside down (say, moving it from one side of the fridge to the other) like I did, you will need to not only flip the HDMI image, but also the touch screen coordinates.
NOTE: I believe the actual Raspberry Foundation Official 7" Touchscreen does not require these steps, this is more for the plethora of 3rd party screens out there. Like the one I used. :)
Step 1: Flip the HDMI video
Edit your config.txt file located in /boot:
sudo nano /boot/config.txt
Add the following line:
display_rotate=2 180 degrees
Step 2: Flip your touch screen coordinates
Edit the file 40-libinput.conf located in /usr/share/X11/xorg.conf.d
sudo nano /usr/share/X11/xorg.conf.d/40-libinput.conf
comment out the existing entire section referencing "InputClass" with the identifier for "libinput touchscreen catchall"
Make sure it's the touchscreen and not the touchpad or tablet sections you're commenting out.
Now, add the following:
Identifier "libinput touchscreen catchall"
Option "TransformationMatrix" "-1 0 1 0 -1 1 0 0 1"
Save and reboot.
This "should" flip the touchscreen coordinates.
I hope that you enjoyed this Instructable!
I had a great time making it, and listening to it as I typed this out!
I've already stated modifying this project to include an LED illuminated push button that will toggle the back light on/off for the screen, as well as a second push button that will allow me to cycle through the various desktops and run multiple programs, so FridgePi can be used for displaying not only Volumio, but also Weather Reports, Freezer Contents Tracking database, Family Events Calendar, etc...
Stay tuned for more on these new features... Same bat time, same bat channel!
Questions, comments, suggestions, ideas, please don't hesitate to send them my way!
Take care, and happy hacking!
2 People Made This Project!
We have a be nice policy.
Please be positive and constructive.
I added two push buttons to the display.
Both are momentary, normally open (NO), push buttons with an LED (just to look cool) :)
Both buttons LED contacts are wired to the Pi's 3.3v GPIO pin and ground.
The GREEN button (has a green power emblem) is wired to the Pi's two RUN pins.
It can be used to force the Pi to restart should it become unresponsive. This is great for my setup, as the wall-wart power supply is behind the fridge and not easily accessible to pull if I need to restart the Pi. :)
The BLUE button's NO contacts are wired to GPIO 26 and ground.
I wrote a small Python script that uses UINPUT to emulate the keyboard strokes "CONTROL+TAB". This causes Chrome to cycle through it's open browser tabs when the blue button is pressed.
So on boot, I setup a tab for the Volumio interface, a tab for displaying weather and any other additional tabs I want to be able to cycle through.
Wanna see how it's all put together?
I'll assume you've already built your FridgePi (see above) and installed buttons into the frame somewhere. I used two 12mm metal buttons with internal LED/resistors.
The next step is to install UINPUT if you don't already have it running (you probably don't).
To do this, SSH into your internet connected Pi and type:
sudo pip install python-uinput
Add it to your /etc/modules file so you don't have to manually type modprobe uinput on every boot.
sudo nano /etc/modules
Add the line: uinput
Next, write your Python keystroke emulator script.
Here's mine, which I store in /home/pi/python/keyboard.py
#Original indispensable code example by Roger Woollett
#Modified and built on by Jagged_Path
from time import sleep
import RPi.GPIO as GPIO
GPIO.setup(26, GPIO.IN, pull_up_down=GPIO.PUD_UP)
device = uinput.Device([
if (GPIO.input(26) == False ):
keyA = getattr(uinput,"KEY_LEFTCTRL") #The first key to press and hold
device.emit(keyA, 1) #Hold keyA down
keyB = getattr(uinput,"KEY_TAB") #The second key to press and hold
device.emit(keyB, 1) #Hold keyB down
device.emit(keyA, 0) # Release keyA
device.emit(keyB, 0) # Release keyB
sleep(0.25) #Debounce for a few ms
os.system('clear') #Clear the screen
print ("Waiting for button input")
Credit where credit is due!
Thanks to Roger Woollett for writing a great example UINPUT Python program.
Here's a link to his example: https://www.raspberrypi.org/forums/viewtopic.php?t=188941
The trick was getting the single mechanical button press to emulate a two key stroke combination.
Using 1 (hold) and 0 (release) did the trick. Just remember to put the CONTROL before the TAB, else you'll tab trough the current tab's screen and not actually change the tabs. :)
Next, we want to get the keyboard button emulator program we just wrote to run automatically at every boot.
Let's write a little bash script and add it to the rc.local file to accomplish this.
Inside the same directory you placed the keyboard.py Python file, create this script. Again, mine lives in /home/pi/python/keyboard.sh
sudo nano keyboard.sh
sudo python /home/pi/python/keyboard.py &
Save the file and then set it to executable:
chmod +x keyboard.sh
Now, edit your rc.local file (located in /etc) and add the path to your new .sh script:
sudo nano /etc/rc.local
Add the line:
above the exit 0 statement near the bottom.
If you reboot now, your FridgePi will start, load the Volumio interface and be checking your mechanical button on GPIO 26 for input and sending CONTROL+TAB when it detets a button press.
However, you only have one tab!
Let's create a second tab on boot so we can switch between them...
From the terminal, we need to edit the autostart file for LXDE.
sudo nano /home/pi/.config/lxsession/LXDE-pi/autostart
Now, to create multiple tabs in Chromium, just add URL's one after the other.
Here's the line from my autostart file:
@lxterminal -e chromium-browser --start-fullscreen --incognito 10.0.1.27 https://dakboard.com/app?p=xxxxxxxxxxxxxxx
Note that since I'm pressed for free time, I opted to use DAKBoard (free) for my weather / background display. Pretty slick service (free and paid available).
you could just as easily use any other weather website or even an extension.
Keep adding URL's for more tabs. I plan to add a full screen calendar / To do tab as well.
If I ever get enough free time.. at least it's on my 'to do' tab... :)
I hope that helps get you going with this modification!
Have fun and let me know what you come up with! :)