3 weeks ago

Smart Mirror powered by Raspberry Pi

Build your own mini smart mirror to display the temperature and humidity

Smart mirrors are all the rage, and we’ll show you how to build a mini smart mirror to display the temperature and humidity in a room. And without breaking the bank.

New parents can be obsessed with ensuring their child is not too hot or cold. Sure, they could use a standard thermometer, but that’s not as fun as using a Raspberry Pi.

Build a Smart Mirror: Equipment you will need

  • Raspberry Pi Zero W
  • Micro Dot pHAT 
  • BME280 sensor
  • Prototyping wire and soldering iron
  • 13×18 cm photo frame
  • Reflective mirror window film
  • Beebotte account

See also:

Smart Mirror Circuit Diagram

    • The BME280 is connected to 3V, GND, SDA, and SCL pins on the Pi. The Micro Dot pHAT is connected to 5V, GND, SDA, and SCL as well

STEP-01: Prototype your Smart Mirror circuit first

We recommend testing your circuit with a breadboard before soldering them. The BME280 sensor is 3 V tolerant, and connects to the SDA and SCL pins on the Pi, but shares them with the Micro Dot pHAT, so will require intricate wiring and soldering – we found that stripping a small part of the wire in the middle and soldering to that so the wire is shared worked well. Or you could solder two wires to the one GPIO pin; i.e. one at the top, one at the bottom.

STEP-02: Applying the mirrored window film

We found a UK supplier of mirrored window film that issued free A5-sized samples – they’ve since started charging 99p, which is still great value. Applying the mirrored window film is fairly straightforward, but make sure you follow instructions! We used soapy water, a squeegee, and patience when applying ours to make sure no air bubbles were trapped, and we applied two layers to add to the effect. Make sure it dries!

STEP-03: Prepare the picture frame

We chose the MOSSEBO picture frame as it was fairly deep and housed the Pi and Micro Dot pHAT perfectly. Inside the frame is a white internal frame, which we used to hold our Micro Dot pHAT in place by roughly cutting a slot into the corner. Don’t worry if this is not picture perfect, as it will be hidden anyway. We also cut a small gap for the cables to pass through.

STEP-04: Download our code to your Pi

Now your BME280 sensor and Micro Dot pHAT are all connected, and your frame is built, you’ll need to install the software. Install the Micro Dot pHAT libraries (magpi.cc/NtPlsE) as well as sign up for a Beebotte XS account (beebotte.com) and then you’ll need to install our code. With Beebotte you can keep track of the data sent from your Pi and graph it out.

STEP-05: Install the Beebotte module

Beebotte works via an API, which is very well suited to life on a Pi, but you’ll need to install the Beebotte module with sudo pip install beebotte. The guide at magpi.cc/AiWqCZ is a great starting point. Once installed, you’ll need to create a channel so you can store the data sent from your Pi. This generates a unique channel token that you’ll need to add to our code for it to work, as well as the channel name used.

STEP-06: Test it all out!

Once you’ve added the Beebotte channel token and name, you should be able to test it all out. Type python bme280-mdot-beebotte.py at the command prompt and you should see the Micro Dot pHAT spring into life and cycle through the temperature and humidity. If you have created a dashboard to display your data, you should start seeing it appear in your account straight away. Pressing CTRL+C will exit the code when running.