First, thank you DAB and cy.gul for your comments on my last week's update. It turned out that the Manchester encoder that I built last weekend is not used in the infrared protocol of my TV remote. After more reading I actually found out that there are various other encoding standards used in home appliances (like TVs, Cable boxes, satellite receivers, audio equipment …). So first thing I looked into was how to transform the Manchester encoder into a more universal encoder. To do this I built an experiment using an infrared receiver (I used Vishay TSOP38238) to decode the signal from my TV remote control, and I also opened the remote control and soldered two wires on the transmitter LED so I could probe the raw signals on the oscilloscope the same time with the decoded signals. This is how my experimental setup looked like:
The Vishay TSOP38238 IR decoder has a block diagram as shown below:
With this setup I could measure the signal that my remote control sends to turn ON/OFF the TV:
The upper waveform is the raw signal on the infrared LED and the lower waveform is the signal at the output of the Vishay TSOP decoder. The data sequence begins with a start pulse, then it has the coded bits, after which there is a pause and then it ends with a pulse similar to the starting pulse. Zooming on the x-axis I could then see the correspondence between 38kHz modulated raw signal and decoded logic bits, as shown in the figure below:
So the difference between the logic “1” and logic “0” bits is not the modulated pulse position within a cycle, like for Mancester decoder, and it is not the length of the modulated pulse. Logic “1” bits have longer spacing in between than logic “0” pulses, and all LED_ON pulses have the same length (1/2 cycle). I have tried to think of a way to transform my shift register that I built one week ago to generate this sequence of pulses, but I couldn’t find an easy way since basically I had to create logic “1” pulses with different clock period than logic “0” pulses. So I decided to remove the shift register and instead to build a subroutine in the CPU that creates these pulses using the CyDelay(x) command. So my schematic has changed:
And the encoding is now done in a function that takes two inputs: the code that needs to be sent and the number of bits that needs to be sent. This is because the code can be 8, 16, 32 … bits format (a register inside CPU that is multiple of 8 bits), but there might be cases when the number of bits that needs to be sent to a particular appliance/command to have an arbitrary number of bits not multiple of 8. So my function takes the first N bits from the code to be sent:
The main advantage I see now, by using a “software” encoder versus the previous “hardware” Manchaster encoder is that I have the flexibility to cover various standards of IR transmission protocols by just creating similar functions for each type of protocol that I want to use.
The new design provides the desired encoding as I am showing in the following screenshot, which I have obtained by turning around my IR LED to point into the Vishay TSOP38238 receiver:
We can see now how logic "1" bits are encoded by having twice the spacing of logic "0" bits.
This was part of what I worked on this weekend; besides this I worked on a PCB that will hold the front end amplifier between electrodes and PSoC 4 comparators. I am trying to get this board fabricated this week, so next weekend I can solder the parts and connect it to the PsoC Pioneer kit.
That’s it for this update; I will post more info as I get more work done.