Skip to content

Community Builds / Custom Hardware

Project Feature: A Custom HAT for Analog I/O

Discover how Daryn Kono built a custom HAT providing bipolar analog input and output capabilities for Raspberry Pi. This maker story showcases hardware design for control systems and data acquisition.

Raspberry PiHardware DesignBy Vilros

Overview

Daryn Kono is a Vilros customer from Hawaii who built a custom HAT for his Raspberry Pi. This HAT provides analog input and output capabilities to the Raspberry Pi board, allowing it to interface with other electronic devices more easily.

What he built

Hardware components:

  • Custom HAT board connected to Raspberry Pi 40-pin connector
  • 4-channel bipolar (+/-4.096V) 16-bit analog inputs via SMA RF connectors
  • 4-channel bipolar (+/-4.096V) 16-bit analog outputs via SMA RF connectors
  • MAX1303 ADC (Analog-to-Digital Converter)
  • MAX5134 DAC (Digital-to-Analog Converter)
  • Uses power from Raspberry Pi and SPI0 signals

Inspiration

Daryn needed a low-cost digital controller with bipolar inputs and outputs. Using MATLAB/Simulink allowed him to model, simulate, and implement control systems, in addition to generating digital controller coefficients.

The architecture also allows usage as a data acquisition system, signal generator, digital filter, among other functions. The Raspberry Pi could also be programmed with Python and C/C++ to interface with the analog I/O board via SPI, in lieu of MATLAB/Simulink tools.

Technical challenges

Finding suitable ADC and DAC components: Finding a reasonable-cost 16-bit bipolar ADC and DAC with SPI was a challenge. Daryn believes reduced resolution ADC/DAC (14, 12, or 10-bit) could lower costs considerably.

Voltage requirements: The bipolar input/outputs required +/- voltages, whereas the Raspberry Pi provided only +3.3V and +5.0V. The solution was to use a charge pump to obtain -4.096V which may be cost-effective but maybe not the best performance.

SPI signal generation limitations: The Raspberry Pi SPI signal generation has limitations with maximum sample rates (time between SPI Chip Select/Enable). Depending on the number of channels used and the complexity of the digital algorithm, sample rates may need to be reduced down to 1K samples/second or lower.

Increasing the SPI clock frequency helps reduce latency or time required to read/write data, but does nothing to change the sample rate.

Tips and advice

For people looking to work on similar projects, Daryn offers these insights:

  • Consider the trade-offs between resolution and cost when selecting ADC/DAC components
  • Be aware of Raspberry Pi SPI timing limitations when designing real-time control systems
  • Increasing SPI clock frequency can help with latency but won't improve sample rates
  • Power supply design is critical for bipolar voltage requirements
  • Test thoroughly with your specific application to ensure sample rates meet your needs

By Vilros

Technical sources

Based on the custom HAT project feature from Vilros Blog. Published 2025, featuring Daryn Kono's custom analog I/O board design for Raspberry Pi.