unable to stabilized RSSI value

hi, i am using Xbee series 1 module, and i connect Pin 6(PWM0) of Xbee to 2 digital input pins of ARduino Pro Mini and wrote this code and upload to it

rssi1= pulseIn(rssiPin, HIGH,200);  //Read a HIGH pulse on a pin
  Serial.print("RSSI 1 value is ");
  Serial.println(rssi1);
  delay(100);
  
  rssi2 = pulseIn(rssiPin1, LOW, 200); //Read a LOW pulse on a pin1
  Serial.print("RSSI 2 value is ");
  Serial.println(rssi2);
  delay(100);

it gives me the RSSI value based on PWM signal. when one xbee move away from each other the Rssi 1 decrease while Rssi 2 increase. however there are some values at Rssi 1 that suddenly shoots up to very high value and Rssi 2 drops quite low even when both xbee are far apart like 5 to 7 metre. how can i remove these abnormal readings? should i use For loop to average out the values? plz advice thx!

They're not necessarily abnormal. RSS can vary a lot, see the fifth chart down here, which is not even that bad currently, I've seen significantly more variation.

so does that mean i cant get rid of the "abnormal reading"? :fearful: because i need to place some stuff for example buzzer on HIGH at a certain range of RSSI then buzzer on LOW at another range of RSSI

You can average RSSI readings, and discard any that are significantly different from prior readings.

You can NOT rely on RSSI to correlate to distance. Forget that idea.

gibbysoo:
so does that mean i cant get rid of the "abnormal reading"?

"Normal" around here is just a cycle on the washing machine.

PaulS:
You can NOT rely on RSSI to correlate to distance. Forget that idea.

Agree! RSS will be affected by people walking around, lights and appliances and computers being turned on and off, etc. etc. etc.