The Guzunty Pi board is an open source Complex Programmable Logic Device (CPLD) add-on for the Raspberry Pi. Derek Campbell is behind this project, and has clearly spent a lot of time and effort putting it all together.
He describes it… “a CPLD is like several large breadboards laid out on your desk, full of every combination of logic devices you are ever going to need. It is waiting to be told what to do. It doesn’t need a host of jumper wires like a breadboard would. It can be reprogrammed again and again (even at runtime), and it is small enough to fit on top of your Pi.”
Derek sent me an evaluation kit for his new Guzunty Pi CPLD board a few weeks ago. I soldered it together, taking photos as I went. It was an easy build, and I sent Derek the photos to use on his Github build instructions page. I’m glad I did that because it was another few weeks before I found time to do anything other than run through the basic test procedure to prove I’d built it right.
As you can see, there are not many parts, but there are quite a few solder joints to do. I forgot how long it took me to build, but it wasn’t very long. Since I shot photos all the way through, I looked at the first and last file date/times and there was one hour between them. Bearing in mind that I am a fussy macro photographer, and stopped to shoot each build stage, half of that hour was probably spent on the photos. So I reckon it was a half-hour build (Derek confirms this).
What’s so special about Guzunty Pi?
Here’s six things for starters…
- It’s very small
- It’s very flexible
- It’s got hardware pulse width modulation (PWM) capability
- It’s got lots of I/O capability
- It can handle 5V logic
- The GPIO ports are protected
Small – it can fit on top of the Pi
Guzunty is less than half the size of the Pi. If you build it with the 26 way female socket on the underside, it can press down straight onto the Pi and sit on top. I built mine with pins so I could use a ribbon cable. But I will probably build another using the socket at some point.
Flexible – Many cores available
A CPLD program is often referred to as a ‘core’ to distinguish it from a regular computer program. Cores can do things thousands of times faster than an equivalent computer program.
This is because the cores are programmed in the Xilinx XC9500XL hardware. There are currently 11 different cores available for Guzunty Pi. Some focus more on input, some on output and some on PWM. They have names like gz_4p8o8i.xsvf
gz_ for Guzunty, o = output, i = input, p = pwm (s will be servo PWM). So gz_4p8o8i has 4 PWM outputs, 8 digital outputs and 8 digital inputs.
You can even program your own cores using the free tool chain from Xilinx. It is hoped that community members will do this and submit their own cores to the available cores page for use by others.
Lots of I/O (input/output) capability
You can program in up to 25 digital inputs or outputs (or a mixture), using the Guzunty. This gives you more than the basic 17 on the Pi’s P1 header.
It can handle 5 Volt logic signals
Guzunty can cope with 5 Volt logic I/O signals which would damage the Pi.
The GPIO ports are protected
Guzunty acts as a buffer between the Pi and whatever you’re interfacing with, protecting the GPIO ports from damage. The CPLD chip itself is about £2/$3 to replace, so it’s better to trash that with wiring errors or “careless screwdriver moments” than to burn out ports on the Pi.
Did I mention the cost?
Derek reckons you could build one of these for about £10/$15. He may do kits if there is demand to justify the required investment. (He has a limited number of kits available for UK purchasers at the time of publishing for £10 + £2.20 P+P).
You can control it with Python
The Xilinx CPLD communicates with the Pi via the SPI interface, (but can use other protocols like i2c). This is nice because we can access that in Python, either using the supplied GZ module or with py-spidev.
PWM – motors, servos etc.
I have a “top secret” project which requires the use of servos. I know how to control these with ATMega and directly from the Pi (but only one). But I thought it would be fun to use Guzunty for this. I tried the PWM core gz_4p8o8i, but the PWM for RC servos can be a little fussy. It requires pulses of between 1 and 2 ms at about 50Hz. 1ms = 0 degrees, 2ms = 180 degrees, or thereabouts.
The “pure” PWM on the 4p8o8i core didn’t work for my servo (although it does work for some servos apparently). I mentioned this to Derek and he cooked up a core specifically for servos. This is no trivial task, but obviously has much wider use than just my little project, so it was worth doing. Thanks Derek. :) That core is still under testing and hasn’t been released yet, but no doubt it will be when Derek is happy with it. I can confirm that it works with my servos (currently with about 90 degree movement, but rock-steady control).
If this has piqued your curiosity, check out Derek’s Github Guzunty Pi page
I will update you on my “top secret” project as and when I have something to show, hopefully within a couple of weeks. :) And hopefully there will be video to go with it.