Update for 2019 China-US Young Maker Competition
As a lot of lazy folks, Alexa is saving my day. I don't want to spend time looking for my remote controller to turn on TV or switch sources. I would like to be able to ask Alexa to do it for me!
I spent some time building that and this article explains how.
DemoBefore discussing the technical aspects, this is a short demo video that shows how it works.
ArchitectureThere is a long road between the lazy guy's voice and the actuation on the TV. The figure below illustrate the journey of the command from the voice command to the action on the TV.
Amazon proposes a well define interaction model for the smart home skill. As this project is about building a controller for TV, everything i need is available on the smart home skill for entertainment devices.
AWS LambdaBuilding a back-end for a skill is straightforward with Lambda as they offer support for multiple programming languages and an easy integration with Alexa skills.
Ideally, using AWS IoT is recommended as it offer a more secure way to interact with the devices. However, smaller devices do not support the authentication and security mechanism offered by AWS IoT. I decided to use an other solution.
Adafruit IOI had to use a small device that connects simply to the Lambda. As this is not a critical application, lower security is acceptable.
Adafruit IO offers a MQTT broker available for free for low traffic application. It offers also libraries to connect to the broker from Arduino compatible devices.
Arduino deviceI was initially planning to use the MKR1000 as it is one of my favorite devices. unfortunately, the IR library is not supporting this device yet (i am trying to help the IRLib2 team to support it).
My choice was then for Adafruit Feather HUZZAH ESP8266 as it still a smaller device that i have available, it support WiFi, MQTT, and IR libraries. There is code examples available that illustrates how to use MQTT on this device.
The library IRremoteESP8266 works just fine with this device with plenty of examples provided including with MQTT communication.
TVDepending on the TV make and model, specific codes needs to be used. For now, i added only codes for Samsung TV. Other makes and models are available on databases like this one. I am planning to retrieve directly the codes from those databases on the runtime to support a marge number of TVs.
As example of IR codes bewo the Samsung TV's codes.
[SamsungTV - On] sendir,<mod-addr>:<conn-addr>,29,38000,<repeatcount>,1,172,172,21,64,21,64,21,64,21,21,21,21,21,21,21,21,21,21,21,64,21,64,21,64,21,21,21,21,21,21,21,21,21,21,21,64,21,21,21,21,21,64,21,64,21,21,21,21,21,64,21,21,21,64,21,64,21,21,21,21,21,64,21,64,21,21,21,1673
[SamsungTV - Off] sendir,<mod-addr>:<conn-addr>,30,38000,<repeatcount>,1,172,172,21,64,21,64,21,64,21,21,21,21,21,21,21,21,21,21,21,64,21,64,21,64,21,21,21,21,21,21,21,21,21,21,21,21,21,21,21,21,21,64,21,64,21,21,21,21,21,64,21,64,21,64,21,64,21,21,21,21,21,64,21,64,21,21,21,1673
[SamsungTV - HDMI] sendir,<mod-addr>:<conn-addr>,38,38000,<repeatcount>,1,171,171,21,63,21,63,21,63,21,21,21,21,21,21,21,21,21,21,21,63,21,63,21,63,21,21,21,21,21,21,21,21,21,21,21,63,21,63,21,21,21,63,21,21,21,21,21,21,21,63,21,21,21,21,21,63,21,21,21,63,21,63,21,63,21,21,21,1813
[SamsungTV - Antenna] sendir,<mod-addr>:<conn-addr>,37,38000,<repeatcount>,1,172,172,21,64,21,64,21,64,21,21,21,21,21,21,21,21,21,21,21,64,21,64,21,64,21,21,21,21,21,21,21,21,21,21,21,64,21,64,21,21,21,64,21,64,21,21,21,21,21,21,21,21,21,21,21,64,21,21,21,21,21,64,21,64,21,64,21,1673
[SamsungTV - Vol Up] sendir,<mod-addr>:<conn-addr>,39,38000,<repeatcount>,1,171,171,22,63,22,63,22,63,22,22,22,22,22,22,22,22,22,22,22,63,22,63,22,63,22,22,22,22,22,22,22,22,22,22,22,63,22,63,22,63,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,63,22,63,22,63,22,63,22,63,22,1813
[SamsungTV - Vol Dn] sendir,<mod-addr>:<conn-addr>,40,38000,<repeatcount>,1,171,171,22,63,22,63,22,63,22,22,22,22,22,22,22,22,22,22,22,63,22,63,22,63,22,22,22,22,22,22,22,22,22,22,22,63,22,63,22,22,22,63,22,22,22,22,22,22,22,22,22,22,22,22,22,63,22,22,22,63,22,63,22,63,22,63,22,1813
[SamsungTV - Mute] sendir,<mod-addr>:<conn-addr>,41,38000,<repeatcount>,1,169,170,21,64,21,63,21,64,21,21,21,21,21,21,21,21,21,21,21,64,21,63,21,64,21,21,21,21,21,21,21,21,21,21,21,64,21,63,21,64,21,63,21,21,21,21,21,21,21,21,21,21,21,21,21,21,21,21,21,63,21,63,21,64,21,63,21,3755
ConclusionThis project have an interesting business potential. I am planning to develop it to build a product. If your are interested for partnership, please feel free to contact me.
Comments