PCF8574 issue during booting

Hi, i am using Multirelay with PCF8574 on P0…8 which works really fine, but during the boot all outputs are high for one second only. After the boot everything is working fine.

Is there any possibility to avoid that?

Thanks,
Tom

Something in the power up sequence is defaulting the relay output(s) to Hi or Low, while the finished boot sequence corrects the issue. I haven’t played with that code much, but I do note there’s an option for active high or active low.
I believe that gives you the option of connecting your relays from the control pin to either Vcc or Ground.

You could try reversing that option and change the physical connection of your relay(s) to the opposite of what you’re using now.

I am driving the relays via an ULN similar like below, but the opposite side (relay between Q1 and GND doesn’t work at all.

5cf67483a018ae46b3883fabe0ce5297bb7c4931_2_690x3561

You’re using low side drivers (ULN28093) to connect the relays to 12V.
You would have to switch to a high side driver (UDN2982) to connect the relays to GND.

But looking at your schematic, I don’t think that will help either. The ~1sec “on” time will end up being applied anyway.

A more likely solution would be to put a tri-state buffer between the PCF8574 outputs and the ULN2803 inputs. Something like a 74HC245 (8 bit tri-state buffer).

When in tri-state mode, the buffer disconnects the ULN2803 from the P0-P7 pins so you don’t get any spurious relay starts. You add a delay to the Output Enable pin on the buffer so that it’s not enabled until your “stable wait” period. That delay pin could be connected to a GPIO (if you want to add code) or a simple RC circuit (if you’re happy with a fixed wait time).

Thanks. that helps a lot. I could imagine that a high side drives solves that problem since on “active high” in WLED the outputs are just on at boot without 1sec off. So maybe it works.

On the second suggestion with the inverter: Do you have an example on the connection and dimensions of R and C?

like:
Download
with Vc to OE and R=220k C=10u ?

Thanks again,
Tom

That should give you around 1-1.5s. Unfortunately, the OE pin on the '245 series is inverted ~OE. So you’ll need to tie that RC to a simple inverter. Could be a spare gate in your setup, or just an NPN transistor used as a switch

I have no additional Gate and no free GPIO which all makes it too complex for my simple breakout. Ijust tried to drive from the PCF8574 direct to a PNP - but also after switching to “active high”, the problem still remains. The output is on for around 1s.

Is there no sulution to fix it in the code?

I’ll bet there isn’t (I could be wrong) but I suspect the issue is the power up state of the PCF8574 is not guaranteed to be all outputs off. Until WLED gets around to setting up the PCF8574 after boot, the outputs remain in an On state.

Someone who knows more about that usermod, might have a way to get 8574 reset earlier in the process but I don’t have any in depth knowledge to help there.

If you have any NPN transistors around, you can use one to make a quick and dirty inverter and use the RC circuit to drive the ~OE pin.