-
Notifications
You must be signed in to change notification settings - Fork 83
NEO-M8U on I2C behavior is erratic with ESP-12F #121
Description
Subject of the issue
NEO-M8U module causes bus issues with other I2C devices, causes resets and general instability.
Your workbench
What development board or microcontroller are you using - ESP-12F ( Wemos D1 Mini)
What version of hardware or breakout board are you using - Sparkfun GPS Board (NEO-M8U)
How is the breakout board wired to your microcontroller - I2C lines, 3.3v supply capable of 800mA, hardwired via wirewrap pins & hookup wire for 3.3V, GND, SCL, SDA
How is everything being powered - USB 5V to onboard LDO (3.3v 800mA)
Are there any additional details that may help us help you - Will be using 3 devices on I2C bus.
Steps to reproduce
SETUP:
Install 3 I2C devices on Wemos D1 Mini; Sparkfun NEO-M8U, Sparkfun MAX30105 & Sparkfun BME680. Install libraries to connect and communicate with the devices. Remove jumper connections for I2C bus pull ups on two of three devices. Set up basic sketch to connect and poll sensors. Connect Serial monitor for output messages. (sketch to follow)
ISSUE:
Device behavior is erratic. Sometimes GPS module successfully connects, sometimes doesn't. (sometimes fresh boot works, resetting device via RESET pin does not). On reset, sometimes other I2C devices have connection issues. When GPS module removed, leaving 2 I2C devices connected, system initializes fine, and operates and resets as expected.
Sketch:
#include "SparkFun_Ublox_Arduino_Library.h" //http://librarymanager/All#SparkFun_Ublox_GPS
#include "heartRate.h"
#include <Wire.h>
#include "MAX30105.h"
#include "spo2_algorithm.h"
#include "Zanshin_BME680.h"
#include <ESP8266WiFi.h>
#include <ESP8266WebServer.h>
#include <EEPROM.h>
BME680_Class BME680; ///< Create an instance of the BME680 class
//BME60 I2C address = 0x77 (0x76 if jumper closed on bottom)
MAX30105 particleSensor;
//MAX30105 I2C address = 0xAF (read), 0xAE (write)? .h file says 0x57
SFE_UBLOX_GPS myGPS;
//GPS I2C address = 0x42
static int32_t temp, humidity, pressure, gas;
bool gpsEnabled, bme680Enabled, max30105Enabled = false;
void setup()
{
pinMode(MUX_SELECT, OUTPUT);
pinMode(A0, INPUT);
digitalWrite(MUX_SELECT, LOW);
Serial.begin(UART_SPD);
Wire.begin();
if(!BME680.begin(I2C_STANDARD_MODE)) // Start BME680 using I2C, use first device found
{
Serial.print(F("BME680 was not found. Please check wiring/power. "));
delay(1000);
bme680Enabled = false;
}
else
{
Serial.println("BME680 initialized successfully. ");
Serial.println("BME680 I2C address = 0x" + String(BME680.getI2CAddress(), HEX));
BME680.setOversampling(TemperatureSensor,Oversample16); // Use enumerated type values
BME680.setOversampling(HumiditySensor, Oversample16); // Use enumerated type values
BME680.setOversampling(PressureSensor, Oversample16); // Use enumerated type values
BME680.setIIRFilter(IIR4); // Use enumerated type values
BME680.setGas(320,150); // for 150 milliseconds
bme680Enabled = true;
}
if(particleSensor.begin() == false)
{
Serial.println("MAX30105 was not found. Please check wiring/power. ");
delay(1000);
max30105Enabled = false;
}
else
{
particleSensor.setup(); //Configure sensor. Use 6.4mA for LED drive
Serial.println("MAX30105 initialized successfully. ");
Serial.println("MAX30105 getRevisionID() = " + String(particleSensor.getRevisionID()) + ", getPartID() = " + String(particleSensor.readPartID()));
max30105Enabled = true;
}
if(myGPS.begin() == false) //Connect to the Ublox module using Wire port
{
Serial.println("u-blox NEO-M8U not found. Please check wiring/power");
delay(1000);
gpsEnabled = false;
}
else
{
Serial.println("u-blox NEO-M8U initialzied successfully.");
myGPS.setI2COutput(COM_TYPE_UBX); //Set the I2C port to output UBX only (turn off NMEA noise)
Serial.println("u-blox.IsConnected() = " + String(myGPS.isConnected(100)));
Serial.println("u-blox version = " + String(myGPS.getProtocolVersionHigh()) + "." + String(myGPS.getProtocolVersionLow()));
gpsEnabled = true;
}
}
}
void loop()
{
temp = 0;
humidity = 0;
pressure = 0;
gas = 0;
if(bme680Enabled)
{
BME680.getSensorData(temp,humidity,pressure,gas);
Serial.println("BME680 output: temp = " + String(temp) + ", humidity = " + String(humidity) + ", pressure = " + String(pressure) + ", gas + " + String(gas));
}
if(max30105Enabled)
{
Serial.println("MAX30105 R = " + String(particleSensor.getRed()) + ", G = " + String(particleSensor.getGreen()) + ", IR = " + String(particleSensor.getIR()));
}
if(gpsEnabled)
{
Serial.println("Latitude = " + String(myGPS.getLatitude()) + ", Longitude = " + String(myGPS.getLongitude()) + ", Altitude = " + String(myGPS.getAltitude()));
}
Serial.println("Analog Reading = " + String(analogRead(A0)));
digitalWrite(MUX_SELECT, !digitalRead(MUX_SELECT));
delay(5000);
}
}
2ND TEST
SETUP:
Removed all but the the GPS module from I2C bus on Wemos D1 Mini. Run Example3_GetPosition from Sparkfun u-blox Arduino library. No I2C pull up resistors on GPS module OR Wemos D1 Mini (as per Wemos schematic)
ISSUE:
Similiar behavior as before. Sometimes resets once or two on startup, then gets into loop and correctly functions. On system reset, never re-establishes connection.
3RD TEST
Same test as 2ND TEST, this time including an I2C device with pull ups, but not configured in firmware. Run Example3_GetPosition again. Similar behavior as 2ND TEST.
Expected behavior
Stable and reliable device operation when used on I2C bus with other devices installed.
Actual behavior
System operation is unstable and unreliable. Not usable in current form.