While developing a pc- software for my arc4, I stumbled across a strange bug: Once many leds were lit, the encoders seemingly got stuck or produced random input data. This effect only appeared if more than 50% of the leds where on with 100% brightness.

My first guess was data corruption on the I2C bus that interconnects the boards. My idea was that the power supply voltage might drop just a tiny bit due to the power drawn from the leds - effectively corrupting the data on the bus (where the logical 1's are created by a pullup resistor only).

I probed it with a scope and could not find anything strange. I reduced the I2C pullup's resistance just a little bit to get a better rise time (changes are already in the files section). Overall I saw perfectly fine data transmissions happening on the bus. And I saw that the encoders produced data input, whenever the leds reached the critical brightness, even though the encoder was not touched in this moment.

This lead me to probe the encoder directly - and I found that once the leds where drawing enough power, the supply voltage would indeed drop and cause a mosfet to shut down. This mosfet was meant to switch the encoders power supply off when the arc is in USB stand-by mode, where the power consumption of the encoders is too high. Now when the supply voltage drops just a tiny little bit, it would cause that mosfet to block and shut down the power of the encoder.

The problem here was a mismatched resistor combo at the gate of the mosfet. It is actually a voltage devider where one end is connected to the power supply and the other end is connected to a pin of the micro controller. The center is then connected to the gate of the mosfet. When the microcontroller pin is set to high, the p-mosfet would be blocked (shutting the encoder down). When the pin is set to low, it should create a gate-source voltage high enough to make the mosfet conductive and turn on the encoder. This resistor combo was mismatched in a way that switched the mosfet on only a tiny little bit - enough to make the encoder work under no-load condutions. But not enough to stop it from shutting down, once the supply voltage drops a little.

Its just a matter of replacing a 1k resistor with a 10k (or higher) one. Really anything over 4.7k should work just fine - depending on the mosfet you're using.