This article presents a flexible signal generator based on the Raspberry Pi RP2040 that can be controlled from a PC via an RS-232 interface. With minimal hardware at a correspondingly low cost, a wide range of waveform types can be generated over a frequency range of up to 100 kHz. 

The signal generator uses an XIAO RP2040 board, which is very compact and can be powered and programmed via a USB-C connector. The pinout of this board is shown in Figure 1. Attention, numbering of the 14 connection pins (10 GPIOs of the RP2040 are brought out) starts at 0! Since the RP2040 processor does not have a digital-to-analog converter, an MCP4821 by Microchip was added for output. With this external DAC, you can output about 200 kSamples/s with a resolution of 12 bits. The DAC is connected to the SPI interface of the RP2040.

 XIAO RP2040 CPU board
Figure 1: Pinout of the XIAO RP2040 CPU board (Seeed Studio).

Figure 2 shows how easily the hardware fits on a small perfboard with the XIAO-RP2040 board ...