In May of 2015, I was given an evaluation kit for the Silego GreenPAK (GPAK) line of configurable mixed-signal ICs (see also my previous column on this topic: GPAK eval — the hardware ). These devices aren't FPGAs and they aren't microcontrollers, but they do combine some of the best attributes of both in a very small package.
In addition to familiar digital logic LUT (lookup table) cells, latches, and counters, the GPAK chips have a selection of interface and analog peripherals, such as I2C, SPI, DACs, ADCs, and comparators. Even better, Silego recently introduced dual-voltage parts into their lineup. The dual-voltage aspect allows for line-level converters, which are very important with the mix of 5.0V, 3.3V, and 1.8V logic we deal with these days. This line-level conversion capability has come in particularly handy for me with regard to a Raspberry Pi Zero design on which I'm currently working.
The Raspberry Pi Zero is a 1.2″ x 2.6″ (31 x 65mm) board that's built around a 1GHz Broadcom ARM11 processor with 512 MB of SRAM. It has a minimal, yet still useful set of I/O, including a micro-SD card slot, a mini-HDMI port, a micro-USB port for power, a micro-USB port for USB, and an unpopulated 40-pin I/O header. Most startlingly, it retails for $5.00 US (if you can find one, that is — at the time of this writing they're still in quite short supply and hard to find).
As a standalone device, the Pi Zero may be lacking a bit, but it's perfect as the heart of a custom mobile device. To help in that regard, I designed a LiPoly battery board in the same form-factor. The following image shows my first iteration of this board along with a Raspberry Pi Zero.
LiPoly battery board (left) and Pi Zero (right) (Source: Duane Benson)
My LiPoly board uses a Microchip MCP73831 for charging and battery management. I run the 5V line from the Raspberry Pi into the MCP73831 chip, which charges and maintains the LiPoly battery when the Pi is running on external USB power. The LiPoly battery feeds back to the Pi 5V line for off-line power. The LiPoly battery only provides 3.7V, but the low drop-out regulator on the Pi board can still provide the required system 3.3V from that input.
One thing I don't want to do is to send the battery's 3.7V down the Pi's 5V line and back to the charger chip when the Pi is not externally powered. That would be silly. The circuit required to prevent this happening includes a P-channel MOSFET, a Schottky diode, and a comparator.
(Source: Duane Benson)
The output of the battery goes through the Schottky diode to the 5V line on the Pi's 40-pin expansion connector (PI+5V on the diagram). I put a comparator across the anode and the cathode of the Schottky. If the Pi is connected to external power, the cathode will have 5V and the anode will have 3.7V. Thus, the output from the comparator will be low, thereby allowing the MOSFET, which is sitting between the 5V line and the MCP73831 charger, to pass the 5V to the MCP73831.
Alternatively, if the system is running off battery power, the anode will be presented with 3.7V, while the cathode will carry about 3.5V due to the small Schottky forward voltage drop. If the comparator sees a lower voltage on the cathode than on the anode, its output goes high, thereby shutting off the MOSFET so the battery won't be trying to recharge itself.
I also run the output of the comparator to one of the Pi's I/O lines so the Pi can know when it's running on battery power. That way, if the LiPoly board is being used as a battery backup to a wall-powered Pi, it can signal the Pi to gracefully power down.
For Version 2 of the battery board, I added a battery “fuel gauge” chip in the form of a Maxim MAX17043. With this “fuel gauge,” the Pi can not only tell when it's on battery power, but it can also tell if it's safe to keep running and when it's time to shut down.
The MAX17043 will be powered off of the battery and will talk to the Pi over I2C. The Pi's I2C pins are 3.3V only, which means I need a line-level converter, all of which brings me to Silego and their GPAK SLG46621V dual-voltage chip.
I asked one of Silego's application engineers for help with a bi-directional line level converter configuration, which he provided. I then added a comparator to the configuration, thereby eliminating the LM358 I had originally chosen to use as the comparator.
(Source: Duane Benson)
Thus, I had now replaced two separate chips with a single 2mm x 3mm device. I purchased 10 of the Silego parts at $0.50 each, for this project. The line level converter and comparator I replaced cost, combined, $1.18 in the same low quantities, so using the GPAK can be a cost-saver as well as a space-saver.
The GPAK parts are optimized for high volume use in small devices, which makes hand assembly a bit difficult. Fortunately, working for Screaming Circuits, as I do, gives me an advantage in that regard. I can have the folks on the manufacturing floor build them for me.
While you really do need a manufacturing partner for these parts, you can use their development tools for solderless prototyping. The design and programming software comes with an emulator, and the chip carrier can be pulled of and wired to a solderless prototyping board, as shown in the following image.
(Source: Duane Benson)
One final point: You may have noticed that the output of the comparator on my LiPoly board goes straight to one of the Raspberry Pi I/O pins without going through the line-level converter. That's due to the flexibility of the chip. The comparator inputs are on the 5V side of the GPAK device, while the output is on the 3.3V side; the conversion takes place inside the chip.
Last but not least, to help Max Maxfield with his ever-increasing number of hobby projects, I'm currently working on an Arduino Uno shield that will use several of these GPAK chips to provide line-level converters between the Uno's 5V GPIOs and the 3.3V GPIOs from a Simblee breakout board. I'll be reporting more on that project in a future column. Meanwhile, I welcome any questions and comments about my GPAK-based experiments thus far.