Any reason why I sh...
 
Notifications
Clear all

Any reason why I should not use this PCF8574 based I2C electromagnetic relay with mycodo?  

Page 2 / 2
  RSS

bartleby
(@bartleby)
Active Member
Joined: 5 months ago
Posts: 14
October 16, 2020 6:10 pm  
Posted by: @tico

Okay, had a few spare seconds to look at that Meanwell PS and its dimming function. I'm not 100% sure of this, but it appears that you can *either* add a separate +10VDC PWM signal (not powered from the same power supply) to the DIM+/- terminals, with the PWM controlled externally (via some PWM generator, either standalone or driven by Mycodo via the Pi in some way?) for controlling brightness *above* the constant +10V baseline,

I should have mentioned that the distributor for the Meanwell power supply suggested using the PWM to 0-10V boards and said that they are frequently used to dim strings of LED lights.  The reason I want to do automate the light level is that I'm hoping to make successfully growing plants more repeatable and automating this will remove some of the guesswork.  The reason I ask about the dimming options is just to double check that what the distributor said is a good way to do the dimming considering I'm using the rPi.  So I'm considering pwm->0-10V board for controlling the LED dimming and another to control the fan but just wanted to confirm with you that this is a good way to do it.  I'm going to try to decipher the schematic drawing a little later today 😉  I'm thinking the krida ssr and four heavy duty SSR's like the 25 amp TWTADE  you suggested might be the solution.

Thanks again @tico


ReplyQuote
bartleby
(@bartleby)
Active Member
Joined: 5 months ago
Posts: 14
October 17, 2020 6:54 pm  
Posted by: @tico

here's another crude schematic of how I've used MCP230xx + ULN2803a darlington transistor arrays to control either low-level active relay boards and/or independent DC loads

I think I understand your circuit schematic @tico and thank you for that.  So the ULN2803a not only allows up to 500ma but better control of that current too when paired with the MCP230xx right?

Would it make sense for me to use the AC coil version of the TWTADE ssr (10ma coil activation) and connect it directly to the Krida ssr?  I like the seller's special message which echoes what you've said:   "Special attention: The current of this product is 10A for a long time.A large heat sink or fan need to be added.Model: SSR-25AA Solid State Relay 25A AC to AC".  If you use more than 10 amps I guess it might not be for a "long time" :D

Here's the AC coil version: https://www.amazon.com/gp/product/B079BBTBFM/ref=ox_sc_act_title_1?smid=A1LH3TFU4S09BS&psc=1

 


ReplyQuote
tico
 tico
(@tico)
Trusted Member
Joined: 5 months ago
Posts: 80
October 19, 2020 3:45 pm  

@bartleby

Re: the ULN2803a -- yes, it basically gives you more control and allows to power some of the load from a secondary (or tertiary) source other than the Pi's limited +3.3 or +5V rail, or even the max current sinking ability of the MCP chips -- I believe 125 or 150mA if I remember correctly. Also, since the ULN2803a is rated for much greater load voltage on the output than the MCP's (I think something like even +48V or +60 VDC even!) you can use it to enable finicky SSR relays that might not enable consistenly with  only +3.3 or +5VDC. I have a couple that I've had to drive with 12VDC to get them to work consistently.

 

As for using a DC-AC SSR to then drive an AC coil mechanical relay, I suppose you could do that, but then when the mechanical relay is switching on and off, you still have arcing across its contacts under load (not good for noise suppression) and of course shortened life cycles compared to an SSR by itself, so I'm not sure what that would accomplish besides allowing you just to switch higher amperage loads. Also, SSRs require a minimum amperage load on the outputs for them to switch on and off successfully, but I assume that an AC coil relay would be enough.

 

I have not used that AC-AC ssr that you linked before, but i've used its DCDC or DC-AC cousins successfully. I'd be interested in your experience with it if you go that route. If you try to use a DC-AC SSR to drive that AC-AC ssr, the input load of the AC-AC ssr might not be enough for the first DC-AC SSR to switch the output successfully and consistently, so you might need/want to add some sort of AC indicator bulb in parallel with the output of the first DC-AC ssr to add somewhat of a load when trying to enable the secondary SSR.

Honestly I would just use your lower-amperage SSRs just for directly switching lower-amperage loads, and then get a few higher-amperage indendent SSRs (with cooling fins) to switch the heavier loads. If you run them under a quarter of their rated capacity you should be able to get by without fans if you have good heatsinks, but you might just measure it for a bit and see if you need to zip tie on an extra coolling fan if one tends  to get hotter. I believe my 40A SSRs usually recommend a good/large heatsink at 10A almost full duty cycle, and a heatsink + forced air cooling at or above 20A if I remember correctly, so that may be a decent assumption to scale down for your 25A option, or it may less applicable, who knows.

I like to add fuses to everything because it helps me doublecheck my assumptions about starting current surges and constant current levels. Especially with a selection of fast blow and slow blow fuses.


ReplyQuote
bartleby
(@bartleby)
Active Member
Joined: 5 months ago
Posts: 14
October 20, 2020 2:00 am  

@tico I have seen the light and I'm going to build a 16-ch SSR using your circuit.  I've attached a pdf of what I hope is  a usable circuit using an MCP23017 and 2-ULN2803A chips.  For the relays I'm planning on using an 8-ch 2-amp SSR and on the other ULN2803A I plan to connect four of the 25 amp TWTADE relays: https://www.amazon.com/gp/product/B079BBFKP4/ref=ox_sc_saved_title_5?smid=A1LH3TFU4S09BS&th=1

Let me know if the circuit looks ok.  Thanks again tico.


ReplyQuote
tico
 tico
(@tico)
Trusted Member
Joined: 5 months ago
Posts: 80
October 20, 2020 4:25 am  

@bartleby schematic generally looks good.

Don't forget that the i2c address is set on the Mcp chip, not the uln2803a.

Also, tho the Pi's built in i2c bus includes pull up resistors, if you happen to be connecting this to another i2c bus, perhaps a soft-gpio bus or one hanging off of a tca9548 Mux or something like that, that you'll have to make sure that there's at least one appropriate sized pair of pull up.resistors between both sda and scl relative to +3.3v

Otherwise you look good to go! Dont forget to fuse your +5v auxiliary supply as well :)

There could be optoisolators or other protections added as well if you like, but your schematic has captured accurately what I was describing previously.

 


ReplyQuote
bartleby
(@bartleby)
Active Member
Joined: 5 months ago
Posts: 14
October 21, 2020 12:13 pm  

I guess I got a little confused there on which chips have the I2C address.  I will  fix it so it wont be confusing as maybe others will want to use the diagram. 

Here are a few other things I've written down from your posts on this subject that I may still need to implement.  Listing here just in case you have anything else to add:

  1. Use RC snubber circuitry on potentially noisy connections.
  2. Do not tie AC ground to DC ground.
  3. Bond all metal enclosures to AC ground.
  4. Use fuses on DC components.
  5. Add protective circuitry like optoisolators if needed.

Questions: 

  1. Where might optoisolators be needed?  I'm guessing the 5V to MCP23017 and ULN2803A connections.
  2. What do you think of this solderable breadboard for the circuit?: https://www.amazon.com/Gikfun-Solder-able-Breadboard-Plated-Arduino/dp/B071WC2BCF
  3. Use a "wait and see" approach to rc snubber stuff?

I guess I'll order some chips and relays 😀 Thanks tico.

 

 

 


ReplyQuote
tico
 tico
(@tico)
Trusted Member
Joined: 5 months ago
Posts: 80
October 21, 2020 1:51 pm  
Posted by: @bartleby

I guess I got a little confused there on which chips have the I2C address.  I will  fix it so it wont be confusing as maybe others will want to use the diagram. 

Sounds good. So just to clarify -- the I2C GPIO chips (such as PCF8574/PCF8575, MCP23008, MCP23017) have configurable I2C addresses. Their I2C SDA and SCL signaling lines connect either to the Pi directly or to a MUX, with or without additional pull-up resistors depending on your specific modules, setup, what else is on the same I2C bus, etc. If it's directly to the Pi (and not through a level converter and/or MUX and/or differential extender -- all of which can/would affect the voltage level) then those have to be +3.3v level so as to not damage the Pi's GPIO pins.

Those chips will have a shared DC- ground relative to the signaling lines, as well as with the + output pins. The output voltage on those pins is basically the same as the voltage powering that chip (either +3.3 or +5V depending on your setup).

If you have a high-level active relay (or relay board) and you have the available milliamp budget on your I2C GPIO chip, and that relay *reliably* enables/disables with the voltage (and associated voltage drop under load) available on that GPIO pin either +3.3v or +5v, then you could connect the relay(s) directly to the + output(s) of those I2C GPIO output pins. I have one SSR relay board where that's what I'm doing.

For the rest of the boards I use the ULN2803a and additional power supply to take the +3 or +5V output voltage from each of the  I2C GPIO chip's output pins, and use that to enable a path to ground *thru* the ULN2803a chip, for a relay that is powered with a positive +5 or +12V on its common rail, and just needs each input to be connected to ground in order to be powered on or off.

So the ULN2803a just acts kind of like a "relay for the relay" if that makes it easier to think of it that way. It's just a pile of transistors, and is completely "unaware" of the I2C bus at all, and has no effect on the I2C GPIO chip at all (other than being a fairly high impedance load which makes the current thru the GPIO chips minimal, as desired).

I really recommend trying to get your signal levels to +5V as well as powering at +5V, since in my experience that's led to greater reliability and also makes it easier to share the bus with lots of other I2C devices. I know there are some +3.3V only devices but so far all the devices I've found that I would want to hook up to a Pi or arduino are +3.3V/+5V or are +5V only.

Here are a few other things I've written down from your posts on this subject that I may still need to implement.  Listing here just in case you have anything else to add:

  • Use RC snubber circuitry on potentially noisy
  1. Do not tie AC ground to DC ground.
  2. Bond all metal enclosures to AC ground.
  3. Use fuses on DC components.
  4. Add protective circuitry like optoisolators if needed.

Questions: 

  • Where might optoisolators be needed?  I'm guessing the 5V to MCP23017 and
  • ULN2803A
  • connections.
  • So, after some electrical surprises at my place, I'm retrofitting either optoisolators (or other types of bidirectional isolators such as ISO1540D,) wherever possible that 110VAC or may be in close proximity with either I2C (or 1-wire) devices, or where a short between a DC or I2C line to an AC ground might occur due to moisture. The goal of course being that if that happens, then the damage is contained and fewer devices need to get replaced.
  • I'd say good candidates would be:
  • between the output of either the MCP or the ULN chip or between them and the pins of a relay board (or one of the standalone Fotek/Crydom/TWTADE/etc SSRs),
  • Or between each I2C bus and an I2C MUX, or between a portion of an I2C bus used for relay control circuitry versus a portion used for polling sensors,
  • And definitely when an I2C or 1-wire bus is extended outside of a single case or control panel and onto another structure or panel that might be in proximity to moisture.
  • Don't forget that optoisolators are unidirectional, so for I2C  purposes you'd probably want either a bidirectional optoisolator circuit module, or some other kind of isolator (capacitative for example) which is better suited for bidirectional uses.
  • Example for arduino:
  • https://www.electronics-lab.com/project/optically-isolated-bidirectional-i2c-shield-for-arduino/
  • Long read:
  • https://www.nxp.com/docs/en/application-note/AN10364.pdf
  •  
  1. What do you think of this solderable breadboard for the circuit?: https://www.amazon.com/Gikfun-Solder-able-Breadboard-Plated-Arduino/dp/B071WC2BCF
  2. Use a "wait and see" approach to rc snubber stuff?

I guess I'll order some chips and relays 😀 Thanks tico.

 

 

 

That solderable breadboard looks fine -- basically once you've got your circuit working well on a prototype board, reimplementing it on a solderable board makes for fewer wiggly connections to come loose. Don't forget to spray some clearcoat acrylic spraypaint or a similar protectant across the copper traces of your solderable board after finishing and testing all your connections so that the acid in your fingerprints and moisture in the air don't corrode the copper traces.

That being said, I seem to always have at least one prototyping board zip-tied to my control panel where I'm testing some new circuit and haven't yet soldered up a more permanent replacement for it yet, so it's not like starting out with a soldered circuit board is an absolute requirement at all times, but when I do run into problems that's often where the culprit lies.

As for the snubber stuff, you might consider grabbing a couple of common RC snubbers for AC motors and maybe a couple of diodes to have on-hand in case you start noticing some problems when you're testing out your relay setup, since you could test if just adding a snubber made the problem go away without having to wait another week for parts to arrive (or have access to lots of testing equipment). They're pretty cheap and in my experience always eventually get used for some project or another.

You're welcome :)

Have fun with your build!


ReplyQuote
Page 2 / 2