Continue to Site

Welcome to EDAboard.com

Welcome to our site! EDAboard.com is an international Electronics Discussion Forum focused on EDA software, circuits, schematics, books, theory, papers, asic, pld, 8051, DSP, Network, RF, Analog Design, PCB, Service Manuals... and a whole lot more! To participate you need to register. Registration is free. Click here to register now.

[PIC] RPM Speed Calculation Formular using PIC18F4620 microcontroller

Status
Not open for further replies.

Kaybee909

Newbie level 4
Joined
Aug 6, 2013
Messages
7
Helped
0
Reputation
0
Reaction score
0
Trophy points
1
Activity points
53
Hi, I am in a tight corner with regards to my research. However, I need to calculate the RPM Speed of a motor using PIC18F4620 microcontroller in relation to the following parameters:
Oscillator frequency=20MHz,
Encoder marks=1024,
Pulses(rising edges) and
the time,t.
Can you please help me with the FORMUALR for the Speed in RPM? I'm using timer0 and RB0 for my internal and external interrupts.
 

Hi,

if your motor turns with 60 RPM, then your motor turns once per second.
- your encoder turns once per second
- your encoder outputs 1024 pulses per second

now program your PIC so it counts the pulses for exactely one second.
with 60 RPM you get a counter vlue of 1024.

multiply the counter value by 60/1024 = 0.0586

1024 x 0.0586 = 60.0064 round it to an integer value and get 60. This is the RPM.

If your motor turns faster then the counter value is higher and the calculated RPM value is correct.


********
The formula: RPM = countervalue x 0.0586

Hope this helps

Klaus
 

Hi Klaus,
Based on my PIC program, I generate counts from timer0 interrupts and RB0 interrupts for both timer counts and pulse (rising edges) counts respectively. However, I use the Signal generator to send pulses through the RB0/INT for external interrupts. Meanwhile, I am not actually using a MOTOR directly, so my RPM speed value is dependent on the frequency of signal generator. When frequency of signal generator is increased, then the RPM speed should also increase.
My final target is to obtain the RPM speed value within an "Elapsed Time". So, my RPM speed value should be a function of pulse counts, time counts and encoder marks(1024). While the frequency of the crystal oscillator is 20MHz.

I need my formular to reflect this parameters. Please help me out....
 

Hi,

it´s not clear to me.

Can you write an example, or paint a draft, please.

Klaus
 

in a PIC24 based mechatronics trainer we use
**broken link removed**

the motor speed sensor is a simple system where a fan interrupts a beam
1. the signal from the fan is fed to a digital input with interrupt on change - a count is accumulated
2. timer runs for a tenth of a second and the calculation for RPM is (the fan has three blades so one gets 3 interrupts/recolution)
RPM = count*600/3
one has to be careful of 16bit integer overflow etc so cast the count to long integer
the count is then zeroed ready for the next tenth of a second count
 

cc.png
Please see complete circuit diagram
 

Status
Not open for further replies.

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top