Page 1 of 2

GPIO relay control

Posted: Thu Nov 29, 2018 3:28 am
by nicklofy
I want to control a relay with the raspberry pi gpio port I went to inputs/outputs and set the gpio as an output in universe 1 then made a generic dimmer in fixtures turned them all on in the simple desk but nothing happened.

but if I go to inputs/outputs click gpio under mapping then configure the selected plugin turn on say gpio 17 where I have a lead to the relay to the set usage to output the relay clicks on immediately but is not controllable at all

Re: GPIO relay control

Posted: Thu Nov 29, 2018 10:44 am
by GGGss
did you configure your output to go high or low? This needs quite some other upset...
(and please use an arrestor diode parallel to the coil of your relay) or you will kill your output (and brake the RPi)
Out of curiosity ... what type of relay did you use? Make / ordernumber please?

Re: GPIO relay control

Posted: Thu Nov 29, 2018 3:43 pm
by nicklofy
I do not know what you mean by configure high or low I don't remember seeing anything about that

This is the relay module https://www.amazon.com/gp/product/B0057 ... UTF8&psc=1

Re: GPIO relay control

Posted: Fri Nov 30, 2018 12:26 pm
by GGGss
Stop this immediately !! You will burn your Raspi.

You are exceeding MAXIMUM ratings by factor 20 !!
!! A maximum of 16mA per output and a total limit of 51mA is allowed !!
http://www.thebox.myzen.co.uk/Raspberry ... tputs.html

(and while you are reading ... learn how outputs can be put into high and low states...)

@massimo: can you change the title of this post please ... this post is dangerous

Re: GPIO relay control

Posted: Sat Dec 01, 2018 2:24 am
by nicklofy
https://youtu.be/TFt480sxNWg
here's a video of someone using the exact same relay and it works just fine are you telling me he is
!! EXCEEDING MAXIMUM RATINGS BY FACTOR 20 !!

Re: GPIO relay control

Posted: Sat Dec 01, 2018 9:33 am
by mcallegari
[moderator] Fredje please calm down and don't write in caps. It's plain rude.

Re: GPIO relay control

Posted: Sat Dec 01, 2018 1:22 pm
by GGGss
Massimo, I changed the tone of my post.

To the OP: yeah always believe everything that's on the net ... below the video, in the 3th comment, someone already started complaining about it not working - no wonder!
But hey ... if it works for you - be happy with it.

Re: GPIO relay control

Posted: Sat Dec 01, 2018 7:50 pm
by nicklofy
So if I don't uses all 16 of the relay I should be fine in that matter, I will accept the risk of using more but i still would like to know how to control a relay through this program please?

Re: GPIO relay control

Posted: Sun Dec 02, 2018 2:10 am
by GGGss
Thanks for listening and reaching out ...

If you want to have your 16ch board connected correctly you will need 16 amplifing transistors BC547 f.i. They only 'ask' 1-2 mili Amps and can deliver the required 20mA.

Then your raspi outputs have to be configured to go high when active.
In function to the power voltage supplied you'd have to choose proper pull-up resistors. But this going too far .. simply put a 10k Ohm resistor between raspi-out and transistor base.
Your relay-board input should be 'above' the transistor.

When driving the raspi-output at more than 1,2V (depending on a, b, c and f) the relay should be activated... On regular GPIO set to go high, you get a 3,3V output -which is more than enough

In total it consumes less than 40mA which is fine for long live application. (except for parasites, harmonics induced, and clock frequency influences, ...)
This, of course, would require an extra PCB and some soldering knowledge.
Or
get yourself a true 3,3V low amps output board... you won't be switching 1kW fresnels with that - but I guess that is not the case.
(notice: if you want to install this fixed inside your house -> forget it ... you need a certified solution for that)

Re: GPIO relay control

Posted: Sun Dec 02, 2018 2:16 am
by GGGss
And rereading I realise that your question is a basic one ...
sorry for the overload

Anyway:
Your project should have a fixture installed into the universe your GPIO is at (I assume universe 1)
so
*select add a fixture
*generic - dimmer
put it on
*universe 1, channel 1 -> this is GPIO 1 on your Raspi

go to 'simple mode' and wank this slider '1'... when above (uncertain) level, channel 1 relay will activate

Re: GPIO relay control

Posted: Sun Dec 02, 2018 11:35 pm
by nicklofy
I tried writing a python script to set the gpio port to high but as soon as its ran the relay turns on?

GPIO control

Posted: Mon Dec 10, 2018 2:22 am
by nicklofy
I hooked a multi meter up to my pi from ground to a gpio pin then turned that pin to output and im getting 0 volts out?

Re: GPIO control

Posted: Mon Dec 10, 2018 11:34 am
by GGGss
nicklofy wrote: Mon Dec 10, 2018 2:22 am I hooked a multi meter up to my pi from ground to a gpio pin then turned that pin to output and im getting 0 volts out?
And your relay switches? Halleluja ... it works ;-) Look ... you are pulling the - (minus) of your relay to GND level ... so you close the circuitry with a zero and the relay switches... (You are 'pulling down')

If you would want it to work inversed, then hang your relay - (minus) to GND and your + to GPIO #1. Now you have to instruct your GPIO to go high if switched on. (You are 'pulling up' now and your multimeter should indicate 3,3V vs GND)

If above is not true I'd have to have a drawn circuitry of some kind to look at before I can help further.

Re: GPIO relay control

Posted: Tue Jan 08, 2019 12:17 pm
by Dingezz
I have simulair problems, GPIO inputs work well but i cant get the output to work.
i am using a ssh connection and the command gpio -readall to check the status of the GPIO
changing a pin in QLC from input to output shows, but i can't get it to change from 0 to 1

I used the settings on pervious page: set universe 1 output to GPIO and made a 40 channel dimmer and tryed several values between 0 and 255 in the Simple Desk

any suggestions?



something else my rpi3 has 40 GPIO pins and the QLC plugin shows only 29?

Re: GPIO relay control

Posted: Tue Jan 08, 2019 6:22 pm
by nicklofy
What type of relay are you using?

Re: GPIO relay control

Posted: Tue Jan 08, 2019 6:24 pm
by nicklofy
something else my rpi3 has 40 GPIO pins and the QLC plugin shows only 29?
Not all the pins are usable.

Re: GPIO relay control

Posted: Tue Jan 08, 2019 10:25 pm
by Dingezz
nicklofy wrote: Tue Jan 08, 2019 6:22 pm What type of relay are you using?
none for now.. i am writing a Python script to do logics with the GPIO and i think i figured this one out, forgot about the BCM nummer+one = DMX Chanel ( in my case GPIO. 0 = BCM 17 = DMX 18 ) and i expected anything larger then zero to be a GPIO logic 1. is seems i'ts a bit different DMX 0 to 127 = gives a 1 on the GPIO and 128 to 255 gives a 0

Re: GPIO relay control

Posted: Tue Jan 08, 2019 10:28 pm
by Dingezz
nicklofy wrote: Tue Jan 08, 2019 6:24 pm
something else my rpi3 has 40 GPIO pins and the QLC plugin shows only 29?
Not all the pins are usable.
Yes i see it, thnx!

Re: GPIO relay control

Posted: Wed Jan 09, 2019 3:25 am
by nicklofy
is seems i'ts a bit different DMX 0 to 127 = gives a 1 on the GPIO and 128 to 255 gives a 0
You can invert this in the setting somewhere if needed.

Re: GPIO relay control

Posted: Wed Jan 09, 2019 3:27 am
by nicklofy
Also my issue originally was solved by a friend of my who discoed that the relay I was using wanted absolutely 0 volts to turn off, witch was solved with a few additional components.