lam2018
Posts: 5
Joined: Thu Mar 08, 2018 4:16 pm

How to measure RPM using a Hall Effect Sensor

Fri Sep 06, 2019 1:42 pm

I currently have a Raspberry Pi 3, a hall effect sensor https://grobotronics.com/hall-sensor-board.html and a magnet attached to a bicycle's wheel. I'd like to make a RPM vs Time chart that shows the gradual decrease of the wheel's speed (in RPM). but I don't know where to start because I'm still a beginner. I would either do this through node-red or make a python script that logs the RPM value every 2 seconds or so and then I could manually make the chart in Excel. Is there anyone who could help me out a bit?


Paul Hutch
Posts: 384
Joined: Fri Aug 25, 2017 2:58 pm
Location: Blackstone River Valley, MA, USA
Contact: Website

Re: How to measure RPM using a Hall Effect Sensor

Sat Sep 07, 2019 3:46 pm

What is the frequency of the pulses in your application?

This is the type of application where, depending on the frequency, a microcontroller (possibly an Arduino) may be a much simpler, lower cost, lower power and more reliable solution.


goodburner
Posts: 50
Joined: Sun Jun 16, 2019 3:20 am

Re: How to measure RPM using a Hall Effect Sensor

Sat Sep 07, 2019 4:15 pm

I've measured upto 45000rpm using a simple microphone and audacity. You record, then measure the time between the peaks of the wave, 60/(end time - start time) = rpm.

lam2018
Posts: 5
Joined: Thu Mar 08, 2018 4:16 pm

Re: How to measure RPM using a Hall Effect Sensor

Sun Sep 08, 2019 2:25 pm

joan wrote:
Sat Sep 07, 2019 4:02 pm
Another Python example.

http://abyz.me.uk/rpi/pigpio/examples.h ... ead_RPM_py
I tried to run your code but It didn't work. Do you know what's wrong?
Do I need anything else besides a hall effect sensor to run your code? What sensor are you using and how is it connected to the gpios?
Sorry for all these stupid questions but I am a total beginner and I really need to make this work.

This is what I see in the shell when I try to run the python code.
http://prntscr.com/p3dt58

User avatar
joan
Posts: 14257
Joined: Thu Jul 05, 2012 5:09 pm
Location: UK

Re: How to measure RPM using a Hall Effect Sensor

Sun Sep 08, 2019 3:56 pm

The code I linked requires the pigpio daemon to be running.

sudo pigpiod

lam2018
Posts: 5
Joined: Thu Mar 08, 2018 4:16 pm

Re: How to measure RPM using a Hall Effect Sensor

Sun Sep 08, 2019 4:51 pm

joan wrote:
Sun Sep 08, 2019 3:56 pm
The code I linked requires the pigpio daemon to be running.

sudo pigpiod
Thanks. However I need to initialise the pigpio library first because it says it is dead.

User avatar
joan
Posts: 14257
Joined: Thu Jul 05, 2012 5:09 pm
Location: UK

Re: How to measure RPM using a Hall Effect Sensor

Sun Sep 08, 2019 4:55 pm

Are you running on a Pi? Could you show the command you are running as well as the error response. I'm not sure about "dead" in this context.

lam2018
Posts: 5
Joined: Thu Mar 08, 2018 4:16 pm

Re: How to measure RPM using a Hall Effect Sensor

Sun Sep 08, 2019 5:05 pm

joan wrote:
Sun Sep 08, 2019 4:55 pm
Are you running on a Pi? Could you show the command you are running as well as the error response. I'm not sure about "dead" in this context.
Just managed to make the code work.Thanks a ton! All I need to do now is use it with my sensor. Do you think it would work with a normal hall effect sensor? If so which gpios should I connect it to?

User avatar
joan
Posts: 14257
Joined: Thu Jul 05, 2012 5:09 pm
Location: UK

Re: How to measure RPM using a Hall Effect Sensor

Sun Sep 08, 2019 5:53 pm

Yes it will work with Hall effect sensors, probably better as they have cleaner edges in my experience.

Use any spare GPIO, they don't require anything special.

Not using the same module, but still pigpio.

https://www.raspberrypi.org/forums/view ... hp?t=90243

lam2018
Posts: 5
Joined: Thu Mar 08, 2018 4:16 pm

Re: How to measure RPM using a Hall Effect Sensor

Mon Sep 09, 2019 6:44 pm

joan wrote:
Sun Sep 08, 2019 5:53 pm
Yes it will work with Hall effect sensors, probably better as they have cleaner edges in my experience.

Use any spare GPIO, they don't require anything special.

Not using the same module, but still pigpio.

https://www.raspberrypi.org/forums/view ... hp?t=90243
Do you also know what modifications should I do to your code so It automatically writes the data to a.CSV file (like a logger). And maybe also make a live graph of the data using matplotlib?

Return to “General discussion”