The Gateway to Algorithmic and Automated Trading

Build a Multi-Location Temperature-Monitoring System using Connext DDS & RTI Prototyper with Lua

Real-Time Innovations (RTI) : Gianpiero Napoli - 21st February 2014

The opinions expressed by this blogger and those providing comments are theirs alone, this does not reflect the opinion of Automated Trader or any employee thereof. Automated Trader is not responsible for the accuracy of any of the information supplied by this article.

RTI moved into its current HQ in January 2012, which is much bigger than our previous building. It has 4 big areas (1 in each corner) and 2 big conference rooms in the center of the building.

Some employes in the northwest corner were feeling colder than the engineers on the south side of the building. The engineers, of course, thought it was simply because they were hotter than anybody else, but they took up the challenge to discover whether there was really a problem. In fact, we attempted to use our own RTI Connext DDS and a bunch of other technologies to prove how easy it is to integrate different systems together.

Our web marketing manager purchased 2 BeagleBone boards. We put one of them in his cube and the other in mine. Each board has a 1 write temperature sensor. The sensor uses the 1-wire file system and creates an easily readable file on your system.

We decided to publish the temperature data over DDS and make it available to anyone with a smartphone. For proof of concept, we wanted to do it using as many different technologies as possible.

As shown above, the temperature sensor fed into a C application that published the data over DDS. A Raspberry Pi board collected the data. Then, using RTI Prototyper with Lua, we uploaded the data to a 3rd-party cloud database. Finally, an iOS app written in objective-C pulled the data from the database and displayed it on a mobile phone.

Embedded Temperature Publisher

With RTI Code Generator 2.0, this task was extremely easy! Here's what we did:

Created a simple IDL:


Ran rtiddsgen:


Modified the generated TempMonitor_publisher.c in 2 places:

1) At the beginning of publisher_main() we opened the temperature file:


2) In the main loop, we read the file and published the data:


The sensor_id was passed in from the command line so the application could be used on any of the BeagleBone boards without recompiling.

Compiled and ran the application with the generated makefile:


Added a single line to /etc/rc.local it ran every time the BeagleBone started:


Restarted rc.local to start data flowing on the network:

We could then run rtiddsspy on any other machine on the network and subscribe to it.


Copied the executable to the other BeagleBone boards and set up rc.local to have 3 weather stations running in the office.

RTI Connext DDS allows you to take systems and integrate them seamlessly with little effort. If you already store data in cloud-based storage with a RESTful API, we can gather all the data published over DDS by the different weather stations and store it in the cloud. Using RTI Connext Prototyper and the scripting language Lua, it only takes a few minutes to integrate a 3rd-party service. Here's how we did it…

Copied Prototyper to a Raspberry Pi board and created an XML file that specified the type:


Registered the type:


Created a participant with one subscriber:


Prepared to receive and print the data with a simple Lua script:


Ran Prototyper:


will print on the screen the values:


Altered the Lua script to push the data to the cloud instead of printing it on the screen:


That's it! Here a screenshot of the data populating the database:

Don't forget your iPhone

With a few modifications to a basic example iphone application downloaded from, we ended up with:


Get the application source code in GitHub.

Questions? Trying to explore further possibilities?

Share your Connext DDS adventures with the RTI Community or email

Download the latest version of Connext DDS, complete with RTI Prototyper.