MakerLab
Raspberry PiRaspberry Pi Compute Module 4S

Raspberry Pi Compute Module 4S: The Tiny Powerhouse for Embedded Projects

A compact, powerful module based on the Raspberry Pi 4, designed for integration into custom hardware and demanding embedded applications.

Raspberry Pi Compute Module 4S

The Raspberry Pi Compute Module 4S is a highly integrated System-on-Module (SoM) designed for industrial and commercial applications where a small form factor and high performance are critical. It takes the core processing capabilities of the popular Raspberry Pi 4 Model B and packages them into a compact board-to-board connector form factor, making it ideal for custom carrier boards and high-volume production runs. This board is not intended for direct use like a typical Raspberry Pi but requires a custom carrier board to expose its interfaces.

At its heart, the CM4S features the Broadcom BCM2711, a quad-core ARM Cortex-A72 processor, clocked at 1.5GHz. This SoC provides significant computational power, suitable for running complex operating systems, machine learning inference, and multimedia processing. It supports a wide range of peripherals, which are brought out via the high-density connectors on the module, offering flexibility for designers to tailor their hardware to specific needs.

Positioned as a successor to previous Compute Modules, the CM4S offers enhanced performance and connectivity options compared to its predecessors. It retains the flexibility of the CM series, allowing developers to integrate Raspberry Pi computing power into their own product designs without the constraints of the standard Raspberry Pi board's fixed interfaces. This makes it a compelling choice for makers, students, and embedded engineers looking to build custom IoT devices, industrial controllers, digital signage, or other embedded systems that demand more than a microcontroller can offer.

The CM4S is particularly suited for projects requiring a full Linux environment, significant processing power, and extensive I/O capabilities in a small footprint. Its design encourages custom hardware development, making it perfect for those who need to integrate computing into unique enclosures or create specialized interfaces not found on standard development boards. It's a step up from typical microcontrollers, offering a familiar Raspberry Pi experience in a more embedded-friendly package.

Watch

Related video, embedded from YouTube.

Specifications

Microcontroller / SoCBroadcom BCM2711
Architecture64-bit Quad-core ARM Cortex-A72
Clock speed1.5GHz
Flash / StorageNo onboard eMMC/SD card; requires external storage via carrier board (e.g., SD card, eMMC, NVMe)
RAM / SRAMAvailable in 1GB, 2GB, 4GB, or 8GB LPDDR4-3200 SDRAM options
Operating voltage3.3V (for module interfaces)
Digital I/O pinsUp to 28 GPIO pins exposed via 2x 100-pin connectors
Analog / ADCNo built-in ADC; requires external ADC for analog input
PWMUp to 6 PWM channels available
ConnectivityGigabit Ethernet PHY (requires external connector), Wi-Fi (optional 2.4GHz/5GHz 802.11ac), Bluetooth 5.0 (optional)
USB2x USB 3.0 ports, 2x USB 2.0 ports (via carrier board)
Power inputTypically 5V DC via carrier board; module itself requires stable power from carrier board regulators
Dimensions67.6mm x 30.5mm x 4.1mm

Pinout & pin functions

PinFunction
3V3Power output (3.3V)
GNDGround
GPIO0General Purpose Input/Output
GPIO1General Purpose Input/Output
GPIO2General Purpose Input/Output
GPIO3General Purpose Input/Output
GPIO4General Purpose Input/Output
GPIO5General Purpose Input/Output
GPIO6General Purpose Input/Output
GPIO7General Purpose Input/Output
GPIO8General Purpose Input/Output
GPIO9General Purpose Input/Output
GPIO10General Purpose Input/Output
GPIO11General Purpose Input/Output
GPIO12General Purpose Input/Output
GPIO13General Purpose Input/Output
GPIO14General Purpose Input/Output (UART0_TX)
GPIO15General Purpose Input/Output (UART0_RX)
GPIO16General Purpose Input/Output
GPIO17General Purpose Input/Output
GPIO18General Purpose Input/Output (PWM0)
GPIO19General Purpose Input/Output (PWM1)
GPIO20General Purpose Input/Output
GPIO21General Purpose Input/Output
GPIO22General Purpose Input/Output
GPIO23General Purpose Input/Output
GPIO24General Purpose Input/Output
GPIO25General Purpose Input/Output
GPIO26General Purpose Input/Output
GPIO27General Purpose Input/Output
RUNSystem reset pin
VREFReference voltage for ADC (if carrier board has ADC)
I2C0_SDAI2C bus 0 data line
I2C0_SCLI2C bus 0 clock line
SPI0_MOSISPI bus 0 Master Out Slave In
SPI0_MISOSPI bus 0 Master In Slave Out
SPI0_SCKSPI bus 0 Serial Clock
SPI0_CSSPI bus 0 Chip Select
UART1_TXUART bus 1 transmit
UART1_RXUART bus 1 receive

Wiring & circuit basics

Powering the Compute Module 4S requires careful attention as it relies on a custom carrier board for power management. The module itself operates at 3.3V logic levels. The carrier board typically receives a 5V DC input, which is then regulated down to the necessary voltages for the CM4S and its peripherals. It is crucial to use a stable power supply that can provide sufficient current, especially under heavy load. Consult the carrier board's documentation for specific power input requirements and recommended power supply ratings to avoid damage.

When connecting external components, always remember the CM4S uses 3.3V logic. Connecting 5V devices directly to GPIO pins can cause permanent damage. If you need to interface with 5V components, use a logic level shifter. For example, to safely blink an LED, connect a current-limiting resistor (e.g., 220-330 ohms) in series with the LED, and then connect the other end of the resistor to a 3.3V GPIO pin. Connect the other leg of the LED to a GND pin. This ensures the GPIO pin is not overloaded.

For I2C communication with a sensor like a BME280, connect the sensor's SDA pin to one of the CM4S's I2C SDA pins (e.g., GPIO2, which is I2C0 SDA on many Raspberry Pi configurations). Connect the sensor's SCL pin to the corresponding I2C SCL pin (e.g., GPIO3, which is I2C0 SCL). Ensure both the sensor and the CM4S share a common ground (GND). Most I2C sensors also require a 3.3V power supply, which can be sourced from the CM4S's 3V3 pin. Remember to include pull-up resistors on both SDA and SCL lines if not already present on the sensor module.

Programming & getting started

The Raspberry Pi Compute Module 4S, running Raspberry Pi OS (or other Linux distributions), is typically programmed using standard Linux development tools. For embedded applications, you can use languages like Python (with libraries like RPi.GPIO or gpiozero), C/C++ (using the `wiringPi` library or direct system calls), or even MicroPython if a suitable port is available for the CM4S. Development often involves SSHing into the module once it's running on a carrier board, or cross-compiling on a host PC and then transferring the executable.

A common workflow for C/C++ development is to use a cross-compilation toolchain on a Linux host. Install the appropriate GCC toolchain for ARM. Write your C code, compile it using the cross-compiler (e.g., `arm-linux-gnueabihf-gcc your_program.c -o your_program`), and then copy the executable to the CM4S via SCP or by mounting a shared folder. For Python, simply write your `.py` script and run it directly on the CM4S using the `python3` interpreter. For more complex projects, consider using PlatformIO with VS Code, which offers excellent support for embedded development and cross-compilation.

Project ideas

Custom IoT GatewayBuild a robust IoT gateway by leveraging the CM4S's processing power and connectivity. Use the Gigabit Ethernet and optional Wi-Fi to connect to cloud services, and GPIOs to interface with various sensors and actuators via I2C, SPI, or UART. This project teaches about network protocols, data aggregation, and embedded Linux system management.
Edge AI Inference ModuleDeploy a machine learning model for real-time image recognition or anomaly detection directly on the CM4S. Utilize the quad-core Cortex-A72 processor to run inference tasks efficiently. Connect a camera via CSI and output results to a display or other systems. This project explores edge computing, AI frameworks (like TensorFlow Lite), and hardware acceleration.
Industrial Control SystemCreate a compact industrial controller for automation tasks. Use the multiple UART, I2C, and SPI interfaces to communicate with industrial sensors and PLCs. The CM4S's reliability and processing power make it suitable for real-time control loops and data logging in harsh environments. Learn about industrial communication protocols and real-time operating systems.
High-Performance Media ServerSet up a low-power, high-performance media server for your home or office. With its powerful CPU and optional hardware video decoding, the CM4S can handle streaming and transcoding tasks efficiently. Connect storage via USB 3.0 or NVMe (on compatible carrier boards). This project covers Linux media server software (like Plex or Jellyfin) and storage management.
Robotics BrainIntegrate the CM4S into a robotic platform as its central control unit. Use the extensive GPIOs for motor control (PWM), sensor feedback (ADC via external chips), and communication with other modules. The processing power allows for complex path planning and computer vision algorithms. This project delves into robotics kinematics, sensor fusion, and real-time control.
Custom Kiosk or Digital Signage PlayerDevelop a dedicated player for digital signage or interactive kiosks. The CM4S can drive high-resolution displays and run graphical user interfaces smoothly. Use GPIOs for button inputs or touch screen interfaces. This project focuses on graphical application development, display interfaces, and user interaction design.

Buying tips & gotchas

When purchasing the Raspberry Pi Compute Module 4S, ensure you buy from reputable sources to avoid counterfeit modules. The CM4S requires a dedicated carrier board to function; these are sold separately and come in various designs, from simple I/O boards to complex industrial interfaces. Pay close attention to the carrier board's specifications, especially regarding power input, available interfaces, and storage options (e.g., SD card slot, eMMC socket, M.2 slot for NVMe SSDs). Also, consider whether you need the onboard Wi-Fi and Bluetooth, as there are variants with and without these features. Accessories like heatsinks are often recommended, especially for sustained high-performance operation.