
The ESP32 microcontroller has Bluetooth built directly into the chip, eliminating the need for a separate external module like the HC-05 to set up a simple wireless connection between a mobile phone and the control board.
Components needed
An ESP32 board, an LED with a 220-ohm resistor, and an Android phone with a serial Bluetooth terminal app.
Wiring it up
The LED connects to a digital pin through a 220-ohm resistor, and no extra wiring is needed for Bluetooth since it's built into the ESP32 chip itself.
How it works
The code relies on the BluetoothSerial library, included by default with ESP32 board support in the Arduino IDE, which enables Classic Bluetooth mode that mimics a regular serial connection. A Bluetooth object is created and given a distinct name (such as ESP32_LED_Control) that shows up when searching for it from the phone. Once paired, the code continuously watches for incoming data — if it receives the text value "1", it turns the LED on, and if it receives "0", it turns it off. These values can be sent directly from any Bluetooth terminal app on the phone with no custom app required.
The difference from the HC-05
ESP32's built-in Bluetooth offers lower power consumption and support for newer protocols compared to traditional HC-05 modules, while keeping the same simple serial communication pattern programmers are used to.
You can find ESP32 boards at Juthour Tech.
اترك تعليقا