Programming with Contiki

Step 1: Download Instant Contiki

Download Instant Contiki here. It is a large file, just over 1GB. When downloaded, unzip the file, place the unzipped directory on the opt.

Step2: Start Instant Contiki

To Start contiki first open the terminal by click Ctrl+t (in Ubuntu)

cd opt/contiki-3.0


” ls ” to view and conform the files inside the contiki


Start Cooja

In the terminal window, go to the Cooja directory:

cd contiki-3.0/tools/cooja

Start Cooja with the command:

ant run


Wait for Simulator to start

When Cooja first starts, it will first compile itself, which may take some time.

When its compiled, it will start with a blue empty window.


Step 3: Run simulation

Create new simulation

Click the File menu and click New simulation….5Click the Create button.


Add motes

Before we can simulate our network, we must add one or more motes. We do this via the Motes menu, where we click on Add motes…. Since this is the first mote we add, we must first create a mote type to add. Click Create new mote type… and select one of the available mote types. For this example, we click Sky mote… to create an emulated Tmote Sky mote type.

Motes–>Add Motes–>Create new mote type–>sky mote…6

Browse and find contiki example /opt/contiki-3.0/examples and select a .c file…

for example am selected /opt/contiki-3.0/examples/collect-view/collect-view.c7

Compile Contiki and the application

Now Cooja will verify that the selected Contiki application compiles for the platform that we have selected. Click the Compile button. This will take some time the first time around, expect it to take a minute at least. The compilation output will show up in the white panel at the bottom of the window.8

Create the mote type

Click the Create button to create the mote type. The window will close.10

Add motes to simulation

Cooja will now ask us if we want to add motes from the newly created mote type to the simulation. We change the number of motes to add in the Number of motes field to 5. And click add motes.11

Start the simulation

We can now see the 5 motes we added to the simulation in the Network window. Click the Start button to start the simulation.13

we can pause the simulation by clicking pause button.14

Collect view : Tools–>collect view–>sky 1

In collect window click start collect button to start collect the mote info…15


Congratulations! We have now created our first Cooja simulation with Contiki nodes that collect packets.


Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s