programming the real world

27
Programming the Real-world Introduction to SPOT Peng Deng CSSE University of Melbourne Lab SUM

Upload: pauldeng

Post on 14-Jan-2015

2.382 views

Category:

Documents


0 download

DESCRIPTION

 

TRANSCRIPT

Page 1: Programming The Real World

Programming the Real-world

Introduction to SPOT

Peng Deng

CSSE University of MelbourneLabSUM∑

Page 2: Programming The Real World

2

• Graduated from MEDC in 2008

• Research assistant in UniMelb– SensorWeb

• Software engineer in Daintree Networks– Implement wireless protocol decoder

Page 3: Programming The Real World

3

Agenda

• Introduction– Evolution of Computing– WSN

• Sun SPOT– What is SPOT– Hardware and Software

• Tutorial

• Application Demos

• My Projects

Page 4: Programming The Real World

4

Evolution of Computing4

2020 and beyond: Ubiquity Era

Thousands of computers per user.

Page 5: Programming The Real World

5

Wireless Sensor Network• Small-scale sensor nodes• Wireless communication• Large scale of deployment• Unattended operation• ……

• Environmental monitoring

• Security

• Defence• Bioinformatics and health

• Transportation management

• Chemical detection and emergency response

Page 6: Programming The Real World

6

TinyOS and Crossbow

• Difficult to setup development environment– TinyOS SDK, JDK, cygwin…

• Difficult to program– No process/memory management– Applilcation = scheduler + graph of components– nesC: Low level language

• Lack computing power– MICA2 7MHz 128K; MICAz 4MHz 128K

• Open source software, propitiatory hardware

Page 7: Programming The Real World

7

What is Sun SPOT• Embedded Development Platform

– Flexible hardware and software

• Easy to program – Java top to bottom– User programs the device entirely in Java – Using standard Java tools

• Connected – Wireless Communication– Mesh networking

– Over the Air Programming

• Mobile– Built in battery charged through USB

• Aware and Active– Able to sense and affect surroundings

• Secure– Built-in asymmetric cryptography

• Open Source– Software -- Hardware

Page 8: Programming The Real World

8

Sun SPOT Hardware

Antenna

2.4 GHz IEEE 802.15.4 Radio ModuleCC2420

180 MHz 32 bit

ARM920T core512K RAM4M Flash

Daughter board connector

Power switch

USB interface with mini-B connector

Page 9: Programming The Real World

9

Sun SPOT Hardware [cont.]

8 3-colors LEDs Switches

Light sensor 3-D

Accelerometer

Analog in 4-5

Replicated switches "High" current outputsDigital I/O

Digital I/O 0-3 Analog inputs

Temperature sensor andA/D converter

Page 10: Programming The Real World

10

Sun SPOT Software

• Squawk Virtual Machine

– J2ME CLDC 1.1 (cellphone without display)

– Runs on bare metal (No OS)

– Designed for memory constrained devices

– Runs multiple applications (concurrently)

• IDE Supported– NetBeans, Eclipse, …… any Java IDE you familiar

with

Page 11: Programming The Real World

11

TutorialGet Data From Sun SPOT

Sun SPOTsSun SPOTs

Sun SPOTBase StationSun SPOT

Base Station

PC(Processing)

PC(Processing)

Host Application

Embedded Application

Page 12: Programming The Real World

12

App Dev Procedure

1. Create Sun SPOT project or Sun SPOT Host project

2. Implement your application

3. Connect, compile and deploy application to SPOT

Page 13: Programming The Real World

13

Embedded Application

Import …

public class StartApplication extends MIDlet {

protected void startApp() throws MIDletStateChangeException {

//application logic}

protected void pauseApp() {} //not used

protected void destroyApp(boolean unconditional) throws MIDletStateChangeException {} //execute when exit

}

Page 14: Programming The Real World

14

Embedded Application//create instances of sensors on boardprivate IAccelerometer3D accel = EDemoBoard.getInstance().getAccelerometer(); private ITemperatureInput tempSensor = EDemoBoard.getInstance().getADCTemperature(); private ILightSensor lightSensor= EDemoBoard.getInstance().getLightSensor();

//application logic—get values from sensorsString msg = String.valueOf(accel.getAccelX())+";"+

String.valueOf(accel.getAccelY())+";"+String.valueOf(accel.getAccelZ())+";"+ String.valueOf(tempSensor.getCelsius())+";"+ String.valueOf(lightSensor.getValue());

//send data back to PCRadiogramConnection conn =(RadiogramConnection)Connector.open("radiogram://0014.4F01.0000.4BFD:100"); Datagram dg = conn.newDatagram(conn.getMaximumLength());dg.writeUTF(msg);conn.send(dg);conn.close();

9 lines of code!

Page 15: Programming The Real World

15

Host Application

J2SE applicationRadiogramConnection conn = (RadiogramConnection) Connector.open("radiogram://:100"); Datagram dg = conn.newDatagram(conn.getMaximumLength());conn.receive(dg);

String rawData = dg.readUTF();System.out.println(rawData);conn.close();

DONE!

Page 16: Programming The Real World

16

Debug Remote App

• Create a debug agent– ant debug -DremoteId=0014.4F01.0000.46E0

• Attache IDE Debuger

• Add your breakpoints

Page 17: Programming The Real World

17

Applications

Page 18: Programming The Real World

18

ApplicationsAutonomous Deployment

Page 19: Programming The Real World

19

ApplicationsRobot

Page 20: Programming The Real World

20

ApplicationsSwarms

Autonomous Light Air Vessels•Cell phone vibration motor to propel

•Roam around to find friend or seek food

•Spinning together

•Feed them

Page 21: Programming The Real World

21

ApplicationsMike’s Flying Bike

Flying and Exercise!

Sun SPOT + Google Earth Flight Simulator

Page 22: Programming The Real World

22

ApplicationsSPOTkin

Sun SPOT + Pumpkin?

Page 23: Programming The Real World

23

My ProjectsGame Panel

Sun SPOT + Never Ball

Page 24: Programming The Real World

24

My ProjectsVirtual Earth Controller

Sun SPOT + NASA World Wind

The earth is on your palm

Page 25: Programming The Real World

25

My ProjectsGesture Recognition

Facts:1.Multi-attributes; 2. Data stream

Challenges:1.Recognition; 2. Segmentation

Solutions:1.Machine Learning; 2. Threshold+std dev

Accuracy: 17% ~ 97%

Page 26: Programming The Real World

Q & A

Page 27: Programming The Real World

27

Peng DengResearch Assistant

SUM Research LabCSSE University of Melbourne

Thank you

August 4, 2009