Brief Introduction to S-Ctrl Framework

Air Series firmware v2.0 introduces an automation control oriented framework S-Ctrl. This framework allows up to 32767 devices to communicate over the 2.4G RF. The network is multiple-access, which means any device could send data to any device, which is similar to Ethernet or WiFi. The framework also defines the messaging format for different automation control purposes.

The Arduino library for S-Ctrl can be downloaded here.  Arduino libraries can be import by clicking “Sketch->Import Library->Add Library” in the Arduino IDE. Detailed instruction on installing Arduino libraries is here. There are basically 2 ways to use this library. The library contains examples in both ways (Raw and Framework).

Under Raw, the two inos (hub.ino and stub.ino) represent two AirDuino nodes. The hub send message every 0.5s to the stub requesting it to turn on and off the on-board LED connected to digital pin 13. The stub receives the request, changes the LED state and send message back reporting the updated LED state. The hub then receives the report and set its local on-board LED to indicate the remote LED state. In the Raw example, the hub and stub exchanges message in there own way. There can communicate as far as they understand each other’s message.

Under Framework, the two inos (hub.ino and stub.ino) also represent two AirDuino nodes. They do the same thing as above. The difference is that they are using the APIs provided by S-Ctrl library. One of the advantages is that this simplifies assembling and parsing messages. Data are organized and exchanged easily. Another advantage, which is more important, is that it is easy to communicate with other devices. In the future, we are going to produce many S-Ctrl compatible products that can be added to the network. For example, wireless relays, LCD displays, servos, lights and all kinds of wireless sensors etc. They can all be accessed and controlled with a few lines of code from e.g. AirDuinos.

The idea is very simple. There are two roles, hub and stub. Hub controls, stub being controlled. But of course, a device could act as hub and stub at the same time. Hub GETs or SETs values on stub. Stub REPORTs values solicitedly or unsolicitedly to hub. Every value on the stub is identified by a 2-byte register number.

All messages exchange via I2C. The messages is then sent via 2.4G RF to the receiver. The on-board STM32 CPU handles buffering, retransmission, reception and duplication avoidance. Although it still cannot promise 100% delivery, the message loss possibility is as low as 0.01% in good environment.

On the AirDuino board, the I2C pins are not connected by default. Two connections has to be made before AVR could send S-Ctrl messages to the air. Any wire or 0 Ohm resistor could be used to make the connection. (As shown below in red.)



Leave a Reply

Your email address will not be published. Required fields are marked *

3 + one =