Smart Heater made with Arduino IoT Cloud, can be controlled with Amazon Alexa using the Arduino Alexa skill.
Video tutorial found here:
It uses relays to "hack" the buttons on the remote (I used relays because I wanted to use the MKR IoT Carrier) but it can be achieved with opto-isolators/optocouplers too. It utilizes Arduino IoT Cloud to interact with an Amazon Alexa device. The tutorial below will show you how to create and adapt this project. I find a delay of 100 milliseconds works best for how long to activate the relay, it doesn't go too fast so the relay won't get burned out and the remote will also receive the message.
Project Tutorial:Step 1, Configuring IoT Cloud:
Add these variables (all variables will appear as "devices" to Alexa, but they don't have to be) to IoT Cloud you may have to adapt these to your needs and change the code too:
- Variable name: Heater, Variable type: Cloud Switch (Alexa Compatible), Variable Update Policy: On Change, Purpose: Use this variable to turn heater on and off.
- Variable name: high_power_mode, Variable type: Cloud Switch (Alexa Compatible), Variable Update Policy: On Change, Purpose: Use this variable to toggle the Heater Mode.
- Variable name: low_power_mode, Variable type: Cloud Switch (Alexa Compatible), Variable Update Policy: On Change, Purpose: Use this variable to toggle the Heater Mode.
My heater has toggle switches so you might need to adapt this for other kinds of remote controls.
Step 2, Create the Circuit:
Once you open up your remote, it might be a pcb with momentary switches like mine or it might have a forked pattern of metal the gets connected when someone pushes the button because the button has a conductive material on the back, in the first case solder two wires on the two diagonal terminals of the button. In the second case solder the two wires on both sides of the forked pattern. Then attach the on of the wires to the COM (common) terminal on the relay connecter on the Arduino Opla, it should lock in. Now insert the the second one into the NC (normally closed) terminal, it should also lock in. This will allow us to connect and disconnect the two wires, activating and deactivating the switch. For anyone who doesn't know how a relay works it uses an electromagnet to connect the COM terminal to the NC or NO terminal mechanically.
Step 3, Code the Arduino:
ImportantNote: You will find that the code has a mechanism for tracking when variables change, you will also notice Arduino IoT Cloud generated functions On[Insert Variable Name]Change the reason we use the mechanism instead is because with Alexa Compatible variables it doesn't trigger the function ONLY when the variable actually CHANGES it triggers it anytime you give Alexa a command utilizing the variable in question, the reason this causes problems for us is because the heater has toggle switches and if a user sends a command to Amazon Alexa twice it will seriously mess the code up.
Other then that the code is pretty self-explanatory, BUT we still need the cloud generated functions to switch the low power mode and high power mode variables, ex. when high power mode is turned on, low power mode is automatically turned off. The code also uses the Arduino Opla screen to display the status.
Step 4, Configure Amazon Alexa:
For this you will need the Amazon Alexa app and (obviously) an Amazon Alexa device, so go into the app and go to the skills section, and install the Arduino skill, then go to the devices section, scroll down and click YOUR SMART HOME SKILLS, the click enable to use. Scan for smart devices and three should show up (heater, low_power_mode and high_power_mode). Set heater off and mode to whatever mode your heater defaults to when it starts up.
ImportantNote: Alexa doesn't understand underscores! You will have to rename the high_power_mode and low_power_mode "devices" to high power mode and low power mode without underscores, replacing them with regular spaces.
Step 5, How to use and configure (ImportantStuff):
Insert the batteries in your remote (but don't plug your heater in yet because for some reason the MKR IoT Carrier's relays will turn on and off on start up and upload) and start the Arduino, Once you see that the relays have stopped turning on and off and the Arduino has compensated for any changes made while it was off screen you can plug the heater in, the device is meant to stay on but if you are turning it off for a while make sure heater is off and the mode is set to whatever mode your heater defaults to when it starts up. Don't change the variables when the device is off.
And you're done! Let me know what you think of this project in the comments.
Comments