SlideShare a Scribd company logo
Introducing
the Sun SPOTs
Stefano Sanna
Senior Developer
JUG Sardegna ONLUS

                     1
About Me
• Senior developer @ beeweeb technologies

• Technical writer @ DEV, Computer Programming,
  Java Journal...
• Supporter @ JUG Sardegna, JMDF, JIA, GULCh

• LEGO constructor since 1973...



                                                  2
Java User Groups in Italy




                            3
Program the (Real) World
• Wireless sensor networks open new exciting
  scenarios:
  > pervasive monitoring of environment and structures
  > massive distributed intelligence
  > urban smart objects

• Programmable Objects for Real World
  >   connected: the Internet of Things
  >   autonomous: local CPU, local memory, local code
  >   environment-aware: sensors
  >   safe and robust
                                                         4
Sensors: New Frontier of Interaction
• To be programmable and connected is not enough!

• The ability to “perceive” the surroundings is the next
  interaction frontier for consumer and mobile devices

• Gaming console, mobile phones, automotive
  appliances, embedded systems: any object is
  expected to “sense” and act according to physical
  quantity such as temperature, light, acceleration,
  position, humidity, proximity...

                                                           5
Sensors in the Java ME World
• Java ME is leading technology for mobile
  applications, ranging from cellular phones to
  embedded systems

• A rich set of standard API enables multimedia
  capabilities, 2D and 3G graphics, local and remote
  connectivity, location, NFC...

• The Java Community Process has published the
  Mobile Sensor API (JSR 256) for accessing devices
  such as accelerometers, thermometers, light sensor
                                                       6
Introducing the Project Sun SPOTs
Small Programmable Object Technology

• Project from Sun Laboratories
• Platform for intelligent wireless
  sensors network
• Live-laboratory for implementing
  new computing scenarios:
  > The (Inter)net of Things
  > Program the world


                                       7
Sun SPOT Presentations




                         8
SPOTs Hardware
• Processor Board
  > 180 MHz 32 bit ARM920T core
      512K RAM/4M Flash
  >   2.4 GHz IEEE 802.15.4 radio
      with integrated antenna
  >   USB interface
  >   3.7V rechargeable 720 mAh
      lithium-ion battery
  >   32 uA deep sleep mode



                                    9
SPOTs Hardware
• Demo Sensor Board
 >   2G/6G 3-axis accelerometer
 >   Temperature sensor
 >   Light sensor
 >   8 tri-color LEDs
 >   6 analog inputs, 2 switches
 >   5 general purpose I/O pins
 >   4 high current output pins



                                   10
SPOTs Software
• Squawk Virtual Machine
  > Fully capable J2ME CLDC 1.1
    Java VM with OS functionality
  > VM executes directly
    out of flash memory
  > Device drivers written in Java
  > Automatic battery management




                                     11
Sun SPOT Java Development Kit




                                12
Free-Range and Basestation
• Sun SPOT Development Kit provides:

  > Two free-range SPOTs, equipped with Processor Board,
    radio interface, Demo Sensor and battery

  > One basestation SPOT, with Processor Board and radio
    interface

  > SDK for Windows, Mac OS X, Linux

  > USB cable

                                                           13
Development
• SDK comprises libraries and utilities for compiling
  and packaging bytecode, updating SPOTs firmware,
  running basestation applications

• SDK is based on Ant tasks and can be integrated in
  any IDE, e.g. Netbeans

• SPOTs support remote installation, execution and
  debugging of applications through wireless
  connection

                                                        14
Applications
• Sun SPOT Applications
  > Run on free-range SPOTs
  > CLDC 1.1 and IMP 1.0 application model
  > Full access to peripherals and demo board

• Sun SPOT Host Applications
  > Run on a SPOT configured as basestation
  > Stand-alone application model
  > Simultaneous access to SPOT and JSE libraries



                                                    15
Classes, Devices, Sensors, Interfaces
• There are over 400 classes documented in the Sun
  SPOT javadoc: nearly three times the MIDP 2.0
  specification! :-)
• The Sun SPOT device library contains drivers and
  high-level classes to access physical interfaces and
  peripherals:
  >   ILed
  >   IlightSensor, IAccelerometer3D
  >   IFlashMemoryDevice
  >   IPowerController
  >   IPWMOutput
  >   IAT91_PIO, IAT91_IAC...
                                                         16
Radio Communication
• Sun SPOTs come with low-range IEEE 802.15.4
  radio module
• Communication API is based on Generic
  Connection Framework and provides:
  > RadioConnection (radio://) from stream-based
    communication
  > RadiogramConnection
    (radiogram://) for datagram
    based communication

  > basestation may act as
    proxy for HTTP connections
                                                   17
Sun SPOTs Projects
• Many projects based on Sun SPOTs have been
  published on the Web: just use your preferred
  search engine or video repository to find them!




                                                    18
Mashing-up Hardware and Software
• The Sun SPOTs let developers build their custom
  interfaces for virtually any kind of electronic
  peripheral:

  >   sensors
  >   motors
  >   microcontrollers
  >   radio equipment




                                                    19
Be Careful with Solder... :-(
• However, soldering and designing circuits and
  interfaces for physical components require some
  specific expertise

• Wrong assembly or accidental short circuit may
  definitively damage your SPOTs and/or your
  peripherals

• How can we exploit Sun SPOTs potential without
  setting-up a electronic lab?

                                                    20
Fun for Everyone! :-)
• Thanks to the basestation, we can use the PC as
  gateway to any resource such as USB devices,
  network hosts and Bluetooth peripherals

• LEGO Mindstorms NXT kit provides:
  >   Easy and flexible
  >   3 outputs
  >   4 inputs
  >   Bluetooth and USB interfaces
  >   Open source iCommand Java library provides easy and
      powerful API for remote NXT control
                                                            21
“Real” Gesture Controller for Vehicle



               USB

802.15.4
  radio
                           Bluetooth




                                        22
Overview
• The Gesture Controller
  > Runs on a free-range SPOT
  > Reads tilt degrees on X and Y axes
  > Sends message to Vehicle Controller

• The Vehicle Controller
  > Runs on the basestation
  > Receives messages from Gesture Controller
  > Sends commands to NXT Vehicle



                                                23
The Gesture Controller (source.1)
public class SunSpotApplication extends MIDlet {
 private IAccelerometer3D accelerometer =
        EDemoBoard.getInstance().getAccelerometer();
 private ISwitch switch1;
 private int st=0;
 private RadiogramConnection conn;


 protected void startApp() throws
                     MIDletStateChangeException{
     switch1 =
          EDemoBoard.getInstance().getSwitches()[0];
     runSwitchWatcher();
 }
                                                       24
The Gesture Controller (source.2)

 protected void pauseApp() {
     // This will never be called by the Squawk VM
 }


 protected void destroyApp(boolean arg0)
               throws MIDletStateChangeException {
 }




                                                     25
The Gesture Controller (source.3)
 private void runSwitchWatcher(){
    Thread t1 = new Thread(){
         public void run(){
             sw1.waitForChange();
             if (conn == null) {
                 try {
                  conn = (RadiogramConnection)
                    Connector.open(quot;radiogram://broadcast:133quot;);
                  startAccelerometerWatcher();
                 } catch (Exception e) {   }
             }
         }
    };
    t1.start();
}
                                                                   26
The Gesture Controller (source.4)
 public void startAcceWatchThreadd(){
     Thread t2 = new Thread() {
      public void run() {
          while(true){
              readTildAndSend();
          }
      }
     };
     t2.start();
 }




                                        27
The Gesture Controller (source.5)
 private void readTiltAndSend() {
     try {
      int tiltX = (int) Math.toDegrees(acc.getTiltX());
      int tiltY = (int) Math.toDegrees(acc.getTiltY());
      String data = Integer.toString(tiltX) +
                           quot;#quot; + Integer.toString(tiltY);
      send(data);
     } catch (IOException ex) {   }


     try {
      Thread.sleep(100);
     } catch (InterruptedException ex) {   }
 }


                                                            28
The Gesture Controller (source.6)
    private synchronized void send(String data) {
        if (conn !=    null) {
            try{
             Datagram datagram =
                      conn.newDatagram(conn.getMaximumLength());


             datagram.writeUTF(data);
             conn.send(datagram);
            } catch(IOException e){   }
        }
    }
}




                                                                   29
The Vehicle Controller (source.1)
public class SunSpotHostApplication {
 private static final int FORWARD       = 0;
 private static final int BACKWARD = 1;
 private static final int RIGHT         = 2;
 private static final int LEFT          = 3;
 private static final int STOP          = 4;
 private int last = STOP;
 private static Pilot pilot; // iCommand Java NXT Library


 public static void main(String[] args) {
     SunSpotHostApplication app = new
                                  SunSpotHostApplication();
     startNXT();
     app.start();
 }
                                                              30
The Vehicle Controller (source.2)

 private static void startNXT() {
     try {
         NXTCommand.open();
         pilot = new Pilot(2.1f,4.4f,Motor.A, Motor.C,true);
     } catch(Exception e) {
         e.printStackTrace();
     }
 }




                                                               31
The Vehicle Controller (source.3)
 public void run() {
     try{
      RadiogramConnection conn =
 (RadiogramConnection) Connector.open(quot;radiogram://:133quot;);
      Datagram datagram =
                  conn.newDatagram(conn.getMaximumLength());
      while(true){
          datagram.reset();
          conn.receive(datagram);
          String rawData = datagram.readUTF();
          String[] tokens = rawData.split(quot;#quot;);
          moveVehicle(tokens[0], tokens[1]);
      }
     }catch(IOException e){   e.printStackTrace(); }
 }
                                                               32
The Vehicle Controller (source.4)
 private void moveVehicle(String accelX, String accelY) {
  int tiltX = (int) Double.parseDouble(accelX);
  int tiltY = (int) Double.parseDouble(accelY);


  if (tiltY > 15) {
      if (last != BACKWARD) {
          pilot.backward();
          last = BACKWARD;
      }
  } else if (tiltY < -15) {
      if (last != FORWARD) {
          pilot.forward();
          last = FORWARD;
      }
  }
                                                            33
The Vehicle Controller (source.5)
   else if (tiltX < -25) {
       if (last != RIGHT) {
           pilot.rotate(30);
           last = RIGHT;
       }
   } else if (tiltX > 25) {
       if (last != LEFT) {
           pilot.rotate(-30);
           last = LEFT;
       }
   } else {
       if (last != STOP) {
        pilot.stop();
        last = STOP;
   }
                                    34
DEMO
(Murphy Law loading... please wait...)




                                         35
Conclusions
• Sensors are the new frontier of interaction

• The Sun SPOTs are the quot;cool Java wayquot; to create a
  quot;live labquot; for innovative scenarios
  of ubiquitous and
  pervasive computing
• Extended class library
  and full integration of
  basestation with
  desktop PC gives
  everybody the opportunity to HAVE FUN with SPOT
                                                      36
References
• Sun SPOT World
  > http://www.sunspotworld.com
• Sun SPOTs and Java robotics on java.net
  > https://sunspot-robotics.dev.java.net/
  > http://community.java.net/robotics/
• Sun SPOT purchasing:
  > http://www.sunspotworld.com/products
  > http://store.systronix.com
• LEGO Mindstorms NXT
  > http://mindstorms.lego.com
  > http://lejos.sourceforge.net             37
Contacts
• Stefano Sanna
  > gerdavax@tiscali.it – http://www.gerdavax.it

• JUG Sardegna ONLUS
  > http://www.jugsardegna.org

• Java Mobile Developers Forum
  > http://www.jmdf.org




                                                   38
Introducing
the Sun SPOTs
Stefano Sanna
Senior Developer
JUG Sardegna ONLUS

                     39

More Related Content

What's hot

Wi-Fi Esp8266 nodemcu
Wi-Fi Esp8266 nodemcu Wi-Fi Esp8266 nodemcu
Wi-Fi Esp8266 nodemcu
creatjet3d labs
 
Ceis114 final joshua_brown
Ceis114 final joshua_brownCeis114 final joshua_brown
Ceis114 final joshua_brown
JoshuaBrown233
 
Introduction to AIoT & TinyML - with Arduino
Introduction to AIoT & TinyML - with ArduinoIntroduction to AIoT & TinyML - with Arduino
Introduction to AIoT & TinyML - with Arduino
Andri Yadi
 
Sec285 final presentation_joshua_brown
Sec285 final presentation_joshua_brownSec285 final presentation_joshua_brown
Sec285 final presentation_joshua_brown
JoshuaBrown233
 
Esp8266 basics
Esp8266 basicsEsp8266 basics
Esp8266 basics
Eueung Mulyana
 
Arduino and Internet of Thinks: ShareIT TM: march 2010, TM
Arduino and Internet of Thinks: ShareIT TM: march 2010, TMArduino and Internet of Thinks: ShareIT TM: march 2010, TM
Arduino and Internet of Thinks: ShareIT TM: march 2010, TMAlexandru IOVANOVICI
 
Build WiFi gadgets using esp8266
Build WiFi gadgets using esp8266Build WiFi gadgets using esp8266
Build WiFi gadgets using esp8266
Baoshi Zhu
 
Microcontroller arduino uno board
Microcontroller arduino uno boardMicrocontroller arduino uno board
Microcontroller arduino uno board
Gaurav
 
arduino
 arduino arduino
arduino
jhcid
 
Republic of IoT 2018 - ESPectro32 and NB-IoT Workshop
Republic of IoT 2018 - ESPectro32 and NB-IoT WorkshopRepublic of IoT 2018 - ESPectro32 and NB-IoT Workshop
Republic of IoT 2018 - ESPectro32 and NB-IoT Workshop
Alwin Arrasyid
 
Elektor 0304-2020
Elektor 0304-2020Elektor 0304-2020
Elektor 0304-2020
khonarphub chikdee
 
Esp32 cam arduino-123
Esp32 cam arduino-123Esp32 cam arduino-123
Esp32 cam arduino-123
Victor Sue
 
WHD global 2017 - Smart Power Plant
WHD global 2017 - Smart Power PlantWHD global 2017 - Smart Power Plant
WHD global 2017 - Smart Power Plant
José Enrique Crespo Moreno
 
Espressif Introduction
Espressif IntroductionEspressif Introduction
Espressif Introduction
Amazon Web Services
 
Programming The Real World
Programming The Real WorldProgramming The Real World
Programming The Real Worldpauldeng
 
Lego pres 10
Lego pres 10Lego pres 10
Lego pres 10
monsonite
 
Open Sound Control as Middleware for Games Accessibility and Body-movement Co...
Open Sound Control as Middleware for Games Accessibility and Body-movement Co...Open Sound Control as Middleware for Games Accessibility and Body-movement Co...
Open Sound Control as Middleware for Games Accessibility and Body-movement Co...
Alasdair Thin
 
Issnip Presentation
Issnip PresentationIssnip Presentation
Issnip Presentationpauldeng
 
Project_report_on_Attendance_system
 Project_report_on_Attendance_system Project_report_on_Attendance_system
Project_report_on_Attendance_system
Ami Goswami
 
Arduino day
Arduino dayArduino day
Arduino day
Adedigba Yinka
 

What's hot (20)

Wi-Fi Esp8266 nodemcu
Wi-Fi Esp8266 nodemcu Wi-Fi Esp8266 nodemcu
Wi-Fi Esp8266 nodemcu
 
Ceis114 final joshua_brown
Ceis114 final joshua_brownCeis114 final joshua_brown
Ceis114 final joshua_brown
 
Introduction to AIoT & TinyML - with Arduino
Introduction to AIoT & TinyML - with ArduinoIntroduction to AIoT & TinyML - with Arduino
Introduction to AIoT & TinyML - with Arduino
 
Sec285 final presentation_joshua_brown
Sec285 final presentation_joshua_brownSec285 final presentation_joshua_brown
Sec285 final presentation_joshua_brown
 
Esp8266 basics
Esp8266 basicsEsp8266 basics
Esp8266 basics
 
Arduino and Internet of Thinks: ShareIT TM: march 2010, TM
Arduino and Internet of Thinks: ShareIT TM: march 2010, TMArduino and Internet of Thinks: ShareIT TM: march 2010, TM
Arduino and Internet of Thinks: ShareIT TM: march 2010, TM
 
Build WiFi gadgets using esp8266
Build WiFi gadgets using esp8266Build WiFi gadgets using esp8266
Build WiFi gadgets using esp8266
 
Microcontroller arduino uno board
Microcontroller arduino uno boardMicrocontroller arduino uno board
Microcontroller arduino uno board
 
arduino
 arduino arduino
arduino
 
Republic of IoT 2018 - ESPectro32 and NB-IoT Workshop
Republic of IoT 2018 - ESPectro32 and NB-IoT WorkshopRepublic of IoT 2018 - ESPectro32 and NB-IoT Workshop
Republic of IoT 2018 - ESPectro32 and NB-IoT Workshop
 
Elektor 0304-2020
Elektor 0304-2020Elektor 0304-2020
Elektor 0304-2020
 
Esp32 cam arduino-123
Esp32 cam arduino-123Esp32 cam arduino-123
Esp32 cam arduino-123
 
WHD global 2017 - Smart Power Plant
WHD global 2017 - Smart Power PlantWHD global 2017 - Smart Power Plant
WHD global 2017 - Smart Power Plant
 
Espressif Introduction
Espressif IntroductionEspressif Introduction
Espressif Introduction
 
Programming The Real World
Programming The Real WorldProgramming The Real World
Programming The Real World
 
Lego pres 10
Lego pres 10Lego pres 10
Lego pres 10
 
Open Sound Control as Middleware for Games Accessibility and Body-movement Co...
Open Sound Control as Middleware for Games Accessibility and Body-movement Co...Open Sound Control as Middleware for Games Accessibility and Body-movement Co...
Open Sound Control as Middleware for Games Accessibility and Body-movement Co...
 
Issnip Presentation
Issnip PresentationIssnip Presentation
Issnip Presentation
 
Project_report_on_Attendance_system
 Project_report_on_Attendance_system Project_report_on_Attendance_system
Project_report_on_Attendance_system
 
Arduino day
Arduino dayArduino day
Arduino day
 

Similar to Introducing the Sun SPOTs

Sun Spot Talk
Sun Spot TalkSun Spot Talk
Sun Spot Talk
vittalp88
 
Android Things in action
Android Things in actionAndroid Things in action
Android Things in action
Stefano Sanna
 
Intel galileo gen 2
Intel galileo gen 2Intel galileo gen 2
Intel galileo gen 2
srknec
 
Introduction to FreeRTOS
Introduction to FreeRTOSIntroduction to FreeRTOS
Introduction to FreeRTOS
ICS
 
Iot for smart agriculture
Iot for smart agricultureIot for smart agriculture
Iot for smart agriculture
Atit Patumvan
 
20081114 Friday Food iLabt Bart Joris
20081114 Friday Food iLabt Bart Joris20081114 Friday Food iLabt Bart Joris
20081114 Friday Food iLabt Bart Jorisimec.archive
 
Bidirect visitor counter
Bidirect visitor counterBidirect visitor counter
Bidirect visitor counter
Electric&elctronics&engineeering
 
Eclipse Edje: A Java API for Microcontrollers
Eclipse Edje: A Java API for MicrocontrollersEclipse Edje: A Java API for Microcontrollers
Eclipse Edje: A Java API for Microcontrollers
MicroEJ
 
Embedded Systems
Embedded SystemsEmbedded Systems
Embedded Systems
Mohd Shahrukh
 
Eclipse NeoSCADA 0.3
Eclipse NeoSCADA 0.3Eclipse NeoSCADA 0.3
Eclipse NeoSCADA 0.3
Jürgen Rose
 
IoT on Raspberry Pi
IoT on Raspberry PiIoT on Raspberry Pi
IoT on Raspberry Pi
John Staveley
 
"JavaME + Android in action" CCT-CEJUG Dezembro 2008
"JavaME + Android in action" CCT-CEJUG Dezembro 2008"JavaME + Android in action" CCT-CEJUG Dezembro 2008
"JavaME + Android in action" CCT-CEJUG Dezembro 2008
Vando Batista
 
IoTivity Tutorial: Prototyping IoT Devices on GNU/Linux
IoTivity Tutorial: Prototyping IoT Devices on GNU/LinuxIoTivity Tutorial: Prototyping IoT Devices on GNU/Linux
IoTivity Tutorial: Prototyping IoT Devices on GNU/Linux
Samsung Open Source Group
 
Rohan Narula_Resume
Rohan Narula_ResumeRohan Narula_Resume
Rohan Narula_Resume
Rohan Narula
 
IoT: From Arduino Microcontrollers to Tizen Products using IoTivity
IoT: From Arduino Microcontrollers to Tizen Products using IoTivityIoT: From Arduino Microcontrollers to Tizen Products using IoTivity
IoT: From Arduino Microcontrollers to Tizen Products using IoTivity
Samsung Open Source Group
 
IoT: From Arduino MicroControllers to Tizen Products Using IoTivity - Philipp...
IoT: From Arduino MicroControllers to Tizen Products Using IoTivity - Philipp...IoT: From Arduino MicroControllers to Tizen Products Using IoTivity - Philipp...
IoT: From Arduino MicroControllers to Tizen Products Using IoTivity - Philipp...
WithTheBest
 
Lab Handson: Power your Creations with Intel Edison!
Lab Handson: Power your Creations with Intel Edison!Lab Handson: Power your Creations with Intel Edison!
Lab Handson: Power your Creations with Intel Edison!
Codemotion
 
Developing a NodeBot using Intel XDK IoT Edition
Developing a NodeBot using Intel XDK IoT EditionDeveloping a NodeBot using Intel XDK IoT Edition
Developing a NodeBot using Intel XDK IoT Edition
Intel® Software
 
Introduction of Arduino Uno
Introduction of Arduino UnoIntroduction of Arduino Uno
Introduction of Arduino Uno
Md. Nahidul Islam
 

Similar to Introducing the Sun SPOTs (20)

Sun Spot Talk
Sun Spot TalkSun Spot Talk
Sun Spot Talk
 
Android Things in action
Android Things in actionAndroid Things in action
Android Things in action
 
Intel galileo gen 2
Intel galileo gen 2Intel galileo gen 2
Intel galileo gen 2
 
Introduction to FreeRTOS
Introduction to FreeRTOSIntroduction to FreeRTOS
Introduction to FreeRTOS
 
Iot for smart agriculture
Iot for smart agricultureIot for smart agriculture
Iot for smart agriculture
 
20081114 Friday Food iLabt Bart Joris
20081114 Friday Food iLabt Bart Joris20081114 Friday Food iLabt Bart Joris
20081114 Friday Food iLabt Bart Joris
 
Bidirect visitor counter
Bidirect visitor counterBidirect visitor counter
Bidirect visitor counter
 
CV_Arshad_21June16
CV_Arshad_21June16CV_Arshad_21June16
CV_Arshad_21June16
 
Eclipse Edje: A Java API for Microcontrollers
Eclipse Edje: A Java API for MicrocontrollersEclipse Edje: A Java API for Microcontrollers
Eclipse Edje: A Java API for Microcontrollers
 
Embedded Systems
Embedded SystemsEmbedded Systems
Embedded Systems
 
Eclipse NeoSCADA 0.3
Eclipse NeoSCADA 0.3Eclipse NeoSCADA 0.3
Eclipse NeoSCADA 0.3
 
IoT on Raspberry Pi
IoT on Raspberry PiIoT on Raspberry Pi
IoT on Raspberry Pi
 
"JavaME + Android in action" CCT-CEJUG Dezembro 2008
"JavaME + Android in action" CCT-CEJUG Dezembro 2008"JavaME + Android in action" CCT-CEJUG Dezembro 2008
"JavaME + Android in action" CCT-CEJUG Dezembro 2008
 
IoTivity Tutorial: Prototyping IoT Devices on GNU/Linux
IoTivity Tutorial: Prototyping IoT Devices on GNU/LinuxIoTivity Tutorial: Prototyping IoT Devices on GNU/Linux
IoTivity Tutorial: Prototyping IoT Devices on GNU/Linux
 
Rohan Narula_Resume
Rohan Narula_ResumeRohan Narula_Resume
Rohan Narula_Resume
 
IoT: From Arduino Microcontrollers to Tizen Products using IoTivity
IoT: From Arduino Microcontrollers to Tizen Products using IoTivityIoT: From Arduino Microcontrollers to Tizen Products using IoTivity
IoT: From Arduino Microcontrollers to Tizen Products using IoTivity
 
IoT: From Arduino MicroControllers to Tizen Products Using IoTivity - Philipp...
IoT: From Arduino MicroControllers to Tizen Products Using IoTivity - Philipp...IoT: From Arduino MicroControllers to Tizen Products Using IoTivity - Philipp...
IoT: From Arduino MicroControllers to Tizen Products Using IoTivity - Philipp...
 
Lab Handson: Power your Creations with Intel Edison!
Lab Handson: Power your Creations with Intel Edison!Lab Handson: Power your Creations with Intel Edison!
Lab Handson: Power your Creations with Intel Edison!
 
Developing a NodeBot using Intel XDK IoT Edition
Developing a NodeBot using Intel XDK IoT EditionDeveloping a NodeBot using Intel XDK IoT Edition
Developing a NodeBot using Intel XDK IoT Edition
 
Introduction of Arduino Uno
Introduction of Arduino UnoIntroduction of Arduino Uno
Introduction of Arduino Uno
 

More from Stefano Sanna

Mobile Security su Android - LinuxDay 2018
Mobile Security su Android - LinuxDay 2018Mobile Security su Android - LinuxDay 2018
Mobile Security su Android - LinuxDay 2018
Stefano Sanna
 
Android Things, from mobile apps to physical world
Android Things, from mobile apps to physical worldAndroid Things, from mobile apps to physical world
Android Things, from mobile apps to physical world
Stefano Sanna
 
Android Things Linux Day 2017
Android Things Linux Day 2017 Android Things Linux Day 2017
Android Things Linux Day 2017
Stefano Sanna
 
Introduzione alla tecnologia iBeacon
Introduzione alla tecnologia iBeaconIntroduzione alla tecnologia iBeacon
Introduzione alla tecnologia iBeacon
Stefano Sanna
 
Augmented Smartphone
Augmented SmartphoneAugmented Smartphone
Augmented Smartphone
Stefano Sanna
 
Bluetooth Low Energy
Bluetooth Low EnergyBluetooth Low Energy
Bluetooth Low Energy
Stefano Sanna
 
Google TV: la nuova frontiera Android
Google TV: la nuova frontiera AndroidGoogle TV: la nuova frontiera Android
Google TV: la nuova frontiera Android
Stefano Sanna
 
Enlarge your screen: introducing the Google TV
Enlarge your screen: introducing the Google TVEnlarge your screen: introducing the Google TV
Enlarge your screen: introducing the Google TV
Stefano Sanna
 
Introduzione ad NFC
Introduzione ad NFCIntroduzione ad NFC
Introduzione ad NFC
Stefano Sanna
 
NFC: tecnologia e applicazioni
NFC: tecnologia e applicazioniNFC: tecnologia e applicazioni
NFC: tecnologia e applicazioniStefano Sanna
 
Android - Programmazione Avanzata
Android -  Programmazione AvanzataAndroid -  Programmazione Avanzata
Android - Programmazione Avanzata
Stefano Sanna
 
HCIM08 - Mobile Applications
HCIM08 - Mobile ApplicationsHCIM08 - Mobile Applications
HCIM08 - Mobile Applications
Stefano Sanna
 
Android & Bluetooth: hacking e applicazioni
Android & Bluetooth: hacking e applicazioniAndroid & Bluetooth: hacking e applicazioni
Android & Bluetooth: hacking e applicazioni
Stefano Sanna
 
Application Store: opportunita' e trappole
Application Store: opportunita' e trappoleApplication Store: opportunita' e trappole
Application Store: opportunita' e trappole
Stefano Sanna
 
Android Bluetooth Hacking
Android Bluetooth HackingAndroid Bluetooth Hacking
Android Bluetooth Hacking
Stefano Sanna
 
Android
AndroidAndroid
Android
Stefano Sanna
 
Free Software e Open Hardware
Free Software e Open HardwareFree Software e Open Hardware
Free Software e Open Hardware
Stefano Sanna
 
Playing with Mobile 2.0
Playing with Mobile 2.0Playing with Mobile 2.0
Playing with Mobile 2.0
Stefano Sanna
 
Sun SPOT
Sun SPOTSun SPOT
Sun SPOT
Stefano Sanna
 
Comunicazione Pervasiva
Comunicazione PervasivaComunicazione Pervasiva
Comunicazione PervasivaStefano Sanna
 

More from Stefano Sanna (20)

Mobile Security su Android - LinuxDay 2018
Mobile Security su Android - LinuxDay 2018Mobile Security su Android - LinuxDay 2018
Mobile Security su Android - LinuxDay 2018
 
Android Things, from mobile apps to physical world
Android Things, from mobile apps to physical worldAndroid Things, from mobile apps to physical world
Android Things, from mobile apps to physical world
 
Android Things Linux Day 2017
Android Things Linux Day 2017 Android Things Linux Day 2017
Android Things Linux Day 2017
 
Introduzione alla tecnologia iBeacon
Introduzione alla tecnologia iBeaconIntroduzione alla tecnologia iBeacon
Introduzione alla tecnologia iBeacon
 
Augmented Smartphone
Augmented SmartphoneAugmented Smartphone
Augmented Smartphone
 
Bluetooth Low Energy
Bluetooth Low EnergyBluetooth Low Energy
Bluetooth Low Energy
 
Google TV: la nuova frontiera Android
Google TV: la nuova frontiera AndroidGoogle TV: la nuova frontiera Android
Google TV: la nuova frontiera Android
 
Enlarge your screen: introducing the Google TV
Enlarge your screen: introducing the Google TVEnlarge your screen: introducing the Google TV
Enlarge your screen: introducing the Google TV
 
Introduzione ad NFC
Introduzione ad NFCIntroduzione ad NFC
Introduzione ad NFC
 
NFC: tecnologia e applicazioni
NFC: tecnologia e applicazioniNFC: tecnologia e applicazioni
NFC: tecnologia e applicazioni
 
Android - Programmazione Avanzata
Android -  Programmazione AvanzataAndroid -  Programmazione Avanzata
Android - Programmazione Avanzata
 
HCIM08 - Mobile Applications
HCIM08 - Mobile ApplicationsHCIM08 - Mobile Applications
HCIM08 - Mobile Applications
 
Android & Bluetooth: hacking e applicazioni
Android & Bluetooth: hacking e applicazioniAndroid & Bluetooth: hacking e applicazioni
Android & Bluetooth: hacking e applicazioni
 
Application Store: opportunita' e trappole
Application Store: opportunita' e trappoleApplication Store: opportunita' e trappole
Application Store: opportunita' e trappole
 
Android Bluetooth Hacking
Android Bluetooth HackingAndroid Bluetooth Hacking
Android Bluetooth Hacking
 
Android
AndroidAndroid
Android
 
Free Software e Open Hardware
Free Software e Open HardwareFree Software e Open Hardware
Free Software e Open Hardware
 
Playing with Mobile 2.0
Playing with Mobile 2.0Playing with Mobile 2.0
Playing with Mobile 2.0
 
Sun SPOT
Sun SPOTSun SPOT
Sun SPOT
 
Comunicazione Pervasiva
Comunicazione PervasivaComunicazione Pervasiva
Comunicazione Pervasiva
 

Recently uploaded

Essentials of Automations: The Art of Triggers and Actions in FME
Essentials of Automations: The Art of Triggers and Actions in FMEEssentials of Automations: The Art of Triggers and Actions in FME
Essentials of Automations: The Art of Triggers and Actions in FME
Safe Software
 
Epistemic Interaction - tuning interfaces to provide information for AI support
Epistemic Interaction - tuning interfaces to provide information for AI supportEpistemic Interaction - tuning interfaces to provide information for AI support
Epistemic Interaction - tuning interfaces to provide information for AI support
Alan Dix
 
20240605 QFM017 Machine Intelligence Reading List May 2024
20240605 QFM017 Machine Intelligence Reading List May 202420240605 QFM017 Machine Intelligence Reading List May 2024
20240605 QFM017 Machine Intelligence Reading List May 2024
Matthew Sinclair
 
GraphSummit Singapore | The Future of Agility: Supercharging Digital Transfor...
GraphSummit Singapore | The Future of Agility: Supercharging Digital Transfor...GraphSummit Singapore | The Future of Agility: Supercharging Digital Transfor...
GraphSummit Singapore | The Future of Agility: Supercharging Digital Transfor...
Neo4j
 
Securing your Kubernetes cluster_ a step-by-step guide to success !
Securing your Kubernetes cluster_ a step-by-step guide to success !Securing your Kubernetes cluster_ a step-by-step guide to success !
Securing your Kubernetes cluster_ a step-by-step guide to success !
KatiaHIMEUR1
 
Video Streaming: Then, Now, and in the Future
Video Streaming: Then, Now, and in the FutureVideo Streaming: Then, Now, and in the Future
Video Streaming: Then, Now, and in the Future
Alpen-Adria-Universität
 
Why You Should Replace Windows 11 with Nitrux Linux 3.5.0 for enhanced perfor...
Why You Should Replace Windows 11 with Nitrux Linux 3.5.0 for enhanced perfor...Why You Should Replace Windows 11 with Nitrux Linux 3.5.0 for enhanced perfor...
Why You Should Replace Windows 11 with Nitrux Linux 3.5.0 for enhanced perfor...
SOFTTECHHUB
 
Pushing the limits of ePRTC: 100ns holdover for 100 days
Pushing the limits of ePRTC: 100ns holdover for 100 daysPushing the limits of ePRTC: 100ns holdover for 100 days
Pushing the limits of ePRTC: 100ns holdover for 100 days
Adtran
 
RESUME BUILDER APPLICATION Project for students
RESUME BUILDER APPLICATION Project for studentsRESUME BUILDER APPLICATION Project for students
RESUME BUILDER APPLICATION Project for students
KAMESHS29
 
LF Energy Webinar: Electrical Grid Modelling and Simulation Through PowSyBl -...
LF Energy Webinar: Electrical Grid Modelling and Simulation Through PowSyBl -...LF Energy Webinar: Electrical Grid Modelling and Simulation Through PowSyBl -...
LF Energy Webinar: Electrical Grid Modelling and Simulation Through PowSyBl -...
DanBrown980551
 
20240607 QFM018 Elixir Reading List May 2024
20240607 QFM018 Elixir Reading List May 202420240607 QFM018 Elixir Reading List May 2024
20240607 QFM018 Elixir Reading List May 2024
Matthew Sinclair
 
FIDO Alliance Osaka Seminar: The WebAuthn API and Discoverable Credentials.pdf
FIDO Alliance Osaka Seminar: The WebAuthn API and Discoverable Credentials.pdfFIDO Alliance Osaka Seminar: The WebAuthn API and Discoverable Credentials.pdf
FIDO Alliance Osaka Seminar: The WebAuthn API and Discoverable Credentials.pdf
FIDO Alliance
 
GraphSummit Singapore | The Art of the Possible with Graph - Q2 2024
GraphSummit Singapore | The Art of the  Possible with Graph - Q2 2024GraphSummit Singapore | The Art of the  Possible with Graph - Q2 2024
GraphSummit Singapore | The Art of the Possible with Graph - Q2 2024
Neo4j
 
GraphRAG is All You need? LLM & Knowledge Graph
GraphRAG is All You need? LLM & Knowledge GraphGraphRAG is All You need? LLM & Knowledge Graph
GraphRAG is All You need? LLM & Knowledge Graph
Guy Korland
 
Alt. GDG Cloud Southlake #33: Boule & Rebala: Effective AppSec in SDLC using ...
Alt. GDG Cloud Southlake #33: Boule & Rebala: Effective AppSec in SDLC using ...Alt. GDG Cloud Southlake #33: Boule & Rebala: Effective AppSec in SDLC using ...
Alt. GDG Cloud Southlake #33: Boule & Rebala: Effective AppSec in SDLC using ...
James Anderson
 
Microsoft - Power Platform_G.Aspiotis.pdf
Microsoft - Power Platform_G.Aspiotis.pdfMicrosoft - Power Platform_G.Aspiotis.pdf
Microsoft - Power Platform_G.Aspiotis.pdf
Uni Systems S.M.S.A.
 
Elizabeth Buie - Older adults: Are we really designing for our future selves?
Elizabeth Buie - Older adults: Are we really designing for our future selves?Elizabeth Buie - Older adults: Are we really designing for our future selves?
Elizabeth Buie - Older adults: Are we really designing for our future selves?
Nexer Digital
 
Enchancing adoption of Open Source Libraries. A case study on Albumentations.AI
Enchancing adoption of Open Source Libraries. A case study on Albumentations.AIEnchancing adoption of Open Source Libraries. A case study on Albumentations.AI
Enchancing adoption of Open Source Libraries. A case study on Albumentations.AI
Vladimir Iglovikov, Ph.D.
 
PCI PIN Basics Webinar from the Controlcase Team
PCI PIN Basics Webinar from the Controlcase TeamPCI PIN Basics Webinar from the Controlcase Team
PCI PIN Basics Webinar from the Controlcase Team
ControlCase
 
Removing Uninteresting Bytes in Software Fuzzing
Removing Uninteresting Bytes in Software FuzzingRemoving Uninteresting Bytes in Software Fuzzing
Removing Uninteresting Bytes in Software Fuzzing
Aftab Hussain
 

Recently uploaded (20)

Essentials of Automations: The Art of Triggers and Actions in FME
Essentials of Automations: The Art of Triggers and Actions in FMEEssentials of Automations: The Art of Triggers and Actions in FME
Essentials of Automations: The Art of Triggers and Actions in FME
 
Epistemic Interaction - tuning interfaces to provide information for AI support
Epistemic Interaction - tuning interfaces to provide information for AI supportEpistemic Interaction - tuning interfaces to provide information for AI support
Epistemic Interaction - tuning interfaces to provide information for AI support
 
20240605 QFM017 Machine Intelligence Reading List May 2024
20240605 QFM017 Machine Intelligence Reading List May 202420240605 QFM017 Machine Intelligence Reading List May 2024
20240605 QFM017 Machine Intelligence Reading List May 2024
 
GraphSummit Singapore | The Future of Agility: Supercharging Digital Transfor...
GraphSummit Singapore | The Future of Agility: Supercharging Digital Transfor...GraphSummit Singapore | The Future of Agility: Supercharging Digital Transfor...
GraphSummit Singapore | The Future of Agility: Supercharging Digital Transfor...
 
Securing your Kubernetes cluster_ a step-by-step guide to success !
Securing your Kubernetes cluster_ a step-by-step guide to success !Securing your Kubernetes cluster_ a step-by-step guide to success !
Securing your Kubernetes cluster_ a step-by-step guide to success !
 
Video Streaming: Then, Now, and in the Future
Video Streaming: Then, Now, and in the FutureVideo Streaming: Then, Now, and in the Future
Video Streaming: Then, Now, and in the Future
 
Why You Should Replace Windows 11 with Nitrux Linux 3.5.0 for enhanced perfor...
Why You Should Replace Windows 11 with Nitrux Linux 3.5.0 for enhanced perfor...Why You Should Replace Windows 11 with Nitrux Linux 3.5.0 for enhanced perfor...
Why You Should Replace Windows 11 with Nitrux Linux 3.5.0 for enhanced perfor...
 
Pushing the limits of ePRTC: 100ns holdover for 100 days
Pushing the limits of ePRTC: 100ns holdover for 100 daysPushing the limits of ePRTC: 100ns holdover for 100 days
Pushing the limits of ePRTC: 100ns holdover for 100 days
 
RESUME BUILDER APPLICATION Project for students
RESUME BUILDER APPLICATION Project for studentsRESUME BUILDER APPLICATION Project for students
RESUME BUILDER APPLICATION Project for students
 
LF Energy Webinar: Electrical Grid Modelling and Simulation Through PowSyBl -...
LF Energy Webinar: Electrical Grid Modelling and Simulation Through PowSyBl -...LF Energy Webinar: Electrical Grid Modelling and Simulation Through PowSyBl -...
LF Energy Webinar: Electrical Grid Modelling and Simulation Through PowSyBl -...
 
20240607 QFM018 Elixir Reading List May 2024
20240607 QFM018 Elixir Reading List May 202420240607 QFM018 Elixir Reading List May 2024
20240607 QFM018 Elixir Reading List May 2024
 
FIDO Alliance Osaka Seminar: The WebAuthn API and Discoverable Credentials.pdf
FIDO Alliance Osaka Seminar: The WebAuthn API and Discoverable Credentials.pdfFIDO Alliance Osaka Seminar: The WebAuthn API and Discoverable Credentials.pdf
FIDO Alliance Osaka Seminar: The WebAuthn API and Discoverable Credentials.pdf
 
GraphSummit Singapore | The Art of the Possible with Graph - Q2 2024
GraphSummit Singapore | The Art of the  Possible with Graph - Q2 2024GraphSummit Singapore | The Art of the  Possible with Graph - Q2 2024
GraphSummit Singapore | The Art of the Possible with Graph - Q2 2024
 
GraphRAG is All You need? LLM & Knowledge Graph
GraphRAG is All You need? LLM & Knowledge GraphGraphRAG is All You need? LLM & Knowledge Graph
GraphRAG is All You need? LLM & Knowledge Graph
 
Alt. GDG Cloud Southlake #33: Boule & Rebala: Effective AppSec in SDLC using ...
Alt. GDG Cloud Southlake #33: Boule & Rebala: Effective AppSec in SDLC using ...Alt. GDG Cloud Southlake #33: Boule & Rebala: Effective AppSec in SDLC using ...
Alt. GDG Cloud Southlake #33: Boule & Rebala: Effective AppSec in SDLC using ...
 
Microsoft - Power Platform_G.Aspiotis.pdf
Microsoft - Power Platform_G.Aspiotis.pdfMicrosoft - Power Platform_G.Aspiotis.pdf
Microsoft - Power Platform_G.Aspiotis.pdf
 
Elizabeth Buie - Older adults: Are we really designing for our future selves?
Elizabeth Buie - Older adults: Are we really designing for our future selves?Elizabeth Buie - Older adults: Are we really designing for our future selves?
Elizabeth Buie - Older adults: Are we really designing for our future selves?
 
Enchancing adoption of Open Source Libraries. A case study on Albumentations.AI
Enchancing adoption of Open Source Libraries. A case study on Albumentations.AIEnchancing adoption of Open Source Libraries. A case study on Albumentations.AI
Enchancing adoption of Open Source Libraries. A case study on Albumentations.AI
 
PCI PIN Basics Webinar from the Controlcase Team
PCI PIN Basics Webinar from the Controlcase TeamPCI PIN Basics Webinar from the Controlcase Team
PCI PIN Basics Webinar from the Controlcase Team
 
Removing Uninteresting Bytes in Software Fuzzing
Removing Uninteresting Bytes in Software FuzzingRemoving Uninteresting Bytes in Software Fuzzing
Removing Uninteresting Bytes in Software Fuzzing
 

Introducing the Sun SPOTs

  • 1. Introducing the Sun SPOTs Stefano Sanna Senior Developer JUG Sardegna ONLUS 1
  • 2. About Me • Senior developer @ beeweeb technologies • Technical writer @ DEV, Computer Programming, Java Journal... • Supporter @ JUG Sardegna, JMDF, JIA, GULCh • LEGO constructor since 1973... 2
  • 3. Java User Groups in Italy 3
  • 4. Program the (Real) World • Wireless sensor networks open new exciting scenarios: > pervasive monitoring of environment and structures > massive distributed intelligence > urban smart objects • Programmable Objects for Real World > connected: the Internet of Things > autonomous: local CPU, local memory, local code > environment-aware: sensors > safe and robust 4
  • 5. Sensors: New Frontier of Interaction • To be programmable and connected is not enough! • The ability to “perceive” the surroundings is the next interaction frontier for consumer and mobile devices • Gaming console, mobile phones, automotive appliances, embedded systems: any object is expected to “sense” and act according to physical quantity such as temperature, light, acceleration, position, humidity, proximity... 5
  • 6. Sensors in the Java ME World • Java ME is leading technology for mobile applications, ranging from cellular phones to embedded systems • A rich set of standard API enables multimedia capabilities, 2D and 3G graphics, local and remote connectivity, location, NFC... • The Java Community Process has published the Mobile Sensor API (JSR 256) for accessing devices such as accelerometers, thermometers, light sensor 6
  • 7. Introducing the Project Sun SPOTs Small Programmable Object Technology • Project from Sun Laboratories • Platform for intelligent wireless sensors network • Live-laboratory for implementing new computing scenarios: > The (Inter)net of Things > Program the world 7
  • 9. SPOTs Hardware • Processor Board > 180 MHz 32 bit ARM920T core 512K RAM/4M Flash > 2.4 GHz IEEE 802.15.4 radio with integrated antenna > USB interface > 3.7V rechargeable 720 mAh lithium-ion battery > 32 uA deep sleep mode 9
  • 10. SPOTs Hardware • Demo Sensor Board > 2G/6G 3-axis accelerometer > Temperature sensor > Light sensor > 8 tri-color LEDs > 6 analog inputs, 2 switches > 5 general purpose I/O pins > 4 high current output pins 10
  • 11. SPOTs Software • Squawk Virtual Machine > Fully capable J2ME CLDC 1.1 Java VM with OS functionality > VM executes directly out of flash memory > Device drivers written in Java > Automatic battery management 11
  • 12. Sun SPOT Java Development Kit 12
  • 13. Free-Range and Basestation • Sun SPOT Development Kit provides: > Two free-range SPOTs, equipped with Processor Board, radio interface, Demo Sensor and battery > One basestation SPOT, with Processor Board and radio interface > SDK for Windows, Mac OS X, Linux > USB cable 13
  • 14. Development • SDK comprises libraries and utilities for compiling and packaging bytecode, updating SPOTs firmware, running basestation applications • SDK is based on Ant tasks and can be integrated in any IDE, e.g. Netbeans • SPOTs support remote installation, execution and debugging of applications through wireless connection 14
  • 15. Applications • Sun SPOT Applications > Run on free-range SPOTs > CLDC 1.1 and IMP 1.0 application model > Full access to peripherals and demo board • Sun SPOT Host Applications > Run on a SPOT configured as basestation > Stand-alone application model > Simultaneous access to SPOT and JSE libraries 15
  • 16. Classes, Devices, Sensors, Interfaces • There are over 400 classes documented in the Sun SPOT javadoc: nearly three times the MIDP 2.0 specification! :-) • The Sun SPOT device library contains drivers and high-level classes to access physical interfaces and peripherals: > ILed > IlightSensor, IAccelerometer3D > IFlashMemoryDevice > IPowerController > IPWMOutput > IAT91_PIO, IAT91_IAC... 16
  • 17. Radio Communication • Sun SPOTs come with low-range IEEE 802.15.4 radio module • Communication API is based on Generic Connection Framework and provides: > RadioConnection (radio://) from stream-based communication > RadiogramConnection (radiogram://) for datagram based communication > basestation may act as proxy for HTTP connections 17
  • 18. Sun SPOTs Projects • Many projects based on Sun SPOTs have been published on the Web: just use your preferred search engine or video repository to find them! 18
  • 19. Mashing-up Hardware and Software • The Sun SPOTs let developers build their custom interfaces for virtually any kind of electronic peripheral: > sensors > motors > microcontrollers > radio equipment 19
  • 20. Be Careful with Solder... :-( • However, soldering and designing circuits and interfaces for physical components require some specific expertise • Wrong assembly or accidental short circuit may definitively damage your SPOTs and/or your peripherals • How can we exploit Sun SPOTs potential without setting-up a electronic lab? 20
  • 21. Fun for Everyone! :-) • Thanks to the basestation, we can use the PC as gateway to any resource such as USB devices, network hosts and Bluetooth peripherals • LEGO Mindstorms NXT kit provides: > Easy and flexible > 3 outputs > 4 inputs > Bluetooth and USB interfaces > Open source iCommand Java library provides easy and powerful API for remote NXT control 21
  • 22. “Real” Gesture Controller for Vehicle USB 802.15.4 radio Bluetooth 22
  • 23. Overview • The Gesture Controller > Runs on a free-range SPOT > Reads tilt degrees on X and Y axes > Sends message to Vehicle Controller • The Vehicle Controller > Runs on the basestation > Receives messages from Gesture Controller > Sends commands to NXT Vehicle 23
  • 24. The Gesture Controller (source.1) public class SunSpotApplication extends MIDlet { private IAccelerometer3D accelerometer = EDemoBoard.getInstance().getAccelerometer(); private ISwitch switch1; private int st=0; private RadiogramConnection conn; protected void startApp() throws MIDletStateChangeException{ switch1 = EDemoBoard.getInstance().getSwitches()[0]; runSwitchWatcher(); } 24
  • 25. The Gesture Controller (source.2) protected void pauseApp() { // This will never be called by the Squawk VM } protected void destroyApp(boolean arg0) throws MIDletStateChangeException { } 25
  • 26. The Gesture Controller (source.3) private void runSwitchWatcher(){ Thread t1 = new Thread(){ public void run(){ sw1.waitForChange(); if (conn == null) { try { conn = (RadiogramConnection) Connector.open(quot;radiogram://broadcast:133quot;); startAccelerometerWatcher(); } catch (Exception e) { } } } }; t1.start(); } 26
  • 27. The Gesture Controller (source.4) public void startAcceWatchThreadd(){ Thread t2 = new Thread() { public void run() { while(true){ readTildAndSend(); } } }; t2.start(); } 27
  • 28. The Gesture Controller (source.5) private void readTiltAndSend() { try { int tiltX = (int) Math.toDegrees(acc.getTiltX()); int tiltY = (int) Math.toDegrees(acc.getTiltY()); String data = Integer.toString(tiltX) + quot;#quot; + Integer.toString(tiltY); send(data); } catch (IOException ex) { } try { Thread.sleep(100); } catch (InterruptedException ex) { } } 28
  • 29. The Gesture Controller (source.6) private synchronized void send(String data) { if (conn != null) { try{ Datagram datagram = conn.newDatagram(conn.getMaximumLength()); datagram.writeUTF(data); conn.send(datagram); } catch(IOException e){ } } } } 29
  • 30. The Vehicle Controller (source.1) public class SunSpotHostApplication { private static final int FORWARD = 0; private static final int BACKWARD = 1; private static final int RIGHT = 2; private static final int LEFT = 3; private static final int STOP = 4; private int last = STOP; private static Pilot pilot; // iCommand Java NXT Library public static void main(String[] args) { SunSpotHostApplication app = new SunSpotHostApplication(); startNXT(); app.start(); } 30
  • 31. The Vehicle Controller (source.2) private static void startNXT() { try { NXTCommand.open(); pilot = new Pilot(2.1f,4.4f,Motor.A, Motor.C,true); } catch(Exception e) { e.printStackTrace(); } } 31
  • 32. The Vehicle Controller (source.3) public void run() { try{ RadiogramConnection conn = (RadiogramConnection) Connector.open(quot;radiogram://:133quot;); Datagram datagram = conn.newDatagram(conn.getMaximumLength()); while(true){ datagram.reset(); conn.receive(datagram); String rawData = datagram.readUTF(); String[] tokens = rawData.split(quot;#quot;); moveVehicle(tokens[0], tokens[1]); } }catch(IOException e){ e.printStackTrace(); } } 32
  • 33. The Vehicle Controller (source.4) private void moveVehicle(String accelX, String accelY) { int tiltX = (int) Double.parseDouble(accelX); int tiltY = (int) Double.parseDouble(accelY); if (tiltY > 15) { if (last != BACKWARD) { pilot.backward(); last = BACKWARD; } } else if (tiltY < -15) { if (last != FORWARD) { pilot.forward(); last = FORWARD; } } 33
  • 34. The Vehicle Controller (source.5) else if (tiltX < -25) { if (last != RIGHT) { pilot.rotate(30); last = RIGHT; } } else if (tiltX > 25) { if (last != LEFT) { pilot.rotate(-30); last = LEFT; } } else { if (last != STOP) { pilot.stop(); last = STOP; } 34
  • 35. DEMO (Murphy Law loading... please wait...) 35
  • 36. Conclusions • Sensors are the new frontier of interaction • The Sun SPOTs are the quot;cool Java wayquot; to create a quot;live labquot; for innovative scenarios of ubiquitous and pervasive computing • Extended class library and full integration of basestation with desktop PC gives everybody the opportunity to HAVE FUN with SPOT 36
  • 37. References • Sun SPOT World > http://www.sunspotworld.com • Sun SPOTs and Java robotics on java.net > https://sunspot-robotics.dev.java.net/ > http://community.java.net/robotics/ • Sun SPOT purchasing: > http://www.sunspotworld.com/products > http://store.systronix.com • LEGO Mindstorms NXT > http://mindstorms.lego.com > http://lejos.sourceforge.net 37
  • 38. Contacts • Stefano Sanna > gerdavax@tiscali.it – http://www.gerdavax.it • JUG Sardegna ONLUS > http://www.jugsardegna.org • Java Mobile Developers Forum > http://www.jmdf.org 38
  • 39. Introducing the Sun SPOTs Stefano Sanna Senior Developer JUG Sardegna ONLUS 39