Shop OBEX P1 Docs P2 Docs Learn Events
high resolution RPM code needed — Parallax Forums

high resolution RPM code needed

technoobtechnoob Posts: 21
edited 2009-02-27 06:50 in BASIC Stamp
· 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


·

Comments

  • PJAllenPJAllen Banned Posts: 5,065
    edited 2009-02-23 02:37
    Increase the number of magnets: more magnets, more pulses.
  • MrBi11MrBi11 Posts: 117
    edited 2009-02-23 02:40
    why not use an encoder so you can get more than one pulse per revolution

    Click Here for a < $10 solution

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Smile ... It increases your face value!
  • Craig EidCraig Eid Posts: 106
    edited 2009-02-23 08:00
    The Duration variable in your program, if you are using a BS2,·translates to 1 second on a BS2 and·limits your·resolution to an integer number of counts per second and a resolution of 60 counts per minute (60 RPM translates to 1 revolution counted per second, 120 RPM = 2 per second, 180 = 3, etc). You·need to decrease the Duration variable to increase the resolution.

    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
  • technoobtechnoob Posts: 21
    edited 2009-02-23 08:34
    Im using a BS2p40 for this project.· I have some Dallas One wire and I2C· applications for this project.



    thanks Craig
  • LilDiLilDi Posts: 229
    edited 2009-02-23 18:46
    The Melexis 90217 is not really designed to funtion in this manner, however it may still work the way you are using it. Haven't really tried it your way. What I mean is the 90217 is designed to have a small permanent magnet attached to the back of the sensor, south pole facing the sensor. The sensor will then sense metal objects, like metal gear teeth passing the sensor. There are other models of hall sensors that are designed to work the way you have it set up.

    http://www.libelium.com/tienda/catalog/images/sensors/MLX90217.pdf
  • Craig EidCraig Eid Posts: 106
    edited 2009-02-27 06:50
    Sorry for the delay in posting the information - the shipment from Digikey arrived late Thursday morning.

    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
Sign In or Register to comment.