Attempting to get an IR transmitter to recreate codes from a Fujitsu Air Unit Remote AR-RCF1U
Using IRrecvDump on an Arduino Uno R3 to get codes produced by original remote
#include <IRremote.h>
#include <SPI.h>
#include <Wire.h>
#include <LiquidCrystal_I2C.h>
LiquidCrystal_I2C lcd(0x27,20,4); // set the LCD address to 0x27 for a 16 chars and 2 line display
int recvPin = 3;
IRrecv irrecv(recvPin);
void setup()
{
Serial.begin(9600); // Status message will be sent to PC at 9600 baud
irrecv.enableIRIn(); // Start the receiver
lcd.init(); // initialize the lcd
lcd.backlight();
lcd.setCursor(3,0);
lcd.print("Hello, world!");
lcd.setCursor(0,2);
lcd.print("Waiting 4 IR signal");
}
void loop()
{
decode_results results; // Somewhere to store the results
if (irrecv.decode(&results))
{
dumpInfo(&results); // Output the results
dumpRaw(&results); // Output the results in RAW format
dumpCode(&results); // Output the results as source code
Serial.println(""); // Blank line between entries
irrecv.resume(); // Prepare for the next value
}
delay(100);
}
void ircode(decode_results *results)
{
lcd.setCursor(0, 2); //
lcd.print("Code: ");
// Panasonic has an Address
if (results->decode_type == PANASONIC)
{
Serial.print(results->address, HEX);
Serial.print(":");
lcd.print(results->address, HEX);
lcd.print(":");
}
// Print Code
Serial.print(results->value, HEX);
lcd.print(results->value, HEX);
}
void encoding(decode_results *results)
{
switch (results->decode_type)
{
default:
case UNKNOWN: Serial.print("UNKNOWN"); lcd.setCursor(0, 1); lcd.print("Encoding: UNKNOWN"); break;
case NEC: Serial.print("NEC"); lcd.setCursor(0, 1); lcd.print("Encoding: NEC"); break;
case SONY: Serial.print("SONY"); lcd.setCursor(0, 1); lcd.print("Encoding: SONY"); break;
case RC5: Serial.print("RC5"); lcd.setCursor(0, 1); lcd.print("Encoding: RC5"); break;
case RC6: Serial.print("RC6"); lcd.setCursor(0, 1); lcd.print("Encoding: RC6"); break;
// case DISH: Serial.print("DISH"); break ;
case SHARP: Serial.print("SHARP"); lcd.setCursor(0, 1); lcd.print("Encoding: SHARP"); break;
case JVC: Serial.print("JVC"); lcd.setCursor(0, 1); lcd.print("Encoding: JVC"); break;
// case SANYO: Serial.print("SANYO"); break ;
// case MITSUBISHI: Serial.print("MITSUBISHI"); break ;
case SAMSUNG: Serial.print("SAMSUNG"); lcd.setCursor(0, 1); lcd.print("Encoding: SAMSUNG"); break;
case LG: Serial.print("LG"); lcd.setCursor(0, 1); lcd.print("Encoding: LG"); break;
case WHYNTER: Serial.print("WHYNTER"); lcd.setCursor(0, 1); lcd.print("Encoding: WHYHTER"); break;
// case AIWA_RC_T501: Serial.print("AIWA_RC_T501"); break ;
case PANASONIC: Serial.print("PANASONIC"); lcd.setCursor(0, 1); lcd.print("Encoding: PANASONIC"); break;
case DENON: Serial.print("Denon"); lcd.setCursor(0, 1); lcd.print("Encoding: Denon"); break;
}
}
void dumpInfo(decode_results *results)
{
// Check if the buffer overflowed
if (results->overflow)
{
Serial.println("IR code too long. Edit IRremoteInt.h and increase RAWBUF");
return;
}
// Show Encoding standard
Serial.print("Encoding : ");
encoding(results);
Serial.println("");
lcd.clear();
lcd.setCursor(3, 0); //
lcd.print("IR Signal Read");
// Show Code & length
Serial.print("Code : ");
ircode(results);
Serial.print(" (");
Serial.print(results->bits, DEC);
Serial.println(" bits)");
}
void dumpRaw(decode_results *results)
{
// Print Raw data
Serial.print("Timing[");
Serial.print(results->rawlen-1, DEC);
Serial.println("]: ");
lcd.setCursor(0, 3); //
lcd.print("Timing: ");
lcd.print(results->rawlen-1, DEC);
for (int i = 1; i < results->rawlen; i++)
{
unsigned long x = results->rawbuf[i] * USECPERTICK;
if (!(i & 1))
{ // even
Serial.print("-");
if (x < 1000) Serial.print(" ") ;
if (x < 100) Serial.print(" ") ;
Serial.print(x, DEC);
}
else
{ // odd
Serial.print(" ");
Serial.print("+");
if (x < 1000) Serial.print(" ") ;
if (x < 100) Serial.print(" ") ;
Serial.print(x, DEC);
if (i < results->rawlen-1) Serial.print(", "); //',' not needed for last one
}
if (!(i % 8)) Serial.println("");
}
Serial.println(""); // Newline
}
void dumpCode(decode_results *results)
{
// Start declaration
Serial.print("unsigned int "); // variable type
Serial.print("rawData["); // array name
Serial.print(results->rawlen - 1, DEC); // array size
Serial.print("] = {"); // Start declaration
// Dump data
for (int i = 1; i < results->rawlen; i++)
{
Serial.print(results->rawbuf[i] * USECPERTICK, DEC);
if ( i < results->rawlen-1 ) Serial.print(","); // ',' not needed on last one
if (!(i & 1)) Serial.print(" ");
}
// End declaration
Serial.print("};"); //
// Comment
Serial.print(" // ");
encoding(results);
Serial.print(" ");
ircode(results);
// Newline
Serial.println("");
// Now dump "known" codes
if (results->decode_type != UNKNOWN)
{
// Some protocols have an address
if (results->decode_type == PANASONIC)
{
Serial.print("unsigned int addr = 0x");
Serial.print(results->address, HEX);
Serial.println(";");
}
// All protocols have data
Serial.print("unsigned int data = 0x");
Serial.print(results->value, HEX);
Serial.println(";");
}
}
Get the following in the Serial output pressing:
Power On Auto[Mode: Auto|Cool|Dry|Fan|Heat] 72 Auto[Fan: Auto|High|Med|Low|Quiet]
Encoding : PANASONIC
Code : 2002:60008087 (48 bits)
Timing[111]:
+3200, -1600 + 450, - 350 + 450, - 350 + 450, -1200
+ 400, - 350 + 450, -1200 + 400, - 400 + 400, - 350
+ 450, - 400 + 400, -1200 + 450, -1150 + 450, - 350
+ 450, - 350 + 450, - 350 + 450, -1200 + 400, -1200
+ 400, - 400 + 400, - 400 + 400, - 400 + 400, - 400
+ 400, - 400 + 400, - 400 + 400, - 400 + 400, - 400
+ 400, - 400 + 400, - 400 + 450, - 350 + 450, - 400
+ 400, - 400 + 400, -1200 + 400, - 400 + 400, - 400
+ 400, - 400 + 400, - 400 + 400, - 400 + 400, - 400
+ 400, - 400 + 400, -1200 + 450, - 350 + 450, - 350
+ 450, - 400 + 400, - 400 + 400, -1200 + 400, -1200
+ 400, -1200 + 400, -1200 + 400, -1200 + 450, -1150
+ 450, -1200 + 400, -1200 + 400, - 400 + 400, - 400
+ 400, -1200 + 400, - 400 + 400, - 400 + 400
unsigned int rawData[111] = {3200,1600, 450,350, 450,350, 450,1200, 400,350, 450,1200, 400,400, 400,350, 450,400, 400,1200, 450,1150, 450,350, 450,350, 450,350, 450,1200, 400,1200, 400,400, 400,400, 400,400, 400,400, 400,400, 400,400, 400,400, 400,400, 400,400, 400,400, 450,350, 450,400, 400,400, 400,1200, 400,400, 400,400, 400,400, 400,400, 400,400, 400,400, 400,400, 400,1200, 450,350, 450,350, 450,400, 400,400, 400,1200, 400,1200, 400,1200, 400,1200, 400,1200, 450,1150, 450,1200, 400,1200, 400,400, 400,400, 400,1200, 400,400, 400,400, 400}; // PANASONIC 2002:60008087
unsigned int addr = 0x2002;
unsigned int data = 0x60008087;
Power Off
Encoding : PANASONIC
Code : 2002:60008084 (48 bits)
Timing[111]:
+3200, -1600 + 450, - 350 + 450, - 350 + 450, -1150
+ 450, - 350 + 450, -1200 + 400, - 350 + 450, - 350
+ 450, - 350 + 450, -1200 + 400, -1200 + 450, - 300
+ 500, - 350 + 450, - 350 + 450, -1150 + 450, -1200
+ 400, - 350 + 450, - 350 + 450, - 350 + 450, - 400
+ 400, - 400 + 400, - 400 + 450, - 300 + 450, - 400
+ 400, - 400 + 450, - 350 + 450, - 350 + 450, - 350
+ 450, - 350 + 450, -1200 + 400, - 300 + 500, - 400
+ 400, - 400 + 400, - 400 + 400, - 400 + 400, - 400
+ 400, - 400 + 400, -1200 + 400, - 350 + 450, - 400
+ 450, - 350 + 450, - 350 + 450, -1200 + 400, - 400
+ 400, - 400 + 400, - 400 + 400, - 400 + 400, - 400
+ 400, - 400 + 400, -1200 + 400, - 400 + 400, -1200
+ 450, -1150 + 450, -1200 + 400, -1200 + 400
unsigned int rawData[111] = {3200,1600, 450,350, 450,350, 450,1150, 450,350, 450,1200, 400,350, 450,350, 450,350, 450,1200, 400,1200, 450,300, 500,350, 450,350, 450,1150, 450,1200, 400,350, 450,350, 450,350, 450,400, 400,400, 400,400, 450,300, 450,400, 400,400, 450,350, 450,350, 450,350, 450,350, 450,1200, 400,300, 500,400, 400,400, 400,400, 400,400, 400,400, 400,400, 400,1200, 400,350, 450,400, 450,350, 450,350, 450,1200, 400,400, 400,400, 400,400, 400,400, 400,400, 400,400, 400,1200, 400,400, 400,1200, 450,1150, 450,1200, 400,1200, 400}; // PANASONIC 2002:60008084
unsigned int addr = 0x2002;
unsigned int data = 0x60008084;
Auto[Mode: Auto|Cool|Dry|Fan|Heat] 74 Auto[Fan: Auto|High|Med|Low|Quiet]
Encoding : PANASONIC
Code : 2002:60008087 (48 bits)
Timing[111]:
+3200, -1650 + 400, - 400 + 400, - 400 + 400, -1200
+ 400, - 400 + 400, -1200 + 400, - 400 + 400, - 400
+ 400, - 450 + 350, -1250 + 350, -1250 + 400, - 400
+ 400, - 400 + 400, - 350 + 450, -1200 + 400, -1200
+ 400, - 400 + 400, - 400 + 400, - 400 + 400, - 400
+ 400, - 400 + 400, - 450 + 350, - 400 + 400, - 450
+ 400, - 400 + 400, - 400 + 400, - 400 + 400, - 400
+ 400, - 400 + 400, -1200 + 400, - 400 + 400, - 400
+ 400, - 400 + 400, - 400 + 400, - 400 + 400, - 450
+ 350, - 450 + 350, -1250 + 350, - 450 + 400, - 400
+ 400, - 400 + 400, - 400 + 400, -1200 + 400, -1200
+ 450, -1200 + 350, -1250 + 350, -1250 + 400, -1200
+ 400, -1200 + 400, -1200 + 450, - 350 + 400, - 400
+ 400, -1250 + 400, - 400 + 350, - 450 + 350
unsigned int rawData[111] = {3200,1650, 400,400, 400,400, 400,1200, 400,400, 400,1200, 400,400, 400,400, 400,450, 350,1250, 350,1250, 400,400, 400,400, 400,350, 450,1200, 400,1200, 400,400, 400,400, 400,400, 400,400, 400,400, 400,450, 350,400, 400,450, 400,400, 400,400, 400,400, 400,400, 400,400, 400,1200, 400,400, 400,400, 400,400, 400,400, 400,400, 400,450, 350,450, 350,1250, 350,450, 400,400, 400,400, 400,400, 400,1200, 400,1200, 450,1200, 350,1250, 350,1250, 400,1200, 400,1200, 400,1200, 450,350, 400,400, 400,1250, 400,400, 350,450, 350}; // PANASONIC 2002:60008087
unsigned int addr = 0x2002;
unsigned int data = 0x60008087;
Here's the code for the transmitter on another Aruino Uno R3
// Fujitsu AR-RCF1U
#include <IRLibAll.h>
//#include <IRremote.h>
IRsend mySender;
const int buttonOnPin = 7; // Pin for On @ Auto 72 Auto button
const int buttonOffPin = 8; // Pin for Off button
const int pinSendIR = 3; // choose any pin to send IR signals
int buttonState = 0; // variable for reading the pushbutton status
uint16_t address = 0x2002; // Given from IRrecvDump with original remote
//
//Power Off
uint32_t powerOff = 0x60008084; // Original 33F10136 - Also came up 60008084
//Provided by IRrecvDump
unsigned int rawOff[111] = {3200,1600, 450,350, 450,350, 450,1150, 450,350, 450,1200, 400,350, 450,350, 450,350, 450,1200, 400,1200, 450,300, 500,350, 450,350, 450,1150, 450,1200, 400,350, 450,350, 450,350, 450,400, 400,400, 400,400, 450,300, 450,400, 400,400, 450,350, 450,350, 450,350, 450,350, 450,1200, 400,300, 500,400, 400,400, 400,400, 400,400, 400,400, 400,400, 400,1200, 400,350, 450,400, 450,350, 450,350, 450,1200, 400,400, 400,400, 400,400, 400,400, 400,400, 400,400, 400,1200, 400,400, 400,1200, 450,1150, 450,1200, 400,1200, 400}; // PANASONIC 2002:60008084
//Power On Auto[Mode: Cool|Dry|Fan|Heat] 72 Auto[Fan: High|Med|Low|Quiet]
uint32_t powerOn = 0x60008087; // Original FC2D425F - Also came up 60008087
//Provided by IRrecvDump
unsigned int rawOn[111] = {3200,1600, 450,350, 450,350, 450,1200, 400,350, 450,1200, 400,400, 400,350, 450,400, 400,1200, 450,1150, 450,350, 450,350, 450,350, 450,1200, 400,1200, 400,400, 400,400, 400,400, 400,400, 400,400, 400,400, 400,400, 400,400, 400,400, 400,400, 450,350, 450,400, 400,400, 400,1200, 400,400, 400,400, 400,400, 400,400, 400,400, 400,400, 400,400, 400,1200, 450,350, 450,350, 450,400, 400,400, 400,1200, 400,1200, 400,1200, 400,1200, 400,1200, 450,1150, 450,1200, 400,1200, 400,400, 400,400, 400,1200, 400,400, 400,400, 400}; // PANASONIC 2002:60008087
void setup()
{
Serial.begin(115200);
pinMode(buttonOnPin, INPUT);
pinMode(buttonOffPin, INPUT);
}
void loop()
{
// buttonState = digitalRead(buttonPin);
// if (buttonState == HIGH)
if(digitalRead(buttonOnPin) == HIGH)
{
mySender.send(address, rawOn, 8); // IRLibAll.h
// mySender.sendPanasonic(address,powerOn); // IRremote.h
Serial.println("On");
while(buttonState == HIGH)
{
buttonState = digitalRead(buttonOnPin);
delay(200);
}
}
if(digitalRead(buttonOffPin) == HIGH)
{
mySender.send(address, rawOff, 8); // IRLibAll.h
// mySender.sendPanasonic(address,powerOff); // IRremote.h
Serial.println("Off");
while(buttonState == HIGH)
{
buttonState = digitalRead(buttonOffPin);
delay(200);
}
}
}
When using IRLibAll.h
the transmitter functions and the IR receiver's LCD displays different values
rawOn:
Encoding: UNKNOWN
Code: 12B5839A
Timing: 17
rawOff:
Encoding: UNKNOWN
Code: AF533B37
Timing: 17
powerOn:
Encoding: UNKNOWN
Code: 256A624B
Timing: 17
powerOff:
Encoding: UNKNOWN
Code: 167EB06
Timing: 17
When using IRremote.h
the transmitter doesn't work, the LED doesn't turn on and nothing is received by the other Uno, and the Serial output says On|Off accordingly
Any help explaining why 72° and 74° give the same unsigned int data
(Code on receiver LCD) and what is wrong with the transmitter and how can it be rectified is greatly appreciated, thank you.