Hardware Reference
In-Depth Information
Note
Now, we can actually test the device you just hacked. Note that the code for this part is
available on the GitHub repository of the project at the following location:
https://github.com/openhomeautomation/arduino-home-automation/tree/master/chapter6
Plug the device into the wall and plug a device inside to test it. For example, I used a
simple 30W desk lamp to test my project.
Upload the code for the Arduino board and open the serial monitor inside the Arduino
IDE. Make sure the serial speed is set to 9600, and type:
/mode/7/o
This should set the pin number 7 as an output. You should be greeted by the following
message:
Setting pin D7 to output
You can now switch the relay with:
/digital/7/1
You should hear the relay click and see the device you are trying to control turn on. You
should also have the following confirmation on the serial monitor:
Pin D7 set to 1
If this doesn't work, the first thing to check is the connections inside the device you
hacked. Disconnect it first from the power plug in the wall and open it again. Make sure
that everything is wired correctly according to the previous section.
You can also test the relay independently by plugging the SIG pin in a 5V pin to see if it's
working. Finally, also make sure that the serial speed matches with the speed defined in
the Arduino sketch.
Search WWH ::




Custom Search