superlative
Posts: 5
Joined: Sat Nov 03, 2012 11:14 pm

GPIO Help - Exit button on door

Mon Nov 17, 2014 5:15 am

Hi,

I have an exit button on a door motor, and if i join two wires between two inputs on the circuit just briefly, the door motor opens an automatic door.

I wanted to control this via the raspberry pi.

Initially I tried making sure I could turn a LED on and off as a test, before I went and connected the wires to my door motor.

I connected GPIO 17 and the Ground straight next to it to the LED.
Turning GPIO 17 on via the "value" setting and using echo, and then using "sleep 1" in my script, and then turning it off, worked fine - the LED came on and then turned off.

I then went down to my door motor and connected GPIO17 and Ground to the exit button circuit on the motor. However the exit circuit was triggered right away even though GPIO17 I had not turned on yet.

I assume this means that the circuit is "connected" between these two wires.

What GPIO and pin should I use where I can have the circuit "not connected" and then "connected" similar to a relay?

I just need to give a quick pulse when I turn the GPIO on to connect the circuit, and then turn it straight back off.

Perhaps I should not use Ground, and I should use something else?

Any help appreciated.

User avatar
joan
Posts: 14959
Joined: Thu Jul 05, 2012 5:09 pm
Location: UK

Re: GPIO Help - Exit button on door

Mon Nov 17, 2014 9:26 am

A relay would be a safer bet.

Perhaps wait for an electrical type person to comment.

At the moment it sounds like you are going to connect a gpio to ground and switch it high. In effect connect 3V3 to ground. A fairly successful way of rebooting the Pi and/or destroying a gpio.

superlative
Posts: 5
Joined: Sat Nov 03, 2012 11:14 pm

Re: GPIO Help - Exit button on door

Mon Nov 17, 2014 9:37 am

Hi Joan.

Thanks for your reply.

I did a multimeter check and there is 4 volts running over the exit circuit.
If I connect the two wires on the exit circuit for 1 second, the door motor opens the door.

I was hoping to avoid a relay as an additional item if it is possible.

However as mentioned, GPIO17 and Ground - and with the GPIO17 turned off, the circuit is still active.

Maybe I need a relay, but if I can save having to do that it would be great....

Any help appreciated.

User avatar
joan
Posts: 14959
Joined: Thu Jul 05, 2012 5:09 pm
Location: UK

Re: GPIO Help - Exit button on door

Mon Nov 17, 2014 9:47 am

It's not safe to connect a Pi gpio to 4V, they are 3V3, you will destroy the gpio sooner or later.

I don't believe that you can do what you want without at least a transistor.

User avatar
Burngate
Posts: 6313
Joined: Thu Sep 29, 2011 4:34 pm
Location: Berkshire UK Tralfamadore
Contact: Website

Re: GPIO Help - Exit button on door

Mon Nov 17, 2014 10:52 am

The Pi effectively connects its GPIO to either ground (when set to 0) or 3v3 (when set to 1). You need something to make those two states look like an open-circuit (a.k.a. button not pushed) or a short-circuit (a.k.a. button pushed)
A relay is one method, a transistor is another, an opto-isolator is a third.*

You've measured 4v between the two wires, when the button isn't pressed. But you also need to know the current that flows when the button is pressed.
The easiest way to check that is to put the multimeter across the wires again, but in current mode - the meter acts like an open-circuit when in voltage mode, and a short-circuit when in current mode.

Once you have those figures, you can decide what device is best to use.

*A fourth is to employ a small child with a mobile phone: set up your Pi so that it sends a text to the small child, and connect an autonomous robot to dispense a treat when the door is open.

superlative
Posts: 5
Joined: Sat Nov 03, 2012 11:14 pm

Re: GPIO Help - Exit button on door

Mon Nov 17, 2014 12:33 pm

hi.

so if i connect a relay to the gpio17 and ground, then on the other part of the relay i can connect this circuit for the exit button .

then when the relay is activated by gpio17 and ground, the 4 volt circuit will be allowed to flow.

so the relay i would buy would have to be activated by 3.3 volts? is that correct? i cant get a 12 volt relay?

please help.

User avatar
joan
Posts: 14959
Joined: Thu Jul 05, 2012 5:09 pm
Location: UK

Re: GPIO Help - Exit button on door

Mon Nov 17, 2014 12:47 pm

Afraid not. The gpios are unlikely to have enough current to switch a relay. Even if they did the back EMF from a collapsing relay coil would kill the gpio so you'd need at least a protective diode.

I think a ULN2003A would work. The gpio could switch that on and the ULN2003A would act as the relay.

http://www.hobbytronics.co.uk/electroni ... gton-array

User avatar
rpdom
Posts: 17274
Joined: Sun May 06, 2012 5:17 am
Location: Chelmsford, Essex, UK

Re: GPIO Help - Exit button on door

Mon Nov 17, 2014 12:49 pm

You wouldn't drive the relay directly from the GPIO pin, as it can't provide enough current to do it. You would drive the relay via a transistor or driver chip and supply it with 5V or 12V as required.

If the current required to trigger the door is low enough, it might be easier to use an opto-isolator (or opto-coupler) which can be driven from the Pi with just a suitable resistor.

superlative
Posts: 5
Joined: Sat Nov 03, 2012 11:14 pm

Re: GPIO Help - Exit button on door

Mon Nov 17, 2014 1:04 pm

hi guys.

here is the relay i am looking at:

http://www.jaycar.com.au/productView.asp?ID=SY4036

So to get this to work, i would have to add a transistor before the relay?

any more pointers apprecaited.

PiGraham
Posts: 3971
Joined: Fri Jun 07, 2013 12:37 pm
Location: Waterlooville

Re: GPIO Help - Exit button on door

Mon Nov 17, 2014 3:02 pm

This would do the job.

http://www.hobbytronics.co.uk/relay-boa ... egory_id=0

It has a transistor on board and is designed to support 3.3V logic.

This might do as well, but the site gives no specs.

http://www.jaycar.com.au/productView.asp?ID=KC5434

Return to “Troubleshooting”