How to Hack Amazon Alexa to Build a Connected Thermostat
Here's how combining an Amazon Echo Dot and an Arduino allows you to build a voice-controlled, WiFi-enabled temperature control unit for your home.
June 12, 2018
According to Amazon, there are over 30,000 skills available for Alexa now. And with a little know-how, we can transform an Echo Dot into a temperature control unit for an attic, greenhouse, un-attached garage, or in any other location in your home that isn't able to be connected to the Internet over WiFi.
The skill in question we'll be using is the Sinric app, which allows Arduino development boards to be connected with Alexa. This project uses Sinric to exploit an inexpensive ESP-01 WiFi module, interfacing to an Amazon Echo Dot. The ESP-01 relies on a very capable 8266-based controller. In this application, the coded module formats and forwards data from Alexa-based requests to the Sinric app, which is interfaced with a 433 MHz-based transceiver (HC-12) and a remote Arduino-based receiver.
Parts List:
Qty. | Part | Digi Key# | Notes |
1 | Amazon Echo Dot | ||
1 | Ardurino Nano | ||
1 | ESP-01 | ||
2 | HC-12 wireless communication module | ||
2 | HCT11 Humidity/Temp Sensor | ||
1 | 5 to 3.3 volt(200ma) regulator module | ||
1 | 33uF/25V Cap | ||
5 | 3.3K | thruHole | |
2 | 2K | thruHole | |
2 | NPN transistors (translator) | TO-92 | |
2 | 2Pin male header | 0.1" centers | |
3 | Dual (screw) Terminal | 0.2" centers | |
Perf Board, single sided clad, 0.1” pattern | as required (see text) | ||
Arduino shield | as required (see text) | ||
1 | Opti-coupler | TCp817BC9G | Optional-PC817 |
1 | NMOS transistor | Optional-IRFZ44 | |
1 | Relay module(rated 10A contacts) | Optional- | |
1 | 47 nF capacitor | ||
1 | 1N4001 diode |
DOWNLOAD THE SOURCE CODE FILES: alexa_Attic_baseINO.pdf alexa_Attic_INO.pdf
The Arduino based controller described here is coded to provide sensor, fan, and vent controls.
The ESP-01-based hardware includes a single, named output port control, providing on/off (relay) or as a dimming feature with a fader function. The output is provided with a de-bounced (push on, push off) momentary input to manually alternate the output port. The Sinric app is installed on an Alexa associated tablet or phone. It then gives you explicit control anywhere, along with the Alexa voice-based control thru the app.
The Sinric app is one of several that may also be available, and there are several ways to get the Alexa to interface into the ESP-01. I used the Sinric app because it had the graphic interfaces for switch, light, thermostat, and volume, allowing me to communicate more than an ‘On’ or ‘Off’ variable.
The switch and light modules are defined and ‘dropped in’ to the Sinric app to accommodate the combinations of features used in the project. The ESP-01 base is ‘expected’ to be customized using multiple key settings taken from the Sinric app. The base code also may be ported into the several other (and larger) 8266 based chip modules, including a WeMos mini D1.
Entering ‘set’ in the serial monitor attached to the remote controller application returns the following parameters, which may be altered (saved to EEPROM). The S1off/S2off entries are for sensor temperature offset and fan%/pump% are for fan and pump humidity trip offsets. The profile # establishes the ‘power up’ default profile. The APIkey is the last 4 characters of the provided Sinric key. Each parameter is saved to EEPROM.
The remote Arduino-based controller was assembled on an Arduino shield and is coded to provide indoor and outdoor sensors, two fans, pump, and a vent control.
The HC-12 has 100 configurable channels, beginning at 433 MHZ and offers links up to 1000 meters. (The 1000 meters is a pretty ideal spec.) I have configured my application, using the configurable link bit rate and transmit power to support ~500 feet.
The function is intended to be used to automate attic, cooler, or greenhouse ventilation fans. The controller can be used in an un-attached garage, barn, or in any other location not connected to the Internet.
F1 'temp set’ (on the schematic) may be included to allow a manually +/-4 degree offset to be used for the trip temperature. The F1/F2 jumper allows the fans to be operated separately (FanH disables FanL before being powered) for split coil fans. The vent output is asserted eight seconds before FanL is enabled and is disabled two seconds after all fans are disabled.
The application is based on a selected profile and may be defined or changed in code to provide for specific applications, environments, and season of year. These are defined as:
Minimum differential inside/outside temperature for second fan operation
Maximum outside humidity for pump to operate (with offset)
Maximum outside air humidity for fans to operate (with offset)
Temperature trip setting (code includes fixed +/-2 degree hysteresis) for low fan operation
Voice commands allow:
Trip temperature override (not saved in EEPROM)
Remote application enable; enable or disable remote controller application
Fan High override: forces fan high on or returns fan to be under controller
Fan Low override: forces fan low on or returns fan to be under controller
Selected profile to be used, 3 are defined above (max =10), saved in EEPROM
FanL is enabled when the profile trip is satisfied and FanH is enabled when the profile-defined difference temperature is meet.
The ESP-01 base is coded to define and schedule different HC-12 channels using a channel table. This allows voice commands to be forwarded to different receiver applications maintained in the ESP-01 base. The project may be used as a voice commanded remote system. Or, the remote Arduino-based application may be used separately.
Power for the ESP base (3.3V/.12A [ESP-01] and 5V/.12A [relay]) are taken from the 120VAC using a small enclosed AC-DC 5V wall adaptor and 3.3V regulator.
While the remote application is complete and operational, it is an example that you might use to implement your own functional requirements.
For any specific setup help or documents William Grill can be reached at [email protected].
[All images courtesy William Grill]
About the Author
You May Also Like