Society of Robots - Robot Forum

Software => Software => Topic started by: Cristi_Neagu on February 23, 2010, 03:03:21 PM

Title: Variable frequency on Axon
Post by: Cristi_Neagu on February 23, 2010, 03:03:21 PM
Hello.

I am trying to build a articulated arm robot for a school project. I am planning to use steppers to move the whole thing, controlled by L297 drivers. As you may or may not know, those need an external clock source. I also know that the Axon has 6 hardware timers. What i want to know is if i can use those timers to output a clock frequency that varies according to a preset rule (say... a sinusoidal pattern of sorts). Also note that i can't use a PWM type signal as used for servos, because for PWM you vary the duty cycle, not the frequency of the signal. Also... The signal is square wave as usual. The L298 uses the rising edge of the signal for stepping.

I am not asking for the code to do such a thing. If it's easy to code, i can probably do it myself, if it's not then i don't want anyone to wrack their mind over it for me :) And, besides, I'm still in the "choosing the parts" stage.

Thanks for the help.
Title: Re: Variable frequency on Axon
Post by: Webbot on February 23, 2010, 04:23:03 PM
Yes - 'its easy to code'
Title: Re: Variable frequency on Axon
Post by: Ro-Bot-X on February 23, 2010, 05:42:24 PM
Bun venit pe forum, Cristi!

You need a (50% duty cycle) square wave signal with adjustable frequency. Faster pulse rate will make the stepper spin faster. If you are using a 16 bit Timer, you can set the OCRx register to 50% and change the ICRx register to adjust the frequency. I'm not sure how you will issue a specific number of pulses so the motor stops where it is supposed to. Perhaps you will need an external encoder and just stop the timer when the stepper gets to the expected position.
Title: Re: Variable frequency on Axon
Post by: chelmi on February 24, 2010, 09:37:38 AM
Bun venit pe forum, Cristi!

You need a (50% duty cycle) square wave signal with adjustable frequency. Faster pulse rate will make the stepper spin faster. If you are using a 16 bit Timer, you can set the OCRx register to 50% and change the ICRx register to adjust the frequency. I'm not sure how you will issue a specific number of pulses so the motor stops where it is supposed to. Perhaps you will need an external encoder and just stop the timer when the stepper gets to the expected position.


use the overflow interrupt handler to count the number of pulse ?
Title: Re: Variable frequency on Axon
Post by: Admin on February 24, 2010, 10:22:35 AM
Just use the PWM feature as in the manual. You'll also find an example of using PWM with the Axon in the example programs.
Title: Re: Variable frequency on Axon
Post by: Cristi_Neagu on February 24, 2010, 02:47:23 PM
Thanks for the replies.
So, after taking your advice in, i looked a bit more thorough through the SOR site. I indeed found info about how to set the frequency of the timers. What i didn't find was the Axon documentation. Is there a specific document, or is this ( http://www.societyofrobots.com/axon/#documentation (http://www.societyofrobots.com/axon/#documentation) ) it?

Also, on a slightly different note: can i have different procedures and functions in the Axon.c file? Because as you can imagine, to compute the movement of a articulated arm robot isn't a walk in the park, so having functions and procedures will help things out. And, yes, i know i might be asking a little too much of a 16MHz processor, but for my needs, it'll be ok.

Thanks again for the replies.
Title: Re: Variable frequency on Axon
Post by: Admin on February 24, 2010, 08:33:23 PM
Just look at the Axon II instructions to use WebbotLib. The original Axon can use WebbotLib, no problem.

Also look at my ERP robot for arm movement control, which is entirely open sourced.