I’ve posted a new project to github (https://github.com/markmoro/gate_opener). The aim of this project is to make my driveway gate open as I drive up to it. It works by using geo fencing on my phone to detect that I am close to my house and then send a message to an Arduino with ethernet shield to open the gate. The opening it self is done with a spare gate remote that has had the switch replaced with a MOSFET. This project is still in progress.
The key thing about this project was to make sure that only some one with a correct code can open the gate. To do this there is a few steps:-
- Both the Arduino and the phone have a shared secret key
- The phone requests a token from the Arduino
- The token is appended with the command (‘open’ string) and an HMAC digest is created with the token
- The digest is sent as a POST parameter to the Arduino
- The Arduino re-creates the digest and verifies the received digest matches
- The gate is open (sends a 500ms pulse to the MOSFET gate to open the switch).
The above scheme should prevent any replay attacks as all of the requests are unencrypted (there is no SSL for Arduino). There is also a test Python bottle server and test bash scripts to test both sides of the communications (in the webapp folder).
There has been a few issues with the MOSFET circuit which I will fix in the next few days and post!