Hands on Arduino ESP32 Workshop
The Arduino and ESP32 are two of the most popular platforms in the embedded systems world. Arduino is the perfect starting point for beginners, while ESP32 brings built-in WiFi and Bluetooth for IoT projects. Combining them in a structured workshop gives students a complete foundation in modern embedded development.
This workshop is designed for engineering students, hobbyists, and anyone looking to build real-world IoT and automation projects.
Workshop Structure
Day 1: Arduino fundamentals — blink, buttons, sensors
Day 2: Advanced Arduino — motors, displays, interrupts
Day 3: ESP32 introduction — WiFi, web server, cloud
Day 4: IoT project — build a complete smart device
Day 5: Testing, troubleshooting, and project showcase
Day 1: Arduino Basics
Getting Started
- Understanding Arduino Uno board layout — pins, power, clock.
- Installing Arduino IDE and setting up the board.
- Structure of an Arduino sketch — setup() and loop().
First Program: LED Blink
void setup() {
pinMode(13, OUTPUT); // Built-in LED
}
void loop() {
digitalWrite(13, HIGH);
delay(1000);
digitalWrite(13, LOW);
delay(1000);
}
Digital Input: Push Button
Students learn to read a button press and control an LED:
int buttonPin = 2;
int ledPin = 13;
void setup() {
pinMode(buttonPin, INPUT_PULLUP);
pinMode(ledPin, OUTPUT);
}
void loop() {
if (digitalRead(buttonPin) == LOW) {
digitalWrite(ledPin, HIGH);
} else {
digitalWrite(ledPin, LOW);
}
}
Analog Input: Potentiometer
Reading variable voltage and mapping to LED brightness:
int potPin = A0;
int ledPin = 9;
void setup() {
Serial.begin(9600);
pinMode(ledPin, OUTPUT);
}
void loop() {
int value = analogRead(potPin);
int brightness = map(value, 0, 1023, 0, 255);
analogWrite(ledPin, brightness);
Serial.println(value);
delay(50);
}
Day 2: Sensors and Actuators
Ultrasonic Distance Sensor (HC-SR04)
int trig = 9, echo = 10;
void setup() {
Serial.begin(9600);
pinMode(trig, OUTPUT);
pinMode(echo, INPUT);
}
void loop() {
digitalWrite(trig, LOW); delayMicroseconds(2);
digitalWrite(trig, HIGH); delayMicroseconds(10);
digitalWrite(trig, LOW);
long duration = pulseIn(echo, HIGH);
int cm = duration * 0.034 / 2;
Serial.print("Distance: ");
Serial.print(cm);
Serial.println(" cm");
delay(200);
}
Servo Motor Control
#include <Servo.h>
Servo myServo;
int potPin = A0;
void setup() {
myServo.attach(9);
}
void loop() {
int val = analogRead(potPin);
int angle = map(val, 0, 1023, 0, 180);
myServo.write(angle);
delay(15);
}
DHT11 Temperature and Humidity Sensor
#include <DHT.h>
DHT dht(2, DHT11);
void setup() {
Serial.begin(9600);
dht.begin();
}
void loop() {
float h = dht.readHumidity();
float t = dht.readTemperature();
if (isnan(h) || isnan(t)) {
Serial.println("Sensor error");
return;
}
Serial.print("Temp: "); Serial.print(t);
Serial.print("C Humidity: "); Serial.println(h);
delay(2000);
}
Teaching tip: Let students combine sensors creatively. Example: ultrasonic sensor + servo = automatic dustbin lid, DHT11 + relay = temperature-controlled fan. These mini-projects build confidence before the main project day.
Day 3: ESP32 — IoT and WiFi
The ESP32 is the heart of modern IoT. It has dual-core processor, WiFi, Bluetooth, and plenty of GPIO pins — all for under Rs. 500.
Setting Up ESP32 in Arduino IDE
- Add ESP32 board URL to Preferences.
- Install ESP32 board package via Boards Manager.
- Select board: ESP32 Dev Module.
WiFi Scanner
#include <WiFi.h>
void setup() {
Serial.begin(115200);
WiFi.mode(WIFI_STA);
WiFi.disconnect();
delay(100);
Serial.println("Scanning WiFi networks...");
int n = WiFi.scanNetworks();
for (int i = 0; i < n; i++) {
Serial.print(i + 1);
Serial.print(": ");
Serial.print(WiFi.SSID(i));
Serial.print(" (");
Serial.print(WiFi.RSSI(i));
Serial.println(" dBm)");
}
}
void loop() {}
ESP32 Web Server — Control LED from Phone
#include <WiFi.h>
#include <WebServer.h>
const char* ssid = "YourWiFi";
const char* password = "YourPassword";
WebServer server(80);
int ledPin = 2;
void handleRoot() {
String html = "<html><body>";
html += "<h1>ESP32 LED Control</h1>";
html += "<a href='/on'><button>ON</button></a>";
html += "<a href='/off'><button>OFF</button></a>";
html += "</body></html>";
server.send(200, "text/html", html);
}
void setup() {
pinMode(ledPin, OUTPUT);
WiFi.begin(ssid, password);
server.on("/", handleRoot);
server.on("/on", []() { digitalWrite(ledPin, HIGH); server.send(200, "text/plain", "ON"); });
server.on("/off", []() { digitalWrite(ledPin, LOW); server.send(200, "text/plain", "OFF"); });
server.begin();
}
void loop() {
server.handleClient();
}
Sending Sensor Data to Cloud
Students learn to send sensor data to a cloud dashboard using Blynk or ThingSpeak:
#include <WiFi.h>
#include <ThingSpeak.h>
WiFiClient client;
unsigned long channelID = YOUR_CHANNEL_ID;
const char* apiKey = "YOUR_API_KEY";
void setup() {
WiFi.begin("SSID", "Password");
ThingSpeak.begin(client);
}
void loop() {
int sensorValue = analogRead(34);
ThingSpeak.setField(1, sensorValue);
ThingSpeak.writeFields(channelID, apiKey);
delay(30000); // Update every 30 sec
}
Day 4: IoT Project — Smart Plant Monitoring System
Students build a complete IoT project that monitors soil moisture, temperature, and humidity, and automatically waters the plant:
Components
- ESP32 Dev Board
- Soil moisture sensor (capacitive type)
- DHT11 temperature and humidity sensor
- Relay module + small water pump
- OLED display (128x64, I2C)
- Breadboard and jumper wires
Working Logic
- Read soil moisture every 10 seconds.
- Display temperature, humidity, and moisture on OLED.
- If moisture is below threshold, activate pump for 3 seconds.
- Send all data to ThingSpeak cloud dashboard.
- Show alerts on OLED when water level is low.
#include <WiFi.h>
#include <DHT.h>
#include <Wire.h>
#include <Adafruit_SSD1306.h>
DHT dht(4, DHT11);
Adafruit_SSD1306 display(128, 64, &Wire, -1);
int moisturePin = 34;
int relayPin = 5;
void setup() {
WiFi.begin("SSID", "Password");
pinMode(relayPin, OUTPUT);
dht.begin();
display.begin(SSD1306_SWITCHCAPVCC, 0x3C);
}
void loop() {
int moisture = analogRead(moisturePin);
float temp = dht.readTemperature();
float hum = dht.readHumidity();
// Display on OLED
display.clearDisplay();
display.setTextSize(1);
display.setCursor(0, 0);
display.println("Plant Monitor");
display.print("Moisture: "); display.println(moisture);
display.print("Temp: "); display.print(temp); display.println("C");
display.print("Humidity: "); display.print(hum); display.println("%");
if (moisture > 3000) { // Dry soil
digitalWrite(relayPin, HIGH); // Pump ON
display.println("PUMP ON");
delay(3000);
digitalWrite(relayPin, LOW); // Pump OFF
}
display.display();
delay(10000);
}
Day 5: Troubleshooting and Showcase
Common Issues and Fixes
Problem Cause Fix
Board not detected Wrong port/driver Install CP210x/CH340 driver
Upload fails Board not in flash Hold BOOT button during upload
mode
Serial shows garbage Wrong baud rate Set to 115200 for ESP32
WiFi not connecting Wrong SSID/password Check credentials, 2.4GHz only
Sensor reading 0 Wrong pin/Wiring Check connections, VCC/GND
OLED blank Wrong I2C address Scan with i2c_scanner sketch
Pump not activating Relay not powered Check relay VCC and GND
Project Showcase Format
Each team presents their working project in 5 minutes:
- Problem statement — what does your project solve?
- Circuit demo — show the hardware working live.
- Code walkthrough — explain key functions.
- Cloud dashboard — show real-time data (if applicable).
- Challenges faced — what went wrong and how you fixed it.
Kit Contents
Workshop Kit per student:
1 × Arduino Uno (compatible)
1 × ESP32 Dev Board
1 × Breadboard (830 points)
1 × USB cable (Arduino) + 1 × Micro USB cable (ESP32)
10 × LEDs (assorted)
10 × Resistors (220Ω, 1kΩ, 10kΩ)
1 × Potentiometer (10kΩ)
2 × Push buttons
1 × Buzzer
1 × DHT11 sensor
1 × HC-SR04 ultrasonic sensor
1 × Servo motor (SG90)
1 × Soil moisture sensor
1 × OLED display (128x64, I2C)
1 × Relay module (1-channel)
1 × Small water pump
1 × L293D motor driver
40 × Male-male jumper wires
20 × Male-female jumper wires
1 × Multimeter (basic)
Projects Students Can Build After This Workshop
- Smart home automation — control appliances from phone via ESP32.
- Weather station — measure and upload temperature, humidity, pressure.
- Smart dustbin — ultrasonic sensor + servo for automatic lid.
- Water quality monitor — TDS sensor + ESP32 for real-time data.
- Fire alarm system — flame sensor + buzzer + SMS alert.
- Smart parking system — IR sensors + ESP32 showing slot availability.
Conclusion
The Arduino and ESP32 combination gives students everything they need to build real-world IoT and automation projects. Arduino provides the easiest learning curve for beginners, while ESP32 opens the door to WiFi-connected, cloud-enabled devices that are in high demand in industry.
After this workshop, students will have the confidence to design their own embedded systems, write efficient code, and troubleshoot hardware problems — skills that are directly applicable in careers across electronics, software, and IoT.