Newv0.4.0: cngsim, a web UI that edits the network, Cooja-NG in the browser → MSP430 · Cortex-M · RISC-V — 802.15.4, 6LoWPAN, RPL

Real Contiki-NG firmware. A whole network of it.

Cooja-NG emulates the motes Contiki-NG runs on — Tmote Sky, Z1, CC2538, nRF52840, nRF54L15 — instruction by instruction, on one simulated 802.15.4 radio medium with nanosecond time. It runs Contiki-NG's own Cooja tests headless, without a JVM, and the same seed gives the same run every time.

93/93 Contiki-NG Cooja tests stock Contiki-NG and Zephyr builds, no simulator hooks same seed, same run no JVM · builds with make BSD-3-Clause
The Cooja-NG web UI: a 10 by 10 grid of Tmote Sky motes with radio links and arrows for transmissions, a node list, and a packet log of decoded RPL and UDP frames
100 Tmote Sky motes forming an RPL DAG — a recorded run, replayed by the simulator's own web UI
▶ Play it
Demos

Watch a network form.

Each demo is a recording of a real run. CI built the simulator from this site's commit, ran the scenario headless with --ui-record and kept what the web UI would have shown. The player replays the file in this tab: nothing runs on a server. Run it live runs the same scenario in this tab instead: the simulator itself, compiled to WebAssembly, emulating the real firmware while you watch, pause it or drag the motes around.

A 10 by 10 grid of motes with many transmission arrows
100 × Tmote SkyRPL · UDP · CSMA

A hundred motes in a grid

A 10×10 grid of Tmote Skys (MSP430 + CC2420) running Contiki-NG's rpl-udp example. DIOs spread out from the root, DAOs climb a DAG up to five hops deep, and the UDP requests start to flow.

Three motes in a row with arrows between them and a packet log
Sky · CC2538 · nRF52840IPv6 · RPL · UDP

Three CPUs, one RPL network

An MSP430 (Tmote Sky), a Cortex-M3 (CC2538) and a Cortex-M4F (nRF52840), each with its own radio model, on one DAG. The Sky is the root, and both ARM clients complete UDP round trips through it.

A 4 by 4 grid of motes around a central root, with arrows along the routes
16 × CC2538RPL · UDP

Sixteen CC2538s

A 4×4 grid of TI CC2538 motes — Cortex-M3 with the on-chip 802.15.4 radio — around a root in the centre. The overlapping circles are each mote's radio range in the unit-disk medium.

Two motes linked by a radio arrow, with a packet log
2 × XIAO nRF54L15TrustZone-M · RPL

TrustZone-M, over the air

Two Seeed XIAO nRF54L15s (Cortex-M33). Each node's Non-secure world runs Contiki-NG and reaches the radio through SG veneers into the Secure world's driver — and they still join one DAG and exchange UDP.

Two motes with TSCH log lines in the node list and data frames with ACKs in the packet log
2 × nRF52840 DKTSCH · 6TiSCH

TSCH on the nRF52840

Contiki-NG's 6tisch simple-node: the coordinator sends enhanced beacons, the second node scans, associates and keeps its sync. A time-slotted MAC only works if the emulated radio's timing is right.

Two motes with an energy panel showing duty cycle and millijoules per mote
2 × Tmote Skyenergest plugin

Energy, as it happens

The built-in energest plugin turns each mote's radio and CPU states into an energy estimate, in the spirit of Cooja's PowerTracker, and draws it as a live panel. The recording keeps the panel too.

Two motes; the Contiki-NG console lists echoes of 16 to 640 bytes with round-trip times, the Zephyr console logs each reply
2 × nRF52840 DKContiki-NG · Zephyr

Contiki-NG talks to Zephyr

Zephyr's stock echo_server, unmodified, and a Contiki-NG node that sends it datagrams of 16 to 640 bytes and checks every echo. Neighbor Discovery finds the server; from 128 bytes up each datagram crosses as 6LoWPAN fragments, reassembled by the other OS.

Two motes; the Contiki-NG root lists a route to the RIOT node and the messages RIOT sent, the RIOT console shows its shell commands and the replies
2 × nRF52840 DKContiki-NG · RIOT

RIOT joins a Contiki-NG network

A stock RIOT node, driven from its own shell, joins the RPL network a Contiki-NG node roots, takes its address from the root's prefix, then pings it (300-byte pings go as fragments) and trades UDP messages with it. Two RPL implementations, one DODAG.

In the player: the scrubber seeks, the slider sets the speed (simulated seconds per second), Timeline shows each mote's radio activity, and the Packets tab decodes every frame. A hidden tab pauses playback until you come back.

Get started

Three commands to a running network.

cngsim runs a simulation from a short YAML file and prints what the nodes print, the checks and a verdict, or opens it in your browser. The examples, the firmware they run and the guide come in the same download.

  1. Install. Download the latest release for your machine (Linux x86-64, macOS) and put its bin/ on your PATH, or build from source: make && make install PREFIX=~/.local.
  2. Run an example.cngsim examples lists them; cngsim run rpl-udp-sky runs one headless, with an exit code CI understands.
  3. Watch it.--ui opens the browser, paused. Drag nodes, add and remove them, type into a node's console, and save the setup as YAML.
  4. Make your own.cngsim new writes a commented setup from a template, on any board, in a grid, line, circle or at random. Point it at your own Contiki-NG builds with board:.
  cngsim, from a shell
$ cngsim run rpl-udp-sky
cooja-ng 0.4.0 · RPL-UDP on two Tmote Skys · 2 nodes · seed 42
   19.000 [Node 2/MSP430] Sending request 0 to fd00::212:7401:1:101
  ✓ "Sending request" on node 2 (19.000 s)
   19.019 [Node 1/MSP430] Received request 'hello 0'
  ✓ "Received request" on node 1 (19.019 s)
   19.063 [Node 2/MSP430] Received response 'hello 0'
  …
  ✓ "Received response" ×3 on node 2 (38.203 s)
PASSED · 38.2 s simulated in 0.04 s

$ cngsim run rpl-udp-sky --ui
Web UI: http://localhost:8080/
Paused: press Play (or Space) in the browser, or Enter here, to start.

$ cngsim new rpl-udp --board nrf52840-dk -n 9 --layout grid -o my-net.yaml
Wrote my-net.yaml: 9 nrf52840-dk nodes, grid layout, 45 m radio range.
For Contiki-NG

The Cooja test suite, headless. 93 of 93.

Contiki-NG's simulation tests are .csc files for Java Cooja. Cooja-NG converts each one, builds the firmware it needs from your tree, runs it with the test's own JavaScript and reports PASS or FAIL — from one binary, with no JVM and no GUI, roughly an order of magnitude faster than Cooja with MSPSim.

  1. Point it at a Contiki-NG tree.tools/run-cooja-tests.sh takes CONTIKI_DIR (5.2 or develop), builds and caches the firmware, and runs everything, one category or one .csc.
  2. Same seed, same run.--seed N is Cooja's --random-seed. The same seed gives a byte-identical simulation, and the project's CI diffs every engine change against main to keep it that way.
  3. Fails loudly.A timeout, a .csc feature that is not implemented, a broken firmware build, a pattern that matches nothing: each is an error with a reason and a non-zero exit, never "0 tests, all OK".
  4. Drop it into CI.Prebuilt releases for Linux and macOS, a GitHub Actions job to copy, and a documented SIMULATOR=cooja-ng patch for Contiki-NG's own make -C tests/… flow.
  5. Script the run.--script runs a command script against the simulation — send input, expect output, wait-until a condition — and the exit code says what failed: what a CI job, or a coding agent, needs from a test bench.
  the Contiki-NG Cooja suite, from a shell
# a Contiki-NG checkout next to this repository
$ export CONTIKI_DIR=~/contiki-ng
$ tools/run-cooja-tests.sh
=== Cooja Test Suite (csim) ===
  RUN   07-simulation-base/01-hello-world-sky       PASS (0s)
  RUN   07-simulation-base/02-ringbufindex          PASS (1s)
  RUN   09-ipv6/01-ping-lla-csma-w-rpl              PASS (1s)
  RUN   14-rpl-lite/01-rpl-up-route                 PASS (1s)
  RUN   15-rpl-classic/07-rpl-random-rearrangement  PASS (6s)
  …
  SKIP  17-tun-rpl-br/01-border-router-cooja (filtered)
  …
=== Results ===
  Total: 93
  Passed: 85
  Failed: 0
  Skipped: 8
  Errors: 0

# the 8 skips are the border-router tests, which need a TUN
# device: --with-tun (root, or setcap on tunslip6) runs all 93
$ tools/run-cooja-tests.sh 14-rpl-lite --seed 3
What's inside

The motes Contiki-NG runs on.

Each CPU is an interpreter (with a JIT for hot MSP430 and Thumb blocks) and each SoC a model of its peripherals, down to the radio's per-byte timing. Everything shares one event queue and one radio medium.

MSP430 16-bit · MSP430X

Boards
Tmote Sky, Z1, MSP-EXP430FR5969
MCUs
F1611, F2617, FR5969
Radio
On the Tmote Sky: the CC2420 state machine with auto-ACK, CRC and TX power

CC2538 Cortex-M3

Boards
CC2538DK, OpenMote, Zolertia Firefly
Radio
On-chip RF core; the Firefly adds the off-SoC CC1200 for sub-GHz 802.15.4g
Runs
Contiki-NG RPL, TSCH (with low-power modes)

nRF52840 Cortex-M4F

Boards
nRF52840 DK, nRF52840 Dongle
Radio
Nordic 802.15.4 RADIO with EasyDMA and per-byte delivery
Runs
Contiki-NG RPL and TSCH, stock Zephyr 802.15.4 samples

nRF54L15 Cortex-M33 + RISC-V

Boards
nRF54L15 DK, Seeed XIAO nRF54L15
Security
TrustZone-M: SAU, SG/BXNS, SecureFault, the SPU's peripheral permissions
Dual core
The FLPR coprocessor (RV32EMC) running Contiki-NG's nrf-vpr port next to the M33

The kernel deterministic

Time
One event queue in (time, sequence) order, nanosecond resolution, Cooja's scheduling model
Medium
Unit-disk graph with interference ranges and TX power; plugin media such as burst loss
Motes
Emulated ELF, native Cooja motes, JavaScript motes, external processes

Around it tools

Watch
Live web UI, run recording and replay, pcap capture, energy estimation
Debug
Interactive shell and scripts, GDB stub, breakpoints and watchpoints
Co-sim
Renode as the clock master, esp32sim's ESP32-C6 as a mote on the medium
News

Releases.

Each release ships prebuilt binaries for Linux x86-64 and macOS (Intel and Apple Silicon), with checksums and a build-provenance attestation per tarball.

  1. v0.4.0

    Cooja-NG, usable without building it from source: cngsim takes you from the download to a running simulation in three commands, with commented examples, layouts that place many nodes at once, and a web UI that edits the running network and saves it as YAML. The same C code runs in the browser on the original firmware, held to the native build byte for byte, behind this site's live demos. The CC1352R1 and CC1312R7 LaunchPads join, Contiki-NG talks to Zephyr and to RIOT in two interop demos, and configs are checked harder — read Changed in the notes before upgrading.

  2. v0.3.0

    A command shell and script engine for testing firmware through its own console, run recording and replay (this site), the nRF54L15's TrustZone-M enforced the way a Seeed XIAO enforces it, Renode co-simulation, the simulator as a library, FreeBSD, and a kernel wakeup path that no longer scales with the node count. The three release binaries give byte-identical simulation output.

  3. v0.2.3

    YAML as the primary config format, external motes for emulators that keep their own clock (esp32sim's ESP32-C6), and a kernel fix that made the border-router traceroute test pass on Linux.

  4. v0.2.0

    The first prebuilt binaries, the first release to pass Contiki-NG 5.2's complete Cooja suite (93 of 93), and a JIT for Cortex-M.

Your own runs

Record a run, replay it anywhere.

Add --ui-record to any run and you get the file these demos play: the web UI's stream, with the simulation unchanged. Put it next to player.html (the repository's ui/index.html) on any static host and open player.html?replay= plus its name.

./build/test_runner test configs/test-mixed-platform-rpl.yaml --ui-record mixed.json
How replays work →