Controlling Air Conditioner (A/C) using Arduino GPIO - Page 1
Forum section: electronics / general

author: baget
author_rank: Contributor
timestamp: September 21, 2013, 09:04:30 pm
content: HelloI'm trying to build a Arduino based system that will control by Home Air Conditioner (A/C).using Logic analyzer and IR receiver I was able to extract the code that the A/C Remote is sending of a command. (see attach files)it seem like it is sending NEC according the following sequence:1) Send the Code (e.g. 0xB335A962)2) Send the inversion (NOT op) of the code (e.g. 0x4CCA569D)3) Send the Code again (e.g. 0xB335A962)I tried to reproduce this sequence using Ardiuno code, but for some reason it does not work.the circuit that I'm using it very simple, it is a 2n2222 transistor and IR LED (I tried 2 type of LED: TOIR-30 and "Super-bright 5mm IR LED - 940nm" from Adafruit)my circuit schematics is also attach.using logic analyzer I compare the output on the GPIO and it seem like the signal on the IR receiverI tried to send the codes using IRRemote lib that I found and also the example from the EEVBLOG, both didn't work for me.the source code that I tried:http://pastebin.com/Zi3KCUshhttp://pastebin.com/xue5wstxI'm stuck...I really need some advices and ideasThanks in Advance

author: Rerouter
author_rank: Super Contributor
timestamp: September 21, 2013, 09:19:08 pm
content: with no resistance on the base of your transistor you may have killed the transistor, while the atmega328 specs 50mA max per pin they are not current limited in any manner,so when you asserted a logical 1 on your output, the base - emitter junction looks like a diode to ground and will happily sink a few hundred milliamps until either the gpio or the transistor gives, the fact you can still measure the waveform leads me to think transistor.to confirm this you can measure at the cathode of the led.

author: dannyf
author_rank: Super Contributor
timestamp: September 21, 2013, 10:02:55 pm
content: QuoteThat is your #1 problem right there. Either it is or it isn't replicating the ir signal. You are the only one in the whole world we can tell that for sure.

author: baget
author_rank: Contributor
timestamp: September 21, 2013, 10:38:15 pm
content: Quote from: Rerouter on September 21, 2013, 09:19:08 pmI don't think the problem is here, because I also tested with the GPIO connected to the IR LED via resistor. (without the transistor)

author: baget
author_rank: Contributor
timestamp: September 21, 2013, 10:39:07 pm
content: Quote from: dannyf on September 21, 2013, 10:02:55 pmsorry... it does... I use my cheat logic analyzer and it looks the same.

author: dannyf
author_rank: Super Contributor
timestamp: September 22, 2013, 02:45:02 am
content: QuoteWhat looks the same to what?

author: IanB
author_rank: Super Contributor
timestamp: September 22, 2013, 02:45:54 am
content: Do both signals have the same frequency (same bit rate)?

author: baget
author_rank: Contributor
timestamp: September 22, 2013, 04:34:38 pm
content: Guys, first of all thanks for the quick answers.I will explain.I compere using IR receiver and logic analyzer the output of the IR receiver when I send a data from the original A/C Remotethis is what I attach to the original message.now I attach image of the output signal of IR receiver when I use my arduino project + my IR LEDs to send the codes.the bit rate seem to be the same (I saw some 1ms diffs in the length of the big pulses)

author: dannyf
author_rank: Super Contributor
timestamp: September 22, 2013, 04:48:02 pm
content: QuoteYou should be more concise as to exactly what you are comparing. Are you comparing the IR receiver's output signal to the transmitting mcu's output pin? or the voltage across the ir transmitting led, or the current through the ir transmitting led, or the receiver when your own transmitter is sending?QuoteEither they are the same or they are not the same. The notion that they "seem" to be the same has no value to help you.No, just based on what you have posted, those two bit streams are vastly different. All you need is to examine one over the other.

author: baget
author_rank: Contributor
timestamp: September 22, 2013, 05:13:58 pm
content: Quote from: dannyf on September 22, 2013, 04:48:02 pmI have an IR receiver that I hook up for the mesurments (TSOP4838 -http://www.vishay.com/docs/82459/tsop48.pdf)and on it out pin, I did all of the attach measurement.does it make sense??Quote from: dannyf on September 22, 2013, 04:48:02 pmI will try measure.I'm using saleae logic, if you have plugin that can help me, it would be great.

author: IanB
author_rank: Super Contributor
timestamp: September 22, 2013, 08:13:55 pm
content: I overlaid the two bit streams on the same time scale:Then I directly compared the first group of bits:Clearly they are similar, but similar may not be good enough. For your copied signal to be recognized by the receiver it may need to be exact.

author: baget
author_rank: Contributor
timestamp: September 23, 2013, 06:11:30 pm
content: Do you think it is a problem of just tweaking the bitrate?or there are bit missing?Quote from: IanB on September 22, 2013, 08:13:55 pm

author: IanB
author_rank: Super Contributor
timestamp: September 23, 2013, 08:05:27 pm
content: It looks like you need to adjust your interval timings and your bit rate (clock frequency) if you want to match the original signal exactly.