[SOLVED] Blynk + IR SAMSUNG TV Remote Power ON/OFF

try this code, obviously change the gpio pin number for the esp8266 board you are using
in this line IRsend irsend(2); //an IR emitter led is connected to GPIO pin 2 (2)

#include <ESP8266WiFi.h>
#include <BlynkSimpleEsp8266.h>
#include <IRremoteESP8266.h>
#include <IRsend.h>  // Needed if you want to send IR commands.
#include <IRrecv.h>  // Needed if you want to receive IR commands.


char auth[] = "your token";

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

IRsend irsend(2); //an IR emitter led is connected to GPIO pin 2 (2)
void setup()
{
  irsend.begin();
  Serial.begin(115200, SERIAL_8N1, SERIAL_TX_ONLY);
  Blynk.begin(auth, ssid, pass);
  
}
BLYNK_WRITE(V1){
  int onoff = param.asInt();
  if(onoff == 1){
    irsend.sendSAMSUNG(0XE0E040BF, 32); // 32 bits, no repeat

}

}
void loop() {
  Blynk.run();
    
}
1 Like

i take it you are not using your own local server? if you are using your own local server then you need to add some more information to the code,

It work!!
Im using global blynk server.
If i want to use my ir code, how i replace :
irsend.sendSAMSUNG(0XE0E040BF, 32); // 32 bits, no repeat

IR code is this:
unsigned int unknown[23] = {1250,450, 1250,400, 450,1200, 1300,400, 1250,400, 450,1250, 400,1250, 450,1200, 450,1250, 400,1250, 450,1250, 1250}; // UNKNOWN A32AB931 32 bit

that explains why you couldn’t use the original code which was for using a local server.

is it a samsung tv? because if it is then go back to using the original code without the server added code.

Im trying to send IR codes to a Samsung TV, SONY muteki and a Peabody Heater(thats the “unknown” code) using blynk… only to control them with Google Assistant (thanks to IFTTT), i think i use multiple blynk virtual ports (V1 for TV power… and so…)

here is the original code less the local server bit.

#include <ESP8266WiFi.h>
#include <BlynkSimpleEsp8266.h>
#include <IRremoteESP8266.h>
#include <IRsend.h>  // Needed if you want to send IR commands.
#include <IRrecv.h>  // Needed if you want to receive IR commands.



// 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[] = "**********";


// Codes are in Global Cache format less the emitter ID and request ID. These codes can be found in GC's Control Tower database.

unsigned int Samsung_power_toggle[71] = {38000,1,1,170,170,20,63,20,63,20,63,20,20,20,20,20,20,20,20,20,20,20,63,20,63,20,63,20,20,20,20,20,20,20,20,20,20,20,20,20,63,20,20,20,20,20,20,20,20,20,20,20,20,20,63,20,20,20,63,20,63,20,63,20,63,20,63,20,63,20,1798};

IRsend irsend(2); //an IR emitter led is connected to GPIO pin 2 (2)
void setup()
{
  irsend.begin();
  Serial.begin(115200, SERIAL_8N1, SERIAL_TX_ONLY);
  Blynk.begin(auth, ssid, pass);
  // 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.sendGC(Samsung_power_toggle, 71);
 }
}
    void loop() {
     Blynk.run();
  
}

same error… something with “irsend.sendGC” comand…

the following turns my samsung tv on/off

unsigned int Samsung_power_toggle[71] = {38000,1,1,170,170,20,63,20,63,20,63,20,20,20,20,20,20,20,20,20,20,20,63,20,63,20,63,20,20,20,20,20,20,20,20,20,20,20,20,20,63,20,20,20,20,20,20,20,20,20,20,20,20,20,63,20,20,20,63,20,63,20,63,20,63,20,63,20,63,20,1798};

just remember to set the blynk button in th blynk app to a push and not switch

1 Like

A post was split to a new topic: I want to create a button to press eeprom function for 3 times eeprom, and 3 buttons to send IR