Hello there!
hoping someone can help me with solving a peculiar issue I am having with my home grown remote.
this code works - it turns the TV off, can control the volume on my TV, and also controls some RGB lights I have taped behind my TV - Only issue is, it wont turn the TV on!
TV Brand is sceptre (off brand found on Amazon)
I was able to discern the appropriate IR Codes using some other code, an IR sensor, the serial monitor and the remote provided with the TV.
I've searched pretty deep on the web to try to find my own answer, but I think my problem is a bit specific.
I am hopeful you can help, code below! - also, if you have any comments about how I could post, code, or really do anything better please feel free to share. I am an eager learner and receptive of criticism. I am happy to finally join this community!
#include <IRremote.h>
IRsend irsend;
int Button1 = A1;
int Button2 = A2;
int Button3 = A3;
int Button4 = A4;
int LED = 3;
int val = 0;
void setup() {
// put your setup code here, to run once:
inMode(Button1,INPUT);
pinMode(Button2,INPUT);
pinMode(Button3,INPUT);
pinMode(Button4,INPUT);
pinMode(LED,OUTPUT);
}
void loop() {
// put your main code here, to run repeatedly:
{if (analogRead(Button1)>900)irsend.sendNEC(0xFF02FD,32);
delay(100);}//RGB Strip On&off
{if (analogRead(Button2)>900){
for (int i = 0; i < 3; i++) {
irsend.sendSony(0xa90, 12); // Sony TV power code, send 3X
delay(100);
}}}
{if (analogRead(Button3)>900){
for (int i = 0; i < 3; i++) {
irsend.sendSony(0x490, 12); // Sony TV power Volume Up, send 3X
delay(100);
}}}
{if (analogRead(Button4)>900){
for (int i = 0; i < 3; i++) {
irsend.sendSony(0xc90, 12); // Sony TV power Volume Down, send 3X
delay(100);
}}}
delay(100);
}
Look up the bitpattern, or bitpattern sequence for turn the TV on.
Is this what you mean by bit pattern? if so - I'm very unsure of what to do with it...
Sceptre Power on/off
Ready to receive IR signals
Decoded Sony(2): Value:A90 Adrs:0 (12 bits)
Raw samples(26): Gap:3390
Head: m2410 s618
0:m1202 s606 1:m586 s614 2:m1198 s606 3:m594 s610
4:m1198 s606 5:m590 s614 6:m586 s614 7:m1198 s606
8:m594 s610 9:m586 s618 10:m590 s610 11:m590
Extent=19254
Mark min:586 max:1202
Space min:606 max:618
You are on to something basic and important by this
Head: //My guess is start
m 2410 s 618
0:m 1202 s 606 //Can this be the digit 0 ?
1:m 586 s 614 //Can this be the digit 1 ?
2:m 1198 s 606
3:m 594 s 610
4:m 1198 s 606
5:m 590 s 614
6:m 586 s 614
7:m 1198 s 606
8:m 594 s 610
9:m 586 s 618
10:m 590 s 610
11:m 590
Extent=19254
Mark min:586 max:1202
Space min:606 max:618
Note Mark resp. Space. I Think there are some misses. Mark ought to be larger than Space all the time. During the stoneage of computer science Mark resp. Space could be built by using 2 different frequencies. I don't remember this coding in detail. Maybe, maybe Mark is a tone and Space is silence.
However, the useful messages might be built from several digits. Lets say that "Turn on" is 1234 and Turn off is 4321.....
Hopefully some more knowing helper will finish his(her) sleep and step in.
In the mean time, how did You do to catch those figugures? Impressive anyway.
im happy to show the code - its not mine, but here it is below:
also - a walkthrough guide: Receiving and Decoding IR | Using an Infrared Library on Arduino | Adafruit Learning System
#include "IRLibAll.h"
//Create a receiver object to listen on pin 2
IRrecvPCI myReceiver(2);
//Create a decoder object
IRdecode myDecoder;
void setup() {
Serial.begin(9600);
delay(2000); while (!Serial); //delay for Leonardo
myReceiver.enableIRIn(); // Start the receiver
Serial.println(F("Ready to receive IR signals"));
}
void loop() {
//Continue looping until you get a complete signal received
if (myReceiver.getResults()) {
myDecoder.decode(); //Decode it
myDecoder.dumpResults(true); //Now print results. Use false for less detail
myReceiver.enableIRIn(); //Restart receiver
}
}
Well done!
To me it looks like You have been debugging/decoding an IR transmitter. Right?
Assuming I am right, could You decode the missing function "TV ON" pressing the "TV ON" on the remote?
I have never worked with things like this, not on this level but I have dealth with communication since 1985.
As I said, hopefully more knowing helpers will step in. Just wait for them to finish their sleep.
Thanks for the link. Here it is very late, time for early working people to get out of bed. I will go to bed....
In other words, I am getting very sleepy and I have no sharpness to explore Your link.
Let's wait for tomorow!
If the TV uses the same IR-code to turn on/off, and "off" works as expected, you may assume the right IR-code is sent.
When using the TV's remote control; do you have to press and hold on/off to turn it on?
If so, you have to send multiple on/off's to turn it on. Experiment with how many and the delay between them.