I was going through the ESP32 BLE client/Server module again and on the client-oled side. While looking at the Serial Monitor, I’m seeing/getting this error and it constantly reboots:
rst:0xc (SW_CPU_RESET),boot:0x13 (SPI_FAST_FLASH_BOOT)
configsip: 0, SPIWP:0xee
clk_drv:0x00,q_drv:0x00,d_drv:0x00,cs0_drv:0x00,hd_drv:0x00,wp_drv:0x00
mode:DIO, clock div:1
load:0x3fff0018,len:4
load:0x3fff001c,len:808
load:0x40078000,len:6084
load:0x40080000,len:6696
entry 0x400802e4
Guru Meditation Error: Core 1 panic’ed (IntegerDivideByZero). Exception was unhandled.
Core 1 register dump:
PC : 0x400d7c2b PS : 0x00060730 A0 : 0x800d6614 A1 : 0x3ffd5df0
A2 : 0x3ffc10c4 A3 : 0x00000000 A4 : 0x02625a00 A5 : 0x00000015
A6 : 0x00000000 A7 : 0x3ffc10c4 A8 : 0x8008f142 A9 : 0x3ffd5dd0
A10 : 0x00000001 A11 : 0x00000038 A12 : 0x00000001 A13 : 0x00000001
A14 : 0x00060720 A15 : 0x00000000 SAR : 0x00000010 EXCCAUSE: 0x00000006
EXCVADDR: 0x00000000 LBEG : 0x4000c46c LEND : 0x4000c477 LCOUNT : 0x00000000
Backtrace: 0x400d7c2b:0x3ffd5df0 0x400d6611:0x3ffd5e10 0x400d6b6e:0x3ffd5e30 0x400d19d5:0x3ffd5e60 0x4018b05a:0x3ffd5ec0
Rebooting…
The only change to your original code (BLE_CLIENT_OLED.ino) was to comment out line 13: // #define temperatureCelsius to match the server side.
It says there is an unhandled exception but I don’t know where or what it is. The sketch compiled and loaded without issue.
UPDATE: I was looking at “ESP32 OLED SSD1306 issue” from 5 days ago and it looks like the same issue, but with a different script, though both are using an OLED display.
Thanks for letting me know. I’ve updated these sketches 3 days ago to work with the latest OLED library. Please make sure you use the latest BLE_CLIENT_OLED.ino file:
I’ve also updated a LoRa receiver example that uses the OLED display:
Those two new examples fixes the problems with the OLED display causing that error.
Thanks for letting me know!
OK. I updated the sketch and re-ran everything. I can see the server sending out the date and the client receive, but the received is not right and I don’t know which side the issue is coming from.
In the Serial Monitor for the server i see:
Temperature Fahrenheit: 77.90 *F – Humidity: 38.20 %
but on the client side (in the serial monitor) I see:
We are now connected to the BLE Server.
Temperature: 77.90⸮⸮⸮?Z⸮⸮⸮⸮⸮? *F Humidity: 38.20⸮⸮⸮?Z⸮⸮⸮⸮⸮? %
and the display on the OLID is just noise.
I’m guessing on the client side the issue is the extra characters are causing the noise, but is it being sent from the server or is the packet too big and has filler data or is the client not properly filtering the data (ex. only using the first 4 characters of the number – 77.36 for example).
Using the nRF sniffer i can see a value of (0x) 20-33-39-2E-35-30, “39.50” for the humidity and (0x) 20-37-37-2E-33-36, “77.36” for the temperature if that helps.
As an aside question, how is the data encoded? It doesnt seem to be hex
Just to clarify. Are you using my exact script? Can you place a link to the Github code that you’re using?
In the BLE server, it should print something like this in your serial monitor…
Temperature: 77.90 *F
Humidity: 38.20 %
Thanks!
I don’t have a GitHub account, but it’s your exact code. I downloaded new copies of both the client and server from your GitHub link just now and when I ran it, I got this in the serial monitor:
rst:0x1 (POWERON_RESET),boot:0x13 (SPI_FAST_FLASH_BOOT)
configsip: 0, SPIWP:0xee
clk_drv:0x00,q_drv:0x00,d_drv:0x00,cs0_drv:0x00,hd_drv:0x00,wp_drv:0x00
mode:DIO, clock div:1
load:0x3fff0018,len:4
load:0x3fff001c,len:808
load:0x40078000,len:6084
load:0x40080000,len:6696
entry 0x400802e4
Starting Arduino BLE Client application…
Device found. Connecting!
– Connected to server
– Found our characteristics
We are now connected to the BLE Server.
Temperature: 71.42⸮⸮⸮? 2y ⸮⸮⸮? *F Humidity: 36.20⸮⸮⸮? 2y ⸮⸮⸮? %
Temperature: 71.42⸮⸮⸮? 2y ⸮⸮⸮? *F Humidity: 49.00⸮⸮⸮? 2y ⸮⸮⸮? %
The display is garbage.
The only change to your code was commenting out line 13 to display in F. I then tried it again without commenting out line 13:
We are now connected to the BLE Server.
Temperature: 24.30⸮⸮⸮?⸮7ud⸮⸮⸮? *C Humidity: 48.80⸮⸮⸮?⸮7ud⸮⸮⸮? %
Temperature: 24.30⸮⸮⸮?⸮7ud⸮⸮⸮? *C Humidity: 48.80⸮⸮⸮?⸮7ud⸮⸮⸮? %
The server side in the Serial Monitor shows:
Temperature Celsius: 24.60 *C – Humidity: 40.80 %
I even changed out the DHT22 on the server and the OLED and there was no change
Hello, I’m sorry for taking so long to get back to you, but I could only re-test the project today.
After re-installing the ESP32 add-on and all the required libraries, I was able to reproduce your error.
Here’s why the OLED wasn’t working:
- In the previous code showed in the course, we were printing the sensor readings in display on the callback function that received the BLE reading. That callback function runs in a core that can’t be used with the display.
I’ve updated the code and it’s now working with the latest libraries updates.
Can you try the following code?
https://github.com/RuiSantosdotme/ESP32-Course/blob/master/code/BLE_Client_OLED/BLE_Client_OLED.ino
Let me know if it also works for you! Thanks for your patience.
Thank you for the updated code. It still didn’t work properly, but it was closer. I could see the correct values but still displayed a lot of garbage after the numbers.
However, I did some research on variable types and print syntax and came up with the following changes which work perfectly for me:
In the variables definition (around line 53) I added two new variables:
//Variables to store temperature and humidity
char* temperatureR;
char* humidityR;
float tem;
float hum;
Around line 109 I added a type conversion to go from char* to a float:
//store temperature value
temperatureR = (char*)pData;
newTemperatureR = true;
tem = atof(temperatureR);
And another around line 118:
//store humidity value
humidityR = (char*)pData;
newHumidityR = true;
hum = atof(humidityR);
Then in the printDHTReadings() function starting around line 125 I made the following changes:
//display temperature
display.setCursor(0,20);
// display.println(temperatureR);
display.print(“Temperature: “);
display.print(tem);
Serial.print(“Temperature:”);
// Serial.print(temperatureR);
Serial.print(tem);
And these changes around line 150:
//display humidity
display.setCursor(0,40);
// display.println(humidityR);
display.print(“Humidity: “);
display.print(hum);
display.print(“%”);
display.display();
Serial.print(” Humidity:”);
// Serial.print(humidityR);
Serial.print(hum);
Serial.println(“%”);
Recompiled and restarted everything and the garbage was gone and readings were now readable!
Thank you for your assistance getting this issue figured out.