Tag Archives: magnetometer

Python Code for BerryIMU – Accelerometer, Gyroscope, Magnetometer & Pressure Sensor

We have updated our git repository with python code for the BerryIMU.

This is specific for the BerryIMU, however the math and code can be applied to any digital IMU, just some minor modifications need to be made. E.g  Pololu MinIMU, Adafruit IMU and Sparkfun IMUs

Git repository here
The code can be pulled down to your Raspberry Pi with;

pi@raspberrypi ~ $ git clone http://github.com/mwilliams03/BerryIMU.git

 

We have left the code as simple as it can be to make it easier to understand.

The code currently performs angle measurements using the gyroscope and accelerometer , which are fused using a complementary filter. The heading is also calculated using the magnetometer, without tilt compensation.
BerryIMU Raspberry Pi Gyroscope Accelerometer
To view pressure;

pi@raspberrypi ~ $ sudo python berryIMU.py

To view pressure;

pi@raspberrypi ~ $ sudo python bmp180.py

Detailed Guides and Tutorials

In this order;
Guide to interfacing a Gyro and Accelerometer with a Raspberry Pi
Guide to interfacing a Gyro and Accelerometer with a Raspberry Pi – Kalman Filter
Create a Digital Compass with the Raspberry Pi – Part 1 – “The Basics”
Create a Digital Compass with the Raspberry Pi – Part 2 – “Tilt Compensation”
Create a Digital Compass with the Raspberry Pi – Part 3 – “Calibration”

 

These cover both BerryIMU and displaying graphics with SDL;
How to Create an Inclinometer using a Raspberry Pi and an IMU

Create a Digital Compass with the Raspberry Pi – Part 1 – “The Basics”

This will be a multipart series on how to use a digital compass(magnetometer) with your Raspberry Pi.

The magnetometer used in these tutorials is a LSM9DS0 which is on a BerryIMU. We will also point out where some of the information can be found in the Datasheet for the LSM9DS0. This will help you understand how the LSM9DS0 works.

The math and logic in this series can also be used with other magnetometers or IMUs.

We will also go over how to do some basic communication on the i2c bus. As well as using SDL to display the compass heading as traditional compass as shown in the video above.

Git repository here
The code can be pulled down to your Raspberry Pi with;

pi@raspberrypi ~ $ git clone https://github.com/mwilliams03/BerryIMU.git

The code for this guide can be found under the compass_tutorial01_basics directory. 

Overview of a Compass

Raspberry Pi Compass
A traditional Magnetic compass (as opposed to a gyroscopic compass) consists of a small, lightweight magnet balanced on a nearly frictionless pivot point. The magnet is generally called a needle. The Earth’s Magnetic field will cause the needle to point to the North Pole.

To be more accurate, the needle points to the Magnetic North. The angle difference between true North and the Magnetic North is called declination. Declination is different in different locations. This angle varies depending on position on the Earth’s surface, and changes over time.

The strength of the earth’s magnetic field is about 0.5 to 0.6 gauss .

Continue reading Create a Digital Compass with the Raspberry Pi – Part 1 – “The Basics”

New Kickstarter Launched – BerryIMU

An accelerometer, gyroscope and magnetometer which is specifically designed for the Raspberry Pi.

 

What is it?

BerryIMU is an inertial measurement unit, or IMU, that measures and reports on velocity, orientation and gravitational forces, using a combination of an accelerometer, gyroscope and a magnetometer.

IMUs can be found in devices like, quad copters, smart phones, segways, Wii Remote etc.. and are used to sense movement and orientation.

BerryIMU for the raspberry pi

Adding BerryIMU to your Pi will open up a whole new world of possibilities.

BerryIMU is specifically designed for the Raspberry Pi and is designed to take some of the complexity out of IMUs and to try and make them more enjoyable to use. BerryIMU includes the latest and greatest sensor ICs.

Head on over to Kickstarter.com to check it out;
https://www.kickstarter.com/projects/2135028730/berryimu-orientation-sensor-for-the-raspberry-pi