7hekingofkings
Posts: 2
Joined: Sun May 28, 2017 7:29 pm

Interface with sainsmart relay

Mon May 29, 2017 5:10 pm

Hi guys,

I bought a 16 channel Relay Module Smart. As i have read, the relay board can be connect to the Raspberry pi directly.
I using Wiring-pi library to control GPIO Pins. However, when i configure the pins as output, the relay is triggered.
code : > gpio mode 0 out // Relay switched

Is this normal??
When i run these two other commands nothing happens.:

*> gpio write 0 0 // nothing happend

*> gpio write 0 1 // nothing happend

Any advise will be apprecited

klricks
Posts: 5883
Joined: Sat Jan 12, 2013 3:01 am
Location: Grants Pass, OR, USA
Contact: Website

Re: Interface with sainsmart relay

Mon May 29, 2017 8:21 pm

What pin are you connected to? The command gpio write 0 1 is GPIO 17 which physical pin 11. See chart: http://wiringpi.com/pins/
You must have ground connected from relay board to one of the RPi ground pins.
Most relay boards are ACTIVE LOW which means: Low or 0 will turn the relay ON and High or 1 turns the relay OFF.
Unless specified otherwise my response is based on the latest and fully updated Raspbian Stretch w/ Desktop OS.

7hekingofkings
Posts: 2
Joined: Sun May 28, 2017 7:29 pm

Re: Interface with sainsmart relay

Tue May 30, 2017 7:03 pm

Hi,

The pins are connected correctly. I am using GPIO 0 which is a physical pin 11 as input signal and physical pin 6 which is 0 V as ground. As using external power supply to supply the board.

However i have tester the same configuration with a led which seem to work fine.

pcmanbob
Posts: 4458
Joined: Fri May 31, 2013 9:28 pm
Location: Mansfield UK

Re: Interface with sainsmart relay

Tue May 30, 2017 9:31 pm

Hi.

A lot of the sainsmart relay boards are 5v logic and active low, they exhibit the sort of response you are getting because the 3.3v of the Pi is not high enough to drive the relay off.

you may need a transistor circuit to interface the pi to the relay board one for each relay of course.
Remember we want information.......................no information no help
The use of crystal balls & mind reading is not supported

Return to “HATs and other add-ons”