Continue to Site

Welcome to our site!

Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.

  • Welcome to our site! Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.

RPM Meter Idea

Status
Not open for further replies.

Suraj143

Active Member
Hi I’m going to build a PIC RPM meter range will be 0-9999.

I’ll use TMR1 as a counter (pulse input will connect to TMR1 input)

I’ll use TMR0 to count 1 second & when it reaches 1 second I’ll read TMR1 16bit value & multiply by 60 & show on the display.

Tell is this method good?
 
No, it's not a good way to measure rpm because at low rpms (below 60 rpm), your T1 counter has no values inside and you get no readings or big errors in readings.
It's better to measure the period T (ie the time the motor takes for a single turn) in msec (or msec x 10) and then divide 60 sec by that time.
 
Hi Arkham00

Thanks for your wonderful idea.

You mean
1) Wait until pulse comes & then start the timer.

2)Wait until 2nd pulse comes & read the timer.

3)Divide 60Sec by Timer value.

Is this correct?

Is TMR0 suitable for this job with a general I/O pin connecting to the sensor input?

Thanks
 
Last edited:
If you want to measure up to 9999 rpm, then the minimum period will be 60 msec. This is a very long time for a PIC (let's say a 16F84A at 12MHz). You can use the RB0 interrupt (edge triggered).

You program your timer T0 to have an interrupt every 1 msec.
For every T0 interrupt, you increment a 16 bit variable (name it CNT).

Each time you get an RB0 interrupt, just copy CNT to a temp location, calculate the RPM and reset CNT so you are ready for the next turn of the motor turn.
 
Arkham00's method of measuring the RPM is a good way of doing it, but can be inaccurate if the spacing between each pulse on the encoder is not exactly the same.
If the encoder is accurate, this method can be much faster than waiting 1 second and counting pulses.
What are you measuring and what is your setup for the measurement?
 
Status
Not open for further replies.

Latest threads

New Articles From Microcontroller Tips

Back
Top