Hello I am new here.
I would like to help with programming the noise filter for receiver Aurel RX2.
I tried to take the solution from the IR decoder but the noise made ??it impossible to capture data.
So I made small changes but the result is still bad.
I had best results with this code but there is still a lot of noise
#define IRpin_PIN PIND
#define IRpin 6
#define MAXPULSE 5000
// what our timing resolution should be, larger is better
// as its more 'precise' - but too large and you wont get
// accurate timing
#define RESOLUTION 20
// we will store
uint16_t pulses[300][2]; // pair is high and low pulse
uint8_t currentpulse = 0; // index for pulses we're storing
uint8_t LEDpin = 13;
void setup(void) {
Serial.begin(19200);
Serial.println("Ready to decode 433.92Mhz!");
}
void loop(void) {
uint16_t highpulse, lowpulse; // temporary storage timing
highpulse = lowpulse = 0; // start out with no pulse length
while (IRpin_PIN & (1 << IRpin)) {
// pin is still HIGH
highpulse++;
delayMicroseconds(RESOLUTION);
digitalWrite(LEDpin,HIGH);
if ((highpulse >= MAXPULSE) && (currentpulse != 0) && (currentpulse <= 299)) {
printpulses();
currentpulse=0;
return;
}
}
pulses[currentpulse][0] = highpulse;
// same as above
while (! (IRpin_PIN & _BV(IRpin))) {
// pin is still LOW
lowpulse++;
delayMicroseconds(RESOLUTION);
digitalWrite(LEDpin,LOW);
if ((lowpulse >= MAXPULSE) && (currentpulse != 0) && (currentpulse <= 299)) {
printpulses();
currentpulse=0;
return;
}
}
pulses[currentpulse][1] = lowpulse;
currentpulse++;
}
void printpulses(void) {
Serial.println("\n\r\n\rReceived: \n\rOFF \tON");
for (uint8_t i = 0; i < currentpulse; i++) {
Serial.print(pulses[i][0] * RESOLUTION, DEC);
Serial.print(" usec, ");
Serial.print(pulses[i][1] * RESOLUTION, DEC);
Serial.println(" usec");
}
}
I got it for, debug and decoding my weather stations, remote switch and etc..
I attach pictures of the measured noise and noise with the signal in the red circles.
I would advise anyone how to improve filtering.
Thanks for reading.
Sorry for bad English.