Kickstart Linux

If you are completely new to OpenWSN, and you are using Linux, read this page first. It will walk you through all the steps to install OpenWSN and explore a number of key features.

In particular you will:

  • compile and run OpenWSN in simulation mode, ping a simulated mote, and interact with it over CoAP.
  • program a OpenMote-CC2538 mote, connect it to your computer, ping it, and interact with it over CoAP.

Download OpenWSN

OpenWSN is a collection of repositories hosted on GitHub. We will download and use the following:

We will download these repositories side-by-side in an openwsn/ directory in your desktop using Git. 

At any time, you can make sure that you are using the latest code by using git pull:

Running a Simulation

Frankly, it's a bit strange to start using OpenWSN with a simulation, since the firmware is really meant (and written) to run on real motes. But, not everyone has hardware, not always the same hardware, etc. So to make things nice and easy, we'll start by simulation. Oh, and the simulated code behaves exactly the same as the real code, so what you see now is what you'll get with real hardware.


Before we can start running a simulation, we need to compile the firmware as a Python extension. This is all explained in the OpenSim page if you want to know what's going on.

This step compile the complete OpenWSN firmware as a Python extension module (a form of shared library) which the simulation environment can import at run-time.

The extension module is at ~/Desktop/openwsn/openwsn-fw/projects/common/, no need to move it.


You can now start a simulation. Running a simulation just means taking the usual software which runs on your computer (and call "openvisualizer"), but running it in simulation mode. That is, instead of the openvisualizer connecting to read motes, it connects to emulated mote code actually running on you machine.

Start a simulation:

That's it, an OpenWSN simulation is now running your computer!

Open to see the web interface of OpenWSN

Open the "Topology" tab:

  • left click on a mote to move it around
  • right-click on two motes to connect them with a wireless link

  • left-click on a link to change its PDR (packet delivery ratio)

Set up the topology to have a chain 1-2-3, and set each PDR to 1.

Back in the "Motes" tab, select mote 0001 and click on the "Toggle" button. You just declare mote 1 to be the root of your network (the DAGroot in RPL parlance, the sink in WSN parlance, the gateway, etc). You can select other motes and see that they join the network and obtained the same prefix bbbb::/64.

Congratulations, you have built your first OpenWSN simulated network!

Ping a mote

By convention (i.e. this is hard-coded in the software), the IPv6 prefix of the simulated network is bbbb:/64. This means that the IPv6 address of each mote will start with "bbbb::". The remainder of a mote's IPv6 address is it's MAC address (or EUI-64). You can read this in the web interface (under "EUI-64").

Open a new terminal to ping mote 2:

You can also ping mote 3 which is 3 hops away:

Interact over CoAP

CoAP is a protocol implement on each OpenWSN device, which makes it appear like a web server on the Internet.

By default, an OpenWSN mote implements a CoAP "info" resource which indicate what version of the code is running. You can test that by running the Python test script provided in the firmware:

Debugging with Wireshark

In simulation mode, the openvisualizer takes care of simulating the wireless medium. You can use Wireshark to take a peek at what goes over this simulated radio space.

You can download the Wireshark from and install with default configuration. 

Start Wireshark on the tun interface at address bbbb::1, and configure the filtering for zep (the ZigBee encapsulation protocol).

You now see all the packets exchanged over the simulated radio environment, exciting!

Here is an example pcap file of openwsn simulation network with three motes: example.

Closing the OpenVisualizer

In the terminal from where you started the OpenVisualizer, type q to close it

Now with real hardware

User experience with real hardware is identical than when using the simulator. Because it is a popular platform, we will use the TelosB mote, although any other supported hardware platform can be used instead.

Connecting the boards

When connecting a TelosB board, you Linux will assign it a device file. Reading/writing to/from that file results in bytes being sent to/from your TelosB over its UART interface. To know which device your TelosB is located at, plug it into your computer, wait a second, and type dmesg:

The penultimate line indicates that this TelosB is attached to /dev/ttyUSB0. You can repeat the same procedure for the other boards. In my case, I have 3 motes connected:

Compiling/Loading firmware

The build environment allow you to build the firmware and load is on all your boards with a single command (how cool is that?):

Start a network

Once the motes are programmed, you have the exact same experience as when running a simulated network.

First, start the OpenVisualizer:

Open to see the web interface:

Your TelosB motes turn on their blue LED once synchronized.

Ping a mote

You can ping a mote exactly as you would in the simulator:

Interaction over CoAP

You can interact with a mote exactly as you would in the simulator. After modifying the script to communicate with mote bbbb::1415:9200:12:e63b:

What's next?

Congratulations! You've now gone through the trouble of installing all of the tools and pieces of OpenWSN. From now on, it's just fun.

AttributeError: 'Requirement' object has no attribute 'project_name'