At i3Detroit we had a door (as seen it the scrolling, scaling web 2.0 bliss that is i3’s main page [just go to the wiki for important stuff]) that frequently got opened into groups of people standing by the front door. The groups stand there because despite this door always having existed someone decided that a good bottleneck for people is right there, in the way. Other hackerspaces have paperwork filled out elsewhere in their space, places where you can sit down even, but not us. I chose not to solve the problem of people congregating because it didn’t seem interesting. Instead the problem to be solved was that the door was a bit too opaque. We could, of course, put a window in the door. The issue was that the door worked fine most of the time as its old opaque self, and we really only needed a window then there were people on the other side of the door. An on-demand window. A mechanical iris for the door of course.
This idea and the plans to laser cut it were blatantly stolen form the internet. I don’t remember where I got the file I ended up using to cut it out, but it is hosted on i3’s wiki here. The thing that we added to that is a car window motor spline. This particular spline comes from a motor used by a FIRST team some years ago. To model it I just drew 2 concentric circles in inkscape, did some math to calculate the offset of the spline edges from the center, and traced it out. I provide it here if you happen to have the same motors we had (I don’t remember what brand or model they were.
The PIR sensors are pretty standard, but I wanted to jazz them up a bit. That, and it’s easier to debug if you can see what’s going on. I was inspired by the ‘electric eye’ description in stories about old-school home automation and added a FET, resistor, and orange LED to light up the shell of the PIR sensor whenever the output is triggered. Based on my knowledge of historical electronics I would guess that the ‘electric eye’ in those stories is a big freakin cadmium sulfide cell that they pass motor current through. That being said, tuning one of those systems is no way to have a relaxing weekend if you have a deadline anytime soon.
So now we have sensors for people and an actuator for the door. Now we need limit switches. My preferred way of detecting the limits of this mechanism is to use limit switches. You could use motor current, but that is likely to vary over the life of the motor, wire, solder joints, etc. You could implement a rolling boxcar filter to pick out where the current should be based on the assumption it will be changing slowly over time but that relies on good sturdy mechanical connections and not much slop. It’s also much harder to program, and harder on the wooden gears needing to put stress on the whole system to know when to stop. The key aspect of using limit switches instead of motor current is that it does not stop if you put your finger in it. I am of the opinion that if you put your finger in it then you must not care about it enough and deserve what happens to you. I have also intentionally put my finger in it and with the motor moving on 5 volt power it doesn’t hurt that much. To address how to fix this (because if the motor does not reach the limit switch then it never stops) I made the code so the iris opens upon reboot.
With limit switches you can tell when you’re closed, you can tell when you’re all the way open, but you cannot detect an intermediate state. This becomes more complicated when you talk about having two limit switches and two triggers on the same gear. Because of how far the gear rotates to make a full movement of the mechanism it was not convenient to have one magnet and hall effect sensor. I decided to add 2 sensors and two magnets. This means that there is one position where the drive gear and ring gear can meet in order for the limit switches to work. This gets tricky if anyone dis-assembles the mechanism and moves it by hand.
The only remaining question was how to power the motor. It turns out that the motor that’s designed to run at 12V works great at 5V. The problem with using a logic and motor power supply together is that when the motor browns out and resets the microcontroller you get a nice infinite loop of opening and closing. A nice chunky power supply solves that problem. We switched the motor with relays because the coil current draw isn’t an issue and dissipating the heat a FET would generate is also not how I like to spend a relaxing weekend.
<laser cutter porn>
The mechanical assembly was done with chrome 1/4-20 hardware, washers we lasercut out of a single thin sheet of polyester, coconut oiled wood (which we hastily cut on the wrong side, it’s not a symetrical design) and brass flat head wood screws. The scale was wonderfully coincidental, we were given the porthole which had an ID of 7″. When we scaled that to the whole project it turns out the 1/4-20 hardware worked great. The porthole got a lasercut sheet of acrylic to replace the non-existent glass and a translucent ‘i3’ vinyl logo in the center. The arms that move even got a real gold leaf treatment. The mechanical build went smoothly and waited for a motor current based control board. When that didn’t appear I put it into permanent install with my code and limit switches.
The code is supposed to do as follows:
10 open the iris
20 close the iris
30 if either of the sensor lines goes high
40 open the iris
50 stay open until 2 seconds after both sensor lines go low
60 close the iris
70 goto 30
It bounces around a bit and one of the sensor wires has fallen off inside the door (don’t use connectors when you can fit an iron in there, seriously) so it only opens from movement outside. It’s not perfect, but it’s perfect enough that no one has been motivated to change it in the year and a half since we made it.
pictures and videos here.