Introduction: Raspdio

About: I'm a Univern! I'm following a one year intense program to learn, meet amazing people & gain parctical experience on a global scale.

An connected radio checking the internet to see when and for how long it should play.

Operation Principle: The Raspberry Pi queries a google spreadsheet to retrieve the "wake up" time, the "sleep time" & the duration of the play. A button can also start/stop the radio. Volume control is also available.

More Info: http://univership.org/projects/NXf9Bzunz9owYdx5d/...
Github: https://github.com/gcool-info/raspdio


Created @Tink Tank with @Arthur Schmitt as part of my Univership

Step 1: Get Your Material

You will need:

- A Raspberry Pi

- wifi dongle (e.g. Edimax EW-7811Un)

- speaker (I used the one from Kano)

- A 3D printer

- An ADC (e.g. MCP3008)

- A push button

- A potentiometer

- A breadboard

Step 2: Connect the Speaker

The speaker is connected to 5V and Ground for power.

It received the audio signal from the 3.5mm jack.

(If you're unsure about the pin location, check this: http://elinux.org/RPi_Low-level_peripherals)

Step 3: Connect the Button

The push button is connected to pins GPIO4, GND & GPIO17.

Current passes through GPIO17 & GND and the RPi detects whether the button has been pressed.

This button has a led inside it. GPIO4 controls whether the LED is turned on or off.

Step 4: Volume Control

To control the volume we will use a potentiometer. The output signal is analogue but the RPi doesn't have a built-in ADC. So we have to include one....

I followed this excellent tutorial by adafruit to do this: Connect RPi to MCP3008

Note that I connected the potentiometer to CH7 of the MCP3008!

Step 5: Create the Google Spreadsheet

You can copy the google spreadsheet from my drive: Control Room

After you copy it to your drive, make sure to note down the spreadsheet's key. We will use it later.

In this example shown below, it is the part of the URL which is bold / underlined


Step 6: Configure the Wifi on the Raspberry Pi

1. Boot the Raspberry Pi and run: sudo nano etc/network/interfaces

Edit the file so that it looks like:

auto lo iface lo inet loopback iface eth0 inet dhcp allow-hotplug wlan0 iface wlan0 inet manual wpa-roam /etc/wpa_supplicant/wpa_supplicant.conf iface default inet dhcp

2. Run the command: sudo nano etc/wpa_suppilicant/wpa_suppilicant.conf
- If you are on a WPA-EAP network, edit the file so that it looks like:

ctrl_interface=DIR=/var/run/wpa_supplicant GROUP=netdev

network {ssid=""
key_mgmt=WPA-EAP password="" identity=""


- If you are on a WPA-PSK network, edit the file so that it looks like:

ctrl_interface=DIR=/var/run/wpa_supplicant GROUP=netdev

network {ssid=""
key_mgmt=WPA-PSK psk=""


Step 7: Add the Files to the Raspberry Pi

You can clone all files to the raspberry pi from my github by using:

git clone https://github.com/gcool-info/raspdio.git

(if you haven't installed git on your Pi, you can run: sudo apt-get install git)

Otherwise, just copy the files inside "pi.zip" in some directory on your Pi.

- Make sure to change the following lines in the file "main.py":


You can also modify the radio stream (if you don't want to the most boring station ever!!)

streamURL = "http://2QMTL0.akacast.akamaistream.net/7/953/177387/v1/rc.akacast.akamaistream.net/2QMTL0"


In this file, we take a look at the gSpreadsheet every 5min & we get the "wake up", "sleep" time & duration.

We check these against the current time & if there is a match, we play the music for "duration". We also adjust the volume on whether it it the "wake-up" or the "sleep" time.

We then configure an interrupt to check whether the button is pressed (to stop or start the music accordingly).

Finally, if the radio is playing, we are constantly querying the ADC to get the volume.


Step 8: Add Dependancies

- We will have to install the gspread python library, which will do the heavy lifting of connecting to google docs and updating the spreadsheet!

sudo apt-get install python-pip

sudo pip install gspread

- We also need to install a streaming music library by using the commands:

sudo apt-get install mpc mpd

This installs the Music Player Daemon (mpd) and it's client mpc.You use the mpc client to configure mpd to add radio streams to the playlist, start and stop the player etc.

Step 9: Run Program on Pi Boot

To run the program immediately when the Pi boots up, we use a crontab. A crontab is a background (daemon) process that lets you execute scripts at specific times. It's essential to Python and Raspberry Pi. To do this, open the file launcher.sh

nano connected-doorbell/pi/launcher.sh

Make sure that the line

cd home/pi/Desktop/raspdio

is pointing to the directory containing your main.py program.

Then, follow this excellent tutorial: https://www.instructables.com/id/Raspberry-Pi-Launch-Python-script-on-startup/ (starting from step 2)

Step 10: 3D Print and Assemble!

Open the stl files & print them. If you're using different components, make sure to change their dimensions!

Then assemble, plug-in and play!

Be the First to Share


    • Science Fair Challenge

      Science Fair Challenge
    • Woodworking Contest

      Woodworking Contest
    • Trash to Treasure Contest

      Trash to Treasure Contest



    Reply 7 years ago on Introduction

    I've heard "Dios", would that be spanish instead of Italian? Or do they both need an "s"?
    Great looking project here, very nice finished form!


    7 years ago on Introduction

    Don't you have to start the RaspberryPi with a login and password? If so how do you do that?


    Reply 7 years ago on Introduction

    Linux's cron can run scripts as the default user, immediately after power on, without a human user ever logging on.


    Reply 7 years ago on Introduction

    Yep! The default login is "pi" and the password is "raspberry"


    7 years ago on Introduction

    Very cool build- excellent application of a ras-pi. Nice work!