rjdekker / MHI2MQTT

Arduino-based WiFi/MQTT controller for wireless operation of a Mitsubishi Heavy Industries air conditioner through its serial CNS port
MIT License
136 stars 27 forks source link

Use ESP8266 only? #1

Open rjdekker opened 6 years ago

rjdekker commented 6 years ago

I'm getting some questions if it is possible to only use an ESP8266-based board without the Arduino.

The thing is that this is what I was aiming for when starting this project. Unfortunately, I could not get SPI communication working with the MHI. The reason is technical and mostly beyond my skills. Running an ESP8266 as a SPI slave (MHI is master) is very poorly documented and some code that I found was impossible for me to get working for this particular scenario.

Some of the things that I ran into:

I still think it's possible but it would cost me too much time to figure out.

In contrast, I had the Arduino working as a SPI slave in no time and the programmatic implementation was delightfully simple compared to the ESP8266.

If anyone knows how to do this, I will be happy to provide you with more detailed information on the SPI protocol.

Cheers, Rob

SwiCago commented 6 years ago

Hey Rob, awesome job figuring out the protocol for the heavies! I wrote the arduino library for the non_heavy units, based on Hadley's python code. Maybe one day we can do a merge of the two librarys, where a user can choose via #define which protocol to use. But first it would need to work on stand alone ESP. Since the MHI doesn't use SPI SS, why not just pull it low at all times on ESP. The ESP will be the only slave and that is probably why they didn't add SS pin. Second, you say CLK is low when idle, it is possible that you need to pull it up to 5V with a 10k resistor, since that is what I had to do with my TX/RX lines for bone stock esp01. It seems that Mitsu pins are floating when they are not in use. Good luck and let me know if this helped.

rjdekker commented 6 years ago

Hi SwiCago,

Great to hear from you and thank you so much for your input. It was actually your work and Hadley’s that inspired me to get something similar going for the MHIs! It works in the current form but it is still far from a mature library that can run on a single ESP.

Your suggestions are a good starting point for further investigation. Unfortunately, I relocated to another city a while ago and left my beloved heavies including the arduinos to the new owner of my old home. I have therefore no access to a unit for testing purposes. My interest will surely return if and when I will install heavies in my new home. Hopefully somebody else can pick this up in the meantime....

Best,

Rob

apateluk commented 5 years ago

Hi Rob,

I am looking to do an ESP8266 only variant. Can you provide more detail on the SPI protocol if possible please ?

I'm struggling to completely follow the outline High-level protocol you have on the repo home page.

[Edit] I've looked through the code and have a couple of clarifying questions:

  1. Are the three frame variants sent continually. i.e. The statement in the documentation about starting a connection is a continual process (rather than only doing it once)
  2. To update settings, it can be sent in any of the three variations of the message, but as long as it happens in the 'clock' hight stage
ThomasHFWright commented 4 years ago

FYI all there is another project now active using only ESP8266 hardware without the arduino requirement https://github.com/absalom-muc/MHI-AC-Ctrl