Author Topic: Controlling Air Conditioner (A/C) using Arduino GPIO  (Read 6073 times)

0 Members and 1 Guest are viewing this topic.

Offline baget

  • Contributor
  • Posts: 13
Controlling Air Conditioner (A/C) using Arduino GPIO
« on: September 21, 2013, 09:04:30 pm »
Hello

I'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 receiver

I 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/Zi3KCUsh
http://pastebin.com/xue5wstx

I'm stuck...  :scared: I really need some advices and ideas :-+

Thanks in Advance


 

Offline Rerouter

  • Super Contributor
  • ***
  • Posts: 4640
  • Country: au
  • Question Everything... Except This Statement
Re: Controlling Air Conditioner (A/C) using Arduino GPIO
« Reply #1 on: September 21, 2013, 09:19:08 pm »
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.
 

Offline dannyf

  • Super Contributor
  • ***
  • Posts: 8229
  • Country: 00
Re: Controlling Air Conditioner (A/C) using Arduino GPIO
« Reply #2 on: September 21, 2013, 10:02:55 pm »
Quote
it seem like

That 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.
================================
https://dannyelectronics.wordpress.com/
 

Offline baget

  • Contributor
  • Posts: 13
Re: Controlling Air Conditioner (A/C) using Arduino GPIO
« Reply #3 on: September 21, 2013, 10:38:15 pm »
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.

I don't think the problem is here, because I also tested with the GPIO connected to the IR LED via resistor. (without the transistor)
 

Offline baget

  • Contributor
  • Posts: 13
Re: Controlling Air Conditioner (A/C) using Arduino GPIO
« Reply #4 on: September 21, 2013, 10:39:07 pm »
Quote
it seem like

That 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.

sorry... it does... I use my cheat logic analyzer and it looks the same.  :)
 

Offline dannyf

  • Super Contributor
  • ***
  • Posts: 8229
  • Country: 00
Re: Controlling Air Conditioner (A/C) using Arduino GPIO
« Reply #5 on: September 22, 2013, 02:45:02 am »
Quote
it looks the same.

What looks the same to what?
================================
https://dannyelectronics.wordpress.com/
 

Offline IanB

  • Super Contributor
  • ***
  • Posts: 9724
  • Country: us
Re: Controlling Air Conditioner (A/C) using Arduino GPIO
« Reply #6 on: September 22, 2013, 02:45:54 am »
Do both signals have the same frequency (same bit rate)?
I'm not an EE--what am I doing here?
 

Offline baget

  • Contributor
  • Posts: 13
Re: Controlling Air Conditioner (A/C) using Arduino GPIO
« Reply #7 on: September 22, 2013, 04:34:38 pm »
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 Remote
this 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)
 

Offline dannyf

  • Super Contributor
  • ***
  • Posts: 8229
  • Country: 00
Re: Controlling Air Conditioner (A/C) using Arduino GPIO
« Reply #8 on: September 22, 2013, 04:48:02 pm »
Quote
I compere using IR receiver and logic analyzer the output of the IR receiver ...

You 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?

Quote
the bit rate seem to be the same

Either 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.
================================
https://dannyelectronics.wordpress.com/
 

Offline baget

  • Contributor
  • Posts: 13
Re: Controlling Air Conditioner (A/C) using Arduino GPIO
« Reply #9 on: September 22, 2013, 05:13:58 pm »
Quote
I compere using IR receiver and logic analyzer the output of the IR receiver ...

You 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?

I 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
the bit rate seem to be the same

Either 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.

I will try measure.
I'm using saleae logic, if you have plugin that can help me, it would be great.

 

Offline IanB

  • Super Contributor
  • ***
  • Posts: 9724
  • Country: us
Re: Controlling Air Conditioner (A/C) using Arduino GPIO
« Reply #10 on: September 22, 2013, 08:13:55 pm »
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.
I'm not an EE--what am I doing here?
 

Offline baget

  • Contributor
  • Posts: 13
Re: Controlling Air Conditioner (A/C) using Arduino GPIO
« Reply #11 on: September 23, 2013, 06:11:30 pm »
Do you think it is a problem of just tweaking the bitrate?
or there are bit missing?

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.
 

Offline IanB

  • Super Contributor
  • ***
  • Posts: 9724
  • Country: us
Re: Controlling Air Conditioner (A/C) using Arduino GPIO
« Reply #12 on: September 23, 2013, 08:05:27 pm »
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.
I'm not an EE--what am I doing here?
 


Share me

Digg  Facebook  SlashDot  Delicious  Technorati  Twitter  Google  Yahoo
Smf