Comments (21)
I figured out the problem. Here is the (workaround):
- Sony expects the code to be sent 3 times. So, sending it 3 times and pausing about 40ms (using delay(40);) fixed the problem for me. Now the Sony TV responds.
In addition, if someone knows about guidelines which devices need repeated transmit like this, how many times and at what interval, please let us know.
And Mark, thank you for contributing this valuable library.
Cheers,
Jordan
from irremoteesp8266.
I had send it three times, But still not working.
sendSony works fine on UNO.
Compare two version's differences.
in Arduino-IRRemote
void IRsend::sendSony (unsigned long data, int nbits){
// Set IR carrier frequency
enableIROut(40);
// Header
mark(SONY_HDR_MARK);
space(SONY_HDR_SPACE);
// Data
for (unsigned long mask = 1UL << (nbits - 1); mask; mask >>= 1) {
if (data & mask) {
mark(SONY_ONE_MARK);
space(SONY_HDR_SPACE);
} else {
mark(SONY_ZERO_MARK);
space(SONY_HDR_SPACE);
}
}
// We will have ended with LED off
}
IRremoteESP8266
void IRsend::sendSony(unsigned long data, int nbits) {
// Set IR carrier frequency
enableIROut(40);
// Header
mark(SONY_HDR_MARK);
// Data
for (unsigned long mask = 1UL << (nbits - 1); mask; mask >>= 1) {
if (data & mask) { // 1
mark(SONY_ONE_MARK);
space(SONY_HDR_SPACE);
} else { // 0
mark(SONY_ZERO_MARK);
space(SONY_HDR_SPACE);
}
}
// Footer
}
Does that space needed after mark in header setction?
It makes no different when adding it in, still not working.
from irremoteesp8266.
Please try out the code at the pull request 1 marcosamarinho/IRremoteESP8266 that I made many changes including sony, note that this code already send more than I time , them you not need loop anymore.
from irremoteesp8266.
Thanks - this helped me get sending to a Sony amplifier working from an ESP8266. Keep up the good work!
from irremoteesp8266.
@GabeHC Is correct. There was a missing space() after the initial header mark(). I've added it.
Can someone with a Sony device please confirm this addresses the issue?
from irremoteesp8266.
I updated my library on Arduino IDE but still no luck getting my Sony AMP to work. Tried single "irsend.sendSony(0x240C, 15);" and triple using delay 40 and nothing... Any ideas ? I don't know if a simple download from the main page is what I was supposed to test or not... pls advice.
from irremoteesp8266.
@MopheusDG Yes, a simple download per the instructions on the main page should be fine. Is your setup working with other devices at all? If not, try using a digital camera (on a phone etc) to see if you can see the IR LED is flashing when you send a signal.
Have you checked what IR code your existing remote is sending via one of the decoding or dumping programs?
from irremoteesp8266.
Hi @crankyoldgit , Yes, I followed the main page instructions, I have 2 RAW devices working and a Samsung TV, but no luck with my Sony Amplifier. Tested the IR Led is flashing ok when sending Sony so that's not the problem.
I'm attaching my dumping codes just in case I'm missing something:
ON/OFF:
Detected as SONY: 540C(15 bits)
Raw (32): -3858 2350 -600 1200 -550 650 -550 1200 -550 600 -600 1200 -550 600 -600 600 -600 550 -600 600 -600 600 -550 600 -600 1200 -550 1250 -550 600 -550 600
My Send Code for that one is:
irsend.sendSony(0x540C, 15);
Please let me know if you see something off, and thanks for your help !
By the way, I'm also having some weird problem when trying to send 2 or 3 times VOLUME UP in my Samsung TV, not sure why if I repeat the same IRSEND code 3 times, it's not working, even if I add some delay in the middle, still only 1 of the IRSENDs goes out for the TV. Is this normal ? Am I missing something there too ?
Thanks.
from irremoteesp8266.
Re: the repeating problem. Yes, there should be a delay after each command is sent. See https://github.com/markszabo/IRremoteESP8266/blob/master/IRremoteESP8266.cpp#L644 Currently the irsend routines do not enforce this. It's something I want to add but finding the info for each protocol is a fair bit of work. Depending on the protocol, I'd guess you should approx delay(40) or so before beginning the next IR command/packet transmission.
If you do find out from a datasheet or similar, what the minimum sequence length is for your protocols, please let us know, as I think we should support it.
Now, to the Sony problem. I've rechecked the code, it appears to be functionally identical to the Arduino IRremote library we are based off. (e.g. http://www.sbprojects.com/knowledge/ir/sirc.php)
Are you able to use another ESP8266 or Arduino board with an IR decoder/raw dump to read what the ESP is sending at all?
Details on the SONY protocol seem to be here:
http://www.sbprojects.com/knowledge/ir/sirc.php
I note that that page says it sends the LSB first, where we(IRremote) seem to be sending the MSB first which has me scratching my head.
I hand decoded the raw data you presented, it indeed decodes to 0x540C/B101010000001100. AFAICT, that's what we should be transmitting too.
I've visually inspected another implementation of the Sony IR protocol, and it seems we have it correct.
Are you transmitting the code 3 times in sequence, with a delay(40) between each? Some references say sony devices need to have the code repeated at least 3 times.
from irremoteesp8266.
I have an Arduino and the ESP, let me do some more testing... I'm gonna try using RAW mode too. When I first started this project I was using an Arduino and Sony using RAW (Didn't know about SendSONY at the time), so, gonna do some more testing an get back to you guys.
Thanks a lot for your help.
from irremoteesp8266.
Thanks. Looking forward to your results. I'd like to get to the bottom of the Sony issue and fix what ever needs done to get it working etc.
from irremoteesp8266.
Ok. This are my findings so far. 1) I found a problem on my RAW Codes from SONY cause my receiver was only 38 hz, so looked for std one's on the LIRC DB. Now, in Arduino UNO works perfectly using CODE + Delay 40 (3 times). So that's for sure, I need to send it 3 times.
Now tested the same on ESP8266 but there's still some problem, and I think it's related to something on my code ? Not sure... this is what I'm doing:
Created a Switch CASE for Fauxmo On Message based on device_id, so far.. works on everything except when I want to send MORE than 1 send on the same CASE... like this:
case 2: // 'TV ESPN'
irsend.sendSAMSUNG(0xE0E020DF, 32); // This is remote #1
Serial.println("PARTE 1");
delay(500);
irsend.sendSAMSUNG(0xE0E030CF, 32); // This is remote #7
Serial.println("PARTE 2");
break;
I tested on Samsung after not having luck with Sony, just to see if my TV that works fine on other cases, can handle 2 irsend lines, but for some reason, that code gives me:
PARTE1
PARTE2
on the monitor, but only send a #7 on my TV ! It's driving me crazy.... and I think that's why SONY is not working too, only the first send works probably. Any ideas ? I tried using brackets, using a FOR inside the case, changing DELAY time... I have no more ideas.
from irremoteesp8266.
I think a found the problem #2, I was handling the irsends inside the onmessage code of fauxmo, I moved it to the Loop and I think it's working now. Sony needs to be send 3 times.
from irremoteesp8266.
Okay. So to summarise, the library's sendSony() works as intended, but for a Sony device to accept the code/command, the IR code has to be sent 3 times in total, with a small delay between them.
e.g. A sequence of the following should work:
irsend.sendSony(0x540C, 15);
delay(40);
irsend.sendSony(0x540C, 15);
delay(40);
irsend.sendSony(0x540C, 15);
Obviously, that's not how we'd implement it, but is that correct summation of your results?
I want to confirm before I make the changes to the lib.
from irremoteesp8266.
That is correct. At least on my Sony AMP only sending 3 times with delay works. Be aware that same goes for the Arduino Library, at least on my case, I also have to send 3 times on Arduino (both libraries are the same, right ?), so that was expected too.
Thanks for your help.
from irremoteesp8266.
I'm glad there was nothing 'wrong' with the code, because I sure couldn't see it.
Unfortunately, lots of existing code that uses us will expect the current behaviour, but I'll add some notes and an easy method to invoke it the correct number of times.
from irremoteesp8266.
That's great. What really got me lost was Sony using 40 hz instead of 38 hz, cause most of the standard IR Receivers work only 38 hz, with senders can do anything in most cases. So when I started the project, captured all my devices, some Samsungs, some Unknown and Sony got in as Unknown because of that, and didn't realize. Then when I found the problem, searched the LIRC DB for Sony and found some matching codes from other Sony's, but again not working.... and finally, remembered what someone said before about the 3 times, and that was it.
Maybe explaining that (in good English) could help other ppl with same problem. By the way, I also learn (that I didn't know) that sometimes you have "codes" for specific functions on TV's or whathever, that are NOT in the actual remote. For example, my TV Remote does not have a HDMI button, just SOURCE that switches between all sources, playing around with the codes found a code, that will do TV/HDMI switching, ignoring the rest of the sources, and that's pretty usefull for my Alexa project. So, that could be a nice help for someppl, again, explained better probably :)
from irremoteesp8266.
With that commit, I think I can close this issue.
from irremoteesp8266.
Encoding : SONY
Code : 240C (15 bits)
Timing[31]:
+2450, - 550 + 700, - 550 +1300, - 550 + 650, - 550
+ 650, - 600 +1300, - 550 + 700, - 550 + 700, - 550
+ 700, - 550 + 700, - 550 + 700, - 550 + 700, - 550
+1250, - 550 +1250, - 600 + 700, - 550 + 700
unsigned int rawData[31] = {2450,550, 700,550, 1300,550, 650,550, 650,600, 1300,550, 700,550, 700,550, 700,550, 700,550, 700,550, 700,550, 1250,550, 1250,600, 700,550, 700}; // SONY 240C
unsigned int data = 0x240C;
I cant transmit and tried 3 times...
irsend.sendSony(dondur , pirbit.toInt());
delay(40);
irsend.sendSony(dondur , pirbit.toInt());
delay(40);
irsend.sendSony(dondur , pirbit.toInt());
Any suggestion?
from irremoteesp8266.
@kiralikbeyin Please open a new issue if you are having a problem with sendSony.
Things you should include in the new issue:
Are you using a version of the library post #101? e.g. the latest/current master.
As of #101 you shouldn't need the delay(40)'s in your code. That's now done in sendSony().
Also, what is your above decode from? i.e. Is it of your physical remote, or from your ESP8266?
More info is the best way for us to be able to help you.
from irremoteesp8266.
#118 ok
from irremoteesp8266.
Related Issues (20)
- DECODE_HASH should get its own protocol type HOT 9
- IRremoteESP8266 library compile error bk7231t HOT 2
- USB CDC must be enabled on ESP32S3 in order to receive infrared signals correctly. HOT 1
- Fails to detect Hitachi AC Remote. Sending raw data also does not work HOT 9
- Need help for Panasonic Remote Control N2QAYB000354
- The IT Receiver sensor (SM0038) is receiving signals and reporting values even when not pressing any button in the remote.
- Carrier AC 84bit HOT 2
- Does this library support for OnePlus TV , realme TV and Mi TV remote. HOT 1
- Problem with Zanussi A/C HOT 7
- IRHaierAC160 light toggle only working every 2nd time
- Unable to include C libraries HOT 3
- How to get or find CarrierAc 32 bit protocol? HOT 1
- Common AC Control - Swing turn on HOT 1
- Toshiba AC Remote Control B Support HOT 1
- Feature Request: De'Longhi Pinguino PAC N82 ECO IR Protocol HOT 5
- DAIKIN IRHVAC Off Issue. HOT 1
- The implementation and declaration of some functions differs from the function call HOT 4
- Coolix protocol "fan only mode" sends "dry mode" command instead HOT 1
- Support for Carrier RG56CMI-WRAC1 HOT 1
- Got error messages in Arduino IDE v3.0.1(ESP32C3) something like timerAlarm or void gpio_intr() HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from irremoteesp8266.