Shop OBEX P1 Docs P2 Docs Learn Events
Help with RC pulse to analog — Parallax Forums

Help with RC pulse to analog

SteveW719SteveW719 Posts: 40
edited 2012-04-12 20:03 in Propeller 1
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

Comments

  • Duane DegnDuane Degn Posts: 10,588
    edited 2012-04-12 10:19
    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?
  • SteveW719SteveW719 Posts: 40
    edited 2012-04-12 10:53
    Thanks for pointing me in the right direction. I will need an analog 0-10vdc not a PWM signal.
  • JonnyMacJonnyMac Posts: 9,197
    edited 2012-04-12 13:52
    You can filter the PWM signal and buffer with an opamp.
  • AribaAriba Posts: 2,690
    edited 2012-04-12 20:03
    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:
    RC210V.gif


    Andy
    424 x 167 - 2K
Sign In or Register to comment.