XBee S2C with Arduino & SmartThings

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.

4 Likes

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.

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.

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

2 Likes

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!

Very promising progress! :statue_of_liberty:

@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

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

2 Likes

That would be absolutely awesome!

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.

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

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.

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

Reviving this topic, the link to George’s tutorial is dead, here’s a working link

1 Like

Hi Jeanvancaloen

I take it there is still no solution to this problem. After I made made my tutorial I went off grid as I went traveling for the next few years and have only just got round to trying to pick up were I left off. What is the latest from the community on this?

Hi there
I spent a LOT of time trying to connect to the network. I never really reached a point where I could use it in smartthings. I’ve switched to esp modules with ST-Anything for the latest projects. I may come back to this later. Would certainly be interested to be able to adopt this. Ideally with a library that handles the hard part ;).
Cheers

Cool well if there is something you would like to achieve let me know and I can try figure it out for you :slight_smile:

1 Like

Hello,

I have managed to set up an Arduino with an Xbee S2C and got it connect to smartthings
I have set it up as a parent and attached two child switches to it that I can use to independently control 2 relays connected to the arduino

I am now trying to get the arduino/Xbee to communicate back to the smartthings hub similar to pressing a smart light switch. Eg. when you physically press a light switch it sets the device to off in the smartthings app.

I want to be able to use a sensor on the arduino to trigger this same effect when something happens. Eg. it detects an overcurrent or and override reset switch is pressed

Is this possible?