Emulating an infrared sensor with arduino for an external device connection

Hi, I'm working on a project that have to do several tasks.

The configuration is an arduino that is connected to another device based on a stm32 chip. The device that i have to control with my arduino has a 3.5mm jack input where I normally connect an infrared sensor.

The device that i have to control is a chrono. Whenever the receiver pass in front of the sender, the chrono will stop the time.

Now the problem is that i need to replace the ir system with the arduino that checks different parameters (so the ir is completely removed).

I pretty much need a way to emulate what the ir senor would send to the device in order to stop the timer. Being a time based project, i need this interaction to be as fast as possible to keep the measurements as true as possible.

I saw that the working voltage of the stm32 is 3.3V so i'll also need a voltage divider in order to send the right voltage. Am I right?

In order to keep it simple I would like to keep the device i'm connecting to as it is, without modifying anything.

I have sampled what the sender is sending but I noticed that the chrono is stopping with any ir signal (tested with a remote of my tv), so this let me think that the subject of the transimission is not very important as long as it's not an error code.

Do you guys have any idea to make this work?
Thanks.

I saw that the working voltage of the stm32 is 3.3V so i'll also need a voltage divider in order to send the right voltage. Am I right?

Probably, hard to tell without having seen the schematics of that STM32 device.

I have sampled what the sender is sending but I noticed that the chrono is stopping with any ir signal (tested with a remote of my tv), so this let me think that the subject of the transimission is not very important as long as it's not an error code.

It might be a good idea to share these samples with us...

What voltage had that signal? That might answer your question above.

What is the sending device for the original infrared sensor? Do you have more information about that infrared sensor? Schematics? Type? Link?

What voltage had that signal? That might answer your question above.

The voltage between the ir receiver and the chrono was around 2V when it was working. So i guess I’ve already answered my question.

What is the sending device for the original infrared sensor? Do you have more information about that infrared sensor? Schematics? Type? Link?

I’ve attached 3 photos. 2 of them are the sender (the bigger one). The last photo is the ir receiver sensor.

I don’t have the schematics of both.

I have found this one, it’s very similar to the one i have, but not exactly the same. If i’m able to find the right one I’ll send a link.

It might be a good idea to share these samples with us

I have attached also a logger of multiple tests of what i could capture from the sender

Those are some of the samples that the sender is giving me. Most of them are longer than 100. So i tried to increase the buffer of the library but the message looked like even longer, so…

The receiver also works with those codes (the remote of my tv):

Decoded RC6: C (20 bits)
Raw (42): 2650 -850 450 -850 500 -400 450 -400 450 -900 900 -400 450 -450 450 -400 500 -400 450 -400 450 -450 450 -400 450 -450 450 -450 450 -400 450 -450 400 -450 900 -400 500 -850 450 -400 450

At this point, I guess that would be easier for me to use the last one for testing; considering that they are smaller and with a known format.

Maybe the receiver is triggered with any signal but i’m not sure, I’ll have to test it.

Logger hex.txt (39.3 KB)

The voltage between the ir receiver and the chrono was around 2V when it was working. So i guess I've already answered my question.

What voltage is the power supply of the sensor? I guess you tried to measure the sensor output voltage using a multimeter. That won't give you the actual voltage but some average over time. Use the value of the sensor's power supply (I guess that's 3.3V).

Regarding the output my guess is that you can send a simply spike and the chrono will react on it. So you don't have to emulate complicated infrared sequences. Overlooking the logged data from the sender It seems that it simply sends a rectangular wave most probably modulated on the usual 38kHz carrier. As the sensor probably contains the 38kHz filter all the chrono needs is that single spike. But try it and report back if that works.

Yes the 2V measurement was from the signal out of the ir receiver (and not from the power). Anyway the receiver is powered by a lir2450 (3.6V). This led me think that the receiver system was working at 3.3V. Then i looked for the stm32 and this also said that it was working at 3.3V too.

Regarding the output my guess is that you can send a simply spike and the chrono will react on it.

Yes this was the idea. I won't need the arduino to send any modulated pulse but just a "decoded" signal (because this is what the receiver is expecting). So my problem is: do i send the raw signal? Do i send it with SoftwareSerial or i have to send it in other ways?

Thanks for the support. :wink:

Yes this was the idea. I won't need the arduino to send any modulated pulse but just a "decoded" signal (because this is what the receiver is expecting). So my problem is: do i send the raw signal? Do i send it with SoftwareSerial or i have to send it in other ways?

A simple spike looks like this:

digitalWrite(out_pin, HIGH);
digitalWrite(out_pin, LOW);

I would start with a simple voltage divider to get the 5V of the Arduino to the 3.3V of the STM32. Check if that works.

Ah ok.

Then I’ve already tried doing so but the chrono is not moving. I’ve tried again in case i did some mistake (see the attached photo) and with this connections it’s not working.

I tried to send single spikes, series of spikes, inverted spikes (kept the out high and when i wanted to send the signal set to low) but nothing is working. So i guess this is not the right way.

However, when i tried to make some changes in the connection and forgot to power off the chrono, it stopped the time. Don’t know why and how, but sometimes it did (very few times).

p.s. the resistance of the photo are: R1 220 (the left one), R2 330 (the right one). Let me know if this the right way of making a voltage divider or if i did it wrong.

In that picture I'm missing the GND connection. The chrono will not see the spike as it doesn't have a reference.

In this test I was trying without the ground of the receiver, but in my first test i connected both the grounds together in the spot u see in the pic. I've made several combinations but with simple spikes, it seems not to work

I think I made it work. I simply used the tx of the arduino and sended a cluster of "0xFF" or "0x00" with a simple

Serial.print/println("0xFF"); (could not find any difference between print and println so...)

and it worked at a standard baudrate of 9600. Then i tried to use with sfotware serial and it works too.

Now i'll have to implement to the main software. Ah and I used the voltage divider for the connection (the same i used in the photo but with both the grounds connected together).

I'll let you know if everything works fine.

P.S. the error is +-5: I've sent a signal every 15s and the chrono measured between 15.05 and 14.95 (sometimes even more but are rare cases). Not perfect but for me is enaugh.