Modul 10: Platform IoT (Node-RED, AWS, Azure, Google)

Pertemuan 10 Sub-CPMK: 3.1, 3.2
CPL-05 CPL-11

1. Platform IoT: Gateway menuju Solusi Cerdas

Platform IoT menyediakan infrastruktur dan tools yang diperlukan untuk menghubungkan, mengelola, dan menganalisis perangkat IoT dalam skala besar. Modul ini membahas platform-platform utama yang digunakan dalam industri dan bagaimana memilih platform yang tepat untuk kebutuhan spesifik.

Mengapa Platform IoT Penting?

  • Scalability: Mendukung jutaan perangkat yang terhubung
  • Security: Menyediakan keamanan end-to-end
  • Data Management: Pengolahan dan analisis data real-time
  • Integration: Integrasi dengan sistem existing
  • Development Speed: Mempercepat pengembangan solusi IoT

Tujuan Pembelajaran

  • Memahami arsitektur platform IoT utama
  • Menguasai Node-RED untuk rapid prototyping
  • Mengimplementasikan solusi menggunakan AWS IoT
  • Membandingkan fitur platform IoT cloud
  • Memilih platform yang tepat untuk use case tertentu

2. Overview Platform IoT Populer

🔴

Node-RED

Type: Open-source, Flow-based

Best for: Rapid prototyping, Education

Pricing: Free & Open Source

  • Visual programming interface
  • Extensive node library
  • Easy integration dengan hardware
☁️

AWS IoT

Type: Enterprise Cloud Platform

Best for: Large-scale deployments

Pricing: Pay-as-you-go

  • Highly scalable
  • Deep integration dengan AWS services
  • Enterprise-grade security
🔷

Azure IoT

Type: Enterprise Cloud Platform

Best for: Hybrid cloud scenarios

Pricing: Pay-as-you-go

  • Strong enterprise integration
  • AI and ML capabilities
  • Edge computing support
🔵

Google Cloud IoT

Type: Enterprise Cloud Platform

Best for: Data analytics & AI

Pricing: Pay-as-you-go

  • Powerful data analytics
  • Machine learning integration
  • Global infrastructure

3. Node-RED: Visual Programming untuk IoT

Apa itu Node-RED?

Node-RED adalah tool visual programming yang dibangun di atas Node.js, dirancang khusus untuk menghubungkan perangkat hardware, APIs, dan online services dengan cara yang baru dan menarik.

Fitur Utama Node-RED

🎨

Browser-based Editor

Interface visual yang dapat diakses melalui browser

📦

Extensible

Ribuan nodes tersedia melalui palette manager

🔗

Easy Integration

Integrasi mudah dengan MQTT, HTTP, WebSockets

🚀

Rapid Prototyping

Membangun aplikasi IoT dalam hitungan menit

Node-RED Simulator

Build Your First Flow

📤 Inject
Trigger flow
🐛 Debug
Show output
⚙️ Function
JavaScript code
🌐 MQTT
Message broker
📡 HTTP
REST API
📊 Dashboard
UI components

Drag nodes here to build your flow

Contoh Flow: Sensor Data Processing

// Contoh JavaScript function dalam Node-RED
var temperature = msg.payload.temperature;
var humidity = msg.payload.humidity;

// Data processing
if (temperature > 30) {
  msg.alert = "High temperature warning!";
  msg.level = "warning";
} else {
  msg.alert = "Temperature normal";
  msg.level = "normal";
}

return msg;

4. AWS IoT: Enterprise IoT Platform

AWS IoT Architecture

AWS IoT menyediakan suite lengkap services untuk menghubungkan perangkat IoT ke cloud AWS, mengelola perangkat, memproses data, dan membangun aplikasi.

AWS IoT Core Services

🔗

IoT Core

Device connectivity & management

📊

IoT Analytics

Data processing & analysis

🚨

IoT Events

Event detection & response

🌿

Greengrass

Edge computing

🏭

SiteWise

Industrial data collection

ThingsWise

Industrial data collection

AWS IoT Architecture Example

Smart Home IoT Architecture dengan AWS

🏠
IoT Devices

ESP32, Sensors, Actuators

🔗
AWS IoT Core

MQTT Broker, Device Shadow

Lambda Functions

Data Processing

💾
DynamoDB

Data Storage

📊
QuickSight

Data Visualization

Contoh Kode: ESP32 ke AWS IoT

// AWS IoT Connection dengan ESP32
#include <WiFi.h>
#include <AWS_IOT.h>

AWS_IOT aws_iot;
char HOST_ADDRESS[] = "your-aws-iot-endpoint.amazonaws.com";
char CLIENT_ID[] = "esp32-client";

void setup() {
  Serial.begin(115200);
  WiFi.begin("SSID", "PASSWORD");

  if(aws_iot.connect(HOST_ADDRESS, CLIENT_ID) == 0) {
    Serial.println("Connected to AWS IoT");
  } else {
    Serial.println("AWS IoT connection failed");
  }
}

5. Azure IoT: Microsoft's IoT Platform

Azure IoT Hub Features

  • Device Provisioning Service: Zero-touch device registration
  • IoT Edge: Cloud intelligence di edge devices
  • Time Series Insights: Real-time analytics untuk IoT data
  • IoT Central: SaaS solution untuk IoT applications

Azure IoT Services Comparison

Service Use Case Pricing Model
IoT Hub Device connectivity & management Per message
IoT Central SaaS IoT applications Per device
IoT Edge Edge computing Free with IoT Hub

6. Google Cloud IoT: AI-Powered IoT

Google Cloud IoT Core (Deprecated) & Alternatives

Meskipun Google Cloud IoT Core telah di-deprecate, Google menyediakan alternatif yang powerful dengan integrasi AI/ML:

  • Cloud Pub/Sub: Real-time messaging
  • Cloud Dataflow: Stream & batch processing
  • BigQuery: Data analytics
  • AI Platform: Machine learning

Google Cloud IoT Architecture

📱
IoT Devices

MQTT Clients

📨
Cloud Pub/Sub

Message Ingestion

Cloud Functions

Data Processing

🤖
AI Platform

Machine Learning

📈
Data Studio

Visualization

7. Perbandingan Platform IoT

Feature Node-RED AWS IoT Azure IoT
Pricing Free & Open Source Pay-per-use Pay-per-use
Learning Curve Low (Visual) Medium Medium
Scalability Limited Very High Very High
Enterprise Features Basic Comprehensive Comprehensive
Best For Prototyping, Education Large-scale Production Enterprise Integration

Platform Selection Guide

🎓

Education & Prototyping

Choose: Node-RED
Free, visual, easy to learn

🏢

Enterprise Scale

Choose: AWS IoT
Highly scalable, comprehensive

🔗

Microsoft Ecosystem

Choose: Azure IoT
Seamless Office 365 integration

🤖

AI/ML Focus

Choose: Google Cloud
Advanced analytics capabilities

8. Hands-on Lab: Membangun IoT Dashboard

Lab: Smart Temperature Monitoring System

Bangun sistem monitoring suhu menggunakan Node-RED dan simulasi data sensor.

Step 1: Install Node-RED

Install Node-RED pada komputer atau Raspberry Pi Anda:

npm install -g --unsafe-perm node-red

Step 2: Start Node-RED

Jalankan Node-RED dan akses melalui browser:

node-red
# Akses http://localhost:1880

Step 3: Buat Flow Simulasi Sensor

Drag and drop nodes berikut:

  • Inject node: Untuk generate data acak
  • Function node: Untuk processing data
  • Debug node: Untuk melihat output
  • Dashboard nodes: Untuk UI (install node-red-dashboard)

Step 4: Deploy dan Test

Klik "Deploy" dan buka dashboard di http://localhost:1880/ui

🎯 Challenge: Tambahkan Fitur Alert

Modifikasi flow untuk mengirim notifikasi ketika suhu melebihi 30°C!

  • Gunakan "Switch" node untuk conditional logic
  • Tambahkan "Email" node atau "Notification" node
  • Test dengan berbagai nilai threshold

9. Kuis Pemahaman

1. Platform mana yang paling cocok untuk rapid prototyping IoT dengan interface visual?

  • A. AWS IoT
  • B. Azure IoT
  • C. Node-RED
  • D. Google Cloud IoT

2. Service AWS mana yang bertanggung jawab untuk device connectivity dan management?

  • A. AWS Lambda
  • B. AWS IoT Core
  • C. AWS S3
  • D. AWS EC2

3. Apa keuntungan utama menggunakan platform cloud seperti AWS IoT dibandingkan solusi on-premise?

  • A. Harga lebih murah
  • B. Scalability dan managed services
  • C. Keamanan yang lebih rendah
  • D. Performa yang lebih lambat