We were supposed to design a solenoid valve system to control watering based on soil moisture. A capacitive soil moisture sensor sends readings to the ESP32, which triggers the valve to open if moisture falls below the threshold. Since the ESP32 operates at 3.3V logic and cannot directly control the 12V solenoid valve, a relay module is used. The relay, powered via the VIN pin (5V), switches a 12V power supply to control the valve. In its normally closed (NC) state, the solenoid blocks water flow. When the relay energizes the solenoid, the electromagnet pulls the plunger up, opening the valve. Once de-energized, the spring pushes the plunger back, closing it.
Link to ESP32 Code
This task involved displaying the hex code of a metro card using an RFID (Radio Frequency Identification) system. The MFRC522 reader operates at 13.56 MHz, generating an RF field to power passive RFID tags. Each tag contains a microchip and an antenna—the microchip stores a unique ID, while the antenna enables wireless communication with the reader. The tag modulates the signal and transmits its ID back via load modulation. The reader communicates with the ESP32 via SPI (Serial Peripheral Interface), a synchronous serial communication protocol used for high-speed data exchange between microcontrollers and peripherals, using:
Once received, the ESP32 processes and displays the RFID tag’s hex code.
Link to ESP32 Code
In this task, I interfaced the DS3231 Real-Time Clock (RTC) module with the ESP32 to display time on the serial monitor. The DS3231 features a temperature-compensated crystal oscillator (TCXO) for high accuracy and a backup battery to maintain time when power is lost.
The DS3231 uses a 32.768 kHz quartz crystal oscillator as its clock source. Since quartz frequency can drift due to temperature changes, the built-in TCXO continuously measures temperature and adjusts the oscillator’s frequency using a capacitor array, ensuring stable and precise timekeeping with an accuracy of ±2 ppm. The ESP32 reads this time over I2C communication and displays it on the serial monitor.
Link to ESP32 Code
In this task, I used an ESP32 to log RFID-based attendance and update Google Sheets via Zapier Webhooks (an alternative to IFTTT). When an RFID card was scanned, the ESP32 sent a JSON payload ({"date": "2025-03-29", "time": "10:10:50", "rfid": "ABCD1234"}) in an HTTP POST request to Zapier’s Webhook, which processed the data and mapped it to Google Sheets.
Webhooks enabled real-time data transfer, acting as a bridge between ESP32 and Zapier. I also learned that this could be done without Zapier using Google Apps Script, which directly processes ESP32’s POST requests and updates Google Sheets.
Link to ESP32 Code
This task aimed to establish communication between an Arduino and an ESP32 using Zigbee, but I couldn’t complete it due to the unavailability of the required module. Zigbee is a low-power, wireless protocol based on IEEE 802.15.4, operating at 2.4 GHz with packet-based communication and mesh networking for reliability. Since Arduino and ESP32 lack built-in Zigbee, external XBee modules are needed. Arduino connects to an XBee transmitter via UART (TX/RX pins) to send a message (e.g., "Hello ESP32"), which is wirelessly transmitted. An XBee receiver on ESP32 receives the message and forwards it to ESP32 via UART for processing.
In this task, I interfaced an RFID module with an ESP32 using the SPI protocol to control a DC motor via an L298N motor driver. Two RFID cards were used—one to move the motor forward, another to move it backward, and any unknown card would stop the motor.
The MFRC522 RFID module communicates with the ESP32 over SPI, sending the scanned card’s unique ID. The ESP32 checks this ID against predefined values and accordingly controls the L298N motor driver, adjusting the motor’s direction or stopping it.
Link to ESP32 Code
A Telegram bot was created using BotFather, which provided a bot token for authentication. The ESP32 used this token to communicate with Telegram’s servers via the Telegram Bot API.
The ESP32 connected to Wi-Fi and repeatedly polled Telegram’s server by sending HTTP GET requests to check for new messages. When I sent a command like "Motor Forward", "Motor Backward" or "Motor Stop", Telegram stored it on its server, and the ESP32 retrieved it using an API request. Based on the received command, the ESP32 controlled the motor driver to rotate the motor or stop accordingly.
Link to ESP32 Code
I built my own voice assistant to control an LED using ESP32. A Python script handled voice recognition using Google Speech-to-Text (STT) and generated responses using Google Text-to-Speech (TTS).
When I gave a voice command like "Turn on the light" or "Turn off the light," the script converted the speech to text and processed the command. It then sent an HTTP request to the ESP32’s IP address, instructing it to switch the LED on or off.
Link to Python Code
Link to ESP32 Code