Guide · Arduino and ESP32
Arduino and ESP32 – Learning Guide
Arduino and ESP32 are platforms for learning electronics and programming microcontrollers. Arduino is simple and ideal for getting started, while the ESP32 adds Wi-Fi, Bluetooth, more memory and higher speed.
Programs are written in a language similar to C/C++, in the Arduino IDE environment.
- Primary and secondary school
- Electronics
- Examples in C/C++
Some lessons linked below are available only in Serbian for now. They are marked (SR).
1 Beginner level
The first programs: LED, button, sound, display and simple sensors – first on the Arduino, then on the ESP32.
Arduino
1. Introduction to Arduino
The board, the Arduino IDE and the Blink program.
Open lesson →2. LED, button and traffic light New
A resistor with an LED, a button with INPUT_PULLUP, a traffic light and a pedestrian crossing.
Open lesson →3. Speaker and RGB LED New
Tones, a siren and a melody; mixing colours and a small alarm.
Open lesson →4. Light level (LDR sensor)
Analog input and showing the value.
Open lesson →5. Temperature sensor
Measuring and showing the temperature.
Open lesson →6. OLED display New
Text, shapes and a thermometer on a 128×64 display over I2C – for Arduino and ESP32.
Open lesson →7. Measuring an unknown resistor
A voltage divider and Ohm's law.
Open lesson →8. Ultrasonic sensor
Measuring distance with the HC-SR04 sensor.
Open lesson →9. Servo motor
The PWM signal and the Servo.h library.
Open lesson →ESP32
14. Introduction to the ESP32
The board, the pins and setting up the environment.
Open lesson →15. LED, button and PWM New
The first program on the ESP32: blinking, a button, brightness and a potentiometer.
Open lesson →16. Measuring light (ESP32)
An LDR sensor on the ESP32 board.
Open lesson →17. Light sensor and LED ring New
A night light with an LDR sensor and a WS2812 (NeoPixel) ring.
Open lesson →18. Temperature and humidity (DHT11) New
Measuring in the Serial Monitor and a weather station with a web page.
Open lesson →2 Intermediate level: motors and sensors
A DC motor, a relay and a pump, a servo motor on the ESP32, an accelerometer, a gyroscope and a magnetometer.
Arduino
10. Controlling a DC motor
An H-bridge driver and the direction of rotation of the motor.
Open lesson →11. Soil moisture sensor
Resistive and capacitive sensors, display in Processing.
Open lesson →12. Relay and water pump
How the Arduino safely turns on a pump through a relay.
Open lesson →ESP32
19. Ultrasonic sensor
Measuring the distance to an obstacle.
Open lesson →20. Servo motor
Controlling the angle of a servo motor.
Open lesson →21. SG90 servo motor – exercise New
Connecting it, given angles, a potentiometer and control from the Serial Monitor.
Open lesson →23. Accelerometer and magnetometer
MPU6050 and QMC5883L over I2C, a comparison with the micro:bit.
Open lesson →24. MPU9250: a 9-axis sensor New
An accelerometer, a gyroscope and a magnetometer in one module.
Open lesson →25. Water pump
Turning on a pump for a watering system.
Open lesson →3 Projects and the review test
Several parts in one device: watering the garden, a barrier and radar, a smart classroom – and a knowledge check at the end.
Arduino
ESP32
22. Barrier and radar New
A servo motor and an ultrasonic sensor: an automatic barrier and a radar in Processing.
Open lesson →26. Automatic watering with Wi-Fi
A smart garden: moisture and the pump on a web page.
Open lesson →27. Smart classroom New
DHT11, an LED ring, a servo "window" and a web page on the phone.
Open lesson →Knowledge check
4 Networks and the Internet of Things
The ESP32 can connect to Wi-Fi and send data.
Internet of Things (IoT)
How connected devices exchange data.
Open lesson →ESP32 and a Wi-Fi web server
Showing sensor values on a web page made by the ESP32.
I2C and SPI communication
Connecting displays and sensors over buses.
✎ A short example
Reading an analog sensor on pin A0 and printing it to the Serial Monitor.
int value = 0;
void setup() {
Serial.begin(9600); // start serial communication
}
void loop() {
value = analogRead(A0); // value from 0 to 1023
Serial.println(value);
delay(500); // pause of half a second
}
