Arduino door switch

Last week a customer of mine mentioned an issue with a door. This door is inside their server room which leads to a second room. They wanted that this door is closed most of the time because the air conditioning system doesn’t really need to cool down the second room.  The second room is around 15 square meters but goes through to the second floor. It’s seems that this space was supposed to be for a freight elevator in the first place. Now it’s just a giant cable channel and the room a welcome place for the technicians. It’s more cozy to stay there than in the actual server room less noise and their are chairs and tables.

Using a system like NetBotz or similar is out of the question because they are way to expensive just to check the state of a door. It seems a perfect place for an Arduino. I remembered that I wrote a script (arduino-xmpp) which just send a message to an XMPP recipient when something happens. I updated that script that it can work with a digital input instead of an analog value. It’s still messy but works.

Switch which is pressed when the doors is open, an Arduino, an USB cable, a Jabber/XMPP server, and a linux system with python, that’s all what was needed. I was lucky because I only needed a switch (found one in an old computer casing). The customers agreed to connect the Arduino to a Debian machine with a long USB cable and created an account on their Jabber server.

So, this solution is home-made but the overall costs of CHF 40 (around 30 Euro) are a huge advantage. I think that I will port this to the Raspberry Pi. Only one device means more flexibility and the costs are almost the same. Well, with the Arduino it would be very easy to check if the lights in the second room are on and the temperature there. As far as I know is the Raspberry Pi not capable to work with analog sensors directly. A topic for another day…

Below is a screenshot while script is working (sorry, I’m cheating with a standard button that I press with my finger, no door).

The code is hosted at

This entry was posted in Arduino, XMPP. Bookmark the permalink.

One Response to Arduino door switch

  1. Pingback: Node.js and MQTT | bits and pieces

Leave a Reply

Your email address will not be published. Required fields are marked *

Time limit is exhausted. Please reload CAPTCHA.