Introduction: Electronic Affirmation Mirror

About: Making and sharing are my two biggest passions! In total I've published hundreds of tutorials about everything from microcontrollers to knitting. I'm a New York City motorcyclist and unrepentant dog mom. My wo…

When you look in the mirror, who couldn’t use a few words of encouragement? Build a display inside a mirror to scroll custom affirmations you can read over your own reflection. This polished project comes together easily with a store-bought shadowbox frame and some see-through mirror material. You can build a simple version with a basic Arduino or compatible, or level it up using a NodeMCU (ESP8266 wifi board) in order to add more positive quotes to the mirror over the internet.

This article was originally published in HackSpace Magazine.

Supplies

To keep up with what I'm working on, follow me on YouTube, Instagram, Twitter, Pinterest, and subscribe to my newsletter. As an Amazon Associate I earn from qualifying purchases you make using my affiliate links.

Step 1: Assemble Alphanumeric Displays

The first step is to assemble the alphanumeric displays, which means soldering them to their i2c backpacks and also adding header pins. The way your microcontroller can tell them apart is by their address, which you can change by bridging these solder pads on the board.

The backpack is a circuit board containing a chip to control each of the LED segments through the I2C data protocol, which uses just two data pins to control the large number of LEDs. The delicate segment display pins go through the holes on the board, then you can lay the display down on its face and solder the pins at the back. Be careful to line up the decimal dot LED with the dot on the board’s silkscreen to avoid soldering it in upside down! It’s smart to solder two diagonal corner pins first, so you can make any adjustments to the seating before everything’s locked in place. Components with multiple pins are exceedingly difficult to de-solder later. After all the leads are soldered, clip the protruding wire leads with a pair of flush snips.

Next, you should solder the included header pins into the labeled row of holes at the top of the display. It’s easier to get everything lined up straight if you do this part of the assembly with the header pins sticking into a solderless breadboard. It’s helpful to start by soldering just one header pin, which you can easily re-melt to make any adjustments if the board and pins aren’t perfectly perpendicular at first.

You can chain these I2C devices together, so long as they have different addresses. You should change the address of two of the displays by soldering to bridge a set or two of the pairs of pads on the back of the board. For instance, bridge the pads marked A0 on one display, and the pads marked A1 on another, leaving the third one at its default address. You don’t have to use three displays, though! It still looks good and readable with just two, albeit harder to photograph a meaningful phrase since so few letters appear at once. To bridge the solder pads, touch your hot soldering iron to both at once, then apply some solder to the heated pads, which should blob over both pads. If it doesn’t look even and shiny at first, try reheating the joint again.

Step 2: Test With a Solderless Breadboard Circuit

Test your displays with a solderless breadboard before assembling them into your project. That way, if something goes wrong, you won’t have to spend a bunch of time trying to test multiple variables at once or have to waste time undoing and redoing work unnecessarily. Testing each display not only verifies that it works, but gives you a chance to confirm which one has which address.You can use the alphanumeric display’s Arduino library example code to test each screen individually. The simple code attached to this step includes a sketch to scroll a test across three displays at once, which helps with identifying and confirming the correct address for each display.

// label the displays with their i2c addresses
struct {
  uint8_t           addr;         // I2C address
  Adafruit_AlphaNum4 alpha4;         
} disp[] = {
  { 0x70, Adafruit_AlphaNum4() },  // left-hand display
  { 0x72, Adafruit_AlphaNum4() },  // middle display
  { 0x71, Adafruit_AlphaNum4() },  // right-hand display
};

Look for this block of code at the beginning of the quadalphanum-multi example. If your displays aren’t scrolling in order, try swapping the addresses (0x70, 0x72, 0x71) and re-uploading your code. If you soldered a different configuration of address pins than pictured, the other addresses you might try are 0x73, 0x74, 0x75, 0x76, and 0x77. The address is calculated as a sum of 0x70 and the bridged address pins, each of which has its own value (A0 = 1, A1 = 2, A3 = 4).

You can decide what microcontroller to use for this project. If you want your mirror to randomly display affirmations from a set list, you can use something simple and offline like a Trinket. If you want to try out a more advanced version that connects to the internet to retrieve new messages, you can use a wifi board like the NodeMCU. Just look up which pins are used for I2C data and clock on your microcontroller and connect accordingly. Additionally, these displays require connections to ground, power, and a reference voltage matching your microcontroller’s logic voltage.

Step 3: Determine Display Layout Inside Frame and Solder Displays

Now it’s time to lay out the final circuit on a big perfboard. Align it to one of the bottom corners of your shadowbox frame, then place your displays so that they are centred in the frame from right to left, using the help of a ruler. Note which holes in the perfboard align with the display headers, then solder the display headers in place. It’s very important that the displays align with one another such that they will appear as one long seamless display. However, it’s not hyper-critical that you solder them in the same order you had them in earlier, since you can always rearrange the addresses in the code.

Step 4: Build the Rest of the Circuit and Test

Solder up the rest of the circuit using solid-core hookup wire and be sure it works as expected. Adjust the display I2C addresses if necessary, as you did when testing, so that the message scrolls smoothly across all the displays as one.

Step 5: Code

Find affirmations that are meaningful for you! The sample code for this project comes with 17 mood-boosting quotes from famous creatives:

  • “Failure is always an option” -Adam Savage
  • “Power is not given to you, you have to take it” -Beyoncé Knowles-Carter
  • “I don’t measure myself by others’ expectations or let others define my worth” -Sonia Sotomayor
  • “We must accept finite disappointment, but may never lose infinite hope.” -Martin Luther King Jr.
  • “Now is the time to understand so that we may fear less.” -Marie Curie
  • “Don’t compromise yourself – you’re all you’ve got.” -Janis Joplin
  • “If you have good thoughts they will shine out your face like sunbeams and you will always look lovely.” -Roald Dahl
  • “What makes you different or weird, that’s your strength.” -Meryl Streep
  • “Who you are inside is what helps you make and do everything in life.” -Fred Rogers
  • “I’m not afraid of storms for I’m learning to sail my ship.” -Louisa May Alcott
  • “I am deliberate and afraid of nothing.” -Audre Lord
  • “What we dwell on is what we become.” -Oprah Winfrey
  • “Always be a first-rate version of yourself instead of a second-rate version of somebody else.” -Judy Garland
  • “Am I good enough? Yes I am.” -Michelle Obama
  • “You have to believe in yourself of no one else will” -Sarah Michelle Geller
  • “Nothing can dim the light that shines from within you.” -Maya Angelou
  • “My strength lies solely in my tenacity.” -Louis Pasteur

Step 6: Tape and Mirrors

To assemble the mirror, grab a piece of see-through mirror plastic or glass that is the same size to fit your shadowbox frame. You can order this stuff online or find it at specialty plastics and glass retailers. You can use a thick piece of glass or plastic instead of your frame’s glass, or use a thin piece of plastic layered behind the frame’s original glass. Peel away any protective film and assess which side gives the best reflection, since it’s not always the same from both sides. Cover the “wrong” side of it in black paper tape, or tape some on some dark paper. Trim the edges flush so no tape hangs over the edge. Black paper tape (affectionately abbreviated “BPT” in the film industry) is preferred for this project because it blocks light out completely.

Carefully cut out this rectangle with a craft knife, optionally re-taping the edges of the rectangle to create clean, straight lines. This tape will stop light from bouncing around behind the mirror, which would reduce its reflectiveness. Now light can only shine through where the displays are.

Step 7: Cut a Notch for the Cable

Plug a USB cable into your circuit before replacing it inside the frame, aligning the display with the rectangular tape cutout. Notice how your USB cable might need to bend sharply to exit the back or bottom of the frame. Align, mark, and cut a notch in the frame’s back panel to accommodate the cable’s exit. Depending on your frame material, this can be achieved with a utility blade or small hand saw.

Once you’ve determined your cable-routing strategy, you can close up the frame. Use more tape to secure your circuit board inside the frame, so it doesn’t slide around. The sandwiching force of the shadowbox back panel may be enough to hold your circuit in place, but the tape helps you align it perfectly and provides extra insurance it won’t wiggle out of place later

Step 8: Think Positive

What affirmations do you want to put in yours? I'd love to hear them in the comments below.

To take this project further, you could upgrade the mirror with a motion or proximity sensor to trigger the display only when a person is present, or even swap out the microcontroller for a single board computer and camera for some facial recognition or expression detection.

Thanks for following along! To keep up with what I'm working on, follow me on YouTube, Instagram, Twitter, Pinterest, and subscribe to my newsletter.

Arduino Contest 2020

Participated in the
Arduino Contest 2020