4) Search for ESP32 and press install button for the “ESP32 by Espressif Systems“:

5) That’s it. It should be installed after a few seconds.

2. Deleting the espressif folder

If this is your first time installing the ESP32 on Arduino IDE you can ignore this section. If you’ve followed the older installation procedure and you’ve manually installed the ESP32 add-on with Git GUI, you need to remove the espressif folder from your Arduino IDE.

6) Press the Upload button in the Arduino IDE. Wait a few seconds while the code compiles and uploads to your board.

7) If everything went as expected, you should see a “Done uploading.” message.

8) Open the Arduino IDE Serial Monitor at a baud rate of 115200:

9) Press the ESP32 on-board Enable button and you should see the networks available near your ESP32

Done!

ESP32 Pinout

The ESP32 has more GPIOs with more functionalities compared with the ESP826. With the ESP32 you can decide which pins are UART, I2C, or SPI – you just need to set that on the code. This is possible due to the ESP32 chip’s multiplexing feature that allows to assign multiple functions to the same pin. If you don’t set them on the code, the pins will be used as default

Version with 30 GPIOs

Version with 36 GPIOs

What is Bluetooth Low Energy?

Bluetooth Low Energy, BLE for short, is a power-conserving variant of Bluetooth. BLE’s primary application is short distance transmission of small amounts of data (low bandwidth). Unlike Bluetooth that is always on, BLE remains in sleep mode constantly except for when a connection is initiated.

This makes it consume very low power. BLE consumes approximately 100x less power than Bluetooth (depending on the use case).

Take a look at the table below that compares BLE and Bluetooth in more detail.

ESP32 BLE Tutorials

BLE with ESP32

The ESP32 can act as a BLE server or as a BLE client. There are several BLE examples for the ESP32 in the ESP32 BLE library for Arduino IDE. This library comes installed by default when you install the ESP32 on the Arduino IDE.

In your Arduino IDE, you can go to File > Examples > ESP32 BLE Arduino and explore the examples that come with the BLE library.

Note: to see the ESP32 examples, you must have the ESP32 board selected on Tools > Board. and Select correct port.

You can leave the default UUIDs, or you can go to uuidgenerator.net to create random UUIDs for your services and characteristics.

In the setup(), it starts the serial communication at a baud rate of 115200.

Serial.begin(115200);

Then, you create a BLE device called “MyESP32”. You can change this name to whatever you like.

// Create the BLE Device
BLEDevice::init("MyESP32");

In the following line, you set the BLE device as a server.

BLEServer *pServer = BLEDevice::createServer();

After that, you create a service for the BLE server with the UUID defined earlier.

BLEService *pService = pServer->createService(SERVICE_UUID);

Then, you set the characteristic for that service. As you can see, you also use the UUID defined earlier, and you need to pass as arguments the characteristic’s properties. In this case, it’s: READ and WRITE.

After creating the characteristic, you can set its value with the setValue() method.

pCharacteristic->setValue("Hello World says Neil");

In this case we’re setting the value to the text “Hello World says Neil”. You can change this text to whatever your like. In future projects, this text can be a sensor reading, or the state of a lamp, for example.

Finally, you can start the service, and the advertising, so other BLE devices can scan and find this BLE device.

This is just a simple example on how to create a BLE server. In this code nothing is done in the loop(), but you can add what happens when a new client connects (check the BLE_notify example for some guidance).

ESP32 BLE on Arduino IDE with UART Test | ESP32 BLE tutorials

Flash this code in ESP32 Board

/*
Create a BLE server that, once we receive a connection, will send periodic notifications.
The service advertises itself as: 6E400001-B5A3-F393-E0A9-E50E24DCCA9E
Has a characteristic of: 6E400002-B5A3-F393-E0A9-E50E24DCCA9E - used for receiving data with "WRITE"
Has a characteristic of: 6E400003-B5A3-F393-E0A9-E50E24DCCA9E - used to send data with "NOTIFY"
The design of creating the BLE server is:
1. Create a BLE Server
2. Create a BLE Service
3. Create a BLE Characteristic on the Service
4. Create a BLE Descriptor on the characteristic
5. Start the service.
6. Start advertising.
In this example rxValue is the data received (only accessible inside that function).
And txValue is the data to be sent, in this example just a byte incremented every second.
*/

ESP32 BLE with DHT11 | ESP32 BLE tutorials

The program basically sets the UUID of the UART communication service, it reads the humidity and temperature of the DHT sensor, and transmits this data to the application on the mobile phone. Data is sent in a single variable, but in a CSV format, with temperature and humidity separated by a comma.

In summary, in this tutorial we’ve shown you ESP32 BLE Tutorials | How to use ESP32 with BLE with Arduino IDE. I hope you like this ESP32 BLE Tutorials post. Do you have any questions? Leave a comment down below!

Thanks for reading. If you like this post probably you might like my next ones, so please support me by subscribing my blog.

About Us

IoTbyHVM.OOO is an attempt to help the people by sharing the knowledge and ideas about Internet of things and other technology related articles and videos. IoTbyHVM.OOO provides articles related to Arduino, Raspberry Pi, use of all general purpose sensors, circuits, home automation, drones, smart TV, voice control TV , Micro Controller etc. for DIY (Do it Yourself) purpose.

If you want to help support me on my journey, consider sharing my articles, or Buy me a Coffee!

Subscribe to Blog via Email

Enter your email address to subscribe to this blog and receive notifications of new posts by email.