Main > Project Announcements
javeryh's Salisbury Beach Twin Tullys
<< < (75/80) > >>
Zebidee:
Relays are everywhere. You don't need to spend $30 on one either.

I bought a 5-pack of 5v relays for about $3.50 last year, so less than $1 each. The only drawback was most of the writing was in Chinese. Fortunately my multimeter serves as an effective language translation tool.

Find an old USB 2.0 cable and cut the other end off. Find the red (5v) and black (GND) wires. You won't need the green/white wires.

You only need the more common low-active relay, which is what I used (high is fine too, but instructions slightly different). On one end there will be 3 terminals for Vcc (5v), GND and IN.  Vcc and GND are self-explanatory. For IN, just jumper it to the GND terminal with a short piece of wire.

First, the relay must be getting some power (a few milliamps) to become active. So turn on the Pi. Then, because GND is connected to IN and it is low-active, this will trigger the relay. Because my relays have Dupont pins on the input terminals, I was able to recycle an old 3-pin header from some old electronics bits. I soldered that to the 5v and GND from the molex, then jumpered the GND to IN.

At the other end are your three typical NO - COM - NC terminals. You connect your AC active wires to the COM and NO terminals. When the relay activates it will close the NO (normally open) and open the NC (normally closed), shunting your power through.

I've added a few shots of how I did mine. The 5v for switching is from a PC connected via Molex, should work the same from USB unless your Pi provides standby power.

I took the shots of the relay wiring a year ago, been working well since, all hidden away behind a panel. I apologise for photobombing your thread  :embarassed:

I just added a shot of the panel/switch at front, for context only, you don't need it. It is the original mains power switch for the cab, so I left it in. It is actually unnecessary now because I added a PC-style power plug port at the back which includes a switch, fuse and LED. Also added a line filter.  Anyway, none of it triggers the relay or is otherwise important, it is only for context.

Hopefully it all passes the Scott test ;)

EDIT: Mostly I power up/down the cab with a discreet momentary switch at back/top/left of the cab (reach up/behind with left hand). This powers up the PC, which then powers up everything else via the relay. Very noob-friendly. The fused mains power switches I mentioned mostly just stay on, though I sometimes turn off the one at the back if not using for a long time.

leapinlew:
My Pi on my Gorf imploded after a shutdown. I used the spare card method, and re-imaged the old card. I've probably powered on/off that machine 50 times or so. I still power on/off the cabinet with a light switch.
PL1:

--- Quote from: Zebidee on February 08, 2022, 09:23:18 pm ---The 5v for switching is from a PC connected via Molex, should work the same from USB unless your Pi provides standby power.

--- End quote ---
This unknown is part of why I suggested the active high relay.

It's easy enough to use a hacked USB cable like you recommend to test for USB standby power.

If it doesn't have it, your approach of an active low relay with a hacked USB cable for operating power + ground jumpered to the trigger would be great.

If it does have it, you can still use a hacked USB cable for the relay's operating power, but an active high relay seems to be the better idea with the trigger coming from either GPIO 5v (pin 2 or 4), GPIO 3.3v (pin 1 or 17), or another GPIO pin that is logic high when the system is on and logic low during standby.
- Test if pins 2, 4, 1, and 17 have power during standby.  They probably do, which eliminates using one of them as the trigger.


--- Quote from: Zebidee on February 08, 2022, 09:23:18 pm ---Hopefully it all passes the Scott test ;)

--- End quote ---
It passes the far more important "Electronics 101" test.   :cheers:

The big question is whether it passes the Javery test.   ;)


Scott
Zebidee:

--- Quote from: PL1 on February 08, 2022, 11:05:07 pm ---
--- Quote from: Zebidee on February 08, 2022, 09:23:18 pm ---The 5v for switching is from a PC connected via Molex, should work the same from USB unless your Pi provides standby power.

--- End quote ---
This unknown is part of why I suggested the active high relay.

It's easy enough to use a hacked USB cable like you recommend to test for USB standby power.

If it doesn't have it, your approach of an active low relay with a hacked USB cable for operating power + ground jumpered to the trigger would be great.

--- End quote ---

We'll see I guess. The USB standby power thing might not even be a concern.

I don't know Pis nor how to turn a Pi's USB standby power on/off. For a PC you can usually control it via the BIOS, pretty easy. I imagine a Pi has similar or at least a config setting.

With a low-active design you just apply 5v power to let the relay work. It is simple and modular. If the PC in my cab dies, just replace with any old or new PC, plug in the molex, and it will all work the same as before.

What worries me is that relying upon a GPIO logic pin setting being HIGH makes the design less modular. It is a higher level of software control, setup and wiring. If the Pi dies you can't just replace the Pi with another Pi, it has to be setup the same way as well. Maybe swapping cloned SD cards is the way around this? Also, if you can program a Pi via SD card to work with a high-active design, can't it be programmed to work with low-active design too? Does it matter and does anybody care?

The important thing is that there are solutions for all occasions! Relays with both high and low triggers are the best of both worlds, and probably aren't much more expensive anyway.



--- Quote from: PL1 on February 08, 2022, 11:05:07 pm ---
--- Quote from: Zebidee on February 08, 2022, 09:23:18 pm ---Hopefully it all passes the Scott test ;)

--- End quote ---
It passes the far more important "Electronics 101" test.   :cheers:

The big question is whether it passes the Javery test.   ;)


Scott

--- End quote ---

Thanks! I hope Javery's head isn't spinning ;)

I just pulled the relay panel out and snapped off a couple more pics. Those earlier photos were taken before I re-purposed a 3-pin female header from an old TV. This makes it sturdy yet easy to remove and work with stuff. Anyway here is is. The wire colours don't match traditional colours because I soldered the 5v & GND wires onto the ends of existing wires. So the header goes 5v - GND - GND. Next photo shows relay with header removed so you can see the pin order VCC - GND - IN.

Again, apologies for photobombing. I'll stop now, for a bit.

 
bobbyb13:
This is all briliant of course.

If the thing is pissing you off, you have no delivery deadline and you aren't absolutely sure of what you want to do...?

Walk away from them for now.

In time the choice will illuminate itself.

Then do that.
Navigation
Message Index
Next page
Previous page

Go to full version