Skip to content

danche626/rpi-cm4-dev

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

5 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Raspberry Pi CM4 Development Kit

A macOS-based development environment for Raspberry Pi Compute Module 4 (Lite, Wi-Fi). Includes system configuration, remote access setup, and example scripts for GPIO, camera, and sensor interfacing.

Hardware

Component Specification
Module Raspberry Pi CM4 Lite (no eMMC)
SoC BCM2711, Quad-core Cortex-A72 @ 1.5GHz
RAM 4GB LPDDR4
Storage 32GB MicroSD (Raspbian Trixie)
Wireless Dual-band WiFi 802.11ac, Bluetooth 5.0
USB 4x USB 3.0
GPIO 40-pin header, I2C, SPI, UART
Carrier Board Hiwonder CM4 Board (RPi 4B compatible)
Power USB-C 5V/3A

System Info

  • OS: Raspbian GNU/Linux 13 (trixie)
  • Kernel: Linux 6.18.34+rpt-rpi-v8 aarch64
  • Python: 3.13.5
  • IP (WiFi): 192.168.0.153
  • User: yuanji

Quick Start

1. Flash SD Card

Use Raspberry Pi Imager to write Raspberry Pi OS to a MicroSD card. Configure username, password, WiFi, and SSH in the Imager settings before flashing.

2. SSH Access

ssh yuanji@192.168.0.153

For passwordless access, copy your SSH key:

ssh-copy-id yuanji@192.168.0.153

3. Run Examples

# GPIO blink test
python3 examples/blink.py

# I2C device scan
python3 examples/i2c_scan.py

# Camera capture
python3 examples/camera_capture.py

Project Structure

rpi-cm4-dev/
├── README.md
├── docs/
│   └── setup.md              # Detailed setup guide
├── examples/
│   ├── blink.py              # GPIO LED blink
│   ├── i2c_scan.py           # I2C bus scanner
│   ├── camera_capture.py     # PiCamera2 capture
│   └── servo_control.py      # PWM servo control
├── scripts/
│   ├── deploy.sh             # Deploy code to CM4 via rsync
│   └── system_info.sh        # Print system diagnostics
└── config/
    └── interfaces.md         # Pin mapping & wiring reference

Available Interfaces

Interface Device Status
I2C /dev/i2c-20, /dev/i2c-21 Active
SPI /dev/spidev* Needs enabling
UART /dev/ttyAMA* Needs enabling
Camera CSI (libcamera) Available via picamera2
GPIO gpiozero / lgpio Ready

Key Python Packages (Pre-installed)

  • gpiozero / lgpio / gpiod — GPIO control
  • picamera2 — Camera interface
  • smbus2 / spidev — I2C/SPI communication
  • numpy / pillow — Data & image processing
  • pygame — Display & input
  • sense-hat — Sense HAT sensor suite
  • pyserial — Serial communication

Development Workflow

Mac (VS Code / Terminal)
    │
    ├── Edit code locally
    ├── rsync/scp to CM4
    │       ↓
    └── SSH → Run & Debug on CM4

Or use VS Code Remote-SSH extension for seamless editing directly on the Pi.

Deploy Script

# Sync project files to CM4
./scripts/deploy.sh

License

MIT

About

No description, website, or topics provided.

Resources

Stars

1 star

Watchers

0 watching

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages