Baptiste Gaultier edited this page Jun 4, 2013 · 15 revisions
Clone this wiki locally

Arduino µIPv6 Stack

In Telecom Bretagne, we love open source and IPv6. That's why we decided to port the Contiki OS network stack (6LoWPAN/IPv6 + RPL + CoAP) to our favorite prototyping platform : Arduino.

How to use IPv6 stack library

We released a first example which demonstrates the use of IPv6 stack library : IPv6UDPexample.ino In this example, you will need two Arduino Mega with Wireless Proto Shield and Xbee Series 1 mounted.

Then follow these steps :

  1. Change the value of the SERIAL_BUFFER_SIZE to 128 in /arduino-directory/hardware/arduino/cores/arduino/HardwareSerial.cpp
  2. Clone the IPv6 Stack repo : git clone https://github.com/telecombretagne/Arduino-IPv6Stack.git
  3. Upgrade and configure the Xbee modules using X-CTU like so : ![X-CTU screenshot.png](./raw/master/wiki/X-CTU screenshot.png)
  • ID - PAN ID 0xABCD (if you want to talk with Contiki nodes configured with 0xABCD PAN ID by default)
  • MM - MAC Mode 2 - 802.15.4 WITH ACKS
  • AP - API Enable 2 - API ENABLED W/PPP
  • MY - 16-bit Source Address 0xFFFF
  • DH - Destination Address High 0x00
  • DL - Destination Address Low 0xFFFF
  1. You can also use your favorite serial communication program (like minicom, screen, cutecom, coolterm...)

  2. To do so, connect your Arduino MEGA mounted by a XBee shield w/ XBee Series 1 module to your computer

  3. Upload BareMinimum.ino (Files‣Examples‣01.Basics‣BareMinimum) to your Arduino MEGA (don't forget to switch the wireless shield to USB)

  4. Then fire up your terminal and type : $ screen /dev/<arduino_tty> 9600

  5. Type $ screen /dev/<arduino_tty> 9600

  6. Press +++ without pressing Enter and wait for OK

  7. Enter each command+value and press Enter (Eg. ATCHE sets channel to 0x0E==14)

  8. Then type +++ followed by Enter to write the configuration to non-volatile memory

  9. Configure your motes using contiki_conf.h

For nodes (can be run with two nodes only):


For routers (can have a border router and intermediate ones (see IS_INTERMEDIATE_ROUTER in IPv6UDPexample.ino)):

  1. If you want a different prefix for the 6LoWPAN context then you have to define SICSLOWPAN_CONF_ADDR_CONTEXT_0 in contiki_conf.h like so : #define SICSLOWPAN_CONF_ADDR_CONTEXT_0 {addr_contexts[0].prefix[0]=0xbb;addr_contexts[0].prefix[1]=0xbb;addr_contexts[0].prefix[2]=0;addr_contexts[0].prefix[3]=0;addr_contexts[0].prefix[4]=0;addr_contexts[0].prefix[5]=0;addr_contexts[0].prefix[6]=0;addr_contexts[0].prefix[7]=0;}
  • Change it in the example too (IPv6UDPexample.ino) and put the same as in the context: IPv6Address prefix(0xbb, 0xbb, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0);
  1. Upload IPv6UDPexample.ino to the two Arduino Mega (don't forget to switch the wireless shield to USB)
  2. Switch to Micro position. The wireless module will then communicate with the microcontroller.
  3. Enjoy !