LittleUnicorn: Raspberry Pi Baby Monitor

Introduction: LittleUnicorn: Raspberry Pi Baby Monitor

About: I'm an astrophysicist, musician, tinkerer and dad.

I have young twins and the audio baby monitor stresses me out. Each time it goes off, I get nervous sweat in case it means another sleepless night.

So I made Little Unicorn. Its a visual baby monitor made from:

Teacher Notes

Teachers! Did you use this instructable in your classroom?
Add a Teacher Note to share how you incorporated it into your lesson.

Step 1: Setup the Pis

Both of your Raspberry Pis will need to be on the same wifi network. All of my recommendations are for Raspbian OS.

If you are setting them up from scratch you'll need to add your wifi details. I've found the easiest way is by editing the `wpa_supplicant` file, as is shown in the Raspberry Pi Foundation's guide, to be the most reliable way. I had a couple of Pis at home, a Pi 3 and a Pi zero (which needed a wifi dongle).

One of the pis will act as the audio server and the other as the receiver. I'm using the Pi 3 as the server and the Pi Zero as the receiver/client.

Download the LittleUnicorn python code on to each of the Pis. If you have git installed, the easiest way to do this is with:

git clone https://github.com/zemogle/littleunicorn
cd littleunicorn python setup.py install

If you don't have git installed you can install it from a release, but you will need cURL or wget install:

wget https://github.com/zemogle/LittleUnicorn/archive/1.0.tar.gz
tar -xvf 1.0.tar.gz
cd LittleUnicorn-1.0
python setup.py install

NB Python < 3 is now deprecated so I am assuming you are using Python 3+. If you don't have python 3, you'll need to install it.

Step 2: Server Set Up

There is a requirement for pyaudio but this is only required for the server (i.e. the one with the USB mic which goes in the baby's bedroom). You can install this painlessly as a package. This will pull in all the dependencies you need and set it up for you:

sudo apt-get install python3-pyaudio

You can then install all of the other requirements from the requirements file:

sudo pip3 install -r ~/littleunicorn/requirements.pip

Now your server should be ready to go! Fire up the server:

cd littleunicorn
python3 server.py

You should see a status message like the following:

======== Running on http://0.0.0.0:8080 ========
(Press CTRL+C to quit)

If you don't see this message and get an error it is almost certainly your python set up isn't quite right. Occasionally it will be a problem with the microphone. In which case try a different USB socket.

Step 3: Receiver Setup

This is where things get fun. Somewhere else in your house (or in the same room for testing), put the Unicorn HAT HD on your receiver Rasperberry Pi and power on.

Install the Pimoroni software

You will need to install the software for this. The excellent people at Pimoroni have written a nice python library for this. Their GitHub repo tells you exactly how to install it.

Install the LittleUnicorn software

This is exactly the same as in the previous step (i.e. for the server), so just follow those instructions.

Test it out!

Once that's all installed take your LittleUnicorn for a spin.

N.B. This requires that you've left the server running in the previous step and you know either the name or IP address of the Pi it's running on.

The client.py file takes a rotation argument as well as the name/IP of the server. This is useful especially because of the difference in the placement of header pins power input between different pi models.

If your server is running on a Pi with IP address 192.168.1.10 and you want to rotate the display by 90 degrees, you can start up as follows:

cd littleunicorn
python3 client.py 192.168.1.10 90

Step 4: Automating the Start Up

You probably don't want to have to log in each time you restart each Pi. You can use either supervisor or cron to start these up at boot. Cron is the simplest and comes installed as part of Raspbian.

On the server

Edit your crontab by typing sudo crontab -e then enter this below the commented out lines (i.e. after the ones starting with #)

@reboot python3 /home/pi/littleunicorn/server.py >> /home/pi/unicorn.log 2>&1

On the receiver

Edit the crontab on the receiver pi and add the following

@reboot python3 /home/pi/littleunicorn/client.py 192.168.1.10 90 >> /home/pi/unicorn.log 2>&1

The 90 is the rotation of the display as before. Change this and the IP address to appropriate values.

Step 5: Conclusion

This is a small, zero-wiring project for anyone who doesn't mind getting their hands dirty with a little bit of command line work.

I'm a child of the 80s so...the cry alarm is inspired by PacMan

  • Jelly Beans - this is normal operation. There is always a bit of electrical noise the mic picks up
  • Orange Ghost (Clyde) - receiver is looking for the server. Check you've entered the right IP and you can log into the server pi.
  • Blue Ghost - When the noise exceeds a threshold ( you can tinker with it in the code) you'll see a blue PacMan ghost. Go and see if your kid is ok!

I happen to have a LEGO Ghostbusters fire house so I have placed Little Unicorn in that, which seems appropriate.

Be the First to Share

    Recommendations

    • Trash to Treasure Contest

      Trash to Treasure Contest
    • Raspberry Pi Contest 2020

      Raspberry Pi Contest 2020
    • Wearables Contest

      Wearables Contest

    Discussions