Continuous PWM output...no time left in program for other functions.
s_ash
Posts: 2
in BASIC Stamp
Hi,
I am trying to use feedback from a digital tachometer to influence the speed of a motor with the Basic Stamp's PWM command.
The process is a 26" bicycle wheel being driven by windshield wiper motor, geared to a rotational speed of about 10 minimum - 60 maximum RPMs. The digital tachometer is Hall effect based, and proximity with a magnet fixed to the wheel provides a high to low to high pulse, every 1 - 6 seconds based on the RPM. (Signal is normally high). I fed the signal line from the tachometer to I/O pin 0.
I feel that the best way to measure the RPM is to measure the time between pulses in ms with a COUNT, or the total pulse width when the tachometer signal goes low using PULSEIN...then apply a divider and send that variable quantity to a PWM output.
I don't see how I can perform either of those strategies without pausing the PWM output for long enough to cause an interruption in the rotational speed of the wheel. I basically have the Basic Stamp dedicated to PWM, while I somehow need to find time for the feedback signal to influence the output.
I appreciate any ideas. I do have access to other stamps, I am just not sure if adding stamps is the best solution
Thanks
Scott
I am trying to use feedback from a digital tachometer to influence the speed of a motor with the Basic Stamp's PWM command.
The process is a 26" bicycle wheel being driven by windshield wiper motor, geared to a rotational speed of about 10 minimum - 60 maximum RPMs. The digital tachometer is Hall effect based, and proximity with a magnet fixed to the wheel provides a high to low to high pulse, every 1 - 6 seconds based on the RPM. (Signal is normally high). I fed the signal line from the tachometer to I/O pin 0.
I feel that the best way to measure the RPM is to measure the time between pulses in ms with a COUNT, or the total pulse width when the tachometer signal goes low using PULSEIN...then apply a divider and send that variable quantity to a PWM output.
I don't see how I can perform either of those strategies without pausing the PWM output for long enough to cause an interruption in the rotational speed of the wheel. I basically have the Basic Stamp dedicated to PWM, while I somehow need to find time for the feedback signal to influence the output.
I appreciate any ideas. I do have access to other stamps, I am just not sure if adding stamps is the best solution
Thanks
Scott
Comments
Your stamp is tied up too long waiting for the pulse counting to take place.
Two possibilities:
1. Watch the pulse input. While it is HIGH, jump to a loop that will update the PWM, then RETURN. Track how many times the PWM loop is called. When the pulse goes low, check how many times the PWM loop was called. Higher count means the speed is low.
2. Get more pulses per revolution. Something high enough so at speed, you can just watch COUNT for a very short time then update the PWM loop.
Tom Sisk
As with the built-in PWM, the speed variable is 0..255 (byte). There's an old BS1 app note called "Fun With Trains" that illustrates this technique.
https://www.parallax.com/sites/default/files/downloads/BS1-IC-BASIC_Stamp_1_AppNotes.pdf