go_away

Author Topic: Variable frequency on Axon  (Read 1110 times)

0 Members and 1 Guest are viewing this topic.

Offline Cristi_NeaguTopic starter

  • Robot Overlord
  • ****
  • Posts: 165
  • Helpful? 5
Variable frequency on Axon
« 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.

Offline Webbot

  • Expert Roboticist
  • Supreme Robot
  • *****
  • Posts: 2,132
  • Helpful? 109
Re: Variable frequency on Axon
« Reply #1 on: February 23, 2010, 04:23:03 PM »
Yes - 'its easy to code'
Webbot Home: http://webbot.org.uk/
WebbotLib online docs: http://webbot.org.uk/WebbotLibDocs
If your in the neighbourhood: http://www.hovinghamspa.co.uk

Offline Ro-Bot-X

  • Contest Winner
  • Supreme Robot
  • ****
  • Posts: 1,431
  • Helpful? 25
  • Store: RoBotXDesigns.ca
Re: Variable frequency on Axon
« Reply #2 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.
Check out the uBotino robot controller!

Offline chelmi

  • Supreme Robot
  • *****
  • Posts: 496
  • Helpful? 15
Re: Variable frequency on Axon
« Reply #3 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 ?

Offline Admin

  • Administrator
  • Supreme Robot
  • *****
  • Posts: 11,658
  • Helpful? 169
    • Society of Robots
Re: Variable frequency on Axon
« Reply #4 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.

Offline Cristi_NeaguTopic starter

  • Robot Overlord
  • ****
  • Posts: 165
  • Helpful? 5
Re: Variable frequency on Axon
« Reply #5 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 ) 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.

Offline Admin

  • Administrator
  • Supreme Robot
  • *****
  • Posts: 11,658
  • Helpful? 169
    • Society of Robots
Re: Variable frequency on Axon
« Reply #6 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.

 


Get Your Ad Here

data_list