My Android Garage Door Opener

What does a mobile-enabled automated garage door opener has to do with Health Informatics? As it turns out, quite a bit!

First of all, this is a demo of an Android app that communicates bi-directionally and in real time with an Arduino-controlled sensor for a generic garage door opener. The sensor consists of an optical encoder from an old mouse scroll wheel and a leaf switch. The optical encoder transforms the rotational motion of the door mechanism into a signal that is decoded by the Arduino. The switch detects when the door is fully closed. The Arduino micro-controller communicates with a Linux box through a serial port. Each time there is a significant change in the door position or in the switch status, the micro-controller generates a message that is processed by an application hosted by the Linux box. The application functions as a server as well and is able to accept encrypted network connection sessions from clients residing on, you guessed, mobile devices. The client application shows, in real-time, the door switch status and door position and allows opening and closing a simple touch up and down commands.

The system allows many concurrent client applications to connect and display the door switch status, as demonstrated in the next video.

For rotational stability and robustness, the optical encoder sensor was fixed in a high quality bearing taken from an old hard-drive and ruggedized, in true hacker spirit, with copious amounts of glue from a glue gun. The mechanical connection with the door mechanism is done through a spring for reducing the vibrations. The transparent plastic knob was the only part I could find that could fit an old Tamiya toy wheel that I noticed it fit perfectly into the garage door shaft that rotates when the door is opened and closed (pheww...). You can probably also spot the transistor switch that opens/closes the door.

Connection to informatics

So what is the connection to Health Informatics? First, let’s review the four typical steps of informatics applications:

1. Measure, observe and gather data about something that is relevant to one’s health,

2. Make records of the data, observations and measurements (e.g., in a database),

3. Gain new knowledge and information by analyzing the data records and by interpreting results,

4. Make good decisions using the new information.

Maybe you do not yet agree that tracking one’s garage door motion and usage patterns is relevant to one’s health. Unless… you picture yourself or someone else to be much older and suffering from a condition that causes one to forget things. Suddenly, measuring, observing and gathering data about one’s garage door (step 1), or about any object one interacts in their daily life for that matter, becomes relevant to one’s health status. The data can be recorded by logging the door activity and by storing the messages in a database (step 2). The analysis of the collected data (step 3) could result in detecting patterns, knowledge and objective evidence that can be interpreted quite a few ways. One of them is that the garage door appears to be left open for long periods of times, including at night (when there should be little reason to). This knowledge could help one make some decisions (step 4), health related or not. So, at the very least the system makes it possible to check the status of the door. However, it is easy to imagine more intelligent approaches consisting of automated rules (e.g., door open for more than 30 minutes, after 10PM, should set off an audible alarm and then close by itself), season variances, awareness of user preferences, etc. In fact, I would contend that the apparent triviality of operating a garage door operation is misleading: computing an optimal decision to close or open the door could, in theory involve a large, likely unbounded number of conditions, ranging from weather conditions, to visitors in the house to vacation and scheduling to real estate transactions (a.k.a, selling your house). From a theoretical point of view you could say that such decisions are dependent on context. This context dependence is something I've written about before, so I'll stop here.

Finally, some of the principles and technological hurdles that had to be overcome in order to implement this simple garage door application can be extended to other applications that involve an complex sensor networks, comprising heterogeneous computing platforms and consequently more data for analysis. As an example, consider that a solution to encrypting all the communication between the server and mobile clients had to be found and implemented. For security reasons, without this important component, the mobile application would have to be confined to the local wireless network. This will require the mobile device to have WiFi enabled (battery concerns) and be in close proximity to the wireless router. Good luck making it work from your car as you drive in and want to open your garage door. Alternatively, one could setup a VPN and connect to the local network directly from the cellular data network. That would work from anywhere in the world, but would require one to log on to VPN (difficult on older mobile devices - though some apps may help with that) each time just to open a garage door. Leaving the VPN client on will eventually disconnect it if the the mobile device turns off. Therefore, the only convenient solution I could find was to create a dedicated encrypted data network connection that allows the client to directly connect to the server without the need for additional apps or complex logons. Well, I better not lose my phone in this case. Or else I will probably find my garage door opening and closing to the amusement of whomever found it.

To conclude, this project not only opened the world of mobile application development to me but also forced me to find workable solutions to a variety of problems that I would not have otherwise thought of. The "Powerpoint" stage must be followed by the "actually build the thing" stage. This kind of applied problem solving methodology is extremely common and necessary for health informatics.

Stefan V. Pantazi

Feb 22, 2012

Updated June 17, 2013