Both GPS modules use the M10478-A2 from Antenova, which is a high quality GPS module which is able to track 22 satellites and has an internal antenna. This means no external antenna is needed if the module has clear access to sky. Both feature a SuperCap to store ephemeris data for up to four hours. This and many more features are included.
Both have been specifically designed for the Raspberry Pi Zero, however they will work with any version of Raspberry Pi.
The BerryGPS-IMU also includes all the components found on the BerryIMU. And is compatible with the existing code in our repository. The BerryGPS-IMU present a lot of sensors in a very, very small package.
This guide covers how to use an Inertial Measurement Unit (IMU) with a Raspberry Pi . This is an updated guide and improves on the old one found here.
In this guide I will explain how to get readings from the IMU and convert these raw readings into usable angles. I will also show how to read some of the information in the datasheets for these devices.
When using the IMU to calculate angles, readings from both the gyro and accelerometer are needed which are then combined. This is because using either on their own will result in inaccurate readings. And a special note about yaw.
Here is why; Gyros - A gyro measures the rate of rotation, which has to be tracked over time to calculate the current angle. This tracking causes the gyro to drift. However, gyros are good at measuring quick sharp movements. Accelerometers - Accelerometers are used to sense both static (e.g. gravity) and dynamic (e.g. sudden starts/stops) acceleration. They don’t need to be tracked like a gyro and can measure the current angle at any given time. Accelerometers however are very noisy and are only useful for tracking angles over a long period of time.
Accelerometers cannot measure yaw. To explain it simply, yaw is when the accelerometer is on a flat level surface and it is rotated clockwise or anticlockwise. As the Z-Axis readings will not change, we cannot measure yaw. A gyro and a magnetometer can help you measure yaw. This will be covered in a future guide.
The IMU used for this guid a BerryIMU which uses a LSM9DS0, which consists of a 3-axis gyroscope, a 3-axis accelerometer and a 3-axis magnetometer.
The datasheet is needed if you want to use this device;LSM9DS0
This IMU communicates via the I2C interface.
The image below shows how to connect the BerryIMU to a Raspberry Pi
Or BerryIMU can sit right on top of the GPIO pins on a Raspberry Pi A, B, B+ and A+. The first 6 GPIOs are used as shown below.
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;
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 .