Installing
Contiki Operating System (in Windows)
Steps involved
are as follows:
1 .Download Instant Contiki
Contiki
is a open source Operating System. Instant Contiki and Cooja makes Contiki
easier to install and get started with.
About Instant Contiki:
Instant Contiki is an entire Contiki development
environment in a single download. It is an Ubuntu Linux virtual machine that
runs in VMWare player and has Contiki and all the development tools, compilers,
and simulators used in Contiki development installed.Instant Contiki is so
convenient that even hardcore Contiki developers use it.
We begin by
downloading Instant Contiki, installing VMWare Player, and booting up Instant
Contiki.
Download Instant Contiki
Download Instant Contiki. It is a large file, just over 2 gigabyte.
When downloaded, unzip the file, place the unzipped directory on the desktop.
Install
VMWare Player
Download
and install VMWare Player.It might require
a reboot of your computer, which is unfortunate but needed to get networking
working.
Start Instant Contiki
Boot Ubuntu
Start Instant Contiki by running InstantContiki2.7.vmx.
Wait for the virtual Ubuntu Linux boot up.
Log in
Log into Instant Contiki with the default password user
2 .Start Cooja
We will now compile and start Cooja, the Contiki network simulator.
About Cooja:
Cooja is the Contiki network simulator. Cooja
allows large and small networks of Contiki motes to be simulated. Motes can be
emulated at the hardware level, which is slower but allows precise inspection
of the system behavior, or at a less detailed level, which is faster and allows
simulation of larger networks.
Open
a terminal window
To start Cooja, first
open a terminal window.
Start
Cooja
In the terminal
window, go to the Cooja directory:
Ø
cd contiki/tools/cooja
Start Cooja with the
command:
Ø
ant run
Wait
for Cooja to start
When Cooja first
starts, it will first compile itself, which may take some time.
When Cooja is
compiled, it will start with a blue empty window.
Now that Cooja is up
and running, we can try it out with an example simulation.
3.Run Contiki in Simulation
About
Cooja Simulaton:
Cooja is
a highly useful tool for Contiki development as it allows developers to test
their code and systems long before running it on the target hardware.
Developers regularly set up new simulations both to debug their software and to
verify the behavior of their systems.
Create
new simulation
Click on the File menu and click New simulation…
Set
simulation options
Cooja
now opens up the Create new simulation dialog. In this dialog, we may choose to give our
simulation a new name, but for this example, we'll just stick with My
simulation. Click the Create button.
Simulation
windows
Cooja
brings up the new simulation.
ü
The Network window, at the top
left of the screen, shows all the motes in the simulated network - it is empty
now, since we have no motes in our simulation.
ü
The Timeline window, at the
bottom of the screen, shows all communication events in the simulation over
time - very handy for understanding what goes on in the network.
ü
The Mote output window, on the right
side of the screen, shows all serial port printouts from all the motes.
ü
The Notes window on the top right is where we can put notes for our
simulation.
ü
The Simulation control window is where we start, pause, and reload.
Add motes to the
simulation
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 type mote and select one of the available mote types. For this
example, we click Sky mote to create an
emulated Tmote Sky mote type.
Create
a new mote type
Cooja
opens the Create mote type dialog, in which
we can choose a name for our mote type as well as the Contiki application that
our mote type will run. For this example, we stick with the suggested name, and
instead click on the Browse…button on the right hand side to choose our Contiki
application.
Example of Contiki
Application
Go to the directory /home/user/contiki/examples/udp-stream/udp-stream.c
Specify C source file.i.e.choose
the file udp-stream.c
This file contains a simple Contiki application that randomly broadcasts a UDP
packet to its neighbors. Click the open button to choose the file.
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.
Create the mote type
Click the create button to create the mote type. The window will close.
/
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 8. Then click the Add
motes button to add the
motes to the simulation.
Start the simulation
We can now see
the 8 motes we added to the simulation in the Network window. Click
the Start button to start the
simulation.
See printouts from the simulated motes appearing in the Mote
outputwindow.
The Network window
shows communication going on in the network. The Timeline window shows communication and radio events over time - the small gray
lines are ContikiMAC periodically waking the radio up. We can click the Pause button
to pause the simulation.
This shows the Cooja simulation with Contiki nodes that send periodic UDP
packets with ContikiMAC sleepy router functionaliy.