It one of the most advanced I/O Raspberry Pi HATs. Integrates GPIO, ADC, DAC, PWM, SERVO and WS2812 LEDs controller. Using this hat you can create almost everything like the weather station, robots, oscilloscopes, machines or home automation systems.
The Universal Plus Zero Servo HAT has 17 ports in the RC servo connector standard. All of them can be used to control the servos but most of them have additional functions as well:
- 17x fast GPIO ports
- 10x ADC ports (4 5MSPS converters)
- 1x DAC 5MSPS
- 17x PWM ports
- 17x SERVO ports
- 4x WS2812 LED ports (up to 700 LEDs each)
- 4x stepper motor controller
It is extremely easy to code. In 30 lines of code it is possible to create Arbitrary Waveform Generator, PWM and oscilloscope:
uzp0.DACInit(uzp0.DAC1, obuff = 0, generate = 1)
uzp0.DACInit(uzp0.DAC2, obuff = 0, generate = 1)
for i in range(0, nsamples):
samples.append(2048 + 1900 * math.cos(i*2*3.14/nsamples) * math.sin(i*32*3.14/nsamples))
if i < nsamples / 2:
samples1.append(100 + i * 3900 / (nsamples / 2))
samples1.append(4000 - (i - nsamples / 2) * 3900 / (nsamples / 2))
uzp0.DACGenerate(uzp0.DAC1, nsamples, samples, frequency = DACfrequency)
uzp0.DACGenerate(uzp0.DAC2, nsamples, samples1, frequency = 2 * DACfrequency)
uzp0.PWMFrequencyDuty(PWMports, frequency = PWMfrequency, duty = PWMratio)
Data aquision, waveform drawing and PWM duty cycle change
data = uzp0.ADCReadData(dports, nsamples = ADCNsamples, frequency = ADCfrequency)
PWMratio += PWMdelta
if PWMratio > 75 or PWMratio < 25:
PWMdelta = -PWMdelta
Drawing.DrawGrid(functions, xgrid = 10)
Full source code available here: https://github.com/diymat/UniversalZeroPlus/blob/master/UZP_demo_scope.py
Each of the GPIO pins can be configured by software as output (push-pull or open-drain), as input (with or without pull-up or pull-down)
- Output and input configuration
- 16mA sink or current source. Total max 160mA
- Fast I/O handling allows I/O toggling up to 36 MHz (in PWM mode).
- Impulse width, frequency and duty ratio measurement
Four fast analogue-to-digital converters 5 MSPS, 10 channels. Channels can be configured to be either single-ended input or differential input*. ADC inputs can be configured in the single conversion mode or in the scan (real time) mode. In the real time mode conversions are taken autonomously by the hat. The number of conversions and time between conversions is software configurable (this mode is used in the example above).
- Single-ended or differential*
- Channel-wise programmable sampling time
- Fast four ADC converters up to 5MSPS
- Single or real time conversions
- built in input OP-amps with programmable gain
Digital-to-analogue converter (DAC). 12-bit buffered DAC channel can be used to convert digital signals into analog voltage. Single conversion or realtime generator mode.
- 12 bits resolution
- Buffered or not buffered output
- Fast conversion up to 5MSPS (depending on the output circuit)
- Single or real time conversions
Pulse Width Modulation mode allows you to generate a signal with a programmed frequency and duty cycle.
- frequency up to 36MHz
- 19 channels
17 RC SERVO channels. software configurable frequency and impulse width for fast digital servos. Programmable exponent ratio.
- programmable frequency (default 50Hz)
- programmable impulse widths (minimum, centre, maximum)
- configurable exponential ratio – for explanation visit https://www.desmos.com/calculator/x3utvihals
4 WS2812 (NEOPIXEL) ports.
- 4 WS2812 logic ports
- up to 700 LEDs / channel
Stepper motor control:
Logic level control signals. Requires power control circuit.
For examples, libraries and pictures visit : https://github.com/diymat/UniversalZeroPlus
- – differential channel configuration will be available in the next firmware version