Shop OBEX P1 Docs P2 Docs Learn Events
closed loop motor control circuit — Parallax Forums

closed loop motor control circuit

i is himi is him Posts: 7
edited 2007-03-20 15:40 in BASIC Stamp
Hello.

Ive got to design a new closed loop motor control curcuit for my welder.

What i want to do is calculate motor speed from the frequency a beam of light is broken in order to generate a RPM figure.

Im new to stamp programming and im having trouble changing the input frequency to an rpm figure

Could anyone help me by just giving me some sudo code to work with.

Thanks

Dan

[noparse]/noparse][i]Subject Edited By Moderator[/i

Post Edited By Moderator (Chris Savage (Parallax)) : 3/19/2007 7:19:26 PM GMT

Comments

  • Mike GreenMike Green Posts: 23,101
    edited 2007-03-18 20:18
    You'll have to supply some information about your sensor. The big question is "how many interruptions of the light per revolution".
    Say you have 100 marks around a wheel and each mark causes an interruption. You've got a frequency of 100 per revolution. If
    your frequency is given in interruptions per second, you need to multiply by 60 to get interruptions per minute. If you divide that
    by 100 interruptions per revolution, you'd get a result in revolutions per minute. So you have a simple formula:
    RPM = <frequency> * 60 / <pulses per revolution>
  • i is himi is him Posts: 7
    edited 2007-03-18 20:43
    im planning on having 6 marks.


    I understand the mathmatics behind calculating rpm etc.

    My problem is from memory (ive only done one stamp project before and it was on a bs1 and it was over a year ago) that the bs2 has no sense of real time.


    i.e. i dont think i can simply tell it to count the number of pulses in a second as it does not how long a second is (please correct me if im wrong).

    Thanks

    Dan
  • Mike GreenMike Green Posts: 23,101
    edited 2007-03-18 21:39
    You don't need to calculate the number of pulses in a second. All you need is pulses per revolution. Look, work out the formula in units ...
    revolutions / minute = (pulses / second) * (seconds / minute) / (pulses / revolution)

    The "seconds / minute" is 60. In your system, the "pulses / revolution" is 6. The formula becomes
    revolutions / minute (RPM) = pulses / second (frequency) * 60 / 6, in other words: RPM = Frequency * 10
  • LSBLSB Posts: 175
    edited 2007-03-18 23:03
    Or, you could include a real time clock in your project. Many interface easily and provide accurate second, minute, hour, etcetera info. I beleive I've seen some that toggle one pin to produce a square wave of known frequency.
  • UnsoundcodeUnsoundcode Posts: 1,532
    edited 2007-03-18 23:29
    Hi Dan, the BS2 has a very accurate sense of time. The·COUNT function is able to acurately measure the frequency of a square wave. A limiting factor might be your desired speed as the BS2 caps out at 120KHz. If that is not fast enough you could look at reducing the number of marks or using the BS2p which has a top count frequency 416.7KHz.

    Jeff T.
  • Skywalker49Skywalker49 Posts: 172
    edited 2007-03-20 15:40
    Mike, in order to measure frequency,·one need to measure time between pulse
    otherwise there is no reference to real time.
    Have a good day.
    Mike Green said...
    You don't need to calculate the number of pulses in a second. All you need is pulses per revolution. Look, work out the formula in units ...
    revolutions / minute = (pulses / second) * (seconds / minute) / (pulses / revolution)

    The "seconds / minute" is 60. In your system, the "pulses / revolution" is 6. The formula becomes
    revolutions / minute (RPM) = pulses / second (frequency) * 60 / 6, in other words: RPM = Frequency * 10
Sign In or Register to comment.