ArduCAM/B0580-002-SDK

★ 0Forks 0ShellGitHub ↗Compare

README

Arducam B0580-002 SDK

Arducam B0580-002 IMU sensor SDK release package. It provides C / C++ / Python APIs for scanning devices, opening the IMU, and reading accelerometer, gyroscope, temperature, and timestamp data.

See the full API documentation in doc/arducamb0580-002sdk.pdf.

Follow the following tutorial to build the complete program.

Directory Structure

.
├── assets/                 # Example screenshots
├── doc/                    # SDK documentation
│   └── arducamb0580-002sdk.pdf
├── examples/
│   ├── CMakeLists.txt      # Build C / C++ examples together
│   ├── c/
│   │   ├── CMakeLists.txt
│   │   └── demo_c.c
│   ├── c++/
│   │   ├── CMakeLists.txt
│   │   └── demo_cpp.cpp
│   └── python/
│       ├── demo_py.py
│       ├── pose_show.py
│       └── requirements.txt
├── library/
│   ├── amd64/              # x86_64 deb / wheel packages
│   ├── arm64/              # aarch64 deb / wheel packages
│   └── armhf/              # armv7l deb / wheel packages
├── scripts/
│   └── build_examples.sh   # One-click C / C++ build, output to bin/
└── README.md

Supported Platforms

Architecture deb package directory Python wheel
amd64 (x86_64) library/amd64/ cp38 ~ cp313
arm64 (aarch64) library/arm64/ cp38 ~ cp313
armhf (armv7l) library/armhf/ cp38 ~ cp313

Download

You can get the SDK with git clone or by downloading a ZIP from GitHub. All later steps assume your shell is in the project root (the folder that contains README.md, library/, and examples/).

Option A: Clone with git

  1. Open a terminal.

  2. Create a working directory and enter it:

mkdir -p Arducam-B0580-002
cd Arducam-B0580-002
  1. If git is already installed, skip this step. Check with:
git --version

If the command prints a version (for example git version 2.x.x), git is installed and you can go to step 4. Otherwise, please execute the following command to install:

# Debian / Ubuntu / Raspberry Pi OS
sudo apt update && sudo apt install -y git
  1. Clone the repository:
git clone https://github.com/ArduCAM/B0580-002-SDK.git
cd B0580-002-SDK
  1. Verify the download is complete. Key directories and files should exist:
test -f README.md \
  && test -d library/amd64 && test -d library/arm64 && test -d library/armhf \
  && test -d examples/c && test -d examples/c++ && test -d examples/python \
  && test -d doc && test -d scripts \
  && echo "Download OK" \
  || echo "Download incomplete"
  • If the output is Download OK, continue with the installation steps below.
  • If the output is Download incomplete (network interruption, partial clone, etc.), delete the incomplete repository and clone again:
cd ..
rm -rf B0580-002-SDK
git clone https://github.com/ArduCAM/B0580-002-SDK.git
cd B0580-002-SDK

Then repeat step 5. If it still fails, check your network connection and retry.

Option B: Download a ZIP

  1. Download the ZIP from GitHub and extract it.
  2. Open a terminal and switch to the extracted project root yourself (for example cd ~/Downloads/B0580-002-SDK-main or cd ~/Arducam-B0580-002/B0580-002-SDK).

There is no .git directory in a ZIP download, so commands like cd "$(git rev-parse --show-toplevel)" will not work. Before performing the installation and build steps below, please use the cd to enter the project root directory (B0580-002-SDK).

Installation

1. Install the C / C++ SDK (deb)

sudo dpkg -i library/$(dpkg --print-architecture)/arducam-B0580-002-sdk_0.1.0_*.deb

2. Install the Python package (wheel)

pip3 install --no-index \
  --find-links=library/amd64 \
  --find-links=library/arm64 \
  --find-links=library/armhf \
  arducam_b0580_002_sdk_py

3. Install Python example dependencies

pose_show.py needs OpenCV and NumPy (not included with the SDK wheel):

pip3 install -r examples/python/requirements.txt

Build and Run C / C++ Examples

Each block below starts from the project root. If you used git clone, run cd "$(git rev-parse --show-toplevel)" first. If you downloaded the ZIP, please do not execute the cd "$(git reverse path -- show toplevel)" and switch to the project root directory by yourself (B0580-002-SDK).

Option 1 builds the C and C++ demos separately. Option 2 builds both C and C++ demos with one command.

Option 1: Build separately under the C / C++ directories

Build and run the C example

# Use git clone to run this command back to the project root directory
cd "$(git rev-parse --show-toplevel)"
cd examples/c
mkdir -p build && cd build
cmake ..
make
./demo_c

Expected output:

demo_c

Build and run the C++ example

# Use git clone to run this command back to the project root directory
cd "$(git rev-parse --show-toplevel)"
cd examples/c++
mkdir -p build && cd build
cmake ..
make
./demo_cpp

Expected output:

demo_cpp

Option 2: Use the one-click build script

# Use git clone to run this command back to the project root directory
cd "$(git rev-parse --show-toplevel)"
./scripts/build_examples.sh

The script builds the C / C++ examples with examples/CMakeLists.txt, copies the executables to the project-root bin/ directory, and removes intermediate build files.

./bin/demo_c
./bin/demo_cpp

See the C / C++ screenshots above for expected output.

Run Python Examples

python3 examples/python/demo_py.py

Expected output:

demo_py

Attitude visualization example (requires OpenCV and NumPy; install with pip3 install -r examples/python/requirements.txt):

This demo needs a local graphical display. If you use a remote terminal (for example SSH), set up display forwarding yourself.

python3 examples/python/pose_show.py

Press q on the keyboard to quit the program.

Terminal output:

pose_show_1

Visualization window:

pose_show_2

Demo video (MP4)

Examples

File Description
examples/c/demo_c.c C API example
examples/c++/demo_cpp.cpp C++ API example
examples/python/demo_py.py Python API example
examples/python/pose_show.py Attitude visualization with Mahony filter

Basic Workflow

  1. device_scanner: Scan Arducam devices and resolve I2C bus / IMU addresses
  2. open_imu / open_imu_path: Open the IMU
  3. read_imu: Read raw sensor data
  4. accel_to_g / gyro_to_dps / temp_to_c: Convert raw values to physical units
  5. devices_free: Free the device list resources

Documentation

Full API documentation: doc/arducamb0580-002sdk.pdf

Issues