IR Transmitter ?

Moderators: grovkillen, Stuntteam, TD-er

Message
Author
inneet
New user
Posts: 8
Joined: 31 Jan 2016, 23:56

Re: IR Transmitter ?

#31 Post by inneet » 09 Jul 2016, 21:01

Hello everyone! Who can help me with this plugin https://github.com/ESP8266nu/ESPEasyPlu ... 6_IRTX.ino? I try to use NEC protocol, but still nothing not working. It's correct command for NEC: http://192.168.1.106/control?cmd=IRSEND,NEC,4FB40BF,32 ??? After send that command i recieve the message:
IR Code Sent NEC
and in logs this item
IR Code Sent
But IR LED just once blink and it's all.

I test the my ir led in the arduino uno with ir_remote library and everything is working.

Code: Select all

Code : 4FB40BF (32 bits)
Timing[67]: 
+8950, -4500 + 500, - 600 + 550, - 550 + 550, - 600
+ 550, - 550 + 550, - 550 + 600, -1650 + 550, - 600
+ 550, - 550 + 550, -1700 + 550, -1700 + 550, -1700
+ 500, -1700 + 600, -1650 + 550, - 600 + 550, -1650
+ 550, -1700 + 550, - 550 + 600, -1700 + 500, - 600
+ 550, - 550 + 550, - 600 + 550, - 550 + 550, - 550
+ 600, - 550 + 550, -1700 + 550, - 550 + 550, -1700
+ 550, -1650 + 600, -1700 + 500, -1700 + 550, -1700
+ 550, -1700 + 550
unsigned int rawData[67] = {8950,4500, 500,600, 550,550, 550,600, 550,550, 550,550, 600,1650, 550,600, 550,550, 550,1700, 550,1700, 550,1700, 500,1700, 600,1650, 550,600, 550,1650, 550,1700, 550,550, 600,1700, 500,600, 550,550, 550,600, 550,550, 550,550, 600,550, 550,1700, 550,550, 550,1700, 550,1650, 600,1700, 500,1700, 550,1700, 550,1700, 550}; // NEC 4FB40BF
unsigned int data = 0x4FB40BF;

highroller
Normal user
Posts: 31
Joined: 09 Feb 2016, 22:16

Re: IR Transmitter ?

#32 Post by highroller » 09 Jul 2016, 21:49

inneet wrote:Hello everyone! Who can help me with this plugin https://github.com/ESP8266nu/ESPEasyPlu ... 6_IRTX.ino? I try to use NEC protocol, but still nothing not working. It's correct command for NEC: http://192.168.1.106/control?cmd=IRSEND,NEC,4FB40BF,32 ??? After send that command i recieve the message:
IR Code Sent NEC
and in logs this item
IR Code Sent
But IR LED just once blink and it's all.

I test the my ir led in the arduino uno with ir_remote library and everything is working.

Code: Select all

Code : 4FB40BF (32 bits)
Timing[67]: 
+8950, -4500 + 500, - 600 + 550, - 550 + 550, - 600
+ 550, - 550 + 550, - 550 + 600, -1650 + 550, - 600
+ 550, - 550 + 550, -1700 + 550, -1700 + 550, -1700
+ 500, -1700 + 600, -1650 + 550, - 600 + 550, -1650
+ 550, -1700 + 550, - 550 + 600, -1700 + 500, - 600
+ 550, - 550 + 550, - 600 + 550, - 550 + 550, - 550
+ 600, - 550 + 550, -1700 + 550, - 550 + 550, -1700
+ 550, -1650 + 600, -1700 + 500, -1700 + 550, -1700
+ 550, -1700 + 550
unsigned int rawData[67] = {8950,4500, 500,600, 550,550, 550,600, 550,550, 550,550, 600,1650, 550,600, 550,550, 550,1700, 550,1700, 550,1700, 500,1700, 600,1650, 550,600, 550,1650, 550,1700, 550,550, 600,1700, 500,600, 550,550, 550,600, 550,550, 550,550, 600,550, 550,1700, 550,550, 550,1700, 550,1650, 600,1700, 500,1700, 550,1700, 550,1700, 550}; // NEC 4FB40BF
unsigned int data = 0x4FB40BF;
What is the value of the resistor you are using?

And ho long is distance you are trying to transmitt?

With the arduino that have about the double amount of current on each pin i have been able to transmitt around 4-6 meters with an IRled from a remote. Havent tried the ESP transmitter but the distance would be a bit shorter because of the 20ma(?) pr pin.

inneet
New user
Posts: 8
Joined: 31 Jan 2016, 23:56

Re: IR Transmitter ?

#33 Post by inneet » 10 Jul 2016, 04:46

highroller wrote: What is the value of the resistor you are using?
And ho long is distance you are trying to transmitt?
With the arduino that have about the double amount of current on each pin i have been able
to transmitt around 4-6 meters with an IRled from a remote. Havent tried the ESP transmitter
but the distance would be a bit shorter because of the 20ma(?) pr pin.
Tremendous thank you! You are right, a weak power. Output pins in ESP8266 is 12mA maximum.
Near everything worked. After many attempts to amplify the signal I have achieved the result of 2 meters.
A little, but this is the maximum that was possible to make out of components available to me. LED is connected
the under the new scheme. And i has made a calculator for calculating the resistance of the transistor :mrgreen:
Image
transistor_key_LED.xlsx
About the increase in the distance I think we must look in the direction of the code, but in this I am not sure yet.
I try how it will work with the Arduino circuit and at what distance.

Deennoo
Normal user
Posts: 158
Joined: 07 Sep 2015, 13:03

Re: IR Transmitter ?

#34 Post by Deennoo » 01 Aug 2016, 15:26

cherowley wrote:
the http command is:

To turn samsung tv off:

http://192.168.2.165/control?cmd=IRSEND ... 0e019e6,32

to turn samsung tv on:

http://192.168.2.165/control?cmd=IRSEND ... 0e09966,32

Where "SAMSUNG" is the protocol - see the source code for which ones are supported.
The hex string is the ir code to send.
The no of bits in the code
I will start to play with your plugin to just power on\off my samsung sound system.

Of course i have the original remote, is there a way to simple copy hex code ? (using IR reciver plugin ?)

cherowley
Normal user
Posts: 125
Joined: 14 Jan 2016, 09:39

Re: IR Transmitter ?

#35 Post by cherowley » 03 Aug 2016, 12:33

Hi!

The way I did it was to use an arduino IR library with an ir receiver to make a note of the codes...
Deennoo wrote:
cherowley wrote:
the http command is:

To turn samsung tv off:

http://192.168.2.165/control?cmd=IRSEND ... 0e019e6,32

to turn samsung tv on:

http://192.168.2.165/control?cmd=IRSEND ... 0e09966,32

Where "SAMSUNG" is the protocol - see the source code for which ones are supported.
The hex string is the ir code to send.
The no of bits in the code
I will start to play with your plugin to just power on\off my samsung sound system.

Of course i have the original remote, is there a way to simple copy hex code ? (using IR reciver plugin ?)

Deennoo
Normal user
Posts: 158
Joined: 07 Sep 2015, 13:03

Re: IR Transmitter ?

#36 Post by Deennoo » 03 Aug 2016, 13:33

OK thx the trick !

Will work on it now

cherowley
Normal user
Posts: 125
Joined: 14 Jan 2016, 09:39

Re: IR Transmitter ?

#37 Post by cherowley » 09 Aug 2016, 17:05

Deennoo wrote:OK thx the trick !

Will work on it now
Hmm I just remembered you could also use esp easy standard software too!

plugin 016 is an ir receiver/decoder, some details are on http://www.esp8266.nu/index.php/IR

User avatar
ThinkPad
New user
Posts: 5
Joined: 20 Jun 2016, 12:04

Re: IR Transmitter ?

#38 Post by ThinkPad » 11 Aug 2016, 22:16

Maybe some code from https://alexbloggt.com/universal-infrar ... r-esp8266/ can be used?
I tried that sketch on a ESP-01 and it worked fine. But having something plug and play in ESPEasy would be even more fun ;)

User avatar
ThinkPad
New user
Posts: 5
Joined: 20 Jun 2016, 12:04

Re: IR Transmitter ?

#39 Post by ThinkPad » 20 Aug 2016, 10:45

I got the _P106_IRTX.ino plugin working! It works really good!

How to do it:
- Download ESPEasy source (from .zip or from GitHub)
- Download the plugin and place it in the same folder as 'ESPEasy.ino' and the other *.ino files
- Download the IRremoteESP8266.h and also put in same folder as above
- Compile & upload to your device (i used a Wemos D1 Mini board)
- Then under 'Devices' in ESPEasy, select 'Infrared Transmit' and choose the GPIO pin that you have the IR Transmitter connected to. For Wemos D1 Mini i connected the transmitter to pin 'D1', which is GPIO5 in ESPEasy.

You should then be able to send commands by calling the ESP url like this: http://192.168.4.138/control?cmd=IRSEND,NEC,4bb620df,32 (this command turns my Onkyo 5.1 receiver on)

Finding out the codes (and protocol and bits) that your remote uses is quite easy. I used a separate Arduino Nano which i loaded a sample sketch of 'IRrecvDumpV2' on.
As a transmitter i use two IR leds, a 2N2222 transistor and a 470 Ohm resistor. The transistor is driven from the GPIO and gives the IR leds 5V, to create a powerful transmitter. The ready to use IR transmitter boards from China are very weak, because they draw their power from the GPIO.

To have a sort of remote, i created this webpage on my webserver:

Code: Select all

<!DOCTYPE html>
<html>
<head>
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
</head>
<body>

<h1>ESP8266 IR Remote</h1>
<h2>Versterker</h2>
<button type="button" onclick="loadDoc('http://192.168.4.138/control?cmd=IRSEND,NEC,4bb620df,32')">Power on</button>
<button type="button" onclick="loadDoc('http://192.168.4.138/control?cmd=IRSEND,NEC,4b36e21d,32')">Power off</button><br><br>
<button type="button" onclick="loadDoc('http://192.168.4.138/control?cmd=IRSEND,NEC,4bb6d02f,32')">Input tuner</button>
<button type="button" onclick="loadDoc('http://192.168.4.138/control?cmd=IRSEND,NEC,4bb6f00f,32')">Input VIDEO1 (Laptop)</button>
<button type="button" onclick="loadDoc('http://192.168.4.138/control?cmd=IRSEND,NEC,4bb6906f,32')">Input CD (PC Coaxial)</button>
<button type="button" onclick="loadDoc('http://192.168.4.138/control?cmd=IRSEND,NEC,4bb6708f,32')">Input VIDEO2 (TV)</button><br><br>

<button type="button" onclick="loadDoc('http://192.168.4.138/control?cmd=IRSEND,NEC,4bb600ff,32')">Channel up</button>
<button type="button" onclick="loadDoc('http://192.168.4.138/control?cmd=IRSEND,NEC,4bb6807f,32')">Channel down</button><br><br>
<button type="button" onclick="loadDoc('http://192.168.4.138/control?cmd=IRSEND,NEC,4bb641be,32')">(Search) Up</button>
<button type="button" onclick="loadDoc('http://192.168.4.138/control?cmd=IRSEND,NEC,4bb6c13e,32')">(Search) Down</button><br><br>

<button type="button" onclick="loadDoc('http://192.168.4.138/control?cmd=IRSEND,NEC,4bb640bf,32')">Volume +</button>
<button type="button" onclick="loadDoc('http://192.168.4.138/control?cmd=IRSEND,NEC,4bb6c03f,32')">Volume -</button>
<button type="button" onclick="loadDoc('http://192.168.4.138/control?cmd=IRSEND,NEC,4bb6a05f,32')">Volume mute</button><br><br><br>
<button type="button" onclick="loadDoc('http://192.168.4.138/control?cmd=IRSEND,NEC,4bb632cd,32')">Listening mode up</button>
<button type="button" onclick="loadDoc('http://192.168.4.138/control?cmd=IRSEND,NEC,4b36a25d,32')">Listening mode down</button>
<hr>
<h2>TV</h2>
<button type="button" onclick="loadDoc('http://192.168.4.138/control?cmd=IRSEND,SAMSUNG,E0E09966,32')">Power on</button>
<button type="button" onclick="loadDoc('http://192.168.4.138/control?cmd=IRSEND,SAMSUNG,E0E019E6,32')">Power off</button><br><br>
Response: <b><p id="output"></p></b>

<script>
function loadDoc(url) {
  var xhttp = new XMLHttpRequest();
  xhttp.onreadystatechange = function() {
    if (xhttp.readyState == 4 && xhttp.status == 200) {
      document.getElementById("output").innerHTML = xhttp.responseText;
    }
  };
  xhttp.open("GET", url, true);
  xhttp.send();
}
</script>

</body>
</html>

But i am planning on using it with my home automation, 'Home Assistant'.

ambassadoro
Normal user
Posts: 40
Joined: 17 Nov 2015, 15:58

Re: IR Transmitter ?

#40 Post by ambassadoro » 20 Aug 2016, 11:59

Looks interesting, can it be accessed by MQTT, too? Would be more sophisticated.

tozett
Normal user
Posts: 734
Joined: 22 Dec 2015, 15:46
Location: Germany

Re: IR Transmitter ?

#41 Post by tozett » 20 Aug 2016, 12:43

If you Look here,
http://www.esp8266.nu/index.php/ESPEasy ... _Reference

It seems that Command s could basically send via http or MQTT.
BUT there must be a reason , why this is not generraly working. Maybe the Plugin must Provider a Call for his cmds?

This is a Task for the developers, i guess..
I also would like to See all! Cmds functioning via MQTT, generraly.. :D

User avatar
ThinkPad
New user
Posts: 5
Joined: 20 Jun 2016, 12:04

Re: IR Transmitter ?

#42 Post by ThinkPad » 20 Aug 2016, 14:15

ambassadoro wrote:Looks interesting, can it be accessed by MQTT, too? Would be more sophisticated.
I don't know. I haven't done anything with MQTT (yet?).

I think tozett is right, and that the plugin should offer some kind of call for it. But i don't know enough about it to guarantee that.

Martinus

Re: IR Transmitter ?

#43 Post by Martinus » 20 Aug 2016, 17:47

It should also work with MQTT, just send the command to <template>/cmd topic.

And because we have the IR receive feature within the default ESP Easy for some time, it makes much sense to have transmit as well. At a certain time, we have had two IR transmit plugins and we were waiting for those to be merged. As nothing has happened since then, the current IR TX playground plugin will be renumbered and added to the default repository to complete the IR receive/send handling features of ESP Easy.

mtsukamoto
New user
Posts: 8
Joined: 22 Dec 2015, 11:28

Re: IR Transmitter ?

#44 Post by mtsukamoto » 25 Aug 2016, 19:38

Hello Guys....i wanna implement the IR TX on the my ESPEASY project but i no know connect the IR LED on my ESP :cry: Help me please

farhanito
New user
Posts: 9
Joined: 10 May 2016, 16:15

Re: IR Transmitter ?

#45 Post by farhanito » 29 Aug 2016, 18:27

cherowley wrote:
Deennoo wrote:OK thx the trick !

Will work on it now
Hmm I just remembered you could also use esp easy standard software too!

plugin 016 is an ir receiver/decoder, some details are on http://www.esp8266.nu/index.php/IR
It doesn't seems to provide complete dump info, like protocol used and bits

adrianmihalko
Normal user
Posts: 51
Joined: 15 Sep 2016, 00:20

Re: IR Transmitter ?

#46 Post by adrianmihalko » 15 Sep 2016, 00:26

Hi,

I am still waiting for my Wemos devices, but I have some questions:

0, The original IRRemote library for Arduino contains an irsend.sendRaw command to send RAW codes. It is available in ESP EASY IR library too?

1, I want to control my AC unit. AC unit's are usually using long ir codes. Anybody tried to capture/send command like this from ESP EASY?

2, I want to build a powerfull IR transmitter module from 3-4 IR LEDs. It is possible to power these LEDs from only the Wemos D1 mini? Can you help me with a wiring diagram?

User avatar
costo
Normal user
Posts: 500
Joined: 21 Nov 2015, 15:03
Location: NL, zw-NB

Re: IR Transmitter ?

#47 Post by costo » 15 Sep 2016, 01:41

Yes it is possible but,

The maximum current a ESP8266 output can source is about 12mA so you should limit the current with a currentlimit resistor. The value of this resistor should be 180 ohms to be on the safe side.
The Led with series resistor is connected between a GPIO and ground.

If you need a little more current than 12mA/Led you can connect the IR led between Vcc and a GPIO pin with a series resistor of 120 ohm because the ESP can sink 20mA/pin.

You can use more than one output at the same time to drive several IR Leds as long as the total current of all pins together is less than about 100mA.
Each output needs it's own series resistor.

Probably it is easier to use a good transistor if you want to drive a lot of IR Led's. Some type of IR Led's can be driven with 100mA which is way too high for a ESP8266 GPIO pin.

farhanito
New user
Posts: 9
Joined: 10 May 2016, 16:15

Re: IR Transmitter ?

#48 Post by farhanito » 15 Sep 2016, 04:50

hpapagaj wrote:Hi,


1, I want to control my AC unit. AC unit's are usually using long ir codes. Anybody tried to capture/send command like this from ESP EASY?
my question as well,

my AC units use Panasonic, 48bits code like this:

Code: Select all

Encoding  : PANASONIC
Code      : 555A:F3081384 (48 bits)
will it work?

adrianmihalko
Normal user
Posts: 51
Joined: 15 Sep 2016, 00:20

Re: IR Transmitter ?

#49 Post by adrianmihalko » 15 Sep 2016, 09:19

Hi costo,

I already bought some 2N3904 transistors, because I red that it is not good to directly wire IR LEDs to the pins (because of the mA/pin) - I tried direct connection too, but it worked only from few centimeters.

I have TSAL6100 IR LEDs with ratings 5V/100ma. It is possible to drive 3-4 leds with 2N3904 transistor at their full power? Do I need external power supply connected to the transistor? (If I am not wrong the transistor works like a switch, we give a signal to the BASE leg and it's opens the two other leg /E/C/)

Sorry for the dumb qeustions, but I am not an electro engineer, just a hobbyist. :)

User avatar
costo
Normal user
Posts: 500
Joined: 21 Nov 2015, 15:03
Location: NL, zw-NB

Re: IR Transmitter ?

#50 Post by costo » 15 Sep 2016, 14:26

@ hpapagaj
2N3904 is not a powerfull transistor but it can be used to drive a few LED's. Max current for a 3904 is 200mA. The TSAL6100 has a max current of 100mA.
It is not good practise to drive either of them at max current all of the time so I would either limit the current/Led to 40mA and use 4 of them parrallel on one transistor with a series resistor on each LED
Or I would use 2 transistors with each 2 LED's parrallel with seriesresistor @ 80mA each .

You can calculate the value of the series resistor yourself.
First calculate the voltage drop over the resistor, then divide the voltage drop by the LED current to get the ohms value.
Voltage drop over the transistor is 0.2V, over the IR LED = 1.2V, total 1.4V.
If you have 5V to feed the LED's the resistor needs 3.6V over it. So (3.6/0.04) 90 ohm@40mA or 45 ohm@80mA. So use 100 or 47 ohms resistors.
If you use 3.3V to feed the LED's the resistor drop must be (3.3-1.4)=1.9V which gives 47.5 ohms@40mA or 23.75 ohms@80mA. So use 47 ohm or 24 ohms resistor.
All calculated values may vary up to 20% when measured with a volt/current meter

See http://electronics.stackexchange.com/qu ... e-or-below for the schematic and some background.

adrianmihalko
Normal user
Posts: 51
Joined: 15 Sep 2016, 00:20

Re: IR Transmitter ?

#51 Post by adrianmihalko » 18 Sep 2016, 21:21

Finally I have time to play again with the IR. ;) Costo, do I need a resistor between GPIO and the base of the transistor? On the schematic I see 1kΩ resistor, on other sites I found 4.7kΩ resistors.

EDIT:

I just made a quick prototype:
IMG_0745.JPG
IMG_0745.JPG (252.13 KiB) Viewed 56775 times
It's working pretty good. Two more questions left unanswered:

If I choose GPIO2 (D4 on Wemos) the WiFi led is lighting ->why?
Can I use the IR LED(+transistors, resitors) on a 2 meter length cable? On the other end will be the ESP8266.

mtsukamoto
New user
Posts: 8
Joined: 22 Dec 2015, 11:28

Re: IR Transmitter ?

#52 Post by mtsukamoto » 19 Sep 2016, 14:49

hpapagaj, you can control your air conditioner?I had sucess using irheatpump plugin, but i can control Samsung aircon only in my tests, and trying undesrtand the other aircon brand library of this plugin.In the simple IR Transmit plugin (native of ESPEASY), i can control tv and others devices easily but the air conditioner no.

adrianmihalko
Normal user
Posts: 51
Joined: 15 Sep 2016, 00:20

Re: IR Transmitter ?

#53 Post by adrianmihalko » 19 Sep 2016, 16:39

No, I checked only my TV. But my AC is on my list.

User ToniA made a plugin for Heat Pumps (basically they are AC's with long codes), I am now waiting for support for my remote/AC.

Here, I scanned my remote:
https://github.com/ToniA/arduino-heatpumpir/issues/11

...using his tool:
https://github.com/ToniA/Raw-IR-decoder-for-Arduino

The plugin that he wrote for ESP EASY:

https://github.com/ToniA/ESPEasyPluginP ... pumpIR.ino

You must compile ESP EASY to try out, maybe your AC is already supported, because in code I see SamsungHeatpumpIR.h.

Deennoo
Normal user
Posts: 158
Joined: 07 Sep 2015, 13:03

Re: IR Transmitter ?

#54 Post by Deennoo » 26 Sep 2016, 11:57

I there,

Got some time to play with IR on my side.

Got a Samsung HWJ355 sound system. Remote number is AH59-02547B.

Looks like this device doesn't use Samsung Protocole :

IRrecdumpV2 give :

Code: Select all

Encoding  : UNKNOWN
Code      : CA31DA45 (32 bits)
Timing[77]: 
     +4500, -4400     + 550, - 450     + 550, - 450     + 550, - 450
     + 550, - 450     + 550, -1400     + 550, -1500     + 500, - 450
     + 550, - 450     + 550, -1450     + 500, -1500     + 500, -1500
     + 500, -1450     + 550, - 450     + 500, - 500     + 500, - 450
     + 550, - 450     + 550, -4400     + 550, - 450     + 550, - 450
     + 550, - 450     + 550, - 450     + 550, - 450     + 500, - 500
     + 500, - 450     + 550, - 450     + 550, -1450     + 550, -1450
     + 550, -1450     + 500, - 450     + 550, -1500     + 500, -1450
     + 550, -1450     + 500, -1500     + 500, - 450     + 550, - 450
     + 550, - 450     + 550, -1450     + 500
unsigned int  rawData[77] = {4500,4400, 550,450, 550,450, 550,450, 550,450, 550,1400, 550,1500, 500,450, 550,450, 550,1450, 500,1500, 500,1500, 500,1450, 550,450, 500,500, 500,450, 550,450, 550,4400, 550,450, 550,450, 550,450, 550,450, 550,450, 500,500, 500,450, 550,450, 550,1450, 550,1450, 550,1450, 500,450, 550,1500, 500,1450, 550,1450, 500,1500, 500,450, 550,450, 550,450, 550,1450, 500};  // UNKNOWN CA31DA45

ESPEasy IR RX give a different HEX code who doesn't works of course.

Any idea to help please ?

Following this : https://www.hackster.io/BuddyC/wifi-ir-blaster-af6bca

Raw code is hardcoded on Script.

I manage to send a my raw IR code true an ESP8266.

Waldmensch
Normal user
Posts: 11
Joined: 28 Nov 2016, 17:12

Re: IR Transmitter ?

#55 Post by Waldmensch » 28 Nov 2016, 17:22

Hi,

is it possible to use such IR Transmitter? It generates the 38k frequency by itself. So PWM is not needed on ESP side. How the frequency generation can be disabled in ESP code?

http://www.ebay.de/itm/112112841806?_tr ... EBIDX%3AIT

BasemAlsaeed
Normal user
Posts: 10
Joined: 11 Sep 2016, 16:43

Re: IR Transmitter ?

#56 Post by BasemAlsaeed » 05 Dec 2016, 22:20

Hi all,
is it possible by any means to send RAW large IR code like the ones used in ACs ? i managed to have this working on a normal Arduino, but it seems that Plugin P035 is configured only with the 7 well known protocols
it would be perfect if we have the ability to send RAW large commands

Shardan
Normal user
Posts: 1156
Joined: 03 Sep 2016, 23:27
Location: Bielefeld / Germany

Re: IR Transmitter ?

#57 Post by Shardan » 28 Dec 2016, 23:05

Hello all,

after tinkering and testing around i've created a first prototype of a little IR transmitter/receiver module.
Some improvements are still to be made:
- Change the transistor to a SMD darlington type or MOSFET to get more power,
- OnBoard flashing possibility
- find out why it does not boot up sometimes when powered on.

For now besides the mentioned points the prototype works well, driving my Yamaha receiver and some cheap led stripes from the DIY market.
It can be used with 2 or 4 IR-LEDs so one may bend some LEDs to get better results or use 850 nm and 940nm LEDs in parallel.
A TSOP-Receiver can be added optionally to the board to use a IR remote control for what purposes ever.
Attachments
IRTXRX_Stückseite_600.jpg
IRTXRX_Stückseite_600.jpg (63.85 KiB) Viewed 56342 times
IRTXRX_Lötseite_600.jpg
IRTXRX_Lötseite_600.jpg (64.53 KiB) Viewed 56342 times
Regards
Shardan

GusPS
Normal user
Posts: 23
Joined: 28 Feb 2017, 15:59

Re: IR Transmitter ?

#58 Post by GusPS » 02 Mar 2017, 03:47

Hi.

I'm working to get IRTX plugin to send RAW codes.

My idea is to add a sequences of pulses-spaces encoded like this:

/control?cmd=IRSEND,RAW,26,512,256,1f8108550a8428542142150a85555555550a85421555421555555555555555555555550aa85
26: kHz in HEX (0x26 = 38)
512: Duration of Pulse
256: Duration of Space
Big Hex: Sequences of 0/1 encoded in HEX

After recreating the durations, finally call:

Plugin_035_irSender->sendRaw(buf, buf_len, kHz);

Using the example above, and taking the first 4 digits (1f81), we can see that
1 = 0001
f = 1111
8 = 1000
1 = 0001
That means that the first pulse (1), which counts 6, will have a duration of 512*6 = 3072. So buf[0] = 3072.
And the spaces count 6 too, but buf[1] = 1536 because the Space duration is 256.

I've a few questions:
1. What is the limit on the URL that ESPEasy can handle? Is it 80? Where is it defined?
2. I'm new to programming on the ESP8266 and with PlatformIO. Should I get an eye on the resulting .bin file size? For example, I got this log:
Calculating size .pioenvs/normal_4096/firmware.elf
text data bss dec hex filename
415955 9752 39440 465147 718fb .pioenvs/normal_4096/firmware.elf
Building .pioenvs/normal_4096/firmware.bin

Are those numbers right? In case the resulting size exceeds the ESP space, should I get a warning from the IDE?
3. In case something goes wrong after firmware upload, Can I only revert to a functional ESPEasy using an USB-Serial? Are there any other options available like ICSP?

Thank you, and would like to hear your opinions. Regards.

GusPS
Normal user
Posts: 23
Joined: 28 Feb 2017, 15:59

Re: IR Transmitter ?

#59 Post by GusPS » 04 Mar 2017, 02:48

Good news.

I've made a simple test sending a RAW signal and it works fine.

It's just a concept proof.

I'll be coding a final-general approach on the next days....

ahmed.elsakka
New user
Posts: 1
Joined: 04 Mar 2017, 17:14

Re: IR Transmitter ?

#60 Post by ahmed.elsakka » 04 Mar 2017, 17:36

Hello Everyone,

i am new to IR, and my understanding is that if i want to send an unknown code i have to send raw data in arrays, does this work too with the well known codes ? also some of my remotes send different code every key press and some have alternating codes for the same key, is it ok to just pick one of the codes for this key and send it ? or do i have to act same as the remote ?

i am currently checking IR Blaster code on "https://www.hackster.io/BuddyC/wifi-ir-blaster-af6bca" to send raws using esp8266 and "https://learn.adafruit.com/ir-sensor/using-an-ir-sensor" to decode the remote signal to Raws.

GusPS would you please let me know when you finish, if it is ok with you.

I will also post my progress here.

GusPS
Normal user
Posts: 23
Joined: 28 Feb 2017, 15:59

Re: IR Transmitter ?

#61 Post by GusPS » 05 Mar 2017, 02:07

ahmed.elsakka wrote:does this work too with the well known codes ?
Yes. A well-known code can be sent as a RAW code too. The advantage about using a well-known code with ESPEasy is that the pulse/space will be a HEX string of about 6 or 8 digits. With a RAW, this must be greater unless a good reduction routine will be written. I'm thinking about using a base 32 or 64 instead 16 to be able to have an URL with shorter length. Or any other idea... don't know yet. I hear opinions!....
ahmed.elsakka wrote:also some of my remotes send different code every key press and some have alternating codes for the same key, is it ok to just pick one of the codes for this key and send it ? or do i have to act same as the remote ?
I've seen that almost every key has the same code. There are a few that does not send the same code. Here I've an Air Conditioner remote that the ON/OFF button send one code to turn it on and a different one to turn it off.
Don't know your remote, but I would mimic as close as possible their behavior.
Tip: Don't be confused about pulse-space and code. If a key send the same code, 99.9% that the pulse-space sequence will be different every time. But if you see it in detail, will notice that the diffs are minimal.
ahmed.elsakka wrote:GusPS would you please let me know when you finish, if it is ok with you.
Of course!.
ahmed.elsakka wrote:I will also post my progress here.
Excellent!

GusPS
Normal user
Posts: 23
Joined: 28 Feb 2017, 15:59

Re: IR Transmitter ?

#62 Post by GusPS » 08 Mar 2017, 00:17

Hi.

I finish the RAW Code implementation.

The URL to invoke this method is:

http://192.168.1.101/control?cmd=IRSEND ... 38,512,256

IRSEND: Command Control
Type of IR: RAW
RAW Code as base2hex: 3U0GGL8AGGK588A22K58ALALALAGL1A22LAK45ALALALALALALALALAL1AK5
kHz: 38
Pulse Length: 512
Space Length: 256

Here is the modified _P035_IRTX.ino:

Code: Select all

//#######################################################################################################
//#################################### Plugin 035: Output IR ############################################
//#######################################################################################################

#include <IRremoteESP8266.h>
IRsend *Plugin_035_irSender;

#define PLUGIN_035
#define PLUGIN_ID_035         35
#define PLUGIN_NAME_035       "Infrared Transmit"

boolean Plugin_035(byte function, struct EventStruct *event, String& string)
{
  boolean success = false;

  switch (function)
  {
    case PLUGIN_DEVICE_ADD:
      {
        Device[++deviceCount].Number = PLUGIN_ID_035;
        Device[deviceCount].Type = DEVICE_TYPE_SINGLE;
        Device[deviceCount].SendDataOption = false;
        break;
      }

    case PLUGIN_GET_DEVICENAME:
      {
        string = F(PLUGIN_NAME_035);
        break;
      }

    case PLUGIN_GET_DEVICEVALUENAMES:
      {
        break;
      }

    case PLUGIN_INIT:
      {
        int irPin = Settings.TaskDevicePin1[event->TaskIndex];
        if (Plugin_035_irSender == 0 && irPin != -1)
        {
          addLog(LOG_LEVEL_INFO, "INIT: IR TX");
          Plugin_035_irSender = new IRsend(irPin);
          Plugin_035_irSender->begin(); // Start the sender
        }
        if (Plugin_035_irSender != 0 && irPin == -1)
        {
          addLog(LOG_LEVEL_INFO, "INIT: IR TX Removed");
          delete Plugin_035_irSender;
          Plugin_035_irSender = 0;
        }
        success = true;
        break;
      }

    case PLUGIN_WRITE:
      {
        String IrType;
        unsigned long IrCode;
        unsigned int IrBits;
        char log[120];

        char command[120];
        command[0] = 0;
        char TmpStr1[100];
        TmpStr1[0] = 0;
        string.toCharArray(command, 120);

        String cmdCode = string;
        int argIndex = cmdCode.indexOf(',');
        if (argIndex) cmdCode = cmdCode.substring(0, argIndex);

        if (cmdCode.equalsIgnoreCase("IRSEND") && Plugin_035_irSender != 0)
        {
          success = true;
          if (irReceiver != 0) irReceiver->disableIRIn(); // Stop the receiver

          if (GetArgv(command, TmpStr1, 2)) IrType = TmpStr1;

          if (IrType.equalsIgnoreCase("RAW")) {
            String IrRaw;
            unsigned int IrHz;
            unsigned int IrPLen;
            unsigned int IrBLen;

            if (GetArgv(command, TmpStr1, 3)) IrRaw = TmpStr1;
            if (GetArgv(command, TmpStr1, 4)) IrHz = str2int(TmpStr1);
            if (GetArgv(command, TmpStr1, 5)) IrPLen = str2int(TmpStr1);
            if (GetArgv(command, TmpStr1, 6)) IrBLen = str2int(TmpStr1);

            printWebString += F("<a href='https://en.wikipedia.org/wiki/Base32#base32hex'>Base32Hex</a> RAW Code: ");
            printWebString += IrRaw;
            printWebString += F("<BR>");

            printWebString += F("kHz: ");
            printWebString += IrHz;
            printWebString += F("<BR>");

            printWebString += F("Pulse Len: ");
            printWebString += IrPLen;
            printWebString += F("<BR>");

            printWebString += F("Blank Len: ");
            printWebString += IrBLen;
            printWebString += F("<BR>");

            unsigned int buf[200];
            unsigned int idx = 0;
            unsigned int c0 = 0;
            unsigned int c1 = 0;

            printWebString += F("Interpreted RAW Code: ");
            for(int i = 0; i < IrRaw.length(); i++)
            {
              char c = ((IrRaw[i] | ('A' ^ 'a')) - '0') % 39;

              for (unsigned int shft = 1; shft < 6; shft++)
              {
                if ((c & 16) != 0) {
                  c1++;
                  if (c0 > 0) {
                    buf[idx++] = c0 * IrBLen;
                    for (uint t = 0; t < c0; t++)
                      printWebString += F("0");
                  }
                  c0 = 0;
                } else {
                  if (c0+c1 != 0) {
                    c0++;
                    if (c1 > 0) {
                      buf[idx++] = c1 * IrPLen;
                      for (uint t = 0; t < c1; t++)
                        printWebString += F("1");
                    }
                    c1 = 0;
                  }
                }
                c <<= 1;
              }
            }

            if (c0 > 0) {
              buf[idx] = c0 * IrBLen;
              for (uint t = 0; t < c0; t++)
                printWebString += F("0");
            }
            if (c1 > 0) {
              buf[idx] = c1 * IrPLen;
              for (uint t = 0; t < c1; t++)
                printWebString += F("1");
            }

            printWebString += F("<BR>");

            Plugin_035_irSender->sendRaw(buf, idx+1, IrHz);

            //sprintf_P(log, PSTR("IR Params1: Hz:%u - PLen: %u - BLen: %u"), IrHz, IrPLen, IrBLen);
            //addLog(LOG_LEVEL_INFO, log);
            //sprintf_P(log, PSTR("IR Params2: RAW Code:%s"), IrRaw.c_str());
            //addLog(LOG_LEVEL_INFO, log);
          } else {
            if (GetArgv(command, TmpStr1, 2)) IrType = TmpStr1;
            if (GetArgv(command, TmpStr1, 3)) IrCode = strtoul(TmpStr1, NULL, 16); //(long) TmpStr1
            if (GetArgv(command, TmpStr1, 4)) IrBits = str2int(TmpStr1);

            if (IrType.equalsIgnoreCase("NEC")) Plugin_035_irSender->sendNEC(IrCode, IrBits);
            if (IrType.equalsIgnoreCase("JVC")) Plugin_035_irSender->sendJVC(IrCode, IrBits, 2);
            if (IrType.equalsIgnoreCase("RC5")) Plugin_035_irSender->sendRC5(IrCode, IrBits);
            if (IrType.equalsIgnoreCase("RC6")) Plugin_035_irSender->sendRC6(IrCode, IrBits);
            if (IrType.equalsIgnoreCase("SAMSUNG")) Plugin_035_irSender->sendSAMSUNG(IrCode, IrBits);
            if (IrType.equalsIgnoreCase("SONY")) Plugin_035_irSender->sendSony(IrCode, IrBits);
            if (IrType.equalsIgnoreCase("PANASONIC")) Plugin_035_irSender->sendPanasonic(IrBits, IrCode);
          }

          addLog(LOG_LEVEL_INFO, "IR Code Sent");
          if (printToWeb)
          {
            printWebString += F("IR Code Sent ");
            printWebString += IrType;
            printWebString += F("<BR>");
          }

          if (irReceiver != 0) irReceiver->enableIRIn(); // Start the receiver
        }
        break;
      }
  }
  return success;
}
I've tested it with 2 buttons on different remotes.

1)
The red on/off button on "Top House" control:
Image
Here is the Hex Bin file generated by IR Toy:
http://filebin.ca/3En22WfhfTDj/onoff_tophouse.bin

2)
The blue on/off button on Delonghi Air Conditioner:
Image
Here is the Hex Bin file generated by IR Toy:
http://filebin.ca/3En2d3V91y99/onoff_delonghi.bin
In this case, the control sends a different code to turn on and to turn off. The file corresponds to "turn on".


The bin files format are described here: http://dangerousprototypes.com/docs/USB ... pling_mode
I save those files as .bin using GTKTerm on Linux.

To convert the .bin file into a base32hex string, I run (previously the variables pulse_len ad blank_len must be seted):

Code: Select all

#!/usr/bin/python

b32 = "0123456789ABCDEFGHIJKLMNOPQRSTUV"
b64 = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/"

def bits32(bits):
    rdo = ""
    while len(bits) > 0:
        subBits = bits[-5:]
        bits = bits[:-5]
        rdo = b32[int(subBits,2)] + rdo
    return rdo

def bits64(bits):
    rdo = ""
    while len(bits) > 0:
        subBits = bits[-6:]
        bits = bits[:-6]
        rdo = b64[int(subBits,2)] + rdo
    return rdo

bits = ""
#pulse_len = 550
#blank_len = 550
pulse_len = 533
blank_len = 277

idx = 0
with open("onoff_delonghi.bin", "rb") as f:
    byte = f.read(1)
    while byte != "":
        idx += 1
        if idx % 4 == 1 or idx % 4 == 3:
            byte_h = ord(byte)
        if idx % 4 == 2 or idx % 4 == 0:
            measure = ord(byte) + (byte_h << 8)
            if measure != 0xFFFF:
                ms = measure * 21.3333
                mtype = "Blank"
                bv = "0"
                ds = blank_len
                if idx % 4 == 2:
                    mtype = "Pulse"
                    bv = "1"
                    ds = pulse_len
                cbits = round(ms / ds,0)
                print "%s: %s - %u ms - cbits: %.3g" % \
                    (mtype, format(measure, '04x'), ms, cbits)

                for i in range (0, int(cbits)):
                    bits += bv

        # Do stuff with byte.
        byte = f.read(1)

print "Rdo: %s\nHex: %s\nB32: %s\nB64: %s" % (bits,hex(int(bits,2)),bits32(bits), bits64(bits))
The things about base 64 where just for testing purpouses.

The resulting output is like:
Pulse: 0018 - 511 ms - cbits: 1
Blank: 000e - 298 ms - cbits: 1
Pulse: 0018 - 511 ms - cbits: 1
Blank: 0030 - 1023 ms - cbits: 4
Pulse: 0018 - 511 ms - cbits: 1
Blank: 000e - 298 ms - cbits: 1
Pulse: 0018 - 511 ms - cbits: 1
Rdo: 111111000000100001000010101010000101010000100001010000101010000100001010000100001010100001010100001010101010101010101010101010101010100001010100001010100001000010101010101010100001000010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010100001010101010000101
Hex: 0x1f8108550a8428542142150a85555555550a85421555421555555555555555555555550aa85L
B32: 3U0GGL8AGGK588A22K58ALALALAGL1A22LAK45ALALALALALALALALAL1AK5
B64: H4EIVQqEKFQhQhUKhVVVVVUKhUIVVUIVVVVVVVVVVVVVVVUKqF
The base32hex string that should be used is "B32".

For now, I think it's a start.

Things to improve:
  • Improve Python script to accept params instead of setting it in the code.
  • Improve Python script to read "space / pulse" text files
  • Improve Python script to automatically determine pulse and blank length
  • Improve _P016_IR.ino to inform a base32hex in case an Unkown Type is received.
  • Suggest the _P035_IRTX.ino diffs to be accepted on master branch. (I've to read about how to do it)
Any doubts, suggestion, comments, etc, are welcome!
Gustavo.

GusPS
Normal user
Posts: 23
Joined: 28 Feb 2017, 15:59

Re: IR Transmitter ?

#63 Post by GusPS » 08 Mar 2017, 04:48

GusPS wrote: 08 Mar 2017, 00:17
  • Suggest the _P035_IRTX.ino diffs to be accepted on master branch. (I've to read about how to do it)
Done!. Forked on https://github.com/GusPS/ESPEasy and created a Pull Request. ;)

lacco
New user
Posts: 7
Joined: 19 Mar 2017, 00:46

Re: IR Transmitter ?

#64 Post by lacco » 19 Mar 2017, 01:04

Hey everyone,
I've tried to use the send RAW function but without success so far. The hardware part should be okay, it works with other devices.

From the raw data (see below) I thought that these were the correct parameters:
Blank: 450
Pulse: 1200 (I also tried 400 without success)
Binary: 001010100100110000000010100001100100100011001100
(using https://www.translatorscafe.com/unit-co ... bers/4-35/ to convert)
Base32: 1040G04012000000104000480200G008G0480
URL: http://192.168.1.180/control?cmd=IRSEND ... 8,1200,450

Heres what I recorded with the IRRemote library from the button (its from an Denon AVR-1612 receiver):

Code: Select all

Encoding  : UNKNOWN
Code      : 77DE9340 (32 bits)
Timing[99]: 
     +3300, -1650     + 450, - 400     + 450, - 400     + 400, -1250
     + 450, - 400     + 400, -1250     + 400, - 450     + 400, -1250
     + 400, - 450     + 400, - 400     + 450, -1200     + 450, - 400
     + 400, - 450     + 400, -1200     + 450, -1250     + 400, - 450
     + 400, - 400     + 400, - 450     + 400, - 450     + 400, - 400
     + 450, - 350     + 450, - 400     + 450, - 400     + 400, -1250
     + 450, - 400     + 400, -1250     + 400, - 450     + 400, - 400
     + 450, - 400     + 400, - 450     + 400, -1250     + 400, -1250
     + 400, - 450     + 400, - 400     + 450, -1200     + 450, - 400
     + 400, - 450     + 400, -1250     + 400, - 450     + 400, - 400
     + 450, - 400     + 400, -1250     + 400, -1250     + 450, - 400
     + 400, - 400     + 450, -1200     + 450, -1200     + 450, - 450
     + 400, - 400     + 450
unsigned int  rawData[99] = {3300,1650, 450,400, 450,400, 400,1250, 450,400, 400,1250, 400,450, 400,1250, 400,450, 400,400, 450,1200, 450,400, 400,450, 400,1200, 450,1250, 400,450, 400,400, 400,450, 400,450, 400,400, 450,350, 450,400, 450,400, 400,1250, 450,400, 400,1250, 400,450, 400,400, 450,400, 400,450, 400,1250, 400,1250, 400,450, 400,400, 450,1200, 450,400, 400,450, 400,1250, 400,450, 400,400, 450,400, 400,1250, 400,1250, 450,400, 400,400, 450,1200, 450,1200, 450,450, 400,400, 450};  // UNKNOWN 77DE9340
I guess I didn't really understand how to derive the binary code from the raw timings - could someone help me out here?

GusPS
Normal user
Posts: 23
Joined: 28 Feb 2017, 15:59

Re: IR Transmitter ?

#65 Post by GusPS » 19 Mar 2017, 16:15

Hi lacco,

Try with "VS58KA58L25AMKA5AH2KAHAH2K8L"

URL:
http://192.168.1.180/control?cmd=IRSEND ... 38,400,400

I've calculated these values:

Code: Select all

Pulse: 3300 ms - cbits: 8
Space: 1650 ms - cbits: 4
Pulse: 450 ms - cbits: 1
Space: 400 ms - cbits: 1
Pulse: 450 ms - cbits: 1
Space: 400 ms - cbits: 1
Pulse: 400 ms - cbits: 1
Space: 1250 ms - cbits: 3
Pulse: 450 ms - cbits: 1
Space: 400 ms - cbits: 1
Pulse: 400 ms - cbits: 1
Space: 1250 ms - cbits: 3
Pulse: 400 ms - cbits: 1
Space: 450 ms - cbits: 1
Pulse: 400 ms - cbits: 1
Space: 1250 ms - cbits: 3
Pulse: 400 ms - cbits: 1
Space: 450 ms - cbits: 1
Pulse: 400 ms - cbits: 1
Space: 400 ms - cbits: 1
Pulse: 450 ms - cbits: 1
Space: 1200 ms - cbits: 3
Pulse: 450 ms - cbits: 1
Space: 400 ms - cbits: 1
Pulse: 400 ms - cbits: 1
Space: 450 ms - cbits: 1
Pulse: 400 ms - cbits: 1
Space: 1200 ms - cbits: 3
Pulse: 450 ms - cbits: 1
Space: 1250 ms - cbits: 3
Pulse: 400 ms - cbits: 1
Space: 450 ms - cbits: 1
Pulse: 400 ms - cbits: 1
Space: 400 ms - cbits: 1
Pulse: 400 ms - cbits: 1
Space: 450 ms - cbits: 1
Pulse: 400 ms - cbits: 1
Space: 450 ms - cbits: 1
Pulse: 400 ms - cbits: 1
Space: 400 ms - cbits: 1
Pulse: 450 ms - cbits: 1
Space: 350 ms - cbits: 0
Pulse: 450 ms - cbits: 1
Space: 400 ms - cbits: 1
Pulse: 450 ms - cbits: 1
Space: 400 ms - cbits: 1
Pulse: 400 ms - cbits: 1
Space: 1250 ms - cbits: 3
Pulse: 450 ms - cbits: 1
Space: 400 ms - cbits: 1
Pulse: 400 ms - cbits: 1
Space: 1250 ms - cbits: 3
Pulse: 400 ms - cbits: 1
Space: 450 ms - cbits: 1
Pulse: 400 ms - cbits: 1
Space: 400 ms - cbits: 1
Pulse: 450 ms - cbits: 1
Space: 400 ms - cbits: 1
Pulse: 400 ms - cbits: 1
Space: 450 ms - cbits: 1
Pulse: 400 ms - cbits: 1
Space: 1250 ms - cbits: 3
Pulse: 400 ms - cbits: 1
Space: 1250 ms - cbits: 3
Pulse: 400 ms - cbits: 1
Space: 450 ms - cbits: 1
Pulse: 400 ms - cbits: 1
Space: 400 ms - cbits: 1
Pulse: 450 ms - cbits: 1
Space: 1200 ms - cbits: 3
Pulse: 450 ms - cbits: 1
Space: 400 ms - cbits: 1
Pulse: 400 ms - cbits: 1
Space: 450 ms - cbits: 1
Pulse: 400 ms - cbits: 1
Space: 1250 ms - cbits: 3
Pulse: 400 ms - cbits: 1
Space: 450 ms - cbits: 1
Pulse: 400 ms - cbits: 1
Space: 400 ms - cbits: 1
Pulse: 450 ms - cbits: 1
Space: 400 ms - cbits: 1
Pulse: 400 ms - cbits: 1
Space: 1250 ms - cbits: 3
Pulse: 400 ms - cbits: 1
Space: 1250 ms - cbits: 3
Pulse: 450 ms - cbits: 1
Space: 400 ms - cbits: 1
Pulse: 400 ms - cbits: 1
Space: 400 ms - cbits: 1
Pulse: 450 ms - cbits: 1
Space: 1200 ms - cbits: 3
Pulse: 450 ms - cbits: 1
Space: 1200 ms - cbits: 3
Pulse: 450 ms - cbits: 1
Space: 450 ms - cbits: 1
Pulse: 400 ms - cbits: 1
Space: 400 ms - cbits: 1
Pulse: 450 ms - cbits: 1
Rdo: 11111111000010101000101000101000101010001010100010001010101010110101000101000101010101000100010101000101010001010101000100010101000100010101
Hex: 0xff0a8a28a8a88aab5145544545455115115L
B32: VS58KA58L25AMKA5AH2KAHAH2K8L


Let me know it it works. Also check if "38" is the correct Hz. Also try 36 or 40.

As you can see, i've used 400ms for both space & pulse. This would lead to not so precise values. If I choose 50ms, i get this b32 string: 3VVVVVVVVVVVVU0000007VG1VS0FU00001VS0FU00001VO0FU00001VO0FU07VG0000VU07V01VO0000FV00000VS07V03VG0VS07V03VO1VS0FV03VG0000FV03VG0000FU03VG1VS0FU03VG0000FU00001VO0FU07VG0000VU07V01VO00007V01VO0VU07V00000VS00003VO0VS0FV00001VS00007VG0VS0FV

That would replicate EXACT timings, BUT it is too large (235 chars) for ESPEasy URL. :(

lacco
New user
Posts: 7
Joined: 19 Mar 2017, 00:46

Re: IR Transmitter ?

#66 Post by lacco » 19 Mar 2017, 23:58

Hey GusPS,
thanks for your effort! Unfortunately I couldnt get it to work yet :(
I've tried your suggestions, plus I replaced "cbits: 0" with "cbits: 1" because I thought there should be a space as well, but no luck so far. 36 or 40 Hz didn't work either.

I've created a spreadsheet to generate the binary code automatically, so others might use that, too:
https://docs.google.com/spreadsheets/d/ ... sp=sharing

Any other ideas would be appreciated!

GusPS
Normal user
Posts: 23
Joined: 28 Feb 2017, 15:59

Re: IR Transmitter ?

#67 Post by GusPS » 20 Mar 2017, 00:49

Didn't notice there where one "cbits=0"!!!!... That's important. Luckly you saw it.

Very good spreadsheet! Thanks!

A few Qs:

1. How are you getting the byte array? Is weird to me that the timings are so precise!. IRRemote library can be so precise like that? I use IR Toy, and the Sampling Mode always gives me some minimal differences between tests.
2. If you use the ESPEasy with the base32 value against the IRRemote library, which result do you get?
3. What about using 150 as "space" and "pulse? That's giving me ---> FVVVS01PPG1PG1HG1HJG1PHG1O0OPHHJJJJ03J03376606066E0766066EC0C0ECS0E0737
That's 71 chars and I think is enough for the URL buffer.
4. As stated in this page (http://mc.mikrocontroller.com/de/IR-Pro ... .php#DENON - Use google to translate it to English), the Denon protocol uses 32Khz. Try all those tests, even the previous ones, changing it.
5. Also, try to get more info about your controller in http://irdb.tk

Let me know when you test it.
As the last resort, if you are sure that the protocol is the Denon, there's the possibility to implement it like the RC5 or Panasonic, etc... in which case you could finally use the 32 bits code (in your example the number 77DE9340)

PD: More info about Denon protocol -----> http://read.pudn.com/downloads157/sourc ... ts%202.PDF

Shardan
Normal user
Posts: 1156
Joined: 03 Sep 2016, 23:27
Location: Bielefeld / Germany

Re: IR Transmitter ?

#68 Post by Shardan » 30 Mar 2017, 20:01

Hello all,

for those who have difficulties with the hardware here is the schematic and PCB layout
including silks for the IR-TX-RX shown in post #57.
IRTXRX-v2.1.pdf.zip
(139.12 KiB) Downloaded 1212 times
The version has some slight changes over the photos from #57 to improve the IR-receiver.
I've five of these modules running atm so i can say it is proven to work.

You may use different IR LED types. Beware, you have to adapt R4 and R5 to your LED type!
Most LEDs can take 20..30 mA. As they are pulse driven here they can take much more, but
be carefull.

The PCB is designed for four LEDs to give high IR power. You may ommit one of the paths, for example D1/D2/R4.

R3 is optional, some FET transistor types need it, some not. So i designed it into the PCB
The IRLL014 does not need it.

For easy flashing RX, TX and reset are lead out to pins.
The jumper P6 gives GND for flashing and allows jumpering to flash mode.

Happy tinkering :)

Regards
Shardan
Regards
Shardan

nick-head
Normal user
Posts: 48
Joined: 15 Nov 2016, 11:09
Location: North East UK

Re: IR Transmitter ?

#69 Post by nick-head » 16 Apr 2017, 11:06

How about an IR Repeater ?

Then it doesn't matter about protocols , does it ?

Many of us have lots of ESP's that we can put around the house and utilise a common receiver to control
appliances in a different room.

Or am I being too presumptuous?
ESP32, Arduino's,Raspberry Pi's, ESP8266's, Nextion's, Sonoff's, LightWaveRF's, RFXCom 433, and a headache
And a HackRF One, as a present to myself.

NietGiftig
Normal user
Posts: 103
Joined: 16 Sep 2015, 20:32

Re: IR Transmitter ?

#70 Post by NietGiftig » 16 Apr 2017, 13:26

nick-head wrote: 16 Apr 2017, 11:06 How about an IR Repeater ?
Many of us have lots of ESP's that we can put around the house and utilise a common receiver to control
appliances in a different room.
Would like to have that !!

bobbybeans
Normal user
Posts: 119
Joined: 26 Feb 2017, 17:30

Re: IR Transmitter ?

#71 Post by bobbybeans » 08 May 2017, 23:16

Hey there wow ! lots of work has been done since a few months ago i love it!. I already use this plugin for some IR LED RGB candles. have them working great. However I just bought a Future 40watt air purifier and decoded the signals exactly the same way i did in my original post for the candles
https://www.letscontrolit.com/forum/vie ... php?t=2761

however.. this is not identified as any standard protocol by the arduino or the raspberry pi.
It does give me a hex but it wont work as it doesn't know the protocol. So I thought id check back up on this and sure enough its been updated. However I am having trouble with even just compiling it. then i was going to use the raw output to see if i could get it working
I have taken your for Gusps that has seemed to be updated 26 days ago and i updated the IR libraries. is that the final version? because i get errors when trying to compile it and i have updated to the latest IR library as well
here is what I am getting. Suggestions?

Code: Select all


_P035_IRTX:14: error: missing terminating " character
_P035_IRTX:23: error: stray '\' in program
_P035_IRTX:23: error: stray '\' in program
_P035_IRTX:130: error: missing terminating ' character
_P035_IRTX:167: error: missing terminating " character
_P035_IRTX:369: error: too many decimal points in number
_P035_IRTX:379: error: too many decimal points in number
_P035_IRTX:389: error: too many decimal points in number
_P035_IRTX:399: error: too many decimal points in number
_P035_IRTX:409: error: too many decimal points in number
_P035_IRTX:440: error: exponent has no digits
_P035_IRTX:447: error: stray '\' in program
_P035_IRTX:538: error: stray '#' in program
_P035_IRTX:547: error: stray '#' in program
_P035_IRTX:560: error: stray '#' in program
_P035_IRTX:564: error: stray '#' in program
_P035_IRTX:568: error: stray '#' in program
_P035_IRTX:816: error: stray '#' in program
_P035_IRTX:816: error: stray '#' in program
_P035_IRTX:841: error: stray '#' in program
_P035_IRTX:849: error: stray '#' in program
_P035_IRTX:913: error: stray '#' in program
_P035_IRTX:1014: error: stray '#' in program
_P035_IRTX:1014: error: stray '#' in program
_P035_IRTX:1014: error: stray '#' in program
_P035_IRTX:1014: error: stray '#' in program
_P035_IRTX:1014: error: stray '#' in program
_P035_IRTX:1014: error: stray '#' in program
_P035_IRTX:1294: error: stray '#' in program
_P035_IRTX:1302: error: stray '#' in program
_P035_IRTX:1335: error: stray '#' in program
_P035_IRTX:1345: error: missing terminating ' character
_P035_IRTX:1363: error: missing terminating " character
_P035_IRTX:1395: error: missing terminating ' character
_P035_IRTX:7: error: expected unqualified-id before '<' token
_P035_IRTX:547: error: expected unqualified-id before '<' token
_P035_IRTX:547: error: expected unqualified-id before '<' token
_P035_IRTX:551: error: expected unqualified-id before '<' token
_P035_IRTX:568: error: expected unqualified-id before '<' token
_P035_IRTX:568: error: expected unqualified-id before '<' token
_P035_IRTX:577: error: 'string' does not name a type

Edit: i am an idiot. i right click saved as on the new plugin and it saved the htm file not the plugin... however still having trouble with compiling
now i get this, and it never finishes compiling just stays and does this forever

Code: Select all

 java.util.regex.Pattern$GroupTail.match(Pattern.java:4717)
	at java.util.regex.Pattern$BranchConn.match(Pattern.java:4568)
	at java.util.regex.Pattern$CharProperty.match(Pattern.java:3777)
	at java.util.regex.Pattern$Branch.match(Pattern.java:4604)
	at java.util.regex.Pattern$GroupHead.match(Pattern.java:4658)
	at java.util.regex.Pattern$Loop.match(Pattern.java:4785)
	at java.util.regex.Pattern$GroupTail.match(Pattern.java:4717)

GusPS
Normal user
Posts: 23
Joined: 28 Feb 2017, 15:59

Re: IR Transmitter ?

#72 Post by GusPS » 09 May 2017, 00:09

That java stuff seems weird.
I remember not having any problems compiling using Atom following the guide that's on the site: https://www.letscontrolit.com/wiki/inde ... Platformio

I'll double check everything in your case.
Regards!

bobbybeans
Normal user
Posts: 119
Joined: 26 Feb 2017, 17:30

Re: IR Transmitter ?

#73 Post by bobbybeans » 09 May 2017, 12:42

yeah I thought that was weird too. I removed the plugin and it compiled fine
I put back my original ir library as well

I will try again tonight starting from scratch. I copied the raw code from github into notepad then saved it
could have been tired not sure

I will also follow thi guide

bobbybeans
Normal user
Posts: 119
Joined: 26 Feb 2017, 17:30

Re: IR Transmitter ?

#74 Post by bobbybeans » 19 May 2017, 20:57

Well I got the ir plugin working. I just gave up on compiling and downloaded the easy esp mega 2.0.0 dev8 branch bin file and flashed....
now I am a big confused
I was using the excel doc provided back a page and i am not getting anything to work main because it looks like my IR code is a lot shorter than what you guys have

While yes I would like to know the answer. More importantly I would like to know how you figured it out with the info below as I have other buttons I want to convert. This is pulled from my arduino using irrecdumpv2

Code: Select all


Encoding  : UNKNOWN
Code      : A32AB931 (32 bits)
Timing[23]: 
     +1350, - 300     +1350, - 300     + 550, -1150     +1350, - 300
     +1350, - 350     + 500, -1150     + 550, -1100     + 550, -1150
     + 500, -1150     + 550, -1100     + 550, -1150     +1350
unsigned int  rawData[23] = {1350,300, 1350,300, 550,1150, 1350,300, 1350,350, 500,1150, 550,1100, 550,1150, 500,1150, 550,1100, 550,1150, 1350};  // UNKNOWN A32AB931


I also added a receiver on the esp and piped it into domoticz dummy text to track the stuff it was sending. Here it is, 4140943054 is the most common which is similar to what I was getting with my arduino. Not in a sense of the same number but it was not the same every single time and there was a common them of 1 out of maybe 3-4 times I hit the button it would be A32AB931 or in domoticz case 4140943054. I dont know what this number is. is this hex? just a number? if so how would I send it?

Code: Select all

2017-05-19 20:06:03	2582915280
2017-05-19 20:06:02	4140943054
2017-05-19 20:05:53	3658147960
2017-05-19 20:05:52	4140943054
2017-05-19 20:05:45	3117192660
2017-05-19 20:05:44	4140943054
2017-05-19 20:05:38	2737486129
2017-05-19 20:05:37	4140943054

GusPS
Normal user
Posts: 23
Joined: 28 Feb 2017, 15:59

Re: IR Transmitter ?

#75 Post by GusPS » 19 May 2017, 22:35

Try this URL:

http://x.x.x.x/control?cmd=IRSEND,RAW,7 ... 38,170,150

7VJVPO1VSVUE0E0E0E0E0E0FV es de Base32 if this sequence: 111111111001111111110011100000001111111110011111111100111000000011100000001110000000111000000011100000001110000000111111111
having 170 and 150 as pulse and silence respectively.

If it doesn't work, make sure you have a 38khz sender. If not, change that number to your khz control.
Other thing to try is to be closer to the decive.

Let us know if it work.

bobbybeans
Normal user
Posts: 119
Joined: 26 Feb 2017, 17:30

Re: IR Transmitter ?

#76 Post by bobbybeans » 19 May 2017, 23:26

GusPS wrote: 19 May 2017, 22:35 Try this URL:

http://x.x.x.x/control?cmd=IRSEND,RAW,7 ... 38,170,150

7VJVPO1VSVUE0E0E0E0E0E0FV es de Base32 if this sequence: 111111111001111111110011100000001111111110011111111100111000000011100000001110000000111000000011100000001110000000111111111
having 170 and 150 as pulse and silence respectively.

If it doesn't work, make sure you have a 38khz sender. If not, change that number to your khz control.
Other thing to try is to be closer to the decive.

Let us know if it work.
Unfortunately that did not work. :( I moved my device within about half a meter to the IR. I have confirmed that it actually sending via putting the led next to the receiver and it does catch something.
It is 38khz sender and receiver. I have no clue if my remote is though however based on googling A32AB931
This code is an on off switch for a heater which is the same on off for my air purifier
http://www.remotecentral.com/cgi-bin/mb ... d.cgi?9724
and another thread confirmed it was 38 khz
https://arduino.stackexchange.com/quest ... ote-heater
this is not definitive proof that my remote is 38khz but it at least seems plasible

how did you calculate the 170 and 150 pulse? I dont see that anywhere in the raw data? also how did you come up with the binary? I realize you probably took the raw and converted it somehow but how? once I have the binary I can easily use a base32 converter online

angelosub
Normal user
Posts: 10
Joined: 26 Jan 2017, 12:59
Location: Italy

Re: IR Transmitter ?

#77 Post by angelosub » 28 May 2017, 21:32

I have don't understand extrapolate a RAW data from IR transmitter.
I have try to receive a IR code with a P016 plugin "Infrared Receiv - TSOP4838". In house I have TSOP4136 ad I have used this, the difference is the IR frequencies. TSOP4838 38kHz TSOP4136 36kHz. I hope isn't a problem.

When I push the on/off button of the IR transmitter the ESPEasy receive 2 codes HEX:
800ff and ffffffff

I don't understand how convert this HEX values to a RAW for sending the code with a ESPEasy.
http://<ip address>/control?cmd=IRSEND,RAW,code,kHZ,Pulse Len, Blank Len
kHZ = 38 It's correct?

thanks for help.

GusPS
Normal user
Posts: 23
Joined: 28 Feb 2017, 15:59

Re: IR Transmitter ?

#78 Post by GusPS » 29 May 2017, 01:19

bobbybeans wrote: 19 May 2017, 23:26
GusPS wrote: 19 May 2017, 22:35 Try this URL:

http://x.x.x.x/control?cmd=IRSEND,RAW,7 ... 38,170,150

7VJVPO1VSVUE0E0E0E0E0E0FV es de Base32 if this sequence: 111111111001111111110011100000001111111110011111111100111000000011100000001110000000111000000011100000001110000000111111111
having 170 and 150 as pulse and silence respectively.

If it doesn't work, make sure you have a 38khz sender. If not, change that number to your khz control.
Other thing to try is to be closer to the decive.

Let us know if it work.
Unfortunately that did not work. :( I moved my device within about half a meter to the IR. I have confirmed that it actually sending via putting the led next to the receiver and it does catch something.
It is 38khz sender and receiver. I have no clue if my remote is though however based on googling A32AB931
This code is an on off switch for a heater which is the same on off for my air purifier
http://www.remotecentral.com/cgi-bin/mb ... d.cgi?9724
and another thread confirmed it was 38 khz
https://arduino.stackexchange.com/quest ... ote-heater
this is not definitive proof that my remote is 38khz but it at least seems plasible

how did you calculate the 170 and 150 pulse? I dont see that anywhere in the raw data? also how did you come up with the binary? I realize you probably took the raw and converted it somehow but how? once I have the binary I can easily use a base32 converter online
Hi bobbybeans,

The IR code is just a few PULSE and BLANK sequence, where PULSE is a 38khz burst of IR light, and BLANK is no light at all. Viewing at your rawData array, you can see that your remote is sending 1350 millisecs of PULSE and then 300 ms of BLANK, then again 1350 of PULSE and the 300 of BLANK, 550 of PULSE, and 1150 of BLANK, and so on.
When you know the Protocol that is being used, you can "compress" the PULSE and BLANK data according to the protocol spec, which can be written with a few chars.
The RAW option I've added to the _P035_IRTX plugin, aims to address the situation where you can't decode or don't know the used protocol. If you were able to just send in the ESPEasy URL your array (1350,300, 1350,300, 550,1150, 1350,300, 1350,350, 500,1150, 550,1100, 550,1150, 500,1150, 550,1100, 550,1150, 1350), your remote signal will most likely to work ok. BUT, that URL has some limit on the length, being necesary to reduce it as much as possible.
That's why that array of PULSE and BLANK will be written in base32.

Take a look at this post #62 : https://www.letscontrolit.com/forum/vie ... 030#p14030

The key is to find the best length for PULSE and BLANK. If your array were 1400 and 500 only, you should use 1400 for pulse and 500 for blank (that's too obvious). So the binary expression will be "10". If you choose 700 and 500, then the binary will be: "110".
But, when you have in your array different values, the selected values should be the closest higher multiplier possible. That's why I choose 170 and 150. Of course you could lower those values, but the resulting B32 will be longer and maybe you reach the URL limit. (I don't recall what it is).

Seeing at the resulting binary I gave you, I saw that the first sequence of "1" count 9 instead of 8. 8 will be more accurate (8*170=1360). Maybe that's the reason why it doesn't work. This could mean a bug in the Python script.
You could also use the Excel converter the other member uploaded a few post earlier and see what's the result.

Then, after you have the binary sequence, this is just writter as base32 as a compression method to be less in length for the URL.

Have a look at it, check the Python script, and ask me if you need more detail.
Regards.
Gustavo.

GusPS
Normal user
Posts: 23
Joined: 28 Feb 2017, 15:59

Re: IR Transmitter ?

#79 Post by GusPS » 29 May 2017, 01:30

angelosub wrote: 28 May 2017, 21:32 I have don't understand extrapolate a RAW data from IR transmitter.
I have try to receive a IR code with a P016 plugin "Infrared Receiv - TSOP4838". In house I have TSOP4136 ad I have used this, the difference is the IR frequencies. TSOP4838 38kHz TSOP4136 36kHz. I hope isn't a problem.

When I push the on/off button of the IR transmitter the ESPEasy receive 2 codes HEX:
800ff and ffffffff

I don't understand how convert this HEX values to a RAW for sending the code with a ESPEasy.
http://<ip address>/control?cmd=IRSEND,RAW,code,kHZ,Pulse Len, Blank Len
kHZ = 38 It's correct?

thanks for help.
Hi angelusb,
You need to grab the PULSE and BLANK timings to be able to generate the RAW data.
To do this, I use the http://dangerousprototypes.com/docs/USB_Infrared_Toy
Other people use IRrecvDump for Arduino.
The P016 is not good to get the timings for unkown protocols.

After you have those values, you can use the Python script or the Excel sheet to generate de Base32 chars.

Let me know about any doubts.
Gustavo.

ged
Normal user
Posts: 10
Joined: 15 Oct 2016, 07:04

Re: IR Transmitter ?

#80 Post by ged » 30 May 2017, 18:22

I'm now struggling with this as well... Trying to get a Bionaire Space Heater to do my bidding.

I took a hack on the spreadsheet and added some code to do the Bin to Base32 in the sheet and used GCD to look for Pulse and Space... (my work is here: https://docs.google.com/spreadsheets/d/ ... AB3Kbq7vWU)

My data looks like this (captured from ESP8266 IRrecvDumpV2):
unsigned int rawData[47] = {1300,400, 1300,400, 450,1250, 1300,400, 1300,450, 450,1300, 450,1250, 450,1250, 450,1250, 1300,450, 450,1250, 450,7850, 1300,400, 1300,400, 450,1250, 1300,450, 1300,450, 450,1250, 450,1250, 450,1250, 450,1250, 1300,450, 450,1250, 450}; // UNKNOWN DE7C1C3
It's obvious that the pulse and space are all multiples of 50 (could that be the limit of timing resolution on the ESP8266?), GCD confirms that multiple for this data.
Pulse (Greatest Common Denominator) 50
Blank/Space GCD 50

Binary String 11111111111111111111111111000000001111111111111111111111111100000000111111111000000000000000000000000011111111111111111111111111000000001111111111111111111111111100000000011111111100000000000000000000000000111111111000000000000000000000000011111111100000000000000000000000001111111110000000000000000000000000111111111111111111111111110000000001111111110000000000000000000000000111111111000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000011111111111111111111111111000000001111111111111111111111111100000000111111111000000000000000000000000011111111111111111111111111000000000111111111111111111111111110000000001111111110000000000000000000000000111111111000000000000000000000000011111111100000000000000000000000001111111110000000000000000000000000111111111111111111111111110000000001111111110000000000000000000000000111111111
Binary String -> Base32 FVVVVO0VVVVVG1VS00003VVVVU07VVVVS07VG00007VG0000FV00000VU00001VVVVV01VS00003VO0000000000000000000000000000001VVVVV03VVVVU07VG0000FVVVVO0FVVVVO0FV00000VU00001VS00003VO00007VVVVS07VG0000FV
Path + Query String /control?cmd=IRSEND,RAW,FVVVVO0VVVVVG1VS00003VVVVU07VVVVS07VG00007VG0000FV00000VU00001VVVVV01VS00003VO0000000000000000000000000000001VVVVV03VVVVU07VG0000FVVVVO0FVVVVO0FV00000VU00001VS00003VO00007VVVVS07VG0000FV,38,50,50

Length < 2048 chars Should be ok (http says the max size of path+query string must be less than 2KB)
URL http://esp4/control?cmd=IRSEND,RAW,FVVV ... V,38,50,50
The trouble with this is the get request to the esp4 doesn't give a response, eventually curl times out. A smaller payload does go through and ESP2.0.0-dev8 echos back the binary string (so I know the bin2base32 code works okay).

Obviously, pulse and blank have to be bigger than 50 to result in a small enough payload that the ESP doesn't choke. Not really sure how to make to make them bigger without giving a float to the ESP for Pulse/Blank. How much fuzzing does IR typically tolerate for pulse/blank intervals? (+/- 25%?)
Last edited by ged on 30 May 2017, 19:22, edited 1 time in total.

Post Reply

Who is online

Users browsing this forum: Google [Bot] and 115 guests