Contiki Power Switch Example

 Introduction

The following instructions show how to realize a remote power switch by using a SeedEye board running Contiki OS.

(The picture shows the system architecture)

 

Hardware Requirements

  • A PC
  • Two SEED-EYE boards;
  • A power switch connected to the Analog port RE0/HV7131_Y7_B0 of the board implementing the remote switch functionality;
  • picKit3 or ICD3 or other PIC programmer.

Software Requirements

Running the Demo 

  1. download and install the Microchip XC32 Compiler
  2. download Contiki
  3. supposing Contiki is installed inside directory /data/contiki/, compile the border-router example present in the Contiki mainstream by doing:

    cd /data/contiki/examples/ipv6/rpl-border-router

    make TARGET=seedeye SEEDEYE_ID=1

    mv border-router.seedeye border-router.elf

  4. supposing Contiki is installed inside directory /data/contiki/, compile the powerswitch application provided by doing:

    cp powerswitch /data/contiki/examples/seedeye/ -rf

    cd /data/contiki/examples/seedeye/powerswitch

    make TARGET=seedeye SEEDEYE_ID=2

    mv remotepowerswitch.seedeye remotepowerswitch.elf

  5. program the first PIC board with the border-router.elf
  6. program the second PIC board with the remotepowerswitch.elf
  7. reset the two Seed-Eye boards
  8. connect the first board with the PC using the UART 1A port and activate the border-router application by doing:

    cd /data/contiki/tools

    make tunslip6

    ./tunslip6 -s /dev/ttyUSB0 aaaa::1/64

  9. since IPv6 addresses of the two boards are random assigned in software, they must be manually read by attaching a serial interface to the UART 1B port of each SEEDEYE (UART 1B is the interface used for debug in this application) what follows is an example of the output:

    Rime started with address 00:50:C2:FF:FE:A8:C2:66

    nullmac nullrdc, channel check rate 1000 Hz, radio channel 26

    Tentative link-local IPv6 address fe80:0000:0000:0000:0250:c2ff:fea8:c266

    Tentative global IPv6 address aaaa:0000:0000:0000:0250:c2ff:fea8:c266

  10. download and install Firefox and install the Copper Plugin
  11. supposing the address of the powerswitch node has IPv6 address aaaa::3  by using Firefox it's now possible to a access the switch resource at the following CoAP address: coap://aaaa:3/actuators/powerswitch. Through the Copper interface it is possible to power-on and power-off the switch by sending simple GET requests to the resource. Alongside wit the switch-on/switch-off of the RE0 pin, a led of the board is also toggled for debug purpose.


Remote Power Switch Example can be downloaded at:

https://github.com/tecip-nes/contiki-sssup/tree/master/examples/seedeye/powerswitch


Author

Giovanni Pellerano


Credits

Daniele Alessandrelli

Riccardo Pelliccia