Go Down

Topic: Solved: LG air conditioning codes (Read 21 times) previous topic - next topic

dw5304

adis is there a way of turning the unit off with provided libary?
I will be working on a web-client seeing these lg ac units have issues turning back on once they loose power :).

any information would be great thanks.

robtillaart

from a previous post
Quote
power off:1 1 0 0 0 0 0 0 0 0 0 0 0 1 0 1

so looks like it can be done
(never used those thingies disclaimer)
Rob Tillaart

Nederlandse sectie - http://arduino.cc/forum/index.php/board,77.0.html -
(Please do not PM for private consultancy)

dw5304

by the looks of the libary that was supplied though thats the turn off for each of the compoents not the unit its self.

class LG
{
   public:
      // fields
      unsigned int codes[LG_buffer_size];
      // methods
      // setter
      LG(int _mode,
            int _fan,
            int _temperature,
            int _state);
      // getter
      // debugging
      void debug();
   private:
      // fields
      byte crc;
      // methods
      void FillBuffer(byte _pos, byte _bit, byte _value);
};

argonauta1

I would like to create a program that allows you to control all (or almost all) Brands of air conditioners.
Is there anyone who has already done it?
Some of you have never planned an air conditioner that is not LG?

Thanks to all of you ... :-)

PS: I will open another post anyway

vk2tds

Hi All

I am just wondering which model LG remotes this is for.

Thanks

Darryl

geminium


Hi Adi,
I installed the IR library for Arduino, and used it to record the signal sent by my remote control to my Elco airconditioner.
However, when using the IRecvDump sketch, the output is in a form such as
Code: [Select]
Raw (76): 21114 1400 -1450 500 -500 500 -500 450 -1000 450 -500 500 -500 950 -550 450 -1000 950 -550 450 -950 500 -500 950 -550 450 -500 450 -550 450 -500 450 -550 450 -500 450 -550 450 -550 450 -550 400 -550 450 -550 450 -500 450 -550 450 -500 450 -550 450 -550 400 -550 450 -550 400 -1000 950 -550 1400 -1500 450 -550 400 -550 450 -1000 450 -550 400 -550 950

and I have no idea how to convert this to hex.
Can you please give me a hand?

Thanks!
-Ethan


Hi, did you find a solution to your problem ?

Many thnaks

adis


Hi All

I am just wondering which model LG remotes this is for.

Thanks

Darryl


The code works with LG S09AW
Regards,
Adi

arvindk62

#22
Jun 29, 2013, 11:59 am Last Edit: Jun 29, 2013, 01:16 pm by arvindk62 Reason: 1
Hi Adis,

Im trying to achieve what you have been able to do with the lg remote, using the codes mentioned in the earlier posts. Im using the Uno and been able  to record the incoming IR pulses from the remote controller. But if I send them from the uno  and compare it to the pulses sent from the remote controller itself, the uno seems less bright and the LG aircon doesnt respond. Is there a way to address this issue or is it normal?

Appreciate your help in this.

Cheers,
Arvind

power7net

Hi, I used this code for LG A/C Power On : Header NEC + 10001000 + 0000 0000 + 10100100 + 1110 + final pulse (520,4200usecs)
and it works fine with the LG Air Condition power on but how i switch off ?Not the same....i can't switch off....
Can you share the code for power off and others functions?
I find the code from there....http://irremote.psiloc.com/Show.aspx?d=Air%20Conditioner
Thanks.
Web / sms / bluetooth / arduino / android remote control. Home Automation projects.
http://www.power7.net

arvindk62

Hi power7net,

these are the two codes which I received

using IRrecord
ON
Received unknown code, saving as raw
m8750 s4150 m500 s1550 m400 s650 m150 s900 m50 s3200 m100 s750 m50
OFF
Received unknown code, saving as raw
m8750 s4200 m500 s1650 m50 s250 m50 s650 m100 s900 m50 s3000 m50 s1000 m50 s4300 m50 s1850 m0 s1000 m100

using IRrecvDump
ON
Unknown encoding: 1C583E4B (32 bits)
Raw (16): -21000 8850 -4050 500 -1600 200 -100 100 -650 150 -850 150 -2900 150 -950 100
OFF
Unknown encoding: 8BCEFF74 (32 bits)
Raw (18): -22958 8850 -4050 650 -1500 150 -900 100 -3950 150 -950 100 -4150 100 -1750 150 -850 200

But a funny thing happens when I cycle the ON/OFF button more than 5-6 times, the codes double in size for both functions and return to the original size, after cycling them 5-6 more times.

Cheers,
Arvind

marciofernandesrn


Another HELP!!??? XD   :D

I use Arduino 1.0.1
in the verification phase of the first code posted by Adis:

[ERROR]
Programmi\arduino-1.0.1\libraries\LG/LG.h:49: error: 'byte' does not name a type
Programmi\arduino-1.0.1\libraries\LG/LG.h:51: error: 'byte' does not name a type
Programmi\arduino-1.0.1\libraries\LG/LG.h:51: error: 'byte' does not name a type
Programmi\arduino-1.0.1\libraries\LG/LG.h:51: error: 'byte' does not name a type

[Possible solution] in 'LG.h' I changed the code to "unsigned char"................ but appears a new error:

sketch_LG_ino.cpp.o: In function `setup':
C:\Users\ALESSA~1\AppData\Local\Temp\build6352010931496577367.tmp/sketch_LG_ino.cpp:22: undefined reference to `LG::LG(int, int, int, int)'
C:\Users\ALESSA~1\AppData\Local\Temp\build6352010931496577367.tmp/sketch_LG_ino.cpp:25: undefined reference to `LG::debug()'



to solve that just change the header on LG.h from '#include <wprogram.h>' to '#include <Arduino.h>'

robwlakes

Hi Folks,
Just an idea for you people out there working on these IR controller codes.  As a teacher a I got fed up with students fiddling with remotes (setting too high a temp, too low a temp and also setting timer functions so it starts up Friday night and runs all weekend hahaha, Not!!!)   Also some teachers who think the system will get to the thermostatic operating point  quicker if the Thermostat is really cranked up and then forget it, grrrr Even some science teachers do this.)

So two devices would be neat. First a "simple on/off button controller" for the desired Heater/Cooler that only switches it off and on and cannot choose the temperature or alter any other function.  So a Split system would have it set on the "feel good" setting.  This would be in the classroom for the staff or students to use at their discretion (Preferably screwed down somewhere).  The second device I would issue to cleaners and it simply could be pressed every time they cleaned a room to set all the default settings the school board wanted for the school to use.  This may need the incorporation of multiple brand protocols to cover a whole school.  This would at least reset the systems on a regular basis in case some one brings their own controller (eg School has clever Arduino users who read this column :)

What do you think?  A commercial opportunity?  Plus an energy saver!!!

Cheers, Rob
Learning Flute and C++, heading for a meltdown.

busymind


Hi,

Below is the test program and a library I wrote in january.
I did my best to make it as clear as possible.

Regards,
Adi

Code: [Select]

#include <LG.h>
#include <IRremote.h>

// the LG code generator object

// the IR emitter object
IRsend irsend;

void setup()
{
Serial.begin(9600);
Serial.println("Start");


// wait 5 seconds
//delay(5000);
//LG LG(mode_heating,fan_4,30,state_on);
//LG LG(mode_heating,fan_4,30,state_off);
LG LG(mode_cooling,fan_1,18 ,state_on);


LG.debug();
// change the state
//LG.setState(STATE_off);
// send the code

irsend.sendRaw(LG.codes,LG_buffer_size,38);
//
Serial.println("End");



// wait 10 seconds
//delay(10000);

// change the state
//LG.setState(STATE_on);
// send the code
//irsend.sendRaw(LG.codes,LG_buffer_size,38);
}

void loop() {}


LG.h
Code: [Select]

#ifndef LG_h
#define LG_h
#include <WProgram.h>

#define first_byte 136 //b10001000

#define state_on 0
#define state_off 24 //b11000
#define state_change_mode 1

#define mode_heating 4 //b100
#define mode_auto 3 //b011
#define mode_dehuidification 1 //b001
#define mode_cooling 0
#define mode_none 0

#define temperature_offset 15

#define fan_1 1
#define fan_2 0
#define fan_3 2
#define fan_4 4 //b100
#define fan_none 5 //b101

#define first_high 8271
#define first_low 4298
#define zero_and_one_high 439
#define zero_low 647
#define one_low 1709

#define LG_buffer_size 59

class LG
{
public:
// fields
unsigned int codes[LG_buffer_size];
// methods
// setter
LG(int _mode,
int _fan,
int _temperature,
int _state);
// getter
// debugging
void debug();
private:
// fields
byte crc;
// methods
void FillBuffer(byte _pos, byte _bit, byte _value);
};

#endif;

LG.cpp
Code: [Select]

#include "LG.h"
LG::LG(int _mode,
int _fan,
int _temperature,
int _state)
{
// set sync
codes[0] = first_high;
codes[1] = first_low;
crc = 0;
FillBuffer(0,8,first_byte);
FillBuffer(8,5,_state);
if(_state==state_off)
FillBuffer(13,3,mode_none);
else
FillBuffer(13,3,_mode);
if(_state==state_off)
FillBuffer(16,4,0);
else
FillBuffer(16,4,(byte)_temperature-temperature_offset);
FillBuffer(20,1,0); //jet
if(_state==state_off)
FillBuffer(21,3,fan_none);
else
FillBuffer(21,3,_fan);
FillBuffer(24,4,crc);
codes[LG_buffer_size-1] = zero_and_one_high;
}

void LG::FillBuffer(byte _pos, byte _bits, byte _value){
for (int i=_bits;i>0;i--){
codes[2+2*(_pos+_bits-i)] = zero_and_one_high;
codes[2+2*(_pos+_bits-i)+1] = (bitRead(_value,i-1)==1?one_low:zero_low);
if(bitRead(_value,i-1)==1){
byte bitset = 0;
bitSet(bitset,(128+i-_pos-_bits-1)%4);
crc = crc + bitset;
}
}
}
void LG::debug()
{
for(byte i=0;i<LG_buffer_size;i++){
Serial.print(codes[i],DEC);
Serial.print(",");
}
}



It is something wrong with the code above?

Arduino: 1.5.7 (Mac OS X), Board: "Arduino Uno"

Build options changed, rebuilding all
Using library LG in folder: /Users/adrian/Documents/Programming X/Arduino.app/Contents/Java/libraries/LG (legacy)
Using library IRremote in folder: /Users/adrian/Documents/Programming X/Arduino.app/Contents/Java/libraries/IRremote (legacy)

/Users/adrian/Documents/Programming X/Arduino.app/Contents/Java/hardware/tools/avr/bin/avr-g++ -c -g -Os -w -fno-exceptions -ffunction-sections -fdata-sections -MMD -mmcu=atmega328p -DF_CPU=16000000L -DARDUINO=157 -DARDUINO_AVR_UNO -DARDUINO_ARCH_AVR -I/Users/adrian/Documents/Programming X/Arduino.app/Contents/Java/hardware/arduino/avr/cores/arduino -I/Users/adrian/Documents/Programming X/Arduino.app/Contents/Java/hardware/arduino/avr/variants/standard -I/Users/adrian/Documents/Programming X/Arduino.app/Contents/Java/libraries/LG -I/Users/adrian/Documents/Programming X/Arduino.app/Contents/Java/libraries/IRremote /var/folders/10/07l7h8mx39n1bs7klbmdzvv00000gn/T/build7630953899009137011.tmp/sketch_sep08a.cpp -o /var/folders/10/07l7h8mx39n1bs7klbmdzvv00000gn/T/build7630953899009137011.tmp/sketch_sep08a.cpp.o
In file included from sketch_sep08a.ino:2:0:
sketch_sep08a.ino: In function 'void setup()':
/Users/adrian/Documents/Programming X/Arduino.app/Contents/Java/libraries/IRremote/IRremote.h:50:12: error: expected ';' before numeric constant
#define LG 12
            ^
sketch_sep08a.ino:19:4: note: in expansion of macro 'LG'
sketch_sep08a.ino:22:4: error: request for member 'debug' in '12', which is of non-class type 'int'
sketch_sep08a.ino:27:19: error: request for member 'codes' in '12', which is of non-class type 'int'

busymind

Situation is solved. In fact into IRremote is something about LG added that I've comment out. I am not expert into codding I just figure out that some functions call defined into IRremote (LG added by Darryl Smith) are in conflict with LG.h and LG.cpp shown above.
Thank you for the LG.h and LG.cpp code. Now I am in control of cool and heat air with arduino First project ;).


Go Up