Circuit B opto-coupler upsets Circuit A opto-couplers

Thread Starter

Alan_uk

Joined Nov 15, 2016
6
Hi. I have built an interface between a Raspi 4 and an Alarm Panel with some extra add ons. The diagram below shows 3 circuits A, B & C.


HMS Problem Circuit.png


Circuit A at the top has 8 inputs from the alarm panel (12v) and feeds them through 8 optocouplers (2 x 4 modules) - note the internal 3K resistors and the common output ground. The normally high panel inputs are held low into the Rasp Pi.

Circuit B is a push button 5v input that feeds though an opto-coupler into the Rasp Pi

Circuit C is a 3.3v output from the Rasp Pi that feeds though an opto-coupler into a 5v relay.

Note that the circuits within the red dotted line are on a single piece of strip-board an share a common ground with the Pi

All 3 circuits work on their own but when I press the Ciricuit B push button then one or more of the 8 panel inputs into the Rasp Pi go high. I've had up to 6 fire.

I suspect it is something to do with the common ground but no idea how to fix it. Would one or more diodes help (at Z?) or is there something wrong with the design or if not, then maybe with the construction?

Help much appreciated. Thank you
Alan
Wiltshire
 

MaxHeadRoom

Joined Jul 18, 2013
21,630
If you want a good guide to the design of I/O modules take a look at the Opto22 site, they publish the schematic of all modules.
For e.g. the later G4 style has 5v, 15v & 24v input control. AC or DC H.V.output.
Max.
 

crutschow

Joined Mar 14, 2008
25,663
I see no obvious problems with the circuit.
I don't see how diodes would help without knowing the source of the problem.

You need to probe all the circuit nodes and record the voltages when it is failing (Circuit B active) to help determine the source.
I suspect a miswire.
 

ElectricSpidey

Joined Dec 2, 2017
1,333
Is the Pi and the supply properly filtered and de-coupled?

Do any electro-mechanical devices activate or de-activate when circuit 3 is activated? If so do you have suppression on those devices?

I just finished building a micro based alarm system that worked fine on the bench, but when installed in the field I learned a valuable lesson…these things are very sensitive.
 

Thread Starter

Alan_uk

Joined Nov 15, 2016
6
Thanks crutschow and ElectricSpidey I think ElectricSpidey may have hit the nail on head. As crutshow suggested I started to probes and all was looking good. Then I needed to start up a python test script to change a GPIO state - the script monitors all the inputs. As I was prodding the script was throwing alerts. Sometimes even the slightest touch on the Aux 5v/12v supply terminals caused the GPIOs changing state. I don't think it was mechanical fault (e.g. soldering) but could be but could be static - but I was wearing an earth strap.

Strange thing is that the gpio pins and circuits are powered by the pi's 3.3v pins not the aux supply. The aux 5v supply operates a bank of solid state relays and the 12v is the relay switched outputs (currently disconnected). Circuit 3 does operate a relay but it was discounted when I was probing.

I'm beginning to think it might be the aux 12v/5v supply. I used a 12V 2A plug-in adapter made by Ying Yuan Co, Ld. I bought it from a company specialising in CCTV and not the cheapest so I was hoping to get something a bit reliable. I then feed the 12v into a DC-DC 24V 12V to 5V 5A Step Down Power Supply Buck Converter USB Charging Module. The 12V/5V output was then delivered by a old laptop cable with a din plug into the project box with a din socket and screw terminals to distribute to the various sub-assemblies.

What I will do tomorrow is remove the din socket and screw terminals and wire up another 5V supply and see if the problems go away or not. Like ElectricSpidey the individual sub-assemblies were working OK on the bench but not together and not will this new aux power supply.

Thanks again for responding. I'll give an update with my findings.
Alan
 

Thread Starter

Alan_uk

Joined Nov 15, 2016
6
Update. Problem is the 5v Aux supply. There was no problem using my bench supply. I was using a DC-DC 24V 12V to 5V 5A Step Down Power Supply Buck Converter USB Charging Module. Usual Chinese stuff. Even putting a LED across the 5V terminals caused "hick-ups" in the rest of the circuit.

I'm open to suggestions for a 12V 2A + 5V 2A supply, preferably one that is plug and go rather than having to build another case. Has to work with minimal load as most of the time it will be in a quiescence state. On ebay there are some used PSU bricks that are branded and made in Taiwan so probably better that the usual Chinese stuff.
 

Thread Starter

Alan_uk

Joined Nov 15, 2016
6
I'm updating this thread on how I resolved, more or less, the problem with the circuit I posted earlier.

To recap, a closing of a reed switched circuit, triggered by the solenoid of a traditional door bell, caused many if not all the 8 Panel inputs into the Raspberry Pi GPIO inputs to trigger.

I therefore decided to isolated my Home Automation control system from the door bell. I used the 18V AC supply to the door bell to provide a 5V DC supply for both the reed switch circuit and the relay circuit. In the HA control system I added another strip board with opto-couplers X and Y to interface to the original opto-couplers B and C respectively.


HMS Problem Circuit Revised.jpg

Additionally, I twisted as many of the pairs of wires as I could, or wrapped multiple control lines with a single earth cable. Further I bought some shielding mess to wrap the main 2 multi-core signal cables and the mess was grounded to either the 5v Aux supply or the Pi Ground.

Project Box installed - inside lr.jpg

This cured the rogue triggers so I installed the whole system.

Further "problem"

The Raspberry Pi controls 3 devices via opto-couplers and a relay module with 4 (yellow) solid state relays. 1 device is 5V and 2 devices are 12V: a Kkmoon electro magnetic door lock and a 3W LED ceiling light, both powered by a 12V aux. supply. The door lock spec said it was fitted with a MOV.

However, I noticed that when the relay unlocked the lock the LED ceiling light flashed. So I added a 1N4001 diode to the positive line. This made matters worse in that the door bell reed switch circuit was activated! Putting another 1N4001 on the negative line plus moving the door lock cables away from the door bell cables and to another trunk some 15cm away, fixed the door bell reed switch circuit but the LED ceiling light still flashes.

Maybe this is a problem within the solid state relay module. It's this one: eBay Solid State Relay

If this continues to run OK I might get a custom printed circuit made, making use of the introductory offer by JLCPCB. I have 90% done but concerned with designing in a ground plane.

Question: should I join the Aux 5V ground and Pi ground? I've not done this as I've tried to isolate my expensive Pi 4 and SSD hard drive from the rest of the system which is my own design and build.

Many thanks
Alan
 
Top