Alexa, open Spark and ... (Amazon Echo Hackathon)

Hey Everyone,

Just a quick post but I thought y’all might be interested. Last night I got to be part of an Amazon Echo hackathon. It was the first time anybody on our team had ever worked with the Echo so we needed every minute of the 4 hours we got to hack.

Here’s a picture our setup as we waited to present:

  1. Spark Core in a Spark Button. Responded to the “set color” command
  2. Spark Core + DHT22 running the PietteTech library. Responded to the “how hot is it in here?” and “how humid is it in here?” questions
  3. Amazon Echo
  4. Portable Power Supply (so we could untether the Spark Button to show everyone in the room)
  5. Power Supply for the other Spark Core and to power the WiFi hotspot
  6. WiFi hotspot running on a phone (to demonstrate that the Cores weren’t just connected to the same WiFi as the Echo) and Beer

We implemented the following workflow:

  1. Us: “Alexa, open Spark”
  2. Alexa: beep
  3. Us: “How humid is it in here?” or “How humid?”
  4. Alexa: “The humidity is 54%” (Used a Spark.variable to grab the humidity)
  5. Us: “How hot is it in here?” or “How hot?”
  6. Alexa: “It is 77 degrees Farenheight” (Used a Spark.variable to grab the temp)
  7. Us: “Set color red”
  8. Alexa: “Setting color to red” (Spark Button lights up red. Used a Spark.function to send the temp as "rrr,ggg,bbb)

Other colors were supported (yellow, green, magenta, cyan, etc)

The backend
We were lucky enough to find a SDE (Software Development Engineer) at the last second. Without him I don’t think we’d have gotten the Echo API implemented, it’s not as straightforward as you would think. The backend code itself was hosted on Heroku and written in Ruby. He used this Ruby Project to get it connected to the Spark API.

So, how did we do?

Out of the numerous teams there (I guess somewhere around 40-50 but I will ask for the exact number, judging took 3 hours) we did decently well. We came in tied for second!

We tied… AGAINST ANOTHER TEAM USING A SPARK CORE! (They used it to simulate making cocktails so I guess the tie is acceptable). Out of all the teams there only 3 did IoT projects, and we all came in top 3 (1st, 2nd, and 2nd). GO IoT! & Spark!

Anyway, let me know if anybody has any questions. This is my first hackathon in a while so I was pretty excited. It was a fun experience (the pizza was pretty good and free beer is always a good thing)

16 Likes

Great Project @harrisonhjones!

One question, this is possible only with Echo SDK?

Not really. The “SDK” is just an example java implementation. You do need access to developing apps for your Echo/Alexa. Once you have that you just need to setup your backend and device you app and you are good to go

2 Likes

i saw this article today, and it made me search for this community post.

i also got an echo last week, so im trying to think of a fun implementation…

1 Like

If you want to start a GIT repo for using a Photon to impersonate a weemo switch I’m down. I’d love to contribute (I also have a Echo now)

1 Like

interesting. i might want to make my echo integrate with my new photon powered BBQ.
“alexa, when will my ribs be done?”

You can run a hue bridge emulator on any computer that runs java (or node), I have a raspberry pi setup to interface my echo with a bunch of my home automation stuff (including my spark core powered blinds).

1 Like

Links/More Info on the Bridge Emulator and Spark-powered blinds? I’d be interested in both!

Sure I’m feeling a little under the weather but when I get up I’ll post some info

1 Like

@harrisonhjones here is a link to the java version of the hue bridge emulator https://github.com/armzilla/amazon-echo-ha-bridge I have it running on a 2nd generation raspberry pi. Mine is setup with a custom REST endpoint app for smart things but I would imagine it would be easy to hook in anything you want (I think amazon might require HTTPS so you will probably need to use an intermediary to get it to talk directly to a core/photon (maybe through webhooks). I’ll take some pictures of the blinds later this evening when I finally get around to adding a hard coded switch (i’ll have to go up into the blinds anyways). I have never used the node one but this is likely it https://www.npmjs.com/package/huemulator all i know is that there is one that several over at smart things have gotten one of the node implementations up and running. What I really like about it is that since it emulates a hue bridge no need for the extra language, just alexa turn on the lights in the kitchen or close the dining room blinds etc…

2 Likes

Thanks a bunch for the links! I pulled down the node emulator and it doesn’t work out of the box. I was able to get it to work with a bit of tweaking. As I mentioned in the issue on the project’s GH I’ll see if I can’t find what’s wrong and issue a PR. If I get some time I might even see about integrating some Particle-ness into it.

[Edit @hawesg I don’t see “open” or “close” as one of the available alexa commands. Can you confirm these work? My alexa is at home :frowning: while I’m away]

@harrisonhjones open and close do (or at least did work), I originally set it up going through my home server before I got the blinds hooked in with end points. “Alexa open the kitchen lights” and “Alexa close the kitchen lights” worked perfectly. Then I finished the blinds and switched over to a fork of the java emulator that integrates with smart things directly. Sadly “Alexa open/close the blinds” doesn’t seem to work. I haven’t had a chance to see if its a change in the code that is causing the problem or if it is the keyword blinds that she doesn’t like. The other day when moving my smart things hub the usb connector broke, I’ll play around with it in a couple days when the new one comes and let you know.

@harrisonhjones here is a some info I copied from a post that i made over on the smart things forum,

https://youtu.be/NIKup7Cy8YQ

https://youtu.be/v70ifkk-tYQ

https://youtu.be/MwTrQsULo0c

As you can see I used a servo to shaft coupler from servocity, I haven’t settled on a mount yet, the spacing was perfect when I trimmed off the plastic tabs on one side of the servo.



Everything is all tucked away except the bottom right hand corner of the window where a usb cord comes out and plugs into an outlet right beside it (not pictured).

Now I just need to figure out how to do the top window in that room, i’m thinking a continuous rotation servo used to pull the two cords rather than getting a ladder and going up to the header which is like 19 feet up.

2 Likes

The code is pretty basic as all it needs to do is position the servo

Good Project!! I am thinking If I can use my raspberry Pi as a Amazon echo to control my photon?Because I don’t have a Amazon echo in hand , but I have a raspberry Pi and I’ve set it could work with the Amazon Voice Service . :grinning:

That should work! You can also test your skill out with Echo sim