Page 1 of 1

Mitsubishi AC MSZ-GA71VA & AnalysIR

Posted: Fri Oct 15, 2021 6:58 am
by dkc1959
Really happy with the AnalysIR software & support. I've been working on the remote for a Mitsubishi MSZ-GA71VA and was starting from scratch with my understanding of AC IR codes. Using a combination of AnalysIR, my Oscilloscope and details from the AnalysIR blog, I now have a reasonable understanding in general and I've been able to create a model solution using a pair of ESP32's as sender and receiver and produce almost perfect signals. Currently I am only generating (from the Hex codes) test signals for turning ON and OFF (one byte change within the 18 byte array) every 30 seconds (with temp, fan, vane etc remaining unchanged). Signals are output via constant current circuit and works perfectly.

References: (https://www.analysir.com/blog/2015/01/0 ... -protocol/) & (https://www.analysir.com/blog/2013/11/2 ... d-circuit/)

Note : The approach I used was to use the ESP32's programmable PWM functions (ledc) to generate the 38kHz carrier and to vary the duty cycle (0-255) argument from 0 (for a Space) to 87 (for a Mark). Seems to work well - and I'm not worried about using the ESP32 re power consumption, as eventually it'll be part of a mains powered home automation unit.

Happy with progress so far ...

Re: Mitsubishi AC MSZ-GA71VA & AnalysIR

Posted: Fri Oct 15, 2021 11:54 am
by AnalysIR
Thanks for posting .

If running on battery, 33% duty cycle is usually optimum (more efficient). However as you are running on mains power, 50% duty cycle should do fine.

using 84 or 85 might be a better value (vs 87) as it would be closer to 33.3333% duty cycle. Alternatively 127 would get you 50%.

Also, could you post or email the LEDC code, as I have never used it before on the ESP32 would be interesting to try it out.

Re: Mitsubishi AC MSZ-GA71VA & AnalysIR

Posted: Sat Oct 16, 2021 2:35 am
by dkc1959
Yep good point about the duty cycle ... easy enough to change to 50%. As for the LEDC stuff, sure. Code still has a way to go to my end result, but the PWM bit seems to work well.

Essentially my starting point was your blog post "Simple Infrared PWM on Arduino, Part 3 – Hex IR Signals". I trimmed it down to the basics ... removed all the NEC stuff, removed the raw Mitsubishi stuff and modified the rest to cover the Mitsubishi 288 instead of Mitsubishi88 code structure. I got it working after a few tries ... needed to play with the periodHigh and periodLow a bit using the oscilloscope, but got close. I couldn't get 38kHz @ 33% though, but it was probably close enough. It was at that point I thought ... wait a minute, the ESP32 has the ability to generate PWM on multiple channels and I had used that before to dim LEDs, but hadn't really thought about the PWM abilities beyond that ... what if ... hmmm.

I wrote a basic sketch (Note I use PlatformIO not Arduino IDE, so I've attached as a simple text file "DKC-ESP32-PWMTest.txt" instead of cpp or ino) that generated a 38kHz "square" wave with a duty cycle that changed every 5 seconds that I could check on the oscilloscope. Once I had that going, I changed it to only generate 38kHz @ 33% duty cycle so I could play with the duty cycle values with a but more granularity.

At this point I started on the "actual" code ... I removed initSoftPWM and coded the PWM parameters directly into setup(), and rewrote mark() and space() to use ledcWrite(PWMChannel, dutyCycle) for a mark and ledcWrite(PWMChannel, 0) for a space, where dutyCycle ended up being 87. I changed sendHexMitsubishi88AC to sendHexMitsubishi288AC and modified it to send the supplied array twice, but with LSB instead of MSB first.
Again, attached as text file ... "DKC-ESP32-MitsubishiAC.txt"

It's been many years since I've done any coding (circa 1990), so enjoying waking up those brain cells :)

thanks again for your help

References : https://www.analysir.com/blog/2015/09/0 ... r-signals/
https://docs.espressif.com/projects/esp ... /ledc.html

Re: Mitsubishi AC MSZ-GA71VA & AnalysIR

Posted: Sun Oct 17, 2021 12:45 pm
by AnalysIR
cool thanks for that....looks pretty straight forward.

:)