MakerLab
Raspberry PiRaspberry Pi Compute Module 4

Raspberry Pi Compute Module 4: The Embedded Powerhouse

A compact, powerful System-on-Module designed for industrial and embedded applications, offering flexibility and performance.

Raspberry Pi Compute Module 4

The Raspberry Pi Compute Module 4 (CM4) is a highly versatile and powerful System-on-Module (SoM) that brings the capabilities of the Raspberry Pi to a more embedded-friendly form factor. Unlike traditional Raspberry Pi boards with fixed ports and layouts, the CM4 is designed to be integrated directly onto a custom carrier board, allowing engineers and makers to create bespoke hardware solutions. This approach offers significant advantages in terms of size, cost, and customization for production runs or specialized projects.

At its heart, the CM4 features the Broadcom BCM2711, a quad-core 64-bit ARM Cortex-A72 processor, the same capable SoC found in the Raspberry Pi 4 Model B. This provides ample processing power for demanding tasks, from running complex applications to handling real-time data processing. The CM4 is available in various configurations, differing in RAM (from 1GB to 8GB LPDDR4) and onboard eMMC flash storage (from 8GB to 32GB), or without eMMC for external storage solutions. This modularity allows users to select the precise specifications needed for their application, optimizing cost and performance.

Sitting in the Raspberry Pi family, the CM4 represents a shift towards professional and industrial embedded systems. While earlier Compute Modules were targeted at similar markets, the CM4's significantly enhanced processing power, wider range of I/O options exposed via its high-density connectors, and support for features like PCIe make it suitable for a broader spectrum of applications. It bridges the gap between hobbyist-friendly Raspberry Pi boards and full-fledged industrial single-board computers, making advanced computing accessible for embedded projects.

The CM4 is ideal for makers, students, and embedded engineers who require a compact, powerful, and customizable computing solution. It's perfect for projects that need to be integrated into tight spaces, mass-produced, or require specific hardware interfaces not found on standard Raspberry Pi boards. Applications range from industrial automation and IoT gateways to digital signage, robotics, and custom control systems where reliability and performance are paramount.

Watch

Related video, embedded from YouTube.

Specifications

Microcontroller / SoCBroadcom BCM2711
Architecture64-bit Quad-Core ARM Cortex-A72
Clock speed1.5 GHz
Flash / StorageOptional 8GB, 16GB, or 32GB eMMC flash; or no eMMC for external storage
RAM / SRAM1GB, 2GB, 4GB, or 8GB LPDDR4-3200 SDRAM
Operating voltage3.3V (core logic)
Digital I/O pinsUp to 28 GPIO (depending on carrier board implementation)
Analog / ADCNo built-in ADC on CM4 itself; requires external components on carrier board
PWMHardware PWM available on specific GPIO pins
ConnectivityGigabit Ethernet, Dual-band 802.11ac Wi-Fi, Bluetooth 5.0
USB2x USB 3.0 interfaces (via carrier board), 1x USB 2.0 interface (via carrier board)
Power inputTypically 5V DC via carrier board, with power management for the CM4
Dimensions55mm x 40mm

Pinout & pin functions

PinFunction
3V3Power output (3.3V)
GNDGround
GPIO17General Purpose Input/Output
GPIO27General Purpose Input/Output
GPIO22General Purpose Input/Output
GPIO23General Purpose Input/Output
GPIO24General Purpose Input/Output
GPIO25General Purpose Input/Output
GPIO05General Purpose Input/Output
GPIO06General Purpose Input/Output
GPIO12General Purpose Input/Output, PWM0
GPIO13General Purpose Input/Output, PWM1
GPIO19General Purpose Input/Output, PWM2
GPIO16General Purpose Input/Output, PWM3
GPIO26General Purpose Input/Output
GPIO18General Purpose Input/Output, PWM4
GPIO04General Purpose Input/Output
GPIO11General Purpose Input/Output, SPI0 MOSI
GPIO09General Purpose Input/Output, SPI0 MISO
GPIO10General Purpose Input/Output, SPI0 SCK
GPIO08General Purpose Input/Output, SPI0 CS0
GPIO07General Purpose Input/Output, SPI0 CS1
GPIO02General Purpose Input/Output, I2C1 SDA
GPIO03General Purpose Input/Output, I2C1 SCL
GPIO14General Purpose Input/Output, UART0 TX
GPIO15General Purpose Input/Output, UART0 RX
GPIO20General Purpose Input/Output, I2C0 SDA
GPIO21General Purpose Input/Output, I2C0 SCL
RUNSystem reset pin
VSYSSystem power input (typically 5V)

Wiring & circuit basics

The Raspberry Pi Compute Module 4 requires a carrier board for operation, as it lacks the standard USB, HDMI, and Ethernet ports of a typical Raspberry Pi. The carrier board provides the necessary power regulation and connectors. Power is typically supplied as 5V DC to the carrier board, which then steps it down to the 3.3V required by the CM4's core logic. Ensure your power supply can provide sufficient current, especially under load; a 3A supply is often recommended for the CM4 and connected peripherals. Always connect power to the carrier board's designated input, not directly to the CM4's module edge connector.

The GPIO pins on the CM4 operate at 3.3V logic levels. Connecting a 5V device directly to a 3.3V GPIO pin can cause damage. If you need to interface with 5V devices, use a level shifter. For example, to connect a standard LED, you would connect a GPIO pin (e.g., GPIO17) to one end of a current-limiting resistor (typically 220-330 ohms), the other end of the resistor to the LED's anode, and the LED's cathode to a GND pin on the carrier board. The GPIO pin would be configured as an output to turn the LED on.

For sensors or modules that communicate via I2C or SPI, the CM4 offers dedicated pins. For an I2C device, connect its SDA pin to a designated I2C SDA GPIO (e.g., GPIO2) and its SCL pin to the corresponding I2C SCL GPIO (e.g., GPIO3). Ensure the sensor is also powered correctly, usually from the carrier board's 3.3V or 5V rail, depending on the sensor's requirements. Always consult the datasheets for both the CM4's carrier board and your peripheral devices to ensure correct wiring and voltage compatibility.

Programming & getting started

The primary operating system for the Compute Module 4 is Raspberry Pi OS (formerly Raspbian), which can be flashed onto the eMMC storage or an SD card via a carrier board with an SD card slot. Toolchains like the standard Linux development environment, cross-compilation tools, and package managers (apt) are used. For more embedded-focused development, MicroPython or CircuitPython can be installed, offering a Python-based programming environment. PlatformIO is also an excellent choice for managing projects and dependencies across different environments. Uploading code typically involves SSHing into the running Raspberry Pi OS or using serial debugging tools, depending on the chosen OS and development approach.

To get started with Raspberry Pi OS, you'll typically flash the OS image onto the eMMC or an SD card using Raspberry Pi Imager on another computer. Once booted, you can access the CM4 via SSH or a connected keyboard/monitor. For Python-based development, you can write scripts directly on the CM4. For bare-metal or RTOS development, you would use cross-compilation toolchains (like GCC for ARM) on a separate development machine and flash the compiled binaries to the CM4's storage or load them via TFTP.

Project ideas

Industrial IoT GatewayBuild a robust gateway that collects data from various sensors using I2C, SPI, and UART, processes it locally, and transmits it wirelessly via Wi-Fi or Ethernet. This project teaches industrial communication protocols and network management.
Robotics Control HubUse the CM4's processing power and multiple GPIOs to control multiple motors, read encoder feedback, and process sensor data for an advanced robot. Learn about motor control, real-time processing, and sensor fusion.
Custom Digital Signage PlayerDevelop a dedicated media player for digital displays, capable of playing high-definition video and managing content updates over the network. Leverages the CM4's multimedia capabilities and network connectivity.
Embedded Machine Vision SystemIntegrate a camera module and use the CM4's powerful CPU to perform real-time image processing tasks like object detection or barcode scanning. This project explores computer vision libraries and hardware acceleration.
Home Automation ServerCreate a central server for smart home devices, managing communication between different protocols (e.g., Zigbee, Z-Wave via USB dongles) and providing a web interface for control. Teaches network services and inter-device communication.
Data Logger with Cloud SyncDesign a system to log environmental data (temperature, humidity, pressure) from sensors and upload it to a cloud platform. Uses I2C sensors, file I/O, and network communication for data persistence and remote access.

Buying tips & gotchas

When purchasing the Compute Module 4, consider whether you need eMMC flash storage or if an external solution (like an SD card or NVMe SSD via a PCIe adapter on the carrier board) is sufficient. Carrier boards vary significantly in features and price; choose one that matches your project's I/O requirements. Be aware that the CM4 itself does not have built-in connectors for peripherals; a carrier board is essential. Official Raspberry Pi carrier boards are available, but many third-party options offer specialized features. Avoid counterfeit modules; always buy from reputable distributors to ensure genuine Broadcom silicon and proper firmware.