-
1Step 1
With this project, you will be able to automate a welcoming music for either your smart home or your smart office. As long as someone is around, the music will keep playing your favorite playlist at home or a welcome music to greet your customers or business partners while they wait in the lobby of your office.
FEATURES
- Start music once detecting any motion around
- Keep playing as long as there is someone
- Control your speaker via a TelegramBot
- Create a smooth atmosphere in the room with an audio automation
This project requires no special skills, very little equipment and can be done in less than an hour. It’s perfect for anyone who begins in home automation or an aficionado looking for new ideas and a powerful smart home OS.
-
2Step 2
Step 1: REQUIRED COMPONENTS
- Raspberry Pi v2 or v3 ($20-$35) // with a RPi2, you will need a WiFi dongle
- 16Gb SD card ($9) PIR sensor for Raspberry Pi
- Speakers (with auxiliary cable)
- A USB stick
If you already have speakers, this project can be done for less than $50.
-
3Step 3
Step 2: SET UP YOUR PROTA PI
You first need to build the smart hub that will control the automation of your ring bell and connect all devices together. Prota OS for Raspberry Pi is our free smart hub OS which is very easy to install. In no time you will turn your Raspberry Pi into a smart home automation hub!
You can download Prota OS here. Then burn it on the SD card.
We made an easy guide you can follow to set up your Prota Pi.
Alternatively, you can check this Instructables.
-
4Step 4
Step 3: CONNECT YOUR SPEAKER AND SET VOLUMIO
Volumio is the app that manages your music and let you automate your speaker.
- Connect your Raspberry Pi and speaker via auxiliary cable
- Put the music you want on your USB plug and plug it to your Raspberry Pi’s USB plug.
Now it’s time to set the Volumio app.
- Go to App Libraries and download Volumio app
- Open Volumio
- Click on the bottom left button “Browse”
- There you will be able to select the songs and radio stations you want to play and/or add to a playlist
The shared folder contains the audio files added on your USB stick.
-
5Step 5
Step 4: SET UP YOUR PIR SENSOR
As you can see, next to your sensor’s pins are small indications on what each pin is made for:
- D is for Data
- + is for the current connection
- - is for the ground connection
Simply connect as in the picture below to set properly.
For the quick explanation, the RED cable is connected to a 5V pin (PIN02), the BLACK cable is connected to a ground pin (PIN 14) and the BLUE cable is connected to GPIO18 (PIN 12).
You can look at the map below if you need any direction.
- Now let’s open Prota Space.
- If you haven’t done it yet, download the GPIO app in App Libraries.
- In GPIO app, click on GPIO18. Select “Interrupt” and “Pull down”. Click on “set”.
The sensor is now set up.
Move your hand around, you should see notifications of “rising interrupt” on the GPIO app page.
-
6Step 6
Step 5: SET UP YOUR TELEGRAM BOT
A Telegram bot is a virtual assistant that you can create on Telegram messenger app.
If you want to learn more about Telegram bots, don’t hesitate to read this previous Instructables.
- Download Telegram app on your smartphone and create an account
- Download Telegram app on your Prota Pi (in App Libraries)
- Open the Telegram app on Prota and click on “Request Authorization”
- Set a name and username for your bot, then click on "Create"
Your bot is now created! Once the automation is setup (next step), the bot will react to the message you send it to reduce, increase the volume or stop the music.
-
7Step 7
Step 6: SET UP THE AUTOMATION STORY
We will now write the four following automation storylines
- When a motion is detected, the playlist starts and play for 3 minutes until there are no more motion detected.
- When you send “Up” to TelegramBot, speaker’s music increases
- When you send “Down” to TelegramBot, speaker’s music decreases
- When you send “Stop” to TelegramBot, speaker’s music stops
Speaker automation
- Go to Stories app
- Click on + and then on “When”
- Select GPIO as the sensor of your story and set it to “when GPIO detects is a rising interrupt on GPIO18”. This means when a motion is detected.
- Select Volumio as the actor of your story and set the action to “play the Volumio”. This will play the playlist you previously prepared.
- Click on “Extra options: Delay” and set the delay to 5 minutes. This sets the timelapse the music should keep playing until there is no more motion detected.
- Click on “then” to add a follow-up actor-story. Select Volumio as actor and “stop the volumio” as action.
- Click on the save icon.
TelegramBot
- Click on + and then on “When”
- Select TelegramBot as Sensor. Select “receive a message” as event and add the condition “text equal to - Up”.
- Select Volumio as actor and set the action to “set the volume to - louder”
- Save.
- Click on + again and set a similar storyline with “Down” as message and “Quiet” as volume setting.
- Click on + again and set a similar storyline with “Stop” as message and with “stops the volumio” as action.
-
8Step 8
Step 7: INSTALL AND TEST
Your welcoming music system is now ready!
Install the Raspberry Pi next to the door and the PIR sensor toward the entrance door or somewhere in your lobby where guests usually come. The music will keep playing for 3 minutes after the last motion was detected and you will be able to remotely stop the music or modify the volume level.
You can also add Telegram to your computer to do it directly from the computer app.
If you have an Amazon Echo at home, you can also use the same triggers up/down/stop to control your music via voice command. Simply follow our IFTTT guide here and create an applet for each command. You can find another of our Instructable using IFTTT here.
We hope you enjoyed this Instructables and can know automate your office or home music system to respond to motion presence and to your chatbot commands. Don't forget to "favorite" it and to follow us on Instructables and on Twitter!
Any question? Please use our forum.
Discussions
Become a Hackaday.io Member
Create an account to leave a comment. Already have an account? Log In.