You are on page 1of 5

Yet another programmer

My programming experiences
About
Tag Archives: arduino relay shield
SiriProxy + Raspberry Pi + my little lamp = awesome sense
of achievement
By steve0hh on May 10, 2013 | 9 Comments
Not trying to say that Ive created/invented something very awesome. But the sense of
being able to DIY and learning lots of things from it. The sense of achievement is
really there. =)
Also, there might already be blogs teaching how to do it, but I am still gonna write
about how it works and the problems Ive faced while doing it and hopefully there
would be still some of you guys that will benefit from it.
This is what youll get at the end of this tutorial.
Warning! Do proceed with this project with care as you are dealing with AC
electricity which could potentially kill you.
Cut the crap! Now for the interesting part!
How did I do it?
What you will need:
Some basic electronics and electrical skill
01 x Raspberry Pi with SiriProxy installed
01 x Relay control kit which I happened to have one lying around because I was
tinkering withArduino last time in school.
01 x switch lying around
01 x Raspberry Pi cobbler kit
01 x Multimeter (Optional but will be good for troubleshooting)
Some jumper wires
Get SiriProxy running
If you have not installed SiriProxy on your Raspberry Pi, please do so. You can the
guide here.
Check if your SiriProxys plugin file are working:
Note:
For this example, I am going to edit SiriProxy example instead of creating a new one
but if you would like to use this project for many many of your switches at home, its
generally a good idea to create your own plugin, but for simplicity sake, I shall stick
with this.
First in your Raspberry Pis terminal,
type :
vim ~/SiriProxy/plugins/siriproxy-example/lib/siriproxy-example.rb
Inside siriproxy-example.rb edit:
listen_for /test siri proxy/i do
to
listen_for /hello siri proxy/i do
I had a hard time troubleshooting if it works because I missed the following step.
In which Ive found the answer from the SiriProxys Wiki page.
After editing of plugin file, type:
siriproxy update .
Then start Siriproxy server on your Raspberry Pi again:
siriproxy server
Now, test from your iPhone that its working by launching Siri and saying:
hello siri proxy
And if Siri replies you with
siri proxy is up and running
congrats, you have just successfully edited the siriproxy example plugin.
Now install WiringPi!
Installation of WiringPi is pretty, Ive followed the instructions of @drogons and
didnt encounter any problems.
Type your code to make it work! :)
Edit your plugin to make it work! Type the following into your terminal :
vim ~/SiriProxy/plugins/siriproxy-example/lib/siriproxy-example.rb
Then in your file just under the
listen_for /hello siri proxy/i do
...
...
...
end
Add the following code:
listen_for /turn on the lights/i do
say "turning on the lights"
request_completed
system("gpio mode 1 out")
system("gpio write 1 1")
end

listen_for /turn on the lights/i do
say "turning on the lights"
request_completed
system("gpio mode 1 out")
system("gpio write 1 1")
end
The code is pretty much self-explainatory for listen_for /turn on the lights/i
do and say "turning on the lights"
request_completed tells Siri that the request is completed and stop Siri from the
endless spinning awaiting for another command from the server.
system("gpio mode 1 out") makes the Raspberry Pis GPIO Pin 01 be an output.

You might also like