Book Image

Getting Started with Raspberry Pi Zero

By : Richard Grimmett
Book Image

Getting Started with Raspberry Pi Zero

By: Richard Grimmett

Overview of this book

Raspberry Pi Zero is half the size of Raspberry Pi A, only with twice the utility. At just three centimeters wide, it packs in every utility required for full-fledged computing tasks. This practical tutorial will help you quickly get up and running with Raspberry Pi Zero to control hardware and software and write simple programs and games. You will learn to build creative programs and exciting games with little or no programming experience. We cover all the features of Raspberry Pi Zero as you discover how to configure software and hardware, and control external devices. You will find out how to navigate your way in Raspbian, write simple Python scripts, and create simple DIY programs.
Table of Contents (16 chapters)
Getting Started with Raspberry Pi Zero
Credits
About the Author
About the Reviewer
www.PacktPub.com
Preface
Index

Connecting a digital compass to Raspberry Pi Zero


Now you've created some pretty basic connections to Raspberry Pi Zero, turning lines on and off and sensing a high or low signal. Now let's explore one of the other interfaces available on Raspberry Pi Zero, the I2C interface. To do this, you'll connect a digital compass with this sort of interface.

Note

For more on the I2C interface, see http://www.robot-electronics.co.uk/i2c-tutorial.

There are several chips that provide digital compass capability; one of the most common is the HMC5883L, a 3-axis digital compass chip. This chip is packaged in a module by several companies but almost all of them result in a similar interface.

Here is an image of the GY-271 HMC5883L, a triple-axis compass magnetometer sensor module available with a number of online retailers:

This type of digital compass uses magnetic sensors to measure the earth's magnetic field. The output of these sensors is then made accessible to the outside world through a set of registers...