Problem with multiple IR-emitters (only the first one works)
Moderators: grovkillen, Stuntteam, TD-er
Problem with multiple IR-emitters (only the first one works)
Dear community,
Here's a brain teaser:
I have multiple IR emitters (IR-leds) added to Devices-section, named as "IRTX1" and "IRTX2".
PROBLEM
All IR commands are sent through IRTX1, even if I specifically try to send them via IRTX2. In other words, I'm unable to send any commands through IRTX2.
I've tried both HTTP and MQTT, with the same results. More specifically:
1) MQTT:
Address: ESP1/IRTX2/cmd
Message: "IRSEND,SONY,28B97,20"
2) HTTP:
http://192.168.100.51/control?cmd=IRSEND,SONY,28B97,20
Both methods succesfully send command through IRTX1, but not through IRTX2. Hardware is ESP8266.
QUESTION
Is there a way to send a command via IRTX2 ?
Any pointers would be greatly appreciated.
-Julius
Here's a brain teaser:
I have multiple IR emitters (IR-leds) added to Devices-section, named as "IRTX1" and "IRTX2".
PROBLEM
All IR commands are sent through IRTX1, even if I specifically try to send them via IRTX2. In other words, I'm unable to send any commands through IRTX2.
I've tried both HTTP and MQTT, with the same results. More specifically:
1) MQTT:
Address: ESP1/IRTX2/cmd
Message: "IRSEND,SONY,28B97,20"
2) HTTP:
http://192.168.100.51/control?cmd=IRSEND,SONY,28B97,20
Both methods succesfully send command through IRTX1, but not through IRTX2. Hardware is ESP8266.
QUESTION
Is there a way to send a command via IRTX2 ?
Any pointers would be greatly appreciated.
-Julius
Re: Problem with multiple IR-emitters (only the first one works)
You can prefix any command with the name of the task, and a period as a separator, so in your case that would be "irtx1.irsend,....." and "irtx2.irsend,.....".
The taskname can also be wrapped in square brackets, to improve readability, like "[irtx1].irsend,...." and "[irtx2].irsend,...." (fill the rest of the command on the dots
)
The taskname can also be wrapped in square brackets, to improve readability, like "[irtx1].irsend,...." and "[irtx2].irsend,...." (fill the rest of the command on the dots
![Knipoog ;)](./images/smilies/icon_e_wink.gif)
/Ton (PayPal.me)
Re: Problem with multiple IR-emitters (only the first one works)
Thank you Ath for your quick answer!
I tried adding IRTX2 as the prefix as you suggested, on both the HTTP and MQTT methods, but it still always sends via IRTX1, and the IRTX2 led doesn't send anything.
Specifically:
1) MQTT:
Address: ESP1/IRTX2/cmd
Message: "IRTX2.IRSEND,NEC,FFE817,32"
2) HTTP:
http://192.168.100.51/control?cmd=IRTX2 ... ,FFE817,32
Electrically the first IR-led is on D7 and the second on D6.
I also tried a couple of other things:
- Erased flash. Flashed the latest ESP_Easy_mega_20211224_minimal_IRext_ESP8266_4M1M.bin. Reconfigured. Didn't help.
- Disabled IRTX1: Still no reaction from IRTX2
- Eliminated the possibility of electric problems (in GPIO, LEDs and wiring) by:
A) Swapping IR LEDs: Still IRTX1 drives the swapped led as expected, but IRTX2 does nothing
B) Swapping IRTX1 to D6 and IRTX2 to D7 from device settings: First no effect, but after boot, the situation reversed as expected (only the second led fires, but the first never)
Anything else I could try?
I tried adding IRTX2 as the prefix as you suggested, on both the HTTP and MQTT methods, but it still always sends via IRTX1, and the IRTX2 led doesn't send anything.
Specifically:
1) MQTT:
Address: ESP1/IRTX2/cmd
Message: "IRTX2.IRSEND,NEC,FFE817,32"
2) HTTP:
http://192.168.100.51/control?cmd=IRTX2 ... ,FFE817,32
Electrically the first IR-led is on D7 and the second on D6.
I also tried a couple of other things:
- Erased flash. Flashed the latest ESP_Easy_mega_20211224_minimal_IRext_ESP8266_4M1M.bin. Reconfigured. Didn't help.
- Disabled IRTX1: Still no reaction from IRTX2
- Eliminated the possibility of electric problems (in GPIO, LEDs and wiring) by:
A) Swapping IR LEDs: Still IRTX1 drives the swapped led as expected, but IRTX2 does nothing
B) Swapping IRTX1 to D6 and IRTX2 to D7 from device settings: First no effect, but after boot, the situation reversed as expected (only the second led fires, but the first never)
Anything else I could try?
Re: Problem with multiple IR-emitters (only the first one works)
Ah, this plugin P035 has the same issue as many other plugins: It is explicitly single-instance, as it defines 1 global object to control the IR led.
This has already be fixed for all I2C plugins, allowing multiple instances, since I2C multiplexers are now supported, to enable multiple I2C devices with a fixed address on a single ESP unit.
I've opened an issue on the github issue tracker, #3906 to get that fixed.
This has already be fixed for all I2C plugins, allowing multiple instances, since I2C multiplexers are now supported, to enable multiple I2C devices with a fixed address on a single ESP unit.
I've opened an issue on the github issue tracker, #3906 to get that fixed.
/Ton (PayPal.me)
Re: Problem with multiple IR-emitters (only the first one works)
Nice. Thank you!
Just gotta add - the project you guys have created is absolutely astounding. Thank you for everything.
Just gotta add - the project you guys have created is absolutely astounding. Thank you for everything.
Re: Problem with multiple IR-emitters (only the first one works)
You're welcome
Are you also using the IR receiver (P016) plugin? As that has exactly the same issue, no multi instance possible, that can get the same treatment (in a separate issue & PR).
![Erg Blij :D](./images/smilies/icon_e_biggrin.gif)
Are you also using the IR receiver (P016) plugin? As that has exactly the same issue, no multi instance possible, that can get the same treatment (in a separate issue & PR).
/Ton (PayPal.me)
Re: Problem with multiple IR-emitters (only the first one works)
Indeed, I am using the IR Receiver module with TSOP4838, but just one per module - so I'm maybe not the best person to say ![Lach :)](./images/smilies/icon_e_smile.gif)
I don't even realize how much work it is to modify one driver into the new structure, and all pro bono.
![Lach :)](./images/smilies/icon_e_smile.gif)
I don't even realize how much work it is to modify one driver into the new structure, and all pro bono.
Re: Problem with multiple IR-emitters (only the first one works)
Question is more: Would it be feasible to even have multiple IR receivers in use on a single unit?
You've got to have a hobby, right?
![Lachend :lol:](./images/smilies/icon_lol.gif)
It is quite satisfying, just improving code, and in the process, helping others getting their projects up and running
![Knipoog ;)](./images/smilies/icon_e_wink.gif)
/Ton (PayPal.me)
Re: Problem with multiple IR-emitters (only the first one works)
I suppose someone might have multiple receivers, for instance
- covering of multiple angles or adjacent rooms
- covering different carrier frequencies (with non-38kHz receivers)
- covering of multiple angles or adjacent rooms
- covering different carrier frequencies (with non-38kHz receivers)
Re: Problem with multiple IR-emitters (only the first one works)
Multiple receivers I can understand, but multiple transmitters?
Only if more than one device may react and you only want to address a single one.
Only if more than one device may react and you only want to address a single one.
Re: Problem with multiple IR-emitters (only the first one works)
You're right. I'm actually controlling multiple identical TOSLink-matrixes, so they have to be commanded individually (using a blinding tape over the emitters).
Furthermore, I use those IR emitters that are mounted to the IR screen of each device (tv, amp, decoder, projector, etc). They look neat and are more reliable than blasting the signal from distance. If the devices have different protocols, you could drive multiple emitters via one transistor, but still it's more convenient to connect each emitter to their individual GPIO pins, eliminating the need for the transistor and also making it easier to debug.
Another workaround could be to drive the ir emitters through a transistor, but grounding each emitter's cathode to GPIO pins. That would allow a crude way of selecting the emitter.
Furthermore, I use those IR emitters that are mounted to the IR screen of each device (tv, amp, decoder, projector, etc). They look neat and are more reliable than blasting the signal from distance. If the devices have different protocols, you could drive multiple emitters via one transistor, but still it's more convenient to connect each emitter to their individual GPIO pins, eliminating the need for the transistor and also making it easier to debug.
Another workaround could be to drive the ir emitters through a transistor, but grounding each emitter's cathode to GPIO pins. That would allow a crude way of selecting the emitter.
Re: Problem with multiple IR-emitters (only the first one works)
You can also feed the IR signal into some AND port.
Then you can select which one should be used via other GPIO pins.
Or use the very old 4066 IC as an analog switch.
Then you can select which one should be used via other GPIO pins.
Or use the very old 4066 IC as an analog switch.
Re: Problem with multiple IR-emitters (only the first one works)
If I'm the only one using per-device emitters, then it's probably not worth anyone else's effort to update the P035 driver, so I won't ask you that ![Lach :)](./images/smilies/icon_e_smile.gif)
And by examining https://github.com/letscontrolit/ESPEas ... 5_IRTX.ino, It's not obvious to me how to make it support multiple instances, so perhaps a workaround is my best option here.
![Lach :)](./images/smilies/icon_e_smile.gif)
And by examining https://github.com/letscontrolit/ESPEas ... 5_IRTX.ino, It's not obvious to me how to make it support multiple instances, so perhaps a workaround is my best option here.
Re: Problem with multiple IR-emitters (only the first one works)
I don't know what Ton already has done.
Yesterday we talked about it on Signal, and knowing Ton he might already be looking into it.
First we have to check if the library can be used in multiple instances or not. For example if the library uses static variables to keep some internal state, then it cannot be done without changing the library.
Yesterday we talked about it on Signal, and knowing Ton he might already be looking into it.
First we have to check if the library can be used in multiple instances or not. For example if the library uses static variables to keep some internal state, then it cannot be done without changing the library.
Re: Problem with multiple IR-emitters (only the first one works)
I've looked at the IR library used, and while it does have a couple of static variables, they are only in crucial places for the 'IRrecv' part, the receiver. For the sender the only static members are methods and some data arrays used for AC control.
So I expect it to be doable, and not too hard, to improve P035 IRsend to multi-instance.
So I expect it to be doable, and not too hard, to improve P035 IRsend to multi-instance.
/Ton (PayPal.me)
Re: Problem with multiple IR-emitters (only the first one works)
Thank you for the effort. That's good news.
Re: Problem with multiple IR-emitters (only the first one works)
I've just created PR #3911 enabling multi-instance use of the IR Transmit plugin (P035).
As the Github actions run failed (.bin size issue) here is an ESP8266 4M1M ERext build for testing:
as well as an ESP32 IRext build:
As the Github actions run failed (.bin size issue) here is an ESP8266 4M1M ERext build for testing:
as well as an ESP32 IRext build:
/Ton (PayPal.me)
Re: Problem with multiple IR-emitters (only the first one works)
Wow. Worked right out of the bat, tested it with both HTTP and MQTT requests.
No need for extra electronics, tricks or workarounds.
Thank you!
Now how do I buy you a beer?
No need for extra electronics, tricks or workarounds.
Thank you!
Now how do I buy you a beer?
Re: Problem with multiple IR-emitters (only the first one works)
That's great.
I expect you only validated on ESP8266, right?
![Lachend :lol:](./images/smilies/icon_lol.gif)
![Mr. Groen :mrgreen:](./images/smilies/icon_mrgreen.gif)
And of course you're welcome to make a donation to the project, TD-er has a "Sponsor ESPEasy" link in his profile, redirecting to this thread
/Ton (PayPal.me)
Re: Problem with multiple IR-emitters (only the first one works)
You're right. I only validated with ESP8266EX.
Bedankt for the invitation, it's been a couple of years since I've enjoyed a fresh bottle of Amstel.
As there's no obvious one-shot options, I'll consider registering to Patreon. This is a project worth supporting.
Bedankt for the invitation, it's been a couple of years since I've enjoyed a fresh bottle of Amstel.
As there's no obvious one-shot options, I'll consider registering to Patreon. This is a project worth supporting.
Who is online
Users browsing this forum: Bing [Bot] and 49 guests