Getting Started with Unicorn Paint

If you've picked up Unicorn HAT or pHAT and want to give Unicorn Paint a go, then this is the guide for you.

Unicorn Paint assumes some basic knowledge that not everyone will have. We're going to try and fill those gaps below.

In this guide you'll learn how to:

  1. Install the unicornhat modules
  2. Download the Unicorn HAT/pHAT examples and projects from GitHub
  3. Find your Raspberry Pi's IP address
  4. Start Unicorn Paint
  5. Connect to Unicorn Paint with your web browser and start painting.

How to install the unicornhat module

Installing modules can be trickier than it looks, the process for Python 2 and Python 3 is subtly different. We've tried to make the install process as simple as possible with this magical one liner:

curl https://get.pimoroni.com/unicornhat | bash

You'll need to locate LXTerminal, or be logged into your Raspberry Pi's terminal to run this script. You can find out more about Unicorn HAT, and the setup process by reading our getting started with Unicorn HAT guide. For Unicorn pHAT, check out getting started with Unicorn pHAT guide.

This script will automatically prompt you to download the project code, so make sure you answer yes. If you miss it, or need a fresh copy of the project for any reason you can "clone" them with Git:

git clone https://github.com/pimoroni/unicorn-hat

Find your Raspberry Pi's IP Address

If you're using the web browser on your Pi, you can simply skip this step and substitute the IP address we're looking for with 127.0.0.1. This is the "local loopback" IP, and simply tells your browser to talk to the machine it's running on, rather than look for another one across the network. In order to connect to your Pi from a web browser and use Unicorn Paint, you'll need to find your Pi's IP Address. Its IP address is like a postal address, and allows you to find your Pi on your local network.

If you know how to do this, go right ahead, otherwise read our guide to finding your Raspberry Pi's IP address

At the end of this kerfuffle you should be in possession of a number that looks something like: 192.168.1.123 or perhaps 10.0.1.123. Make a note of it.

Start Unicorn Paint

Before starting Unicorn Paint, you should make sure the dependencies are installed. Unicorn Paint requires the Python web framework Flask. The script above will have installed it for you but if needs be you can install it manually, like so:

sudo apt-get install python-flask python3-flask

Locate the code you downloaded earlier and make your way to the Unicorn Paint project folder. If you use the one-line installer, it will be located in the /home/pi/Pimoroni/unicornhat/projects/ folder. Then just type:

sudo ./paint.py

And Unicorn Paint should fire up on your Pi. Note: you won't see any graphical interface yet, we need to connect with a web browser from another computer, or your Pi, to get things working.

Connect to Unicorn Paint from your web browser

If you're running entirely on the Raspberry Pi, I'm going to assume you've got a desktop up and have a browser such as Chromium or Epiphany installed. You should see an icon for it on your desktop if you do, click it and enter the following into the address bar:

http://127.0.0.1:5000

Unicorn Paint in action.

If you've got the paint.py project running, you should see the interface pop up and be able to start painting. Enjoy!

If you're using a desktop PC or laptop, you'll have to use the IP Address that you found earlier and plug it into the address bar of your browser of choice. For example:

http://192.168.1.123:5000

Hopefully the Unicorn Paint UI will come right up. Happy painting!

Shopping basket

Need something for this project? You can use the links below to add products to your Pimoroni Shop basket for easy checkout.

Unicorn HAT
£24.00
Unicorn pHAT
£10.00
Want to checkout or change something? Click here to view your cart.

Tutorial
Beginner
Unicorn HAT, Raspberry Pi, Python, LEDs

Phil Howard

phil@pimoroni.com
@gadgetoid
Phil is Pimoroni's software guru, instantly recognisable by his somewhat pirate-themed moustache growing attempts. Usually found buried neck deep in Python libraries, he's also been known to escape on occasion and turn out crazy new products. If you need a helping hand, he's a prolific Twitter user and rampages around the forums like a T-Rex. Ask him if you need help with Pimoroni's software libraries, or Propeller HAT.