Replacing the Arduino Thing Shield with an xBee in transparent mode

Hi John, looks like a 2017 article for Nuts and Volts. This would be very good, as you have said, for development with other MCU platforms.
I could for see an application where a user uses a touch panel PC running any Windows embedded OS, or Linux, or Windows 10 IOT, or PLC controlling say all of the functions of a Greenhouse, and reporting the status and values to a smartphone/tablet.

Lots of potential

Ben

Maybe ZigBee firewall on chip is not a good name. As I think more about it I think it is more of an API on chip. Take a look at this spreadsheet:


The spreadsheet shows the conversion of data form left to right for two temperature values sent from an Arduino and received in a SmartThings device type handler. The bit in yellow will be taken care of by the Z-API on Chip (zAOC). The light blue on the left is the string the Arduino will asynchronously transmit to the zAOC. After it transmits the string the Arduino is free to go onto its next task. From this point the zAOC (illustrated in yellow) parses the data into the correct ZigBee cluster and ZigBee attribute that will be used to send to the ZigBee radio for transmission to SmartThings. The zAOC will take care of all that plus creating the checksum for the xBee radio packet and other api overhead required to communicate with the xBee in api mode.

All data that is sent to SmartThings will be sent over standard ZigBee clusters and attributes so it will look like a very well behaved ZigBee device. It will adhere to ZigBee Min and Max reporting intervals (SmartThings requires that for certification). To receive data from SmartThings, data will be received as standard ZigBee read attribute request or commands. This is all very doable as it is exactly what any true ZigBee compliant device does today. I propose instead of doing it in a software library in the Arduino the object lives in firmware inside the zAOC. This way the zAOC can be certified by SmartThings and used in just about any Arduino project that wants to send its data to SmartThings. The Arduino community can be focused on the sensors and the code to read them but let the zAOC take care of all the communications.

Of course reporting temperature is just an example data type it would support, there would be several more. Yes I can see this being an article for Nuts and Volts but at this point it is all theory and my articles always have real live hardware and working examples. To do this I would need to create a custom PCB, test it with an Arduino, create the Arduino API (string commands to send and receive data) and document it all. I do have a good start as I can base a lot of this on my existing work but there is still a great deal of work to do. At this point I think it would be a cool project but I would need to see buy-in from SmartThings and more people in the Arduino community.

3 Likes

Hi John,
I think the main concern would be the buy in from Smatthings. This zAOC device would open the platform selection to any device that can send/receive ASCII over a serial port.

The Baud rate for the Arduino Smartthings shield is 2400 baud, really slow… I would suggest a Baud rate that the user could select, or firmware that automatically reads the incoming baudrate.

With this zAOC device, the Arduino platform is only one of many possible MCU platforms and programming languages.

If your end result/project has more than a handfull of I/O, then the Arduino has to be something other than an UNO or Leonardo., a MEGA would be a minimum.

To me, a device like this should cost no more than a Smartthings Hub.

How about a Kickstarter project? I’ll invest…

Thanks for your input.

Ben

Is ZAOC going to implement all clusters defined in HA profile, including thermostat and intruder alarm? How many endpoints? Would it support 10 temperature sensors, for example?

2 Likes

I was thinking of only implementing a handful of clusters to start. I already have objects for the analog, contact, light, switch, level, color, temperature, and door clusters. As for the endpoints, yes we could easily support more than a 100 end points. However, the Device Type Handler in SmartThings would be out of control with that many endpoints. I think I would set a limit around 25 endpoints. That would give you 25 sensors you could report up to SmartThings or 25 relays connected to the Arduino you could turn on and off from SmartThigns all with one Device Type Handler! It has been awhile since I have written a multi endpoint DTH and last time I did I had to jump through some hoops to get it to work. I think support has improved for multiple endpoints and I expect it to be easier. If they have limits on the number of supported endpoints then I would have to adhere to that number. The ZigBee speck supports devices with over 200 endpoints.

There is a difference between a ZigBee device and a ZigBee cluster. ZigBee devices are made up of a collection of ZigBee clusters with mandatory support for some of the cluster’s attributes. I would like to stay away from saying the ZAOC is one device or another but give the user enough clusters they could make several devices.

A thermostat is both a device and a cluster with mandatory attributes that must be supported and I would like to stay away from being that specific. If someone wants to create a thermostat out of an Arduino they have a lot of safety items and fail safes that need to be addressed not to mention 24 volt AC to deal with. Some thermostats control when the HVAC fan kicks in, when the heating elements come on, how long the fan runs after the elements are switched off etc. In my mind the ZAOC needs to stay focused for the maker market (quick projects that fit a very specif need). Here is an example that is similar in function to a thermostat the ZAOC will have the supporting clusters for. Say you have brooder light (red heat lamp) to keep you chickens warm. It doesn’t matter if the light is left on all the time or not. It is installed in a way nothing will catch fire if stays on all the time. Normally before a cold spell hits you walk out and plug it in and leave it plugged in until the cold spell passes. Well with a temperature sensor and a relay hooked up to your Arduino you could build a device to do this. You would have a couple approaches on how to design your solution. One would rely heavily on the cloud and the other would not rely on the cloud for core functionally. The cloud dependent solution would use a SmartApp running in the SmartThings cloud to turn the light on and off based on the temperature. Your SmartApp would subscribe to the temperature capability of your DTH and if it got above 45 you could send the off command to the switch capability of your DTH. This solution would rely on the cloud and a SmartApp to function. So if your internet connection is down your light may miss the off command and stay on too long or not come on at all. Another approach you could take with such a solution is to build in the smarts to turn on and off the light based on temperate in your Arduino app. Only use SmartThings to send the set points for the temperature to turn on and off. You can use the analog cluster to do this. So now you don’t need a SmartApp but just a DTH with set points. You could have the low set-point at endpoint one of the analog cluster and the high set-point at endpoint two of the analog cluster. Your Arduino would just receive a string like “analog 1, 45.0” so it would know to set the off temperature to 45.0 degrees. The ZAOC would support the necessary clusters to make both of these solutions possible.

As for the intruder alarm I bet you talking about a IAS Warning Device (device number 0x103). For now I see putting all the security clusters in a phase 2 of the project. I want to stay away from specific device definitions.

Addendum: @geko as I reread that I want to make sure I don’t come across as talking down to you!! I was just trying to illustrate it for others. I know you live and breath SmartApps and Device Type Handlers!! Need and want your input!! Thanks!!

@chickenPeople (smile) I know there is much discussion on if you should put a heat lamp in a Chicken Coop before anyone starts down that road I acknowledge that and I’m just using it here as an example!

4 Likes

In case anyone here is interested in what I have been up to… :slight_smile:

2 Likes