Adding Sensors to the Pi - alanbjohnston/CubeSatSim GitHub Wiki

This page describes how to add a sensor to the Pi Zero 2. The normal way to add new sensors to the CubeSatSim is to add them to the Main board so they are read by the Raspberry Pi Pico microcontroller as described here: https://github.com/alanbjohnston/CubeSatSim/wiki/Adding-New-Sensors

However, for the Lite board, the only way to add sensors is to have the Pi Zero 2 read them.

The sensors are added to the I2C Bus 1 on the Raspberry Pi Zero 2. This can be done using the GPIO pins, but it is easiest to use the Qwiic connector on the Lite.

If you have the v2.2 software, a BME280 or MPU6050 sensor will be automatically detected and configured on power up. Automatic simulated telemetry will be turned off if a BME or MPU sensor is plugged into the Lite.

You can read the sensors by typing these commands into the Pi Zero 2:

  cd
  raspberry-pi-bme280/bme280
  MPU6050-C-CPP-Library-for-Raspberry-Pi/mpu6050

The MPU should be calibrated by having it not moving in the horizontal position (+Z facing up) and typing this command:

  MPU6050-C-CPP-Library-for-Raspberry-Pi/mpu6050 c

These commands just return the set of readings, four numbers for the BME280 and six numbers for the MPU6050. If you get all zeros, it means the sensor was not able to be read. You can scan the I2C buses using this command CubeSatSim/config -S. If they are connected, the MPU will show up as address 68 and the BME as address 76 on the I2C Bus 1.

You can also plug the BME and MPU into the Qwiic connector on the Solar board or connect them to the I2C Bus 1 GPIO pins. However, they will not be read if the Pico is plugged in and programmed. For these sensors to be read, you will need to unplug the Pico or program it so it doesn't send sensor data over the serial port.