How i plan to wire PCF8574

Forgive my circuit design i have never used kicad before. This is how i intend to wire the PCF8574 to the relays and the ESP8266. I did not find solenoid symbols in kicad library so i replaced them with 12VDC motors.

Will this wiring be okay or should i change something? The Relays im using are the cheap 8 relay module board from ebay. they also work at 3.3v. I have not measured the current required to operate the relay coil but i understand the PCF8574 is rated for a clamp current of 25mA or 50mA if i use 2 pins at once. I only intend to use 1 pin per output. I will wire the PCF8574 to 3.3v so that ESP8266 and PCF8574 SDA/SCL voltages match.

Is this okay please have a look.

It looks like it may only take 4mA to trigger the coil. the relay module plugs in 5V/GND and requires only 4ma to trigger the coil.

Should i add any resistors to SDA/SCL or flyback diodes on the motor/solenoids. should i use resistors between the PCF8574 and the Optically Isolated relay module inputs?

This is a more complete circuit but i wanted to focus on the PCF8574 first.

Please ignore the double lines going to the bottom left relay coil 5v.


No the data sheet says:-

|IOL|LOW level output current|VOL =1V;VDD =5V|10|25|−|mA|

Which means when you pull 10mA or perhaps 25mA depending on the individual device the voltage output will have dropped to 1V. Leaving 5 - 1 = 4V to drive the relay. This should be enough.

But as you have not actually drawn the relay board you have it is hard to tell. I am assuming the board has an optical isolator on the front end.

1 Like

It does have opto isolators for each input on the relay board. i use 135v varistors on the ac motors and it seems to work so far. What do you think about which resistor to use where and how can i gauge the right size flyback diodes. Sorry my questions are so vague i'm just trying to learn.

I'm still getting use to the symbols library in kicad. i may need to see if i can find the right symbols to use for solenoids and prefab relay modules

Hang on. That schematic shows the motors being driven by 12V. You didn't mention it was AC. Do not put diodes on AC motors as they will instantly burn out.

I see you added that extra diagram after you initially commented on it. Please don't do that here. Mabe look at How to get the best out of this forum as you are new, and read it.

Sorry for the confusion. I posted a second schematic that included more circuits. The five top relays will drive 5 12vdc solenoids/motor

There are 2 more relays that will control 2 more 120v AC motors that I use 135v varistors to prevent high spikes back to the relay when the coil is de energized.

No you don't. The energising of the relay has nothing to do with it, you get those spikes every cycle. With that diagram you seem to connect the ground of your circuit to mains, that is a great way to destroy things, and is illegal in most countries.

I think maybe I wasn't clear enough. This is my first time using kicad and no I do not connect the ac neutral or grounds to any of the dc circuitry sorry my schematic shows that. I use the varistors on the ac motor power wires to prevent high voltage spikes back to the relay modules.

Your schematic as it is, is all we have to go on. You asked if it was OK so I said no. If I thought "he just made a mistake with the schematic so I will say it is OK" then your schematic was a representation of what you are doing then I would be neglecting my duty here.

So correct and resubmit do not change the post I commented on.

No I understand. I wouldnt want to get bad advice. As far as the varistor goes "forgive my knowledge" when I bought them they were called MOV and they are said to activate at 135 volts.

One of my goals here is to prevent some spikes to disturb Serial communication or cpu operations.

The solenoids i use aka "12vdc motor in schematic" draw 1.6 amps at 12v. they switch kinda fast, energized for only maybe 500ms. The 120v AC motors draw 1.4 amps each. the cables between the 12vdc solenoids are about 30ft of 16 gauge wire.

I should probably try to fix my schematic. could you maybe give me a list of things to do differently when designing the schematic to make it easier to read or make more sense?

I had to fix it again because k7 was junctioned in the wrong spot. i have also provided better descriptions to the components

So I'm going to assume I dont need any resistors on the gpio on the pcf8574 to the relay module because they are using optoisolators and only require 4ma?

Ever since I used the 135v MOV on the ac motors I have no problems with EMI crashing anything. Did I use these wrong? My theory is it will filter out some high spikes above 130vac.

Since you are using a relay module and not just relays, the relay module already contains the current limiting resistor.

Mind you it doesn't hurt to cite a Web link to the actual relay module just in case. :face_with_raised_eyebrow:

1 Like

What about my 135v MOV's am I using these correctly, are they doing anything good? Are they a fire waiting to happen? What happens when lightning strikes the home meter base, do they become firecrackers or starters/glow sticks?

I'm wondering if I should fuse the AC power

Here is a link to my relay module.

The MOV does not protect the relay from voltage spike from its own coil. The module should have a diode for this.
There will be a voltage spike from the motor when you turn off the relay. The MOV will reduce this in some sense. But MOVs are cheap and not so reliable devices. From here

  1. MOV will eventually fail in such application leading to potentially dangerous condition (short on mains).
  2. At least some MOVs are rated for so many cycles the relay will fail long before the MOV (if you trust the MOV source).

I don't know enough about this topic to say what is the optimal way.

1 Like

Okay then I'm going to use a 5amp fuse on the ac side. I didnt have alot of problems with the relay coil causing issues. I twist up the signal between the GPIO extender and the relay module and it seems to help alot. I test this by disconnecting the ac power from the device and switched the relays 100ms ON 100ms OFF for 20 hours without any issues but as soon as I apply an ac oad to the relay "and switch slower" I would get all kinds of crashes, then I added the MOV and the problem stopped.

I would put a low value resistor in series with the mov to act as a fuse to burn up if it ever goes short circuit. They are rather slow to react and I have not seen them used in the way you have used them.
I have only used them for output protection against short circuits or input protection against surges.

The normal way to suppress interference from an AC motor is to use a snubber circuit, but you have to have a high voltage non polarised capacitor to make one.

The thing that is worrying about those relay modules is that while the relay contacts can cope with mains voltages, I am not sure that the boards comply with the regulations on “creepage and clearance”, these are the minimum gap you can have between live mains tracks and connections the isolated circuits. These are at least 0.2 inch which is why you see components that bridge that gap like opto isolators having a missing pin in the package.

1 Like

The whole device is (or will be) fused. Will the extra small resistor make the MOV less or more likely to burst in flames? Since it will limit the current the MOV will have more time to heat up before the fuse blows...
How can a MOV protect a PS from short circuit?

1 Like

Sorry I meant to say a PPTC or polymeric positive temperature coefficient device.
Sometimes known as a poly fuse. I often used to use them together with a Mov in protection circuits on access control systems.

What size non polarized cap should i use on a 120vac circuit. I would not be apply a load that is more than 4 amps to the 120v circuit.

I dont really trust the cheap relay module with high voltage because a lot of them fail at even 12volts and less than 5 amps. I have another module that i use the cheap relay module to activate a 5v OMRON relay, relay to relay .. The OMRON relays seems to be a lot more durable and reliable. this is a link to the ones i bought.

I was thinking about making a metal enclosure just for the high voltage relays and possibly filling it with sand. not sure what sand would be safe to use in such way. If the MOV can be dangerous and im using them in a dangerous way then i must not be using them right. Im interested in building the snubber circuit. I mean its only a matter of time before they are presented with a destructive surge. I also thought about something happening to the processor that cause the relay to switch really fast inducing a meltdown.

I have been using those OMRON relays for some time now to switch 15amp motors and air conditioners with my homemade thermostat and they have been working great now for over a year. I know its more of a job for probably a contactor instead.

Would regular sand work for filling an enclosure to suppress fire or is it conductive in some way?