0% found this document useful (0 votes)
25 views

Materi Arduino Dan IoT

This document discusses using Android hardware and Arduino boards for Internet of Things projects. It covers various communication methods between Android and Arduino like USB, Bluetooth, WiFi. It also discusses using sensors, displays and other hardware with Android. Finally, it covers common IoT protocols like HTTP, MQTT, CoAP and integrating devices with cloud services.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
25 views

Materi Arduino Dan IoT

This document discusses using Android hardware and Arduino boards for Internet of Things projects. It covers various communication methods between Android and Arduino like USB, Bluetooth, WiFi. It also discusses using sensors, displays and other hardware with Android. Finally, it covers common IoT protocols like HTTP, MQTT, CoAP and integrating devices with cloud services.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 65

Android Control Hardware and Arduino IoT

Arduino Uno dan ESP 8266


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
Arduino OTG USB

http://androidcontrol.blogspot.com/2014/06/arduino-usb-servo-motor-control.html
Arduino Servo USB
Arduino Firmata Library
http://arduino.cc/en/Reference/Firmata
Download Firmata Test Program
www.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 Download


https://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
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
XML eXtensible Markup Language
Bahasa markup yang diciptakan oleh konsorsium World
Wide Web (W3C). Bahasa ini berfungsi untuk
menyederhanakan proses penyimpanan dan pengiriman
data antarserver.
<?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 JavaScript object notation
format yang digunakan untuk menyimpan dan mentransfer data.
Berbeda dengan XML (extensive markup language) dan format lainnya
yang memiliki fungsi serupa, JSON memiliki struktur data yang
sederhana dan mudah dipahami.
JSON sendiri terdiri dari dua struktur, yaitu:
•Kumpulan value yang saling berpasangan. Dalam JSON, contohnya
adalah object.
•Daftar value yang berurutan, seperti array.
JSON juga tidak hanya dapat digunakan dengan JavaScript. Berikut ini
adalah beberapa bahasa pemrograman lain yang mendukung
penggunaan format tersebut:
•PHP
•Python
•Ruby
•C++
•Perl
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 Automation
http://androidcontrol.blogspot.com/2014/08/arduino-smart-home-automation.html
Arduino WiFi Control with ESP8266 Module
http://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
Compare Searchterms ...

MQTT CoAIP AMQP


Seard1 1erm Search term Search term
+Add t e r m

Interest ov€ff time


1 1 '!'.l'" ews headlines L Fo recast ?

Average

<I>
Internet of Things Protocol

➤ HTTP (Hypertext Transfer Protocol)


Protokol jaringan lapisan aplikasi (application layer) yang dikembangkan untuk
membantu proses transfer antar komputer. Protokol ini berguna untuk
mentransfer informasi seperti dokumen, file, gambar, dan video antar komputer.

➤ MQTT (Message Queuing Telemetry Transport)


Protokol merupakan sebuah protokol yang berjalan diatas stack TCP/IP dan
dirancang khusus untuk machine to machine yang tidak memiliki alamat
khusus. Maksud dari kata tidak memiliki alamat khusus ini seperti halnya
sebuah arduino, raspi atau device lain yang tidak memiliki alamat khusus.
HTTP Protocol

Server Client

Device System
(server ) (client )

HTTP GET /< resource >

(long)
polling
HTTP 200 OK (< resource >)
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/

Mosquitto
An Open Source MQTT v3.1/v3.1.1 Broker
http://mosquitto.org/
MQTT Protocol
• Publish / Subscribe
• Topics based
• M2M
IoT Protocol
L o w
2G,3G,4G QJnpa! success
Protocol Transport Messaging and Lossy Security Arch
(lOOO's) Resources Stories
(lOOO's)
Utility field
CoAP UDP Rq t/R pn xcellent xcellent
area ntw k

Continua
UDP air air None Medical tar
HDP
Pub/ ubsrb lOOKs/RAl\1 High-
DDS UDP
Rq t/R pn e
air Poo r
ah ptio nal Mili ary Bu

100Ks/RA1\1 High-
DPWS T P ood Fair Web erv rs
ash Optio nal

HTIP/ 10Ks/RAM mart nergy


T p Rq ·pn e xcellent Fair Pha e2
REST la h

T p 10Ks/RAM
MQTT Excellent ood IoT ging Tr e
la h

Rq 10 Netw rk lient-
SNMP UDP pone X llent air
M nitor ing
lOKs/RAl\.1 P2P nt
UPnP xcellent ood ah None on umer

OKs/RAM Hi gh- ·en1


XMPP T p xcellent Fair
ash Mand it ry

OKs/RA\.1
ZeroMQ UDP Fair Fair
ah RN P2P
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
TERIMA KASIH

You might also like