Shop OBEX P1 Docs P2 Docs Learn Events
Need real PWM — Parallax Forums

Need real PWM

PCB4UPCB4U Posts: 14
edited 2004-10-24 21:06 in BASIC Stamp
Hi Folks,

I want to use a STAMP to do the following:

1. Use 2 inputs to count pulses (optical encoders) from 2 motors (master, slave). The master is free running, the slave to be controlled by PWM techniques.
2. Find the differences in counts between the 2 inputs
3. Determine which input was greater than the other
4. Using magnitude of item 2· and the results of item 3,·determine correction factor
5. Output a true·PWM stream to·drive the slave motor (via a MOSFET) that is either running·too slow or too fast so that·the slave·will be·at same RPM as master

Is it possible??

Thanks for any help

Jay

Comments

  • BeanBean Posts: 8,129
    edited 2004-10-24 16:36
    Sounds like a classic PID exersise.

    I would look at the parallax "industrial control" course.

    You can download the book for free. Just search for industrial control.

    It uses a heater to keep a constant temperature, but it's the same idea. When the temperature goes down the stamp will give the heater more power. When the slave is too slow the PWM increases.
  • PCB4UPCB4U Posts: 14
    edited 2004-10-24 19:48
    Thanks for the link.

    The 2 motors will be adjusted once at turn on, each time the device is turned on. This will "calibrate" the 2 motors. They do not have to remain "synced" thereafter as the resultant error will be very small at this point. I am assuming that the "calibrating" of the free spinning motors, once matched at no load, will be pretty well matched under very similiar loads for each motor.

    I think I may have to do the following.

    1) Measure the differnetial pulse count of the master and the slave
    2) Conver that to drive the slave factor via a lookup table or formula (can the STAMP have a lookup table due to internal limitations?)
    3) Output the factor digitally, paralllel, into a D/A
    4) The D/A ouput will drive a DC voltage to PWM circuit using a DG3525 chip which will drive the slave motor as required
  • AlWilliamsAWCAlWilliamsAWC Posts: 135
    edited 2004-10-24 19:52
    If you really need to count two streams at once, consider a PAK-VII (http://www.awce.com/pak7.htm). By "real" PWM do you mean continuous or having a fixed frequency? The PAK-V and PAK-VIII both can do these, although in many cases, the Stamp's PWM is fine if you don't need it to run all the time or a fixed frequency. The PAKs run multiple channels at the same time.

    Regards,

    Al Williams
    AWC
    http://www.awce.com
    ·
  • BeanBean Posts: 8,129
    edited 2004-10-24 20:04
    So in use the motors are locked together ?

    I wouldn't be so sure about the speed staying matched under load...

    I would measure the average current going to each motor and try to keep that equal while in use.

    If one motor is trying to go faster it will draw more current as it "pulls" the other motor along.

    Terry
  • PCB4UPCB4U Posts: 14
    edited 2004-10-24 20:55
    The motors are not physically hooked up together...2 independent motors. I just need to get their RPMs real close
  • PCB4UPCB4U Posts: 14
    edited 2004-10-24 21:06
    AWC...thanks for the input.

    The PAKs sound interesting.

    I need to look at 2 sets of pulses coming off 2 encoder wheels, compare the two and adjust the slave to match the master which remains fixed at whatever native RPM its at.

    The differnetial·should be PWM as this would ease the hardware requirements. As I think about it more, the·2 motors should be constantly be updated to keep them best synced as possible. I don't think monitoring current will guarantee syncing as each motor would have to be identically·constructed....and I'm sure gear head motors from afar aren't!!!

    So in the end, I need a chip that can do a differenttial pulse count (via hardware or software) and will generate a PWM as a function of the differential. I don't know the microcontroller world very well.

    Thanks again
    ·
Sign In or Register to comment.