Thursday, May 29, 2014

Quickstart: Raspbian (Raspberry Pi) Essentials

Prepare booting SD card
SD card > 4G, http://www.raspberrypi.org/documentation/installation/installing-images/README.md

Example with Raspbian
- Download: http://downloads.raspberrypi.org/raspbian_latest
- Download the Win32DiskImager utility from Sourceforge Project
- Make booting SD card from the downloaded image using Win32DiskImager

USB Serial Console (no need a monitor and keyboard)
https://learn.adafruit.com/adafruits-raspberry-pi-lesson-5-using-a-console-cable/overview


VNC Server
http://elinux.org/RPi_VNC_Server

Youtube player
https://pypi.python.org/pypi/whitey

Enable IPv6
Easy. sudo modprobe ipv6 will enable it immediately. If you want it to automatically be enabled at boot, just add ipv6 on a line by itself at the end of /etc/modules.  

Tips
- SD card will appears in Windows only with its boot partition, which is few hundred kb
- If Ethernet doesn't work, check power source using official cable

Thursday, April 17, 2014

Light sensing with TelosB

A small application to demonstrate IP networking in smart objects: Light sensing with TelosB motes + Contiki OS + uIP stacks.

Equipment needed
- 02 TelosB motes
- 01 gateway machine: Java supported, USB port

Setup
- 01 mote is connected to the gateway as a sink node to receive data from the other mote. It is an UDP server to print the received data to serial port
- 01 motes frequently collect light intensity and send it to the sink node if the intensity changes dramatically (higher than a predefined THRESHOLD = 2). It is an UDP client to send data
- Gateway: Using serialdump* tool to get data from the sink node's serial port and a Java client running to capture these data.

Source code
https://github.com/sonhan/ipsensorcollect

Demo

The bottom panel gets darker if  light intensity reduces

Friday, March 21, 2014

Contiki OS 2.7 Cooja Serial Device with serial2pty

Create a virtual serial device for Cooja motes under /dev/pts/[id]

1. Download
https://github.com/cmorty/cooja-serial2pty
2. Update code with new Cooja class names (if not updated) in Serial2Pty.java

- Change package org.contikios.cooja to se.sics.cooja
import se.sics.cooja.*;
import se.sics.cooja.interfaces.SerialPort;
- Change class Cooja to GUI

A modified code can be found here: https://github.com/sonhan/cooja-serial2pty

3. Build
copy to /contiki/cooja/apps/serial2pty
ant jar
cooja > Settings -> Cooja Extensions... > Select the serial2pty app

4. Test
- Restart Cooja if needed
- Right click on the mote > Mote tools for Test Node > Serial 2 Pty > it shows the serial device (e.g., /dev/pts/10
- Open a Terminal:

#cd contiki
#sudo make login TARGET=sky MOTES=/dev/pts/10 (for a simulated Sky mote)

Thursday, March 6, 2014

Contiki OS: RPL Network Setup 2

One mote can be used as a wireless interface (IEEE 802.15.4), host machine as Border Router to  bridge the wireless IPv6 network (e.g., LLN) to outside network, and the Internet.

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

1. slip-radio (mote 1 as an IEEE 802.15.4 interface)
#cd contiki-2.7/examples/ipv6/slip-radio
#make TARGET=sky
#sudo make TARGET=sky slip-radio.upload

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

3. Host machine (Linux)
 #cd contiki-2.7/examples/ipv6/native-border-router
#make [TARGET=native]
#sudo ./border-router.native -L -v6 aaaa::1/64
*default: -s ttyUSB0 (serial device) -B 115200 (baud rate) -t tun0 (name of interface)

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

[Contiki 2.7 Release Error] border-router.c:161:28: error: expected ‘)’ before ‘;’ token. 
Just delete the ';'

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

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

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