N00b at electronics - can't work out why optocoupler relay is being triggered by other relays.

Thread Starter

Lexifir

Joined Oct 28, 2020
5
I've got a small project that is supposed to be for me to learn how to get a Raspberry Pi 4 to trigger a few motors and other assorted bits of kit. (Automated watering project, along with graphical interactive display) - Still in breadboard test stages as I can't move beyond...

The relay board is one of these;
Optocoupler relay (Amazon)
This particular one has only 5 relays wired up, has 12v DC plugged into the blue terminal blocks at the bottom and has the 5v inputs and ground pins going to the Pi via the GPIO pins.
Power for the attached devices (motors and solenoids) is drawn from an exterior 12v power source, it is the same supply as the one that powers the board... Taking the 12v DC board power out means that the relay board doesn't function at all, the Pi doesn't supply enough via 5v to make the board work.



I've got it working when there are no devices attached to the relays - but when the relays have a device that draws current installed - they seem to trigger each other and mess everything up.
Below is what I had assumed would be an acceptable setup, but I'm sure that a couple of the devices are allowing enough power to flow back around that it is somehow triggering the relays - and I don't understand why it is doing this.
Circuit wiring (simplified)
The relay input is handled by the Pi via an 8bit shift register.


The image above only shows how part of the system is laid out. Without any attached devices - the system works fine and is controlling the relays according to the program specifics (relays toggle on and off as expected)
As soon as the devices are added - it stops functioning as expected and quickly flickers between relays, sometimes it triggers some relays to swap states and other times not - there is no consistency to the madness.

This is my first time building electronic circuits - I've previously just stuck to writing code.

I've missed something simple, but I don't know what.



EDIT:
Power supply is 12v 30A
Main motor load is 6A
Two smaller 12v motors are 2A
Solenoids - I think 1Amp was needed to hold them open (normally closed)
 
Last edited:

dl324

Joined Mar 30, 2015
16,839
Welcome to AAC!
I've got it working when there are no devices attached to the relays - but when the relays have a device that draws current installed - they seem to trigger each other and mess everything up.
Post your schematic on this site.

  1. What is the current draw for the relay loads?
  2. What is the current rating of the power supply?
 

dl324

Joined Mar 30, 2015
16,839
I did, on the second link... I'll go get a photo too if that helps - but it's wiring chaos while play and experiment...
The link wouldn't open in the browser I'm using (Slimjet) and moderators prefer for things to be posted on this site so future references won't have broken links.

Post a screen capture of whatever you posted on that other site.
 

Tonyr1084

Joined Sep 24, 2015
7,852
I did, on the second link...
That only shows the switching portion of the relays. What we need to know is how YOU wired it and how YOU are controlling the relays. A much more detailed diagram is needed please. What you posted looks like something you copied and pasted (or linked to). We need to see how You made the connections.
 

Thread Starter

Lexifir

Joined Oct 28, 2020
5
Screenshot 2020-10-28 145437.png

Left icon - AC Source
First box AC / DC Converter
M = the three motors I have
The lamps represent the solenoids I am triggering, but I couldn't find the icon for that.


Any suggestions on a free online circuit designer?
There are a lot of them, but I don't have time to try lots
 

Thread Starter

Lexifir

Joined Oct 28, 2020
5
20201028_145251.jpg

That's the actual installation of the relay. Power in behind the black cable tidy (12v terminal blocks)
Pins all go to 8bit shift register and raspberry pi.
 

Tonyr1084

Joined Sep 24, 2015
7,852
Here's what I'm seeing: You've connected (assuming) motors to the Common and the Normally Closed posts. This means without any input to the relays your motors will just run. The schematic shows connections to the Normally Open posts. In the current configuration only relays that are active will Shut Down the motors.

Simple mistake. I make them too.
 

ElectricSpidey

Joined Dec 2, 2017
2,757
Been down this road before, the problem is most likely to be caused by RFI or some such interference either in the air or thru the cables.

The other obvious culprit is power supply dropout when the motors start, or lack of proper de-coupling.
 
This particular one has only 5 relays wired up, has 12v DC plugged into the blue terminal blocks at the bottom and has the 5v inputs and ground pins going to the Pi via the GPIO pins.
Power for the attached devices (motors and solenoids) is drawn from an exterior 12v power source, it is the same supply as the one that powers the board... Taking the 12v DC board power out means that the relay board doesn't function at all, the Pi doesn't supply enough via 5v to make the board work.
It actually looks like +5 is supplied to the board and it creates +12 for the relays. The datasheet for the relays says it's good for 3A inductive. The coils are 0.36w

A quick estimate: =0.5*8*(1/0.8)

0.5W per coil, 8 relays, 80% efficient power supply gets you 5W or 1A at 5V.
Because the relays are inductive and your activating them all at once, a 1A supply probably isn't big enough.

As noted, the motors are connected to the NC or Normally closed contacts.

I have no idea what your 5V supply is rated for?

So, all sorts of wierd stuff will happen.
 

Thread Starter

Lexifir

Joined Oct 28, 2020
5
It actually looks like +5 is supplied to the board and it creates +12 for the relays. The datasheet for the relays says it's good for 3A inductive. The coils are 0.36w

A quick estimate: =0.5*8*(1/0.8)

0.5W per coil, 8 relays, 80% efficient power supply gets you 5W or 1A at 5V.
Because the relays are inductive and your activating them all at once, a 1A supply probably isn't big enough.

As noted, the motors are connected to the NC or Normally closed contacts.

I have no idea what your 5V supply is rated for?

So, all sorts of wierd stuff will happen.

Ahh - so that pair of 5v pins on the relay board should have an independent 5v supply?
It's currently running off the Pi 5v pin out, and I think that gives a little over 1A...

I'll swap the relays to NC and use a more stable power source and see what hapens.

Thanks all!!
 
You should probably use a Bosch style automotive relay for the 6A motor. Use diode supprssion on the coils. A reverse biased diode 50-200 PRV.

Put 0.1 uF ceramic caps at the motor to suppress RFI a little.

if you do need either quick stopping or polarity reversal, then the Bosch style relays are helpful. Two relays are generally used with the commons to the motor. The NC contacts go to ground and the NO contacts to +12.

With the relays not engaged, the motor is shorted to ground. The motor acts as a generator into the short so it stops very quickly, otherwise the motors coast. If both relays are activated at the same time, the motor is also shorted to the +12V supply. So, with 2 bits, you get fwd, rev, brake and brake.

The Bosch relay coils have a 150-200 mA current requirement, I THINK. Limit switches can be placed in the coil side.

Fancier, if needed an H-bridge and PWM can control a motor as well. With PWM, you torque essentially remains the same at all speeds.
 
Top