My Cart

Waspmote Starter Kit: Beginners GuideJanuary 17, 2013

Waspmote tutorial

[Spanish Version] by Arduteka

Welcome to the first tutorial of Waspmote for beginners!

If you don't know anything about Waspmote, in THIS ARTICLE you can see some of its features. In this tutorial, we are going to learn how to start working with it. First, we will see how to install the IDE. Then, we will review its characteristics using some examples.

Waspmote is an Open Source Sensor Platform developed by Libelium. It is very optimized in terms of consumption and applications. As we will see later, that's why it can open up a big world of possibilities making projects.

Because this is a tutorial for beginners, we are going to start with the basic steps.


Install and configure the IDE for Waspmote

First of all, we have to download the IDE (Integrated Development Environment) and the drivers needed. We will use it to program Waspmote in an easy way (as in Arduino).

In the next links you have the package for each operating system.

Once it is downloaded, we will see how to install it in each operating system!


Install Waspmote in Windows

Once the ZIP file is downloaded, we have to unzip it and search the drivers that we will need in the next step to install the USB and the FTDI converter.

When we connect a Waspmote board using the mini-USB, we will be able to see the message “New hardware found” and a new window will pop-up with the installation of this device.

Now we have to select the directory where the drivers for the FTDI converter are found, these drivers are in the file where we have unzip Waspmote.

Once the installation is finished, we will see again the message “New hardware found” but related with the USB. We have to do the same process that we have done with the FTDI converter in the steps before.

Finally, a message of a good USB installation will appear.

Waspmote is already installed! If we go to the “devices manager” we will see the port where the Waspmote board is connected.


Install Waspmote in Linux

Waspmote can be programmed using any of the Linux distributions.

To compile and use Waspmote is necessary to install some packages related to the compiler version for Atmel microcontrollers and the Java environment.

1.-Installing Java

The first step is to install the required version of the Java environment. For this, we can use Synaptic, the package manager, or using the terminal to carry out this process.

If we use Synaptic, we have to search the package “sun-java6-jre” and install it.

Using the terminal, we can use the command apt-get as follows:

$ sudo apt-get install sun-java6-jre

2.- Installing AVR-GCC compiler

The next step is to install the necessary version of the avr-gcc compiler to program the ATMEGA 1281 microcontroller of Waspmote.

For this, we can use again the Synaptic package manager or the terminal.

Using Synaptic we have to search the package “gcc-avr” an install it.

If we want to use the terminal we can use again the apt-get command as follows:

$ sudo apt-get install gcc-avr

3.- Installing the library lib-avc

The next step is to install the necessary version of the lib-avc library. To do this process we can use again the Synaptic package manager or the terminal.

Using Synaptic we have to search the package “lib-avc” and install it.

Using the terminal we can use the apt-get command as follows:

$ sudo apt-get install avr-libc

4.- Running Waspmote

Once we have installed the necessary packages to use Waspmote and downloaded the file of the link before, we only have to run the file called Waspmote to launch the IDE!


Install Waspmote in Mac-OS

Waspmote can be programmed using the operating system Mac OS X.

1.- Installing Waspmote

Once we have downloaded the package of the link before, we have to unzip it in a folder.

In this folder we can find the necessary drivers to install the FTDI converter and the IDE to program Waspmote.

2.- Installing the drivers of the FTDI converter

Waspmote requires to install the drivers of the FTDI converter. These drivers are in the downloaded file.

Once the drivers are installed, the Waspmote board can be connected and the system will recognize it correctly.

3.- Running Waspmote

We do not need to install anything else because it is ready to run directly. So we search the Waspmote file and launch it!

All is installed! When we run it, we have to see something like the following window:

As you can see, it is very similar to the Arduino IDE because it is based on it. In order to be an user-friendly interface.


Approaching to Waspmote

Now we will see the main features to know where is everything!

Inputs and outputs in Waspmote

In the next image we can see the two main ports of Waspmote, one with 12 pins and other with 22.

The port on the left of the image corresponds to the inputs and outputs in Waspmote, and they are defined as follows:

As you can see, it has 8 digital inputs/outputs operating at 3.3v, so we have to take the same precautions that we take with Arduino DUE or Raspberry Pi to avoid damaging the board if we connect a sensor.

We are going to control these inputs and outputs in the same way as in Arduino. In other words, using the familiar instructions pinMode(), digitalRead() and digitalWrite() and calling the appropriate digital I/O. Here we have some examples of the instructions:


In addition, the digital output 1 can also be configured as a PWM output of 8 bit (0-255 values from 0 to 3,3V) as follows:


Also, it has 7 analog inputs that will give us a resolution of 10 bit (0-1023 from 0 to 3,3v) of the sensors that we will connect.

Again, by analogy with Arduino, the way to access to them is with the instruction analogRead(selected input) as we can see in the example:


If we remember, in Arduino we can use these analog inputs as digital inputs and outputs, so here we can do it too.

For this, we have to call them, but not to his “tag” Analog, we have to call to the pin that they are connected.

In the next list we have the pin of each one:

  • ANALOG1 => 14
  • ANALOG2 => 15
  • ANALOG3 => 16
  • ANALOG4 => 17
  • ANALOG5 => 18
  • ANALOG6 => 19
  • ANALOG7 => 20

The other connector that we can see in the image is the I2C-UART bus.

Waspmote has 6 serial ports.

One of the UART of the microcontroller is simultaneously connected to the XBee communication module (the two parallel spaced rows of pins near the USB) and the USB port.

The other UART of the microcontroller is connected to a four channels multiplexer. Thanks to this, using the code you can select which of the four new UART we want to connect to the UART of the microcontroller.

These four new UART are connected as follows:

  • One is connected to the GPRS board.
  • One is connected to the GPS.
  • Two are accessible using the I2C-UART connector (Aux-Serial 1 and 2).

We can configure the multiplexer using the following instructions of Waspmote:


In Waspmote, there are some LED diodes integrated in the board, we are going to see the function of each one:

Charging Battery LED

This red LED indicates us that in Waspmote is connected a battery being charged. It can be charged using a mini USB cable or a solar panel connected to Waspmote in the corresponding connector. Once the battery is completely charged the LED turns off automatically.

LED 0 – Programmable LED

This green Led is connected to the microcontroller and is programmable by the user using the code in the program. In addition, this led indicates when Waspmote is reset emitting a blink each time that we reset the board.

LED 1 – Programmable LED

This red LED is connected to the microcontroller too. We can use it for what we need in our projects.


A green LED indicates when the Waspmote is connected to a compatible USB port for battery charging or programming. When the LED turns on indicates that the USB cable is connected correctly, when the USB cable is removed the LED turns off automatically.


In Waspmote, there are 3 LEDs to know visually the RSSI (Received Strength Signal Indicator) value of the ZigBee/802.15.4. These LEDs indicate the signal quality of the last packet received in mode of “coverage antenna”.

Now let's look for the jumpers that we have in the Waspmote board.

As we can see, we have 3 jumpers, whose functions are:

Programming Jumper:

Programming the board is only possible if the jumper is placed.

RSSI enable jumper

If the jumper is placed, the RSSI LEDs function is enabled.

Hibernate enable jumper.

If the jumper is not placed, programming Waspmote will be disabled too. The hibernate mode needs to remove this jumper during the beginning of the program for the first time.

In the next images, we can see all the things that Waspmote has. Note that if we want to program it and to operate with it, the switch must be turned ON, placed on the opposite side of the mini USB connector.

If we turn it over, we can see that they have used all the space to include details that will be very helpful.

We can see that it has a RTC (Real Time Clock) and a battery which will allow us to hibernate Waspmote during very accurate periods of time. While it is "asleep" it has a consumption of only 7uA!

We can program it for the 1st of each month do a reading, or every 30 minutes, send it to us, and then go back to sleep.

In addition, the RTC is extremely robust and resistant to thermal variations. It has a maximum margin of error, in extreme conditions, from just 1 minute per year!

Finally, apart from the different sockets that it owns, we can see that it has a slot for a card to incorporate micro-SD to store all the data that we acquired if we don't want to send it.

For example, we can connect the GPS module and the radiation board and to trace a route with different readings and then overlay it on Google maps with a simple application.

Let's start with our first program!!


Hello, Waspmote World!!

This will be a sample program to familiarize with Waspmote.

First of all, like in Arduino, the first thing to do is to select the serial port you have connected and the board connected, all using the TOOLS menu.

Secondly, we must ensure that we have the switch in the ON position.

Now we can program it!

In this example, we will turn on and off both LEDs integrated in Waspmote using the integrated accelerometer!

These diodes are easily programmable using the Waspmote library that contains instructions defined for it.

Now let's see the whole code!

Powering LEDs with the integrated accelerometer in Waspmote

void setup()
	ACC.ON(); //Activate the accelerometer
	USB.begin(); //USB serial connection

void loop()
	//Accelerometer data
	int ejeZ = ACC.getZ();
	USB.println(ejZ, DEC);

	//If the value is lower than 0... (from +1024 to -1024)
	if (ejeZ < = 0)
		Utils.setLED(LED1, LED_OFF); //Switch off red LED
		Utils.setLED(LED0, LED_ON); //Switch on green LED
		Utils.setLED(LED0, LED_OFF); //Switch off green LED
		Utils.setLED(LED1, LED_ON); //Switch on red LED

If we analyze the code we can see that there are two differentiated parts like in Arduino. The setup, where we configure all that we need in the program and the loop which is the part that will be repeated with the instructions. In the setup, the first thing that we do is to enable the accelerometer, this is as simple as the next instruction:


If we want to disable it, we have to change ON to OFF. In this program we don't want to disable it, we will use it in programs where we want to save energy.

The next instruction enables the UART USB to do debugging. In other words, it gives us the ability to send data using the USB port to the IDE console or any other.

This instruction is analogous to Serial.begin() in Arduino and we will use it in the same way.

If we don't put any value, the port is configured to 38400bps, it is the standard speed to use Waspmote and XBee.


In the loop, the first thing that we do is to save the data of the accelerometer's Z axis in a variable to use it as a reference.

The accelerometer of Waspmote (LIS3LV02DL) is a linear accelerometer of three axis. We can take its data using the I2C interface. The accelerometer has a resolution of 12 bits (4096 values)and 2 measuring ranges ±2g and ±6g.

By default the accelerometer is updated 40 times per second (40Hz), but it can be configured to increase this rate to 160, 640 or even 2560 times per second (2560Hz). In the last case we will obtain a value every 0.39 ms.

The way that we are going to take readings of each axis can not be simpler, just we have to do the call that interest us!


In this first program we have chosen the Z axis but you can do your own tests using the serial port and observing the changes to understand how it works.

We save the data in a variable and then, we print it through the serial port to know what we are reading.

int ejeZ = ACC.getZ();
USB.println(ejeZ, DEC);

Finally, we perform a conditional: if the value is less than 0 light a LED and if it is higher, turn on another, this will do that if we put the Waspmote on one side, turn on a diode, and vice versa!

//If the value is lower than 0... (from +1024 to -1024)
if (ejeZ < = 0)
	Utils.setLED(LED1, LED_OFF); //Switch off red LED
	Utils.setLED(LED0, LED_ON); //Switch on green LED
	Utils.setLED(LED0, LED_OFF); //Switch off green LED
	Utils.setLED(LED1, LED_ON); //Switch on red LED

As you can see, to turn on the integrated LEDs in Waspmote we use some very easy instructions to remember:

Utils.setLED(LED1, LED_OFF);
Utils.setLED(LED0, LED_ON);

The LED0 is the green one and the LED1 the red diode.

Now, we are going to see one of the most useful features that we can find in Waspmote, how to use its socket for wireless communication an the XBee 802.15.4 module.


Turn ON and OFF a LED using XBee 802.15.4

When we buy a Waspmote Starter KIT, it comes with all the necessary things to communicate wirelessly with the XBee 802.15.4 module.

As a curiosity, Waspmote integrates the XBee modules of Digi for communication in free frequency bands ISMB (Industrial Scientific Medical Band). These modules communicate with the microcontroller using the UART_0 with a speed of 38400bps.

Although the starter kit comes with the XBee 802.15.4, there are 7 XBee modules that are distributed by Cooking Hacks to integrate with Waspmote.

Model Protocol Frequancy txPower Sensitivity Range
XBee-802.15.4 802.15.4 2.4GHz 1mW -92dB 500m
XBee-802.15.4-Pro 802.15.4 2.4GHz 100mW -100dBm 7000m
XBee-ZB ZigBee-Pro 2.4GHz 2mW -96dBm 500m
XBee-ZB-Pro ZigBee-Pro 2.4GHz 50mW -102dBm 7000m
XBee-868 RF 868MHz 315mW -112dBm 12km
XBee-900 RF 900MHz 50mW -100dBm 10Km
XBee-XSC RF 900MHz 100mW -106dBm 12Km


These modules have been chosen because of their high sensitivity in reception and their transmission power.

The XBee modules which are integrated in Waspmote have RPSMA antenna connectors.

With everything that is included, we will be able to make connections up to 30m indoors and 90m outdoors. It will allow us a greater freedom of action!


But... if Waspmote sends data... Where do we receive them?

With any device that has a correctly configured XBee 802.15.4. This can be another Waspmote, an Arduino o our PC thanks to the Gateway that is included in the Waspmote Starter KIT!

This Gateway will allow us to connect a XBee to our PC. We only have to plug it and open a serial monitor to start watching what Waspmote is sending!

Once we have the data in our serial port, we can treat them depending on the experience of each one. We can make graphs with processing, fill an excel or upload the data to Pachube. We decide the limits! Let's see some examples that will help us to avoid problems.


How to configure the XBee modules

If we want to communicate two XBee modules, they must have the same PAN ID and speed.

Each XBee has inside a large number of customizable parameters. For example, you can modify the intensity of the signal but, at the moment, we are not interested in it.

If we buy the modules from Cooking Hacks, they will be ready to connect directly without configure them.

Let's see how to configure them in the different operation systems.
First, we have to connect the Gateway with the XBee module that we want to configure.

To configure the XBee, we have some programs that will help us to do it.

Configuring XBee 802.15.4 in Windows

In windows, the easiest way is using a program called XCTU that you can download from this link.

Once we have downloaded and installed it, we have to see something like this:

We find four tabs with the following functions:

  • PC Settings: It allows us to select the COM port where we have connected the Gateway and other necessary parameters to communicate with the XBee module. In the right part, we set the speed (baud) of our XBee. Other parameters, as the parity bit, if we haven't set them before, we shouldn't change them. To verify that communication is properly configured, we have to click Test / Query.
  • Range Test: It allows us to do range tests between two modules.
  • Terminal: With this we have access to the data that we are receiving through XBee module and send data to it.
  • Modem Configuration: This is the tab where we can configure our XBee module. If we have configured the module speed in the first tab, clicking on READ we will be able to read all the configuration data of the module.

With all this, we have to go to the modem configuration tab, and be sure that the PANID is the same in our modules. And INTERFACE DATA RATE is at the same speed as the program, in Waspmote 38400bps.
Then, we click on Write and we have configured the modules!

In this link you have more information about XCTU.

Configuring XBee 802.15.4 in Linux

A quick and easy solution is to use XCTU through WINE. Let's see how to do it!

We have to open a terminal and install WINE:

apt-get install wine

Then, we have to “map” the ports detected in Linux (tty shaped) to the way that windows understands (com).

In ($HOME)/ .wine/dosdevices, do
ln -s /dev/ttyUSB0 com5
ln -s /dev/ttyUSB1 com6
ln -s /dev/ttyUSB2 com7
ln -s /dev/ttyUSB3 com8

Then, we download the XCTU and we have to do it executale.

chmod 755 <file name>

We have to open the downloaded installable file with the program loader of WINE by right clicking on the file and selecting “open with Wine program loader” and follow the instructions.

Now we have to plug the Gateway with the XBee in a USB port and to check if it detects these two instructions:

ls -ltr /dev/tty*
grep USB /var/log/syslog

We can open XCTU from Wine menu!

Configuring XBee 802.15.4 in MAC

For mac, in order to use XCTU, we will have to emulate this software using Wine Bottler. You can download it in this link. Once it is installed, our '.exe' icon will become executable.

We need also install X-Code for Mac. If we are using Mountain Lion, we will use Xquartz because X-Code is not available for this OS.

Now, let's see this module in action with a simple program!


Lighting a LED with XBee 802.15.4

With the next program. we will be able to see how easy is to send data between the Waspmote and the Gateway.

The Waspmote is waiting for a character, A or B. It is sent from the Gateway connected to our PC. Depending on the character, a LED or other of the board will light for a second.

It is a very simple application, but we will use it as the basis of many projects.

Let's see the code.

void setup()
	//Start XBee
	//Activate it
void loop()
	char val =;
	if (val == 'A')
		Utils.setLED(LED0,LED_ON); //Switch ON the red LED
		Utils.setLED(LED0,LED_OFF); //Switch OFF the red LED
	if (val == 'B')
		Utils.setLED(LED1,LED_ON); //Switch ON the green LED
		Utils.setLED(LED1,LED_OFF); //Switch OFF the green LED

As in the example before, in the Setup we configure all that we are going to use in the program. Now, the XBee module. For this, we only have to write these lines:


The first instruction is to tell the program which module we are using, and the second to activate it.

In the first instruction we can add more parameters but we will do it when we have more experience in the Waspmote world!

In the loop, we read the data received by the XBee module, and store them in a variable.

char val =;

Once the data is stored, we have to compare it with the character you want to trigger an action or another.

if (val == 'A')
	Utils.setLED(LED0,LED_ON); //Switch ON the red LED
	Utils.setLED(LED0,LED_OFF); //Switch OFF the red LED
if (val == 'B')
	Utils.setLED(LED1,LED_ON); //Switch ON the green LED
	Utils.setLED(LED1,LED_OFF); //Switch OFF the green LED

As you can see, we have used the explained instructions for lighting the integrated LEDs in Waspmote!

For more information about Waspmote:
- Technical Guides
- Example Codes
- Waspmote Official Website

Source: Arduteka

Leave a Reply