high resolution RPM code needed
technoob
Posts: 21
· Hello,·· Its me again.
Im attempting to get a real accurate RPM reading. (high resolution)·· Im using the Melexis 90217.· Im using this code.
'
[noparse][[/noparse] I/O Definitions ]
SpeedIn PIN 15
'
[noparse][[/noparse] Constants ]
·'
[noparse][[/noparse] Variables ]
Pulses···· VAR····· Word
RPM······· VAR····· Word
percent··· VAR····· Word
'
[noparse][[/noparse] EEPROM Data ]
'
[noparse][[/noparse] Initialization ]
Reset:
'
[noparse][[/noparse] Program Code ]
Main:
DO
· COUNT SpeedIn, 1000, Pulses
··· RPM = Pulses * 60
·· DEBUG ? rpm·· ,CLREOL
··· percent = rpm / 10
· DEBUG· ? percent ,CLREOL
· DEBUG HOME
LOOP
I have one magnet mounted on a spinning shaft.·
This Code·displays the rpm in base 60 increments.· In effect im only getting 60 rpm then 120 rpm then 180 etc.· I need all the little rpms in between.· Any suggestions?· I'm pretty sure that this is a math question.· I'm just not sure where to start.
Im building a throttle control.·· Much akin to a "cruise control"·on a car.· (Actually its is identical to an automotive Cruise control).··
Thanks for your help
·
Im attempting to get a real accurate RPM reading. (high resolution)·· Im using the Melexis 90217.· Im using this code.
'
[noparse][[/noparse] I/O Definitions ]
SpeedIn PIN 15
'
[noparse][[/noparse] Constants ]
·'
[noparse][[/noparse] Variables ]
Pulses···· VAR····· Word
RPM······· VAR····· Word
percent··· VAR····· Word
'
[noparse][[/noparse] EEPROM Data ]
'
[noparse][[/noparse] Initialization ]
Reset:
'
[noparse][[/noparse] Program Code ]
Main:
DO
· COUNT SpeedIn, 1000, Pulses
··· RPM = Pulses * 60
·· DEBUG ? rpm·· ,CLREOL
··· percent = rpm / 10
· DEBUG· ? percent ,CLREOL
· DEBUG HOME
LOOP
I have one magnet mounted on a spinning shaft.·
This Code·displays the rpm in base 60 increments.· In effect im only getting 60 rpm then 120 rpm then 180 etc.· I need all the little rpms in between.· Any suggestions?· I'm pretty sure that this is a math question.· I'm just not sure where to start.
Im building a throttle control.·· Much akin to a "cruise control"·on a car.· (Actually its is identical to an automotive Cruise control).··
Thanks for your help
·
Comments
Click Here for a < $10 solution
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Smile ... It increases your face value!
The PULSIN·command delivers better resolution but will require some math and a more complex algorithm. I will post some additional information tomorrow·that utilizes·the PULSIN command and some additional hardware.
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Craig Eid
www.TriadRD.com
thanks Craig
http://www.libelium.com/tienda/catalog/images/sensors/MLX90217.pdf
I ran some tests on Thursday·with a high sensitivity Melexis US2881 Hall effect sensor, priced at $1.88 -·http://search.digikey.com/scripts/DkSearch/dksus.dll?Detail&name=US2881EUA-ND - to simulate your single pole rotary slide-by application. The US2881 is a better solution for your application than the 90217, eliminating the unnecessary A/D converter, but·it does include an on-board Schmitt trigger to square-up the output signal.
I attached a small magnet to a CD, chucked it into a cordless drill and placed the drill a few inches away from the US2881. The US2881 reliably switched an LED on and off up to the 1400RPM limit of the drill. The datasheet for the US2881, a Hall sensor application note·and the schematic for this circuit are included as attachments.
·
I also ran an experiment testing the COUNT and PULSIN instructions at 10Hz (600 RPM) and at 100Hz (6000 RPM) with a BS2sx installed on a PDB. I used the (1Hz to 1KHz) pulse generator on the·PDB for the input signal to the BS2sx.
The data from the tests highlight the difference in sensitivity for the two instructions. The PULSIN instruction delivers a high number of pulse counts at low frequencies - your application - while the COUNT instruction delivers a high number of pulse counts at high frequencies.
The data for both instructions was consistent with the PULSIN instruction counting 63,315 pulses (592.3 RPM) on the 600 RPM signal and counting 6341 pulses (5913.9 RPM)·at 6000 RPM. The COUNT instruction yielded 10 counts (600 RPM) on the 600 RPM signal·and 98 counts (5880 RPM) at 6000 RPM.·I do not have an explanation for the behavior of your BS2p40.
Tracy Allen has posted code for double precision calculations -http://forums.parallax.com/showthread.php?p=785857·- that you can modify to deliver resolution of 1 RPM for your application.
·
I have also attached·a schematic for a voltage regulator we use in a vintage muscle car application that has a high noise floor and a·datasheet for the Microchip TC1185 LDO regulator -· http://search.digikey.com/scripts/DkSearch/dksus.dll?detail&name=TC11855.0VCT713CT-ND - rated at 150mA and priced at $0.62.·
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Craig Eid
www.TriadRD.com
Post Edited (Craig Eid) : 2/27/2009 8:21:36 AM GMT