Hi Everyone, I am building a weather station and I am having a problem using the serial monitor with the BMP280 temp/barometer and my ESP32. Seems the serial monitor will not work properly. I did some googling and I haven't been able to find anything worth while on this issue. I am getting the following error when I open the serial monitor:
Yes you posted in installation and troubleshooting, it says in the forum description not for your project.
That section is all about installation and troubleshooting of the IDE, not your project.
Personally I think that section is badly named. About 10 to 20 posts a day fall foul of posting about their project in that section, but still the forum software guardian refuse to change it.
I'm sorry, I don't know what you mean by I2C scanner. In my search for info on the web I recall seeing someone else mention the I2C scanner but I guess I don't understand the significance of it. I just started working with the ESP32. First project. I'll look in to the I2C scanner.
In the meantime i just found a video on serial communications and the ESP32. Seems there are a few different ways the ESP can communicate and this can be set programatically. This video is by Andreas Spiess. I like that guy... Anyways, I digress..
In the video he tries to demonstrate writing a message to serial by all serial paths. Interestingly enough, one of the paths he is getting the exact same error message as I am getting.. Hmmm.....
I will do some research on I2C scanners and what they do. I am connecting this thru I2C of course.
// ---------------------------------------------------------------- /
// Arduino I2C Scanner
// Re-writed by Arbi Abdul Jabbaar
// Using Arduino IDE 1.8.7
// Using GY-87 module for the target
// Tested on 10 September 2019
// This sketch tests the standard 7-bit addresses
// Devices with higher bit address might not be seen properly.
// ---------------------------------------------------------------- /
#include <Wire.h> //include Wire.h library
void setup()
{
Wire.begin(); // Wire communication begin
Serial.begin(115200); // The baudrate of Serial monitor is set in 9600/ 115200 for ESP32
while (!Serial); // Waiting for Serial Monitor
Serial.println("\nI2C Scanner");
}
void loop()
{
byte error, address; //variable for error and I2C address
int nDevices;
Serial.println("Scanning...");
nDevices = 0;
for (address = 1; address < 127; address++ )
{
// The i2c_scanner uses the return value of
// the Write.endTransmisstion to see if
// a device did acknowledge to the address.
Wire.beginTransmission(address);
error = Wire.endTransmission();
if (error == 0)
{
Serial.print("I2C device found at address 0x");
if (address < 16)
Serial.print("0");
Serial.print(address, HEX);
Serial.println(" !");
nDevices++;
}
else if (error == 4)
{
Serial.print("Unknown error at address 0x");
if (address < 16)
Serial.print("0");
Serial.println(address, HEX);
}
}
if (nDevices == 0)
Serial.println("No I2C devices found\n");
else
Serial.println("done\n");
delay(5000); // wait 5 seconds for the next I2C scan
}
But when I loaded it on my ESP32S and opened up my Serial Output I see the same message as before... ????
Also, I tried to compile the sketch from Andries Spiess (video #152) to see if the serial port was somehow different but I cannot get this sketch to compile on my board of course... The code is below:
/*
This sketch is to determine which serial communication is working on the ESP32 chip
*/
HardwareSerial Serial1(1);
HardwareSerial Serial2(2);
void setup()
{
Serial.begin(115200);
Serial1.begin(115200);
Serial2.begin(115200);
}
void loop()
{
Serial.println("This message is sent from USB Serial");
Serial1.println("This message is sent from USB Serial1");
Serial2.println("This message is sent from USB Serail2");
delay(2000);
}
Any help would be greatly appreciated.
Thanks,
Chris
Yes, I can upload other sketches and the serial works as well. I just uploaded and tested the sample sketch to get the MAC Address of the ESP32 and it worked fine. I was able to read the Serial data with no issue.
/*
This sketch is to determine which serial communication is working on the ESP32 chip
*/
//HardwareSerial Serial1(1);
//HardwareSerial Serial2(2);
void setup()
{
Serial.begin(115200);
//Serial1.begin(115200);
//Serial2.begin(115200);
}
void loop()
{
Serial.println("This message is sent from USB Serial");
//Serial1.println("This message is sent from USB Serial1");
//Serial2.println("This message is sent from USB Serail2");
delay(2000);
}
?
What happens when you
/*
This sketch is to determine which serial communication is working on the ESP32 chip
*/
HardwareSerial Serial1(1);
//HardwareSerial Serial2(2);
void setup()
{
Serial.begin(115200);
Serial1.begin(115200);
//Serial2.begin(115200);
}
void loop()
{
Serial.println("This message is sent from USB Serial");
Serial1.println("This message is sent from USB Serial1");
//Serial2.println("This message is sent from USB Serail2");
delay(2000);
}
I don't think so. This sketch was to check from where the serial is communicating. I thought this might possibly be the reason why the sketch with the BMP280 was not working so I tried it. Seems like the Serial is fine because all other sketches I've tried worked fine. Weird... I don't understand why the BMP280 is having a problem. I ran the sketch with the BMP280 removed from the breadboard and the serial worked, giving me the message "BMP280 not found. Check wiring".
Well I discovered what is up with my ESP32. I ordered a few of them at different times, thus have 2 different boards. I realized the pins on the first 32 have like 40 pins on it and the 2nd one has 30 (which matches the pinout I have for the ESP32) I didn't notice the pin count did not match the first one. So now I am working thru figuring out my issue connecting to my router but I'm pretty sure I got the issue with the serial monitor sorted. Once I get this thing on my network and displaying values from the BMP280 I will let ya know.
Thanks for your help. I appreciate it. Now to find the pinout for that specific ESP with 40pins....