malini
Posts: 14
Joined: Thu Feb 11, 2016 11:18 am

relay - opposite functioning

Fri Feb 19, 2016 10:58 am

Hi!
I'm controlling a led using raspberry pi from a relay board. It is interfaced with a photo sensor program wherein the led has to light up when it is dark and vice versa. But when i'm connecting with the relay and giving suppose GPIO.LOW , it's doing the opposite i.e the led is lighting up. Why?

PS: GPIO.LOW and GPIO.HIGH are working fine when i'm just controlling the led using Pi alone.
please help

scotty101
Posts: 3958
Joined: Fri Jun 08, 2012 6:03 pm

Re: relay - opposite functioning

Fri Feb 19, 2016 10:59 am

Which relay board are you using?

Many of them invert the GPIO signal so need a logic Low to close the relay.
Electronic and Computer Engineer
Pi Interests: Home Automation, IOT, Python and Tkinter

Massi
Posts: 1691
Joined: Fri May 02, 2014 1:52 pm
Location: Italy

Re: relay - opposite functioning

Fri Feb 19, 2016 11:00 am

probably your relay is active low.

texy
Forum Moderator
Forum Moderator
Posts: 5161
Joined: Sat Mar 03, 2012 10:59 am
Location: Berkshire, England

Re: relay - opposite functioning

Fri Feb 19, 2016 11:41 am

Probably the relay is permanently connected to +ve at one end of the coil and requires a low at the other in order for current to flow.....
Various male/female 40- and 26-way GPIO header for sale here ( IDEAL FOR YOUR PiZero ):
https://www.raspberrypi.org/forums/viewtopic.php?f=93&t=147682#p971555

malini
Posts: 14
Joined: Thu Feb 11, 2016 11:18 am

Re: relay - opposite functioning

Sat Feb 20, 2016 9:11 am

Oh. Yes, i guess the board indeed is active low. It didn't strike me.
Thanks a lot! :)

Return to “General discussion”