Pages: [1]   Go Down
Author Topic: dual Magnetic sensors for RPM  (Read 333 times)
0 Members and 1 Guest are viewing this topic.
Offline Offline
Newbie
*
Karma: 0
Posts: 2
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Hi,

I have a platform consisting of 2 wheels that are being driven by these real large motors which are controlled by the Sabertooth motor driver, 25 Amps.

A line like "ST.motor(1, power);" controls the power to motor 1 and "ST.motor(2, power);" controls motor 2 for the Sabertooth motor driver

My values of power can run from 0 for stop to 30 for maximum speed (technically that speed number can go upto 128).

 

The Problem:

 The platform veers off to the left or right cause the motor speeds and other hardware like ball bearings etc are not perfectly matched.

My solution:
I slapped on 2 hall effect sensors one for each wheel hoping that if i could read the rpm of each wheel and found that they dont match i could control the power of the motor driving the faster/slower wheel, effectly making my platform go straight.

These sensors give me a logic 1 when a magnet attached to the wheel passes by it.


Also I need to have the motors go in one direction only.

Can anyone direct me how can i use the 2 interrupts of arduino to help me compute the speed of each wheel?



Thanks.

Ryan



Logged

Offline Offline
Full Member
***
Karma: 5
Posts: 181
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Check in the playground
http://playground.arduino.cc/Main/ReadingRPM
Logged

United Kingdom
Offline Offline
Tesla Member
***
Karma: 224
Posts: 6593
Hofstadter's Law: It always takes longer than you expect, even when you take into account Hofstadter's Law.
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

A more usual way of computing rpm is to use the ISR to generate an interrupt once per pulse only and to measure the interval between pulses in the ISR. This provides a more accurate, near-instantaneous rpm value (well, averaged over one wheel rotation anyway).

Ether way, you need to detect when rotation has stopped or nearly stopped.
Logged

Formal verification of safety-critical software, software development, and electronic design and prototyping. See http://www.eschertech.com. Please do not ask for unpaid help via PM, use the forum.

Pages: [1]   Go Up
Jump to: