Society of Robots - Robot Forum

Software => Software => Topic started by: hendrachubby on February 09, 2009, 04:51:18 PM

Title: Controlling DC Motor
Post by: hendrachubby on February 09, 2009, 04:51:18 PM
Anybody can help me to program axon MCU for controlling DC motor with 3 phase encoder attached, so the motor can rotate with specific angle..?
Title: Re: Controlling DC Motor
Post by: Admin on February 09, 2009, 09:33:54 PM
What motor driver are you using? Which encoder?

Don't forget that the datasheet of the motor driver will tell you exactly what to do to control a motor :P

Oh and you'll need to use hardware interrupts if you use an encoder.

(we can't help you without more info)
Title: Re: Controlling DC Motor
Post by: hendrachubby on February 10, 2009, 10:30:51 AM
I'm using pololu Pololu High Current Motor Driver Board 9A 6V-36V and for the motor I use sanyo denki 24 volt DC servo motor with quadrature encoder attached on it, i read the spec for the encoder it says the voltage for the encoder is 5 volt. I able to control the motor with PWM but still not use the encoder. The encoder has 3 phase, a b z, i don't know which port of the axon can receive this pulse and how to code it so i can get the motor move with a specific angle.
 :(
Title: Re: Controlling DC Motor
Post by: Admin on February 10, 2009, 08:24:49 PM
You'll need to use the hardware interrupts to count encoder pulses. Also, google up on how to use an encoder and PID loops. Lastely, look at AVRlib, it has quadrature encoder source code already written for you.

You'd have to link us to a datasheet on the encoder, otherwise I'm just guessing how it works.

pins E4 to E7 all have hardware interrupts on the Axon:
http://www.societyofrobots.com/axon/images/640pinout.gif
(several other pins also have hardware interrupts)