Posts: 3
Joined: Mon Nov 20, 2017 1:23 pm

Multi-Relay Board to Trigger Solenoids via Shift Registers

Mon Nov 20, 2017 2:33 pm

Hey everyone. I'm a photography teacher and I'm building a project that consists of an array of lockers that will hold a class set of cameras. I'm about 95% done and have it working almost perfectly. The user enters their student id on a touchpad and then a unique pin, which will trigger their locker's solenoid, opening the locker and allowing them to retrieve their camera.

The problem is, sometimes, apparently randomly, triggering a locker will simultaneously trigger an adjacent locker, which is bad, when the whole point of the project is securing your items and ensuring people only have access to their assigned cameras. I am 99% sure that it is not a software problem. My limited understanding is that this has something to do with EMF and (maybe?) back voltage. Here are some of the clues I've gathered:

  • I've monitored the data being sent to my shift registers. The relays are active low. So, even when 0b11111110 is sent to out (with 0b11111111 being sent to the remainder of the daisy-chained shift registers), the relays act as if they were sent 0b11111100 instead.
  • The problem is not occurring at the lockers themselves. When there is a double-trigger, it is always the selected locker along with the next consecutive locker, even if those lockers are the end of one row and the first in the next row (ie, 6 triggered along with 7, in the image below).
    locker layout.jpg
    locker layout.jpg (57.74 KiB) Viewed 349 times
I've been teaching myself electronics for the last couple of years using various projects, but diodes are one thing I have pretty limited experience with still. Flyback diodes are something that I've seen mention of, although I'm not entirely sure it's my problem. My understanding is that its the collapsing of the EMF in the solenoid that would trigger a back voltage issue. However, my problem occurs right when the first locker is triggered, not when it turns off. Both of lockers are turning on together. Regardless, I've tried placing flyback diodes in the first eight relays to no visible effect.

My next experiment, which I haven't tried yet, is to carefully wrap each relay in aluminum, to see if the issue is with an EMF around the relay itself. Again, very little experience with these things, so if I'm talking nonsense here, try not to laugh too hard at my expense (a little is allowed).

Here are the relay boards I am using: https://www.ebay.com/itm/16-Channel-5V1 ... Sw3ChZeWS4

I appreciate any help or direction you all can give me in figuring out why they are misfiring this way!

User avatar
Posts: 5179
Joined: Thu Sep 29, 2011 4:34 pm
Location: Berkshire UK
Contact: Website

Re: Multi-Relay Board to Trigger Solenoids via Shift Registers

Mon Nov 20, 2017 6:36 pm

Divide and conquer. Split the problem into three parts - the Pi with its shift-registers, the relays, and the solenoids.

If you hang a set of LEDs (with resistors in series, the other ends connected to ground) on the outputs of the shift registers, and without the relays connected, you should be able to see if the Pi and its shift registers is doing what you wish.

If that bit's ok, put another set of LEDs, etc., on the outputs of the relays, and see if the relays are doing what you want.

Only when you're happy with that should you connect the solenoids.

The relay board should already have diodes across the coils, and anyway, as you say, flyback diodes only do anything when the relays switch off.
It's possible that the relays and/or solenoids are putting noise on the power rails, which is corrupting the signals to the shift registers.

Posts: 3
Joined: Mon Nov 20, 2017 1:23 pm

Re: Multi-Relay Board to Trigger Solenoids via Shift Registers

Sun Nov 26, 2017 2:40 am

Alright I did as suggested and it definitely has to do with the solenoids. Behavior is reliable until solenoids are attached. Even with a single solenoid attached to a single relay, the aforementioned problem occurs sporadically (sometimes it only triggers the solenoid, properly). What should that tell me?

You mentioned that they could be putting noise on the power rail and that could be causing it. The relays are opto-isolated and on a separate 12v source than the pi is on. If noise is the issue, what would you all suggest doing to prevent that?

Posts: 3
Joined: Mon Nov 20, 2017 1:23 pm

Re: Multi-Relay Board to Trigger Solenoids via Shift Registers

Mon Dec 04, 2017 5:27 pm

I ended up wrapping every other relay in aluminum foil and it seems to have worked, though I haven't put it to heavy use yet.

Return to “Other projects”

Who is online

Users browsing this forum: No registered users and 8 guests