With the recent discontinuation of the SmartShield attachment for the Arduino. The Samsung SmartThings community has been looking for a replacement for this shield. This project presents the start of a solution to this, using the Arduino wireless shield and a Xbee series 2C to create a simple switch. The switch can control the output of pin 13 as well as the on board LED. This can easily be changed to control whatever pin you like.
To start you must configure the Xbee. Assemble the Arduino, wireless shield and xbee together. This should look like the image below.
Next make sure the switch on the wireless shield is set to USB and import the code Arduino Xbee Setup (link below) to the Arduino IDE, compile and download to Arduino. Switch the wireless shield switch back to micro and reset the Arduino. The code should take about half a minute to run.
https://github.com/CR76/Ardunio_SmartThings/blob/master/Arudino_Xbee_Setup.ino
Next we need to upload the device handler to the SmartThings online IDE. log in and navigate to the device handlers. When there click Create New Device Handler, followed by from code. copy and paste the code from the link below. Once the code is pasted click save and publish for self.
https://github.com/CR76/Mbed-Development-Platform/blob/master/Mbed_Switch.groovy
Finally download the code below into the Arduino IDE. Set the wireless shield to USB and compile and download the code. Next go into the SmartThings app and in the my home tab select add new Thing. Set the wireless shield back to micro and hit the Arduino reset. After a few moments the device should appear in the Arduino app, rename it if want and you are done. See the video below for a view of the switch in action.
In the coming weeks I hope to add more functionality and create a library to make the code much more customisable.
Comments