Use your phone to open your gate or garage

Da raspibo.

Radio remote controls are obsolete. We all carry our portable phones, why not using them as remote controls to open the gate of your parking lot or your garage?

Using asterisk, a Raspberry PI, a Radio TX module and the availability of a number from a VOIP provider it is possible to set up this solution. (Further info can be found in the posting Some experiments on Radio Remote Controls, it works with radio controlled devices using mm53200 encoding on 433.92Mhz or 315Mhz or 330Mhz).

When you call the number of the gate from your portable, the gate will open and the call will be hunged up (so the usage is for free!). You do not need to hack the radio controlled gate, your raspberry pi will fake to be a remote control. (NB: the TX module must use the same frequency of the remote used by your gate, and must be provided with a suitable antenna, e.g. a chunk of telephone wire 1/4 of the wavelen long).

First step: cabling It is straight simple. The TX module has three pins labelled VCC, GND and DATA. Connect VCC to +5v, GND to GND, and Data to one of the GPIO.

Second step: the code. Get and compile the source code on your raspberry pi:

wget http://www.raspibo.org/renzo/mm53200.gpio.c

... edit the source code, change the GPIO constant to match the number of the GPIO pin used (in the source code it is 24).

gcc -o mm53200.gpio mm53200.gpio.c
sudo cp mm53200.gpio /usr/local/lib
sudo chmod 4755 /usr/local/lib/mm53200.gpio

Now you can test the mm53200.gpio command:

mm53200 100100100100

(change 100100100100 with the code of the remote of your gate, i.e. the configuration of the dip switches).

Third step: configure asterisk. Provided you have registered your asterisk to your sip provider, here are some lines to add to /etc/asterisk/extensions.conf

exten => 051051051,1,GotoIf($["${CALLERIDNUM}" = "3351111111"]?1000)
exten => 051051051,2,GotoIf($["${CALLERIDNUM}" = "3392222222"]?1000)
exten => 051051051,3,GotoIf($["${CALLERIDNUM}" = "3393333333"]?1000)
exten => 051051051,4,GotoIf($["${CALLERIDNUM}" = "3284444444"]?1000)
exten => 051051051,5,GotoIf($["${CALLERIDNUM}" = "3285555555"]?1000)
exten => 051051051,6,Hangup
exten => 051051051,1000,System(/usr/local/bin/mm53200.gpio 100100100100)
exten => 051051051,1001,Hangup

In this example: 051051051 is the phone number from the VOIP provider as registered in /etc/asterisk/sip.conf. 03351111111, 03392222222.... are the caller ID-s of the portable phones authorized to open the gate.

That's all. Here it is working like a charm.

Strumenti personali
Namespace

Varianti
Azioni
Navigazione
Strumenti