Optimal I2C pullup resistors
-
@dnear1 Hmm. I would still suspect the code fails to generate a valid Stop condition before starting the next addressing cycle. Maybe the problem is hidden at the end of dew_point() ?
Hook up a scope if possible and check for a valid start condition. That would also ease the problem of choosing good pull up resistors without wasting too much power. -
Digging further into my issues, it seems if I stuff a print(i2c.scan()) before I read an i2c device, it will reliably succeed;
if I don't , this is what i see on the scope.
So my guess is the pullup is too strong?
-
I seem to get identical results regardless if I use a 1.5k, 4.7k or 6.8k resistor for the pullups.
-
@dnear1 Check the GND connection between the LoPy4 and the sensors, and also the oscilloscope. It looks like there is some inductivity in the way.
-
@robert-hh I'll try to shorten/redo the connections when I get a chance in the next few days.

Ignore the wire colors, especially for the ribbon wire. The wires are organized by the color of the heat shrink tubing.
The Arduino board has the Atmega removed and is just being used to supply 5v to the Pycom and 3.3v to the sensors. The 3v3 output from the Pycom is unattached. Both share a common ground via two wires connected to the Arduino GND pins.
My design was constrained by the short length of the Pycom LoRa antenna cable and trying to make the sensor shields removable/serviceable. -
@dnear1 This wiring looks like calling for trouble. Especially breadboards have sometimes lousy connections. For anything but desktop test setups, better use soldered or at least screwed connections.
-
@robert-hh
I was hoping to resolve issues before spending time designing/building a PCB. I never had issues like this just using an Arduino Mini with solderless breadboards.I made new I2C wires with individual 24awg 7/32 strand, and wrapped a ground lead around the SCL and SDA pins separately, and did a daisy-chain configuration from the first sensor to the second. That alone didn't help.
I started soldering together a test board that can draw power from a POE injector, since this will eventually get mounted on the roof, 4 stories up. This is as far as I got. The top PSU will feed 5.5v to the Pycom and the right-most will give 3.3v to the I2C sensors. It's assembled and the power supplies tested but needs to be swapped into the enclosure.

-
Could the pullups built into the sensors have been the problem all along?
I was using a 3v3 IO so I only had 3v3 connected. On one of my assemblies, all 3 sensors (Adafruit HTU21d, Adafruit MPL3115A2 and adafruit TSL2561 breakout boards have these 10k pullups and the level shifter.
I soldered a jumper from 3v3 to vin on all 3 and removed the pullups below the Pycom, and things seem a lot cleaner..
-
@dnear1 Th elowest suitabel value of the pull-up resistors depends only on how much current the driving device can sink. For the ESP32 (20 mA) that would be ~165 Ohm, for the sensors you have to look in their data sheet. Per data sheet, pull-up resistors at the I2C bus can get down to ~1 kOhm. With all the 10k's and a voltage of 3.3 V it will be effetively ~1.7 kOhm. Even if that is not a problem, it cause higher currents in the GND line. And the Oscilloscope picture you showed indicated such a problem. Removing some of the transistors reduces the impact of the problem, but is not the cause.
-
@robert-hh Actually, I scoped it with the Vin and 3v0 pins tied together at 3v3 and both with/without the 1.7k pull-up on the main board, I was getting a clean signal with full swings from the start. Not only that, but I was able to increase the I2C speed from the meek 9600 baud to 100,000 baud without issues.
-
@dnear1 So what was the issue then with the scope diagram below: https://forum.pycom.io/topic/4263/optimal-i2c-pullup-resistors/5
That one does not look well.
Hello! It looks like you're interested in this conversation, but you don't have an account yet.
Getting fed up of having to scroll through the same posts each visit? When you register for an account, you'll always come back to exactly where you were before, and choose to be notified of new replies (either via email, or push notification). You'll also be able to save bookmarks and upvote posts to show your appreciation to other community members.
With your input, this post could be even better 💗
Register Login