Example Code for Raspberry Pi-get configuration status
Last revision 2026/01/21
Get the configuration status of the BMM150 sensor on Raspberry Pi.
Hardware Preparation
- Raspberry Pi 4 Model B-2GB (or similar) x 1
- BMM150 Triple Axis Magnetometer Sensor x1
- Dupont Wires
Software Preparation
- BMM150 Sensor Python Library
- RASPBIAN Official OS
Wiring Diagram
Connect the module with Raspberry Pi as shown below. Default address: 0x13.

Other Preparation Work
- Enable Raspberry Pi I2C:
- Open the terminal and enter
sudo raspi-config. - Select "5 Interface Options" -> "P5 I2C" -> "YES", then restart.
- Open the terminal and enter
- Install dependencies:
sudo apt-get updatesudo apt-get install build-essential python-dev python-smbus git
- Download the library:
cd Desktopgit clone https://github.com/DFRobot/DFRobot_BMM150
- Navigate to the sample code directory:
cd DFRobot_BMM150/python/raspberrypi/examples/get_all_state
Sample Code
Open the terminal and enter the following commands to run the sample code:
cd DFRobot_BMM150/python/raspberrypi/examples
cd get_all_state
python get_all_state.py
Result

Was this article helpful?
