Page 3 of 4

Re: Modulo Ky-022 Sensor Receptor Infrarrojo Ir Pic

Posted: Sun Jul 12, 2026 11:45 am
by mnfisher
Something odd - if I do Rx available - the component toggles the Rx pin at 300us intervals.

If I set Tx available - then the pin behaves as expected (held high) and I can see the signal received (on a logic analyser) if I press a button on the control....

Re: Modulo Ky-022 Sensor Receptor Infrarrojo Ir Pic

Posted: Sun Jul 12, 2026 11:53 am
by mnfisher
Using the Rc5_Receive from the above link - the sensor does receive data correctly (not whilst using the component!)

Somewhere there is a better version that uses a pin change interrupt not the busy_wait as in this code.

There was a lot of discussion with Jan about this...

Re: Modulo Ky-022 Sensor Receptor Infrarrojo Ir Pic

Posted: Sun Jul 12, 2026 2:52 pm
by ELECTRONICA67
Hi

I really appreciate your help. I've been working day and night for two weeks on a solution. I was confident there wouldn't be a problem, but sometimes these situations arise. The problem is that I'm pressed for time. I did something simple with an IR photodiode as a pulse counter: it would send 10 pulses and open, then with another IR remote it would send 20 pulses and close. But it wasn't reliable. It had to be at a distance of 10 or 20 cm, and there was a lot of noise in the receiver with the light, not to mention sunlight. I've tried using Flowcode and a receiver like the KC-022, which is commercially available, to at least receive two signals, but I haven't been able to get it to work. That's why I think it might be a bug.

Thanks again, and I really appreciate your help. :)
Enrique

Re: Modulo Ky-022 Sensor Receptor Infrarrojo Ir Pic

Posted: Sun Jul 12, 2026 3:05 pm
by mnfisher
Hi Enrique,

Jan and I managed to get it to work very reliably on AVR and PIC (which didn't support an either edge interrupt). It's not quite the same as a component (no simulation) - but it might do the trick for you?

I'll try and find the latest version / topic....

Martin

Re: Modulo Ky-022 Sensor Receptor Infrarrojo Ir Pic

Posted: Sun Jul 12, 2026 6:26 pm
by ELECTRONICA67
Hi Martin,

I would really appreciate it if you could do that. :D

Thanks
Regards
Enrique

Re: Modulo Ky-022 Sensor Receptor Infrarrojo Ir Pic

Posted: Mon Jul 13, 2026 8:53 am
by mnfisher
I managed to find a lot of stuff for the NEC format - less for the RC5 :-(

However - having just done a Manchester format decoder for the wireless comms - I think I can pull the bits together fairly easily.

Couple of things...

Did you manage to get RC5_Receive to work?
Which MCU are you aiming for? Some PICs have less flexible PIN change interrupts (rising OR falling rather than both) - which we can sidestep by toggling the direction bit after each interrupt...

Martin

Re: Modulo Ky-022 Sensor Receptor Infrarrojo Ir Pic

Posted: Mon Jul 13, 2026 5:54 pm
by ELECTRONICA67
Hi

I couldn't receive any information. I'm using the PIC12F1840 as the transmitter and the PIC16F1847 as the receiver.

The KC-022 sensor only flashed an LED when you transmitted an IR signal to it, but the receiver didn't read any data.

What model of IR sensor are you using :?:

Enrique

Re: Modulo Ky-022 Sensor Receptor Infrarrojo Ir Pic

Posted: Mon Jul 13, 2026 8:11 pm
by mnfisher
That's maybe two problems then - can you try the transmitter that came with the receiver boards?

I'm using the same board ky-022 from a pack of sensors.

If you are using the rc5 component to transmit - the data out might be wrong?

Martin

Re: Modulo Ky-022 Sensor Receptor Infrarrojo Ir Pic

Posted: Mon Jul 13, 2026 8:32 pm
by ELECTRONICA67
Yes, I was using the RC5 component, with the KY-022 sensor and its original IR transmitter or controller.

Re: Modulo Ky-022 Sensor Receptor Infrarrojo Ir Pic

Posted: Mon Jul 13, 2026 9:11 pm
by ELECTRONICA67
But I need to create an IR controller using the PIC12F1840 that can send multiple numbers to the receiver and have them decoded, for example, 10, 20, 50, or 100.

so that it can read four different values.