SlideShare una empresa de Scribd logo
1 de 28
RCDroid
Robot Controller With Android
          Phone          IT 52 - 11
AGENDA
•   Part 0 : Overview
•   Part 1 : API
•   Part 2 : Android application
•   Part 3 : RCDroid circuit
•   Part 4 : Show off




                       IT 52-11    2
Part 0 : Overview




       IT 52-11     3
Command between server to
            mobile
•   DEV:65 12 0
•   DEV:21 200 0
•   DDS:65 12
•   REQGPS
•   SON:1
•   SOFF:2



                   IT 52-11     4
Command signal From Mobile to
      Microcontroller




            IT 52-11            5
Part 1 : API - How to use
•   initialize server
•   Waiting for client
•   initialize device
•   control device
•   receive data from mobile phone




                     IT 52-11        6
initialize server

       Service
       Request


  Server
 Container

      Ready

      IT 52-11      7
Waiting for client

 Server
Container




                    Container

  Client
Connection




              IT 52-11          8
initialize device
Create
Device
Object


         Register to
         container


                       Set Default   • OPTIONNAL
                         State

                IT 52-11                           9
control device



Just simply call the
      method
  It’s easy, Isn’t It?
          IT 52-11       10
receive data from mobile phone

                           REGISTER
• Sensor                    Listener
  Listener                                  • onSensorChange
• Battery          • registerSensorListe    • onLocationChange
  Listener           ner                    • onGetNewVideoFr
• Disconnect       • registerLocationList     ame
  Listener           ener                   • batteryChanged
• Location
    Implements     • registerVideoListen    • onClientDisconnect
  Listener           er                       ed Waiting for
      Interface
• Video Listener   • setBatteryListener
                   • setOnDisconnectLi               Event
                     stener

                           IT 52-11                         11
Part 2 : Android application




            IT 52-11           12
Part 3 : RCDroid circuit




          IT 52-11         13
RCDroid
Part 4 : Let’s the Show begin!
RCDroid
The time for question
RCDroid
Thank you, see you again on d
             day
RCDroid
appendix
initialize service
ServiceRequests sr = new ServiceRequests();

sr.addRequest(ServiceRequests.USE_CAMERA);
sr.addRequest(ServiceRequests.USE_COMPASS);
sr.addRequest(ServiceRequests.USE_SENSOR_TYPE_ACCELEROMETER);
sr.addRequest(ServiceRequests.USE_SENSOR_TYPE_MAGNETIC_FIELD);

ServerContainer sc = new ServerContainer(8012, sr);




                            IT 52-11                      18
Waiting for client
Container container = sc.getContainer();




                       IT 52-11            19
initialize device
ServoMotor dv_wheel = new ServoMotor(PIC16F877A.PORTDB0);
SpeedControl dv_motor = new SpeedControl(PIC16F877A.PORTDB1);
SwitchControl light = new SwitchControl(PIC16F877A.PORTBB0);

container.registerDevice(dv_wheel);
container.registerDevice(dv_motor);
container.registerDevice(light);

dv_motor.setDefaultState(sm2.getPulseWidthBySpeed(0));
container.addDeviceDefaultState(dv_motor);




                          IT 52-11                       20
public class SwitchControl extends BaseDevice {
        public SwitchControl(int port) {
                super(port);
        }
        public void on(){
                pulseWidth = 200;
                execute();
        }
        public void off(){
                pulseWidth = 0;
                execute();
        }
        public void toggle(){
                if(pulseWidth == 200)
                        pulseWidth = 0;
                else
                        pulseWidth = 200;

              execute();

}
       }
                           initialize device Cont.
                             IT 52-11             21
control device
dv_wheel.setDegree(0);
dv_wheel.setDegree(90);
dv_wheel.setDegree(180);

dv_motor.setSpeed(0);
dv_motor.setSpeed(80);
dv_motor.setSpeed(-40);

light.on();
light.off();
light.toggle();




                           IT 52-11   22
receive data from mobile phone
           - Sensor
container.registerSensorListener(sensorListener);

container.sensorOn(ServiceRequests.USE_COMPASS);
container.sensorOn(ServiceRequests.USE_SENSOR_TYPE_MAGNETI
C_FIELD);
container.sensorOn(ServiceRequests.USE_SENSOR_TYPE_ACCELER
OMETER);

@Override
public void onSensorChange(SensorEvent e) {
     if (e.type == ServiceRequests.USE_COMPASS) {
         System.out.println(e.values[0]);
     }
}


                          IT 52-11                       23
receive data from mobile phone
           - Location
container.registerLocationListener(locationListener);



container.requestLocation();
container.requestLastKnownLocation();

@Override
    public void onLocationChange(LocationEvent e) {
       System.out.println(e.latitude+”:”+e.longitude);
    }




                          IT 52-11                       24
receive data from mobile phone
           - Camera
container.registerVideoListener(videoListener);

@Override
    public void onGetNewVideoFrame(VideoEvent e) {
       //you can get BufferedImage by use e.image
    }




                          IT 52-11                   25
receive data from mobile phone
           - Battery
container.setBatteryListener(this);



@Override
    public void phoneBatteryChanged(int level) {
       // percent unit
    }

   @Override
   public void batteryChanged(int level) {
      // maximum is 0 and minimum is 4.
   }




                          IT 52-11                 26
receive data from mobile phone -
             Disconnect
container.setOnDisconnectListener(DisconnectListener);

@Override
public void onClientDisconnected() {
       System.exit(0);
}




                          IT 52-11                       27
receive data from mobile phone –
             Capture Audio
- Capture microphone on Mobile to Server

container.captureAudio();
container.stopAudio();

- Capture microphone on Server to Mobile

Speaker sk = container.getSpeaker();
sk.startCapture();
sk.stopCapture();




                            IT 52-11       28

Más contenido relacionado

La actualidad más candente

TV Remote control Home Appliances using Arduino(Infrared)
TV Remote control Home Appliances using Arduino(Infrared)TV Remote control Home Appliances using Arduino(Infrared)
TV Remote control Home Appliances using Arduino(Infrared)sushil roy thalakayala
 
User Manual - Final Project 2015
User Manual - Final Project 2015User Manual - Final Project 2015
User Manual - Final Project 2015Chafic Bouchakra
 
Password based door lock system using 8051 microcontroller final report
Password based door lock system using 8051 microcontroller final reportPassword based door lock system using 8051 microcontroller final report
Password based door lock system using 8051 microcontroller final reportChinaraja Baratam
 
Attacking Industrial Remote Controllers (HITB AMS 2019)
Attacking Industrial Remote Controllers (HITB AMS 2019)Attacking Industrial Remote Controllers (HITB AMS 2019)
Attacking Industrial Remote Controllers (HITB AMS 2019)Marco Balduzzi
 
PARAMETER SENSING REMOTE OPERATED VIDEO ENHANCED RECEIVER
PARAMETER SENSING REMOTE OPERATED VIDEO ENHANCED RECEIVERPARAMETER SENSING REMOTE OPERATED VIDEO ENHANCED RECEIVER
PARAMETER SENSING REMOTE OPERATED VIDEO ENHANCED RECEIVERShaheem TM
 
CONTROLLING HOME APPLIANCES USING REMOTE(1)
CONTROLLING HOME APPLIANCES USING REMOTE(1)CONTROLLING HOME APPLIANCES USING REMOTE(1)
CONTROLLING HOME APPLIANCES USING REMOTE(1)Ambar Gupta
 
Remote control for home appliances
Remote control for home appliancesRemote control for home appliances
Remote control for home appliancesBharath University
 
MICROCONTROLLER BASED IR FOR HOME APPLICATION
MICROCONTROLLER BASED IR FOR HOME APPLICATIONMICROCONTROLLER BASED IR FOR HOME APPLICATION
MICROCONTROLLER BASED IR FOR HOME APPLICATIONJahir Hussain
 
Electronic code lock device
Electronic code lock deviceElectronic code lock device
Electronic code lock deviceAmitoj Kaur
 
TV Remote Operated Domestic Appliances Control
TV Remote Operated Domestic Appliances ControlTV Remote Operated Domestic Appliances Control
TV Remote Operated Domestic Appliances ControlEdgefxkits & Solutions
 
Controlling a home appliance using IR remote
Controlling a home appliance using IR remoteControlling a home appliance using IR remote
Controlling a home appliance using IR remoteChittaranjan Baliarsingh
 
Keysight Mini-ICT - Testing Days México
Keysight Mini-ICT - Testing Days MéxicoKeysight Mini-ICT - Testing Days México
Keysight Mini-ICT - Testing Days MéxicoInterlatin
 
Controlling home appliances using remote (2)
Controlling home appliances using remote (2)Controlling home appliances using remote (2)
Controlling home appliances using remote (2)K Vivek Varkey
 
5808spec
5808spec5808spec
5808specfredotm
 
Remote Controlled Home Appliance
Remote Controlled Home Appliance Remote Controlled Home Appliance
Remote Controlled Home Appliance Samir Ahmed Shimul
 
Allenbradley Micro logix 1400 Plc Hardware information Guide
Allenbradley Micro logix 1400 Plc Hardware information GuideAllenbradley Micro logix 1400 Plc Hardware information Guide
Allenbradley Micro logix 1400 Plc Hardware information GuideDEEPAK GORAI
 

La actualidad más candente (20)

TV Remote control Home Appliances using Arduino(Infrared)
TV Remote control Home Appliances using Arduino(Infrared)TV Remote control Home Appliances using Arduino(Infrared)
TV Remote control Home Appliances using Arduino(Infrared)
 
User Manual - Final Project 2015
User Manual - Final Project 2015User Manual - Final Project 2015
User Manual - Final Project 2015
 
LayerZero Series 70: eRPP-SL2 Slim Remote Power Panel
LayerZero Series 70: eRPP-SL2 Slim Remote Power PanelLayerZero Series 70: eRPP-SL2 Slim Remote Power Panel
LayerZero Series 70: eRPP-SL2 Slim Remote Power Panel
 
Password based door lock system using 8051 microcontroller final report
Password based door lock system using 8051 microcontroller final reportPassword based door lock system using 8051 microcontroller final report
Password based door lock system using 8051 microcontroller final report
 
Ae55 brochure
Ae55 brochureAe55 brochure
Ae55 brochure
 
Project ppt
Project pptProject ppt
Project ppt
 
Attacking Industrial Remote Controllers (HITB AMS 2019)
Attacking Industrial Remote Controllers (HITB AMS 2019)Attacking Industrial Remote Controllers (HITB AMS 2019)
Attacking Industrial Remote Controllers (HITB AMS 2019)
 
PARAMETER SENSING REMOTE OPERATED VIDEO ENHANCED RECEIVER
PARAMETER SENSING REMOTE OPERATED VIDEO ENHANCED RECEIVERPARAMETER SENSING REMOTE OPERATED VIDEO ENHANCED RECEIVER
PARAMETER SENSING REMOTE OPERATED VIDEO ENHANCED RECEIVER
 
CONTROLLING HOME APPLIANCES USING REMOTE(1)
CONTROLLING HOME APPLIANCES USING REMOTE(1)CONTROLLING HOME APPLIANCES USING REMOTE(1)
CONTROLLING HOME APPLIANCES USING REMOTE(1)
 
Remote control for home appliances
Remote control for home appliancesRemote control for home appliances
Remote control for home appliances
 
MICROCONTROLLER BASED IR FOR HOME APPLICATION
MICROCONTROLLER BASED IR FOR HOME APPLICATIONMICROCONTROLLER BASED IR FOR HOME APPLICATION
MICROCONTROLLER BASED IR FOR HOME APPLICATION
 
Electronic code lock device
Electronic code lock deviceElectronic code lock device
Electronic code lock device
 
TV Remote Operated Domestic Appliances Control
TV Remote Operated Domestic Appliances ControlTV Remote Operated Domestic Appliances Control
TV Remote Operated Domestic Appliances Control
 
Controlling a home appliance using IR remote
Controlling a home appliance using IR remoteControlling a home appliance using IR remote
Controlling a home appliance using IR remote
 
Keysight Mini-ICT - Testing Days México
Keysight Mini-ICT - Testing Days MéxicoKeysight Mini-ICT - Testing Days México
Keysight Mini-ICT - Testing Days México
 
Controlling home appliances using remote (2)
Controlling home appliances using remote (2)Controlling home appliances using remote (2)
Controlling home appliances using remote (2)
 
5808spec
5808spec5808spec
5808spec
 
Remote Controlled Home Appliance
Remote Controlled Home Appliance Remote Controlled Home Appliance
Remote Controlled Home Appliance
 
Allenbradley Micro logix 1400 Plc Hardware information Guide
Allenbradley Micro logix 1400 Plc Hardware information GuideAllenbradley Micro logix 1400 Plc Hardware information Guide
Allenbradley Micro logix 1400 Plc Hardware information Guide
 
Exit device-operators
Exit device-operatorsExit device-operators
Exit device-operators
 

Destacado

Hardware trends 2015
Hardware trends 2015Hardware trends 2015
Hardware trends 2015HAX
 
HAX at stanford
HAX at stanfordHAX at stanford
HAX at stanfordHAX
 
Types of production_in_delta_of_ebro
Types of production_in_delta_of_ebroTypes of production_in_delta_of_ebro
Types of production_in_delta_of_ebrowaterborneidentities
 
Hax Made with Shenzhen
Hax Made with ShenzhenHax Made with Shenzhen
Hax Made with ShenzhenHAX
 
Physical spaces bc
Physical spaces bcPhysical spaces bc
Physical spaces bcBCTLA
 
Historical portfolio - Vratsa , Bulgaria
Historical portfolio - Vratsa , BulgariaHistorical portfolio - Vratsa , Bulgaria
Historical portfolio - Vratsa , Bulgariawaterborneidentities
 
Market measurement
Market measurementMarket measurement
Market measurementpragna1510
 
Презентация компании СК ПНГ (сентябрь, 2012)
Презентация компании СК ПНГ (сентябрь, 2012)Презентация компании СК ПНГ (сентябрь, 2012)
Презентация компании СК ПНГ (сентябрь, 2012)png-service
 
Learning commons in bc c. koechlin for slide share
Learning commons in bc c. koechlin for slide shareLearning commons in bc c. koechlin for slide share
Learning commons in bc c. koechlin for slide shareBCTLA
 
How HARD can that be?
How HARD can that be?How HARD can that be?
How HARD can that be?HAX
 

Destacado (19)

Presentation1LF
Presentation1LFPresentation1LF
Presentation1LF
 
Hardware trends 2015
Hardware trends 2015Hardware trends 2015
Hardware trends 2015
 
Water sports in Bulgaria
Water sports in  BulgariaWater sports in  Bulgaria
Water sports in Bulgaria
 
HAX at stanford
HAX at stanfordHAX at stanford
HAX at stanford
 
Water sports in BULGARIA
Water sports in BULGARIAWater sports in BULGARIA
Water sports in BULGARIA
 
Literature project Bulgaria
Literature  project   BulgariaLiterature  project   Bulgaria
Literature project Bulgaria
 
Types of production_in_delta_of_ebro
Types of production_in_delta_of_ebroTypes of production_in_delta_of_ebro
Types of production_in_delta_of_ebro
 
Hax Made with Shenzhen
Hax Made with ShenzhenHax Made with Shenzhen
Hax Made with Shenzhen
 
Physical spaces bc
Physical spaces bcPhysical spaces bc
Physical spaces bc
 
Historical portfolio - Vratsa , Bulgaria
Historical portfolio - Vratsa , BulgariaHistorical portfolio - Vratsa , Bulgaria
Historical portfolio - Vratsa , Bulgaria
 
Market measurement
Market measurementMarket measurement
Market measurement
 
Bab 1 pp
Bab 1 ppBab 1 pp
Bab 1 pp
 
Bab 1 pp
Bab 1 ppBab 1 pp
Bab 1 pp
 
CERÁMICA INCA
CERÁMICA INCACERÁMICA INCA
CERÁMICA INCA
 
Bab 1 pp
Bab 1 ppBab 1 pp
Bab 1 pp
 
Bab 2 pp
Bab 2 ppBab 2 pp
Bab 2 pp
 
Презентация компании СК ПНГ (сентябрь, 2012)
Презентация компании СК ПНГ (сентябрь, 2012)Презентация компании СК ПНГ (сентябрь, 2012)
Презентация компании СК ПНГ (сентябрь, 2012)
 
Learning commons in bc c. koechlin for slide share
Learning commons in bc c. koechlin for slide shareLearning commons in bc c. koechlin for slide share
Learning commons in bc c. koechlin for slide share
 
How HARD can that be?
How HARD can that be?How HARD can that be?
How HARD can that be?
 

Similar a RCDroid - Presentation 3rd

Programmable command-line interface API for managing operation of a network d...
Programmable command-line interface API for managing operation of a network d...Programmable command-line interface API for managing operation of a network d...
Programmable command-line interface API for managing operation of a network d...Tal Lavian Ph.D.
 
Introducing the Sun SPOTs
Introducing the Sun SPOTsIntroducing the Sun SPOTs
Introducing the Sun SPOTsStefano Sanna
 
Introduction to Things board (An Open Source IoT Cloud Platform)
Introduction to Things board (An Open Source IoT Cloud Platform)Introduction to Things board (An Open Source IoT Cloud Platform)
Introduction to Things board (An Open Source IoT Cloud Platform)Amarjeetsingh Thakur
 
LG Developer Event 2013 in San Francisco
LG Developer Event 2013 in San FranciscoLG Developer Event 2013 in San Francisco
LG Developer Event 2013 in San FranciscoLGDeveloper
 
[HES2013] Hacking apple accessories to pown iDevices – Wake up Neo! Your phon...
[HES2013] Hacking apple accessories to pown iDevices – Wake up Neo! Your phon...[HES2013] Hacking apple accessories to pown iDevices – Wake up Neo! Your phon...
[HES2013] Hacking apple accessories to pown iDevices – Wake up Neo! Your phon...Hackito Ergo Sum
 
DETECTING POWER GRID SYNCHRONISATION FAILURE ON SENSING BAD VOLTAGE OR FREQUE...
DETECTING POWER GRID SYNCHRONISATION FAILURE ON SENSING BAD VOLTAGE OR FREQUE...DETECTING POWER GRID SYNCHRONISATION FAILURE ON SENSING BAD VOLTAGE OR FREQUE...
DETECTING POWER GRID SYNCHRONISATION FAILURE ON SENSING BAD VOLTAGE OR FREQUE...Pradeep Avanigadda
 
Labs_BT_20221017.pptx
Labs_BT_20221017.pptxLabs_BT_20221017.pptx
Labs_BT_20221017.pptxssuserb4d806
 
automation,vfd,plc,scada overview
automation,vfd,plc,scada overviewautomation,vfd,plc,scada overview
automation,vfd,plc,scada overviewpratikguptateddy
 
automation,vfd,plc,scada overview
automation,vfd,plc,scada overviewautomation,vfd,plc,scada overview
automation,vfd,plc,scada overviewPratik Gupta
 
universal remote controller for electric bulb and ceiling fan
universal remote controller for electric bulb and ceiling fanuniversal remote controller for electric bulb and ceiling fan
universal remote controller for electric bulb and ceiling fanOGAGA OTOBOR
 
HOME AUTOMATION USING ARDUINO
HOME AUTOMATION USING ARDUINOHOME AUTOMATION USING ARDUINO
HOME AUTOMATION USING ARDUINOEklavya Sharma
 
WSO2 IoT Server: Implementing Device Gateway Pattern using Android Device & XBee
WSO2 IoT Server: Implementing Device Gateway Pattern using Android Device & XBeeWSO2 IoT Server: Implementing Device Gateway Pattern using Android Device & XBee
WSO2 IoT Server: Implementing Device Gateway Pattern using Android Device & XBeeWSO2
 
Report on remote control home appliances.
Report on remote control home appliances.Report on remote control home appliances.
Report on remote control home appliances.Sonal Bansal
 
IoT on Raspberry PI v1.2
IoT on Raspberry PI v1.2IoT on Raspberry PI v1.2
IoT on Raspberry PI v1.2John Staveley
 
Remote home appliances
Remote home appliancesRemote home appliances
Remote home appliancesHamed Raza
 
eece237lab2EECE237Lab2.uvproj 1.1 ### uVision .docx
eece237lab2EECE237Lab2.uvproj    1.1   ### uVision .docxeece237lab2EECE237Lab2.uvproj    1.1   ### uVision .docx
eece237lab2EECE237Lab2.uvproj 1.1 ### uVision .docxSALU18
 

Similar a RCDroid - Presentation 3rd (20)

Programmable command-line interface API for managing operation of a network d...
Programmable command-line interface API for managing operation of a network d...Programmable command-line interface API for managing operation of a network d...
Programmable command-line interface API for managing operation of a network d...
 
Introducing the Sun SPOTs
Introducing the Sun SPOTsIntroducing the Sun SPOTs
Introducing the Sun SPOTs
 
Day 13.1 startingaswitch
Day 13.1 startingaswitchDay 13.1 startingaswitch
Day 13.1 startingaswitch
 
Introduction to Things board (An Open Source IoT Cloud Platform)
Introduction to Things board (An Open Source IoT Cloud Platform)Introduction to Things board (An Open Source IoT Cloud Platform)
Introduction to Things board (An Open Source IoT Cloud Platform)
 
LG Developer Event 2013 in San Francisco
LG Developer Event 2013 in San FranciscoLG Developer Event 2013 in San Francisco
LG Developer Event 2013 in San Francisco
 
[HES2013] Hacking apple accessories to pown iDevices – Wake up Neo! Your phon...
[HES2013] Hacking apple accessories to pown iDevices – Wake up Neo! Your phon...[HES2013] Hacking apple accessories to pown iDevices – Wake up Neo! Your phon...
[HES2013] Hacking apple accessories to pown iDevices – Wake up Neo! Your phon...
 
DETECTING POWER GRID SYNCHRONISATION FAILURE ON SENSING BAD VOLTAGE OR FREQUE...
DETECTING POWER GRID SYNCHRONISATION FAILURE ON SENSING BAD VOLTAGE OR FREQUE...DETECTING POWER GRID SYNCHRONISATION FAILURE ON SENSING BAD VOLTAGE OR FREQUE...
DETECTING POWER GRID SYNCHRONISATION FAILURE ON SENSING BAD VOLTAGE OR FREQUE...
 
Labs_BT_20221017.pptx
Labs_BT_20221017.pptxLabs_BT_20221017.pptx
Labs_BT_20221017.pptx
 
Vfd
VfdVfd
Vfd
 
automation,vfd,plc,scada overview
automation,vfd,plc,scada overviewautomation,vfd,plc,scada overview
automation,vfd,plc,scada overview
 
automation,vfd,plc,scada overview
automation,vfd,plc,scada overviewautomation,vfd,plc,scada overview
automation,vfd,plc,scada overview
 
universal remote controller for electric bulb and ceiling fan
universal remote controller for electric bulb and ceiling fanuniversal remote controller for electric bulb and ceiling fan
universal remote controller for electric bulb and ceiling fan
 
HOME AUTOMATION USING ARDUINO
HOME AUTOMATION USING ARDUINOHOME AUTOMATION USING ARDUINO
HOME AUTOMATION USING ARDUINO
 
WSO2 IoT Server: Implementing Device Gateway Pattern using Android Device & XBee
WSO2 IoT Server: Implementing Device Gateway Pattern using Android Device & XBeeWSO2 IoT Server: Implementing Device Gateway Pattern using Android Device & XBee
WSO2 IoT Server: Implementing Device Gateway Pattern using Android Device & XBee
 
Report on remote control home appliances.
Report on remote control home appliances.Report on remote control home appliances.
Report on remote control home appliances.
 
1. device onboarding pdf
1. device onboarding pdf1. device onboarding pdf
1. device onboarding pdf
 
IoT on Raspberry PI v1.2
IoT on Raspberry PI v1.2IoT on Raspberry PI v1.2
IoT on Raspberry PI v1.2
 
Remote home appliances
Remote home appliancesRemote home appliances
Remote home appliances
 
eece237lab2EECE237Lab2.uvproj 1.1 ### uVision .docx
eece237lab2EECE237Lab2.uvproj    1.1   ### uVision .docxeece237lab2EECE237Lab2.uvproj    1.1   ### uVision .docx
eece237lab2EECE237Lab2.uvproj 1.1 ### uVision .docx
 
1. device onboarding
1. device onboarding1. device onboarding
1. device onboarding
 

RCDroid - Presentation 3rd

  • 1. RCDroid Robot Controller With Android Phone IT 52 - 11
  • 2. AGENDA • Part 0 : Overview • Part 1 : API • Part 2 : Android application • Part 3 : RCDroid circuit • Part 4 : Show off IT 52-11 2
  • 3. Part 0 : Overview IT 52-11 3
  • 4. Command between server to mobile • DEV:65 12 0 • DEV:21 200 0 • DDS:65 12 • REQGPS • SON:1 • SOFF:2 IT 52-11 4
  • 5. Command signal From Mobile to Microcontroller IT 52-11 5
  • 6. Part 1 : API - How to use • initialize server • Waiting for client • initialize device • control device • receive data from mobile phone IT 52-11 6
  • 7. initialize server Service Request Server Container Ready IT 52-11 7
  • 8. Waiting for client Server Container Container Client Connection IT 52-11 8
  • 9. initialize device Create Device Object Register to container Set Default • OPTIONNAL State IT 52-11 9
  • 10. control device Just simply call the method It’s easy, Isn’t It? IT 52-11 10
  • 11. receive data from mobile phone REGISTER • Sensor Listener Listener • onSensorChange • Battery • registerSensorListe • onLocationChange Listener ner • onGetNewVideoFr • Disconnect • registerLocationList ame Listener ener • batteryChanged • Location Implements • registerVideoListen • onClientDisconnect Listener er ed Waiting for Interface • Video Listener • setBatteryListener • setOnDisconnectLi Event stener IT 52-11 11
  • 12. Part 2 : Android application IT 52-11 12
  • 13. Part 3 : RCDroid circuit IT 52-11 13
  • 14. RCDroid Part 4 : Let’s the Show begin!
  • 16. RCDroid Thank you, see you again on d day
  • 18. initialize service ServiceRequests sr = new ServiceRequests(); sr.addRequest(ServiceRequests.USE_CAMERA); sr.addRequest(ServiceRequests.USE_COMPASS); sr.addRequest(ServiceRequests.USE_SENSOR_TYPE_ACCELEROMETER); sr.addRequest(ServiceRequests.USE_SENSOR_TYPE_MAGNETIC_FIELD); ServerContainer sc = new ServerContainer(8012, sr); IT 52-11 18
  • 19. Waiting for client Container container = sc.getContainer(); IT 52-11 19
  • 20. initialize device ServoMotor dv_wheel = new ServoMotor(PIC16F877A.PORTDB0); SpeedControl dv_motor = new SpeedControl(PIC16F877A.PORTDB1); SwitchControl light = new SwitchControl(PIC16F877A.PORTBB0); container.registerDevice(dv_wheel); container.registerDevice(dv_motor); container.registerDevice(light); dv_motor.setDefaultState(sm2.getPulseWidthBySpeed(0)); container.addDeviceDefaultState(dv_motor); IT 52-11 20
  • 21. public class SwitchControl extends BaseDevice { public SwitchControl(int port) { super(port); } public void on(){ pulseWidth = 200; execute(); } public void off(){ pulseWidth = 0; execute(); } public void toggle(){ if(pulseWidth == 200) pulseWidth = 0; else pulseWidth = 200; execute(); } } initialize device Cont. IT 52-11 21
  • 23. receive data from mobile phone - Sensor container.registerSensorListener(sensorListener); container.sensorOn(ServiceRequests.USE_COMPASS); container.sensorOn(ServiceRequests.USE_SENSOR_TYPE_MAGNETI C_FIELD); container.sensorOn(ServiceRequests.USE_SENSOR_TYPE_ACCELER OMETER); @Override public void onSensorChange(SensorEvent e) { if (e.type == ServiceRequests.USE_COMPASS) { System.out.println(e.values[0]); } } IT 52-11 23
  • 24. receive data from mobile phone - Location container.registerLocationListener(locationListener); container.requestLocation(); container.requestLastKnownLocation(); @Override public void onLocationChange(LocationEvent e) { System.out.println(e.latitude+”:”+e.longitude); } IT 52-11 24
  • 25. receive data from mobile phone - Camera container.registerVideoListener(videoListener); @Override public void onGetNewVideoFrame(VideoEvent e) { //you can get BufferedImage by use e.image } IT 52-11 25
  • 26. receive data from mobile phone - Battery container.setBatteryListener(this); @Override public void phoneBatteryChanged(int level) { // percent unit } @Override public void batteryChanged(int level) { // maximum is 0 and minimum is 4. } IT 52-11 26
  • 27. receive data from mobile phone - Disconnect container.setOnDisconnectListener(DisconnectListener); @Override public void onClientDisconnected() { System.exit(0); } IT 52-11 27
  • 28. receive data from mobile phone – Capture Audio - Capture microphone on Mobile to Server container.captureAudio(); container.stopAudio(); - Capture microphone on Server to Mobile Speaker sk = container.getSpeaker(); sk.startCapture(); sk.stopCapture(); IT 52-11 28

Notas del editor

  1. Before server connected with client, you need to define what Service do you want. It has xx services such as Camera, blablabla.
  2. This method will wait client to connect server. After it’s connected ServerContainer will release Container object
  3. After it’s connected. Now, you need to be create the objects (that have the number of port on microcontroller) of any device and put the device to the container
  4. If you want to create your own device, you need to extends BaseDevice for example.You can control device by setting pulseWidth whatever you want and call execute() to activate it. In this example it’s a led light.