~ Doorhacking: Opening a Door With Your Cellphone» By Joren on Thursday 22 April 2010
The problem: There is a group of people that want access to Hackerspace Ghent but there is only one remote to open the gate.
The solution: Build a system that reacts to a phone call by opening the gate if the number of the caller is whitelisted.
What you need:
- A BeagleBoard or some BeagleBoard alternative with a Linux distribution running on it. Any server running a unix like operating system should be usable.
- A Huaweii e220 or an alternative GSM that supports (a subset of) AT commands and has a USB port.
- A team of hackers that know how to solder something togeher. E.g. The hardware guys of hackerspace Ghent.
- A python script that reacts to calls.
The Hack: First of all try to get caller id working by following the Caller ID with Linux and Huawei e220 tutorial. If this works you can listen to the serial communication using pySerial and react to a call. The following python code shows the wait for call method:
def wait_for_call(self): self.data_channel.open() call_id_pattern = re.compile('.*CLIP.*"\+([0-9]+)",.*') while True: bytes = self.data_channel.inWaiting() buffer = self.data_channel.readline(bytes) call_id_match = call_id_pattern.match(buffer) if call_id_match: number = call_id_match.group(1) self.handle_call(number)
handle_call method … handles the call.
The second thing that is needed is a way to send a signal from the beagle board to the remote. Sending a signal from the beagle board using Linux is really simple. The following bash commands initialize, activate and deactivate a pin.
echo 168 > /sys/class/gpio/export echo "high" > /sys/class/gpio/gpio168/direction echo "low" > /sys/class/gpio/gpio168/direction