View Full Version : Unsolved Help with RC pulse to analog
04-12-2012, 06:02 PM
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.
04-12-2012, 06:19 PM
The posts in this thread might help.
Could your analog output be in the form of PWM?
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.
04-12-2012, 09:52 PM
You can filter the PWM signal and buffer with an opamp.
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:
_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
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: