Recent Changes - Search:



The SmartSantander platform relies on a technology developed by Libelium Comunicaciones Distribuidas S.L ( called Waspmote. Each repeater used for experimentation is composed by a waspmote board which has two radio interfaces (802.15.4 and digimesh) and some specific sensors (i.e. Temperature, CO, Luminosity, noise). This board is powered by an ATmega1281 (

Platform Structure Considerations

SmartSantander offers different kind of devices and, taking into account their nature, the platform can be divided in two main groups:

  • Fixed nodes are deployed on facades and streetlamps and are composed with the static sensors spread throughout the city. They are the backbone upon which the SmartSantander platform relies. As explained before, these nodes have to support experimentation and service provision at the same time. Therefore, to manage both at the same time, the experimenter has to be aware that, in some point of the execution, the processor will be locked to send service data. Also, watchdog interrupts will manage times transparently. Depending on the node, different measures can be accessed to experiment together with 802.15.4 interface:
    • Temperature
    • Luminous intensity
    • Noise
    • CO
    • Relative Humidity
    • Soil Moisture
    • Soil Temperature
  • Mobility nodes: the SmartSantander project, during the second phase, has also included mobility nodes. They have been deployed on top of the public transport vehicles (such us buses). In this case, node sensors are controlled by a central computer (CLV) which will send the date to the Waspmote. Thus, the board will be controlled to only receive data from sensors from time to time, allowing the experimenter use these data along with the 802.15.4 interface. Measurements gathered from this sensors includes:
    • CO
    • Suspended Particles
    • Temperature
    • Humidity
    • Ozone (O3)
    • Nitrogen Dioxide (NO2)

Due to the continuous movement of the nodes, GPS data is also available as a sensor. For both fixed and mobility nodes, the 802.15.4 interface is included relying on Waspmote boards. However, as the hardware configuration varies between them, some considerations have to be considered. At the time being, as explained before, there are two libraries developed. The first one is intended to be used with fixed nodes. This library allows use of the sensors at any moment, using some functions described in the class SmartSantanderSensors.cpp. The Experimenter API is explained below. The second library, developed having in mind mobility sensors, offers a structure containing last values measured from the sensors. This structure is updated every 10 seconds through a serial port, and allows the experimenter access to the most recent information. Also, the current position can be accessed through this C structure. Detailed information about its management can be found below. For both cases, full control of the Xbee module with the 802.15.4 firmware is allowed. It is possible to manage all the parameters (such as channel, PanID, etc), except those related to serial communication between the board and the Xbee (API mode and baudrate).

Preparing the environment

The application development is carried out through software called Waspmote-IDE. The following steps are the simple explanations to install the IDE. This guide is a summary of the Libelium quick start guide (

First, The software can be downloaded from the link ( just choosing the Operating System in the API-environment section.

Once the software has been downloaded and unzipped, the IDE can be executed. For its configuration, it is necessary to choose your sketchbox folder in the menu file/preferences. The programs (that have an extension .pde) must be allocated there.

The IDE, as shown in the previous image, is divided in four parts:

  • Ide options: this part is the configuration menu. It allows the Waspmote IDE configuration as well as the board or port we are using.
  • Buttons: this part is a button menu for compiling, opening, storing or uploading a code to the board. Next figure shows the different buttons and their function.
  • Main Code: this part contains the main code that will be uploaded to Waspmote board, following a structure divided into two parts: 'setup' and 'loop'. 'setup' is only executed once, when the program starts, and 'loop' is executed indefinitely.
  • Output messages: this part shows some output messages as error messages (compilation or upload) or success messages (compiling or uploading properly done).

Finally, before you start developing, it is necessary to choose the library (API) to be used. In the SmartSantander platform there will soon be available a special version of the library, meanwhile the last version included with the IDE (v021) will be sufficient for using the main characteristics of the waspmote.

To load the new programs in the waspmote board, the Micro-USB port of the waspmote is used, connected to the USB port of the PC. However, before trying to load the code, it is necessary to unplug the xbee digimesh from the board and plug, at least (if the three ones are placed it perfectly works), the two jumpers as shown in the image below. The last thing would be to select the correct serial port inside the IDE options “/Tools/Serial Port” and press the “upload” button.

Experimenter API

As aforementioned, two different libraries have been developed. Therefore, different functionalities can be used: Common functionality: 802.15.4 Interface can be used whether you are using fixed or mobility nodes in the same way. So as to manage the interface, there is available an object (xbee802) which implements basic functions. The following functions allow the main communications among devices: xbee802.treatData(): used to process the packet received with Libelium’s API. Once the packet is processed, it is stored in an array called xbee802.packet_finished[] and current position being specified by the variable xbee802.pos. Distinguishing between different packets can be done by comparing the packetID member structure from each packet_finished[]. Xbee802.sendXBee(): used to send data through 802.15.4 using the libelium API. Prior to sending a packet with that structure, a packetXBee structure has to be called and initialized. Parameters belonging to this structure that also have to be initialized are: aforementioned packetID, in order to filter packets at the destination; mode, whether UNICAST or BROADCAST options; other variables as MY_known and opt, typically 0. xbee802.setOriginParams () sets the header API type, being MY_TYPE for the minimum header, and MAC_TYPE, which allows sending the mac in the header. xbee802.setDestinationsParams () sets the node destination address as well as the payload content.

  • Using sendXBee() method to send a frame through 802.15.4 interface.
 packetXBee* paq_sent;  
paq_sent = (packetXBee*) calloc(1,sizeof(packetXBee));
 xbee802.setDestinationParams(paq_sent,"000000000000FFFF","HELLO WORLD!",MAC_TYPE, DATA_ABSOLUTE);
  • Fixed Nodes:

Accessing sensors data can be done by calling specific functions from smartsantander.cpp. Each node has been defined with a type depending on its sensors. smart.readSensorType() returns the type of node. Possible types are: 0x01, node with temperature sensor; 0x02, node with CO sensor; 0x03 node type includes temperature and luminous sensors; 0x04, node with noise sensor; 0x06 implements temperature and humidity sensors; 0x07 node type includes temperature, humidity, soil temperature and soil moisture sensors.

  • Mobility nodes:

Mobility nodes do not have sensors plugged directly to its analog inputs. Instead, the Waspmote board gets new sensors values through the UART1 serial port. Once new sensor data is ready, an interrupt stops the current program and the microcontroller stores the values in a structure. These values can be accessed from the structure called smartMobile.sensorsValue and the structure members are the timestamp, valueCO, valueHumidity, valueTemperature, valueSuspendedParticles, valueOzone, valueNitrogenDioxide, valueMeterCounter and valueDigitalInputs ((W X Y Z) W = IGNITION X = CONTACT Y = LIGHT Z = MUTE). GPS position can be accessed through the same structure: quality, latitude, longitude, altitude, speed, course and time.

Sample Programs

As explained before, there are two main functions in the program structure: Setup() and loop(). The first one executes once at startup in order to configure the initial node parameters, while the second one executes in an infinite loop until the node is switched off. Creating the binary is as simple as writing the code using the IDE, and pressing the compile button.

Following simple examples will show a first approach to the SmartSantander programming style:

  • Sending “Hellow World!” through USB port.

void setup() {

  // Opening UART to show messages using 'Serial Monitor' 


void loop() {

      // Blinking LEDs 
      // Printing a message, remember to open 'Serial Monitor' 
      // to be able to see this message 
      USB.println("Hello World!"); 
      // A little delay 


This program shows how to turn on the USB module and print messages through its mini USB port. Logically, USB will be used only for debugging issues, but not in the SmartSantander platform due to its wireless nature.

  • Sending “Hellow World!” through 802.15.4 interface.

void setup() {

  // Inits the XBee 802.15.4 library 

  // Powers XBee 


void loop() {

  Xbee802.send(“0013A200406C16E1”,”Hello world!”,0x00,12);


In this example, a string is being transmitted through the 802.15.4 to the MAC destination. Logically, this communication only works with nodes within the transmitter’s coverage area. This ‘send’ function allows the communication from node to gateway, but for communication among nodes it is necessary to use Libelium API headers. More 802.15.4/Digimesh code examples can be found in the IDE under File/Examples/XBEE. For other operation examples go to File/Examples.

Taking into account that the Digimesh interface is going to be used for network management and service provision, the experimentation must not use this interface, but only the 802.15.4 interface.

Apart from the IDE to load codes on the waspmotes, there is another interesting program to be downloaded in order to modify the parameters associated with the Xbee radio modules. This program is called XCTU and can be downloaded from With this program it is possible to read the xbee parameters for addressing, security, etc. Among these parameters can be found:

  • Communication channel.
  • PAN ID. Allows to create different networks working in the same channel.
  • Transmission power
  • API mode (2 for deployed nodes, 1 for GW node)
  • ….

Regarding security issues, it can be modified with the AES 128 encryption key. The following figure shows the parameters that can be modified:

In order to modify these parameters and also to send/receive data frames to/from the deployed nodes, it is needed a gateway. The steps to write these parameters consist on:

  • Go to PC Settings tab and select the COM module where the gateway is connected.
  • Go to the Modem Configuration tab and select Read in order to see the values loaded in the Xbee module, then modify the values you consider and finally hit the Write tab in order to load the changed values. Note: Sometimes, there are problems reading/writing so for these cases just press the reset button (in the gw) during 2 seconds.

Finally, using the assemble packet option in the terminal tab is possible to send frames to the xbee through the gateway, allowing communication among gateway and waspmotes while using the Libelium’s API header.


As the deployed nodes within SmartSantander platform have to guarantee the service provision at the same time an experiment is running on the nodes, there are some restrictions for the programs developed for the platform. First, as the Waspmote is based on a mono-threaded processor, the service provision is guaranteed by the watchdog interruptions, that will check periodically if there are new management frames or there is a service frame to send. As a result of this, the experimenter is not allowed to modify the watchdog interrupts or use the Digimesh interface but through the smart.sendLog() method. As aforementioned, the libraries have been modified, thus the experimenter is not allowed to modify them or use another version as well. In addition, there is a template of the program file that will have to be used to enable these characteristics. The use of the EEPROM memory is forbidden for the first 400 bytes, as they are used for service provision parameters. The use of the SD card is limited, and it is forbidden to modify or erase the files stored as the SD card is the place where the binary images are stored.

Edit - History - Print - Recent Changes - Search
Page last modified on November 30, 2012, at 01:38 PM