ESP32

ESP32

I have been meaning to try the new ESP32 for quite a while and I finally got around to ordering them and trying them. As you may know, the ESP32 is the successor of the ESP8266 and the biggest addition, at least for me, is BLE, bluetooth low energy, support. So before I go into how I managed to get it to talk to several MiFloras, let’s first set it up to work with Arduino.

Of course it does not make sense to rewrite what others have done. I followed this article to set up Arduino to work with the ESP32.

When you’re done, read on.

What I could not find in the article is how to configure some of the settings in Arduino, so here is what I have and what works for me:

ESP32 settings

What also gave me some issues is getting the code to upload. As you can see in the picture above, I bought 2 different versions, a small one for which you have to solder the pins yourself and which has 2 buttons on the back and the ESP32 DEV module. Initially I could not get the code to upload to the ESP32 DEV module. When I tried the same for the samller module, it seemd to work. After some trial and error I figured out how to upload to the ESP32 DEV module as well. Tell Arduino to upload and after it is done compiling, it will show you:

esptool.py v2.3.1
Connecting........_______

This will continue and eventually you will get a timeout unless…. you press the button marked boot and hold it until Arduino starts uploading. Than you can let go. I don’t know why this is not needed for the smaller one and maybe it is a setting in Arduino which puts it in boot mode, similar to what could be done for the ESP8266. If I find it, I will update this article.

Now, you are all done and you want to start uploading some BLE sketches only to find it does not allow you to do so. Something about memory.  Luckily somebody already figured out what needs to be done. You need to change the partition size as described in this article. I choose method 3 but instead of creating a new type, I just updated the existing type (lazy, I know). I changed the following 2 files (Windows platform):

C:\Program Files (x86)\Arduino\hardware\espressif\esp32\boards.txt

and changed the following (marked in bold underline):

##############################################################

esp32.name=ESP32 Dev Module

esp32.upload.tool=esptool
esp32.upload.maximum_size=1966080
esp32.upload.maximum_data_size=294912
esp32.upload.wait_for_upload_port=true

esp32.serial.disableDTR=true
esp32.serial.disableRTS=true

and changed the file (path clipped to prevent scrolling):

C:\Pro...ino\hardware\espressif\esp32\tools\partitions\default.csv

to (full file):

# Name,   Type, SubType, Offset,  Size, Flags
nvs,      data, nvs,     0x9000,  0x5000,
otadata,  data, ota,     0xe000,  0x2000,
app0,     app,  ota_0,   0x10000, 0x1E0000,
app1,     app,  ota_1,   0x1F0000,0x1E0000,
eeprom,   data, 0x99,    0x3F0000,0x1000,
spiffs,   data, spiffs,  0x3F1000,0xF000,

So now you can upload your sketch and you might run into the next problem; either the ESP keeps rebooting and you get a message about brown out. There are people that stop brownout detection (see Google) but what worked for me, at least during development on the computer, change the cable to a better one. The cheap Chinese cables gave me brownouts while the more sturdy cables I had worked.

Next step…. using the ESP32 to talk to the Xiaomi MiFlora.

2 thoughts on “ESP32

  1. Hi have you tried passing the BLE received data to esp8266 then upload to the internet? Would really like to see if both device could work together to create an ideal IOT solution. 🙂

    Like

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s