Ever find yourself turning off your alarm clock without realizing it only to wake up an hour later and have to race out the door? In this build we are going to build a robot alarm clock that makes you work to turn it off! Not only that, but the robot will be able to sync to your Google Calender allowing for the alarm time to be adjusted using almost any device.
Introduction:
Today almost everyone uses their phone as an alarm clock which has a range of benefits. Phones are easy to set, easy to adjust, play custom songs, and can even sense when is the best time to wake you up. The problem is, unless your phone is across the room, we use our phones so much we can literally use them in our sleep. Why not build a robot that is able to do all these things, but wont stop till you get up and start moving! Our robot will be able to easily move randomly around the room over any surface with ease playing a custom alarm tone. In order to set the alarm simple link the program on the BrickPi to your Google account and it will search events with the title “wake1” and automatically start the alarm at the events time. This means the alarm time can very easily be adjusted using any device that can access your Google Calender.
Parts Required:
- RaspberryPi
- BrickPi
- BrickPi Power Pack
- SD Card with Raspbian Wheezy installed
- Wifi Dongle
- 1 Small Speaker (Such as the X-Mini 2)
- 2 LEGO® Mindstorm® Motors
- 2 LEGO® Mindstorm® Touch Sensors
- 2 LEGO® Wheel
- LEGO beams and pins to construct the robot platform
The Build:
In order to begin we will need to collect the components from the bill of materials below. These will be the components needed in order to build our robot. It is possible to use either LEGO® Mindstorm® NXT or EV3 motors and sensors for this project.
Upon completion of collecting all of the necessary part it will simply be a matter of assembling the robot. This can be done by following the step by step instructions found here in PDF format. Instruction Manual
Once the robot has been assembled it is important to remember which sensors and motors are plugged into each port.
- Right motor = PORT_A
- Left motor = PORT_D
- Touch sensor one = PORT_1
- Touch sensor two = PORT_2
- Ultrasonic sensor = Port_4
- Speaker = audio jack and USB port
Your Rolly Robot is know assembled and ready to be programmed!
The Software:
For our software to work we will need to install a few additional components to our Raspberry Pi so that everything is able to operate correctly. You will first need to download the .zip folder below. While there are two versions the ultrasonic sensor is the sensor which determines which version you are able to use.
This should be unzipped into a folder on the desktop, the ‘alarm.py’ file opened, and lines 26 and 27 edited. You will need to replace ’email’ with your Google Calender email and ‘password’ with your password and save the file.
- calendar_service.email = ’email’ #your email
- calendar_service.password = ‘password’ #your password
With the ‘alarm.py’ file customized it is time to setup the software needed. This can be done very easily by setting up the the alarm_setup.sh as an executable file and running it. First you will need to open a terminal window and using the ‘cd’ command chance to the director that you unzipped the needed files.
Once the terminal is looking at the correct folder it will be necessary to run “sudo chmod +x alarm_setup.sh” without the quotes. Once this script has finished it will be possible to run the command “sudo ./alarm_setup.sh” which will run the installer. Upon competition your Rolling Robot is complete and ready to run. If you are still in the directory that the files were unzipped it all that is necessary to run the program is type “python alarm.py” which will start your robot scanning Google Calender for the phrase “wake1.”
Putting it all Together:
With our robot built, the Raspberry Pi configured, and the BrickPi programmed we only have one step left to complete. In order for our robot to begin to play its alarm and move we will need to give it a start time. This can be done by simply logging into Google Calender and adding a new event. This event will need to be titled “wake1” and be given a start time that is when you would like the robot to go off. Simple save this event and your robot will wake you up and make you work to turn in off the next morning. It is also possible to add a small speaker which will play the ‘alarm_sound.mp3’ file while the robot moves around the room. This .mp3 file can be any track as long as the name remains the same.