Controlling a garage door remote

Yes, exactly. Choosing not to use the cloud meant that I had to implement my own AES based secure communication channel. This was actually quite convenient, b/c Spark Core firmware already includes TropicSSL library, which had everything I needed. The biggest challenge was actually generation of enough entropy to create good random numbers, but I think that is solved now.

The reason for not using the cloud was two-fold. First, this was an educational project, which I wanted to use to increase my understanding of cryptography and authentication algorithms.

Second, I am concerned about man-in-the-middle type replay attacks, and I am still not clear if Spark’s implementation of OAuth2 properly implements token expiration after every request. I am not saying that it doesn’t, and section 4.1.2 of OAuth2 RFC does say that if an authorization code is used more than once, the authorization server MUST deny the request, but I could not easily find the code that does this when I looked here:

Perhaps someone who knows these details can provide a clarification?

I also felt that architecturally speaking, it is simpler not to use the cloud in a situation where I can easily distribute a shared key and communicate directly. And since I implemented my secure channel as a modular library, it is now trivial to use it in any other project that wants p2p communication like this - just include the library, implement a MessageConsumer, implement a CommunicationChannel and you are good to go.


I’ve been working on a garage door monitor based upon the code posted a while ago by @austinpe. I added the ability to email a warning after either door is open for 20 minutes. Unfortunately, my time has been spent trying to incorporate email code posted by @BDub, but it isn’t reliable enough to use in real life, so I will start from scratch and switch over to using Pushingbox or Atomiot to get email alerts. Has anyone else done a garage project that does alerts?

vace117, awesome, thanks for the detailed explanation!

And here’s the full Instructable, as promised:

1 Like

Alright so finally got around to taking some pictures and cleaning the code up, now this was my first Arduino project and is yet to be ported to Spark

Now most peoples code simply blindly opens or closes the door, or fails to know the actual state of the door… My code uses two reed switches to determine if the door is open or closed, as well as confirming if the door reaches its destination state (eg. door does not close correctly due to something blocking its path)

As I am in a rental house (unable to make changes), and the operator is quite old (unable to find the connections in the box) I have opted to open the remote and hook into the button

As this is designed for an Arduino Uno, it uses a serial command to operate, so DOOR OPEN will open the door is the door is not currently open, and DOOR CLOSE for the obvious, DOOR STATUS is used to change the status of the door.

Once I get my Spark Core I will port the code and design a web interface for it

Fritz Diagram and Photos -
Code -

it was great to read your project, you made everything super-clear

+1 for providing me with the links to abra electronics with local prices! :wink:


thanks for the pics.
great idea on using the same half of the reed switch for sensing the open/close position!
I’m going to use it in my garage :wink:

@gusgonnet I would also suggest not making the same mistake I did… I put the reed sensors on before the magnet… had to reposition them after installing them :frowning: that being said the magnet on mine is also held in place by some plastic from a milk container :stuck_out_tongue: this allows it to bend and push closer to the reed switch as my roller door rails have a lip that makes it hard to get the magnet close

Would love to see more of what people have done, seems like everyone wants to do this project

thanks for the tip on placing the reed magnet.
For the plastic placer, I am still more inclined to use a coffee container :wink: hehehe

just in case it helps someone, I got around to document my garage remote:

Missing master_key.h file

I am trying to compile the GarageOpenerSpark-master code on OSX and the compiler is complaining that it can’t find master_key.h. Which library is this included from?