vrijdag 8 december 2017

My IOT garage - the components

One of the gripes I have with my garage is that I have no way of checking whether the garage doors are closed or not.

Why would this be an issue?  Well it happened before that one of the remotes get accidentally hit and one of my garage doors opens up without me knowing it.  As I do not have a line of sight onto the garage doors from my house, I have no way of checking without actually walking up to my garage and seeing if it is closed or not.

Also, garage doors are not really known for their security, if somebody forces up one of the garage doors, I will not know until it is too late.

A second issue with the garage doors is that I only can open them with my remotes.  The keypad I used to have was broken and I took it away, as just pushing the up arrow opened up my garage doors 😨

So what components am I planning to use:
A raspberry pi in a case that can be mounted on a DIN rail.


A waterproof keypad with RFID reader


2 reed switches to detect if my garage doors are open (female connectors already soldered on)


Why the DIN rail housing?
Well there is a fuse box in my garage that has DIN rails where I could mount the raspberry pi to keep dust and insects out.  I might mount it closer to the garage doors in testing phase. But eventually it should end up there.

As the leads from the keypad are quit short, a UTP cable was sacrificed to lengthen most leads coming from the keypad.

Next to the above components there are 2 additional items to add.  An power transformer for the keypad and one for the raspberry pi.


The leads on the reed switches are too short to be installed comfortably.  So a second UTP cable was sacrificed for the greater good.  Its plugs were cut off and on one end they were soldered to the reed switches.



On the other end some connectors were soldered on to connect to the raspberry pi.


However, above setup failed miserably.

The location where this DIN rail housing was located, is not able to connect over WiFi to my house WiFi network.  Most probably due to some brick walls, the distance and the fact that my garage and the small workshop between the garage and my home have metal roofs.
And I tried a lot of options and tweaks.

  • The power adapter for the Raspberry pi, did not seem to be able to provide enough power for the RPi (and the wifi dongle)
  • An ad hoc setup with another RPi, a beefy power supply and an 12dbi antenna still was not able to connect to my WiFi network.
  • I then setup a dedicated RPi access point, also with a 12 dbi antenna, but this did not help either.
  • So, I moved the second RPi in my workshop (the one adjoining my garage) to the closest point to my house.  Then I got some wifi signal from my dedicated RPi access point, but pretty intermittent.
  • Then finally, after using a wifi analyzer, decided to switch back to my regular access point, and voila, connection....

Well most of the time, from time to time connection still drops away, but thats more like every few weeks rather than hours.

So how was I able to move the RPi with the limited leads on the reed switches?

  • I combined 2 RJ45 breakout boards, 2 RJ45 8 pin connectors, 25 meters of UTP cable.
  • On one side I soldered the leads of the read switches to the RJ45 breakout board
  • On the other side I resoldered the connecters for my RPi GPIO pins to the other RJ45 breakout board.

I now have some very basic python code that reads out the GPIO pins and transfers the status of the reed switches to a basic python web service at my house.
The basic python web service receives the messages from my garage, and depending on the status of the reed switches will make one or two LEDs blink to indicate an open garage door.

The end of the struggle, ...no.

  • Occasionally the connection still drops.  The I need to reboot the RPi in my workshop. But I also need to disconnect the wifi adapter before doing so.  That's because the WiFi dongle does not get activated when rebooting. Only when you plug it in afterwards, it works.
  • The python code seems to fail from time to time without an apparent reason.  Although very basic and naive code wise, I would expect it to just keep working.
  • When either the connection or the python code fails, it is not immediately apparent.
  • The keyboard works, but is beeping error sequence. Although everything worked with a dedicated power supply when testing it out, when mounting it on my garage it continuously flashes error.  Especially if I turn on my TL lights :-S


Future plans

  • Some monitoring to see when either the connection dropped or the python code stopped working.
  • Improve Python code to aggregate the readouts when status does not change and send the aggregated readouts occasionally instead of a call each second.
  • Some alerting solution to sms/IM me whenever the status of one of the garage doors changes as I am not constantly looking at the LED equipped RPi.