Turn on light from thindspeak with esp32
In this tutorial, we will show you how to control lights over the Internet using an ESP32 and the ThingSpeak platform. Imagine being able to turn the lights in your home on or off from anywhere in the world with just a couple of clicks, or even automate the process based on real-time data. This is possible thanks to the combination of the ESP32, a powerful microcontroller with WiFi connectivity, and ThingSpeak, a cloud service that allows you to store and process data from sensors and other devices.
Throughout this tutorial, you will learn how to configure your ESP32 to connect to ThingSpeak, read data from a specific channel, and act on that data by turning lights on or off. This project is ideal for those who want to delve into the world of the Internet of Things (IoT) and explore how connected devices can interact with cloud services to create smart solutions.
Whether you're looking for a way to automate your home, create a remote lighting system, or just want to experiment with IoT, this tutorial will guide you step-by-step so you can do it easily and effectively.
An Esp32
Female pins
Dupont cables female male
PCB
Download gerber file –> Gerber_esp32
Relay Module
TECHNICAL SPECIFICATIONS
Operating Voltage: 5V DC
Control Signal: TTL (3.3V or 5V)
Number of Relays (channels): 1 CH
Max capacity: 10A/250VAC, 10A/30VDC
Max current: 10A (NO), 5A (NC)
Action time: 10 ms / 5 ms
To activate output NO: 0 Volts
#include <WiFi.h>
#include <ThingSpeak.h>
// Configuración de red WiFi
const char* ssid = "Tu_red_wifi"; // Nombre de la red WiFi
const char* contrasena = "Tu_clave_wifi"; // Contraseña de la red WiFi
// Configuración de ThingSpeak
unsigned long idCanal = 0000000; // Reemplaza con tu ID de canal
const char* claveAPIlectura = "Read_API_Keys"; // Reemplaza con tu clave de lectura
WiFiClient cliente;
int pinLuz = 12; // Pin donde está conectada la luz o el relé
void setup() {
Serial.begin(115200);
// Configurar el pin como salida
pinMode(pinLuz, OUTPUT);
// Conectar a la red WiFi
WiFi.begin(ssid, contrasena);
Serial.print("Conectando a WiFi...");
while (WiFi.status() != WL_CONNECTED) {
delay(1000);
Serial.print(".");
}
Serial.println("Conectado a WiFi");
// Conectar a ThingSpeak
ThingSpeak.begin(cliente);
}
void loop() {
// Leer el valor del canal
int estadoLuz = ThingSpeak.readIntField(idCanal, 1, claveAPIlectura); // Leer el campo 1
if (estadoLuz == 1) {
digitalWrite(pinLuz, HIGH); // Encender la luz
Serial.println("Luz encendida");
} else if (estadoLuz == 0) {
digitalWrite(pinLuz, LOW); // Apagar la luz
Serial.println("Luz apagada");
} else {
Serial.println("Error al leer el estado de la luz");
}
delay(15000); // Esperar 15 segundos antes de la próxima lectura
}
Turn on light from thindspeak with esp32
*PCBWay community is a sharing platform. We are not responsible for any design issues and parameter issues (board thickness, surface finish, etc.) you choose.
- Comments(0)
- Likes(0)
- 0 USER VOTES
- YOUR VOTE 0.00 0.00
- 1
- 2
- 3
- 4
- 5
- 6
- 7
- 8
- 9
- 10
- 1
- 2
- 3
- 4
- 5
- 6
- 7
- 8
- 9
- 10
- 1
- 2
- 3
- 4
- 5
- 6
- 7
- 8
- 9
- 10
- 1
- 2
- 3
- 4
- 5
- 6
- 7
- 8
- 9
- 10
More by CarlosVolt Tutoriales
- Infrared stepper motor control with speed control More info and updates https://rogerbit.com/wprb/2024/09/motor-paso-a-paso-x-infrarrojo/In this proje...
- Uploading BME280 Sensor Data to ThingSpeak Using ESP32 In this tutorial, we will show you how to connect a BME280 sensor to an ESP32 to read temperature, h...
- Water pump control for irrigation via telegram and esp32 Water Pump Control by Telegram and ESP32 is an automated system that allows you to remotely control ...
- Air conditioning on/off control via telegram and esp32 In this tutorial we will see how to control an air conditioner, with an esp32 and the telegram appli...
- 35 watt stereo amplifier In this video we will see how to build an audio amplifier, with the TDA7377 integrated circuit, and ...
- Laser alarm with RFID module More info and updates in https://rogerbit.com/wprb/2024/08/alarma-laser-rfid/In this project, we bui...
- Control lights by voice commands and keys In this tutorial we will see how to create a device to control lights by voice commands, with a modu...
- Stepper motor control x bluetooth and app In this tutorial we will see a circuit, which controls a stepper motor, with an application made in ...
- DFplayermini x bluetooth mp3 player control More info and updates in https://rogerbit.com/wprb/2022/12/dfplayermini-x-bluetooth/In this tutorial...
- Robot with WiFi control and servos driven by ESP32 More info and updates in https://rogerbit.com/wprb/2023/07/robot-wifi/A robot controlled by Wi-Fi, s...
- How to make a water level meter with uln2803 In this tutorial we will see how to make a water level meter circuit with the built-in uln2803.The p...
- Color Detector with Arduino and OLED display In this tutorial we will show you how to build a color detector using the TCS3200 sensor and an SH11...
- DTMF decoder for handy with arduino, control over several kilometers In this tutorial we will see how to make a circuit to connect to our handy, in this case a Baofeng U...
- Turn on light from thindspeak with esp32 In this tutorial, we will show you how to control lights over the Internet using an ESP32 and the Th...
- MP3 player control with webserver using ESP32 WIFI In this tutorial, you will learn how to build a web server using the ESP32 to control the YX5300 mod...
- Time clock with fingerprint IoT module, uploading data to thingspeak More info in and updates in https://rogerbit.com/wprb/2022/07/reloj-de-control-fingerprint/In this t...
- Make your own logic tip (includes printed circuit board) In this video tutorial we will see how to make a logic tip, on a printed circuit, with the integrate...
- Coil or inductor meter with Arduino and OLED display More info and updates in https://rogerbit.com/wprb/2022/06/medidor-inductores/In this tutorial we wi...
-
-
-
kmMiniSchield MIDI I/O - IN/OUT/THROUGH MIDI extension for kmMidiMini
119 0 0 -
DIY Laser Power Meter with Arduino
170 0 2 -
-
-
Box & Bolt, 3D Printed Cardboard Crafting Tools
157 0 2 -