Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.sys.raspberry-pi > #12684
| From | rickman <gnuarm@gmail.com> |
|---|---|
| Newsgroups | comp.sys.raspberry-pi |
| Subject | Re: control a relay from the pi via GPIO |
| Date | 2016-07-10 12:43 -0400 |
| Organization | A noiseless patient Spider |
| Message-ID | <nlttuo$m3v$1@dont-email.me> (permalink) |
| References | <nljpg6$me8$1@dont-email.me> <nllbra$3ga$1@dont-email.me> <nltq7o$8kj$1@dont-email.me> |
On 7/10/2016 11:40 AM, Björn Lundin wrote:
> On 2016-07-07 12:44, Gordon Henderson wrote:
>
>>>
>>> What am I doing wrong here?
>>
>> Several things.
>>
>> Firstly you've bought a cheap relay board which may have said "Raspberry
>> Pi" on it website, but it really is not Pi compatible. This happens a lot,
>> especially with sellers in far-off land you have no way to get in-touch
>> with. They lie and use the Raspberry Pi name to lure unsuspecting buyers.
>>
>
> Well, what can I say. One born any minute ?
>
>
>> Leave it wired as it is, but then remove the wire from the Pi'2 GPIO
>> pin 22 and connect it to 0v/Gnd.
>>
>> If the relay fires then you have one of these.
>>
>> And by reading the above, this is most likely.
>
> correct, it does.
Info on this module is scant. Is there a reason why you don't trace out
the circuit so you know for sure what the circuit is? It shouldn't be
that hard to do.
If you only have one transistor, the circuit you have is most likely the
one Gordon is thinking of. But it is always possible not. Trace it out
and we'll know for sure.
>> So do this:
>>
>> Re-connect it to the Pi on that pin (bcm_gpio 22)
>>
>> and run these commands:
>>
>> gpio -g mode 22 in
>>
>> Realy ought to be off and stay off.
>>
>> gpio -g write 22 0
>>
>> Nothing should happen at this point.
>>
>> gpio -g mode 22 out
>>
>> Relay should click ON. The pin is in output mode and is sinking
>> the current from the 5v, via the resistor + LED to 0v.
>
> and it does
>
>
>>
>> gpio -g mode 22 in
>>
>> Relay should click off.
>>
>
> this one too.
> toggling the port bewteen in and out toggles the relay
>
>
>> Really, you need to throw this relay board away and get something designed
>> for the Pi. Use something like a PiFace board.
>
> I'll hook it up via my arduiono, if I can bring that to life again.
It can be used with the rPi if you use something to limit the voltage on
the I/O pin. A blue, white or UV LED would be perfect for this. As
long as the circuit on the relay board has a resistor in the path from 5
volts to the input pin, the LED can safely clamp the voltage at that pin
to about 3.3 volts protecting the rPi I/O. Use an IR LED in series
between the rPi and the relay board and it will drop the excess voltage
so the visible LED won't cause the relay circuit to activate.
| | Relay _____
| | Module / |
| IR LED | |_ ---
rPi | | /| | |/ Gnd
Header -->>----+-----|< |------<<----\/\/\-----| PNP
Output | | | \| | |\
| _|_ | \
| \ / | |
| V Blue, White | |
| ----- or UV LED | C||
| | | C|| Relay
| C|| Coil
| |
--- ---
Gnd 5 volts
If the circuit on the relay board doesn't have the resistor on the base
you need to add it to your circuit, but I find that unlikely.
The base-emitter junction of the transistor will drop 0.7 volts when
forward biased. The IR LED will drop about 1.2 volts and the blue LED
will drop around 3.4 volts. This adds up to more than 5 volts which
means only a very small current will flow (your goal) when the rPi
output is not pulling low. This should not be enough to pull in the
relay. If the relay still activates without being pulled low by the rPi
output, use a red LED in place of the IR (or add some series
resistance), but I'm pretty sure this won't be needed. The relay needs
significant current to activate and the transistor only has so much gain.
Just an idea to let you use this module with your rPi. This circuit
works for a lot of 5 volt circuits as long as a small trickle current
won't trigger it.
Rick C.
>> Gordon
>> (Author of wiringPi)
>
> And thanks a lot for the walk-trough for dummies,
> and for wiringPi.
--
Rick C
Back to comp.sys.raspberry-pi | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
control a relay from the pi via GPIO Björn Lundin <b.f.lundin@gmail.com> - 2016-07-06 22:24 +0200
Re: control a relay from the pi via GPIO rickman <gnuarm@gmail.com> - 2016-07-06 16:45 -0400
Re: control a relay from the pi via GPIO rickman <gnuarm@gmail.com> - 2016-07-06 17:03 -0400
Re: control a relay from the pi via GPIO Dennis <dennis@none.none> - 2016-07-06 18:00 -0500
Re: control a relay from the pi via GPIO Dennis <dennis@none.none> - 2016-07-06 21:10 -0500
Re: control a relay from the pi via GPIO rickman <gnuarm@gmail.com> - 2016-07-06 23:55 -0400
Re: control a relay from the pi via GPIO Dennis <dennis@none.none> - 2016-07-07 12:30 -0500
Re: control a relay from the pi via GPIO Björn Lundin <b.f.lundin@gmail.com> - 2016-07-07 19:21 +0200
Re: control a relay from the pi via GPIO rickman <gnuarm@gmail.com> - 2016-07-07 14:34 -0400
Re: control a relay from the pi via GPIO Dennis <dennis@none.none> - 2016-07-07 17:10 -0500
Re: control a relay from the pi via GPIO rickman <gnuarm@gmail.com> - 2016-07-08 00:29 -0400
Re: control a relay from the pi via GPIO Björn Lundin <b.f.lundin@gmail.com> - 2016-07-12 10:18 +0200
Re: control a relay from the pi via GPIO Rob Morley <nospam@ntlworld.com> - 2016-07-12 12:49 +0100
Re: control a relay from the pi via GPIO Gordon Henderson <gordon+usenet@drogon.net> - 2016-07-07 10:44 +0000
Re: control a relay from the pi via GPIO Björn Lundin <b.f.lundin@gmail.com> - 2016-07-10 17:40 +0200
Re: control a relay from the pi via GPIO rickman <gnuarm@gmail.com> - 2016-07-10 12:43 -0400
Re: control a relay from the pi via GPIO Björn Lundin <b.f.lundin@gmail.com> - 2016-07-12 10:06 +0200
Re: control a relay from the pi via GPIO The Natural Philosopher <tnp@invalid.invalid> - 2016-07-12 09:20 +0100
Re: control a relay from the pi via GPIO rickman <gnuarm@gmail.com> - 2016-07-12 04:23 -0400
Re: control a relay from the pi via GPIO The Natural Philosopher <tnp@invalid.invalid> - 2016-07-12 09:58 +0100
Re: control a relay from the pi via GPIO Graham. <graham-usenet@mail.com> - 2016-07-11 23:10 +0100
Re: control a relay from the pi via GPIO Graham. <graham-usenet@mail.com> - 2016-07-08 21:45 +0100
Re: control a relay from the pi via GPIO Björn Lundin <b.f.lundin@gmail.com> - 2016-07-10 17:26 +0200
Re: control a relay from the pi via GPIO Graham. <graham-usenet@mail.com> - 2016-07-11 22:13 +0100
Re: control a relay from the pi via GPIO Björn Lundin <b.f.lundin@gmail.com> - 2016-07-12 10:00 +0200
Re: control a relay from the pi via GPIO Big Bad Bob <BigBadBob-at-mrp3-dot-com@testing.local> - 2016-08-18 10:08 -0700
Re: control a relay from the pi via GPIO rickman <gnuarm@gmail.com> - 2016-08-18 16:40 -0400
csiph-web