XBee S2C with Arduino & SmartThings

zigbee
arduino
smartthings
hubv2
thingshield

#1

Hello all,

So I’m still fairly new to the ZigBee & SmartThings platforms, but I’ve worked with Arduino for quite some time. I am attempting to replicate the functionality of the SmartThings Arduino Shield that was discontinued some time ago and have gotten close (as least I think so) over the past few weeks.

So far I’ve managed to successfully get a ‘Xbee S2C’ to join the ‘SmartThings Hub V2’ network and show up as a thing using XCTU and following George’s guide here (https://www.falco.co.nz/electronic-projects/xbee-to-smartthings/).


EDIT: I should also note that I am communicating between the ‘XBee S2C’ and ‘XCTU’ pc application using a Seeeduino Xbee Shield V2.1. In order to configure the Xbee, I first upload a blank sketch in the ‘Arduino IDE’ and then open up XCTU and ‘Add Radio’ to connect to the Xbee. Afterwards, I swap the RX/TX adjustable pins so that data from the Arduino will be sent to the Xbee, rather than the Arduino acting strictly as a programmer for the ‘Xbee’ during initial configuration.


I’ve also gotten the Arduino to send the DS18B20 temperature data in the correct hex format over TX (read in the serial console), and it should be sending to the RX of the Xbee, I just don’t think the Xbee is configured properly to understand the data it’s seeing.


Note: The Xbee he used was not the same as my Xbee S2C module, so the profile configuration file he linked did not work by default. To get it to work with the S2C module, I just went through and replaced each field manually and then re-saved it as a profile for the S2C and following the rest of the tutorial worked fine.


I’ve been playing around with the code in the ST_Anything libraries that were originally written for the SmartThings shield and I believe that I have the code on the Arduino side working as expected (it sends a temperature value from a DS18B20 in hex over TX (checked from the console), but I do not think I fully grasp the configuration of the profile ID and cluster used for reading in data to the Xbee and then transferring to the SmartThings Hub V2.


The specific libraries I am trying to adapt & get working are the:
(https://github.com/DanielOgorchock/ST_Anything) by Daniel Ogorchock
ST_Anything -> Arduino -> Sketches -> ST_Anything_DS18B20_Temperature
ST_Anything -> Groovy -> ST_Anything_Temperatures (adapted to use only the DS18B20 instead of all of the other sensors for temperature & humidity)

The example from George uses an On/Off function (Cluster ID: 0x0006 - pg 8. of the ZCL.pdf) and my goal is to read data over TX, so I’d imagine the correct cluster ID for my project would be under ‘2.2.2.5 Measurement and Sensing’ - pg. 11 - in the ZigBee Cluster Library (ZCL) pdf document.

0x0402 - Temperature Measurement - attributes and commands for configuring the measurement of temperature, and reporting temperature measurements.


The trouble I’m having is in the ‘Simple Descriptor Response’ (the third frame sent in George’s guide on his site).

I understand that the ‘04 01’ corresponds to Home Automation, but I’m not quite sure how the ‘02 00’ which says the device is an on/off output, can be related to something different such as temperature sensing. From the example it seems like it goes…

04 01: set for home automation
02 00: says device is on/off output
00 00: First cluster type - Basic
03 00: ID clusters
06 00: On/off clusters


Does anyone know where the ‘02 00’ is referred to in the ZCL? For the last 3 clusters, I’m assuming the only one that would need changed is the ‘06 00’ to ‘02 04’ for Temperature measurement, but I’m not quite sure what the ‘02 00’ would be changed to along with it.

I will post any updates to this thread if I can figure them out.


(Paul Osborne) #2

Check out Section 5.7 of the ZigBee HA Specificaiton (Document 05-3520-29). There are a bunch of different types of devices specified within the HA Application Profile. For your use case, the Generic Simple Sensor device ID (0x000C) would seem to make sense.


(Geko) #3

I may be wrong here, but I don’t think SmartShield uses any standard ZCL clusters. AFAIK, it implements a proprietary serial over Zigbee protocol to talk to Arduino. I’d be interested to see if you can use XBee to emulate SmartShield, but it may be difficult, unless SmartThings sheds some light on their custom protocol implementation.


(Cr76) #4

I have already done this released a video of it working on Friday. I will be sharing the code and creating and instruction guide later tonight. I would like to develop the code into a library so that its easy for everyone to use any help with this would be great. Take a look.

https://community.smartthings.com/t/things-shield-replacement/66201/6?u=cr76


#5

Fantastic CR76! Did you achieve it by doing any of the stuff I’m trying or a completely different method? I eagerly await your instruction guide. Great work!


#6

Very promising progress! :statue_of_liberty:


(Tim) #7

@ZaIINN I am also trying to accomplish the same thing. Can you give any differences you came across from George’s blog post to what you got working? I just can not get the first step in the blog to work, but my firmware is a bit different. Maybe could you post your xml configuration from the XTCU tool?

Thanks a ton


#8

Hi Tim,

I was actually able to get it working with the help of another forum member. I’ll put together a guide of what I did along with his immense contribution here over the next few days & send you a link.

Regards,

Zane


(Tim) #9

That would be absolutely awesome!


(Dan) #10

I would love to see this as well! Thank you for pulling all of the information together. I look forward to understanding how this works.


(Tim) #11

Zane,

I hate to look a gift horse in the mouth since you are under no obligation to provide documentation, but have you had a chance to write up any of the information you have? I would be eternally grateful and forever in your debt. :wink:

Thanks
Tim


(phil.a.edwa@live.com) #12

Has this guide been published? I ask because I’m still struggling to get my Xbee S2C w/ SainSmart Shield connected to my ST hub. Thanks for any help that anyone can provide.


(Ben Wolodko) #13

Hi All…

It’s me again… like a broken record …( Old School )

If anyone has an Arduino ThingShield available for sale, please let me know
still looking for a couple units.

Thank you very much

Ben