Shop OBEX P1 Docs P2 Docs Learn Events
pulse width modulation + FREQOUT — Parallax Forums

pulse width modulation + FREQOUT

kingnebkingneb Posts: 65
edited 2005-09-14 17:33 in BASIC Stamp
I am trying to control the speed of·two motors at once with one BS2 module.· Will·this work with the freqout command?· If not how do·I do it?

Thanks·

Comments

  • Chris SavageChris Savage Parallax Engineering Posts: 14,406
    edited 2005-09-12 23:13
    Hello,

    ·· I've never heard of anyone trying to perform such a task.· Are you trying to control the motors directly off the I/O pins or are you using some sort of motor controller?

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Chris Savage
    Parallax Tech Support
    csavage@parallax.com
  • kingnebkingneb Posts: 65
    edited 2005-09-12 23:17
    The pins supply the pulses, a mosfet amplifies the pulses and controls the motor.
  • Chris SavageChris Savage Parallax Engineering Posts: 14,406
    edited 2005-09-12 23:24
    I guess you could try the FREQOUT command.· The recommended solution is the PWMPAL, available on our website under Accessories, Motor Control.· We also have Motor Controllers listed that have the PWM generation and driver circuitry all-inclusive.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Chris Savage
    Parallax Tech Support
    csavage@parallax.com
  • NewzedNewzed Posts: 2,503
    edited 2005-09-12 23:25
    You can pulsout two frequencies with FREQOUT.· If you had a notch filter on the input to the mosfets that would only pass one of the two frequencies, then you could control two motors almost simultaneously.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Sid Weaver
    Do you have a Stamp Tester yet?
    http://hometown.aol.com/newzed/index.html

    ·
  • kingnebkingneb Posts: 65
    edited 2005-09-12 23:34
    OK, those motor controllers are too expensive.· Can you send two frequencies on two different pins (or something similar) at once·to each mosfet?·
  • Chris SavageChris Savage Parallax Engineering Posts: 14,406
    edited 2005-09-12 23:36
    No, each FREQOUT command takes a finite time to complete before the other pin could be activated.· Too brief a pulse and it won't do anything.



    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Chris Savage
    Parallax Tech Support
    csavage@parallax.com
  • kingnebkingneb Posts: 65
    edited 2005-09-12 23:39
    What can I do then? What is a notch filter?
  • NewzedNewzed Posts: 2,503
    edited 2005-09-13 00:09
    A notch filter is a combination of inductance and capacitance designed to pass a particular frequency.· Google for notch filters.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Sid Weaver
    Do you have a Stamp Tester yet?
    http://hometown.aol.com/newzed/index.html

    ·
  • NewzedNewzed Posts: 2,503
    edited 2005-09-13 00:16
    There is also a low pass filter, which passes only frequencies below a certain frequency, and high pass filter, which only pass frequencies above a certain frequency.· These might be easier to build, if you choose widely separated frequencies such as 500 and 2500.· Radio Shack probably has all the parts you need.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Sid Weaver
    Do you have a Stamp Tester yet?
    http://hometown.aol.com/newzed/index.html

    ·
  • kingnebkingneb Posts: 65
    edited 2005-09-13 00:23
    I modulate the pulses by pulsing one of the pins on the BS2. I could use 555 timer to generate the pulses and the BS2 to select the duty cycle. 555 timers are dirt cheap. What would be a good circuit to do this?
  • allanlane5allanlane5 Posts: 3,815
    edited 2005-09-13 13:10
    The BS2 is a single-tasking processor.· It cannot do PWM on two pins, unless you do as in the attached.

    The approach I've taken is to not use the "PWM" command.· Instead, you use the main loop of your program to update each pin.· You can change the duty cycle by making "Low1" and "High1" different values.

    Now, the fastest speed of the pulses may be low -- 500 uSec high and low.· You can put in a 'PAUSE' command to change the pulses by 1 mSec.· But I think this is the best the BS2 can do, if you're trying to drive multiple pins.


    Post Edited (allanlane5) : 9/13/2005 1:09:45 PM GMT
  • japerjaper Posts: 105
    edited 2005-09-14 01:27
    hello

    can somebody tell me how the translate this into a freq

    for x = 1 to 300 'time, personal pref.
    high fan
    pause 5
    low fan
    pause 22

    this will set a low volt fan at approx 25 %

    for x = 1 to 200
    high fan
    pause 25
    low fan
    pause 4

    this will run a low volt fan at approx. 75 %

    japer
  • allanlane5allanlane5 Posts: 3,815
    edited 2005-09-14 15:13
    A signal which is high for 5 mSec, and low for 22 mSec, has a period of 27 mSec, and a duty cycle of 5/22 == 22%.
    A period of 22 mSec is a frequency of 1/22 mSec == 45 Hz.

    Now, I don't know what the duty cycle of 'FREQOUT' is.

    And I hope you're driving that fan through a transistor or Darlington or some other 'high current' device. Driving it directly from a BS2 pin could damage the pin (if you're pulling more than 25 mA).
  • japerjaper Posts: 105
    edited 2005-09-14 17:33
    yes
    i used the transistor that came with what is a microcontroller
    with a diode to prevent backfeeding problems


    thanks for helping me with the math on this one

    japer
Sign In or Register to comment.