You just received your new AirQ ShielD. And you want to start developing your application right now. But before you can start coding there are a couple of things you may know. We know: you don’t like to read tens of pages on our technical wiki. You’re only interested in write down code. That’s the reason why we wrote this survival guide. One. Two. Three. Let’s go
There are essentially two main things you have to know: pairing and ARS.
Each AirQ Networks end device (eg. AirQ 310 control board or AirQ 101 wireless sensor) can be associated to only one transceiver. And an AirQ ShielD is a transceiver. This procedure is called pairing. To pair a device to an AirQ ShielD you need to follow this procedure:
- Turn off the device you need to pair to the shield (eg. AirQ 310 control board).
- Turn on Arduino with the shield correctly mounted (see next).
- Press the PAIR button on AirQ ShielD leaving it pressed for 2 seconds.
- You’ll notice that the STATUS led starts blinking repeatedly. The shield will remain in pairing mode for 30 seconds.
- Turn on the device you want to pair.
- After two or three seconds the STATUS led of the device will blink more quickly to signal that it has been paired. The STATUS led stops blinking.
- Pairing is completed. To stop pairing mode immediately, press PAIR button for 1 second.
We did a video that shows this procedure.
However, for all of you that are buying in this period an AirQ ShielD with another AirQ Networks device, we are providing them already paired. But it’s important to know that pairing could be needed if you buy other devices in the future.
Remember that if you bought only AirQ ShielDs you don’t need pairing.
Disable Adaptive Radio System
Adaptive Radio System (ARS in the next) is a technology developed by AirQ Networks that allows to automatically changing radio configuration to adapt power transmission and frequency. ARS is designed to:
- Adapt the power level of the radio to reduce the power consumption of devices (this is especially true for AirQ 1XX sensors).
- Choose dynamically the frequency in 433Mhz spectrum that optimizes the operative range (aka: frequency agility); this is also needed to complain to FCC and CE directives.
ARS is designed to optimize distance. This means that programmers can run in troubles if they put both end devices and Arduino close each other during development. Typically they will see a really high rate of lost messages. This doesn’t mean that devices are broken: it’s just the way ARS works. However, ARS can be disabled in this way:
- Turn on Arduino with the AirQ ShielD correctly mounted (see next).
- Press the PAIR button and leave it pressed for 10 seconds.
- Release the button.
- If STATUS led blinks for less then 1 second, ARS is disabled.
- If STATUS led blinks for more then 2 second, ARS is enabled.
- Repeat the previous steps to enable/disable ARS.
There is no need to disable ARS on remote device: the sNET protocol will do it automatically. Please, keep in mind that when ARS is disabled the operative distance between devices is dramatically reduced. The following video shows the behavior when ARS is disabled and enabled.
So if you are an Arduino guru you can stop here. However we suggest taking another 5 minutes to read few other things.
How to mount the shield correctly
We decided to use pin headers with longer tails compared to other Arduino Shield. The main reason is that we suggest putting our shield always above all other shields. Putting another shield on the AirQ ShielD can dramatically reduce the operative range of our devices. So, longer tails allow to put our shield on the most common available shields. But longer tails require additional effort to mount the shield correctly. When the shield is inserted inside Arduino headers, you have to pay attention to insert pins to the end. If shield is mounted correctly, you’ll have no more then 6mm of free space between Arduino headers and AirQ ShielD. If this space is higher, the shield isn’t mounted correctly. The following picture clearly shows this.
Install sNET library
Ok. We have completed the hardware setup. Next step is downloading the sNET library for Arduino. The library is hosted on our public github repository at https://github.com/airqnetworks/snet-arduino. If you are confident with git, you can download the library simply typing:
$ git clone git://github.com/airqnetworks/snet-arduino.git sNET
to the command prompt. Those who aren’t confident with git version system can download the library zip file using this link https://github.com/airqnetworks/snet-arduino/archive/master.zip.
After you have downloaded the library, open your Arduino sketchbook folder. If there is already a folder there called libraries, place the library folder in there and call it sNET. If not, create a folder called libraries in the sketchbook folder, and drop the library folder in there. Then re-start the Arduino IDE, and you should see your new library in the Sketch > Import Library menu. Now you are almost ready.
Identifying devices address
Each AirQ Networks device has its one unique network address (named sNET address). To identify device address you have to know that:
- Each AirQ Networks control board (300, 305 and 310) has its network ID on the bottom side of PCB. If you bought a control board with its enclosure, the sNET address is reported on the enclosure too.
- Each AirQ ShielD has its sNET address on the bottom side of PCB.
- Each AirQ Networks sensor (101, 110, 111, 121, 122 and so on) has its network ID on the external enclosure.
Network ID is in the form of 188.8.131.52 (4 octets) and it’s the same of an IPv4 address. But remember: it’s not an IP address ;-). Network ID will allow you to identify the device uniquely inside your Arduino code, using the sNET::getDeviceForDeviceID() method. Moreover, remember that each AirQ Network device type has its own network class. Please, take a look at this table (http://wiki.airqnetworks.com/index.php/Template:SNET_Address_Classes).
Finally, consider to use our forum to ask question if you run in troubles using our AirQ ShielD.
When the going gets tough, the tough get going. So now you can start coding. Enjoy 😀