bschwind / ir-slinger

A small C library for sending infrared packets on the Raspberry Pi
The Unlicense
99 stars 30 forks source link

Distance problem #13

Closed ffleandro closed 5 years ago

ffleandro commented 5 years ago

Hey there,

I've been using this library for quite some time, however on the last few days I've been trying to configure other types of Air Conditioners, although unsuccessfully.

I'm running your reader program and emitting through pyslinger using a Raspberry Pi 3.

The reader program prints the same command both when I emit using the RPi3 and my real remote, with some microseconds differences, but I think those are irrelevant since using my real remote a few meters distant also varies those timings and the AC still accepts the commands.

So I changed tactics, and now I'm using the testRaw.c using the raw codes I read from the reader program. It only works if I put my board really close to the AC, for instance 0.5m or less.

This problem happens on two different brands of AC, however it is working in my old AC.

I use the same board using Lirc for my TV and it works fine in a distance of 5m to 10m. I use the same board using pyslinger for my other AC in a distance of 5m to 10m.

This shows me that the board is fine, I even tried with another brand new board and leds, same results.

My question is, is there anything on the software I'm not configuring properly to improve the "signal power"?

I've tried changing the frequency to 36KHz or 38KHz. I've tried changing the duty cycle to 0.33 or 0.5.

In testRaw.c I've tried subtracting 50 or 100 microsecond to every code (pulse and gap), and the results are the same, it only works really close to the AC unit.

bschwind commented 5 years ago

Hmm, if it's not a hardware issue then yeah I would have suggested trying a different duty cycle. Compared to the old AC signals, do the LEDs look faint when sending the signal for the new AC over them?

To be clear, on the exact same hardware, you can send a signal 5-10m away to a device successfully, and the only difference now is that you're sending a different signal?

Definitely sounds like this may be tricky to resolve. I would try playing more with different frequencies and duty cycles, and apart from that, I'm not really sure what to do. Whenever I've needed more signal power, I add LEDs in parallel, ensure they have at least 5V, and prefer LEDs with narrow angles of emission as though can go a longer distance.

ffleandro commented 5 years ago

I will make more tests and come back here.

ffleandro commented 5 years ago

Ok, so I went to the site to make more tests and the results are correct:

All the tests were executed with the same hardware, which have 5 leds in every direction and a BC548 transistor to amplify the signal.

AC Consul: sending commands using pyslinger: 5m to 10m OK AC Gree: sending commands with irslinger.testRawCodes.c or pyslinger: Only works in less than 20cm AC Carrier: sending commands with irslinger testRawCodes.c: Only works in less than 20cm

ffleandro commented 5 years ago

I've tried differente frequencies and nothing improved: 30 kHz, 33 kHz, 36 kHz, 38 kHz, 40 kHz, and 56 kHz

ffleandro commented 5 years ago

In this Library https://github.com/z3t0/Arduino-IRremote they use 38KHz for all different AC models.

This is starting to appear very strange to me, it's definetely something on the software. I will try to send the same raws codes using lirc to see if anything changes...

ffleandro commented 5 years ago

Closing this issue, since I found it was a hardware issue.

The hardware works with most Media devices and some ACs as well, but I found that some AC have weak IR Receivers. I was able to reproduce my problem by testing several IR Receivers connected to a Raspberry Pi.

I solved the issue by using a Darlington NPN BC517 transistor (instead of the BC548) and changing the values of the resistors used.

bschwind commented 5 years ago

Interesting! That's the first I've heard of the problem being a weak IR receiver. Glad to hear you figured it out, and I'll be sure to keep that potential problem in mind if similar issues get reported.