Turn on two lamps by the ESP32 board

ESP32 28-11-23
212 0

Tutorial plan

1- The components needed to control two lamps by ESP32 card

2- Mounting the ESP32 card with two lamps and two relays

3- Program the ESP32 card with Micropython language to flash two lamps

 

 

The components needed to control two lamps by ESP32 card

To control two lamps using the ESP32 board, you will need the following components:

ESP32 Board:

ESP32 card

The ESP32 is a microcontroller board that features built-in WiFi and Bluetooth capabilities. It can be programmed and used to control the lamp.

Two Relays Modules:

Two relays

You'll need a relay module that is compatible with the ESP32 card and can switch the high-voltage lamp. Ensure it's rated for the voltage and current required for your lamp.

Two Lamps (220V):

The two lamps  is rated for 220V. Ensure it's in working condition and safe to use.

Power Supply for the Lamp:

You'll need a power source for the lamp, typically a 220V AC power supply.

Wiring:

Various wires and cables for connecting the components in your circuit.

Breadboard:

Breadboard

A breadboard is a prototyping board that allows you to build circuits without soldering. It provides a convenient way to connect the components together.

Jumper Wires:

Jumper Wires

You'll need jumper wires to make connections between the ESP32 card, lamp, relay, and breadboard. Ensure you have male-to-male jumper wires or a mix of male-to-male and male-to-female wires, depending on your specific needs.

Mounting the ESP32 card with two lamps and two relays

To control two lamps using a ESP32 board, you will need to use two relays modules to safely interface the low-voltage ESP32 card with the high-voltage lamp. Here are the step-by-step instructions to set up the ESP32 with two lamps :

1- Safety First: Ensure the two lamps are disconnected from any power source before proceeding.

2- Connect the first Relay to the ESP32:

- Connect the relay's control pin (S) to pin 23 of ESP32 board.

- Connect the pin (+) of relay to pin 3.3V of ESP32 board.

- Connect the relay's ground pin (-) to the ESP32's GND.

3- Connect the first Lamp and the power supply to the Relay:

- Connect one of the the the power supply  wires to the relay's common (COM) terminal.

- Connect the phase wire of the lamp's to the normally open (NO) terminal of the relay.

- Connect the neutral wire of the power supply directly to the neutral wire of the lamp.

4- Connect the second Relay to the ESP32:

- Connect the relay's control pin (S) to pin 22 of ESP32 board.

- Connect the pin (+) of relay to pin 3.3V of ESP32 board.

- Connect the relay's ground pin (-) to the ESP32's GND.

5- Connect the second Lamp and the power supply to the Relay:

- Connect one of the lamp's wires to the relay's common (COM) terminal.

- Connect the phase wire of the power supply to the normally open (NO) terminal of the relay.

- Connect the neutral wire of the power supply directly to the neutral wire of the lamp.

Mounting the ESP32 card with two lamps and two relays

Mounting the ESP32 card with two lamps and two relays

Program the ESP32 card with Micropython language to flash the lamp

To flash two lamps using an ESP32 board with MicroPython, use the following MicroPython code to blink the lamp:

This code will blink the two Lamps by the  two relays connected to GPIO 23 and GPIO 22 with a period of 1 second.

Upload the code to the ESP32 board using your MicroPython editor.

Once the code is uploaded and the physical connections are made, the two lamps should start to blink based on the code. Adjust the sleep durations (time.sleep()) to modify the timing of the lamp's on and off states as desired.

0 comment

Leave a comment

Veuillez noter s'il vous plaît*

Votre adresse e-mail ne sera pas publiée. Les champs obligatoires sont indiqués avec *

Purpose of this website

Educational robotics refers to the use of robots and robotics technology to promote learning in educational settings. It involves the integration of technology, engineering, and computer science into the classroom, allowing students to engage in hands-on, project-based learning experiences.
In this context, our website represents an excellent resource for parents, teachers and children who wish to discover robotics.

Contact details

Zaouiet Kontech-Jemmel-Monastir-Tunisia

+216 92 886 231

medaliprof@gmail.com

Pictures of the articles

Robotic site created by MedAli-Teacher info