barakwei / IRelectra

Electra A/C IR Encoder for IRremote
GNU General Public License v2.0
32 stars 10 forks source link

IRelectra power behavior and indication to AC power is ON. #7

Closed alonf closed 6 years ago

alonf commented 7 years ago

Hi, First, thanks! I have some issues, not all commands work, and the same command to turn the AC on, also turns it off. I do own the IRAnalyzer, and I was starting to reverse engineer the RC when I found your code. It should be much easier use your code than continue with the reverse engineering effort. You have wrote that turning the AC on and off is a bit tricky, how did you solve it?

Alon.

The RC: https://www.aliexpress.com/item-img/Air-Conditioner-Remote-Control-for-Airwell-Emailair-Electra-RC-3-RC-4-RC-7/32659714247.html?spm=2114.10010108.1000017.2.eV7A20

barakwei commented 7 years ago

This RC is supported. The power feature on these ACs are tricky by design, it's not really a power on/off bit, but rather a power cycle bit. You can't really turn on (and not off) your AC for example. If you send a message with the POWER bit on like this

e.SendElectra(POWER_ON, MODE_COOL, FAN_LOW, 24, SWING_ON, SLEEP_OFF);

It will change change the power state of the AC. If it was on, now it'll be off, and vice-versa. If you set the power bit to OFF, it'll not change the power state of the AC. When you click any button on your remote other than the power button, it send the current state of the remote with the power bit OFF. When you click on the power button, it send the current state of the remote, with the power bit ON.

barakwei commented 7 years ago

Note that the master branch contains perfectly good working remote, but the 2.0 branches contains a more extendable (and testable) codebase and also support Arduino.

alonf commented 7 years ago

Thanks, the behavior that you described is exactly what I figured out, and this is really annoying! you can't really turn on or off the AC when you'r away from home, since you don't know its current state. I thought to use some other sensors to "understand" that the AC is on or off, maybe I can use a photo-diode to detect the AC green and red lights, or some sort of noise sensor, or two temperature sensors, one in the AC vent and one in the room. Another option is to put IR receiver led near by the AC receiver and to track the commands that the AC receives. What do you think? Alon.

barakwei commented 7 years ago

Using some sensor to detect the color of the led sounds good. Or some vibration/noise detection where the air comes out. I don't believe in putting IR receiver near the A/C IR receiver, this forces you to keep a state which is always a bad idea (what is the state on startup?). The only really good (and relatively simple IMO) is to use a non-invasive AC current sensor like this one. It might be complex to install this depending on you A/C but the best source of truth. You can also you this to monitor the power consumption of you home.

guyco75 commented 7 years ago

IMO the best way is to use an opto-coupler to sense the voltage on the green led directly (through the connector). See here: https://www.hthome.co.il/vt161827.html

barakwei commented 7 years ago

That's a bit intrusive for my taste, but very possible. If you're doing that, you might be able to skip the IR led and connect the output directly to the circuit.

guyco75 commented 7 years ago

Doing that with a large enough resistor and an optocoupler shouldn't be that intrusive I think.. Luckily they already expose the needed signals - connectors 2 and 7 are connected directly to the green LED and provide 1.9v-2v to the LED when the AC is on.

Currently I'm annoyed that I don't have any indication if the AC is on or off in my automation system when I already left home :/

(this image is copied from Avi's thread above) image

barakwei commented 7 years ago

I agree that this is really needed. I'm not an electronics man so doing this is not trivial to me. Also - is this a DIN-8 connector? If so I would make a "box-in-the-middle" to sniff the bus.

guyco75 commented 7 years ago

Also - is this a DIN-8 connector?

Yes it is.. but those 8 pins are already exposed in that blue header below it.. I believe it's meant for connecting a raw 8-wire cable that doesn't have the DIN connector instead..

I'm not an electronics guy myself too - but did a lot of learning over the years.. The left side of an optocouple is really just a low power LED and with a large enough resistor it will "still" really only about 1mA out of the ~20mA running over the green led. Other than than, it's physically isolated from the [arduino] circuit connected to the right side. image

Saying that - I did experiment with this but I didn't install permanent wiring yet. Will update you when it's completely done and tested (waiting for a proper optocoupler I ordered).

barakwei commented 7 years ago

I understand the basic circuitry, but you're adding components to a circuit that you don't own. I wonder if the IR signals are transmitted on the connector as well or they go through some kind of decoding first. It will be fun to create a replacement circuit, or a proxy.

guyco75 commented 7 years ago

There is almost no logic on the board (maybe except for the transistor and a couple of capacitors that I can try to check what they are connected to - probably driving the bip-speaker on the left or amplifying the IR Receiver led). Specifically the LEDs are directly connected to the input pins/connector - they virtually/practically belong to a circuit that sits on the AC main unit - this is why I'm quite comfortable to assume that there are a lot of margins with the rail supplies to that green LED (voltage drop and inductive noise over a long cable, etc).

A 2k resistor will ensure low enough current drawn from the AC circuit compared to what the green LED is already sucking.

Anyway - this is going to be my final implementation:

image

About manipulating the IR Signals themselves - that crossed my mind a lot of times.. Almost brought up a scope to track the signals on the connector - but I guess I don't have that amount of courage :)

barakwei commented 7 years ago

@guyco75 Thanks for the diagram, I'm sure it'll help a lot of people. At some point, this should be a part of the library, I believe a single circuit that both controls the A/C and have an indication of the power status of the AC is the end goal of this project, together with the SW. @alonf You should have a lot of information on how to implement this. Can the issue be closed?

guyco75 commented 6 years ago

Hey, So after some prototypes on a breadboard, I designed and manufactured a board that can:

This board is connected to an Arduino with +5v/GND and 3 signals for the above 3 capabilities. And it works! :) @barakwei - I can share with you the schematics/layout for this board and actually can give you a couple of boards to play with as a gratitude for your work... (I manufactured 10 pieces as it was the same price as getting 1) image

barakwei commented 6 years ago

Very nice!!!! I'm really happy you got it to work. And thanks for the willingness to share the board! I recently moved to a new apt and installed an AC that comes with built-in wifi (via esp8266) and uses a simple and very insecure protocol (Tadiran), so now I don't have any need to control AC with IR.

Also - which branch did you use?

guyco75 commented 6 years ago

New apt is on my to-do list too :) I'm still using the snapshot I started with from ~3 years ago + added support for "I Feel" to report the temperature from the DHT sensor. I didn't bother rebasing to the latest library since it just works for me and I hope that in 1y I will too find myself with a new AC... Thanks! Guy

mattanl commented 6 years ago

Hi,

Is there a way to use the IRElectra with esp8266 (NodeMCU/WeMos) instead of arduino?

Just found out that these boards are much better than the arduinos...

Thanks

alonf commented 6 years ago

Yes, it works with ESP8266. I use it to control my AC and I also developed Alexa smart home skill to control the AC using Amazon Echo. I have uploaded the source code for you: https://github.com/alonf/ElectraACRemote