IRremote library how to send customized Protocol

Hi, thank you for the help.
I tried running the code you provided and I can see that the receiver is picking up signals, but the SendOne() function does not seem to result in the receiver outputting a 1. I also noticed that for a delay of 40 or lower in the transmitter loop, the receiver does not seem to pick up signals either. I am not sure what the problem is exactly. I set my baud rate to 9600

My transmitter loop just calls the two functions:

void loop() {
SendZero();
SendOne();
delay(50);
}

Right, because different transmitters may interfere with one another, which is why I am currently looking into using optical orthogonal codes to prevent this interference.

That won't work. No code can overcome a saturated receiver. Time division multiplexing is what you need. The information you would need to use correlation codes is destroyed in the receiver. You would have to build your own receiver that can function in the analog domain.

Could it be that the receiver takes a millisecond to recognize the signal so SendOne() is recognized as a '0' and SendZero() is not recognized at all? Sound like you will need to experiment with timing.

Try this: Have the sender call SendOne() once a second. Have the receiver do nothing but report the length of pulse it sees. Then switch to SendZero(). With those numbers you can start to adjust your timing to get reliable transmission of single bits. Then work on the between-signal timing.

When I tried calling SendOne with one second delay, the duration is just zero all the time
When I tried doing

void loop() {
SendZero();
SendOne();
delay(50);
}

The duration is also zero for the majority of the times, except a couple 900-950 number occasionally

So, does the receiver I have right now not suffice?

Change the duration of a One bit until you get a non-zero duration every second. That will be the shortest pulse you can send. Add about 50% and that will be your 'short' pulse. Double it for your 'long' pulse. Adjust the values in the receiver to recognize the two pulse lengths.

Yes, it is the AGC issue I mentioned.

Have you downloaded the receiver data sheet? The board you have is just a carrier PCB for a common modular component that you can look up. Think about it for a moment. It yields a digital output for AM detection of a 38kHz signal. It's optimized for that. It does a terrific job of that. I don't know how much communications theory you know, but with AM, the signal bandwidth is expected to be much lower than the carrier frequency. Additionally, the internal AM demod is followed by a threshold based digital detector (comparator). I would like you to explain to me how you could ever accomplish the correlation of two concurrent 38kHz signals applied to a system like that.

You could correlate the digital outputs, but it would be inefficient and realllllly slooooooooow. Like several bits per second. Your best bet is to synchronize them and use TDMA.

I'm done here...

This topic was automatically closed 120 days after the last reply. New replies are no longer allowed.