0% found this document useful (0 votes)
2 views2 pages

LED Notifikasi RGB Arduino

The document outlines two projects for creating an RGB notification LED using Arduino and ESP modules. The first project utilizes Bluetooth (HC-05) to receive messages and change LED colors based on notifications from apps like WhatsApp and Telegram. The second project employs Wi-Fi (ESP8266/ESP32) with IFTTT to trigger LED color changes through HTTP requests based on app notifications.

Uploaded by

recoverry
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)
2 views2 pages

LED Notifikasi RGB Arduino

The document outlines two projects for creating an RGB notification LED using Arduino and ESP modules. The first project utilizes Bluetooth (HC-05) to receive messages and change LED colors based on notifications from apps like WhatsApp and Telegram. The second project employs Wi-Fi (ESP8266/ESP32) with IFTTT to trigger LED color changes through HTTP requests based on app notifications.

Uploaded by

recoverry
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/ 2

Proyek: LED Notifikasi RGB dengan Arduino

1. Menggunakan Bluetooth (HC-05)

Pendekatan 1: Bluetooth (HC-05/HC-06)

Hardware:
- Arduino Uno/Nano
- Modul Bluetooth HC-05/HC-06
- LED RGB (common-cathode atau anode) + resistor 220 Ω per channel
- Kabel jumper

Skema Rangkaian:
- HC-05 TX → Arduino RX (pin 0)
- HC-05 RX → Arduino TX (pin 1)
- LED RGB:
- R → Arduino PWM pin 9 (via resistor)
- G → PWM pin 10
- B → PWM pin 11
- Common cathode → GND

Cara Kerja:
- Gunakan aplikasi seperti Notification Forwarder atau Serial Bluetooth Terminal di Android.
- Kirim pesan seperti 'WA' untuk WhatsApp dan 'TG' untuk Telegram ke HC-05.
- Arduino membaca data serial dan mengatur warna LED berdasarkan pesan tersebut.

Contoh kode Arduino:

const int pinR = 9;


const int pinG = 10;
const int pinB = 11;

void setup() {
Serial.begin(9600);
pinMode(pinR, OUTPUT);
pinMode(pinG, OUTPUT);
pinMode(pinB, OUTPUT);
turnOff();
}

void loop() {
if (Serial.available()) {
String msg = Serial.readStringUntil('\n');
msg.trim();
if (msg == "WA") setColor(255, 165, 0);
else if (msg == "TG") setColor(0, 50, 255);
else turnOff();
}
}

void setColor(int r, int g, int b) {


analogWrite(pinR, 255 - r);
analogWrite(pinG, 255 - g);
analogWrite(pinB, 255 - b);
}

void turnOff() {
analogWrite(pinR, 255);
analogWrite(pinG, 255);
analogWrite(pinB, 255);
2. Menggunakan Wi-Fi (ESP8266/ESP32 + IFTTT)

Pendekatan 2: Wi-Fi (ESP8266/ESP32 + IFTTT)

Hardware:
- ESP8266 (NodeMCU) atau ESP32
- LED RGB + resistor

Cara Kerja:
- Buat applet IFTTT dengan trigger 'Android Notifications' (untuk WhatsApp/Telegram).
- Aksi: 'Webhooks' untuk mengirim HTTP request ke ESP, misalnya:
http://192.168.1.50/notify?app=whatsapp
- ESP menjalankan server kecil dan mengatur warna LED berdasarkan parameter 'app'.

Contoh kode (ESP32, Arduino IDE):

#include <WiFi.h>
#include <WebServer.h>

const char* ssid = "SSID_Anda";


const char* pass = "PASSWORD";

WebServer server(80);
const int pinR = 14, pinG = 12, pinB = 13;

void handleNotify() {
String app = server.arg("app");
if (app == "whatsapp") setColor(255,165,0);
else if (app == "telegram") setColor(0,50,255);
else turnOff();
server.send(200, "text/plain", "OK");
}

void setup() {
Serial.begin(115200);
WiFi.begin(ssid, pass);
while (WiFi.status() != WL_CONNECTED) delay(500);
pinMode(pinR, OUTPUT); pinMode(pinG, OUTPUT); pinMode(pinB, OUTPUT);
server.on("/notify", handleNotify);
server.begin();
}

void loop() {
server.handleClient();
}

void setColor(int r, int g, int b) {


analogWrite(pinR, r);
analogWrite(pinG, g);
analogWrite(pinB, b);
}

void turnOff() { setColor(0,0,0); }

You might also like