Thursday, February 20, 2014

Contiki OS: Handy Commands and Tools (TelosB)

Linux
#make TARGET=sky savetarget (save target)
#make [TARGET=sky] motelist (list of attached motes)
#sudo [TARGET=sky] make login (mote console)
#make [TARGET=sky] MOTES=/dev/ttyUSB1 (target at the motes /dev/ttyUSB1)
#sudo make [MOTES=/dev/ttyUSB1] name_of_program.upload (upload to [ttyUSB1]) 


Windows
cd tools\sky
motelist-windows.exe (list of attached motes)
serialdump-windows.exe -b115200 /dev/com5 (mote console of COM5 mote, baud rate 115200)

TelosB driver:  FTDI
http://www.ftdichip.com/FTDrivers.htm

Monday, February 17, 2014

Contiki OS: Run Contiki Collect View tool on Windows, Linux

Collect View is a Contiki tool to collect and visualize data from a mote (including energy consumption)

Requirements
- 01 Host machine (Windows or Linux TI MSP430 toolchain)
- 02 TelosB motes

Motes setup
- Use InstantContiki or Linux with TI MSP430 toolchain (see here)
- Connect 02 motes
- Build and upload udp-sink (sink node) and udp-sender (send node
cd examples/ipv6/rpl-collect
make PERIOD=10 (sending every 10sec) if this doesn't work change in the source file collect-common.c #define PERIOD 10

make TARGET=sky MOTES=/dev/ttyUSB0 udp-sink.upload
make TARGET=sky MOTES=/dev/ttyUSB1 udp-sender.upload

Windows environment setup
- Download Contiki source (contiki-2.7)
- Download ANT and extract to a folder (E:\dev\apache-ant-1.9.3)
- Add System Environment variable ANT_HOME=E:\dev\apache-ant-1.9.3
- Add %ANT_HOME%\bin to your PATH

build.xml fix (for Windows)
- Remove the collect-view-shell.ihex part (it is used to compile collect example and copy to the dist folder)
<target name="collect-view-shell.ihex"
<target name="dist" depends="jar,collect-view-shell.ihex">

Go and rock
- Connect sink node to the host machin
- Run Terminal or cmd (Windows with administrator)

cd contiki-2.7\tools\collect-view
ant (building)
cd dist
java -jar collect-view.jar /dev/com6 (Windows, COM6 is the device port)
sudo java -jar collect-view.jar /dev/ttyUSB0 (Linux, ttyUSB0 is the device port)

Click Start Collect

Tuesday, February 11, 2014

Contiki OS: TelosB Toolchain TI MSP430 Installation Ubuntu + Cygwin (Windows)

Official Website

http://sourceforge.net/apps/mediawiki/mspgcc/index.php?title=MSPGCC_Wiki 

Ubuntu

Install libncurses
$ sudo apt-get install libncurses5-dev

Install msp430 toolchain
$ sudo apt-get install msp430-libc mspdebug msp430mcu binutils-msp430 gcc-msp430 gdb-msp430

[ia32-libs]

Cygwin

Make sure rpm package is installed (Run setup again, under util if rpm cannot be found)

Sunday, February 9, 2014

Contiki OS: RPL Network Setup 1

One mote can be used as a Border Router to bridge the wireless IPv6 network (e.g., LLN) to a PC via serial link. By which, the IPv6 network traffic can reach outside network, and the Internet.

InstantContiki 2.7 or any machine with Contiki-2.7 and TI MSP430 toolchain (See here)

1. Border router (mote 1)
#cd contiki-2.7/examples/ipv6/rpl-border-router
#make TARGET=sky
#sudo make TARGET=sky border-router.upload

2. UDP servers (motes 2..n) or any IPv6 service
#cd contiki-2.7/examples/ipv6/rpl-udp
#make TARGET=sky
#sudo make TARGET=sky udp-server.upload

3. Host machine 

- Linux using tunslip6 (with mote 1 connected as ttyUSB0)

#cd contiki-2.7/tools
#make tunslip6
#sudo ./tunslip6 -s /dev/ttyUSB0 aaaa::1/64

Cooja: sudo ./tunslip6 -a 127.0.0.1 aaaa::1/64
(enable Serial  Socket Server in the Cooja node used as the wireless interface)

- Windows using wpcapslip6 (with mote 1 connected as COM5)
Run cmd (Admin)
ifconfig /all --> find a working network interface (e.g.,Virtual Box Network Interface), MAC address: 00-50-56-C0-00-01
cd tools\stm32w\wpcapslip6
wpcapslip6 -s /dev/com5 -b aaaa:: -a aaaa::1/64 00-50-56-C0-00-01 (COM5 is where the mote is connected, check in Device Manager)

4. Test
ping6 aaaa::212:7400:13cb:44 (mote 1, border router)
ping6 aaaa::212:7400:13ca:fee4 (mote 2)
ping6 aaaa::212:7400:13cb:34fa (mote 3)


Firefox: http://[aaaa::212:7400:13cb:44]