Props to pjnewman who has reverse engineered the Samsung remote control tcp protocol. I’ve written a Arduino function based on the perl/php scripts and it works fine with my STB-E7500. Guess it should also work with any other Samsung Smart TV or receiver.
This sketch reads a command from serial and sends it to your TV/receiver. You can try KEY_CHUP or KEY_CHDOWN for example, more commands are documented here.
/**
* Based on:
* http://forum.samygo.tv/viewtopic.php?f=12&t=1792
*
* You need the arduino base64 library:
* https://github.com/adamvr/arduino-base64
*/
#include <SPI.h>
#include <Ethernet.h>
#include <Base64.h>
char inbuf[100];
int inbufC = 0;
byte mac[] = { 0x0E, 0x0C, 0x29, 0x3E, 0xB1, 0x4F };
IPAddress server(192,168,178,22);
EthernetClient client;
void setup() {
Serial.begin(9600);
if (Ethernet.begin(mac) == 0) {
Serial.println("Failed to configure Ethernet using DHCP");
while (true) {}
}
Serial.println("Ready");
}
void loop() {
if (Serial.available() > 0) {
int inByte = Serial.read();
if (inByte == 13) {
inbuf[inbufC] = inByte;
inbuf[inbufC+1] = '\0';
inbufC = 0;
sendCmd(inbuf);
} else if (inbufC > 100) {
inbufC = 0;
} else {
inbuf[inbufC++] = inByte;
}
}
}
void sendCmd(char* cmd) {
if (client.connect(server, 55000)) {
uint8_t part1[] = {0,1,0,102,56,0,100,0,12,0,77,84,73,51,76,106,65,117,77,67,52,120,24,0,77,71,85,116,77,71,77,116,77,106,107,116,77,50,85,116,89,106,69,116,78,71,89,61,12,0,81,88,74,107,100,87,49,118,100,71,85,61,0,1,0,102,2,0,200,0,0,1,0,102,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0};
char text[100];
base64_encode(text,cmd,strlen(cmd)-1);
part1[74+0] = 5+strlen(text);
part1[74+5] = strlen(text);
for (int i = 0; i<strlen(text); i++) {
part1[74+7+i] = text[i];
}
client.write(part1,74+7+strlen(text));
client.stop();
}
}