Hi all,
I am using a Arduino sketch (the built-it <Stepper.h>)+ Arduino Uno R3 + Big Easy Driver (BED) to control a stepper motor. I connect Arduino DIGITAL(PWM~) pin 2 and pin 3, seperately to BED "STEP" and "DIR" pins, and everything works fine.
As a beginner, my understanding of what Uno does is it sends PWM to BED, am I understanding this correctly?
If I understand right, is there a way to measure the PWM signal?
I am thinking of calculating the angular position and speed directly from PWM. (I know a laser tachometer would do it, just exploring the possibilities of more accurate measurement)
Any suggestions? Thanks!
Best,
Sonia
What measure? It is ~488 Hz, with width controlled by the value used in analogWrite(pin, value) from 0 (full off) to 255 (full on).
488 is about 2mS period.
So a value of 1 would yield a high pulse of about 8uS wide, and low the remainder of the 2mS.
A value of 127 will yield about 1mS high, 1mS low.
A value of 254 wll yield a high level with a 8uS low pulse about every 2mS.
So that could likely be used to tell you the command speed of a regular motor.
A stepper, on the other hand, works differently, using Pulse Controlled Modulation (PCM), which involves different frequencies and timimg.
The Servo library handles that.
You should be able to determine the commanded position from the value you provide the servo library.
Perhaps you could use pulseIn() to determine the high & low widths of what is being sent to the servo to estimate how quickly it is moving to the commanded position.
Stepper, I am not sure how to describe how that operates. I believe the controller sends pulses to the stepper, and every pulse moves it along some number of degrees. Even less sure how you would monitor that - bring the pulses into an interrrupt and count them? Check the timing of when they come, when some time has passed with to pulses call it done?
CrossRoads:
Stepper, I am not sure how to describe how that operates. I believe the controller sends pulses to the stepper, and every pulse moves it along some number of degrees. Even less sure how you would monitor that - bring the pulses into an interrrupt and count them? Check the timing of when they come, when some time has passed with to pulses call it done?
Can I use oscilloscope to catch PWM?
Sure, its only 490 Hz, pretty slow.