Home     Forum     Projects     Experiments     Circuits     Theory     BLOG     PIC Tutorials     Time for Science

### Author Topic: RC PWM conversion  (Read 5154 times)

0 Members and 1 Guest are viewing this topic.

#### marquee

• Newbie
• Posts: 8
##### RC PWM conversion
« on: June 06, 2014, 12:42:29 PM »
Hi guys! I want to convert the rc pwm signal from a rc receiver into a DC voltage. How can I achieve this with analog circuits? I don't want to make this conversion with a μC because I don't know programmig.  The output DC voltage from that circuit will be used as a DC input level voltage in a pwm generator.

#### kam

• Hero Member
• Posts: 1849
##### Re: RC PWM conversion
« Reply #1 on: June 06, 2014, 18:14:41 PM »
Hello,
you wanna make a low pass filter like this one:
http://www.pcbheaven.com/circuitpages/PWM_LCD_Contrast_Control/

The R-C values are to be determined by you. Test them.

#### marquee

• Newbie
• Posts: 8
##### Re: RC PWM conversion
« Reply #2 on: June 07, 2014, 00:39:38 AM »
Hello! I tested the low pass filter in multisim and I got good results. I know that the rc receiver generates in neutral condition a square pulse which has width 1,5ms and when the transmitter?s joystick reach the two opposite limits (front/reverse)  then the pulse width becomes 2 - 1ms with T (20-30ms) I am not sure for T.   I want to exploit the area between 1,5 ? 2ms to create the pwm range 0-100% for  the front motion of a PMDC motor . Also I want to exploit the area between 1,5-1ms in order to achieve  0-50% pwm (reverse motion) with the help of a bypass relay which will be activated in a exact position of the joystick (between 1-1,5).

As you can see in  picture  1 ,  the three main positions of the receiver?s signals has been represented as three different pulse signal sources . The picture 2  shows the three signals on the oscilloscope screen. The blue vertical line that intersects the three signals in this position gives for signals 1,2,3 these voltages : 257mV   , 192mV  , 127mV.

   I want to hold the values of these voltages constant, pure DC (and the values between these main voltages) so I have to install a smoothing capacitor in parallel in the output in order to cut the waves. Right?

   I suppose that I have to amplify these voltages in order to be manageable for the pwm generator which I want to create?

Thank you!

#### kam

• Hero Member
• Posts: 1849
##### Re: RC PWM conversion
« Reply #3 on: June 07, 2014, 23:53:36 PM »
yes you need a capacitor but first you need to amplify/interface otherwise you "disrupt" the filter. So you need an op-amp to do the interface and probably the amplification as well.
So first the interface. Conect the output of your RC to the + input of the op-amp. The - input of the op-amp goes to the output of the opamp. This is a perfect high impedance input interface. Check out this pdf:
http://www.ti.com/ww/en/bobpease/assets/AN-31.pdf

Go to page 2 and check the "Fast Inverting Amplifier with High Input Impedance". The first stage is what i describe. Then you can use your smoothing capacitor or second RC low pass to further smooth. Or just use a second op-amp to amplify and smooth at the output.

#### marquee

• Newbie
• Posts: 8
##### Re: RC PWM conversion
« Reply #4 on: June 09, 2014, 01:46:47 AM »
Hello! I tested the circuit   "Fast Inverting Amplifier with High Input Impedance" but unfortunately I didn?t measured the desirable signal in the output? The output signal from the op-amp remains constant   regardless of the change on pulse?s width (for example between 1,5 ? 2ms).
My last post might not have been so clear, I want to create a pure DC voltage (without parasitic waves) in which I will be able to change its amplitude as I will change the width of rc receiver?s pulses.

To point that I haven?t workbench and all circuits are created in multi.
I have used this circuit exactly as it is represent here http://www.ti.com/ww/en/bobpease/assets/AN-31.pdf
With the same values in the res and cap . The only difference is between   the op-amps, I haven?t the LM components but I used others.  I have post the circuit below.

#### marquee

• Newbie
• Posts: 8
##### Re: RC PWM conversion
« Reply #5 on: June 17, 2014, 16:08:16 PM »
Hello! I made the circuit which is shown below , as you can see the circuit consists of a pulse generator (represents rc receiver) 2 low pass filters  ,the output of the filters is connected in the non-inverting input of the voltage amplifier  and a third low pass filter is connected in the output of the op-amp.     According to the period of the three main RC PWM signals (1-1.5-2ms) and the values of op-amp?s resistors (R10,R11)   the values of the signals in the output of the third low pass filter  are:
1 ms : 3,15V       ,  1.5 ms: 4,75V ,   2ms : 6,35V
My question is , how can I convert  these values  in these (-1,6V  to  0V   to 1,6V)?
I want to do this in order to adjust the DC voltage in the same position (0V) with the triangle wave to put them in a PWM generator
Have you any idea?
Thank you!

#### kam

• Hero Member
• Posts: 1849
##### Re: RC PWM conversion
« Reply #6 on: June 19, 2014, 12:51:33 PM »
first you need a positive-negative power supply to provide negative power to the op-amp. then you can adjust the gain of the op-amp to get the desired values

#### marquee

• Newbie
• Posts: 8
##### Re: RC PWM conversion
« Reply #7 on: August 26, 2014, 20:18:05 PM »
Hello!
I have already done  the circuit in the picture above but, unfortunately the circuit displays low response and the output signal is unstable? So I think that the microcontroller is the best solution for this application. How can I convert the rc receiver?s pulsetrain signal in a pwm signal in the output of microcontroller? In what way the microcontroller can count the difference of  T in square pulse signal? I have basic knowledge about microcontrollers.
Have you any idea?

Thank you!

#### kam

• Hero Member
• Posts: 1849
##### Re: RC PWM conversion
« Reply #8 on: August 27, 2014, 11:45:13 AM »
Oh well, thats not a simple question to answer. First you count the period of the signal POSITIVE pulse. With PIC and assembly it is extremely easy. you only set the Timer1 with gate to measure a positive period. The Timer1 does all the job for you (literally), you only need to periodically acquire the 16-bit length of the measured signal. Then you make a lookup table for the digital to analog output module. The hard work that you have to do is to choose the proper prescaller for Tmr1 and the proper oscillator, so that the minimum to maximum signal length (positive pulse period of the PWM) will be between 0 and 255 counts of Tmr1. It does not have to be 0-255 precisely, but it should not exceed this range, otherwise you have to do calculations.
So, say you manage to get a 50 to 180 counts for 1 to 2msec of pulse duration (0 to 180 degrees for the servo). you then make a lookup table for these numbers (50 to 180) for the D/A module which corresponds to 0 to 5V output.

BUT you need to be quite familiar with the TMR1 module. You need to practice.

An other method is to simply poll the PWM signal, wait for the high-going-transistion, then increase a counter periodically and then set the D/A module according to this counter. Here is the logic diagram for this procedure:

0. Clear Counter register
1. Test PWM Input and wait until it is LOW
2. Test PWM Input and wait until it goes HIGH
3. increase Counter
4. Wait 10 micro-seconds
5 Test PWM input. If it is HIGH then GoTo 3
6. Push Counter to D/A module

So, the counter will increase once every 10uSec. So, the PWM signal (typically 1msec for 0 degrees and 2 msec for 180degrees if i remember well) will be translated into 100 to 200 counts of the Counter register. You simply then push this register to the D/A module and you get an appropriate voltage level.