AC signal troubleshooting - Carrier brand unit

Everything related to protocols and IR codes
Aldagoni
Posts: 10
Joined: Thu Apr 03, 2014 2:48 pm

Re: AC signal troubleshooting - Carrier brand unit

Post by Aldagoni »

I am using the IRremote library, it was working fine, probably it is a hardware issue, I am remaking the hardware now just to make sure.
what is a MCU?, I am using an arduino UNO with its ATmega328 microcontroller.
it would be great if you email me the example!
another thing! since the remote control of the air conditioner sends a combination of data, it is possible to separate the signal of a remote?, so I can store each part of the signal that correspond to the diferents datas (temperature, swing, timer, on, off, etc, etc) separately, so I do not have to save all the combinations of signal? if that make sense! jaja

thanks!
Ale Gonzalez Nicolicchia
User avatar
AnalysIR
Site Admin
Posts: 793
Joined: Sat Aug 31, 2013 3:51 pm
Location: Dublin, Ireland
Contact:

Re: AC signal troubleshooting - Carrier brand unit

Post by AnalysIR »

Yes it should be possible to split the signal.

FIrst, if you can send me some sample signals, I will try to put them into an example for you.

(Also note that IRremote cannot send mark or spaces longer than 16383 uSecs. If yours are longer it may be better to use IRLib)

MCU = Micro Controller Unit...for the UNO it is the ATMega328p.
Aldagoni
Posts: 10
Joined: Thu Apr 03, 2014 2:48 pm

Re: AC signal troubleshooting - Carrier brand unit

Post by Aldagoni »

I have sent you the sample signal from the CARRIER brand, the model number is 38MPQ2405, and the type of the remote is R11HG/E

also I wanted to ask you, lately when I try to decode a signal, some time, actually most of times I can decode just half of the signal (exactly the half), I have to try several times to get a complete signal, but just with some brands, with the CARRIER I have no problem, but with other brands that I was able to control fine in the past, now I am having this problem, any idea of what the problem may be? I have already changed the sensor, and some others components!

thanks
Ale Gonzalez Nicolicchia
User avatar
AnalysIR
Site Admin
Posts: 793
Joined: Sat Aug 31, 2013 3:51 pm
Location: Dublin, Ireland
Contact:

Re: AC signal troubleshooting - Carrier brand unit

Post by AnalysIR »

Ale

Its great to hear the issues with Win8 have been sorted.

If you turn on CUSTOM decoding your signal will be decoded to Hex, with the current version of AnalysIR.

Menu->Protocols->none (Turns off other decoding)...then...
Menu->Protocols->Custom


You can decode the signal then by pressing the Analyse button or just pressing a button on your remote.

Regarding your problem receiving some signals with your IR receiver:
This can be any number of reasons:
- battery in remote
- Interference from sunlight, LED lighting, LCD/Plasma TVs
- Incorrect modulation frequency.

Based on your earlier posts, the IR Receiver you are using is TSOP38238.
This is classed as legacy by Vishay and a better one would be TSOP34438 or TSOP4438.
Aldagoni
Posts: 10
Joined: Thu Apr 03, 2014 2:48 pm

Re: AC signal troubleshooting - Carrier brand unit

Post by Aldagoni »

HI THERE, It is been a while since my last post, first i want to apologize for saying that the IR receiver (sensor) TSOP38238 was not working, it is been 5 month that I stopped working in this project, but before that, I had analized the signal with AnalysIR and I could observe something that I can not remember right now (like I said, it is been a while), but I remember that I had to change something in the IR Remote Library for my device to work properly again, so what I am trying to say is that the TSOP38238 works just fine.

"TSOP38238

AC Remote: R11HG/E
AC Unit: CARRIER brand, the model number is 38MPQ2405
Data Bits: 48 + 48 (96)
IR receiver: TSOP348238 Status: FAIL
Optional Comments: User Aldagoni, reports this receiver can receive intermittently for a selection of AC units (Works sometimes, other times not). Although this receiver can work, we classify it as a FAIL, because it does not work consistently and it is classed as a legacy device by the manufacturer Vishay."

Now I am starting to work on this project again, and I am going to look at the Library and analize the signal with AnalysIR to find what exactly I had changed for my device to work again.
I want to ask you about a problem I am having to store the signals in the EEPROM of the arduino, I manage to store 2 signals just fine (ON and OFF for example) but when I store the third signal, my two previous signals get distorted, in others words, storing the third signal alter the two other signals previously stored.

when I print the signals stored (pulse by pulse) in the EEPROM with the SERIAL MONITOR of the arduino I can see that when I Store the third signal, one (just one) of the pulses is wrong.

here are the pulses print in the SERIAL MONITOR, in yellow are the pulses that are supposed to be equals but are different.

Grabar comando via serial: 9-2
Received unknown code, saving as raw: 199
m4300; s4400; m450; s1700; m450; s600; m500; s1650; m500; s1650; m500; s600; m500; s550; m500; s1650; m500; s600; m500; s600; m450; s1700; m450; s600; m500; s600; m450; s1700; m450; s1700; m450; s600; m500; s1650; m500; s1650; m500; s600; m450; s1700; m500; s1650; m500; s1650; m500; s1650; m450; s1700; m450; s1700; m450; s600; m500; s1650; m500; s600; m500; s600; m450; s600; m500; s600; m450; s600; m500; s600; m450; s1700; m450; s600; m500; s600; m500; s600; m450; s600; m500; s600; m450; s600; m500; s600; m450; s600; m500; s1650; m500; s1650; m500; s1650; m500; s1650; m500; s1650; m500; s1650; m500; s1650; m450; s5250; m4250; s4450; m450; s1650; m500; s600; m500; s1650; m500; s1650; m500; s600; m450; s600; m500; s1650; m500; s600; m450; s600; m500; s1650; m500; s600; m500; s600; m450; s1700; m450; s1650; m500; s600; m500; s1650; m500; s1650; m500; s600; m450; s1700; m450; s1700; m450; s1700; m450; s1700; m450; s1700; m450; s1700; m450; s600; m500; s1650; m500; s600; m450; s600; m500; s600; m450; s600; m500; s600; m500; s600; m450; s1650; m500; s600; m500; s600; m450; s600; m500; s600; m450; s600; m500; s600; m500; s600; m450; s600; m500; s1650; m500; s1650; m500; s1650; m500; s1650; m500; s1650; m500; s1650; m450; s1700; m500;
Datos guardados en la EEPROM: 199
Comando Recibido: 2
m4300; s4400; m450; s1700; m450; s600; m500; s1650; m500; s1650; m500; s600; m500; s550; m500; s1650; m500; s600; m500; s600; m450; s1700; m450; s600; m500; s600; m450; s1700; m450; s1700; m450; s600; m500; s1650; m500; s1650; m500; s600; m450; s1700; m500; s1650; m500; s1650; m500; s1650; m450; s1700; m450; s1700; m450; s600; m500; s1650; m500; s600; m500; s600; m450; s600; m500; s600; m450; s600; m500; s600; m450; s1700; m450; s600; m500; s600; m500; s600; m450; s600; m500; s600; m450; s600; m500; s600; m450; s600; m500; s1650; m500; s1650; m500; s1650; m500; s1650; m500; s1650; m500; s1650; m500; s1650; m450; s5250; m4250; s4450; m450; s1650; m500; s600; m500; s1650; m500; s1650; m500; s600; m9850; s600; m500; s1650; m500; s600; m450; s600; m500; s1650; m500; s600; m500; s600; m450; s1700; m450; s1650; m500; s600; m500; s1650; m500; s1650; m500; s600; m450; s1700; m450; s1700; m450; s1700; m450; s1700; m450; s1700; m450; s1700; m450; s600; m500; s1650; m500; s600; m450; s600; m500; s600; m450; s600; m500; s600; m500; s600; m450; s1650; m500; s600; m500; s600; m450; s600; m500; s600; m450; s600; m500; s600; m500; s600; m450; s600; m500; s1650; m500; s1650; m500; s1650; m500; s1650; m500; s1650; m500; s1650; m450; s1700; m500;


first I thought that there was a problem with the EEPROM but I bought another arduino and I have the same problem. Any ideas of what could be the problem?

thanks
Ale Gonzalez Nicolicchia
User avatar
AnalysIR
Site Admin
Posts: 793
Joined: Sat Aug 31, 2013 3:51 pm
Location: Dublin, Ireland
Contact:

Re: AC signal troubleshooting - Carrier brand unit

Post by AnalysIR »

not sure what the problem is....would need to see your code.

Post it or at least the bit that writes to and reads from EEPROM.
Aldagoni
Posts: 10
Joined: Thu Apr 03, 2014 2:48 pm

Re: AC signal troubleshooting - Carrier brand unit

Post by Aldagoni »

hi there,
the other day i told you that i had a problem that i needed to solve for my device to work properly again, well, that was just a matter of gap measure, the IRremote library was set to recognize a maximum gap of 5000 and my signal have a gap of 5200, so i changed that and the device worked fine again (IRremoteInt.h, line 176), now, the other problem that i mentioned was about a pulse that was incorrectly stored in the EEPROM, well the problem is that i run out of space in the EEPROM, so now i will try to save the data in the flash memory, i wonder if there is a way to store the data in a dynamic way in the flash memory (my device need to store the data received through a remote control of a random air conditioner), i think that i can not do that with PROGMEM. any suggestions?? i do not want to add an external EEPROM or SD card because i will need to modify the hardware and the electric circuits of the device, i really prefer to find another way to store all my data.

thanks a lot
Ale Gonzalez Nicolicchia
User avatar
AnalysIR
Site Admin
Posts: 793
Joined: Sat Aug 31, 2013 3:51 pm
Location: Dublin, Ireland
Contact:

Re: AC signal troubleshooting - Carrier brand unit

Post by AnalysIR »

A simple way would be to divide the mark/space durations by 50 and store them as a single byte on eprom. This would double your storage.
Then before you send the signal, copy it to an SRAM buffer array (UINT16) and multiply by 50. Then use sendRAW as normal to send.

This can work if the max length is up to 12750 uSecs (255*50).

If that does not work, you could do the same by storing the signals in FLASH using PROGMEM. You will need to use a special set of functions to read from PROGMEM and copy to a buffer array before sending.
Aldagoni
Posts: 10
Joined: Thu Apr 03, 2014 2:48 pm

Re: AC signal troubleshooting - Carrier brand unit

Post by Aldagoni »

yes you are right, i will double the amount of signal stored, but it will still be insufficient, because the amount of pulses in a signal of a WestingHouse brand unit is about 199, so that modification will give me a 5 signals storage capability.

the problem i find with PROGMEM (i do not know if i am right) is that i will not be able to make a modification in the flash memory while the program is running, for example, will the program is running, if i want to store a new signal, i will need to reprogram the device, am i wrong?

i am sending you my actual algorithm, with it, i store the signals in the eeprom, i use two bytes for each pulse just in case there is an air conditioner brand that needs that amount of space per pulse.

Code: Select all

//ALEJANDRO GONZALEZ NICOLICCHIA
//14-10-2014
#include <IRremote.h>
#include <EEPROM.h>

#define LIMITE_EEPROM 999

int RECV_PIN = 2;
int BUTTON_SEND = 4;
int STATUS_PIN = 7;
int BUTTON_RECV = 5;
int STATUS_RECV_PIN = 6;

IRrecv irrecv(RECV_PIN);
IRsend irsend;

decode_results results;

const int bytes = 2;
uint16_t OFFSET = 0;
int addrE = 0;

void setup()
{
  Serial.begin(9600);
  //irrecv.enableIRIn(); // Start the receiver
  pinMode(BUTTON_SEND, INPUT); // Initialize the "Send" push-button pin as an input
  pinMode(STATUS_PIN, OUTPUT); // Initialize the Orange LED pin as an output  
  pinMode(STATUS_RECV_PIN, OUTPUT); // Initialize the Blue LED pin as an output     
  pinMode(BUTTON_RECV, INPUT);   // Initialize the "Send" push-button pin as an input
}

// Storage for the recorded code
int codeType = -1; // The type of code
unsigned long codeValue; // The code value if not raw
unsigned int rawCodes[RAWBUF]; // The durations if raw
int codeLen; // The length of the code
int toggle = 0; // The RC5/6 toggle state
int buttonState1 = 0;        
int buttonState2 = 0;

// Stores the code for later playback
// Most of this code is just logging
void storeCode(decode_results *results, int comando) {
  codeType = results->decode_type;
  int count = results->rawlen;
  if (codeType == UNKNOWN) {
    Serial.print("Received unknown code, saving as raw: ");
	Serial.println(results->rawlen - 1, DEC);
    codeLen = results->rawlen - 1;
    // To store raw codes:
    // Drop first value (gap)
    // Convert from ticks to microseconds
    // Tweak marks shorter, and spaces longer to cancel out IR receiver distortion
    for (int i = 1; i <= codeLen; i++) {
      if (i % 2) {
        // Mark
        rawCodes[i - 1] = results->rawbuf[i]*USECPERTICK - MARK_EXCESS;
        Serial.print("m");
      } 
      else {
        // Space
        rawCodes[i - 1] = results->rawbuf[i]*USECPERTICK + MARK_EXCESS;
        Serial.print("s");
      }
      Serial.print(rawCodes[i - 1], DEC);
	  Serial.print("; ");
    }
    Serial.println("");
	EEPROMsave(results->rawlen, comando);
	EEPROMprint(comando);
  }
  else {
    if (codeType == NEC) {
      Serial.print("Received NEC: ");
      if (results->value == REPEAT) {
        // Don't record a NEC repeat value as that's useless.
        Serial.println("repeat; ignoring.");
        return;
      }
    } 
    else if (codeType == SONY) {
      Serial.print("Received SONY: ");
    } 
    else if (codeType == RC5) {
      Serial.print("Received RC5: ");
    } 
    else if (codeType == RC6) {
      Serial.print("Received RC6: ");
    } 
    else {
      Serial.print("Unexpected codeType ");
      Serial.print(codeType, DEC);
      Serial.println("");
    }
    Serial.println(results->value, HEX);
    codeValue = results->value;
    codeLen = results->bits;
  }
}

void sendCode(int repeat, int accion) {
  if (codeType == NEC) {
    if (repeat) {
      irsend.sendNEC(REPEAT, codeLen);
      Serial.println("Sent NEC repeat");
    } 
    else {
      irsend.sendNEC(codeValue, codeLen);
      Serial.print("Sent NEC ");
      Serial.println(codeValue, HEX);
    }
  } 
  else if (codeType == SONY) {
    irsend.sendSony(codeValue, codeLen);
    Serial.print("Sent Sony ");
    Serial.println(codeValue, HEX);
  } 
  else if (codeType == RC5 || codeType == RC6) {
    if (!repeat) {
      // Flip the toggle bit for a new button press
      toggle = 1 - toggle;
    }
    // Put the toggle bit into the code to send
    codeValue = codeValue & ~(1 << (codeLen - 1));
    codeValue = codeValue | (toggle << (codeLen - 1));
    if (codeType == RC5) {
      Serial.print("Sent RC5 ");
      Serial.println(codeValue, HEX);
      irsend.sendRC5(codeValue, codeLen);
    } 
    else {
      irsend.sendRC6(codeValue, codeLen);
      Serial.print("Sent RC6 ");
      Serial.println(codeValue, HEX);
    }
  } 
  else if (codeType == UNKNOWN /* i.e. raw */) {
    // Assume 38 KHz
	
	int cantidad = getCantidadPulses();
	
	Serial.println("Dato de la EEPROM");
	for(int i = 1; i <= cantidad; i++)
	{
		if (i % 2) {
			// Mark
			rawCodes[i - 1] = getPulsesEEPROM(i, accion)*USECPERTICK - MARK_EXCESS;
			Serial.print("m");
		} 
		else {
			// Space
			rawCodes[i - 1] = getPulsesEEPROM(i, accion)*USECPERTICK + MARK_EXCESS;
			Serial.print("s");
		}
		Serial.print(rawCodes[i - 1]);
		Serial.print("; ");
	}
	Serial.print("\n\rRecuperacion Completa, ");
    irsend.sendRaw(rawCodes, cantidad, 38);
    Serial.println("Sent raw");
	Serial.println("\n\r");
  }
} 




int lastButtonState1;
int lastButtonState2;

void loop() {
	
  while(Serial.available() > 0)
  {
	int comando = Serial.read() - 'A'; //Variable que tendra el valor que se reciba por comunicacion serial.
	if(comando <= 6)
	{
		Serial.print("Control de AA via comunicacion serial: ");
		Serial.println(comando);
		digitalWrite(STATUS_PIN, HIGH);
		delay(200);
		digitalWrite(STATUS_PIN, LOW);
		delay(200);
		sendCode(lastButtonState1 == buttonState1, comando);    
		delay(50); // Wait a bit between retransmissions
	}
	else if(comando > 6)
	{
		int StoreComando = comando - 7;
		irrecv.enableIRIn(); // Re-enable receiver
		Serial.print("Grabar comando via serial: ");
		while(1)
		{
			if (irrecv.decode(&results))
			{
				Serial.print(comando);
				Serial.print("-");
				Serial.println(StoreComando);
				delay(50);
				storeCode(&results, StoreComando);
				irrecv.resume(); // resume receiver
				digitalWrite(STATUS_RECV_PIN, HIGH);
				delay(200);
				digitalWrite(STATUS_RECV_PIN, LOW);
				delay(200);
				break;
			}
		}	
	}
  }
}




//GUARDA LOS VALORES CONTENIDOS EN RAWBUF A LA EEPROM
void EEPROMsave(uint16_t RawLen, int comando)
{
		uint16_t cantidad = RawLen - 1;
		uint16_t j = 0;
		
		for(j = 1; j <= cantidad; j++)
		{
			setPulses(cantidad, results.rawbuf[j-1], j, comando);
		}
	setCantidadPulses(cantidad, comando);
}
 
void setPulses(int DESPLAZAMIENTO, uint16_t value, uint16_t i, int comando)
{
	
    uint16_t addrE = (2*DESPLAZAMIENTO)*comando + 2 + ((i-1)*bytes);
    uint8_t valorP = (uint8_t)((value>>8)&0xFF);
    uint8_t valorS = (uint8_t)(value&0xFF);
        
        if(EEPROM.read(addrE + 0) != valorP)
        {
			if(addrE + 0 >= LIMITE_EEPROM)
			{
				Serial.println("EEPROM llena...");
				return;
			}
            EEPROM.write(addrE + 0, valorP);
        }
            
        if(EEPROM.read(addrE + 1) != valorS)
        {
			if(addrE + 1 >= LIMITE_EEPROM)
			{
				Serial.println("EEPROM llena...");
				return;
			}
            EEPROM.write(addrE + 1, valorS);
        }
}


void setCantidadPulses(uint16_t cantidad, int NroComando)
{
	uint8_t OFFSETP = (uint8_t)((cantidad>>8)&0xFF);
	uint8_t OFFSETS = (uint8_t)(cantidad&0xFF);
	EEPROM.write(((cantidad*2) + 2)*0 + 0, OFFSETP);
	EEPROM.write(((cantidad*2) + 2)*0 + 1, OFFSETS);
}

//IMPRIME LOS VALORES GUARDADOS EN LA EEPROM
uint16_t getPulsesEEPROM(uint8_t i, int NroComando)
{
	uint16_t Size = getCantidadPulses();
    uint16_t addrE = ((Size*2) + 0)*NroComando;
	uint8_t ValorP = EEPROM.read(addrE + (i*2) + 2);
	uint8_t ValorS = EEPROM.read(addrE + (i*2) + 3);
    uint16_t valor = (((uint16_t)ValorP) << 8) & 0xFF00;
    valor |= ((uint16_t)ValorS) & 0xFF;
	
    return valor;
}


uint8_t getCantidadPulses()
{
	uint8_t OFFSETP = EEPROM.read(OFFSET + 0);
	uint8_t OFFSETS = EEPROM.read(OFFSET + 1);
	uint16_t PULSOS = (((uint16_t)OFFSETP) << 8) & 0xFF00;
    PULSOS |= ((uint16_t)OFFSETS) & 0xFF;
	return PULSOS;
}


// IMPRIME LOS VALORES GUARDADOS EN LA EEPROM

void EEPROMprint(int comando)
{
    uint16_t contador = 1;
    Serial.print("Datos guardados en la EEPROM: ");
    Serial.println(getCantidadPulses(), DEC);
	Serial.print("Comando Recibido: ");
    Serial.println(comando);
        for(contador = 1; contador < getCantidadPulses() + 1; contador++)
        {
            if (contador % 2) {
                  // Mark
                  Serial.print("m");
                  Serial.print(getPulsesEEPROM(contador, comando) * USECPERTICK - MARK_EXCESS);
                  Serial.print("; ");
            }             
            else {
                  // Space    
                  Serial.print("s");
                  Serial.print(getPulsesEEPROM(contador, comando) * USECPERTICK + MARK_EXCESS);
                  Serial.print("; ");
            }      
            if(contador >= getCantidadPulses()) break;
            
        }
        Serial.println("");
		Serial.println("\n\r");
            
}

which way do you think is easier to expand the eeprom memory, with a sd module or with a external eeprom chip?

THANKS
Ale Gonzalez Nicolicchia
User avatar
AnalysIR
Site Admin
Posts: 793
Joined: Sat Aug 31, 2013 3:51 pm
Location: Dublin, Ireland
Contact:

Re: AC signal troubleshooting - Carrier brand unit

Post by AnalysIR »

the problem i find with PROGMEM (i do not know if i am right) is that i will not be able to make a modification in the flash memory while the program is running, for example, will the program is running, if i want to store a new signal, i will need to reprogram the device, am i wrong?
It would be much easier to store your signals in Flash(PROGMEM). Then as you want to send a signal, you copy that signal into SRAM. This way you use up only one buffer in SRAM for all your signals.

I presume that you dont actually use the 199 signals avaialbe. A much better way would be to use AnalysIR to reverse engineer the fields & Checksum of the protocol and then to build up each signal dynamically as you wish to send it. Quite a few users of AnalysIR have done this. (but not with Westinghouse)


PS: If you send me say 15 sample signals of setting temperature from 16->30 degrees, I will have a look at it to see if I can make more suggestions.
You will need to record the signals with AnalysIR, enter the temperature in the "KEY" field and then save them as a session. Menu->File->Save Session
Post Reply