A while back my wife had picked up a packet of flameless candles from costco. These come with an infrared remote which you can change colors, switch modes between glow and flicker and schedule the candles to turn off after a predetermined time interval.
I thought it’d be cool to be able to have my Alexa controlling these, you walk into the room, turn off the lights and turn on these candles thereby creating a perfect environment for a romantic candle lit dinner. Right?
I got some time over the weekend to work on this and here it is, in all it’ s glory for you to enjoy.
If you’re not interested in the technical details involved in setting this up, then you can stop here. Here’s the hardware that I’ve used –
- Raspberry Pi (This plays a dual role, it hosts the server that communicates with the IR blaster and it’s also the IoT device that Alexa talks to)
- Blackbean Mini (This is the IR blaster, it mimics the remote)
- Flameless Candles and Remote (For obvious reasons)
The software components are –
- broadlink-http-rest – HTTP server, running on Raspberry Pi to Communicate with the IR blaster
- AWS IOT SDK – This is also running on my Raspberry Pi to make it an IOT device which listens on an MQTT topic to which the Alexa Skill publishes messages. This reads that message and makes a REST call to our HTTP Server
- Alexa Skills Kit SDK – For the Alexa Skill, to publish a message to the MQTT topic
- AWS Lambda, to host the Alexa Skill – I don’t think I’ll ever spin up another web server for my hobby projects
Here’s a visual diagram that represents the interaction between the pieces to paint a clearer picture –
And for those of you who want to dive deeper and play with the code, you can find it on Github.
I’ve also jotted down some notes and learnings based on developing this –
- The AWS IOT suite is really good, MQTT is a secure way to interact with IOT devices. Going forward I expect to see more devices use this, the current IOT scene is quite messy with every manufacturer spinning up their own HTTP version, with base64 encoded communication which provides no security. With this you can rest assured that it wont be easy for hackers to use you IoT device for the next DDOS attack.
- REST is awesome, this build upon the previous point. This seamless integration is possible because all these pieces talk REST
I had a lot of fun building this, maybe this can give someone else inspiration for their own IoT project. It’s really easy to extend this to control other devices in your home – TVs, ACs, Game Consoles and a bunch of other things are all controlled with IR remotes. The IoT domain is so much fun these days, the fully automated smart home even on a budget is now a reality.