I grew up in a home with a lot of mirrors. Even if you’re not a vain person, if there is a mirror in front of you, it’s difficult to resist the temptation to at least glance in the mirror to check your reflection. It’s a tendency that I grew up with that I really dislike because it makes me feel superficial; on some level, I think that it actually does make me more vain, little by little. I wanted to discourage this vanity-inducing habit by creating a mirror that is only reflective for a short time before “turning off” [in its actual implementation, this time is 5 seconds].
I had read about smart film in a book by Dan Brown, and began to look for places online that would source it. It turned out to be incredibly expensive [$200 per sq. ft.], but I was able to get a small piece of 6″ x 6″ smart film that I made this mirror with. I initially thought it would be a good idea to build a frame out of 2×4 wood because I had planned on plunge routing a hole out of the wood to store my board and components in. This resulted in a pretty abysmal looking design:
I bought thinner planks of wood and settled on mounting the components of my circuit on the back of the mirror. If I bring this product to market, I’ll be using a much smaller microcontroller, so it’ll be easier to keep the controller out of sight. For the remainder of the bulky material [namely the 12-40v convertor [more on that later]], I could always laser cut a case out of acrylic to house it in.
I had to cut channels in the wood to receive alligator clips; the smart film requires a really strong connection with its power supply, otherwise it has a tendency to flicker or not turn on at all.
I had originally experimented and tried to find perforated or clear material that I could hide the sensor behind within the frame, but I couldn’t find anything. I ultimately chiseled a hole out of the wood to fit the sensor, but accidentally chipped the exterior of the wood.
I used some veneer, courtesy of Boris, to patch up the cracks:
I also spray-painted the wired connection of my IR sensor black so that it wouldn’t be uber-visible through the hole that I made.
Here are two shots of the mirror in its on and off stages:
So now that the story of the physical build of this mirror is complete, I’ll regale you with the tale of the TWO Arduino boards and 1 IR sensor that I destroyed while making this mirror. I struggled with Boris, late one Wednesday night, trying to use a transistor to turn the circuit that controls the mirror on and off. You see, the smart film requires 40V to become transparent, which is more voltage than the Arduino could safely handle. The original idea was to use a transistor to control the flow of electricity between the 12V power source and the 40V convertor, but the transistor just wasn’t working. We then tried to use a relay, but the relay wasn’t working either. We finally tried a combination of the two… and that still didn’t work [what gives?!].
We pulled out the multimeter and realized that my Arduino board was fried, probably due to a short circuit earlier in the day, and wasn’t delivering voltage to the pins. With a new board, I was able to successfully flip the relay to power the film. The only issue [which would manifest itself in disaster the next day] was that the relay was controlling power to the 40V side of the convertor, instead of the 12V side. So the next day, as I was tweaking my code, which was largely functional, the power surged [or at least I think it did], my computer turned off, and my board fried. Also, my IR sensor was completely fried. Sad beans.
I rewired the circuit, removed the transistor and only relied on the relay, which now modulated my smart film circuit on the 12V side. Interestingly, because the convertor stores current, the smart film’s once discrete transition from clear to opaque and back again became gradual; I had to alter my code for this. The only issue that remained was a debouncing problem – when I stood at the edge of the mirror’s range, the mirror flickered on and off almost continuously. The way that my code was set up originally, I was checking for a state change defined by a baseline reading in the IR sensor, and then activated the smart film based on this reading and state change.
I tried debouncing, initially by setting a timer based on when the mirror knew someone was standing in front of the mirror, but this didn’t work because the debounce timer reset continuously when I wanted it to be activated just once [i.e. I wanted the timer to run when someone was standing in front of the mirror]. Because the bouncing occurred at the edge of the sensor’s range, I realized that I could start the timer on the off position, so that it ran when someone stood in front of the mirror. The problem now was that because the code was looking for a state change, it would only ever activate the mirror right after someone stood in front of it, when it would fail the debounce time requirement. I changed the methodology for controlling the relay, so that it specifically looked for a state continuity – the code had to loop twice with the switch activated for the mirror to activate. To allow the mirror to turn off [remember, the debounce timer was running off of the off state], I added a second loop that looked for the off state specifically, and turned the mirror off.
And so… it works!