I2C - Clock looks OK, Data line has DC Bias - Page 1
Forum section: electronics / beginners

author: optoisolated
author_rank: Unknown
timestamp: July 11, 2019, 01:31:14 pm
content: Hi All,This ones confusing me... I have a simple I2C circuit trying to drive a 128x32 OLED Display. Worked fine when I prototyped it on an Arduino, moved it to a Wemos D1 Mini, no good. Checked the signal on an oscilloscope, realised I had forgotten to pull the lines high. Put 3K3 resistors on the data and clock lines. Clock line looks good now. The data line however doesn't look right.Instead of having a full 0-5V it's ~3-5V, on the high side. Any idea what I'm missing here?Thanks(I'm assuming a lot of the noise and overshoot is from the excessive loop area from the test leads.)

author: AndyC_772
author_rank: Super Contributor
timestamp: July 11, 2019, 01:47:11 pm
content: Looks like the data line is shorted to a logic signal that's high, so the high level is OK but the low level is only halfway to where it should be.As an experiment, try putting an additional 3k3 resistor between SDA and GND. This should, in theory, create a potential divider that puts it at ~2.5V. My guess is it'll remain high.

author: optoisolated
author_rank: Unknown
timestamp: July 11, 2019, 02:20:43 pm
content: Had a dig around and couldn't see any shorts. I replaced the resistors, and tried a new Wemos D1. Didn't seem to help. I did try what you suggested with the divider, and it does bring down the high level.

author: garethw
author_rank: Regular Contributor
timestamp: July 11, 2019, 02:48:54 pm
content: Next I would be disconnecting the wires from the Wemos and probing each side to determine where the 3.3v is coming from.Sent from my iPhone using Tapatalk

author: ledtester
author_rank: Super Contributor
timestamp: July 11, 2019, 02:52:43 pm
content: This guy got it working - blog post also shows his setup:https://blog.hau.me/2018/12/26/i2c-oled-display-on-a-wemos-d1-mini/Another idea... here is an i2c bit-banging Arduino library. You can try using some other IO pins to see if that makes a difference:https://github.com/Testato/SoftwareWireThe library has a printStatus() method. #define ENABLE_I2C_SCANNER on line 60 and it will perform a device scan when called.

author: garethw
author_rank: Regular Contributor
timestamp: July 11, 2019, 02:59:37 pm
content: Thinking about it a bit more I would think that the pin is configure for push/pull instead of open drain. A short on the line will simply be shorted to ground if that were the case.Sent from my iPhone using Tapatalk

author: optoisolated
author_rank: Unknown
timestamp: July 11, 2019, 03:03:24 pm
content: I think you're on the right track. It seems that the Adafruit library doesn't work properly on the Wemos D1. I switched to the generic SSD1306 library which allows me to use alternate pins for the I2C. using D3 and D5 works a treat. Thanks for your help

author: optoisolated
author_rank: Unknown
timestamp: July 12, 2019, 08:41:19 am
content: Changed the I2C pins to D3 and D5. Bingo, I2C bus works now. Pretty sure that the issue is that the Wemos D1 mini module I am using is actually a ESP8266MOD and pin D1 is actually used as as an Active High boot inhibit for flashing with the USB Interface. I noticed during testing that I needed to pull that pin low to make it boot on power up, so a bit more digging led me to that that module actually uses D3 and D5 for SDA and SCL.It all makes sense now.Thanks so much for your help