Society of Robots - Robot Forum

Electronics => Electronics => Topic started by: kl22 on May 10, 2011, 11:09:28 PM

Title: PPM for Motor Controller
Post by: kl22 on May 10, 2011, 11:09:28 PM
Hi,

Can anyone help me find some code to control a RC Motor Controller (Mamba Monster). I tried using just normal PWM but it doesn't work correctly. I did some research and it seems that I need to drive it using PPM, and I have no idea how to set it up. Doesn't seem like Webbotlib or Arduino's lib does this.

Please post PPM code for either an arduino or an Axon if you have.

Thanks in advance!
Title: Re: PPM for Motor Controller
Post by: rbtying on May 10, 2011, 11:39:45 PM
Drive it like a servo: see here (http://"http://webbot.org.uk/WebbotLibDocs/27190.html") for webbotlib.

And here (http://"http://www.arduino.cc/en/Reference/Servo") for Arduino.
Title: Re: PPM for Motor Controller
Post by: kl22 on May 11, 2011, 12:36:54 AM
Hi rbtying,

I've tried but no luck. I can get it to run through the calibration using Axon and Arduino.

This is what I do, the motor controller I have requires this for calibration:

1. Leave controller off, full throttle and turn on controller
2. After it acknowledges full throttle, it wants full brake (assuming that full reverse)
3. After it acknowledges full brake, it wants neutral

So this is what I did in terms of both Arduino and Axon (in axon terms):

Set PWM to 180(Arduino)/DRIVE_SPEED_MIN (Axon, for some reason it is backwards for RC Controller applications), turned on the controller, waited for it to acknowledge
Then sent PWM of 0 (Arduino)/DRIVE_SPEED_MAX, waited for acknowledgement
Then sent PWM of 90(Arduino)/DRIVE_SPEED_CENTER, waited for acknowledgement

And it calibrated and works.

After this if I send a different speed other than DRIVE_SPEED_CENTER, the motor just twitches back and forth. I tested both codes on a servo and it works fine on the servo.

I'll post the code soon.
Title: Re: PPM for Motor Controller
Post by: rbtying on May 11, 2011, 12:48:59 AM
Have you tried gradually increasing the PWM value, instead of making discontinuous jumps?  I had an ESC once that would autodetect discontinuity and disregard the command, as a failsafe (RC controller sticks are analog and are pretty  much guaranteed to be continuous).
Title: Re: PPM for Motor Controller
Post by: kl22 on May 11, 2011, 01:15:24 AM
Hey rbtying,

Nevermind. My dumb mistake! You were right along! It works perfectly!

I bought a Motor Controller that supports both brushed and brushless and didn't realize that I needed to configure it :D.

Works perfect! Thanks for the help rbyting! (BTW i only new to PWM because u told me so in my other post).