Aerial Photographer
System Overview
This is a Raspberry-Pi based device with a webcam (with microphone), speaker, and wi-fi. When powered on, it goes into an “always listening” mode, listening for a command keyword. In my project, that command keyword is “Robot”. When it hears the command, the device will respond by saying “Yes, overlord?” on the speaker. At this point it is ready to take in a command. The options are:
- Picture takes a picture
- Video (optional length argument) Takes a video of 10 seconds default, or of the specified length)
- Email (recipient) Takes a photo and emails it to the recipient. The recipient name and address must be hard-coded beforehand
- Text (recipient) Takes a photo and texts it to the recipient.
SETUP
Materials
- Raspberry Pi ($35)
- USB hub ($6)
- Webcam ($30)
- Wireless dongle ($16)
- SD card ($5)
- 10000mAh dual port USB battery pack ($30)
- USB-powered speaker ($15)
Total BOM: $137
Optional:
- Monitor with HDMI compatible cable
- Mouse, keyboard
You can use SSH and various methods to use your laptop as the monitor/keyboard/mouse, there are tutorials on those methods at the following sites:
http://www.raspberrypiblog.com/2012/10/how-to-setup-remote-desktop-from.html http://edmundofuentes.com/post/45179343394/raspberry-pi-without-keyboard-mouse-nor-screen
It can be a little easier to get started with a dedicated monitor, keyboard, and mouse, though. To set the keyboard and languages as US (default UK) you can follow the guide here
Setting Up the OS
Follow an online guide to get the latest Raspbian distro on your SD card. I found the most comprehensive guide to all your options to be this site: http://elinux.org/RPi_Easy_SD_Card_Setup
Once your Raspberry Pi is booting properly, run
sudo apt-get update
sudo apt-get upgrade
You can also use the command “startx” to go to the GUI, where it is easy to set up your wi-fi network with your wi-fi dongle plugged in. If you’re using them, your keyboard, mouse, and monitor should all work automatically.
Webcam setup
First follow the webcam setup guide.
I then created a script to take a screenshot and save it in a pictures folder, with the picture name being the date and time the photo was taken. There are two versions of the script; one that checks for an argument (either “me” or “bash”), and if there is one, sends the captured image in an email to the specified recipient. The other script sends a text instead. If there is no recipient argument, the picture is simply saved.
The script is as follows:
Text Sending Script emailpicture.sh
#!/bin/bash DATE=$(date +"%Y-%m-%d_%H%M") tts "Capturing image" 2>/dev/null fswebcam -r 1280x720 --no-banner /home/pi/Documents/Pictures/$DATE.jpg if [ $# > 1 ] then if [[ "$1" = "bash" ]] then echo "Sending text to Bash" tts "Sending text to Bash" 2>/dev/null mpack -s "Sent to Bash Via Voice Command" /home/pi/Documents/Pictures/$DATE.jpg xxxxxxxxxx@mms.att.net fi if [[ "$1" = "me" ]] then echo "Sending text to Wren" tts "Sending text to Wren" 2>/dev/null mpack -s "Sent to Wren Via Voice Command" /home/pi/Documents/Pictures/$DATE.jpg xxxxxxxxxx@mms.att.net fi fi
For step-by-step directions on creating that executable script using the command line and nano text editor, follow this link. It will involve creating a few directories, making the script, then making the script executable using chmod.
Voice Command Setup
Voice command is an open source project by Steven Hickson. To install it, follow the directions under Install Voice Command
To add more commands, just add the command word and script as shown above. To get to the config file where you can set this, run:
voicecommand –e
Instead of adding the light== … line, add the following lines. This first line just captures in image when you say “picture”. The other lines let you email either me or Bash by saying “email [recipient]” or “text [recipient]”.
Picture==/home/pi/Documents/textpicture.sh Text==/home/pi/Documents/textpicture.sh … Email==/home/pi/Documents/emailpicture.sh …
The “…” after the second two lines means that when those keywords are heard, it will also listen to the following word(s) and send them as arguments to the scripts. In this case, it is to specify a recipient.
Mail Setup
Start off by following the SMTP setup directions. Once you have set things up and entered your account information, the scripts mentioned above will take care of the rest! The phone numbers in the scripts are the recipient phone numbers.
Autologin Setup
When I power the Pi, I want it to automatically log in and run voice command. Autlogin is done by changing the inittab file like so: To edit inittab:
sudo nano /etc/inittab
Then replace the line:
1:2345:respawn:/sbin/getty –noclear 38400
with
1:2345:respawn:/sbin/getty –autologin pi –noclear 38400
To have the voicecommand script auto-run at startup, I added the script to the etc/profile document.
sudo nano /etc/profile
Add at the end:
. /home/pi/Documents/startup_script (or whatever your path is)
The script has just two lines:
#!/bin/bash voicecommand
Please log in to post comments.