Log in

View Full Version : DC to servo pulse converter



Agent36
- 11th December 2009, 15:38
I have a eflite blade MSR I would like to convert it from its coreless motors to brushless motors. I have all the hardware main and tail motors and two esc's here. What I need to do is convert the motor voltage into a servo pulse to control the brushless side. I can read a adc on a pic12f675 and convert it into a servo pulse in a crude form.

These are the settings for the ADC plus code;
DEFINE OSC 4
DEFINE ADC_BITS 10 'DEFINES RESOLUTION
DEFINE ADC_CLOCK 3 'DEFINES ACD CLOCK SPEED
DEFINE ADC_SAMPLEUS 50 'DEFINES SAMPLE TIME OF 50ms
ANSEL = %00001000 'TURNS ON A2D THREE

Main:

ANSEL = %00001000 'TURNS ON A2D THREE
ADCIN 3,pos 'READS A2D AND PUTS THE RESULT IN THE POS REG
pos = pos/8 '1024/8 = 128
pause 20
pulsout 2,72 + pos 'SERVO PULSE IS BETWEEN 0.72mS AND 2mS

goto main

Would the adc as configured be fast enough to read the fast changing tail motor voltage? If not what would the best way be to acheive this?

........thanks for your time

Acetronics2
- 13th December 2009, 09:22
Hi, Nick

If I Understand it well ...

you'd like to measure a PWM signal mean value ( Which period ??? good question ) to another PWM signal with a ~ 50 Hz period ...

may be @ first try you should place a lo pass filter before entering the ADC ???



BUT just note the PWM signal you swear to create ... already exists into your receiver ( see related forums where all those mods have already been explained ... hundreds times !!! )

Alain

Agent36
- 16th December 2009, 06:09
Hi Alain,
Thanks for your relpy, I understand about the low pass filter. I dont understand that the pwm signal I want is on the board. As far as I am aware the MSR receiver produces signals to drive a motor directly.
You refer to rc forums, do you mean "thesteve" converter? I am using this on one of my projects, but would like to write my own code for the pics I have here.

......Nick