New Flowcode Component; Wireless Things, Ciseco - SRF ModuleFollow article
I’m quite lucky in my job, I regularly get to play with new bits of kit. We receive and test development kits from all companies and brands. Give or take, they’re all largely the same. A new microcontroller, a form of connection to the computer for programming (generally USB) and maybe some notification LEDs. We recently had a chance meeting with a UK based company called Wireless Things (formerly known as Ciseco) who introduced us to their range of products. To sum it up, they have 2 main lines that were of immediate interest to us; an RF module, called an SRF, which connects via the UART and allows very simple transmission of data over some impressive distances. The second set of products was a range of Arduino based microcontroller boards which feature the SRF module (note, you can buy the RF module separately and connect your own microcontroller if you wish!). Therefore we can create really simple little products which can transmit data wirelessly…Internet of Things anyone? So who are their products aimed at? I’d say a sweeping term would be; anybody interested in the internet of things who only requires a low-to-medium quantity of electronic hardware, but for a very reasonable price. That said, they will still cater for the mass market. If you’re still interested, carry on reading.
Once we knew that we liked the Wireless Things products, we set about getting them to work in Flowcode, our IDE. Our first task was to set about talking to an SRF module from Flowcode. We used the Wireless Things Xino RF development board which features the Atmel-328P microcontroller, and is essentially the Arduino Uno, but with an SRF module embedded. This allowed us to create a simple flowchart which would send serial data over the UART. The SRF radio then takes care of the rest. There are also some other configuration settings that we need to consider. For example, the SRF radio must be activated by holding one of the pins high 328-P. Again, we achieved this by setting an output high on Digital8 (Pin B0) of the Xino RF board. We downloaded the program to the Xino RF using a USB cable and left it running in the background, sending out serial data every 2 seconds. The program for which is seen below;
We were able to test the RF comms with another Ciseco product; the SRF-Stick. This is a great little device which also features an SRF module and allows a virtual COM Port to be created on your PC that can receive RF data. It’s simply a case of plugging the device in, opening a terminal program such as Realterm and listening for data. Our Xino RF was programmed to rhythmically send serial data every 2 seconds, therefore the SRF-Stick should receive this data and present it on our PC screen.
Once we had communications working over RF with the SRF module, the next step was to wrap all this up into a new Flowcode component. Essentially, a Flowcode component is a library/ subroutine which can be included with Flowcode for use. We provide a set of components for those who purchase Flowcode, but components can also be created and added by users at any time by simply including an appropriate component file in the required directory (typically C:\Program Files (x86)\Flowcode 6\components). If you want more information on making your own Flowcode components, visit this link. Components are ideal as they increase modularity of code, where commonly used sections of code are easily used in multiple designs, and they also allow users to not worry about the low-level code ‘behind the scenes’. The SRF component was created and designed to look and feel just like all other Flowcode communications components to ensure familiarity with how it works for our users. In order to use the new SRF component, users navigate to the ‘Wireless’ section of components, and drag the SRF component onto the simulation panel. Users then program the device through several component macros. First, the SRF module must be initialised, that is to configure the radio for data transmission. We created a simple macro to allow this. Next users can send and receive bytes or strings of text. We have included a simple example below to demonstrate.
In the above example, it can be seen that only 5 programming icons were used to configure the SRF Module and begin sending data: 1. We initialise the module. In the first example we showed, we had to manually set pin B0 (Digital8) high to activate the SRF module. Now, this has been embedded into a component macro for ease of use. 2. Next we use the SendString command to send a string of data through the SRF Module. 3. We then use a SendChar, which sends the data ‘\n’ which sends a new line command. 4. We include a delay of 1s just to slow down data transmission a little. 5. Our final command we used was a while loop, where we have configured the microcontroller to send data forever, in out while(1) loop. As said earlier in the blog article, Wireless Things have also developed several Arduino based boards which feature the SRF radio. We have used two of these throughout our work, the first is the Xino RF which we previously mentioned. This couples an Atmega 328P with an SRF into the same board footprint as the Arduino Uno.
The USB interface makes it really simple to physically program the device. The second board is the RFu-328, which is also an Atmega 328P microcontroller with an SRF shield. The RFu-328 board footprint is similar to that of the XBee modules, and has 2 x 10way connectors. Both boards are seen below. The Xino RF is pin-for-pin compatible with the Arduino Uno, with the SRF module connected to the UART pins Digital0 and Digital1. It’s a great device for getting up and running easily with RF comms and creating Internet of Things based applications. The RFu-328, however, is in my mind where the fun really begins. You lose some GPIO due to the limited pin count, but what you lose there you gain in form factor and power consumption. The RFu-328 is ideally suited to battery based applications, and has a convenient sleep mode (we’ve included a component macro to wake and sleep the SRF module on the RFu-328). In deep sleep the power consumption of the radio is as little asFor both devices we have created a target device in Flowcode, allowing you to ensure that all the pinouts are correct and that programming with them is as simple as possible.
As a result of the small form factor of the RFu-328, it does not have a USB interface and can be programmed via an FTDI cable from a breakout board, but this also nicely introduces us to another feature of the Wireless Things products – remote programming. The SRF-Stick we mentioned earlier was previously used to open a virtual COM Port on our PC and allowed us to see incoming RF data. Another great feature of this little product is that Wireless Things have managed to create a wireless programming protocol between this and their Arduino based devices. With minor configurations (a few AT commands through the Wireless Things XCM program) the SRF-Stick can be set to remote program your devices, including the RFu-328, which remember has no USB interface. So, how did we get this to work with Flowcode? Well, it pretty much worked straight out the box. We have made some slight behind-the-scenes adjustments in Flowcode to auto-detect the SRF-Stick and auto-naming, however, remote programming worked first time.
If you’re interested in the internet of things I would highly recommend the Wireless Things range of products coupled with Flowcode. The SRF component, and Xino-RF and RFu-328 target devices are available in the latest release of Flowcode. For more information relating to Flowcode and Matrix TSL products, please follow this link.
To view the original article, please click here.