Surveillance Magic Mirror using Android & Pi Zero W

Smart Mirrors or “Magic” Mirrors are nice, but wouldn’t it be nice if it could also keep an eye out on your house why you were out? Or, like in my case, monitor the puppy from the other room? Well, if we combine the last couple projects that we covered, you could!

Combining an Android Magic Mirror with a Pi Zero W surveillance camera adds remote video capabilities to your unit. But why stop there? Add a USB microphone to the Pi Zero W and we can also have remote sound capabilities as well.

Disclaimer: This is a Proof of Concept build, not a DIY article. The Raspberry Pi v2 camera (and the Pi Zero W at times) can become very hot when in use, so encasing them in cardboard may not be the safest thing in the world to do. As such this is just for instructional purposes only, and it is not a build guide.

The Mirror

I took a Pi Zero W and cut a hole for it in the back cardboard of the Magic Mirror. The cardboard I used was three layers thick, so I cut space for the assembly through the first two layers, and only cut a whole for the camera in the last cardboard layer that rested against the mirror. I then covered the glass side of the back board with black poster board and cut a hole for the camera lens.

Glass side (Front) View:

Android Pi Zero Mirror 1

Back View:

Android Pi Zero Mirror 2

What you can’t see in the picture above is the mini Kinobo USB Microphone I have installed in the micro USB port. This low-profile microphone works great without the need to install any drivers:

Android Pi Zero Mirror 3

Note: The microphone works great on the Pi 3 as is, but you will need an adapter to get it to fit the micro-USB port on the Pi Zero W.

Remote Video

For remote video from the Pi Zero I just used the Python PiCamera script we used in the previous article. I used it the exact same way, but I did make two modifications to the code.

  • One – I bumped up the resolution from the default 640×480
  • Two – I rotated the camera 90 degrees so it would display properly

As seen below:

Android Pi Zero Mirror 4

When the program is executed, just browse to the Pi Zero’s IP address, and port 8000 (IP Address:8000), and you should see the video remotely:

Android Pi Zero Mirror 5

I just used PiCamera, as it was what I currently had installed on the Pi Zero, but you could just as easily use MotionEyeOS or RPI Camera. This would give you more recording and even motion detect options. Both of these programs are discussed in earlier articles.

Remote Audio

As mentioned, I just used the low-profile microphone for remote audio. The remote computer you use as a listener will need to have SSH installed and the program “paplay”. I chose Kali Linux as the remote system as it has both pre-installed.

For this to work we need to record from the Pi Zero using the “arecord” command. We then take that sound and send it via SSH to the sound player on the Kali Linux system.

The command looks like this:

arecord -D plughw:1,0 -f S16_LE | ssh -C root@ paplay –format s16ne

Arecord takes input from the Raspberry Pi microphone, logs into the Kali Linux system via SSH and pipes the sound directly into Kali’s sound player.

Putting it all together

Sounds complicated, right? Well, let’s walk through it step-by-step using the PiCamera script. If you are using MotionEyeOS or PiCamera, remote in to the Pi and skip to step 3.

The Pi Zero will be running headless, so we need to SSH into it.

  1. Enable SSH in Kali (also have to enable root login – understand the security risks or use another user)
  2. Remote SSH in, and then in the terminal prompt run the remote PiCamera script:

python3 ./ &

You should then be able to access the camera feed in a browser. (IP Address:8000)

  1. Then while still in the remote session, type this:

arecord -D plughw:1,0 -f S16_LE | ssh -C root@ paplay –format s16ne

The address is the IP for my Kali Linux system, you will need to use your remote system IP address.

You will be prompted for the Kali SSH password, and once you enter it, sound should begin to stream through your Kali system’s speakers. If everything worked you should see your video feed and heard your audio feed. The video should be near real time, but there was like a 1 second delay for the audio.


So, there you have it. In the future, I plan on using a better (and safer) solution than just cardboard & tape to secure the devices.  But combining an Android based Magic Mirror with a Pi Zero W security camera does seem to be a viable option for someone who wants the fancy tech look of the Magic Mirror, and also wants something to help keep an eye on the house when the mirror part is not in use.

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

%d bloggers like this: