Unfortunately, it’s the only way I found. Got to the original thread and follow the github link for my TVvolume sample. Alexa is great with on/off while I’m having difficulty with numbers/ranges like I’m able to do with my LED’s — Alexa set my nightstand light to 1 — this sets it to 1% but Groovy/ST code is messing with me. You’re welcome to try fixing it as I give you an ATTEMPT in my TV Device where the HDMI selector is a range of 1 thru 4 — and I did it per the ST documented sample and in accordance to other samples — like my LED — but for some reason Alexa doesn’t like me
please let us all know if you’re able to fix ranges and Alexa.
@Casper did you have any success integrating temperature? I received the little temp component you quoted above and I keep getting weird numbers then I unplug it from the NodeMCU and I get the same-ish numbers
either I have a busted component or I’m doing something wrong:
int reading = 0;
reading = analogRead(tempPin);
Serial.print("-----");
Serial.print(reading);
Serial.print("-----");
Thanks!
Yes I was looking at deep sleep mode too, but it’s not really practical. For this project, we’re broadcasting a web server constantly, and that takes a lot of power, even if you shutdown the module for a certain time (during sleep or nobody home), you still need to run the server for few hours, so the battery might last few hours more…still a pain to change batteries
My bad I forgot to tell you to get the DHT22 instead, but what sketch are you using? Let me upload the sketch I use, it sends data to ThingSpeak every 5 min
Using my own/Google sketch where it just does a simple analogRead — it’s just super unreliable. I’ll look into the DHT22 and certainly would appreciate your sketch. Thanks buddy!!!
EDIT: to be fair a simple Google search should probably do it
there’s a DHT library that every sample seems to use for the DHT11 — I’ll give that a shot too.
Yes there’s a lot of examples on the internet, but these worked for me, you have 2 options:
-
This sketch pushes data to ThingSpeak, so make sure you create an account have have your Write API key ready.
-
This sketch broadcasts a webserver and the temp + hum will be queried when you load the website.
Make sure you connect the data of the sensor to GPIO4 (or D2) on NodeMCU, and change the this line:
DHT dht(DHTPIN, DHT22, 11);
to
DHT dht(DHTPIN, DHT11, 11);
Let me know.
I created a Virtual HTTP Switch Creator, will make the creation of virtual http device easier.
It’s been a long time for me waiting for universal IR controller that cheap 
right now, I was able to write code and upload it to nodemcu. The web server is accessible also.
But, the problem is with my infrared blaster, I;m not using IR module like yours, I’m using more simple IR module that seems like no other component on it, just IR LED.

So, I connect it to ground and D4 port, since at the board the vcc is not connected to anything. Just empty SMD resistor pad.
Connect ground to ground LED and D4 to positive LED, the led on my nodemcu is will turned ON solid.
With my phone camera, I didn’t see my IR LED is working. I use my own code and your code for your fan
Maybe @JZst can help me put, I saw you use IR LED only (not IR module)
Most of the newer phone camera filter off IR, that may be the reason you can’t see it.
Try go nearer to your IR device, like few inch or even nearer to test, without modification, the range is very short.
my camera phone still able to view all of my remote, but not with my nodemcu. So I think my infrared is not working yet
I test it with distance about 30-50 cm
Finally it works !!
The problem was my IR LED that not working, now I able to send command to my samsung tv.
I use sendRaw command just like OP’s
But I have a problem with my AC remote, the decoder say it’s Panasonic, actually it’s Sharp remote for my Sharp AC.
It looks like this :
Encoding : PANASONIC Code : 555A:F308B38C (48 bits) Timing[99]: +3800, -1950 + 500, - 500 + 500, -1450 + 500, - 500 + 500, -1450 + 500, - 500 + 500, -1450 + 500, - 500 + 500, -1450 + 500, - 500 + 500, -1450 + 500, - 500 + 500, -1450 + 500, -1450 + 500, - 500 + 500, -1450 + 500, - 500 + 500, -1450 + 500, -1450 + 500, -1450 + 500, -1450 + 500, - 500 + 500, - 500 + 500, -1450 + 500, -1450 + 500, - 500 + 500, - 500 + 500, - 500 + 500, - 500 + 500, -1450 + 500, - 500 + 500, - 500 + 500, - 500 + 500, -1450 + 500, - 500 + 500, -1450 + 500, -1450 + 500, - 500 + 500, - 500 + 500, -1450 + 500, -1450 + 500, -1450 + 500, - 500 + 500, - 500 + 500, - 500 + 500, -1450 + 500, -1450 + 500, - 500 + 500, - 500 + 500 unsigned int rawData[99] = {3800,1950, 500,500, 500,1450, 500,500, 500,1450, 500,500, 500,1450, 500,500, 500,1450, 500,500, 500,1450, 500,500, 500,1450, 500,1450, 500,500, 500,1450, 500,500, 500,1450, 500,1450, 500,1450, 500,1450, 500,500, 500,500, 500,1450, 500,1450, 500,500, 500,500, 500,500, 500,500, 500,1450, 500,500, 500,500, 500,500, 500,1450, 500,500, 500,1450, 500,1450, 500,500, 500,500, 500,1450, 500,1450, 500,1450, 500,500, 500,500, 500,500, 500,1450, 500,1450, 500,500, 500,500, 500}; // PANASONIC 555A:F308B38C unsigned int addr = 0x555A; unsigned int data = 0xF308B38C;
I write
> unsigned int tempup[99] = {3800,1950, 500,500, 500,1450, 500,500, 500,1450, 500,500, 500,1450, 500,500, 500,1450, 500,500, 500,1450, 500,500, 500,1450, 500,1450, 500,500, 500,1450, 500,500, 500,1450, 500,1450, 500,1450, 500,1450, 500,500, 500,500, 500,1450, 500,1450, 500,500, 500,500, 500,500, 500,500, 500,1450, 500,500, 500,500, 500,500, 500,1450, 500,500, 500,1450, 500,1450, 500,500, 500,500, 500,1450, 500,1450, 500,1450, 500,500, 500,500, 500,500, 500,1450, 500,1450, 500,500, 500,500, 500}; // PANASONIC 555A:F308B38C >irsend.sendPanasonic(0x555A,0xF308B38C);
I also try with sendSharp and sendSharpRaw
but it’s not working
anyone know how to do ?
Did you try it with sendRaw? I personally use sendRaw for everything despite what IR dump says about encoding.
Yes I did, here what I wrote
unsigned int ACon[99] = {3800,1950, 500,500, 500,1450, 500,500, 500,1450, 500,500, 500,1450, 500,500, 500,1450, 500,500, 500,1450, 500,500, 500,1450, 500,1450, 500,500, 500,1450, 500,500, 500,1450, 500,1450, 500,1450, 500,1450, 500,500, 500,500, 500,1450, 500,1450, 500,500, 500,500, 500,500, 500,500, 500,1450, 500,500, 500,500, 500,500, 500,500, 500,500, 500,1450, 500,1450, 500,500, 500,500, 500,1450, 500,1450, 500,1450, 500,500, 500,500, 500,500, 500,1450, 500,500, 500,500, 500,500, 500}; // PANASONIC 555A:F3083388
irsend.sendRaw(ACon, 99, 38);
just like yours. Should this also work on any encoding type ?
because I see from the IR dump, the Panasonic is different with Samsung
The difference I saw is Panasonic has unsigned int addr
I also see in the library says there’s different method of irsend for different brand
void sendRaw(unsigned int buf[], int len, int hz);
void sendPanasonic(unsigned int address, unsigned long data);
Since Panasonic have a addr value, I thought it should be used
Send raw doesn’t care abt the encoding type.
still not working
when I see the led indicator, it seems the remote is sending more code then encoder can receive, is this possible ?
I can think of 2 reasons why it’s not working: the IR code isn’t correct, or the IR module cannot handle the range to your AC, or both.
First, check if the IR code is correct by dumping IR codes several times and see which value has the most hits.
Second, try to put the IR led closer to the AC.
Yes you are right, some my device is work when I put infrared really close, about 30cm, some of my TV work with 2 meters range.
The problem that not solved yet is with the remote that have address. In this case is Panasonic AC.
I have three AC remote
- Panasonic AC with IR encoding type is UNKNOWN and 32 bit. It’s working with sendRaw command, with several different hz value, it still working
irsend.sendRaw(tup, 99, 30); irsend.sendRaw(tdown, 99, 48);
- Sharp AC with IR encoding type is Panasonic and 48 bit with address and data
- Panasonic AC with IR encoding type is Panasonic and 48 bit with address and data
Both of them still not working. All of my another device that not have address and not 48 bit is working. Samsung, NEC, UNKNOWN, all of them is 32 bit and it’s working
I found this
http://arduinostuff.jimdo.com/home/remote/ir-codes/
He tell there’s a limitation of library that can’t handle more than 32 bit data.
And have different way to send (transmit) IR data.
In my library from this post is
void sendPanasonic(unsigned int address, unsigned long data);
and from that blog post he use
void sendPanasonic(unsigned long data1, unsigned long data2, int nbits);
Is that true that the problem is with the library that can’t handle 48 bit data ?
Check this, try to increase the RAWBUF limit. It work on some AC.
Voila !
Finally it works !
Thanks to you @CSC and of course @Casper for this thread.
It was true, it’s not because how to send IR code, but how to receive original code. With previous library it can’t handle long IR data, limit to 99 timings. It makes me transmit wrong IR code that device wouldn’t understand, because the IR data I receive was incomplete.
With the explanation and sketch from this blog post ( Air Conditioner Record long Infrared Remote control signals - Arduino ) we can receive long IR code.
Here’s the direct sketch you can copy
→ https://www.analysir.com/blog/wp-content/uploads/2014/03/Arduino_Record_Long_AirConditioner_Infrared_Signals_10.txt
you only need to change the GPIO port at line 38
attachInterrupt(0, rxIR_Interrupt_Handler, CHANGE);//set up ISR for receiving IR signal
zero is GPIO0
with that sketch you will receive only raw data (that’s all you need)
the problem is you will get negative value, that can’t be used when sending IR code
so you need to erase line 54 or just add comment to it
line 54 :
if (!(i & 0x1)) Serial.print(F("-"));
this will add negative mark on raw data that we need to erase
the end result will be like this
Raw: (211) 3765, 1908, 455, 486, 455, 1455, 433, 486, 453, 1457, 433, 485, 453, 1457, 433, 485, 454, 1435, 455, 485, 453, 1434, 456, 485, 454, 1457, 432, 1455, 434, 484, 454, 1436, 453, 486, 454, 1457, 432, 1456, 432, 1434, 453, 1457, 432, 486, 455, 486, 455, 1433, 454, 1456, 432, 487, 454, 486, 454, 486, 455, 484, 456, 1455, 433, 485, 455, 486, 455, 484, 456, 1456, 432, 1456, 433, 1432, 459, 1452, 433, 485, 455, 486, 455, 1455, 433, 1455, 434, 1431, 457, 486, 454, 486, 454, 485, 455, 485, 456, 1455, 433, 485, 455, 485, 456, 485, 455, 1455, 433, 484, 456, 485, 456, 1455, 434, 1454, 433, 1456, 433, 485, 456, 484, 455, 485, 456, 485, 455, 484, 457, 484, 455, 486, 455, 485, 455, 484, 456, 483, 458, 486, 454, 507, 433, 1433, 456, 484, 456, 484, 456, 484, 456, 485, 456, 485, 455, 485, 456, 484, 455, 485, 456, 484, 456, 486, 454, 508, 433, 1455, 433, 487, 454, 485, 455, 486, 454, 487, 453, 486, 455, 485, 454, 508, 433, 485, 455, 488, 453, 485, 455, 486, 457, 483, 456, 1455, 436, 1452, 437, 1430, 458, 1451, 437, 1452, 436, 482, 460, 481, 458, 481, 460, 480, 461, 1451, 436, 1452, 437, 481, 460,
and send it use sendRaw command
unsigned int acoff[211] = {3777, 1901, 460, 479, 462, 1429, 459, 479, 461, 1429, 459, 480, 461, 1428, 460, 479, 462, 1427, 461, 479, 460, 1430, 459, 479, 462, 1428, 460, 1431, 457, 479, 462, 1429, 459, 478, 462, 1429, 459, 1431, 457, 1430, 458, 1429, 459, 480, 461, 479, 461, 1428, 461, 1428, 459, 480, 461, 479, 461, 480, 460, 480, 461, 1430, 458, 479, 461, 480, 461, 479, 461, 1430, 459, 1426, 462, 1429, 459, 1429, 459, 479, 461, 480, 461, 1428, 460, 1428, 461, 1429, 458, 480, 461, 479, 460, 480, 461, 480, 461, 1427, 461, 479, 461, 479, 462, 478, 462, 1427, 461, 479, 462, 478, 461, 1430, 459, 1429, 459, 1428, 460, 480, 461, 479, 461, 479, 462, 478, 462, 479, 461, 479, 461, 479, 461, 479, 461, 480, 461, 479, 461, 479, 462, 479, 461, 1429, 459, 480, 464, 476, 462, 478, 461, 479, 461, 479, 462, 479, 461, 479, 461, 480, 461, 479, 461, 479, 461, 479, 461, 1429, 460, 479, 462, 479, 461, 479, 461, 479, 461, 479, 462, 478, 462, 478, 462, 479, 461, 479, 462, 479, 461, 479, 461, 479, 461, 1429, 460, 1428, 460, 1428, 460, 1428, 460, 1428, 460, 480, 461, 479, 461, 479, 461, 480, 461, 1429, 459, 1429, 460, 478, 462};
irsend.sendRaw(acoff, 211, 38);
Now I’m interested to add temperature sensor on it
Howdy @JZst, I wanna follow up on this DHT sensors project of yours, is there any update? or are you able to integrate it into ST yet? I’ve collecting Temp and Humi data ever since but still not able to make it a ST device.
My smart fan project would complete if ST can read the data from DHT sensor and trigger the fan 