Homemade AC-controller

Everything related to protocols and IR codes
Post Reply
Ripen
Posts: 4
Joined: Sat Jul 08, 2023 3:56 pm

Homemade AC-controller

Post by Ripen »

Hi everybody,
I've posted in a bunch of forums to no avail, so I was hoping I could post my question here. It seems like the right place to ask.

I've bought an IR transmitter and receiver, and I'm using Arduino to control it. I have read the signal from my remote control, which is using Samsung protocol, and copied that signal. I then send that signal using my transmitter, but the AC won't react to it.
I tried sending to my receiver as a test to check what signal was being sent, and I believe the right signal has been transmitted. I'll post the result below:

Signal read from original remote control:
Protocol=Samsung48 Address=0xB24D Command=0x3FD Raw-Data=0xFC03 48 bits LSB first
Send with: IrSender.sendSamsung48(0xB24D, 0x3FD, <numberOfRepeats>);

I have then sent this signal using the command on second line.
Signal read from my transmitter:
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.
User avatar
AnalysIR
Site Admin
Posts: 793
Joined: Sat Aug 31, 2013 3:51 pm
Location: Dublin, Ireland
Contact:

Re: Homemade AC-controller

Post by AnalysIR »

I am not sure if samsung48 is for AC units.

In my experience, it is better to use RAW when recording or sending AC signals.
Ripen
Posts: 4
Joined: Sat Jul 08, 2023 3:56 pm

Re: Homemade AC-controller

Post by Ripen »

AnalysIR wrote: Sat Jul 08, 2023 4:43 pm I am not sure if samsung48 is for AC units.

In my experience, it is better to use RAW when recording or sending AC signals.
You're thinking the reported protocol isn't correct? But would it then still be able to read and decode the signal?

An update, I've gone through a ton of settings at all carrier frequencies, and I'm currently suspecting the wavelength of the diode. Someone told me the different wavelengths don't overlap, I'm not sure if that's correct.


I did look into using RAW but haven't gotten that far yet, I'm a bit confused on how to write this in Arduino.
I'll include the data in case it tells you something.


Result as internal 8bit ticks (50 us) array - compensated with MARK_EXCESS_MICROS=20
uint8_t rawTicks[99] = {87,87, 11,32, 10,11, 11,32, 10,33, 10,11, 10,11, 11,32, 10,11, 11,11, 10,32, 11,11, 10,11, 10,33, 10,32, 11,11, 10,32, 11,11, 10,32, 10,33, 10,32, 11,32, 10,11, 11,32, 10,33, 10,32, 11,11, 10,11, 10,11, 11,11, 10,32, 11,11, 10,11, 11,32, 10,32, 11,32, 11,10, 11,11, 10,11, 11,10, 11,11, 10,11, 11,10, 11,10, 11,32, 11,32, 11,31, 11,32, 11,32, 10}; // Protocol=Samsung48 Address=0xB24D Command=0x7DE Raw-Data=0xF807 48 bits LSB first

Result as microseconds array - compensated with MARK_EXCESS_MICROS=20
uint16_t rawData[99] = {4330,4370, 530,1620, 480,570, 530,1620, 480,1670, 480,570, 480,570, 530,1620, 480,570, 530,570, 480,1620, 530,570, 480,570, 480,1670, 480,1620, 530,570, 480,1620, 530,570, 480,1620, 480,1670, 480,1620, 530,1620, 480,570, 530,1620, 480,1670, 480,1620, 530,570, 480,570, 480,570, 530,570, 480,1620, 530,570, 480,570, 530,1620, 480,1620, 530,1620, 530,520, 530,570, 480,570, 530,520, 530,570, 480,570, 530,520, 530,520, 530,1620, 530,1620, 530,1570, 530,1620, 530,1620, 480}; // Protocol=Samsung48 Address=0xB24D Command=0x7DE Raw-Data=0xF807 48 bits LSB first
User avatar
AnalysIR
Site Admin
Posts: 793
Joined: Sat Aug 31, 2013 3:51 pm
Location: Dublin, Ireland
Contact:

Re: Homemade AC-controller

Post by AnalysIR »

uint16_t rawData[99]

Try increasing the max/default buffer size in IRremote as it is possible you might not be getting the full signal captured.

set using RAW_BUFFER_LENGTH

increase it in steps of 100 until the 99 above is less than teh value you set -1

You may have to restart teh IDE to force the change each time.
Ripen
Posts: 4
Joined: Sat Jul 08, 2023 3:56 pm

Re: Homemade AC-controller

Post by Ripen »

I tried changing it to 600 which was suggested for AC-controllers, but I received the same signal. Although it says it's only sending with 16-bit signal, I do not know if I can change that:

Send NEC 16 bit address=0xFB04 and command 0x08 with exact timing (16 bit array format)
(This is just from Serial.print, but I'm sending with the command below.)

Here's the command for send:

const uint16_t rawData[99] = {4330,4370, 530,1620, 530,520, 530,1620, 530,1620, 480,570, 530,520, 530,1620, 530,520, 530,520, 530,1620, 530,520, 530,570, 480,1620, 530,1620, 530,520, 530,1620, 530,1620, 480,570, 530,1620, 480,1620, 530,1620, 530,1620, 480,1670, 480,1620, 530,520, 530,1620, 530,520, 530,520, 530,570, 530,520, 530,520, 530,570, 530,520, 530,1620, 480,570, 530,520, 530,570, 480,570, 530,520, 530,570, 480,1620, 530,570, 480,1620, 530,1620, 530,1620, 480,1620, 530,1620, 530,1620, 480}; // Protocol=Samsung48 Address=0xB24D Command=0x2FD Raw-Data=0xFD02 48 bits LSB first

IrSender.sendRaw(rawData, sizeof(rawData) / sizeof(rawData[0]), NEC_KHZ); // Note the approach used to automatically calculate the size of the array.

I don't know what "sizeof(rawData[0]" does, so I've tried changing it back and forth. I also tried all the different carrier frequencies.


On a sidenote, what I think is weird is that while receiving from my remote it specifically says:

Protocol=Samsung48 Address=0xB24D Command=0x2FD Raw-Data=0xFD02 48 bits LSB first
Send with: IrSender.sendSamsung48(0xB24D, 0x2FD, <numberOfRepeats>);

So I should just be able to send with that command, right?
Remember, I have also sent the signals to my receiver to verify that it is sending what it should.

Edit:
Above RAW-data, it says:
Result as microseconds array - compensated with MARK_EXCESS_MICROS=20
This might be relevant, I haven't figured out what to do with this though..

Edit2:
Someone on Reddit said it might be wrong IR wavelength, do they not overlap? Sorry for throwing all these questions at you..
Thank you for your help so far!

Sending with send.RAW, my receiver reads and decodes the correct Address, Command and RAW-data. I am now quite sure the transmitter is doing what it should, but the AC somehow can't see it.

Final edit:
Tried with my TV-remote(RAW), it worked right away. I ordered a few 850nm diodes now.
User avatar
AnalysIR
Site Admin
Posts: 793
Joined: Sat Aug 31, 2013 3:51 pm
Location: Dublin, Ireland
Contact:

Re: Homemade AC-controller

Post by AnalysIR »

No...it is always 944nm for IR remote control.

Use sendRAW until you get it working.
the sizeof...just automatically calculates teh buffer size.

Instead of NEC_KHZ try 38. and also try values for 36 & 33 to see if it makes a difference. Most ACs are 38kHz

What are you using to send?

Post a photo of your transmitter circuit...making sure to show all the connections etc.
debojitk
Posts: 1
Joined: Wed Jul 19, 2023 4:49 am

Re: Homemade AC-controller

Post by debojitk »

Hi I also ran into the same problem and don't know how to fix it. I am making a controller that controls both fan and AC. For fan it shows NEC protocol and emitting works out of the box, but for AC as the OP posted is showing as Samsung48, but sending does not work.

Here is some output
Protocol=Samsung48 Address=0xB24D Command=0x1FD Raw-Data=0xFE01 48 bits LSB first
Send with: IrSender.sendSamsung48(0xB24D, 0x1FD, <numberOfRepeats>);
rawData[100]:
-1477500
+4350,-4400
+ 500,-1600 + 550,- 550 + 500,-1600 + 550,-1600
+ 500,- 550 + 500,- 600 + 500,-1600 + 500,- 600
+ 500,- 550 + 500,-1650 + 500,- 550 + 500,- 550
+ 500,-1650 + 500,-1600 + 550,- 550 + 500,-1600
+ 550,-1600 + 550,- 500 + 550,-1600 + 500,-1650
+ 500,-1600 + 550,-1600 + 500,-1650 + 500,-1600
+ 550,- 550 + 500,-1600 + 550,- 550 + 500,- 550
+ 500,- 550 + 550,- 550 + 500,- 550 + 500,- 550
+ 500,-1650 + 500,- 550 + 500,- 600 + 500,- 550
+ 500,- 550 + 500,- 600 + 500,- 550 + 500,- 550
+ 500,- 600 + 500,-1600 + 500,-1650 + 500,-1650
+ 500,-1650 + 450,-1650 + 500,-1650 + 500,-1650
+ 450
Sum: 86000
rawData[100]:
-29550
+87,-88
+10,-32 +11,-11 +10,-32 +11,-32
+10,-11 +10,-12 +10,-32 +10,-12
+10,-11 +10,-33 +10,-11 +10,-11
+10,-33 +10,-32 +11,-11 +10,-32
+11,-32 +11,-10 +11,-32 +10,-33
+10,-32 +11,-32 +10,-33 +10,-32
+11,-11 +10,-32 +11,-11 +10,-11
+10,-11 +11,-11 +10,-11 +10,-11
+10,-33 +10,-11 +10,-12 +10,-11
+10,-11 +10,-12 +10,-11 +10,-11
+10,-12 +10,-32 +10,-33 +10,-33
+10,-33 + 9,-33 +10,-33 +10,-33
+ 9
Sum: 1720

I am using IRemote library.
I am using the IR emitter by seed studio grove https://www.seeedstudio.com/Grove-Infrared-Emitter.html
It says its 940nm wavelength.
BTW I did not understand the solution of OP.
Please help me out here.
Thanks,
Debojitk
Ripen
Posts: 4
Joined: Sat Jul 08, 2023 3:56 pm

Re: Homemade AC-controller

Post by Ripen »

AnalysIR wrote: Mon Jul 10, 2023 8:05 pm No...it is always 944nm for IR remote control.

Use sendRAW until you get it working.
the sizeof...just automatically calculates teh buffer size.

Instead of NEC_KHZ try 38. and also try values for 36 & 33 to see if it makes a difference. Most ACs are 38kHz

What are you using to send?

Post a photo of your transmitter circuit...making sure to show all the connections etc.
Sorry for my late reply, I took a break from the project.
I'm using IR transmitter and receiver from ebay, HX-53 and HX-M121. My Arduino is busy for another project so can't take a picture atm, but it was hooked up straight to the Arduino. The RX received the signal just fine so there shouldn't be an issue there.

I tried NEC_KHZ 38 and every other frequency from 20 to 150.

@debojitk I'm glad I'm not alone! I see we are trying to send the same signal just about. I'll let you know as soon as I figure it out.

Going back to the basics, does number of repeats play an important role?

Send with: IrSender.sendSamsung48(0xB24D, 0x1FD, <numberOfRepeats>);

I've tried 0-20 repeats, not knowing what it actually does.

I'll keep smashing sendRAW as you say, as soon as I receive my new Arduino.

By the way, while trying all different settings the transmitter was 2.5-3m away from the AC. I assume this would be within range, although I did try a bunch of settings holding it right next to the AC as well.
User avatar
AnalysIR
Site Admin
Posts: 793
Joined: Sat Aug 31, 2013 3:51 pm
Location: Dublin, Ireland
Contact:

Re: Homemade AC-controller

Post by AnalysIR »

@Ripen

I see at least 2 possible issues.

Your emitter module has a 220R resistor in line, which means you will get very little IR transmitted when you are driving it directly from the GPIO pin.

Your IR receiver is among the worst you could get (That is why they are so cheap). It could also be the reason you are getting a poor or partial signal capture.

Also, you need to build a strong Tx circuit using a transistor driver. There are several examples on our blog or you can get a selection of modules for send or receive or both with top quality components from Vishay. There is also a DIY module available.
User avatar
AnalysIR
Site Admin
Posts: 793
Joined: Sat Aug 31, 2013 3:51 pm
Location: Dublin, Ireland
Contact:

Re: Homemade AC-controller

Post by AnalysIR »

@Debojitk
Please read the thread and in particular my second reply above!
Post Reply