xbee remote totalizer

Dear all
I have connected a XBEE S2 module on a industrial machine with electromechanical counter. I catch the output signal with igital IO of Xbee S2 and I count the pulse on a remote computer.
my xbee input signal is very clean: https://www.amazon.fr/clouddrive/share/DmoVKjF4PwTJGZ8RjyEjK8L5zbXSEwZWKdSAJH0vtNx?v=grid&ref_=cd_ph_share_link_copy

My problem is that my total on the remote computer is more high than the total on the electromechanical counter : for 100 pulse, around 4 pulse differences.
Here’s the java code of my IO Listener :
// Register a listener to handle the samples received by the local device.
localDevice.addIOSampleListener(new IIOSampleReceiveListener() {
@Override
public void ioSampleReceived(RemoteXBeeDevice remoteDevice, IOSample ioSample) {
state=ioSample.getDigitalValue(IOLine.DIO4_AD4).getName();
Date dNow=new Date();
//delta_time=actual_time-previous_time;
if (previous_state==“Low” && state==“High”) {// && delta_time>5000) {
totalQty++;

					//System.out.println("actual_time-previous_time="+delta_time);
					
					SimpleDateFormat sdf =  new SimpleDateFormat ("yyyy.MM.dd ; HH:mm:ss");
					   System.out.println(REMOTE_NODE_IDENTIFIER + ";"+sdf.format(dNow) + ";" + totalQty);//ioSample.getDigitalValue(IOLine.DIO4_AD4));
					   try {
					   	   writer.write(REMOTE_NODE_IDENTIFIER + ";"+sdf.format(dNow) + ";" + totalQty+"

");
writer.flush();
} catch (IOException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}//ioSample.getDigitalValue(IOLine.DIO4_AD4));
previous_state=“High”;
//}
}
if (previous_state==“High” && state==“Low” ) previous_state=“Low”;
}
});

	} catch (XBeeException e) {
		e.printStackTrace();
		localDevice.close();
		System.exit(1);
	}
}

Somebody has some idea ?

You are aware that the DIO and Analog AIO function on the module you are working with is from 0 - 1.2VDC and not 0 - 3VDC?

To help narrow down where the issue is, I would suggest using a port sniffer application and set some triggers in your app to indicate when it receives the frames. Then compare it to the port sniffer log to see where the issue is.

I am using my IO as Digital input so max voltage is 3.3v. …So the problem is not here.

I verified today my input signal when counting.
Signal is okay. But on the same closet there’s an other drilling machine and I discovered that the perturbation comes from this machine. When pushing the command button of this machine, I increment …(around 40% of the time). But my IO is linked to the ground with the last resistance of the tension devider (220K) so the pin should not toggle … ?

You had better read over the product manual again and pay attention to the Max input voltage of the ADC and DIO lines as on this product line, the max input is 1.2V.

I read it ! http://knowledge.digi.com/articles/Knowledge_Base_Article/Digital-and-analog-sampling-using-XBee-radios

802.15.4 modules min 2.08 max 3v3

The XBEE S2 module you listed is not an 802.15.4 module but an XBee ZB module which supports 0 - 1.2V max. What is the actual part number of the modules you are working with? With that info, I can use that to clear it up exactly what it is you are working with.

you are right for the model and voltage for analog input.
But for digital input the spec say : VLmax=0.2VCC and VHmin=0.8xVCC =2.4V (if VCC=3V) So I understand that 2.4V

It sounds like you are introducing noise on the line from the other machine. What happens if you place some metal between the line and the other machine?

I finally resolved my pb : I put a diode and a resistanc eon my input. Every time there’s a pulse the led is lighting 3secondes.
I detected it with a light sensor using thte following example :
https://www.mathworks.com/examples/matlab/community/11381-wireless-control-and-monitoring-of-an-led-using-xbee

to avoid to make a calibration every (to take into account ambiant luminosity) o r false mesure I have some put some rubber tape around my sensor and LED.
My remote totalizer is now working well !