BLYNK
HOME       📲 GETTING STARTED       📗 DOCS       ❓HELP CENTER       👉 SKETCH BUILDER

[SOLVED] Blynk + NEC Generic TV IR remote power ON/OFF


#1

Hi, Costas, many thanks for solving my last problem, i have shared everything on that issue and marked it as solved. Thinking more Generic, i am prepared to do the same with a NEC IR project, as before, this below code works but not with blynk, can you do your magic again and i will then share it for others to benefit, i must emphasis that i am trying hard to learn but i am a novice but willing to try and learn.

#include <ESP8266WiFi.h>
#include <BlynkSimpleEsp8266.h>
#include <IRremoteESP8266.h>

// You should get Auth Token in the Blynk App.
// Go to the Project Settings (nut icon).
char auth[] = "********************************";

// Your WiFi credentials.
// Set password to "" for open networks.
char ssid[] = "**********";
char pass[] = "**********";
char server[] = "************";

IRsend irsend(4); //an IR led is connected to GPIO pin 4 (D2)

void setup()
{
  irsend.begin();
  irsend.sendNEC(0X2FDE817, 32); // 32 bits, no repeat  
  Blynk.begin(auth, ssid, pass, server);
  // You can also specify server:
  //Blynk.begin(auth, ssid, pass, "blynk-cloud.com", 8442);
  //Blynk.begin(auth, ssid, pass, IPAddress(192,168,1,100), 8442);
}

void loop() {
  Blynk.run();

}


#2

Just set up a new button on V2.


#3

it is a different sketch for a different tv, is my code correct


#4

I know it’s a different TV.

Just do what you did for the Samsung as far as adding a button, it can be V1, V2 or whatever you like.

Paste in the NEC IR signal in the button code in place of the Samsung IR signal.


#5

thanks i understand now…yahhhhhhh


#6

could i edit the
unsigned int Samsung_power_toggle[71] = {0X2FDE817, 32};

to read
unsigned int NEC = {0X2FDE817, 32};

and change
irsend.sendGC(Samsung_power_toggle, 71);

to read
irsend.sendGC(NEC);


#7

All you need to do is comment out the unsigned int line and in the button code change:

irsend.sendGC(Samsung_power_toggle, 71);

to:

irsend.sendNEC(0X2FDE817, 32); // 32 bits, no repeat


#8

when you say comment out do you mean remove the
unsigned int line


#9

Yes, it’s not needed for the NEC.


#10

successssssssssss


#11

thanks costas, will share all later, just for your info, unlike the samsung code the app PUSH only needed quick push, the NEC code app PUSH needed hold longer, any ideas why that might be?

IGNORE THIS COMMENT

was bad wiring


#12

Solved again by Costas

Here is the working project

Download Github Library:-
IRremoteESP8266

code:-

#include <ESP8266WiFi.h>
#include <BlynkSimpleEsp8266.h>
#include <IRremoteESP8266.h>

// You should get Auth Token in the Blynk App.
// Go to the Project Settings (nut icon).
char auth[] = "********************************";

// Your WiFi credentials.
// Set password to "" for open networks.
char ssid[] = "**********";
char pass[] = "**********";
char server[] = "************";


IRsend irsend(4); //an IR emitter led is connected to GPIO pin 4 (D2)
void setup()
{
  irsend.begin();
  Serial.begin(115200, SERIAL_8N1, SERIAL_TX_ONLY);
  Blynk.begin(auth, ssid, pass, server);
  // You can also specify server:
  //Blynk.begin(auth, ssid, pass, "blynk-cloud.com", 8442);
  //Blynk.begin(auth, ssid, pass, IPAddress(192,168,1,100), 8442);
}
BLYNK_WRITE(V1){
  int onoff = param.asInt();
  if(onoff == 1){
    irsend.sendNEC(0X2FDE817, 32); // 32 bits, no repeat
 }
}
void loop() {
  Blynk.run();
  
}

Here is the QR Code for the simple PUSH button, (must be set to PUSH and not SWITCH

Hardware side:- I used a NODEMCU IR led connected to D2

OBVIOUSLY the IR LED must be pointing at the TV to work.


#13

one question, should i mark as solved or projects made with blynk


#14

You should mark this as solved and if you want you can open a new one with “made with blynk”.
Btw about your project, looks really cool ! Are you able to only turn your tv on and off or do you have the possibility of switching channels etc ?


#15

Hi, Thanks but credit goes to Costas for the solving of the code, at present it only serves as an ON/OFF switch.


#16

Hi, I’m new here, I have a doubt in this project, where do I see the schematic, for linking the wires?


#17

@joziel This wasn’t a project topic, rather a troubleshooting one.

As per the OP the pin he uses was determined on the sketch.

IRsend irsend(4); //an IR led is connected to GPIO pin 4 (D2) 

Google around for other full wiring options as they can vary depending on hardware used.


#18

Good evening, a project like this, I wanted the schematic of this project


#19

Hi I am the original poster of this project, sorry but there is not a schematic available, it was not posted as a project it was posted for help with some code that I was stuck on , I soldered up a custom circuit board for the hardware side of things which was quite basic using and ESP8266 chip with a 5v to 3.3 v voltage regulator, A transistor and an infrared LED .


#20

Hi, good evening, I’m behind a project so that I can delligate the TV through the space, will you have a basic material like this.
thank you for your attention