PDA

View Full Version : Unsolved Help with RC pulse to analog



SteveW719
04-12-2012, 06:02 PM
HI,

I am wondering if anyone is familiar with a propellor object to measure the servo control pulse width out of an rc receiver (usually 1000 to 2000 msec) and convert it to a 0-10v or 4-20ma loop for use with some industrial type drives. Also if there is a Prop board available with analog output onboard.

Many thanks

S

Duane Degn
04-12-2012, 06:19 PM
The posts in this thread might help.

http://forums.parallax.com/showthread.php?139341-trying-to-tie-an-r-c-receiver-output-to-pwm-motor-control

Could your analog output be in the form of PWM?

SteveW719
04-12-2012, 06:53 PM
Thanks for pointing me in the right direction. I will need an analog 0-10vdc not a PWM signal.

JonnyMac
04-12-2012, 09:52 PM
You can filter the PWM signal and buffer with an opamp.

Ariba
04-13-2012, 04:03 AM
With the help of the Propeller counters you can do that without objects and with only a few code lines:

CON
_clkmode = xtal1 + pll16x
_xinfreq = 5_000_000

INPIN = 0 '<-- pin numbers
OUTPIN = 1

PUB Main : puls
ctra := %01000<<26 + INPIN 'POS detect mode for pulse in
ctrb := %00110<<26 + OUTPIN 'DUTY mode for Analog out
frqa := 1
dira |= 1<<OUTPIN
repeat
phsa := 0
repeat until phsa > 0 'wait for high pulse
waitcnt(clkfreq/500 + cnt) 'wait 2ms to get entire pulse
puls := phsa 'pulslength in clock ticks
puls -= clkfreq/1000 'subtract 1ms
puls := puls * 4095 / (clkfreq/1000) 'scale 1ms to 0..4095
frqb := puls << 20 'scale to DUTY range (32bits)
'you get 0..3.3V output at OUTPIN
'add an R-C lowpass with ~10Hz cutoff
'and then an OPAMP with a gain of 3 to get 0..10V

This is absolutely untested!
For a first test you can measure the voltage at the OUTPIN with a Multimeter you should get 0..3.3V for 1ms..2ms pulses.
To get a 10V output you need a filter and an OPAMP. Here is a possible circuit:
91648

Andy