[3.1.16] MITERS Door

Description of Project

The project was aimed to create a reliable system in which MIT students could find-out if the MIT Electronic Society (MITERS) was currently open. MITERS is a Student Operated club for Students, with the occasional MIT Community members(Staff, Faculty, Alumni).

Processes Applied:

Raspberry Pi


The way this projected developed was as follows:

  • Get a Raspberry Pi to poll two pins to see if a switch is open or closed. This ultimately would be the code that determines if the door is open or closed, which would trigger various statements.
  • Get a python code to tweet a string. This step took some of the most finagling because roughly half a year before this project Twitter released a whole new update of their API which made all tutorials obsolete.
  • Get a temperature Sensor to read out the Temp. and Humidity.

Once I had these three components working independently I started to integrate them into a working setup. But I ran into an issuewhen I setup the raspberry pi to be remote accessible to make it easier to use. The issue was that on the MIT networks the raspberry pi's IP address would get changed every so often, either due to disconnection or some network setup/requirement. Because of this increasingly frustrating issue i developed an Get-IP python script as well as an Email script, which I combined into a Get-IT-Email script. With a dedicated project gmail, I was able to always have the ability to determine what the IP of the device was at any given time.

One of the other useful things I came across in the development of this code was the PICKLE. This is a neat little python library that allows you to pass a 'state' or variable from one instance of your python script to the next. Since I developed all my scripts to run once, and then ultimately be controlled by the cron job/cron-tab system, this afforded me a way to pass important information between each instance of my code. Specifically, What the current IP address, What the Door state is, both of these allow me to control how often certain triggers go off. This is useful to reduce spam like activity in either email or twitter.

Mechanically my first door switch was built out of readily available components which were comprised of a heavy duty limit switch, aluminum and hot-glue. This mechanism worked for about 2 weeks before it started to run into problems. The main issue was that people would slam the door which had the chance of catching the lever arm of the switch and bend it out of place. Although there was a curved profile to the trigger on the door, it did not prevent this kind of abuse. Ultimately I went to microcenter and replaced this switch with a standard door-security alarm switch. This standard alarm switch uses a magnet on the door, and on the frame a reed switch. In the presence of a strong magnetic field the reed switch will trip and close, thus completing your circuit.

In the end I created two separate codes and twitters: @MITERS_DOORand @MITERS_DOOR2, The first only tweets when the door-state changes (polls once a minute) and the second tweets every 5 minute regardless but also has temperature and humidity measurements.

The @MITERS_DOOR raspberrypi has been consistentlyactive since it was implemented, the only times it was unable to tweet were due to network issues that were related to its access point (Network in MITERS was down for a week here and there). It has also successfully started from power outages without fail.


Elon Musk took over Twitter, broke the API which resulted in the Door Twitter going down. I have handed off the project to the undergrads, This project lasted 8 years with no repair work after the first few weeks. The only time the twitter bot went down was when the internet or power went down. Pretty solid project, and quite impressed with the lifetime of the original raspi's... and the SD card, I thought for sure it would get corrupted by now.

Project Photos