Your Universal Remote Control Center
RemoteCentral.com
General Consumer Remotes Forum - View Post
Previous section Next section Up level
Up level
The following page was printed from RemoteCentral.com:

Login:
Pass:
 
 

Topic:
Correct signal not accepted by AC
This thread has 3 replies. Displaying all posts.
Post 1 made on Saturday July 8, 2023 at 11:31
Ripen
Junior Member
Joined:
Posts:
July 2023
2
I hope I posted this is in the right subforum.

Hi everybody,
I'm trying to control my AC using Arduino. I have bought an IR transmitter and receiver.

I've been able to decode my remote control, it's using Samsung protocol.
I have been able to copy the signal, and send this signal to my receiver as a test which verified it was decoded correctly, but my AC doesn't react to it.


For those interested in the Arduino side of it, I've used IRremote to decode the signal, it prints:

Protocol=Samsung48 Address=0xB24D Command=0x3FD Raw-Data=0xFC03 48 bits LSB first
Send with: IrSender.sendSamsung48(0xB24D, 0x3FD, );

I have then sent the same signal using that command on the second line, with up to 10 repeats to no avail. Again, I have verified this signal using my receiver to make sure it is sending the correct code. Receiver prints:

Decoded protocol: Samsung48, decoded raw data: FC03, decoded address: B24D, decoded command: 3FD


Any help would be much appreciated! I really want to make this work.

Last edited by Ripen on July 8, 2023 12:06.
Post 2 made on Saturday July 8, 2023 at 13:24
Brad Humphrey
Super Member
Joined:
Posts:
February 2004
2,599
The Samsung protocol uses 37.9 KHz carrier frequency.

I would suspect the problem has something to do with the carrier frequency. As in the carrier frequency is getting stripped off and your device is transmitting the base band signal without the carrier, which means the AC unit can't read it.

Not familiar with that system but you would need to dig into information about setting the IR carrier frequency, to see if that is the issue.
OP | Post 3 made on Saturday July 8, 2023 at 15:14
Ripen
Junior Member
Joined:
Posts:
July 2023
2
Thanks for your reply.
I know how to change the carrier frequency in the code, or at least text-wise. Not sure if it actually changes the frequency as I have no way of testing that.
The default is set to 38khz though.

I went through all the frequencies with a ton of different settings with no luck, and I now suspect the wavelength of the diode is off as suggested by someone else. I'm ordering a bunch of different ones.

I'll paste the code in here in case someone can make sense of it.



 
#include <Arduino.h>
 
// select only NEC and the universal decoder for pulse distance protocols
#define DECODE_NEC          // Includes Apple and Onkyo
#define DECODE_DISTANCE_WIDTH // In case NEC is not received correctly. Universal decoder for pulse distance width protocols
#define DECODE_SAMSUNG
#define SEND_SAMSUNG
 
//#define EXCLUDE_UNIVERSAL_PROTOCOLS // Saves up to 1000 bytes program memory.
//#define EXCLUDE_EXOTIC_PROTOCOLS // saves around 650 bytes program memory if all other protocols are active
//#define NO_LED_FEEDBACK_CODE      // saves 92 bytes program memory
//#define RECORD_GAP_MICROS 12000   // Default is 5000. Activate it for some LG air conditioner protocols
//#define SEND_PWM_BY_TIMER         // Disable carrier PWM generation in software and use (restricted) hardware PWM.
//#define USE_NO_SEND_PWM           // Use no carrier PWM, just simulate an active low receiver signal. Overrides SEND_PWM_BY_TIMER definition
 
//#define DEBUG // Activate this for lots of lovely debug output from the decoders.
 
#include "PinDefinitionsAndMore.h" // Define macros for input and output pin etc.
#include <IRremote.hpp>
 
#define DELAY_AFTER_SEND 2000
#define DELAY_AFTER_LOOP 5000
 
void setup() {
    Serial.begin(9600);
 
#if defined(__AVR_ATmega32U4__) || defined(SERIAL_PORT_USBVIRTUAL) || defined(SERIAL_USB) /*stm32duino*/|| defined(USBCON) /*STM32_stm32*/|| defined(SERIALUSB_PID) || defined(ARDUINO_attiny3217)
    delay(4000); // To be able to connect Serial monitor after reset or power up and before first print out. Do not wait for an attached Serial Monitor!
#endif
    // Just to know which program is running on my Arduino
    Serial.println(F("START " __FILE__ " from " __DATE__ "\r\nUsing library version " VERSION_IRREMOTE));
 
    // Start the receiver and if not 3. parameter specified, take LED_BUILTIN pin from the internal boards definition as default feedback LED
    IrReceiver.begin(IR_RECEIVE_PIN, ENABLE_LED_FEEDBACK);
 
    Serial.print(F("Ready to receive IR signals of protocols: "));
    printActiveIRProtocols(&Serial);
    Serial.println(F("at pin " STR(IR_RECEIVE_PIN)));
    IrSender.begin(); // Start with IR_SEND_PIN as send pin and enable feedback LED at default feedback LED pin
    Serial.println(F("Send IR signals at pin " STR(IR_SEND_PIN)));
 
#if FLASHEND >= 0x3FFF  // For 16k flash or more, like ATtiny1604
// For esp32 we use PWM generation by ledcWrite() for each pin.
#  if !defined(SEND_PWM_BY_TIMER) && !defined(USE_NO_SEND_PWM) && !defined(ESP32)
    /*
     * Print internal software PWM generation info
     */
    IrSender.enableIROut(38); // Call it with 38 kHz to initialize the values printed below
    Serial.print(F("Send signal mark duration is "));
    Serial.print(IrSender.periodOnTimeMicros);
    Serial.print(F(" us, pulse correction is "));
    Serial.print(IrSender.getPulseCorrectionNanos());
    Serial.print(F(" ns, total period is "));
    Serial.print(IrSender.periodTimeMicros);
    Serial.println(F(" us"));
#  endif
 
    // infos for receive
    Serial.print(RECORD_GAP_MICROS);
    Serial.println(F(" us is the (minimum) gap, after which the start of a new IR packet is assumed"));
    Serial.print(MARK_EXCESS_MICROS);
    Serial.println(F(" us are subtracted from all marks and added to all spaces for decoding"));
#endif
}
 
uint16_t sAddress = 0xB24D;
uint16_t sCommand = 0x3FD;
uint_fast8_t sRepeats = 1;
 
/*
 * Send NEC IR protocol
 */
void send_ir_data() {
    Serial.print(F("Sending: 0x"));
    Serial.print(sAddress, HEX);
    Serial.print(sCommand, HEX);
    Serial.println(sRepeats, HEX);
    Serial.flush(); // To avoid disturbing the software PWM generation by serial output interrupts
 
    // clip repeats at 4
    if (sRepeats > 4) {
        sRepeats = 0;
    }
    // Results for the first loop to: Protocol=NEC Address=0x102 Command=0x34 Raw-Data=0xCB340102 (32 bits)
    IrSender.sendSamsung48(sAddress, sCommand, sRepeats);
}
 
void receive_ir_data() {
    if (IrReceiver.decode()) {
        Serial.print(F("Decoded protocol: "));
        Serial.print(getProtocolString(IrReceiver.decodedIRData.protocol));
        Serial.print(F(", decoded raw data: "));
#if (__INT_WIDTH__ < 32)
        Serial.print(IrReceiver.decodedIRData.decodedRawData, HEX);
#else
        PrintULL::print(&Serial, IrReceiver.decodedIRData.decodedRawData, HEX);
#endif
        Serial.print(F(", decoded address: "));
        Serial.print(IrReceiver.decodedIRData.address, HEX);
        Serial.print(F(", decoded command: "));
        Serial.println(IrReceiver.decodedIRData.command, HEX);
        IrReceiver.resume();
    }
}
 
void loop() {
    /*
     * Print loop values
     */
    Serial.println();
    Serial.print(F("address=0x"));
    Serial.print(sAddress, HEX);
    Serial.print(F(" command=0x"));
    Serial.print(sCommand, HEX);
    Serial.print(F(" repeats="));
    Serial.println(sRepeats);
    Serial.flush();
 
    send_ir_data();
    IrReceiver.restartAfterSend(); // Is a NOP if sending does not require a timer.
 
    // wait for the receiver state machine to detect the end of a protocol
    delay((RECORD_GAP_MICROS / 1000) + 5);
    receive_ir_data();
 
    // Prepare data for next loop
    sRepeats++;
 
    delay(1000); // Loop delay
}
Post 4 made on Friday April 26, 2024 at 17:26
kowek98577
New Member
Joined:
Posts:
April 2024
1
ohhh


Jump to


Protected Feature Before you can reply to a message...
You must first register for a Remote Central user account - it's fast and free! Or, if you already have an account, please login now.

Please read the following: Unsolicited commercial advertisements are absolutely not permitted on this forum. Other private buy & sell messages should be posted to our Marketplace. For information on how to advertise your service or product click here. Remote Central reserves the right to remove or modify any post that is deemed inappropriate.

Hosting Services by ipHouse