http://web.mit.edu/zacka/www/midas.html Fully automated dorm room, follow the link for videos of it in action MIDAS: Multifunction In-Dorm Automation System Since moving into my dorm this last fall, my roommate RJ Ryan and I have been working on creating the most elaborate automation system we could envision. Featuring everything from web control, voice activation, and a security system, to large continuously running information displays, electric blinds, and one-touch parties, the custom designed MIDAS Automation System has brought ease to our lives (if one doesn't count all the time it took to actually build and program the system). The following page will both describe the system functionalities as well as a description on how it was built. Anyone with some programming and construction skills, drive, and a couple hundred dollars should be able to replicate this system. Key Features Text Displays MIDAS incorporates three VFDs and one large, color LED display. One VFD and the LED display are centralized to give randomized information from various sources. Everything from news, local weather, and of course, Slashdot articles, scroll across the displays. The Control Pod allows a user to select a particular topic to display immediately on the display. Otherwise, it will automatically cycle through information. MIT has a mailing list called "Reuse" where people post equipment they no longer want. Many of the devices incorporated into MIDAS are parts from devices picked off Reuse. When something very desirable is put on the list, it will often be gone within minutes. Whenever a Reuse post is sent to the list, the display immediately displays the title of the email and the location of the item. This works by using a script my roommate created that browses through mail sent to a particular address we own. Once an email comes in, the title field is sent to the MIDAS controller via Ethernet, the web server picks up the request, and the LED display program sends the information to the display. The other two VFDs perform different tasks. One is hooked up to the music server, which stockpiles all the music that MIDAS controls. Whenever MIDAS is playing music, this VFD will display the title and artist of the current song. The third VFD is an accessory VFD hooked up to my laptop and is used for various purposes. Party Mode This is my favorite part of the entire system. One touch to this button: and the room goes to this: (Above: video showing the party mode activation) When the button is hit, all the lights shut off, the blinds close, the displays show: "FEEL THE ENERGY" and a deep voice says this over the speakers with a deep bass beat in the background. Then intense music turns on along with the sound activated strobe light, laser light show, fog machine, black lights, revolving disco light, LCD visualization projector projected onto the blackout-screen, neon colored lights, computer screen Winamp visualization, oscilloscope showing the waveform of the music, and surveillance camera monitors. Below is a flattened schematic of the dorm room with all of the Party Mode devices highlighted in red. Note that the layers have been flattened (the beds are actually lofts, that's why there is a desk partially under them, etc.). (Above: video showing the different devices that make up party mode) Party Mode can also be activated using the touch screen controller and the web interface. This is how Party Mode works: The large red e-stop button is wired to the Control Pod (see below for more information). When the button is hit, MIDAS will read the bit of the port the button is connected to as a logical low (since it is wired with a pull-up resistor). When this happens, MIDAS runs through its Party Mode batch script which calls my X-10 control program various times, first telling all lights to turn on, and then for all of the Party Mode devices to turn on. While this is happening, MIDAS sends an http request to the music server, which has a large inventory of music. Running on this machine is a Perl CGI script that controls Winamp. The parameters of the GET request tell the music server to play the Party Mode playlist, a specially crafted selection of good dance songs preceded by the custom recorded Party Mode intro (see video to listen to it). The system is coordinated such that this Party Mode intro plays at just the right time for the text to be displayed on the LED and Vacuum Florescent displays. The displays, like the audio, say, "Feel the Energy!" Mood Settings Various mood settings in addition to party mode can be actuated with the touch of a button. These include work, relax, and sleep mode. Each of these mood settings can be actuated via the touch of a button on the Control Pod, the touch screen controller, the web interface, or by remote control. These modes are simply batch scripts which call my cm19a control program. This activates the X-10 controlled lights and appliances for each mode. The work mode turns on all the regular lighting and puts on appropriate work music. Relax mode uses colored lighting to create a peaceful atmosphere for kicking back. Sleep mode turns off all the lights, closes the blinds, and queues the sleep playlist on the music server by hitting the Perl CGI script. Touch-Screen Controller A 10.1" touch screen controller with an embedded computer features a GUI for controlling room settings. It also displays news and weather. It serves as the perfect addition to any sink. The controller was purchased off Ebay, and came stock with a Pentium 166 MHz processor and Windows 98. The software running on the machine is a simple GUI that authenticates with the MIDAS controller over Ethernet and then hits a certain URL to activate lighting commands. Since this is based on the web control aspect of the system, it was a very easy addition to implement. Current weather is also displayed on the screen. Remote Light/Appliance Control The core of any automation system is light and appliance control. X-10 equipment controls the majority of the lights in the room. These modules are very inexpensive and easy to use. The MIDAS main controller interfaces with these units. One highly utilized aspect of the system is remote capabilities. Using the remotes to interface with the X-10 wireless adapter (which plugs into the wall and re-transmits signals from the air over the power lines), the room has been able to accommodate a number of wall switches without the hassle of wiring them up. Since X-10 devices have a certain lag time and are somewhat susceptible to interference and/or outside tampering (i.e. someone else gets an X-10 remote and scans through the codes), the more time or security critical devices (such as all the alarm components, blinds, etc.) are run directly from relays hardwired to their respective processing board. Above shows some of the 18 lights that are controlled by MIDAS. Main Controller At the heart of the system is the main controller. Housed in a locked metal alarm system case is an M1000 Mini ITX board. A DC power supply takes in 12v and outputs the necessary regulated voltages to the motherboard. This plugs into an old laptop power transformer. Early testing with transformers proved that the DC power supply I was using is very picky about its input voltage. If the voltage goes somewhere over about 13 volts, it shuts down for self-protection. As a fail-safe, a 12 volt, 4 amp-hour battery is wired in parallel with the power input on the power supply. Since MIDAS only takes about 20 watts of power, if the power goes out, the battery will run MIDAS for another two and a half hours. The original idea was to run the hard drive off of a 512 MB compact flash card hooked into an IDE/CF adapter. The adapter provides pretty much a one-to-one connection to an IDE cable, and also provides power to the card. Due to the limited number of write cycles, the fact that I wanted to log video data, and since I had an old laptop hard drive lying around, I ended up using a laptop drive. To hook this up to the Mini ITX, one needs an adapter to provide power to the drive and convert from the smaller 40-pin connector to 38-pin IDE. In the picture one may note the USB hub. Due to the large number of USB devices hooked into the controller, a hub was necessary. The USB devices include one webcam, the fingerprint scanner, the X-10 cm19a transceiver (which transmits commands to turn on lights, and listens for X-10 remote commands), and the Control Pod (see below). In the top center of the screen is the ultrasonic motion detector we are using for redundancy in addition to the PIR (passive infrared) detector on the other side of the room. Hooked into the parallel port is the VFD display cable, and in the serial port is the LED display cable. Since I didn't want to pay for a data cable I could make myself, I wired the DB-9 to RJ-12 (6 pin modular) adapter using this wiring diagram. Internet Control A web interface allows for the room lights and appliances to be controlled from any computer connected to the internet. For surveillance purposes, the video cameras can also be monitored. Since a program to control the X-10 devices had already been created, having a webpage control these devices was not very much more work. My roommate created a website written in PHP that allows the lights/appliances to be controlled, the music in the room to be controlled, to activate different modes, and to monitor the security cameras. For obvious reasons, the site also had to be secure. Currently it uses SSL authentication using certificates issued by MIT. To control the music, the site merely hits the CGI script on the music server, which controls Winamp on the machine. For mode control, the PHP running on the main controller merely runs batch scripts on the machine. Displaying the security cameras is slightly more complicated, yet still relatively simple. A program on the machine updates an image file every second with the latest shot from the camera. The video monitor page is set to reload every second with the current image. This provides the illusion of slow frame rate video. Alarm System To prevent any break-ins, a multi-pronged, custom alarm system was designed. The system features: (1) ultrasonic motion detector, (1) PIR motion detector, (1) magnetic door sensor, (1) fingerprint scanner for authentication to deactivate alarm system, (1) backup power supply, (3) video cameras, one of which is on continuous recording mode, (1) 120 dB siren, and (1) revolving siren light. In addition to the siren and light activating when an intrusion is detected, a text message is sent to my cell phone informing me of the break-in and which sensor(s) detected the intrusion. Future work on the system will include a lockdown system such as that implemented in my workshop alarm system. This will close the door in addition to the activities is already performs. If I can lay my hands on a good, compact compressor a single pneumatic cylinder should do the trick regarding door actuation. The three detection sensors are all wired into the Control Pod. The alarm service on the computer polls the sensors at 20 Hz, so if any sensor is tripped, the program will activate the alarm sequence. To do this, it simply has to activate a single relay to turn on the alarm siren and light through the Control Pod. In addition, it sends a text message through the AOL Instant Messenger service. To scare the intruder, the lights all turn off, the blinds close, and a halogen light turns on illuminating the mannequin in the corner of the dorm room. Right below and above her are video monitors which turn on showing the intruder from various angles. Video Monitoring The system includes six video cameras. Two are in the room, one is attached to the antenna rig, looking out the window at the courtyard, and three are near the door looking at the entrance and each direction of the hallway. One of these cameras is a hidden camera known as "SEAGALVISION". In lieu of Steven Seagal's decision to make his own energy drink, the idea of using the can as a hidden camera came to me. A pinhole lens looks out of Seagal's right eye. Automatic Secure Closet Door While the hardware is still in development, the software and control electronics are finished. Since a standard swinging closet door takes up too much room, a roll-up garage-door-style door will be installed. The unit in the below picture (for the automatic blinds) shows the hand wave sensor and the status display. With the wave of a hand, using an infra-red proximity sensor circuit, the Handyboard will activate the door motor. This hand wave sensor operates on the same principle as automatic sinks: an infra-red LED is pulsated at a certain frequency, and if something comes in a certain range of the LED, the IR receiver will recognize the light, time the offset, and determine if the object is in range. If so, it sends a digital high to the Handyboard, which then activates a relay to close the closet door. Voice Activation Say, "MIDAS AUTOMATION - Lights On!" And all the lights turn on. Built into the system is a command-set of ten different instructions to perform different tasks. Utilizing Microsoft's Speech SDK, a service on MIDAS is constantly listening for commands. Whenever it hears the "MIDAS AUTOMATION" prefix, it knows a command is about to be made. Originally it was simply "MIDAS," but due to the occasional false-positive (i.e. I would be talking on the phone and the room would suddenly break out into Party Mode), I changed it to a longer identifier. The Speech SDK makes voice dictation very easy, and it comes with a wealth of source code to get one started. All the program does is call the designated batch script associated with a given command. The script just calls my X-10 control program a number of times with the desired parameters. Currently I do not have a very good omni-directional microphone, so one must speak loudly if trying to activate the system on the other side of the room. Omni-directional boundary microphones, the types found on the floors in from of stages, seem to be well suited for this purpose. Automatic Blinds As junk started to pile up in my dorm room, it became apparent that opening and closing the blinds could be quite a feat in itself (having to climb over desks, for example). Naturally, this was an unacceptable hardship that needed taking care of. The room came with a retractable, spring-driven blackout screen. Since the spring would have interfered with the automatic control, I removed the entire shade off the wooden bar and attached it to a 1/4 inch threaded rod that spanned the length of the window sill. The diameter was chosen because it fits very nicely into the chuck of an electric drill, a motor/gearbox assembly I had lying around a parts bin in my room. The assembly is very powerful, and the gearbox limits the speed to an acceptable rate for blinds. (Above: video showing the automatic blinds in action) Two relays control the direction of the blinds motor and a limit switch on both the bottom and top stop the motor from tearing itself out of the wall (an event which at one point happened). Two save myself from running wire across the room, the switches control power directly to the relays like so: To attach the motor to the wall, I drilled two pipe holder brackets over the motor into the concrete behind the drywall. On the opposite end of the blinds sits a U-shaped bracket I made out of a small L-bracket and a bolt. This allows the other end to free-spin, while still holding it up. The limit switches are simple cherry switches with small pads attached, and then bolted into a bracket bent out of sheet metal. An old Handyboard controls the blinds. While it may be overkill for this use, it does provide a nice LCD display that I programmed to show the system status. The unit controls the relays for the blinds. To control the Handyboard, I made a control box with three switches (see below): up, down, and stop. The unit also has a digital input wired to the USB Control Pod which can tell the blinds to close. This same board controls the closet door as well. Personal MIT PA System/ Antenna Rig Outside the dorm window, a miniature antenna rig ornaments the dorm window frame. The rig, the last remnant of the once great antenna tower, has a multi-band scanner antenna as well as an extremely loud power horn speaker. This speaker is weatherproof, and hooks up to a long-range wireless audio microphone system. When spoken through, due to the dynamics of the courtyard that it projects into, the sound reverberates and sounds unbelievably powerful... especially given its size. The rig also has a video camera with infrared LEDs (for night vision) that points out to the courtyard. The rig is made up of steel plumbing piping, 90 degree elbow connectors, a fitting flange, and a couple of brackets. I have found that such piping makes for very solid, high-strength, and easy prototyping. If you go to the page on my car, you can see that I used the same type of piping to make the touch screen mount. Custom USB Control Pod Made out of an old relay box for laboratory equipment, this custom-designed control pod hooks up to one of MIDAS's USB ports and controls a number of system features. Three of the buttons on it activate preset "modes". One will activate sleep mode, which turns off all the lights and cues sleep music, another activates work mode, which turns on all the standard lights and cues study-appropriate music. The third button initiates a relax mode which turns off all the lights except the ambient colored lights which give the room a peaceful feeling. In addition, the blinds are shut and relaxing rhythms play from the speakers. A "romance" mode is in the making. Another three buttons control the information displays (one of the VFDs and the LED display). One button displays the current weather, and also announces it over the speakers through an implementation of Microsoft's Speech SDK. The weather information is retrieved via a Yahoo RSS feed. Another small button announces and displays the time. The third button shifts the LED displays to a different topic (see above description for what is rotated on the displays). The two rocker switches on top control power to the VFDs and the room security cameras. As indicated on the pod, the indicator lamps display the status of the alarm system, MIDAS power, and the security camera power. The unit is comprised of two circuit boards. The primary control board is an ActiveWire USB control board which has 16 I/O lines and interfaces with a computer USB port. Since this outputs 3.3v control signals as outputs, the secondary board has 2N700 transistors wired to IRF730 mosfets. These then go to relays to control the large loads that the pod controls. Below is a simple schematic of how the devices are controlled. This circuit is repeated for every controlled device in the Pod. The outputs on the board control the four indicator lamps, the automatic blinds, and the alarm system sensors and sirens. All of the switches hook up to the ActiveWire board and feature a 10k pull-up resistor. For power, 120v AC is transformed to 12v DC. The 12v controls the relays in the Pod as well as the indicator lamps. This is stepped down to 5v for the controller board and for the VFDs. Entertainment System With the touch of one button on an X-10 remote, entertainment mode will initiate. The blinds will close, which both blocks out light and since they are white black out shades, they double as the projection screen for the LCD projector. The button will also turn off all the lights. Then it is just a matter of playing a movie or television show.