Friday, February 13, 2015

Using your RPi2 for Valentines Day

Thought I would share something cool I did with my Raspberry Pi that others might like for Valentines day.

I basically had a lot of devices sitting around that I realized I could amalgamate together for a good Valentines day surprise for my girlfriend.

First off I had my robotic bartender (bottender), which you can see in my Hackaday projects page.
I modified it so that it would pour wine on command.

Next I had a set of WeMo light switches that you can get here:

Belkin WeMo Light Switch, Wi-Fi Enabled

These are really nicely made. They are easy to install WiFi-enabled and it is easy to interface with them using our custom API.
I found a nice API for the wemo light switches here.
In the end though, I ended up creating a simple shell script API that uses CURL. You can see mine on github here.

I set up my WeMo light switch to control my bedroom fan. Then I sprinkled the top with rose petals.
Connecting this all together, I have a button on my phone that turns the fan on, sprinkling rose petals down, and turns bottender on, pouring two glasses of wine. Resulting in this:


Happy Valentines Day everyone!



Consider donating to further my tinkering since I do all this and help people out for free.


Places you can find me

Wednesday, February 11, 2015

Control anything electrical with the Raspberry Pi using 433 MHz RF

I've gotten a lot of e-mails in the past about controlling lights, plugged-in utilities, etc. with my voicecommand software on the Raspberry Pi and I decided to make a quick easy guide.

Why would you want to do this?

This is an easy question to answer. I walk into a room and I say Pi . . . Let there be light and behold the lights turn on. Or for those with less dramatic flair, just saying lights and having the lights turn on.
Having voice controlled lights in your house just seems convenient.

How can I do this?

It's easy actually.
I've created an image for the RPi that already has everything you need on it. This means it's easier than ever to control electronics with your voice.

You can download it at:
https://mega.co.nz/#!MM8W1JxR!4PlZ_1-dumasDUCYRI4LuiBwEJgtqhfoin0R8ls90NQ

Once you have the image on your Raspberry Pi, buy some RF 433 MHz light switches or sockets like these: 
Etekcity ZAP 5LX Auto-Programmable Function Wireless Remote Control Outlet Light Switch with 2 Remotes, 5-Pack Outlet

You can plug those into an outlet and plug anything (including a light) into them.

Next you need a 433 MHz transmitter and receiver for the RPi. You can get those here:
433Mhz RF transmitter and receiver kit for your Experiment

Then you can wire them up to the pi using the GPIO and use pilight to control them. You wire them in as below:
The smaller unit is plugged into voltage, ground, and pin 17 while the larger board is plugged into voltage, ground, and pin 18.

Once your transmitter and receiver are wired up, simply point the remote at the receiver, run pilight-debug, and press the button on the remote you want to learn. Now you can copy that string and use pilight-send to send it.
Example:
sudo killall pilight-daemon or sudo service pilight stop
sudo pilight-debug
Then CTRL+C when you see a RF string. Mine looks something like this:
172 688 172 688 172 516 172 688 172 688 516 172 172 688 516 172 172 688 172 688 172 688 516 172 172 688 516 172 516 172 516 172 172 688 172 688 172 688 172 688 516 172 516 172 172 688 172 688 172 5814
**Note** Sometime's I have trouble escaping out of pilight-debug. When that happens I kill it (kill -9) from a different terminal
Now I can turn that light on.
First restart the pilight daemon:
sudo pilight-daemon or sudo service pilight start
Now send the command:
sudo pilight-send -p raw -c "172 688 172 688 172 516 172 688 172 688 516 172 172 688 516 172 172 688 172 688 172 688 516 172 172 688 516 172 516 172 516 172 172 688 172 688 172 688 172 688 516 172 516 172 172 688 172 688 172 5814"
but with your own string. Do this for the on and off settings for as many lights as you want.

Now I can add that command in a script and use voicecommand to run it when it hears the right command!
You can do this with voicecommand -e

You can read more about it at the hackaday projects page here.

And here is a quick video demo:

Consider donating to further my tinkering since I do all this and help people out for free.




Also, a contact of mine recently did a computer vision kickstarter. You should join that if you want to learn more about computer vision.
https://www.kickstarter.com/projects/1186001332/pyimagesearch-gurus-become-a-computer-vision-openc

Places you can find me