0

I have a rig with 5 light sensors on an I2C mux and I am wondering if I need only 1 pull-up resister set for the whole bus or one on each branch from the mux?

Or should I remove all the pull-ups from the branches and leave the one on the mux?

My issue is that the Arduino softlocks after 5-60 min of running, and it always softlocks on a read lux call.

2

From what I can tell, the I2C bus multiplexer itself receives and re-transmits on what amounts to a completely separate bus. So, each bus would need its own pull-up resistors. That said, the board you've linked that breaks out the multiplexer chip has pull-up resistors on each bus that it's providing:

Excerpt of Sparkfun Multiplexer breakout showing bus pull-up resistors on far side of multiplexor.

The breakout also has pull-ups on the bus going to the multiplexor itself:

Excerpt of Sparkfun Multiplexer breakout showing bus pull-up resistors on near side of multiplexor.

Beyond that, the ambient light sensor breakout seems to provide its own 4.7K pull-ups. AVR-based Arduinos (and probably others) also enable their own, admittedly weak, pull-ups in the guts of the wire library.

It seems you should not necessarily need to add any additional pull-up resistors of your own to what is already on the buses.


With regard to the O.P. comment given below concerned about too many pull-up resistors.

At some point probably below (perhaps far below) 500 ohms some devices may have trouble sinking enough current to create a LOW. The AVR wouldn't have a problem with 500 ohms for example.

The ATMega328P datasheet (along with most other AVR datasheets) will tell you that the internal pullup value is between 20K-50K. If you're concerned about too-many-parallel-resistors/too-many-current-paths/too-little-total-resistence, you can take the 20K figure along with multiplexer breakout's 4.7K figure, to calculate pow(1 / 20e3 + 1 / 4.7e3, -1), for about 3.8K, which should be fine. If you do the same calculation on the multiplexor's individual bus resistor 4.7k and the ambient light sensor breakout's own 4.7k resistor, you get 2.35 k (half), which is also probably fine. If anything both of these total figures can be made smaller (by adding yet another parallel resistor) for longer buses and at higher frequencies. If you're worried about these figures you can lower the I2C clock rate. You can also examine the edges of your signal with a scope. Also if you really want to dig into this stuff, you read in the official I2C manual. But, really I think what you have is probably fine.

3
  • but do i have too many pull up resistors? i thought i am supposed to only have 1 set? should i remove the ones on the lux sensors then? May 22 at 14:22
  • 1
    I've converted the bulk of my previous (now deleted) comment, addressing yours, into an addition on the answer.
    – timemage
    May 22 at 15:00
  • Try replacing some of the bulk 1.0uF caps with something in the 10 - 100 nF range to add high frequency bypassing.
    – Gil
    May 23 at 1:34

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.