# How to properly select resistance and capacitance values for my low-pass filter

I am aware that this is a basic question but I could not really understand it.

I am trying to convert pwm signal coming from my pretty standart RF receiver to analog signals. It produces pwm signals with the low point of 1 ms and high point of 2 ms. It is powered with 5v supply.

As I was researching on the matter, I saw that I needed a passive(?) low pass filter like this one.

I tried to calculate the resistance and capacitance values using online calculator I found. However, they require a variable called cut off frequency. I tried to learn about too but I did not understand it enough. I know that these type of receivers are designed to be directly compatible with servo motors or ESCs. So I expect the output frequency around 50 hz? not sure though.

So what should the cut off frequency of my filter should be or eventually what should the resistance and capacitance values be.

Review these:

https://forum.arduino.cc/index.php?topic=518945.0

Also search YouTube: PWM to voltage

It seems to me that the signal you describe is a Servo Control signal and
not a PWM signal. It is high only between 5% and 10% of the time. A servo
can use this signal, but converting it to DC serves no purpose because the
resolution is very poor.
Many people call the RC filter a low-pass because it looks like one, but for
single frequency operation, it is just a smoothing filter, like that after a
power supply rectifier.
Herb

It seems you want to make an input signal analogue, and after that have the Arduino make it digital again.
Why not keep it digital, and measure the HIGH duration directly.
Leo..

a Servo Control signal and not a PWM signal.

A servo control signal is a PWM signal. Perhaps you are confused by the fact that the period of the servo PWM signal is much lower than the periods of the analogWrite() PWM signals.

@iasturk: To convert a typical servo PWM signal to a reasonably steady DC value requires a low pass RC filter with cutoff frequency much lower than 50 Hz. For example, a 1K Ohm resistor followed by a 100 uF capacitor has a 3dB frequency of 10 Hz.

isaturk:
I am aware that this is a basic question but I could not really understand it.

I am trying to convert pwm signal coming from my pretty standart RF receiver to analog signals. It produces pwm signals with the low point of 1 ms and high point of 2 ms. It is powered with 5v supply.

The pulse width is well defined, the pulse frequency is not.

There's unlikely to be any useful purpose to converting such a signal to analog - this all sounds
like xyproblem to me. If you do convert to analog you need a different approach than a low
pass filter, you need to measure the pulse width (irrespective of signal period) and output a
voltage dependent on this.

So what are you actually trying to achieve?

@jremington

I will be trying your circuit very soon.

@MarkT

You see, my transmitter has these kind of switches

They have two states, on or off. When they are on they produce a pwm signal with the pulse width of 2ms and when off 1 ms. I want to convert these signals to basic logic levels. When the switch is on 5v, when off 0v. I don't need the values in between, so I am not actually trying to convert it to analog but to digital. I am aware that I can achieve this using a microcontroller but I am kind of short on pins.

So what is the output of your low pass filter feeding? How do you get from analog to digital?

I was planning that since the analog signal should be between 0-5 V and the output of the switch is either the highest or the lowest of the pulse width range (1ms-2ms). the output of the analog conversion should be either close to 5v or close to 0V. As a result, I would not have to convert it to digital. I am very noob on electronics so maybe I thought wrong

isaturk:
I was planning that since the analog signal should be between 0-5 V and the output of the switch is either the highest or the lowest of the pulse width range (1ms-2ms). the output of the analog conversion should be either close to 5v or close to 0V. As a result, I would not have to convert it to digital. I am very noob on electronics so maybe I thought wrong

Wouldn't an analog conversion require the use of an input pin? You said you were running out of those.

Could measure the high time using pulseIn() as suggested ,or RC filter it and use a comparator to check against a fixed voltage level to see if the higher voltage was being created to drive a digital pin.
Not sure how much voltage 1mS vs 2mS wide at 50 Hz creates, would have to do some experimenting with different Rs & Cs.

Guys I know I can use an ardunio but I want to convert that pwm signal to digital logic level without using any microcontroller if it is possible. To be even more clear, this is a code representation of what I want to achieve but without microcontrollers.

``````if(pulsewidth > 1500){
digitalWrite(shouldPin, HIGH);
}else digitalWrite(shouldPin, LOW);
``````

The trick being to dial in the right trim voltage to output a clean high.

Maybe it is just my way of thinking, but, I wonder why a person will
design a low-pass filter for a frequency he does not have, instead
of a smoothing filter for the frequency he does have!

I thought: A 5 volt pulse 1 ms wide averaged to DC over 20 ms would
give a 0.25 volt level. Then a 2 ms pulse would give a 0.5 volt level.
It should be possible to do as Crossroads suggests.

And as others stated, the servo control information is in the pulse width.
Measure that pulse to determine the servo command.
Herb