Labs / Board Reviews & Technical Insights

Three Expansion Boards for the XIAO: Serial Servo Control, Data Conversion, and DDS Signal Generation

Author: Zhuang Xiaoman · Source: Freak Embedded on WeChat, published 2025-02-16 · License: CC BY 4.0

Contents

About us

We are a group of university students from a lab at North University of China. Disappointed with the supporting documentation and hardware design quality of most modules and development boards on the market, we decided to design and build electronic modules and the related tutorials ourselves. We open-source and publicly share all of our software and hardware materials, soldering tutorials, and our production, sourcing and sales process.

Our goal is to let every university student in an innovation and entrepreneurship lab make personalized, distinctive modules by hand instead of relying on ready-made ones, write the drivers, and produce and sell them locally on their own.

For more details, visit our wiki: Freak Embedded wiki on GitHub

You can also read our cloud document for further information: Feishu document

Brief introduction

Serial servo expansion board: an expansion module that controls multiple servos through the UART serial communication interface. All 28 servo commands are implemented. It uses a 220UF tantalum capacitor for voltage stabilization, and has a fuse and a diode.

Data conversion expansion board: collects signal waveforms and outputs signals over I2C. It can be stacked, supports up to 16 input channels, and carries 4 ADC channels and 1 DAC channel on board.

Signal generator expansion board: an on-board DDS signal generator and digital potentiometer unit that produce sine, square and triangle waves with adjustable frequency and amplitude; the output stage provides a 5th-order LC low-pass filter.

You can replicate these three expansion boards. The module lets you choose the terminal / resistor-array colour, and choose the motor driver chip model as needed.

Serial Servo Expansion Board

1. Overview

Labels in the board diagram: UART communication interface; main board interface (direct plug-in connection); servo terminals; terminal block power input.

Three Expansion Boards for the XIAO: Serial Servo Control, Data Conversion, and DDS Signal Generation figure 1
Three Expansion Boards for the XIAO: Serial Servo Control, Data Conversion, and DDS Signal Generation figure 2

The serial servo expansion board is an expansion module that controls multiple servos through the UART serial communication interface. Its main features:

The serial servo expansion board controls multiple servos through the UART interface and supports stacked cascading. With its small size, power protection, full-duplex to half-duplex communication and stable power supply, it suits multi-servo control systems, and supports all serial servos from Hiwonder.

We provide MicroPython and Arduino example code, and it is the first open-source program on the web that implements all 28 commands.

Three Expansion Boards for the XIAO: Serial Servo Control, Data Conversion, and DDS Signal Generation figure 3
Three Expansion Boards for the XIAO: Serial Servo Control, Data Conversion, and DDS Signal Generation figure 4

2. Interface description

2.1 Communication interface

We provide one UART communication interface. When the board is used as a standalone module, connect the main control module and the expansion board with a PH2.0 cable, as shown below:

Connection: use a PH2.0-4P cable.

You can also plug the main board directly into the female header of the expansion board:

Main board used: Seeed Studio XIAO RP2040.

Several expansion boards can also be stacked by changing the direction of the pin headers / female headers in the outer holes. This is mainly used to drive multiple serial servo channels; each servo channel supports independent power, so more servos can be controlled this way:

Notes on the stacked connection: mainly used to drive multiple serial servo channels; each channel supports independent power; more servos can be controlled this way. Here the female headers are replaced with male pins facing down.

2.2 Servo interface

To connect a servo, plug its cable into the on-board PH2.0-3P connector. We use a foolproof design: align the raised part of the cable connector with the notch of the socket and insert it:

From left to right: signal line, power line, ground line.

2.3 Power interface

We power the board through a terminal block: connect the positive supply to V and the negative supply to G. Note that a servo needs 1A to keep working and up to 3A when stalled. We recommend a supply of about 7.4V, with short and thick power wires:

Example: powered by a lithium battery pack together with a buck regulator module. A servo needs 1A to keep working and up to 3A when stalled; a supply of about 7.4V is recommended, with short and thick power wires.

3. Hardware details

3.1 Power protection

We use a large 220uf capacitor for power filtering, together with small capacitors to filter out high-frequency power noise. A reverse-polarity diode prevents reversed power connection, and a self-resetting fuse prevents the servo from burning out when it stalls:

3.2 Full-duplex to half-duplex circuit

Its core components are a tri-state buffer and an inverter, which convert full-duplex serial communication to half-duplex:

3.3 Indicator LED circuit

We also provide power and communication indicator LEDs to make debugging easier:

4. Provided code and usage notes

Before using the main board, with the program flashed, to control servos through the expansion board, make sure the motor and communication wiring is correct and the power supply is right:

Overall wiring: each expansion board can use an independent power supply, to power servos that need different voltages.

The example code comes in the following versions:

Note: the MicroPython program has been optimized by us to fit the hardware better and be easier to use; the Arduino code has also been optimized by us. Both are published on GitHub as third-party libraries under the Creative Commons Attribution-NonCommercial 4.0 International (CC BY-NC 4.0) license. Infringement will be pursued, and we will come and find you in person offline!

All 28 serial servo commands are implemented; one of them, the method that reads the delayed-control servo command, is not available on the LX-1501 servo model.

Data Conversion Expansion Board

1. Overview

Labels in the board diagram: main board interface (direct plug-in connection); I2C communication interface; signal input interface, up to 4 signal inputs; signal output interface, up to 1 signal output.

Three Expansion Boards for the XIAO: Serial Servo Control, Data Conversion, and DDS Signal Generation figure 5
Three Expansion Boards for the XIAO: Serial Servo Control, Data Conversion, and DDS Signal Generation figure 6

The data conversion board is an expansion module that collects signal waveforms or outputs signals through the I2C serial communication interface. Its main features:

Three Expansion Boards for the XIAO: Serial Servo Control, Data Conversion, and DDS Signal Generation figure 7

2. Interface description

2.1 Communication interface

We provide one I2C communication interface. When the board is used as a standalone module, connect the main control module and the expansion board with a PH2.0 cable, as shown below:

Connection: use a PH2.0-4P cable.

You can also plug the main board directly into the female header of the expansion board:

Main board used: Seeed Studio XIAO RP2040.

Several expansion boards can also be stacked by changing the direction of the pin headers / female headers in the outer holes. This is mainly used when more input channels are needed for signal sampling and waveform output. With stacked placement, at most two expansion boards can be stacked, supporting up to 8 signal input channels and 2 signal output channels; if I2C expansion boards are used, four can be used, supporting 16 signal input channels and 2 signal output channels:

Notes on the stacked connection: at most two expansion boards can be stacked; stacked placement supports at most 8 signal input channels and 2 signal output channels; here the female headers are replaced with male pins facing down; when I2C expansion boards are used, four boards can be used.

2.2 Signal interface

For signal input and output, different types of IPEX cables can connect the board to an oscilloscope, a signal generator or other signal processing modules:

Optional types include: IPEX to SMA female, IPEX to SMA male, IPEX to BNC female, IPEX to BNC male. Different types of IPEX cables can connect to an oscilloscope, a signal generator or other signal processing modules.

3. Hardware details

3.1 Stable power supply

In the operational amplifier section we use tantalum capacitors for filtering, which smooth the noise in the supply and stabilize the op-amp's operating voltage; in the chip power section we use capacitors of several different sizes to filter out both high- and low-frequency noise:

3.2 Signal input

The signal input section uses small filter capacitors to remove high-frequency noise and make the input signal smoother. IPEX1 connectors are used for signal input and output to keep the size small; we also tried several footprints and sockets so that the connector does not easily come loose when plugged and unplugged:

The input signal sampling rate is up to 860Hz.

3.3 Signal output

In the signal output section we placed a voltage follower, which improves the drive capability of the output signal and isolates the stages before and after it:

The output signal is further strengthened by the voltage follower, lowering the output impedance while improving the output drive capability.

3.4 Address setting

The chip address bits can be set by soldering the short-circuit pads on the back. Setting different address bits on different chips makes it possible to cascade several expansion boards and tell the chips apart, and the address bit that each pad corresponds to is marked in the silkscreen:

4. Provided code and usage notes

Before using the main board, with the program flashed, to input or output signals through the expansion board, make sure the oscilloscope, signal generator or other signal conditioning module is wired correctly to the signal input or output terminals and the power supply is right:

The example code comes in the following versions:

Note: the MicroPython program has been optimized by us to fit the hardware better and be easier to use; the Arduino code comes from reference code on GitHub (all LICENSEs and code sources are marked and preserved), and has been tested and verified by us to run correctly, but has not been further encapsulated or optimized. The built-in waveform generation class is written by ourselves and comes with the Creative Commons Attribution-NonCommercial 4.0 International (CC BY-NC 4.0) license. Infringement will be pursued, and we will come and find you in person offline!

DDS Signal Generator Expansion Board

1. Overview

Labels in the board diagram: main board interface (direct plug-in connection); raw signal output; amplified signal output; SPI communication interface.

Three Expansion Boards for the XIAO: Serial Servo Control, Data Conversion, and DDS Signal Generation figure 8
Three Expansion Boards for the XIAO: Serial Servo Control, Data Conversion, and DDS Signal Generation figure 9

The signal generator expansion board is an expansion board that produces different waveforms with adjustable frequency and amplitude. Its main features:

Three Expansion Boards for the XIAO: Serial Servo Control, Data Conversion, and DDS Signal Generation figure 10
Three Expansion Boards for the XIAO: Serial Servo Control, Data Conversion, and DDS Signal Generation figure 11
Three Expansion Boards for the XIAO: Serial Servo Control, Data Conversion, and DDS Signal Generation figure 12

2. Interface description

2.1 Communication interface

We provide one SPI communication interface. When the board is used as a standalone module, connect the main control module and the expansion board with a PH2.0 cable, as shown below:

Connection: use a PH2.0-4P cable.

You can also plug the main board directly into the female header of the expansion board:

Main board used: Seeed Studio XIAO.

Several expansion boards can also be stacked by changing the direction of the pin headers / female headers in the outer holes. This is mainly used when more channels are needed for waveform output. At most two expansion boards can be stacked, outputting two raw signal waveforms or two amplified signal waveforms:

Notes on the stacked connection: two expansion boards can be stacked; they share one data line and one clock line, but note that the chip-select pins on the expansion boards are independent.

2.2 Signal interface

For signal output, different types of IPEX cables can connect the board to an oscilloscope or other signal processing modules:

Optional types include: IPEX to SMA. Different types of IPEX cables can connect to an oscilloscope or other signal processing modules.

3. Hardware details

3.1 Stable power supply

In the operational amplifier section we use tantalum capacitors for filtering, which smooth the noise in the supply and stabilize the op-amp's operating voltage; in the chip power section we use capacitors of several different sizes to filter out both high- and low-frequency noise:

3.2 Digital amplitude control

The on-board digital potentiometer works as a voltage divider and lets the program adjust the signal amplitude. It gives more precise and stable control than a mechanical potentiometer, avoids mechanical wear and poor contact, offers higher reliability and durability, and also allows automated control, which makes precise adjustment and remote control easy in complex applications:

RAB = total resistance of the potentiometer; Dn = wiper setting for Dn = 0 to 255.

3.3 Signal amplification

We provide a raw waveform output and a 6x non-inverting amplified output, and users can choose which to connect as needed. To optimize amplifier performance, the non-inverting amplifier uses a compensation-resistor design that effectively reduces the effects of parasitic capacitance and parasitic inductance. The design also controls the error caused by input bias current and, to some extent, improves bandwidth and phase margin, so that the amplifier does not saturate or become unstable at high frequencies, giving a more stable and accurate signal output:

3.4 Low-pass filtering

At the amplified signal output, the DDS signal generator expansion board has a 5th-order low-pass filter with a cutoff frequency of 5.43 MHz. The filter effectively reduces the high-frequency noise in the output signal and improves signal quality, so that the generated waveform better meets the needs for high precision and low noise in experiments and tests that demand high signal quality:

The output impedance is typically in the range of 50 to 200 ohms; the cutoff frequency is 5.43 MHz; the 5th-order low-pass filter smooths the waveform and reduces high-frequency noise.

4. Provided code and usage notes

Before using the main board, with the program flashed, to input or output signals through the expansion board, make sure the oscilloscope or other signal conditioning module is wired correctly to the signal output terminals and the power supply is right:

The example code comes in the following versions:

Note: the MicroPython program has been optimized by us to fit the hardware better and be easier to use; the Arduino code comes from reference code on GitHub (all LICENSEs and code sources are marked and preserved), and has been tested and verified by us to run correctly, but has not been further encapsulated or optimized.

In particular, the SPI communication part of the AD9833 MicroPython driver has been specifically optimized. Compared with most open-source libraries on the web, communication is stable, and the waveform does not stutter when switching waveform generation modes or changing frequency!

Why choose us

0. Why choose us?

0.0 Who are we?

At first glance, this question might seem out of place on a product page or an open-source link. Most people who buy electronic modules are university students just like us, and their reasons are simple: study, course projects or competitions, exactly like us when we first started learning embedded development:

Yes, the one at the top right is me, the organizer of this small project and the head of a small lab at an ordinary university. During my four years of university, I spent almost all my time in the lab and in a rented room with all kinds of development boards, chips and electronic modules:

And of course our other junior and senior students. Yes, we are a group of university students from an obscure lab at North University of China (wuhu, we never got around to a team photo, embarrassing 😅😳🤦‍♂️🙈):

In the course of competitions, we found that the makers of electronic modules, to a greater or lesser extent, have the following problems:

Looking back on our own start in embedded learning

From the embedded learning perspective, makers of electronic modules should provide:

From the competition or rapid project prototyping perspective, makers of electronic modules should provide:

However, most makers of electronic modules fail to do most of the above. The modules and example programs they provide are of little value to an embedded beginner who wants to develop quickly or learn; their tutorials and code are popular science rather than teaching. Many makers even give users books made from old-version documentation for outdated drivers to read and learn from, and some compile open-source code from the internet into their firmware and release it closed-source without keeping the original author's notice and license.

As the old hands of the lab, while teaching juniors and competing, we once tried to speed up development with encapsulated STM32 module libraries and to teach with official boards (such as the ST Nucleo series):

But the results were not ideal; the reasons are in the next section.

After we later came to learn and use the LCSC EDA software and tried MicroPython, the idea took shape of letting beginner juniors use electronic modules we make ourselves, together with detailed tutorials and thorough technical support.

0.1 Why choose MicroPython?

Following on from the last section: according to our observation and statistics (the author has run competition and embedded development training at 8 ordinary undergraduate institutions, including Shanxi Jinzhong Ligong Institute, Shanxi Gongxueyuan and Guangxi Chengzhida, with over a thousand trainees), most students at ordinary undergraduate institutions give up easily when starting embedded development with traditional C library functions or Arduino, for the following reasons:

Compared with traditional C library functions and Arduino, MicroPython has the following advantages:

As for the claim most people make online that MicroPython runs slowly, for example:

there is actually no need to worry:

Some students also wonder whether starting with MicroPython will hurt our own learning of embedded development, since companies surely use C and call library functions at work. Here I give the following personal views, based on how senior students who have graduated are working:

Some students also want to learn chip-level development. For them, the senior students are making a MicroPython tutorial that works through the RP2040 chip itself and the datasheets of the various sensor driver chips, helping everyone quickly understand the basic characteristics of the chips and how they communicate with peripherals, and on that basis learn the concepts and principles of writing drivers:

0.2 Why choose our products?

We know that many large manufacturers, with their deep funds and mass-production advantage, can price modules extremely low and assemble them with pick-and-place machines. We are at an early stage, so we have to buy parts in small batches, which makes component costs higher, and because we solder by hand the appearance may not be perfect. But here we carefully polish every module:

Serial servo expansion board

Hardware open-source link: Hardware files on the LCSC open-source hub (OSHWHub)

Project code link: Code on GitHub

Data conversion expansion board

Hardware open-source link: Hardware files on the LCSC open-source hub (OSHWHub)

Project code link: Code on GitHub

Signal generator expansion board

Hardware open-source link: Hardware files on the LCSC open-source hub (OSHWHub)

Project code link: Code on GitHub

Video (in Chinese, Bilibili): Three new XIAO expansion boards, fully open source

Related Anvol case: Custom development board design: MCU, Linux, DSP and FPGA