danlawton
Posts: 6
Joined: Fri Jan 24, 2014 6:53 pm

"Pushing" Buttons with GPIO

Thu Mar 13, 2014 6:10 am

Hi Guys,

I have a fob for my house alarm and i want to use it with my Pi so i can activate/deactivate my alarm via the internet through a secure page.

Ive attached a picture of the button in the fob

Image
And i was wondering if its possible to use GPIO to "push" the button using Python??

Cheers Danny

Paul Moir
Posts: 46
Joined: Wed Dec 04, 2013 7:25 pm
Location: Nova Scotia, Canada

Re: "Pushing" Buttons with GPIO

Thu Mar 13, 2014 6:24 am

Sure. The dumbest/easiest way would be to use a reed relay. Digikey has one that runs at 3v/6ma which would be directly compatible with the GPIO if you add a freewheeling diode. About $5 each.

danlawton
Posts: 6
Joined: Fri Jan 24, 2014 6:53 pm

Re: "Pushing" Buttons with GPIO

Thu Mar 13, 2014 4:48 pm

Thanks for your reply :).

you said that is the easiest way, im intrigued in hearing about the "harder" way of doing it.

in surprised you cant hook up some wire to the ground GPIO and another one say GPIO18 and make GPIO18 high.

oh well thanks again :)

Danny

Tarcas
Posts: 741
Joined: Thu Jan 09, 2014 5:38 am
Location: USA

Re: "Pushing" Buttons with GPIO

Thu Mar 13, 2014 10:49 pm

in surprised you cant hook up some wire to the ground GPIO and another one say GPIO18 and make GPIO18 high.
This is unwise, without knowing that the voltage that the key fob runs at is exactly 3.3. If it's different, you're liable to fry something by doing that. You instead want a method to electrically bypass the button, simulating a button press, based on a small input voltage from the Pi.
I'm not familiar with the "reed relay" that Paul suggested, but other methods include using a transistor or a relay to trigger the button circuit. You will find plenty of tutorials about using them for exactly this task on Google or YouTube.

Paul Moir
Posts: 46
Joined: Wed Dec 04, 2013 7:25 pm
Location: Nova Scotia, Canada

Re: "Pushing" Buttons with GPIO

Sat Mar 15, 2014 8:00 am

Yeah, exactly. The hard way is to reverse engineer the buttons on the FOB and then figure out how it's chip interfaces with them. The goal will be using a transistor or FET in your solution as the switching element. 'Course your FOB will need a common ground with the Pi, and you'll have to know a bit of what your doing (less perhaps with the FET, likely MOSFET, switching element).

Or you skip the whole ordeal and use a relay...

Tarcas: "reed" relays use a very small reed switching element, so their coils consume very little current to actuate them. "reed" switches are usually glass encapsulated and about the diameter of a glass encapsulated diode, but much longer. A super-common use for these reed switches is the magnetic door switches used in burglar alarms. The downside to them is they can't handle much current or voltage.
Back in the day, some high reliability keyboards used a combination of reed switches and small permanent magnets which were attached to the keys.

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

Re: "Pushing" Buttons with GPIO

Sat Mar 15, 2014 8:22 am

A reed relay is one way of fully isolating the keyfob circuit from the Pi. Another is to use opto-couplers (or opto-isolator), although the output photo-transistor would need to be connected the right way round. Advantage of these is that they are much smaller, you can get four or more in one chip-sized package and they have no moving parts.

User avatar
FLYFISH TECHNOLOGIES
Posts: 1750
Joined: Thu Oct 03, 2013 7:48 am
Location: Ljubljana, Slovenia
Contact: Website

Re: "Pushing" Buttons with GPIO

Sat Mar 15, 2014 12:43 pm

Hi,
danlawton wrote:you said that is the easiest way, im intrigued in hearing about the "harder" way of doing it.
in surprised you cant hook up some wire to the ground GPIO and another one say GPIO18 and make GPIO18 high.
That would really be the hard(est) way, because you can burn something.

Read this thread: http://www.raspberrypi.org/forum/viewto ... 13#p457513


Best wishes, Ivan Zilic.
Running out of GPIO pins and/or need to read analog values?
Solution: http://www.flyfish-tech.com/FF32

User avatar
mahjongg
Forum Moderator
Forum Moderator
Posts: 12400
Joined: Sun Mar 11, 2012 12:19 am
Location: South Holland, The Netherlands

Re: "Pushing" Buttons with GPIO

Sat Mar 15, 2014 1:50 pm

you do not know how the switches are connected to the chip in the FOB, if one end is connected to the GND of the FOB, (and the you have connected the GND's of the FOB and PI together) then yes, you could simulate a key press by pulling the other pin of the key low, by switching the GPIO pin with which you do it from high impedance (i.e. Input) to driving low (i.e. Outputting a low). But actually there is a chance that the key is connected not to GND on one end, but to another key of the FOB! That can happen when the keys are connected in a matrix (matrix scanning), as is normally the case with for example a remote control. If your FOB has only a few keys its more likely each key is simply directly connected to an input pin (and a pull-up resistor).

instead of a (reed)relay you could also use an opto-isolator, but then you need to know the polarity of the voltage over the key.

Return to “Automation, sensing and robotics”