I see in the Newark's collection of 100 projects for the PSoC4, a project that allows the transmission of RC-5 IR Codes.
This is close to what I want to do, only in reverse. I want to set up the PSoC to receive IR codes from a remote. (Actually, I am interested in the Sony IR codes, but feel that the RC-5 is close, and can be modified to the Sony format.)
How difficult is it to do this? I have already searched the archives, and all I come up with is using Designer. I want to do this using Creator.
Yes, I saw this post - it was almost three years ago, and no follow-up on what he wound up doing.
I suppose I could bit-bang it like he did - I was just hoping that there was an easier way.
Since RC-5 is a manchester-encoded protocol, you can look at this PSoC Insider blog entry about manchester encoding / decoding. There is also a more detailed http://www.cypress.com/?app=forum&id=2232&rID=54414www.cypress.com/ in the forum.
Thanks Hli. I followed the links, read the articles, downloaded the code, and opened it.
Looking at the code, I pulled the Decoder section out of it and put it into my program. I hooked the IR receiver in to the input of the NOR gate.
I am able to detect the IR - and am able to switch the output based upon the IR detection, but I am not able to actually decode the pulse train. All I am getting right now looks like a clock of 10101010. (AA is displayed on the LCD.)
So. Any ideas?
Can you attach a logic analyzer and show what the IR input, the clock and the data output look like?
The PWM needs to be configured to a period about 3/4th of a bit period, and this one is 1.778 ms in RC-5. So the PWM should have a pulse width of about 1.33 ms.
Thanks for your response.
RE: Can you attach a logic analyzer and show what the IR input, the clock and the data output look like?
From the result you printed (0xAA) I figured you are reading only 8 bits...
For the Sony protocol, you need different timing (900µs on the PWM), also, did you read the note about possibly needing to invert the input, depending on the sensor?
It also seems sensible to add another timer to detect the start condition (single continuous pulse for 2.4 ms) and then start receiving.
I have a Sony remote here, but it would take a while to set up the receiver 😞
Maybe you can upload your project here (file / create workspace bundle) so we can have a look?
There is a low cost board being used with Freeware for logic analyzer -
@Bob, you also know of something low cost as well ?
You cannot really go cheaper than these ebay clones. One can use a BusPirate, but it will cost as much (and goes only to 1 MHz). The simplest logic analyzer to build by yourself is probably the LogicBoost, going up to 20 MHz, but its based on a MSP430 😞
Or if you can get your hands on a -050 (or possible y -030) board, you can use my analog-digital Scope as analyzer. But it goes, unmodified, also only up to 1 MHz...
Okay. I have zipped up the code for the IR portion of this project and am uploading it.
I am basically using the Manchester Decode portion of the code (taken from code provided in the links above), but it appears that I am missing a crucial part to get it to work correctly with the Sony protocol.
OK, I looked at the circuit, and the Sony IR protocol again.
So this is not really a manchester protocol (which would have different flank direction depending on the input value). I think you can remove the DFF, and replace the ShitfReg with a SPI slave. The SPI slave can the use the PWM output signal as clock, and directly read the input signal after the 900µs.
Maybe increase the period of the PWM to about 100, and use a compare value which creates a proper flank at the end of the period (starting at 900µs). I think using the input signal as input clock will read the input value just at the wrong piojnt in time.
Sorry to have confused you. I should have taken the DFF out of the recap of how it works. If you still need it, I can try to come up with something this evening...
So, here you go. I used a timer for detecting the start bit condition, a PWM for the bit timing and a SPI slave for collecting the bits into a 12bit-word.
I did not test it, I juts did throw everything together and (hopefully) configured everything properly (but its getting late now, so there will be some errors in it).
There are some timing warnings, so clearly some sync components are needed. I also did not change the code, since I cannot test it anyway...
I added comments about the different signals, so you hopefully you know how it should work. If not, ask...
Actually, the input signal _is_ inverted. Your description, and my schematic, assumes that the the signal are active high (e.g. the start bit is high to 2400µs). But the LA trace shows the signals are active low. So it might be enough to add an inverter between the IO pin and the net handling the signal.
Its difficult to debug without the appropriate hardware 😞
What you might try:
Jim, I do not know which version of Creator you use, but for nearly every usermodule you can get a working example when you search for (right click "Find Example Project"). The main difficulty there is (as it is the case for me) is to understand the datasheets because they are english (and this is not my native language). But I must admit that when I studied them intense enough (and tried some examples) I could get them to work. The concept of PSoCs was new for me, having digital and analog hardware that I could place, connect and program to my needs. Since I was used to work with schematic editors and C-language was not uncommon to me, I could successfully deliver project-solutions to my customers.
So when you have any specific questions regarding one of the components we surely will be able to help you.
When you have no (functioning) example program, you can rely only on the available documentation. Also, when working with PSoC, you should try not to "think in software". You will get most out if it when you start thinking about how to solve the problem in hardware. Thats how I came up with my solution (even though it doesn't seem to work correctly 😞
OTOH, you can try to implement a pure software solution - e.g. port some existing code over.
Thanks for your help. I _am_ thinking in 'hardware', and that is part of my problem. I am thinking in terms of 555 Timers with capacitor & resistor settable delays. Those are not available in the PSoc.
I was able to make a small amount of progress over the last week, by thinking about this 'sideways'. I am using a Glitch Filter to trigger on pulses greater than 900 to 1000uS. This outputs a pulse - or a '1', for the ones. I am also clocking all of the 13 pulses (including the Start pulse which is 2400uS), and passing them into a pair of Shift Registers. The first one is set for 5 bits, and the second one is set for 8 bits.
I am not sure if this is the correct approach. I am still working on decoding the string of bits. One negative that I am having to deal with is that this solution seems to also trigger on other IR remotes (not just the Sony SIRC codes), which means that I will get false triggers that I need to deal with.
One other thing that I am noticing, and it may be why no one else has taken the Creator approach, is that I am grinding through PSoC resources like crazy, which leaves me with very little left over to use for other features inside the PSoC4.
Think of the timer component as a digitally configurable 555, then you are quite close 🙂 Everything else (like DFFs and gates) should then be known to you. Evene the PWM, as its used here, is more like a 555...
So if you find a way of decoding the IR code with 555 timers and digital logic, you can translate this easily into a PSoC.
The approach you outlined might work, but I doubt you gett the start bit decoded correctly. Especially detecting other IR protocols (IIRC they use shorter start bits) might get difficult. Speaking of that: yes, other remotes might work, this is the expected result. Their protocols are just similar enough. You will need to check the address bits to filter out anything you don't want to accept (as any other remote control receiver does).
Regarding the resources: PSoC4 is one of the smallest PSoCs, especially in terms of UDBs. There are only 4 of them available, so its best to use fixed-function block whenever possible. Each of your shift registers will need one UDB. Using a SPI slave might be better, because it needs no UDBs.
hello all dear guys, i need help to build ir reciver tsop(remote controlled device) using Psoc Creator 4.
but i don't know how to do in psoc.please please help me