Just "RSSI" is usually a logarithmic signal. As such, it is not appropriate for averaging. I think the most appropriate space for averaging is linear fields strength, proportional to volts/meter. That would be some constant to the power of RSSI.
So for each RSSI reading, do KRSSI, low pass filter those, then invert the low pass filtered value to get a rough idea of distance. Keep in mind that a lot of things effect signal strength than just distance. These include orientation of both the transmitting and receiving antennas, multi-path destructive or constructive interference, and absorption and blocking of things in the environment. You will get only a rough idea of distance at best. If you get within a factor of 2, then consider yourself lucky.
It will be easier to see how to do this after distilling your requirements down to a real spec. You want 16-22 mV to map to 0-5 V. That's a gain of 833 centered around 19 mV. Let's presume you have a well regulated 5 V supply available.
First, leave a little margin. Let's say we'll use a opamp with up to 1 mV offset voltage, and you don't want either extreme of the signal to result in full high or low output. Leaving 1.5 mV room at each end sounds reasonable. That means the input range is 9 mV instead of just the 6 mV you actually care about. The target gain is therefore 5 V / 9 mV = 550.
That's a lot for a single opamp stage. In practise I'd probably use two stages, but it will be easier to show and explain as a single stage amplifier:
The gain is governed by R3 and the parallel combination of R1 and R2, and the point around which the gain applies by the voltage divider of R1 and R2. Everything is ratiometric, so we can pick one resistance. Let's make R3 1 MΩ and see what the others come out to.
R1 and R2 divide the 5 V supply to make the input gain pivot point, which is 19 mV. The ratio of R1/R2 is therefore 4.981V/19mV = 262.
Next we look at the output impedance of the voltage divider, which works against R3 to set the gain. Since the target gain is 550, R3/(R1//R2) = 549, or (R1//R2) = R3 / 549 = 1821 Ω. This gives us two equations to find the two reistances R1 and R2. Solving yields R1 = 479 kΩ and R2 = 1828 Ω.
In reality you're not going to find resistors with exactly these values, and they will have some tolerance anyway. Find the nearest 1% values, then go back and check what input voltage range you end up with that results in 0-5 volts out. Don't forget to run the min/max test with the resistors the full 1% off in the worst direction, and don't forget about the opamp input offset voltage. The nominal gain may have to be reduced to guarantee the minimum 16-22 mV always maps to within the 0-5 V output range. Actually, I'd try to stay away from the top and bottom 50 mV or so of the output range, even with a "rail to rail" CMOS opamp. I've shown you the method, so this checking and re-calculating is your job.
Best Answer
Getting a precise analogue of a digital moving average filter is somewhere between very difficult and impossible using analogue circuitry, as it involves delaying a signal for a long time.
There are various approximations you could use, which might (or might not) be acceptable to your particular application.
The first is a simple lowpass RC filter. Instead of the 'box car' impulse response of a moving average, it gives you a decaying exponential. For many signals and applications, this will result in similar dynamic behaviour. It is however a weighted average.
The second is a gated integrator, zeroed at time = 0, and read out at time = t_window. While this implements the unweighted average over the window time, it only produces one sample at the end. You could run a number of these with differing start times to produce samples more frequently, but this rapidly becomes silly in terms of duplicated hardware.
The exact analogue of an MA filter is to use an integrator on the input signal, and an analogue delay line going to a subtractor on the same integrator. 5 seconds length of cable is obviously impractical, but there used to be made 'CMOS bucket brigade charge coupled analogue delay lines'. I don't know whether these are still available, it's likely they've been completely superceded by low cost ADCs, MCUs and DACs with better and more flexible performance. Even with a high fidelity delay line, integrator drift will give you a long term problem.
If you are used to playing around with impulse responses, then you might consider the following way of tailoring the RC filter to be a bit more box-car like and a bit less exponential. Consider the impulse response as the sum of several exponentials with differing amplitudes and time constants. This image shows (in blue) an RC exponential response, and (in orange) what you get after subtracting 0.66 of an RC response of half the time constant, the result scaled up a bit. This flattens the first part of the curve and moves the weight a bit further out along the response. Just a thought. I'll let you play with adding more of these. There's not a lot that can be done about the long exponential tail however.