Okay,
The pic12 acts as a transmitter with one or multiple recipients. The rc5 protocol would work okay - the Manchester encoder should work okay - with some tweaks to the timing.
I'll find a transmitter and play tomorrow. See
https://flowcode.co.uk/forums/viewtopic.php?t=2944
The rc5 uses a very similar encoding to this with a 14 bit message
Martin
Modulo Ky-022 Sensor Receptor Infrarrojo Ir Pic
-
mnfisher
- Valued Contributor
- Posts: 2086
- http://meble-kuchenne.info.pl
- Joined: Wed Dec 09, 2020 9:37 pm
- Has thanked: 163 times
- Been thanked: 960 times
-
ELECTRONICA67
- Posts: 186
- Joined: Wed Dec 02, 2020 3:59 pm
- Has thanked: 31 times
- Been thanked: 9 times
-
mnfisher
- Valued Contributor
- Posts: 2086
- Joined: Wed Dec 09, 2020 9:37 pm
- Has thanked: 163 times
- Been thanked: 960 times
Re: Modulo Ky-022 Sensor Receptor Infrarrojo Ir Pic
I found a 'transmitter' board - but it doesn't seem to work (the LED doesn't seem to be connected to anything (no resistor etc)). The IR remote I found generates NEC format signals 
However - I modified the Manchester encoding transmitter to generate RC-5 signal. I checked output on a logic analyser.
The 14 bit 'payload' has the format:
2 x 1 bits
Toggle bit (alternates 0 / 1 on each key press)
Address 5 bits
Data 6 bits (0..63)
The only MCU specific part here is the interrupt enable which needs to fire every 889us - this will need altering for PIC.
Martin
However - I modified the Manchester encoding transmitter to generate RC-5 signal. I checked output on a logic analyser.
The 14 bit 'payload' has the format:
2 x 1 bits
Toggle bit (alternates 0 / 1 on each key press)
Address 5 bits
Data 6 bits (0..63)
The only MCU specific part here is the interrupt enable which needs to fire every 889us - this will need altering for PIC.
Martin
-
mnfisher
- Valued Contributor
- Posts: 2086
- Joined: Wed Dec 09, 2020 9:37 pm
- Has thanked: 163 times
- Been thanked: 960 times
Re: Modulo Ky-022 Sensor Receptor Infrarrojo Ir Pic
... and a decoder.
I connected the transmitter directly to the receiver using a jumper. This means the logic is inverted - and needs a change to ProcessPin - enable the first block if using IR.
Fixed a bug in transmission - sent bits 15..1 instead of 14..0...
For the PIC - the interrupt handler needs to toggle the direction bit on each transition - so that it then looks for a change in opposite direction. The timer I use - ticks every 0.5us and I read the time delta in PinChange - this might need some work?
The receiver outputs the data received to UART - first the total 14 bit payload then the command - it's easy to shift out the address (or indeed combine the address and command as data). There is also the 'toggle' bit at bit 11.
Martin
I connected the transmitter directly to the receiver using a jumper. This means the logic is inverted - and needs a change to ProcessPin - enable the first block if using IR.
Fixed a bug in transmission - sent bits 15..1 instead of 14..0...
For the PIC - the interrupt handler needs to toggle the direction bit on each transition - so that it then looks for a change in opposite direction. The timer I use - ticks every 0.5us and I read the time delta in PinChange - this might need some work?
The receiver outputs the data received to UART - first the total 14 bit payload then the command - it's easy to shift out the address (or indeed combine the address and command as data). There is also the 'toggle' bit at bit 11.
Martin
- Attachments
-
- RC5_Transmit.fcfx
- (12.55 KiB) Downloaded 5 times
-
- RC5_IR_Decode.fcfx
- (19.25 KiB) Downloaded 5 times
-
mnfisher
- Valued Contributor
- Posts: 2086
- Joined: Wed Dec 09, 2020 9:37 pm
- Has thanked: 163 times
- Been thanked: 960 times
Re: Modulo Ky-022 Sensor Receptor Infrarrojo Ir Pic
Another fly in the ointment - the transmitter needs to modulate the output pin (using PWM) at 38kHz. I'd imagined the transmitter board would do this - but looking at mine (and photos) - I don't think this is the case. Indeed I might have fried mine by connecting it directly to an output pin..
Martin
Martin
-
mnfisher
- Valued Contributor
- Posts: 2086
- Joined: Wed Dec 09, 2020 9:37 pm
- Has thanked: 163 times
- Been thanked: 960 times
Re: Modulo Ky-022 Sensor Receptor Infrarrojo Ir Pic
My first attempt at generating with a 38kHz carrier.
I used the PWM component - and toggle the PWM pin (in this case d6) and my current output pin on and off at the same time. The duty on the PWM pin looks a bit 'low' - but setdutycycle doesn't seem to alter this?
I also accidentally converted a block to C - attempts to convert it back didn't work (can't read xml file)
Martin
I used the PWM component - and toggle the PWM pin (in this case d6) and my current output pin on and off at the same time. The duty on the PWM pin looks a bit 'low' - but setdutycycle doesn't seem to alter this?
I also accidentally converted a block to C - attempts to convert it back didn't work (can't read xml file)
Martin
- Attachments
-
- RC5_Transmit.fcfx
- (14.75 KiB) Downloaded 5 times
-
ELECTRONICA67
- Posts: 186
- Joined: Wed Dec 02, 2020 3:59 pm
- Has thanked: 31 times
- Been thanked: 9 times
Re: Modulo Ky-022 Sensor Receptor Infrarrojo Ir Pic
Thanks Martin, I appreciate the time and knowledge you're sharing with me;
I'll start assembling the hardware immediately to test the component.
Enrique
I'll start assembling the hardware immediately to test the component.
Enrique
-
mnfisher
- Valued Contributor
- Posts: 2086
- Joined: Wed Dec 09, 2020 9:37 pm
- Has thanked: 163 times
- Been thanked: 960 times
Re: Modulo Ky-022 Sensor Receptor Infrarrojo Ir Pic
It will be interesting to hear how it goes.
There are a few changes needed if you use a PIC, as I didn't have the part to test, I used an Arduino (it was the set-up at present) - if you have issues I'll try and help.
It's not a component as such - I'd probably need some matrix magic to make the interrupts portable - but hopefully a step in the right direction.
Martin
There are a few changes needed if you use a PIC, as I didn't have the part to test, I used an Arduino (it was the set-up at present) - if you have issues I'll try and help.
It's not a component as such - I'd probably need some matrix magic to make the interrupts portable - but hopefully a step in the right direction.
Martin