IR Light Switch + MQTT + ESP8266

Well seen, there is a problem with the atol function used in the sketch which limit the conversion to the max integer value, it should limit to the max long value, I don’t know why it is acting like that…
I have replaced this function by a method based on a foor loop.
Now you should not see this strange value anymore unless you push it voluntary.

It can be a part of your trouble.

Right I tried it with a normal LED and it doesnt seem to work. I strongly believe my circuit is incorrect.

I have tried to explain what I meant by :

"Schematic it shows 1 (emitter) is connected to the resistor which then connects to pin D5, 2 (base) is connected to GND and 3 (collector) is connected to the IR LED.

Now I was looking at your other diagram it shows that you have connected 2 (base) to the resistor which is then connected to pin D5 and 1 (emitter) is connected to the GND. So which one is correct? because I am following the schematic i.e. 1 (emitter) connected to the resistor which is connected to pin D5, 2 (base) connected to GND and 3 (collector) connected to IR LED.”

Please check image 1 where I have written in black as it does not match with image 2 i.e. the transistor connection is not the same in image 1 and image 2.

I am trying my best mate, it seems like my circuit is messed up. Do you mind taking a picture of your circuit as we both are using IR?

Thanks.

I have removed the 2 resistors that I am using for my circuit i.e. 100ohms each but it still doesnt work. I am using this IR LED (http://docs-europe.electrocomponents.com/webdocs/139a/0900766b8139a3fa.pdf) which has 100degrees angle of intensity so I am not sure what is wrong that I am doing.

Try removing the transistor circuit and put a normal led with a resistor on d5 directly and check if it light on when emitting.
If yes try replacing the led with the ir one and emit close to your device.

So what u mean is that I remove the transistor and IR LED and replace the IR LED with a normal LED with a resistor?

Yes try to go on a step by step approach. See if a normal led light on. If yes replace it with an ir one and try to emit close to your receiver.
Added to that you could test first with your tv remote and tv receiver there is better chance to succeed compared to other devices.

ok so all this time I have been trying my TV sorry I did not inform you this. However I have tried with all the topics i.e. sendSAMSUNG, sendLG, sendNEC etc. I have a Samsung TV and I decoded the code 3772793023 which I believe is the one for turning the TV on/off.

I plugged a normal LED anode to D5 and cathode to GND and surprising when I turn the switch on or off from HA the LED flashes accordingly.

Now I put back an IR LED which I have of 3 types with the resistor (100 omhs) connected to its anode which is then connected to D5 and its cathode to GND but still it does not turn the TV on or off with this code “3772793023”. I have tried with all the 3 different types of LEDs I have and nothing works :frowning:

I cannot understand what is wrong. I tried it with 2 different ESP8266 boards as well (one is Wemos D1 and the other is NodeMCU).

Good thing that your led switch ON, you can now try to put again the transistor and make the led work with it!

It is possible that your TV need to use raw data (not possible at this time with the gateway), take a look at:
https://forum.arduino.cc/index.php?topic=265183.15

If your tv control is not your final goal you can try with other devices, the LG devices with the protocol sendNEC seems to work well. For the other devices don’t hesitate to search for IRRemote and Arduino keyword plus the brand of the device.

I will try and use the raw data for my TV to see if it works. Can I ask why is the raw data not working with your setup/scheme?

Sorry what do you mean by: "For the other devices don’t hesitate to search for IRRemote and Arduino keyword plus the brand of the device.”

as it is, the gateway is designed to pass long type parameter value and not raw data.

If you have other devices that you want to implement and if it doesn’t work you can take a look at google with the following keyword “arduino” + “irremote” + “brand device” you can find more data about what is going wrong

ok perfect thanks alot for your help !

I will open an issue to the gateway list, and we will see if raw data can be added to the program

1 Like

That would be great, I hope you can add the raw data to the program. Please let me know when you achieve this.

Many thanks again !

Hi

Quick question: does your IR emitter code work for devices which have a RC5 receivers?

Thanks.

Hi, The IRremote library seems to be compatible with RC5 but this is not implemented at the gateway.
Issue added for emission (it should work on receiving)

1 Like

If you press the button of a RC5 remote control in front of the gateway do you receive something, if yes could you publish it?

well I thought my Samsung TV is RC5 that is why I asked.

on another note please visit these links to see if it helps you to add the the raw data to the program:

1). https://community.openhab.org/t/mqtt-ir-transmiter-receiver/9433

2). https://github.com/enc-X/mqtt-ir-transceiver

Hello,

RC5 has been added to the gateway, feel free to test

1 Like