Samsung SmartThings Mbed Development Platform
This project creates a platform to develop devices for the Samsung SmartThings home automation platform. The project lists a range of useful home automation commands being processed by the mbed.
Required Items
- Mbed NXP LPC1768.
- Mbed Application Board.
- Xbee S2C or S2C pro TH module.
- Samsung SmartThings Hub.
Configuring Xbee Module
In order to talk to the SmartThings hub you need set the Xbee module to use the Zigbee home automation profile. you can either do this by connecting the Xbee module up to your laptop and using digi's XCTU program and set up the Xbee using the following settings.
- ZS ZigBee Stack Profile: 2 = ZigBee-Pro
- NJ Node JoinTime: 0x5a
- EE Encryption Enable: 1 enable
- EO Encryption Options: 1
- KY Encryption Key: 0X5A6967426565416C6C69616E63653039
- AP API Enable: true
- AO API Output Mod: 3 = ZDO pass-through
Alternatively you can place your Xbee module in the slot of your application board and run the following code.
Import programXbee_HA_Config
Configure Series 2 Xbee (S2C) to work with the Zigbee home automation profile and connect to Samsung SmartThings
Once this is done connect up your SmartThings hub using the instructions provided. Download the app and create a SmartThings account.
LED control through SmartThings
Now that we are all set up we can go about controlling the mbed through SmartThings . The first example will be switching one of the on board LEDs on and off. This could easily be edited to control a bulb connected to the mbed or even a relay controlling something much larger. The program will use the Zigbee home automation profile to communicate with the SmartThings hub. The information for how to use these protocols can be found using the following documents.
Zigbee Spec: http://home.deib.polimi.it/cesana/teaching/IoT/papers/ZigBee/ZigBeeSpec.pdf
Zigbee Cluster Library: http://www.zigbee.org/download/standards-zigbee-cluster-library/
Zigbee Home Automation: http://contech.suv.ac.kr/contech/courses/11h2wsn/075367r02ZB_AFG-Home_Automation_Profile_for_Public_Download.pdf
In order to begin download the code below to your mbed. The code is well commented so that if you choose to make modifications, you should be able to easily with the help of the above documents.
Import programSmartThings_Switch
Mbed switch for Samsung SmartThings using Xbee
Next you need to download the custom device handler to your SmartThings account. log into your account SmartThings account on the SmartThings website at the link below:
https://graph.api.smartthings.com/login/auth
Log in, then click on Location and select the location you created during set up. You may have to log in again. Once logged in again select 'My Device Handlers'. Then click 'Create New Device Handler' in the top right corner. Select 'From Code' Then copy and paste the following code from my GitHub, click save and then publish.
https://github.com/CR76/Mbed-Development-Platform
Now you have the device handler published on your account. Open up the SmartThings app go to the 'My Home' tab. Tap on the '+' in the top right corner and select add a thing. Then Connect now. Hit reset on the mbed and wait for the mbed switch to come up on the app and then click through to set up.
Temperature Sensor For SmartThings
In this example we will use the on board temperature sensor to provide a temperature input to SmartThings. This will use the 402 Zigbee cluster for temperature measurement. The mbed code for this is below.
Import programSmartThings_Temperature_Sensor
Mbed temperature sensor for Samsung SmartThings.
The device handler to download to your SmartThings account can be found on my GIT hub here. You will need to remove the mbed switch device. To do this you need go to the device handler and click on the settings cog in the top right corner. Then go to remove device.
https://github.com/CR76/Mbed-Development-Platform/blob/master/Mbed_Temperature_Sensor.groovy
Level Control for SmartThings
In this example we shall look at combining the on/off cluster with the level control cluster. Using this we shall control the brightness of the LED on the mbed however this could be applied to things such as servo position control. For this we shall use the 0006 and 0008 clusters in the Zigbee cluster library.
Import programSmartThings_Level_Control
Mbed Level control for Samsung SmartThings.
The device handler to download to your SmartThings account can be found on my GIT hub here.
https://github.com/CR76/Mbed-Development-Platform/blob/master/Mbed_Level_Control.groovy.
Please log in to post comments.