header text

a blog of things that I (eventually) make work

Thursday, 10 March 2016

Smart Mirror - Software Update

I've now integrated the PIR module I've had kicking around for a while into my Processing sketch:


As you can see, the data displays for a set amount of time after motion is detected, and then hides. 

This was achieved simply by wiring the PIR module to one of the GPIO pins of the Pi, and then reading the state of the pin in Processing (which now has native support for hardware IO built in to the Raspberry Pi distribution).

The next step is to use an optocoupler to get the backlight of the screen to turn on and off using this same method, to allow the screen to be completely hidden from view when the mirror is idle.

Wednesday, 9 March 2016

Smart Mirror - Custom composite cable

Yesterday I mentioned that the composite video cable for the Raspberry Pi that I bought was far too long. It serves its purpose well, but at 3m long it would be a bit ridiculous to include it in the final build of the frame.

The newest models of the Pi (including the 3, which I recently bought but have yet to even power up...) do not include a full size RCA jack for composite video like previous models did, but instead use a three-ring 3.5mm jack, providing combined stereo audio and video, similar to some old camcorders or the original iPod video.

To make my own cable, I was going to need to source one of these jacks from somewhere. I didn't want to cut up my iPhone headphones, so went off to Poundworld in the hope they'd have a cheap set that included a microphone (which use the same jack, except the extra connections are for the mic). I didn't find any of these, but as luck would have it, I did find a remote shutter release for smartphones, a bit like this one. This had a three ring jack attached to it, so I bought one and cannibalised it.

Here's the cable I built during testing:


(Yes it's a bodge, but it works!)

I later epoxied the crap out of both ends of the cable to allow for some strain relief.

As ever with projects like this, I've thought of a bunch of other features I want to add (feature creep again...) so the new to do list is even longer than yesterday:
  • Build a custom short composite video cable for the RPi. The one I bought is far too long for this and could be the source of some of the signal problems I've been having with the screen, so a shorter custom one should fix this. DONE
  • Add in a 19V -> 5V converter module. This is already ordered but is shipping directly from China. Because the screen needs 12-24V DC for power, I'm using an old universal laptop power supply for it. I'd like to use the same source to power the Pi, so that only one cable has to enter the frame, so a small DC-DC buck converter module should do the trick.
  • Software updates as necessary. I've not modified the software since the last blog post about this, so I need to add in the PIR module (so that the screen isn't always on) and make a couple of other improvements.
  • Switch out the Raspberry Pi 2 for a Raspberry Pi 3 for a performance boost and to save using dongles for bluetooth and wifi.
  • Figure out a way of turning the LCD backlight on and off (probably a relay or optoisolator?) so that it is completely black and inconspicuous when in "mirror mode".

Tuesday, 8 March 2016

Smart mirror - it lives!

I've been quite lazy in updating the blog recently because of reasons, but I finally have something worth publishing:


The smart mirror is (mostly) working!

I got my act together and started plugging things in and taping things together and I'm pretty pleased with the results.



The base of the mirror is an Ikea RIBBA frame which was super cheap and perfect for this purpose, It's a nice simple design and has plenty of depth for the screen and RPi to occupy.

The rear side of the frame glass (and it is actual glass, not perspex etc.) is covered in mirror tint film which I think is designed to keep heat out of buildings. This allows the light of the monitor to pass through from inside the frame, while also reflecting pretty much all light that enters the frame.

If you're going to use this technique to make your own one-way glass, my advice would be follow the manufacturer instructions EXACTLY. The film is a huge pain to apply perfectly with no bubbling, and took me many attempts to get right. Also make sure you have a sharp craft knife (or scalpel, as I did) on hand to trim the film, as you'll need an accuracy you can't get with scissors.

All in all it makes a pretty convincing mirror.

The screen (pictured in earlier blog posts) was de-cased and mounted to the back of a piece of thick black card (cut from an old record sleeve because it's what I had to hand) with bright orange gaffer tape. The bright orange wasn't a design decision, nor was it necessarily the best choice, but I wanted to get this thing done. The cutout for the screen was done using a scalpel and a steel rule. It would be nice to have done this using a laser cutter and a piece of acrylic for added stability - maybe next time.

Note: this isn't a picture of the final reverse side of the mounting card below, this one was hacked together for testing.




I also drilled some holes in the back of the frame for ventilation and a hole for the power cord to pass through.



The next steps before I'm happy with it as a final product are:

  • Build a custom short composite video cable for the RPi. The one I bought is far too long for this and could be the source of some of the signal problems I've been having with the screen, so a shorter custom one should fix this.
  • Add in a 19V -> 5V converter module. This is already ordered but is shipping directly from China. Because the screen needs 12-24V DC for power, I'm using an old universal laptop power supply for it. I'd like to use the same source to power the Pi, so that only one cable has to enter the frame, so a small DC-DC buck converter module should do the trick.
  • Software updates as necessary (feature creep yay!). I've not modified the software since the last blog post about this, so I need to add in the PIR module (so that the screen isn't always on) and make a couple of other improvements.