Python Forum
Bike Cadence/RPM displayed via Raspberry Pi 3 on Pimoroni Blinkt
Thread Rating:
  • 3 Vote(s) - 3.33 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Bike Cadence/RPM displayed via Raspberry Pi 3 on Pimoroni Blinkt
#1
Hi,

I want to make a cadence/RPM -Raspberry Pi based LED display mounted on my handle bar so I can see my RPM while mountainbiking.
It needs to switch different Led light patterns according to Rpm on the MetaWear RG / Raspberry Pi base.

I have bought a Metawear RG development board sensor and downloaded the "MetaWear Python SDK for Debian".
Now I am struggeling to get the data from the sensor usable on a Raspberry Pi.

The sensor connects via Bluetooth (I get the LED to blink Green as proof).
I tried to run various scripts on the Pi and failed to get a read out.
I Do get a read out via ios and Win10 development app btw.
Can you help us getting some signals out (i'm pretty much a noob on the Pi)?

This is the hardware I have atm:
* Raspberry Pi 3 running Debian Jessie + Metawear + Pimoroni installed
* Metawear RG development board (casing I will 3D print myself for mounting under the pedal or on the Crank)
* Pimoroni Blinkt (8-LED Hat)
* 5V powerpack to power the RPi for a Day (or more) but still need to buy it :)

I need:
Idle / 0-RPM -> program 1 (PRg1.py) will be sleep mode or 1 Red blinking every 3 sec
Peddling -> program 2 (PRi2.py) will be startup patterns with random blinking and Rainbow for 5 Sec
Rpm 1-15 -> program 3 (PRi3.py) still to create / adjusted Larson/Solid "White"
Rpm 16-30 -> program 4 (PRi4.py) still to create / adjusted Larson/Solid "Red"
Rpm 31-45 -> program 5 (PRi5.py) still to create / adjusted Larson/Solid "Yellow"
Rpm 46-60 -> program 6 (PRi6.py) still to create / adjusted Larson/Solid "Green"
Rpm 61-75 -> program 7 (PRi7.py) still to create / adjusted Larson/Solid "Blue"
Rpm 76-110 -> program 8 (PRi8.py) still to create / adjusted Larson/Solid "Purple"

The PRi*.py programms can be re-writed/adjusted Pimoroni programs like my 1st thought above.

Thanks in Advance,
Ramasen
Netherlands
Reply
#2
Not familiar with your hookup, but did a bit of searching, found your post on community.mbientlab.com
and also the following (which may or may not be new to you): https://github.com/mbientlab/MetaWear-SDK-Python
Reply
#3
Yes i found that also, installed and used it.
All i get is raw data from gyro and accelerometer for 20sec max wich needs to become a constant stream as long as i ride my bike.
I am trying to figure out how to use the raw data for rpm / cadence calculating.
From There it needs to send out signals according to the rpm wich addresses the pimoroni blinkt to light up in different colours.

For Now i am pretty much stuck :(
Reply
#4
It's not easy to do, but will get you where you want to go.
Look at the simple stuff first for an answer to your questions.

If that doesn't work:
  • 1. For each of the devices that need to be programmed, go to the web site of the manufacturer and
    download any technical documentation (data sheets and especially users guide). These will contain complete
    information on how to program each device.

  • 2. For example if the "Adafruit - Triple-axis Accelerometer+Magnetometer (Compass) Board - LSM303" has a
    link on their homepage (https://www.adafruit.com/product/1120) to Technical details and Learn. The datasheet
    is available on the 'technical details' page. and under the datasheet has a Using the LSM303 page:
    'https://learn.adafruit.com/lsm303-accelerometer-slash-compass-breakout/coding, This includes sample code in
    'C' on use and calibration. From this you should be able to garner how to program the device for multiple readouts

The same process can be used for each device. Even if the code examples are in a language other than C. It should give
you insight as to how to proceed.
Reply
#5
I found the missing link (i believe): connection between Blinkt! and Metawear doesn't work.
Do i need to creat a new *.py file to merge/address both libraries/folders?
One is in pi/pimoroni/blinkt and the other in Home/Metwear-sdk.... wich is root for the "pi" level.
Reply
#6
You don't merge packages, you can have old and new ones.
The package is installed for a specific version (or range of versions) of python
Reply
#7
Both are for python 3, i need the ble sensor accelerometer data to trigger the Blinkt! programs.
In the raw acc data i see 2 shifting points "+G & -G" from wich the Rotation Per Minute can be calculated.
The "rpm" needs to be read out and trigger the Blinkt! led patterns.

Can a new *.py file import both the Ble sensor and Blinkt! data to work together?
On my iphone app i get a RPM stream from the sensor wich i long to see on my Rpi3 as usable data.
Reply
#8
import each file (after you have installed it) with import statement
Reply
#9
I'll sign in from my laptop in a few days to show some examples.
Yes, most i did on the Rpi3 was is via VMware but writing Here is done from my telephone.
Reply


Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020