Upload
angad-singh
View
3.112
Download
0
Embed Size (px)
DESCRIPTION
Citation preview
1
Angad SinghSun Campus Ambassadorblogs.sun.com/angad
1
Programming the world Programming the world with Sun SPOTSwith Sun SPOTS
2
The Squawk Java VM
What is Sun SPOT?
Agenda
Coding a SPOT
RoboControl
Sun SPOT Demo
3
What is a Sun SPOT?
• A hardware and sofware research platform• A small, battery operated, wireless device running the Squawk Java Virtual Machine (VM) without an underlying OS.• On-board sensor board Accelerometer, Light Sensor, Temperature Sensor, I/O pins• The Sun SPOT development kit can be purchased at www.sunspotworld.com
4
What is Sun SPOT?• A Java platform for developing
applications for wireless networks and small devices
• Applications such as:> Robotics> Art> Toys> Personal electronics> Commercial Applications> Telemetries
5
Why SunSPOTs?• Too many low-level
concerns in current WSN systems• 4x more productive in
Java than in C• Allows the developer to
focus on application functionality and features
6
Why Sun SPOT?• Abstraction of low level details through VM• Protection of hardware by VM> Memory protection from bad code> Security protection from malicious code
• 802.15.4 wireless communication> upto 250Kbps, ZigBee support> adhoc, mesh, cluster tee and star topologies.
• A simple device with sensors and wireless operates at low power
7
What did Sun Labs come up with?• Powerful mid-level
device:> Space for exploratory
programming> Allow processing of data
on node to reduce network traffic
> Enable over-the-air-programming
8
The anatomy of a SunSPOT• The device has three
layers:> Battery> ARM based processor
board with wireless radio> Add-on sensor board
• Processor board acts as basestation• User programs the
device in Java using NetBeans
9
SunSPOT Hardware• Processor board> 180 MHz 32 bit ARM920T core - 512K RAM/4M Flash> 2.4 GHz 802.15.4 ZigBee radio with integrated antenna> USB interface> 3.7V rechargeable 720 mAh lithium-ion battery
• Sensor board> 2G/6G 3-axis accelerometer> Light and temperature sensor> 8 tri-color LEDs, 2 momentary switches> 6 analog inputs, 5 general purpose I/O pins and 4 high
current output pins
10
You need 2 spoons of java...• SunSPOT Software
Development Kit> Orange ver. 2.0> Purple ver. 3.0 in beta> Green ver. 1.0 (old)
• Java• Ant• NetBeans (works both
with 5.5 and 6.0)
11
Sun SPOT Software Development Kit• Squawk Java VM: Desktop and Sun SPOT• Libraries> Java ME CLDC 1.1 libraries> Hardware libraries
– SPI, AIC, TC, PIO drivers all written in the Java programming language
– Demo sensor board library> Wireless layer libraries> Network layer libraries
– 802.15.4 MAC layer written in Java> Desktop libraries
12
The Squawk Java VM
What is Sun SPOT?
Agenda
Coding a SPOT
RoboControl
Sun SPOT Demo
13
What is squawk?• Another Sun Labs project• A java JVM written in java• Now open source (January
23rd 2008)• Inspiration from Squeak, a
Smalltalk environment written in Smalltalk• New home on the net https://
squawk.dev.java.net/
14
The Squawk virtual machine
15
SunSPOT build and deploy process
SunSPOTbuild
Squawk suite
converter
javac
.class
.java
.suite
.bin deploy
16
Split VM architechture
17
But – why not embedded Linux?• By running on the bare
metal, Squawk avoids the need for an operating system (OS) in the Sun SPOT, thereby freeing up memory that would otherwise be consumed by an OS.
18
But – why not embedded Linux? (2)
“A lightweight configuration of embedded Linux requires 250 KB of ROM and 512 KB of RAM”
Arcticle onJava on the Bare Metal of Wireless Sensor Devices
19
The right tool...for the right job• A series of features made Squawk JVM ideal for a
wireless sensor platform:> 1. was designed for memory constrained devices,> 2. runs on the bare metal on the ARM,> 3. represents applications as objects (via the isolate
mechanism),> 4. runs multiple applications in the one VM,> 5. migrates applications from one device to another, and> 6. authenticates deployed applications on the device.
20
Design Overview
21
The Squawk Java VM
What is Sun SPOT?
Agenda
Coding a SPOT
RoboControl
Sun SPOT Demo
22
Sun SPOT Radio CommunicationExample: A Java Snippet for Sending
try {// Broadcast a message on port 52DatagramConnection conn = (DatagramConnection)
Connector.open(“radiogram://broadcast:52”);
Datagram packet = conn.newDatagram(conn.getMaximumLength());
packet.writeInt(someValue);
conn.send(packet);} catch (IOException ioe) { /* Handler */ }
23
Sun SPOT Radio CommunicationExample: A Java Snippet for Receiving
try {// Listen on port 52DatagramConnection conn = (DatagramConnection)
Connector.open(“radiogram://:52”);
Datagram packet = (Radiogram) listenerConn.newDatagram(0);
conn.receive(packet);
//get the address of the sending SPOTString address= packet.getAddress();int rssi = packet.getRssi(); //get signal strength
} catch (IOException ioe) { /* Handler */ }
24
Sun SPOT Sensor Code SnippetRangeInput light = SensorBoard.getLightSensor();RangeInput temp = SensorBoard.getTemperatureSensor();ISwitch switch1 = SensorBoard.getSwitch1();Accelerometer3D accel = SensorBoard.getAccelerometer();// Set accelerometer to 6G scalling( (LIS3L02AQAccelerometer) accel).set6GSScale();
SensorBoardColouredLED led1 =SensorBoardColouredLED.getLed1();
led1.setOn();// Change LED colour as SPOT is tiltedint xAccel = accel.getX().getValue();
if(xAccel > 0)led1.setRGB(xAccel, 0, 0);
elseled1.setRGB(0, 0, xAccel);
25
demo
26
Where to go from here...• http://www.sunspotworld.com/> Documentation, SDK> Discussion Forums> FAQs and application notes
• http://blogs.sun.com/davidgs/> News and informal info on SPOTs around the world
• https://squawk.dev.java.net/ or http://research.sun.com/projects/squawk/squawk-rjvm.html> The “old” research page and the new home as a open source
project on java.net• http://www.sun.com/emrkt/educonnection/newsletter/0108insidetech.html?cid=e4731
RoboControl
28
29
A network controlled ROBOT
30
A network controlled ^ ROBOTSun SPOT powered
31
What is RoboControl?
• A wireless Sun SPOT powered robot with 2 DC motors, a 12V battery, an IC, a bluetooth camera phone and The Sun SPOT controller application written completely in Java.• A client and server application suite which allows remotely controlling the robot's motion, live video capture of the robot's camera and monitoring and visualization of the sensor data received from the robot's Sun SPOT.
Components of RoboControl
33
Components of RoboControlfile:///C:/Documents%20and%20Settings/Angad%20Singh/Desktop/Sun%20SPOT%20Talk/Sun%20Tech%20Days%20Talk/components.JPG
34
Architecture
Java Technology Used
in RoboControl
36
Java Technology used in RoboControl
• Sun SPOT SDK• Netbeans 6.0 IDE• Java Communications API (uptil v1.0)• Java Media Framework• Java Socket Communications• Java Threading• Swing Application Framework
Future Scope
38
Future Scope● Dynamic spotlight illumination● Out-of-range Alarm● Automatic “return home action” ability of the robot to
backtrack it’s path when it runs out of range.● Using the live accelerometer data received from the SPOT
in a variety of useful ways on the RoboControl Client:● Showing the path traced by Robot● 3D Visualization of the robot’s orientation● Collision detection and warning
39
More Future Scope..● Automatic motor speed adjustment● Remote controlled task based automation – automated task
designer. scripted tasks deployed to robot● Control of multiple wireless robots.● Image Processing● Sensor Plugin Architecture: Ability to add more sensors to
the robot and visualizing the sensor data using a plugin architecture.
RoboControl on the Web
41
RoboControl on the Web• RoboControl Java.net Project:The RoboControl project on Java.net:
http://robocontrol.dev.java.net• Downloadable release, documentation, and complete sources checked in under SVN
Mailing Lists:You may also subscribe to the following mailing lists for queries, suggestions, feedback, announcements and discussion on development work:
42
Angad SinghSun Campus Ambassadorblogs.sun.com/angad
QUESTIONS?
42