Modul 5
Modul 5
Nomor Modul 5
Tanggal 23 Desember 2020
Nama
NIM
Tujuan praktikum:
Internet of Things (IoT) didefinisikan sebagai infrastruktur jaringan global yang dinamis
dengan kemampuan self-configuration berdasarkan standar dan protokol komunikasi yang dapat
dioperasikan. Benda fisik dan virtual dalam IoT memiliki identitas dan atribut serta mampu
menggunakan antarmuka cerdas dan diintegrasikan sebagai jaringan informasi.
Dalam lingkungan IoT, sebuah pintu akan memiliki kemampuan untuk terhubung dengan
alarm kebakaran, atau kursi Anda akan berkomunikasi dengan lampu rumah Anda atau mobil
akan berkomunikasi dengan tempat parkir; daftarnya bisa semakin panjang, dan hanya dibatasi
oleh imajinasi Anda.
Sistem IoT terdiri dari hardware dan software. Komponen hardware termasuk sistem
tertanam, sensor dan SBC. IoT mencakup pemanfaatan sensor dan perangkat keras komunikasi
jarak dekat seperti RFID atau NFC, bersama dengan perangkat komputasi tertanam. Komponen
perangkat lunak IoT dibentuk oleh beberapa lapisan yang berbeda.
Software IoT terdiri dari beberapa lapisan. Lapisan paling rendah adalah sistem operasi
hardware. Lapisan selanjutnya adalah middleware and framework yang menjadi inti dari
software. Lapisan ini bertindak sebagai jembatan antar perangkat untuk mengaktifkan
komunikasi M2M, untuk memfasilitasi penyediaan informasi yang diperoleh dari lingkungan
sekitar kepada pengguna atau ke portal integrasi.
2. ESP32
Module ESP32 merupakan penerus dari module ESP8266 yang cukup populer untuk Aplikasi
IoT. Pada ESP32 terdapat inti CPU serta Wi-Fi yang lebih cepat, GPIO yang lebih, dan
mendukung Bluetooth Low Energy. Berikut ini adalah Arsitektur dan Block Diagram dari
ESP32 :
1. Processors:
> Main processor: Tensilica Xtensa 32-bit LX6 microprocessor
> Cores: 2 or 1 (depending on variation)
> Clock frequency: up to 240 MHz
> Performance: up to 600 DMIPS
> Ultra low power co-processor: allows you to do ADC conversions, computation, and level
thresholds while in deep sleep.
2. Wireless connectivity:
> Wi-Fi: 802.11 b/g/n/e/i (802.11n @ 2.4 GHz up to 150 Mbit/s)
> Bluetooth: v4.2 BR/EDR and Bluetooth Low Energy (BLE)
3. Memory:
> Internal memory:
> ROM: 448 KiB
> SRAM: 520 KiB
> RTC fast SRAM: 8 KiB
> RTC slow SRAM: 8 KiB
> eFuse: 1 Kibit
> Embedded flash:
> 0 MiB (ESP32-D0WDQ6, ESP32-D0WD, and ESP32-S0WD chips)
> 2 MiB (ESP32-D2WD chip)
> 4 MiB (ESP32-PICO-D4 SiP module)
> External flash & SRAM: ESP32 supports up to four 16 MiB external QSPI flashes and
SRAMs with hardware encryption based on AES to protect developers' programs and
data. ESP32 can access the external QSPI flash and SRAM through high-speed caches.
> Up to 16 MiB of external flash are memory-mapped onto the CPU code space,
supporting 8-bit, 16-bit and 32-bit access. Code execution is supported.
> Up to 8 MiB of external flash/SRAM memory are mapped onto the CPU data space,
supporting 8-bit, 16-bit and 32-bit access. Data-read is supported on the flash and
SRAM. Data-write is supported on the SRAM.
3) Buka Arduino IDE yang sebelumnya telah diatur board “Esp32” pada bagian
tools. Masukan kode sebagai berikut:
void loop(){
WiFiClient client = server.available(); // Listen for incoming clients
nilaipot = analogRead(potensio);
if (client) { // If a new client connects,
currentTime = millis();
previousTime = currentTime;
Serial.println("New Client."); // print a message out in the serial port
String currentLine = ""; // make a String to hold incoming data from the client
Serial.print("nilai potensio");
Serial.println(nilaipot);
while (client.connected() && currentTime - previousTime <= timeoutTime) { // loop while the
client's connected
currentTime = millis();
if (client.available()) { // if there's bytes to read from the client,
char c = client.read(); // read a byte, then
Serial.write(c); // print it out the serial monitor
header += c;
if (c == '\n') { // if the byte is a newline character
// if the current line is blank, you got two newline characters in a row.
// that's the end of the client HTTP request, so send a response:
if (currentLine.length() == 0) {
// HTTP headers always start with a response code (e.g. HTTP/1.1 200 OK)
// and a content-type so the client knows what's coming, then a blank line:
client.println("HTTP/1.1 200 OK");
client.println("Content-type:text/html");
client.println("Connection: close");
client.println();
client.println("</body></html>");