My ESP32 Thing Plus works fine when I download from the Arduino IDE on my Windows machine. But I want to work from my Ubuntu Linux machine where I’m setting up an MQTT broker for home automation.
Here’s an example of the problem. This program works fine from the Windows IDE.
void setup()
{
Serial.begin(115200);
delay(100);
}
void loop()
{
Serial.println(“Hello, world!”);
delay(500);
}
The Serial monitor repeats “Hello World” as it should.
But on the Ubuntu machine the output on the Serial monitor is gibberish.
⸮⸮nnoc⸮o|p⸮l⸮⸮noob⸮o|p⸮l
⸮⸮noob⸮n|p⸮l⸮⸮onob⸮o|p⸮l
⸮⸮nnnb⸮
I know it looks like I’m using the wrong baud rate but the baud rate is correct, 115200.
I learned from a posting by anonymous_esp32 that I can temporarily fix the issue by pressing the reset button on the ESP32 Thing Plus board.
I also learned that I can fix the problem by including a call to the WiFi library. Here’s an example.
#include “WiFi.h”
void setup()
{
Serial.begin(115200);
WiFi.mode(WIFI_STA);
delay(100);
}
void loop()
{
Serial.println(“Hello, world!”);
delay(500);
}
This prints out “Hello World” the way it should. For some reason the statement WiFi.mode(WIFI_STA); resets the serial output from the Thing so it matches the Serial monitor. This is better than having to press the reset button but it’s annoying to have to include an otherwise unused statement to fix this bug.
Does anyone have an idea of what’s going on here?
Did you try checking the serial output on the Windows computer with that first script? Did you try hitting reset to see if that helped? If it isn’t the baudrate, maybe its an offset in the bits being read and you just need to reset the connection.
Do the instructions from the board’s guide and first example work? https://learn.sparkfun.com/tutorials/es … mple-blink
Printing to the IDE serial monitor works fine on the Windows machine for all examples using the Sparkfun ESP32 Thing Plus or the Espressif ESP32 Dev Module.
Using the Arduino IDE (1.8.15) on my Ubuntu 20.04.3 LTS desktop (64 bit Xeon, 3.5 GHz, 15.6 GiB memory) I can run ESP32 examples on the ESP32 DEV Module and they print to the serial monitor fine.
When I use the ESP32 Thing Plus, the WIFI scan example works fine and prints to the IDE serial monitor (115200 baud), but the Blink example won’t print properly to the serial monitor unless I include a call to the WIRE library (which I don’t need) or press the reset button on the board.
An offset in the bits seems reasonable but why would adding a WiFi.mode command in setup make it all start working? And only on the ThingPlus? And how can I fix it.
I really want to use the ESP32 Thing Plus for monitoring temperatures around my house because the onboard battery and Qwiic I2C connectors allow me to plug in a battery and temperature and humidity sensors with no soldering in a really small package that talks on WiFi to my MQTT server. I can still do this because I’ll always include the WiFi.command and I only use the serial monitor during initial programming. But it bothers me starting a project using hardware that has errors I don’t understand.
It makes me wonder what else may not work. And I don’t know if it’s a Sparkfun problem or an Ubuntu Linux problem. The fact that you can temporarily fix the problem by pressing reset on the board makes it sound like a ThingPlus problem but why only on Ubuntu, not Windows.
Do you know of anyone successfully using the ESP32 Thing Plus with the Arduino IDE on a Ubuntu box?
From you statement:
When I use the ESP32 Thing Plus, the WIFI scan example works fine and prints to the IDE serial monitor (115200 baud), but the Blink example won’t print properly to the serial monitor unless I include a call to the WIRE library (which I don’t need) or press the reset button on the board.
It sounds like using the reset button works, which is the usual solution to that issue. Reprogramming the board would also work because it triggers a board reset once the programming is complete, but isn’t necessary.
I would recommend having the Serial Monitor up and hit the reset button to capture the debug statements. That has been the most reliable solution for me in the past. I usually get the offset issue when the Serial Monitor is opened while serial data is already streaming; that’s when the IDE has to possibility to start reading data in the middle of a byte.
Including the other libraries shouldn’t affect anything. My guess is that you might have the Serial Monitor already up and when the board resets after programming, it is reading the serial data properly (similar to my solution above).