using multiple frequencies to control a stepper motor.
bbrien
Posts: 561
I have a functioning program that controls two DC geared motors with PWM. I am using a UDN2993 motor controller. I am building a new program which controls also two motors, one DC geared motor and one geared stepper motor. the stepper motor is controlled by a MC3479 motor controller. It uses a enable line which uses a PWM at 50% duty cycle and a phase line(0, or 5 volts) which sets direction.
Comments
bbrien
1. Why do you want to change from the existing setup? What problem(s) are you seeking to fix?
2. What I would like to do is replace the RA motor and function lines to use the stepper motor which uses adjusted frequency to set the speeds of the RA motors Do you mean a stepper will be moving the telescope via a gearbox instead of a DC motor or something more complicated?
3. Are you the programmer or has the program been written for you?
Whether you need more than one cog probably depends on whether one cog is likely to run out of time to do all the task or that too much jitter in control is occurring due to 'multi-tasking'. On some programs, it's possible to measure cog spare-time using the system clock-cycle counter.
I bought a job lot of small worm-wheel gearboxes off ebay. One of them has a ratio of 2304:1 which may be of interest.
Cheers, Bob SW U.K.
So to use a stepper motor for this application you need to know how many steps to generate to get the movement you need.
Look at this project to see three stepper motors in action. They control the X, Y, and Z access of the robot based on the angle that is needed to place the arm in the correct position. SCARA Robot.
Mike
So you would control the stepper directly by sending 1's and 0's to the propeller pins that connect to the stepper controller or even just via power transistors. This means you know exactly how many steps you've sent and thus control the rate of turn exactly. Once tuned so that star field drift is minimised, then it should always maintain that performance - IF that's your problem at the moment.
Your project caught my eye because I like to program the propeller in tachyon forth. You'll probably know that forth was (is?) very popular for big telescope control. I'm not suggesting switching languages, though - stick with what you're most familiar!
-Phil
thanks
Is that stuff reliable, Bob?
I need some 18200 devices which are $13 whereas I can get complete motor control modules for $5 😮
I tried what you suggested and I get an error " expected an expression term" at PWM1_FREQ.
You have to first figure out what controller you're going to use to control the stepper motor. You then either need to write a method, or find one in the OBEX, that interfaces with the controller you selected. Your call to motor.start should only use one of the channels, since only one of your motors will be controlled by pulse-width modulation. You should pass values of -1 for the channel you are not using.
By convention, an object normally has a method called start that is used to initialize the object. The top object calls the start method using the syntax objectname.start(...). As with all methods, the calling arguments must match the parameters that are define when the method is declared in the object. The compiler will issue an error if the number of parameters don't match. You should look at the start method in the object to see what the parameters are.
If an object requires starting a new cog it must be done within that object. When you start a new Spin cog you need to provide a pointer to the stack. In the case of the PWM object that you are using, the PWM object provides the stack. The top object does not provide the stack. If you need more than one instance of the PWM object you would declare it twice in the OBJ section using two unique names. Alternatively, you could define it with one name, but as an array of two objects.
However, ....................................... You do not need two PWM objects. The one you are using support two PWM outputs. But,.......... you only need to use one of the PWM outputs. The other motor is a stepper motor, so it needs a different way to control it. That different way is not PWM. I have no experience with stepper motors, but I'll study the devices you listed to see if I can help you. Maybe somebody else has some code they can provide to control the stepper motor.
What I need is PWM on one counter and a freq. pulse on the other(square wave train with 50% duty cycle)
post # 2020-11-30 18:18:49 See also SMD1 page 13 "External clock input"