Skip to content

Accelerometer Wireling Tutorial

TinyCircuits Accelerometer Wireling product photo

This Wireling features the high performance and low power Bosch BMA250 3-axis accelerometer. The BMA250 allows measurement of accelerations in three perpendicular axes and thus senses tilt, motion, shock, and vibration in your projects. There is also an integrated temperature sensor built in.

Technical Details Bosch BMA250 Accelerometer Specs
  • 3-axis (X, Y & Z)
  • Digital resolution: 10bit
  • Resolution: 3.9mg
  • Measurement ranges: +-2g, +-4g, +-8g, +-16g
  • Sensitivity: 2g: 256LSB/g, 4g: 128LSB/g, 8g: 64LSB/g, 16g: 32LSB/g
  • Zero-g offset (over lifetime): +-80mg
  • Bandwidths: 1000Hz… 8Hz
  • Low Power: 139uA @2kHz data rate
Power Requirements
  • Voltage: 3.0V - 5.5V
  • Current: 139uA (Normal Mode).  Due to the low current, this board can be run using the TinyDuino coin cell option
Pins Used
  • A5/SCL - I2C Serial Clock line
  • A4/SDA - I2C Serial Data line
  • A(x)/INT - Interrupt Pin 
    • Note: (x) corresponds to the Wireling port
  • 10mm x 10mm (.394 inches x .394 inches)
  • Max Height (from lower bottom of Wireling to upper top Wireling Connector): 3.63mm (0.143 inches)
  • Weight: 1 gram (.04 ounces)



Required Software

Hardware Assembly

Plug your Wireling into the port you plan on using! The default in the included program is port 0.

If you want to use a different port, you just need to change the port value in the program mentioned later.


Install the necessary Python package:

pip3 install tinycircuits-bma250

Then you can download (above under Software) the Accelerometer Sensor Wireling Python example:
# BMA250 Example
# Reads all sensor data from accelerometer (X, Y, Z, Temp) and prints
# Written by: Laverena Wienclaw for TinyCircuits

import tinycircuits_wireling
import tinycircuits_bma250
import time

# Enable power to pi hat and wirelings
wireling = tinycircuits_wireling.Wireling()
wireling.selectPort(0) # Select port (0-3) labeled on the Pi Hat

# Sensor init: See tinycircuits_bma250 for reg definition descriptions
bma250 = tinycircuits_bma250.BMA250(0x03, 0x08)

while True:
    print("X: %0.1d" % bma250.X)
    print("Y: %0.1d" % bma250.Y)
    print("Z: %0.1d" % bma250.Z)
    print("Temp: %0.1f" % bma250.Temp)

Run Program

Navigate in the terminal to the directory with the file parent to the examples folder.


Once the program is running, you should see the sensor values print out:

X: 65
Y: 204
Z: 142
Temp: 25.5

Move the sensor around to see the values change, or put a finger down on the sensor lightly to see the temperature increase.


Contact Us

If you have any questions or feedback, feel free to email us or make a post on our forum. Show us what you make by tagging @TinyCircuits on Instagram, Twitter, or Facebook so we can feature it.

Thanks for making with us!