
CLUE Step Counter with ST LSM6DS33
Created by Liz Clark
Last updated on 2021-04-25 11:03:34 AM EDT

2
3
3
3
6
7
7
9
9
11
11
11
14
16
16
17
18
18
19
19
20
20
22
Guide Contents
Guide Contents
Overview
How It Works
Parts
Project Video
CircuitPython on CLUE
Set up CircuitPython Quick Start!
CLUE CircuitPython Libraries
Installing CircuitPython Libraries on your CLUE
Coding the CLUE Step Counter
Additional Libraries
Code
Fonts and Background Bitmap
CircuitPython Code Walkthrough
Setup
Graphics
Pedometer Setup
The Loop
Counting Steps
Calculating Average Steps Per Hour
Updating the Progress Bar
Adjusting Screen Brightness
Final Assembly and Use
© Adafruit Industries https://learn.adafruit.com/clue-step-counter-st-lsm6ds33 Page 2 of 23

Overview
You can clue into your daily step count with the CLUE board! Pair it with a wearable case and you have a
DIY step counter. A lot of step counters require an app to see your data, but with this project you can see
your daily steps without any fears about your data security.
How It Works
The CLUE's on-board accelerometer has a built-in pedometer. With the CircuitPython CLUE and
LSM6DS33 libraries, you can access the pedometer to count your steps with just a few lines of code.
In addition to monitoring your total step count, you can also track your progress towards your step goal
and see how many steps per hour you're taking. To keep your battery life going strong, you can also
adjust the CLUE's display brightness using the A and B buttons on either side of the screen.
Parts
Your browser does not support the video tag.
Adafruit CLUE - nRF52840 Express with Bluetooth LE
Do you feel like you just don't have a CLUE? Well, we can help with that - get a CLUE here at Adafruit by
picking up this sensor-packed development board. We wanted to build some...
$39.95
© Adafruit Industries https://learn.adafruit.com/clue-step-counter-st-lsm6ds33 Page 3 of 23

In Stock
Breadboard-friendly SPDT Slide Switch
These nice switches are perfect for use with breadboard and perfboard projects. They have 0.1" spacing
and snap in nicely into a solderless breadboard. They're easy to switch...
$0.95
In Stock
Add to Cart
Add to Cart
© Adafruit Industries https://learn.adafruit.com/clue-step-counter-st-lsm6ds33 Page 4 of 23

Lithium Ion Polymer Battery Ideal For Feathers - 3.7V 400mAh
Lithium ion polymer (also known as 'lipo' or 'lipoly') batteries are thin, light and powerful. The output
ranges from 4.2V when completely charged to 3.7V. This battery...
$6.95
In Stock
Add to Cart
© Adafruit Industries https://learn.adafruit.com/clue-step-counter-st-lsm6ds33 Page 5 of 23

Fully Reversible Pink/Purple USB A to micro B Cable - 1m long
This cable is not only super-fashionable, with a woven pink and purple Blinka-like pattern, it's also fully
reversible! That's right, you will save seconds a day by...
Out of Stock
Project Video
Out of
Stock
© Adafruit Industries https://learn.adafruit.com/clue-step-counter-st-lsm6ds33 Page 6 of 23

CircuitPython on CLUE
CircuitPython (https://adafru.it/tB7) is a derivative of MicroPython (https://adafru.it/BeZ) designed to simplify
experimentation and education on low-cost microcontrollers. It makes it easier than ever to get
prototyping by requiring no upfront desktop software downloads. Simply copy and edit files on the
CIRCUITPY flash drive to iterate.
The following instructions will show you how to install CircuitPython. If you've already installed
CircuitPython but are looking to update it or reinstall it, the same steps work for that as well!
Set up CircuitPython Quick Start!
Follow this quick step-by-step for super-fast Python power :)
https://adafru.it/IHF
Click the link above to download the latest version of
CircuitPython for the CLUE.
Download and save it to your desktop (or wherever is handy).
Plug your CLUE into your computer using a known-good USB
cable.
A lot of people end up using charge-only USB cables and it is
very frustrating! So make sure you have a USB cable you
know is good for data sync.
Double-click the Reset button on the top (magenta arrow) on
your board, and you will see the NeoPixel RGB LED (green
arrow) turn green. If it turns red, check the USB cable, try
another USB port, etc. Note: The little red LED next to the
USB connector will pulse red. That's ok!
If double-clicking doesn't work the first time, try again.
Sometimes it can take a few tries to get the rhythm right!
https://adafru.it/IHF
© Adafruit Industries https://learn.adafruit.com/clue-step-counter-st-lsm6ds33 Page 7 of 23