SlideShare ist ein Scribd-Unternehmen logo
1 von 39
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

Weitere ähnliche Inhalte

Was ist angesagt?

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
Alexandru IOVANOVICI
 
Programming The Real World
Programming The Real WorldProgramming The Real World
Programming The Real World
pauldeng
 
Issnip Presentation
Issnip PresentationIssnip Presentation
Issnip Presentation
pauldeng
 

Was ist angesagt? (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
 

Ähnlich wie Introducing the Sun SPOTs

20081114 Friday Food iLabt Bart Joris
20081114 Friday Food iLabt Bart Joris20081114 Friday Food iLabt Bart Joris
20081114 Friday Food iLabt Bart Joris
imec.archive
 
CV_Arshad_21June16
CV_Arshad_21June16CV_Arshad_21June16
CV_Arshad_21June16
Arshad Mohammad
 
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
 

Ähnlich wie 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
 

Mehr von Stefano Sanna

NFC: tecnologia e applicazioni
NFC: tecnologia e applicazioniNFC: tecnologia e applicazioni
NFC: tecnologia e applicazioni
Stefano Sanna
 
Comunicazione Pervasiva
Comunicazione PervasivaComunicazione Pervasiva
Comunicazione Pervasiva
Stefano Sanna
 

Mehr von 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
 

KĂźrzlich hochgeladen

Histor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slideHistor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slide
vu2urc
 
Artificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and MythsArtificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and Myths
Joaquim Jorge
 

KĂźrzlich hochgeladen (20)

Scaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organizationScaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organization
 
The Codex of Business Writing Software for Real-World Solutions 2.pptx
The Codex of Business Writing Software for Real-World Solutions 2.pptxThe Codex of Business Writing Software for Real-World Solutions 2.pptx
The Codex of Business Writing Software for Real-World Solutions 2.pptx
 
GenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day PresentationGenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day Presentation
 
08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking Men08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking Men
 
Histor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slideHistor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slide
 
What Are The Drone Anti-jamming Systems Technology?
What Are The Drone Anti-jamming Systems Technology?What Are The Drone Anti-jamming Systems Technology?
What Are The Drone Anti-jamming Systems Technology?
 
Artificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and MythsArtificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and Myths
 
🐬 The future of MySQL is Postgres 🐘
🐬  The future of MySQL is Postgres   🐘🐬  The future of MySQL is Postgres   🐘
🐬 The future of MySQL is Postgres 🐘
 
Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024
 
Driving Behavioral Change for Information Management through Data-Driven Gree...
Driving Behavioral Change for Information Management through Data-Driven Gree...Driving Behavioral Change for Information Management through Data-Driven Gree...
Driving Behavioral Change for Information Management through Data-Driven Gree...
 
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
 
A Year of the Servo Reboot: Where Are We Now?
A Year of the Servo Reboot: Where Are We Now?A Year of the Servo Reboot: Where Are We Now?
A Year of the Servo Reboot: Where Are We Now?
 
Powerful Google developer tools for immediate impact! (2023-24 C)
Powerful Google developer tools for immediate impact! (2023-24 C)Powerful Google developer tools for immediate impact! (2023-24 C)
Powerful Google developer tools for immediate impact! (2023-24 C)
 
From Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time AutomationFrom Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time Automation
 
Data Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt RobisonData Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt Robison
 
Boost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivityBoost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivity
 
The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024
 
2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...
 
Presentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreterPresentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreter
 
Real Time Object Detection Using Open CV
Real Time Object Detection Using Open CVReal Time Object Detection Using Open CV
Real Time Object Detection Using Open CV
 

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