Society of Robots - Robot Forum

Software => Software => Topic started by: Tomas on January 13, 2009, 04:15:21 AM

Title: How to make PWM signals out of Axon?
Post by: Tomas on January 13, 2009, 04:15:21 AM
Me and some pals are doing a project on hooking a RC car up to the axon.
We measured the following signals (check out the pictures) going from our AM reciever to our motor controller, and we want to replicate them with the Axon. Any idea what code to use? We have no experience with coding with the axon, we're still waiting for it (but we're on a tight schedule so we wan't to prepare as much as we can before we get it).

The picture shows the signal in to the motor controller when the DC-motor is idle.
In short: Get the Axon to produse a signal that is 4V with the period being 15 ms , F = 1/T = 66,67Hz.  And the pulse width is 1,5 ms

Thanks

(http://www.skjermskudd.com/out.php/t2868_iro.JPG) (http://www.skjermskudd.com/out.php/i2868_iro.JPG)
(http://www.skjermskudd.com/out.php/t2867_Utennavn.JPG) (http://www.skjermskudd.com/out.php/i2867_Utennavn.JPG)
Title: Re: How to make PWM signals out of Axon?
Post by: izua on January 13, 2009, 07:38:04 AM
Check how to generate servo control signals. Those are RC servo signals.
Title: Re: How to make PWM signals out of Axon?
Post by: Tomas on January 13, 2009, 07:56:36 AM
Are you saying this isnt PWM?
We measured the signals to the servo to and these are exactly the same as the signals to motor controller.
Title: Re: How to make PWM signals out of Axon?
Post by: izua on January 13, 2009, 11:27:55 AM
No, I'm saying that a toy RC car uses RC servos (extremely common). RC servos use servo signals (which are a kind of pwm, but only covers a small range of duty cycles).

If you want to know how to generate pwm signals out of the axon, that can be applied and used with your car, you need to generate a specific type of PWM signals: RC servo signals. You can then feed those signals to your car's actuators (motor, steering) from the axon, as if they were coming from the receiver.
Title: Re: How to make PWM signals out of Axon?
Post by: airman00 on January 13, 2009, 11:45:08 AM
No, I'm saying that a toy RC car uses RC servos (extremely common).
By RC car he means hobby grade RC cars and not those cheap 20 dollar ones you find in toy stores
Title: Re: How to make PWM signals out of Axon?
Post by: Tomas on January 13, 2009, 12:35:43 PM
Yes this is a hobby grade RC car :) I was just wondering if anyone could give us some clues where to start for programming this into the axon without using much resources? I don't understand the different PWM guides that is on this site.
Title: Re: How to make PWM signals out of Axon?
Post by: dunk on January 13, 2009, 12:50:01 PM
there are 2 approaches to controlling servos on AVRs.

the first involves controlling the pulses in software.
this can be a pain because you need an exact pulse length every 50ms.
working the rest of your code in between the pulses without altering the timing can take a bit of patience but does have the advantage that you can control as many servos as you can write the code for.

the other (simpler) method is described in this article: http://members.shaw.ca/climber/avrtimers.html (http://members.shaw.ca/climber/avrtimers.html)
read the whole article but pay particular attention to the " Servo control with timer1" section.
this method generates the pulses in one of the AVRs timer hardware modules so you can just set the position and don't need program anything else.
the disadvantage of this method is you are limited to the number of timer compare pins associated with 16bit timers.
some AVRs have 2 of these pins per timer, some have 3. some AVRs have multiple 16bit timers with several compare pins on each.
i don't know how many the AVR on the Axon has. you will need to check.


dunk.
Title: Re: How to make PWM signals out of Axon?
Post by: mbateman on January 13, 2009, 04:01:25 PM
I have code for driving R/C servos using hardware PWM from the Axon.

You can find it here: http://www.laughingsky.com/hobbies/robotics/pages/axon_modules/pwm/index.html (http://www.laughingsky.com/hobbies/robotics/pages/axon_modules/pwm/index.html)
Title: Re: How to make PWM signals out of Axon?
Post by: airman00 on January 13, 2009, 04:02:57 PM
I have code for driving R/C servos using hardware PWM from the Axon.

You can find it here: http://www.laughingsky.com/hobbies/robotics/pages/axon_modules/pwm/index.html (http://www.laughingsky.com/hobbies/robotics/pages/axon_modules/pwm/index.html)
I would suggest going with hardware PWM because it works in the background
Title: Re: How to make PWM signals out of Axon?
Post by: Admin on January 14, 2009, 07:29:20 AM
The suggestions above are fine.

Another method:
http://www.societyofrobots.com/axon/axon_function_list.shtml#hardware_defines

Vary the cycles number to change the signal.