Your new topic does not fit any of the above??? Check first. Then post here. Thanks.

Moderator: igrr

User avatar
By schufti
#25878 ok,
I will try to hook up diverse other i2c components and see if i2c-scanner will detect them.
Maybe someone with working i2c components can check if i2s-scanner detects them.
IMHO i2c-scanner is a must as first aid tool in case of i2c trouble if one doesn't own a reliable logic analyser.
You sure won't be able to get your initialisation of a device right if i2c can't detect it in the first place.

The use of "SoftwareWire" was simply to rule out significant timing problems. The orig. wire lib on Arduino make use of the hw i2c sequencer in the ATMEGA implemeted compliant with philips i2c. SoftwareWire is AFAIK more relaxed ...

schufti

and yes, I made sure that the correct lib is used
User avatar
By gcarmich
#25901 Are you setting the correct pins for Wire.begin(), the documentation says it defaults to 4(SDA) and 5(SCL). Defaults do now appear to work on the latest staging version, I'm not sure they did in the past.

If using ESP-01 you need Wire.begin(0, 2);
User avatar
By martinayotte
#25918 If you are using a very old version, there was a bug when not using default pins.
check the file in libraries/Wire/Wire.cpp, verify the following constructor :
Code: Select allvoid TwoWire::begin(int sda, int scl){
  default_sda_pin = sda; // this line is the bug fix !
  default_scl_pin = scl; // this line is the bug fix !
  twi_init(sda, scl);
  flush();
}
User avatar
By schufti
#25954 Hi,
thanks for the suggestion, but I allways try to avoid "defaults" (they may change or be incompatible with my projects) so am used to set values where possible (even if they are the defaults, just for documentation).

Meanwhile I got a small OLED (SSD1306) working that was on my workbench, still have too search for other parts (btw, I2C-scanner is working and found the display).

No idea why the temp/hum sensor won't even show up in scanner on esp8266. But it is working with DHT_lib on esp8266 and I2C/DHT on ATMEGA...