Idiots guide to getting an esp32 to control AC Infinity Cloudline EC fans esphome/HA

cubelite

Active Member
From there, what you do is up to your imagination. That being said, I'm more and more leaning towards coding a project outside of esphome. If it was just for me, I'd go for a native esp-idf project since I'm very familiar with the environment, but I might also go with the Arduino framework. It does add a massive amount of bloat and can be frustrating to work with, but it's more accessible to a broader audience I think.

Nonetheless, you are right; the UI could be built with lvgl and speed control could be supported as a slider. Something to think about.

Oh and the button there is a rotary encoder with push button, so a good clicking feeling and no limits on number of turns
How's the board working out for you? Is the control circuit for PWM control of the fan working well?
Does the fan go to 100% while the ESP is being programmed/rebooting? IE same as the fan being powered but unplugged from AC Infinity controller?
Can you share the schematic (or easyeda project)?

I was thinking of making a test circuit to try out a basic opto design. Wondering if R1 would prevent the fan from it's fail-safe ramp to 100% with a weak pull down.
1711041823163.png
 

sle118

Member
How's the board working out for you? Is the control circuit for PWM control of the fan working well?
Does the fan go to 100% while the ESP is being programmed/rebooting? IE same as the fan being powered but unplugged from AC Infinity controller?
Can you share the schematic (or easyeda project)?

I was thinking of making a test circuit to try out a basic opto design. Wondering if R1 would prevent the fan from it's fail-safe ramp to 100% with a weak pull down.
View attachment 5379688
I just did an OTA update and the fan didn't move during the flash operation or during reboot.

I've attached the schematics in case others would want to see. I didn't clean up so don't judge me on that; is a hobby not a Job ;)

The schematics includes a resistor connected to the tachometer screw terminal in the fan enclosure. This isn't tested yet. I followed some findings from another forum and pulled up the output and connected that to a gpio to measure RPM (I love measuring). I wonder if there's a linear relationship between the PWM duty cycle and the rotational speed.

I am also internally debating on whether I'll write a proper UI with navigation for this on, say, the Arduino platform . My preference goes to a raw esp-idf project, but the Arduino is more accessible if others want to fiddle around at some point. The idea would be a UI that is based on the lvgl library, and connecting to home assistant would be optional through mqtt.

I did shape the controller to mount it in the fan enclosure, but it can also be mounted remotely. I didn't bother keeping the connector; I tap the signals from the screw terminals directly
 

Attachments

cubelite

Active Member
I just did an OTA update and the fan didn't move during the flash operation or during reboot.
Interesting - I was thinking that I needed to ground the PWM pin while you're actually pull it up to 10V via R17 - Good thing I found this post

I've attached the schematics in case others would want to see. I didn't clean up so don't judge me on that; is a hobby not a Job ;)
No worries, all of this is a hobby...

The schematics includes a resistor connected to the tachometer screw terminal in the fan enclosure. This isn't tested yet. I followed some findings from another forum and pulled up the output and connected that to a gpio to measure RPM (I love measuring). I wonder if there's a linear relationship between the PWM duty cycle and the rotational speed.
I like measuring too, and if it's available, why not. That terminal is labeled FG in my fan and isn't brought down to the molex as they only use a 3 conductor cabled. That's easy enough to with a 4C wire as I want to have the terminals wired out from the fan case as it will be in my attic.

As far as the duty cycle relationship, here is some testing I did with the oscope. Left is their controller, the right is me using a dev board with esphome using a monochromatic light output at 4khz.
1711546343907.png

I am also internally debating on whether I'll write a proper UI with navigation for this on, say, the Arduino platform . My preference goes to a raw esp-idf project, but the Arduino is more accessible if others want to fiddle around at some point. The idea would be a UI that is based on the lvgl library, and connecting to home assistant would be optional through mqtt.
I've got no need for a UI as it will be node-red automations to control it. But it sounds like we have different use cases for the fans.


I did shape the controller to mount it in the fan enclosure, but it can also be mounted remotely. I didn't bother keeping the connector; I tap the signals from the screw terminals directly
If the tach works, it sounds like the molex connector is going to be more PITA than it's worth.
 

sle118

Member
View attachment 5381401


I've got no need for a UI as it will be node-red automations to control it. But it sounds like we have different use cases for the fans.



If the tach works, it sounds like the molex connector is going to be more PITA than it's worth.
Last reading is really odd and unexpected. Does it have an explanation?

As for my board, the display is not of an exercise in style as I took the opportunity to also build something that I would want in other places around the home. For instance, the mic chips are there to control power for very specific reasons, as I want to hook up a particle sensor from Panasonic which I found to have a poor MTBF unless powered off between reads. It's the most accurate sensor I could find on digikey and one I bought had endured over 12 months being outdoors in the north east (Quebec city). So being able to power sensors on demand was a must. So it packs a lot of features, much more than what I would have included if it were for the single trask of controlling a AC-Infinity fan.

As a matter of fact, I'll dedicate one board to bridging my Mitsubishi HVAC with home assistant
 

sle118

Member
Mmmm... That's excellent to hear. Clicky encoders are always a great time. Can't wait to get my mitts on one of these, ha.
If you're interested, better get the ball rolling before I pull all my boards into some project. I do need to order the components to build more, but real life is keeping me super busy right now.
 

Kommkat

New Member
For those interested the tachometer works really well as outlined in my schematics. Note here that air speed and CFM values are approximated from air flow measurements I took at various fan speeds. I don't have (yet) a mass airflow sensor connected :lol:
That's awesome! Any update on getting my filthy mitts on one of these? :D
 

sle118

Member
That's awesome! Any update on getting my filthy mitts on one of these? :D
PM me for this and we'll see how we can arrange something. I've never done it before, but I'm sure we can manage. I currently have only one left (one controls the fan, the second one is used as a test bed and I was eying the third one for another project, but it is a bit of an overkill).

I'm trying to find the budget to purchase more components in bulk so I can make more at some point, but with the current interest rates, cash flow isn't loose)
 

cubelite

Active Member
PM me for this and we'll see how we can arrange something. I've never done it before, but I'm sure we can manage. I currently have only one left (one controls the fan, the second one is used as a test bed and I was eying the third one for another project, but it is a bit of an overkill).

I'm trying to find the budget to purchase more components in bulk so I can make more at some point, but with the current interest rates, cash flow isn't loose)
any chance you'd be willing to share your easyeda project so I can browse around your overall board design?
 
I'm using a different type of fan, an AC Infinity Cloudline Pro S4. I've posted about it in a separate thread and someone referred me to this thread. I'm not clear if these fans will work with the system people are working with on this thread. I've included a few pictures of the types of controllers I'm using, the Controller 62. It connects to the fan with a USB-C cable, which I don't see in use in any photos here. I've included more photos and described my system in the other post. Right now I can use Home Assistant to turn the wall switches that control the outlets the fans use. (I'm using Z-Wave for the switches.)

I have, in the past, even talked with staff at AC Infinity, but they don't get the concept of whole-house automation, or that there would be any reason a person might want their fans under any control other than their vendor locked-in system, so that's no help.

My fan has 3 wires for AC power coming in and 4 wires from the USB-C cable as well, so 7 wires coming in and it looks to me like there are 8 wires going from the wire box to the motor. That makes me think I'm using the different DC motor than what's used in this thread. (If so, I'm having a heck of a time finding anything on what I can do with that motor.)

I'd appreciate it if someone could take a look at the thread I've started on my system and tell me if I can use what's described here on it - or point me toward something else that works. I've considered, since it's USB-C (but using only 4 wires, which makes me wonder if it's actually using USB 2.x protocols), if I could use some kind of sniffer to see what's going on with the control data going back and forth from the controller to the fan, but I don't have anything anywhere near that advanced and I'm not sure I have the skill to decode what's going on with the signals if it us using some kind of USB communication and not just using the cable for their own use.

Disclaimer: I don't know if this matters, but I'm not a grower. I'm using this as part of a vent system for my CNC, since using the laser sets off the smoke alarm. I do have a few items I've designed for 3D printing that might help - such as wall plates to connect 3" and 4" flexible duct to and an outside vent that hangs from my barn soffit, since most smaller vents attach to vertical walls, instead of a horizontal overhanging surface. I also made a cone that my electrician and I found quite helpful in pulling the flexible duct through some spaces we couldn't get to. I see people here are using 6" ducts, and a lot of these could be easily redesigned for a 6" diameter.
 
Okay, feeling like a frustrated idiot here.

I had opened up the wiring compartment on one of my fans back before installing them. Here's where I have them:
IMG_1860.JPG
And when I open it and pull the platform out, I get this:
IMG_1861.JPG
I had one photo I had taken of the wiring in the box and, from my view, the green/yellow wire looked like 2 wires, so when I counted wires in my photo, it looked like there were 8 going into the fan. If there had been a wiring chart on the top, in paper, like in the photo, I would have seen it. I didn't really want to open things back up and pull the plates off if I didn't need to, but I went down to the barn and checked. Here's my wiring diagram:
IMG_1867.JPG
With my eyes, it was very difficult to see this until I looked closely at it. (Previously, when I handled the top, I just saw black in there and couldn't see the diagram - so I thought there was not one there.) So once I looked closely, and saw the chart, it all made sense.

So now I can go through this and set up my fans for Home Assistant.

Thanks for such a thorough tutorial on this so I can now control these fans from HA and set them up to do what I want and make them useful for me - instead of being locked in to what AC Infinity wants me to do with them.
 
That's one sexy access door.
Thanks!

I'm happy with the result. Also love how the "drawer" works. The fans are mounted to plywood (nice high grade - left over from when the house was built), and it's on a drawer slider, which is mounted to two boards, one on each side, which are also mounted to drawer sliders, so it's a double-drawer - pulls out 2x as far as it normally would. I'll be putting insulation on the back of the door, but I'd like to be able to get back in the crawlspace some day and put a box with insulation around the fans, so they're not in a hot crawlspace/attic environment.

I wonder what the FG and PE lines are for, I suspect one is for reporting the actual speed of the fan?
The PE goes to the AC line, and it's yellow/green (not sure why it's not just greed), so I was working with the idea it is the ground. I'm not sure about the FG line, but fan speed seems like a good guess. I'd like to be able to figure that out, since it'd be nice to be able to set up a warning if the actual speed doesn't match the set speed and the fan is acting up.
 

shimbob

Well-Known Member
Oh, Power Earth, indeed. The blue/brown/G&Y combo is very typical European power color code.

Try connecting a multimeter between the FG and GND lines and see if it changes as you change the PWM input?
 

cubelite

Active Member
In appliances, these are typically:
PE - Protective Earth - In US this is typically green, in the rest of the world it's green/yellow.
FG - Frame Ground

I'm not sure about the FG in this application as the enclosure is plastic so there's nothing to ground.
 
After studying this entire thread, I have a good idea of what's going on. I still have a few questions that have been addressed, but I'm not completely clear on the answers. Also, while I understand what PWM is, I'm not fully clear on how the ESP or Pi is controlling it and what the ESP, the MOSFETs, and the fan itself, are all doing. I'm going to break down my questions and number them, so it's easy for people to respond to several or just one. I realize I can just use the instructions given at the start of the thread and I'll get this working, but I'd really like to understand what's going on as well. So thanks for any help or answers or insight on this!

I also have two questions about this post from @cubelite:
I was thinking of making a test circuit to try out a basic opto design. Wondering if R1 would prevent the fan from it's fail-safe ramp to 100% with a weak pull down.
View attachment 5379688
  1. I've seen some mention of the fan speed. What is the output of the ESP32? Is it a voltage level or a digital value or the actual direct on/off control for the pulses in PWM? (From what I'm reading, my guess would be that the ESP outputs a voltage level and the fan changes the pulse width according to the ESP output level. But I'm not at all sure how close I am on that.)
  2. Is there any issue where it is possible for the ESP32 to specify a speed too fast for the fan? Apparently this is not an issue, but just want to be clear about that.
  3. I like the idea of putting this all in one box, outside the fans, so if I add more, I don't have to open up the fans. There is discussion about using the +10V line from the fan, but also an issue of using the power from one fan to supply power for an ESP32 controlling multiple fans. If I have 2 or more fans, can I connect the +10V from all of them into one line to power the ESP32? (I know the ground on all would have to be connected to the ESP32 and any other components.)
  4. I've seen discussion, in the early parts of the thread about the MOSFETs and the optocoupler being used for isolating the ESP32 (and support chips/components) from the fan. I also see that the ESP32 has PWM control. In the diagram I've included from @cubelite's post, I see he's not using any MOSFET, just controlling the fan from the ESP32, but using the optocoupler for isolation. Do the MOSFETs serve any purpose other than isolating the circuits? Is there a reason to not control the fan directly from the ESP32 (or controlling it with only the optocoupler as an isolation buffer)?
  5. I see @cubelite using a 150kΩ resistor to keep the fan from going up to 100%, but after that, I see @sle118 suggesting a resistor to the ground to do the same thing. So would that resistor would go from ground to where? And I'd really like clarification on just what is going on with this pull-up or pull-down.
  6. If I get a standard USB-C to USB-A cable, will the 4 lines coming out of the USB-A end be the 4 lines used by the fan from the other end? (This is an issue for me because I have fans that have a tail on them for a USB-C cable and ones that just have a cable coming out with a USB-C connector on the end. I'm thinking it's easier to get a USB-C male-to-male or female-to-female adaptor and a USB-C to USB-A cable than to get the USB-C to molex, which is only supplied by the manufacturer and could be discontinued when they're not selling enough anymore.)
I'm thinking I could design a circuit board and have it printed (I'd use a place that includes components, since it would have multiple USB-C connectors, which would be a pain in the rear to solder - at least at my skill level). I was thinking the ground lines from the fan inputs coming in through the USB connectors would all be tied together and so would the +10V lines coming in on all the fans from the USB connections. That would make sure there was enough power available and would also ensure that if one fan was unplugged for servicing, it wouldn't turn off the controller.
 

shimbob

Well-Known Member
The output of the esp32 gpio pin, when outputting a PWM signal, is a square wave, alternating between 0V and a peak of +3.3V based on the duty cycle its set to. If its an arduino device, it'll output a 5V peak signal.

These fans require a 10V peak on the input pin for full speed and that's where the MOSFET/optoiso come in, they will output a PWM square wave with a 10V peak based on the 3.3V input.

If you use the gpio output directly as the PWM fan input, you will most likely only get at most 33% of the fans max duty cycle due to a quirk in how a pwm'd voltage line will measure a lower voltage (measure a 10V PWM signal at 33% duty cycle and it'll measure around 3.3V, or 6.6V if inverted)
 
The output of the esp32 gpio pin, when outputting a PWM signal, is a square wave, alternating between 0V and a peak of +3.3V based on the duty cycle its set to. If its an arduino device, it'll output a 5V peak signal.
Ah - so the config people are using specifies it's a PWM signal, so the ESP knows what to do from there. Thank you for the explanation!

These fans require a 10V peak on the input pin for full speed and that's where the MOSFET/optoiso come in, they will output a PWM square wave with a 10V peak based on the 3.3V input.
Ah - okay, I got it now. Make sense.
If you use the gpio output directly as the PWM fan input, you will most likely only get at most 33% of the fans max duty cycle due to a quirk in how a pwm'd voltage line will measure a lower voltage (measure a 10V PWM signal at 33% duty cycle and it'll measure around 3.3V, or 6.6V if inverted)
Can I do the same thing with an optocoupler if I get one that can handle 10V? I could use the 3.3V on one end with the ESP32 and 10V on the other end - or would it just "see" the max 3.3V on the emitter in there as only 1/3 of the total 10V the other side uses?

And if I use the MOSFET, won't that basically isolate the fan side from the ESP side of the circuit, meaning the optoisolator is just an extra precaution?
 
Top