Tuesday, November 10, 2020

Wemos D1 mini reconnecting all the time to Arduino IDE

 Lately I've acquired some Wemos D1 mini from Amazon and I've noticed an annoying behavior.

Every 2,3 seconds a disconnect and a reconnect sound was produced making impossible any software development on them along with any debugging. 

The problem was a the 3V3 on the CH340C (USB to serial).

After I've added a 100uF capacitor on the 3V3 and not everything is fine again.



Saturday, March 28, 2020

I2C Scanner

Since always when I am working with I2C devices I need the scanner I will post here for me and for others:

#include <Wire.h>


void setup()
{
  Wire.begin();

  Serial.begin(115200);
  Serial.println(F("\nI2C Scanner"));

  byte error, address;
  int nDevices;

  Serial.println(F("Scanning..."));

  nDevices = 0;
  for(address = 1; address < 127; address++ )
  {

    Wire.beginTransmission(address);
    error = Wire.endTransmission();

    if (error == 0)
    {
      Serial.print(F("I2C device found at address 0x"));
      if (address<16)
        Serial.print("0");
      Serial.print(address,HEX);
      Serial.println(F("  !"));

      nDevices++;
    }
    else if (error==4)
    {
      Serial.print(F("Unknow error at address 0x"));
      if (address<16)
        Serial.print(F("0"));
      Serial.println(address,HEX);
    } 
  }
  if (nDevices == 0)
    Serial.println(F("No I2C devices found\n"));
  else
    Serial.println(F("done\n"));

}


void loop()
{}