android control hardware and arduino iot ( 22 aug 15 )
Post on 21-Apr-2017
4.883 Views
Preview:
TRANSCRIPT
22 Aug 2015
Android Control Hardware and Arduino IoTBy Soft Power Group http://softpowergroup.net/
Android Communication Hardware
➤ USB
➤ Bluetooth
➤ Wi-Fi
➤ NFC
➤ Telephone ( Voice or DTMF )
➤ SMS
Android Hardware
➤ TFT/OLED Display
➤ Touch Screen
➤ Camera
➤ Sensor
➤ Speaker
➤ Micro phone
➤ GPS
Android Hardware Workshop
➤ Android Device Info
Android Communication Hardware
➤ USB
➤ Bluetooth
➤ Wi-Fi
➤ NFC
20 Aug 2014
Arduino เชอมตอกบ Android ทาง USB
Arduino เชอมตอกบ Android ทาง USB
http://androidcontrol.blogspot.com/2014/06/arduino-usb-servo-motor-control.html
Arduino เชอมตอกบ Android ทาง USB
Arduino Firmata Libraryhttp://arduino.cc/en/Reference/Firmata
Download Firmata Test Programwww.firmata.org
Upload Firmata Sketch
Test Program
USB Workshop
- Arduino Firmata Library- Program Test on PC- Android USB OTG- Android Example Code- Android USB Control Relay Output
Arduino IDE Downloadhttps://www.arduino.cc/en/Main/Software
Arduino เชอมตอกบ Android ทาง USB
https://play.google.com/store/apps/details?id=arduino.control.servo
Arduino เชอมตอกบ Android ทาง USB
Bluetooth Module
Bluetooth
➤ เปดการใชงานบลทธ➤ คนหาอปกรณ จบค➤ เชอมตออปกรณ Connect
➤ รบ - สงขอมล
Bluetooth API
Bluetooth Adapter - คนหาอปกรณ จบคBluetooth Class - รายละเอยดหาอปกรณบลทธBluetooth Device - ท างานเชอมตออปกรณBluetooth Socket - จดการ รบสงขอมลBluetooth ServerSocket - เปดชองสญญานเพอตรวจจบอปกรณบลทธอนๆ
Arduino เชอมตอกบ Android ทาง Bluetooth
http://androidcontrol.blogspot.com/2014/06/arduino-control-rgb-leds-via-bluetooth.html
Arduino เชอมตอกบ Android ทาง Bluetooth
http://androidcontrol.blogspot.com/2014/06/arduino-control-rgb-leds-via-bluetooth.html
Bluetooth Workshop
- Bluetooth Control Output- Bluetooth Control RGB LEDs- Bluetooth Control Servo
Arduino เชอมตอกบ Android ทาง Bluetooth
https://play.google.com/store/apps/details?id=arduino.bluetooth.rgbleds
Arduino เชอมตอกบ Android ทาง Bluetooth
Ethernet & Wi-Fi Module
Arduino WebServer
การใชงาน Http Connection ( Android )
HttpURLConnection conn = null;
try {
conn = (HttpURLConnection)new URL("http://someurl").openConnection();
conn.setRequestMethod("GET");
conn.setInstanceFollowRedirects(true);
conn.setUseCaches(false);
int resCode = conn.getResponseCode();
if (resCode == HttpURLConnection.HTTP_OK) {
InputStream is = conn.getInputStream();
ByteArrayOutputStream bos =
new ByteArrayOutputStream();
int read = 0;
while ((read = is.read()) != -1) {
bos.write(read);
}
byte[] result = bos.toByteArray();
bos.close();
}
( code ตอหนา 2 )
else {
// do something
}
conn.disconnect();
}
catch (Exception e) {
// do something
}
Web Server Control
JSON and XML
ในการตดตอสอสารขอมลตางๆ ระหวาง Client – Server นนจ าเปนจะตองมภาษากลางทใชส าหรบพดคยหรอสงหากน
XML eXtensible Markup Language
<?xml version="1.0" encoding="UTF-8"?>
<note>
<to> Tove</to>
<from>Jani</from>
<heading>Reminder</heading>
<body>Don't forget me this weekend!</body>
</note>
JSON
ในการตดตอสอสารขอมลตางๆ ระหวาง Client – Server นนจ าเปนจะตองมภาษากลางทใชส าหรบพดคยหรอสงหากน ซงในปจจบนนนภาษากลางดงกลาวทไดรบความนยมสงมากคอ JSON
โดย tag ของ JSON นนมลกษณะดงน
{"NAME1" : "VALUE1", … , "NAMEn" : "VALUEn"}
{"NAME" : {"NAME1" : "VALUE1", … , "NAMEn" : "VALUEn"} }
{"NAME" : ["VALUE1", … , "VALUEn"]}
{"NAME" : [{"NAME1" : "VALUE1", … , "NAMEn" : "VALUEn"},
. . .
,{"NAME1" : "VALUE1", … , "NAMEn" : "VALUEn"}] }
Wi-Fi Workshop
- HTTP JSON http://openweathermap.org/api
- Wi-Fi Connection
- Arduino Ethernet Web Server- Arduino Wi-Fi ESP8266 Web Server
Arduino Smart Home Automationhttp://androidcontrol.blogspot.com/2014/08/arduino-smart-home-automation.html
Arduino WiFi Control with ESP8266 Modulehttp://androidcontrol.blogspot.com/2015/05/arduino-wifi-control-with-esp8266-module.html
Android Hardware อนๆ
➤ Telephone โทรเขา โทรออก➤ SMS
➤ Camera กลองหนา กลองหลง➤ Sensors ตรวจจบความสวาง,อณหภม, ความเอยง➤ GPS พกด ต าแหนง➤ NFC
➤ Sound & Vibration
Internet of Things Protocol
Internet of Things Protocol
➤ HTTP Hyper Text Transfer Protocol
➤ MQTT Message Queue Telemetry Transport
➤ CoAP Constrained Application Protocol
➤ XMPP Extensible Messaging and Presence Protocol. Cisco
➤ AMQP Advanced Message Queuing Protocol
➤ DDS Data Distribution Service
➤ Continua – Home Health Device
➤ UPnP
➤ ETSI SmartM2M
Internet of Things Protocol
➤ HTTP
➤ MQTT
HTTP Protocol
Server Client
Device
(server )
System
(client )
HTTP GET /< resource >
HTTP 200 OK (< resource >)
(long)
polling
HTTP Protocol
• Client / Server
• ASCII based ( Content-Type based on MIME )
• REST API ( POST,GET,PUT,DELETE )
• TCP Transmission Control Protocol
MQTT Protocol
MQTT Protocol
MQTT Protocol
Device Broker
PUBLISH /$TEL/ group_id / device_id /< resource >
acknowledgement (based on QoS )
PUBLISH /$TEL/ group_id / device_id /< resource >
acknowledgement (based on QoS )
PUBLISH /$TEL/ group_id / device_id /< resource >
acknowledgement (based on QoS )
* $TEL as base for topics not needed
MQTT Client
http://www.eclipse.org/paho/
MosquittoAn Open Source MQTT v3.1/v3.1.1 Broker
http://mosquitto.org/
MQTT Protocol
• Publish / Subscribe
• Topics based
• M2M
IoT Protocol
IoT Cloud Service
➤ CloudMQTT http://www.cloudmqtt.com/
➤ ThingSpeak https://thingspeak.com/
➤ IBM BlueMix http://www.ibm.com/cloud-computing/bluemix/
➤ PubNub http://www.pubnub.com/
CloudMQTT http://www.cloudmqtt.com/
ThingSpeak https://thingspeak.com/
IBM Bluemix http://www.ibm.com/cloud-computing/bluemix/
PubNub http://www.pubnub.com/
IoTCloud Service Workshop
- CloudMQTT
- ThingSpeak
- IBM Bluemix- PubNub
ESP8266 Wi-Fi Module
ESP8266 Wi-Fi Module
• 802.11 b/g/n protocol (2.4GHz / 5GHz);
• Wi-Fi Direct (P2P), Soft-AP
• Integrated TCP/IP protocol stack
• UART serial connection
• 3.3V power supply
• +19.5dBm output power
ESP8266 Development
• ESP8266 Firmware Update
• ESP8266 Development Board
ESP8266 Development
• Arduino IDE ( C/C++ )
• AT Command Mode
• SoC Mode
IoT ESP8266 Workshop
- CloudMQTT
- ThingSpeak Sensor Monitor
- ThingSpeak Control Devices- Smart Config
Android IoT ThingSpeak Sensor Data Monitor
http://androidcontrol.blogspot.com/2015/06/android-iot-thingspeak-data-monitor.html
Android Arduino IoT Control Devices with ThingSpeak.com
http://androidcontrol.blogspot.com/2015/06/android-iot-control-thingspeak.html
Thank You
Q&A
Website : http://SoftPowerGroup.net
Blog : http://androidcontrol.blogspot.com/
top related