Metro M4 and Relays Work Backwards

General project help for Adafruit customers

Moderators: adafruit_support_bill, adafruit

Please be positive and constructive with your questions and comments.
Locked
User avatar
platonicsolid
 
Posts: 19
Joined: Mon Jun 22, 2015 2:44 pm

Metro M4 and Relays Work Backwards

Post by platonicsolid »

Good morning, all.

Banging my head against what is probably a simple issue, but something I'm just not clicking on.

I'm using a Metro M4 to control an Elegoo relay module. The relays will control higher voltage (ie: 9-12v) I can't control directly through a level shifter or an AW9523.

The relay module is powered directly via the M4's 5v power, and I have the control lines running to the GPIO pins. I can control the relays just fine, but....everything is backwards!

When the GPIO pin is false, the relay closes and I get continuity through it. When I set it true, it switches and closes. I can, of course, switch from the N-O to N-C port on the relay, but then if the system reboots, the relays will turn on, which is definitely not the behavior I want.

Any assistance would be appreciated.

User avatar
dastels
 
Posts: 15667
Joined: Tue Oct 20, 2015 3:22 pm

Re: Metro M4 and Relays Work Backwards

Post by dastels »

The relay board inputs are active low. To energize a relay, you set it's control input to false. There's no way to change that. It's not backwards, it's just active low inputs. If that bothers you, you can write a function (or functions) to abstract away that detail.

Dave

User avatar
platonicsolid
 
Posts: 19
Joined: Mon Jun 22, 2015 2:44 pm

Re: Metro M4 and Relays Work Backwards

Post by platonicsolid »

Thanks, I somehow passed over that in the relay module's docs. It makes reference to "input signal trigger mode", which makes me think it can be changed between active low and active high, but I can't find any way to actually change that. Maybe it's a misread or poor phrasing.

As to abstracting it, that would seem to be the way to do it. There doesn't appear to be native support for inverting (was discussed here, for example) within the digitalio library, which isn't critical because I have my own wrapper class that will handle 'on'-ness.

Locked
Please be positive and constructive with your questions and comments.

Return to “General Project help”