Wiring a digital accelerometer to the I2C bus

Digital accelerometers usually provide a better precision, higher resolution and more sensitivity than analog accelerometers. Now, we will work with a digital 3-axis accelerometer with a full sensing range from -16g to +16g. We will use a breakout board that uses the I2C bus to allow the board to communicate with the accelerometer.

We will use the two pins labeled SDA and SCL to connect the data and clock lines of the I2C bus to the corresponding pins in the digital accelerometer breakout board. After we finish the necessary wirings, we will write Python code to measure and display the acceleration for the three axis: x, y and z. This way, we will read the result of sending commands to the accelerometer ...

Get Internet of Things with Python now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.