Review by Tim Richardson
What is it?
The Anavi Light pHAT is a board that sits on top of your Raspberry Pi and controls 12v RGB light strips – not the expensive Neopixels or WS2811’s, but the cheap RGB strips that you can get for a few pounds for 5m from AliExpress or eBay.
Why use one?
These LED strips (often labeled ‘5050’) are powered by a 12v power supply and the colour is changed by supplying a PWM signal. This is often done by a microcontroller device with an IR controller, but the controller usually gives a very limited choice of colours – perhaps just 16, and only one strip can be controlled at a time. But what if you want other colours? Or want to control more than one strip at the same time? For that, you need a little more intelligence. In comes the Anavi Light pHAT.
How to use one?
As mentioned, the pHAT sits on top of any 40 pin Pi, like the Pi Zero W or Raspberry Pi 3. You attach your LED strip to the screw terminals (max 5A – enough to control 5m or more) and a 12V power supply.
Unfortunately you have to power the Pi separately; there is simply no space on the board for a voltage regulator to back-power your Pi. Instead there are three i2c ports, a PIR port and UART pins if you want to access the Pi directly. I spoke to the developer, Leon, about this, and agree with him that adding the ports gives the pHAT much more versatility than having the regulator. But, if there is enough interest, he may make a HAT version that has the regulator!
Changing the colour of the LEDs is as simple as supplying PWM signals to pins 9, 10 and 11. Examples given use the PiGPIOd library – which runs a daemon to control the GPIO ports – you tell the pins what to do once, and they just get on with it. Even on a Pi Zero this takes very little CPU (about 6 or 7%) leaving the rest for you to use with your program. During my testing, I used the GPIOZero library’s RGBLED class to control the whole strip. It worked perfectly first time.
The i2c ports are intended to be used for sensors. As part of the Crowdfunding campaign, Leon is optionally supplying three different i2c sensors and one PIR sensor. The i2c sensors are for light, temperature/humidity and RGB colour and gesture detection. As well as the sensors, he will be creating the code to control the LED strip in reaction to sensor changes. You could, for example, make the lights turn on when there is movement, or change brightness depending on how dark it is, or when presented with a colour object, change the strip to that colour. Or even when it’s hot, turn the LEDs blue to cool you down, or red if it’s cold to make you feel warmer (it’s a psychological thing!). I suspect some of Leon’s sensors could use GPIOZero code too, which will make it very simple to control the LEDs.
Leon also plans to supply code/instructions which will allow you to integrate your LED strip into your Home Assistant setup.
All the hardware designs and software are, or will be, open source! This is very generous and could lead to derivatives.
How to get one
Leon is currently using Crowd Supply to kickstart the project but has put a very low goal – meaning it’s definitely going to get funded and built. The price is a little higher than I had hoped when I first heard about it, at $25, but when compared to a solution I have already built for about £10, it’s so much neater and better!
When compared to buying even a 1m NeoPixel light strip, it turns out to be much cheaper. Okay, each individual LED on the NeoPixel strip can be set to a different colour, but when you are using it for lighting are you really going to do that? You also need to add a controller on top of that.
This board is something I was looking for quite a few months ago, but couldn’t find. I did make my own version – not as a pHAT, but as a string of cobbled-together parts. It wasn’t that neat, but it was cheap and very ugly! Personally, I’m going to buy these for my project and abandon what I have. If only I could power the lot from one power supply…