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

zen0n

Member
Hey guys, finally got my esp32 properly controlling my 6" AC Infinity Cloudline EC motor fans and figured I would lay it all out for you. As the title suggests I'm an idiot and just getting back into electronics, so be kind if i'm off on terminology haha. Most of the hard lifting for this stuff was not done by myself. Big thanks to the posters in the following threads that put me on the right track. Just had to have a few bowls to make it all come together :)

Particular thanks to @Kervork and @juanmaria of whose images I will most graciously borrow for this post.


For starters, this guide is for the EC motor cloudline fans, you can quickly determine which one you have by opening the panel and looking at the wires, if you have a 7 wire connections, you're good. 4 and you have the other DC motor. Other guides cover this I'm sure. Not 100% sure if this method will work or not. YMMV

We will be using ESPhome on the esp32 with home assistant controlling the fan. Won't be covering automation at this time because that part is next on the figure this shit out list. Assuming you have esphome addon configured and working in HA.

Parts required.
esp32
MOSFET Trigger Switch Driver Module x how ever many fans
pc817 optocoupler x how ever many fans *
100ohm resister x how ever many fans *
4 pin male molex connector x how ever many fans **
breadboard
various jumpers

* not 100% sure whether an optocoupler is required for the pwm circuit coming from the cloudline motor. I've wired it up both ways and it works both ways.
** I just molested some old PCs I had kicking around for their 4 pin molex power connectors. That's what you're looking for. The old kind of power connector.

Wiring up the fan

Here is a pic of the stock wiring diagram
cloudpanel.png

Backside of the mosfet for pin reference
newmos.png

And here is my slightly modified version of Kervorks original design. For our application, disregard the fact that it's going to a pi and whatever pins. Just know that the only wires you care about are the yellow (pwm) and black (gnd). We'll get back to those on the other esp side.

cloudline_wiring.png

And here is a pic of it all wired up.
newfanwmosfet.png


Inside the panel, with it oriented like above, disconnect red, yellow and black wires on the right hand side. The 3 bottom right wires in this pic. Run the red wire to VOUT+ on the mosfet, run the yellow wire to VOUT- on the mosfet. I made a jumper from the ground wire on the terminal block, connected it and the black wire to gnd pin on the mosfet. Only had white hookup wire, but you can see the ground pin on the mosfet has 2 wires coming out of it. Make sure you're jumpers are long enough so the mosfet will tuck into the corner nicely. I dabbed some hot glue on the live points on the backside of the mosfet pcb.

Leave the fan aside for bench testing or roll the dice and seal er up! :P

Wiring up the esp32

Depending on if you want to run an optocoupler or not, the esp side is pretty dead simple. You just need to make sure you're working with the correct wires on the control connector coming from the cloudline.

Here is a shot of the 2 wires you will be using from the cloudline, from the female side we will be providing from a pc or whatever you have.
newmolex.png

The yellow wire is the pwm signal from the fan, and black is the ground. Note the notches in the connector for pin orientation. Looking at the pic now, the connector housing is female, but the pins are male. So I may have misgendered this connector. I'll monitor twitter for someone educate me on gender, I'm sure it will trend hahaha Anyhow, knocking these pins out and moving the wires around is easy enough with a precision screwdriver if you're color anal.

And I managed to bang out a fritzing diagram for the esp side, don't judge, first one :P In the diagram I've included both a circuit with the optocoupler (yellow wire coming from esp) or just straight wired to the gpio (green wire). Of note the resister in the opto circuit is 100ohm. The dpi settings on my desktop frigged up the pin labels in the image, but red is the 3.3v rail, blacks are grounds and yellow is GPIO4 and green is GPIO5 (but use whatever pwm applicable pins you want, use esp32 pinout ref to find out what will work for you.


esp32-fan-opto_bb.png

And that should wrap it up hardware wise.

ESPHome and Home Assistant
* Again, assuming you know you to add esphome add on, and create a new blank esp32 device. I find it convienent to build the empty config and upload right away just to enable OTA updates going forward.

On the esp32 we will be using the ledc output to control the pwm duty cycle. That it's called ledc might seem a little off, but just know it's essentially a library for controlling pwm signals.


Edit your esp32 device to bring up the yaml editor, and paste the following

of note: make sure inverted reads true, or as it sounds 100% will be off, and 0 will be full speed. Make sure id is unique. frequency of 1000 seemed to work well enough for me.

speed_count will give you X amount of steps between 0 and 100, 10 seems to match up pretty well with what AC infinity was using before. Make sure output in the fan section matches the id from the output section. name is the display name you'll see in HA, id is it's internal name essentially.

change the pin to whatever you're using.

YAML:
output:
  - platform: ledc
    pin: GPIO5
    id: intake_fan_op
    inverted: true
    frequency: 1000
    
fan:
  - platform: speed
    output: intake_fan_op
    name: "Tent intake fan"
    speed_count: 10
    id: intake_fan
validate then upload to your esp.

Now head into Configuration->Integrations in Home Assistant. You should see your esphome device listed as a newly discovered device. Follow the configure prompts for that device. When your're done you should have the name of your esp device listed in the ESPHome integrations box. When you click on it, it should have 1 device and 1 entity.

Now head back into overview, depending on how you have your areas setup the control may be in that area. I haven't done much ui massaging yet and just use the default overview with everything. I added my esp device to my tent area so it shows up in there for me

tentover.png

Clicking on the fan name takes you to the speed control screen, you can't tell by the screenshot, but the slider on the bottom does in fact increment in 10s, so 0,10,20...80,90,100. And the software toggle will turn on and off the fan.

fancontrol.png

I _think_ thats it? I've been typing a long time now and the boss just got home from work so I have to go put some time in. Let me know what you guys think I may have fucked up haha. And again thanks to all the original posters for their skills.
 

rf25532

New Member
This looks like exactly what I need. I've just ordered a handful of parts (MOSFET driver, another ESP32, etc) to start getting this set up. I'll let you know how it goes!
 
I got a question how can I control more. I have multiple tents and AC Infinity cloudline 2 t6 and 5 t4 how can I control say even 4 of them this is what I have to work with I googled 4 or 5 different hookups yours,ledge,stud,and Cple other. I have all the MOSFETs 5 to 36v all the esp32s. Pwm to volt and volt to pwm,, 100k resistor,,,pc817,, adruino mega 256 plus with the extra pwmbI just ordered and booster to boost to 10v for the 2 t6 and also ordered a 4 channel easing edge l ac dimmer,,, 8 opto 22 relays breakout board kit,,sonoffth16 relay,,, dht22,,,bme280,,, ird520 MOSFETs,,,, 3 raps berry pi 4s,, 2 orange pi primes,,,2 atomic pis,,, and bunch different other adruinos,,, 7 inch touch screen for berry pi ,,,fire hd 10,,, and my desktop ,,, I'm running home assistant. Maybe nodered. I'm running. Lg 10kbtu Portable ac and voronado heater both prolly pull each 1200 and I am running 4 Bestva 2000 watt elite reflectors to 1600 watts.. and my grow light I'm working on with peltier pads that synergy they power the cooling fan. So heat from my light powers my peltier pads. Anyone can help me I'm mounting it in. Cple of those. Fancy stash logic boxes and one of my old pistols gin cases the cargo ones wanna mount everything in them and try to keep it mobile so I can close case up if I have to. Someone help plz
 

AdaBill

Member
I was able to connect an ESP32 to the AC Infinity fan by replacing the controller supplied with my ESP32 connector. It is the same Molex connector used in PC's power supply to disks. Just unplug the provided speed controller and plug the molex from the power supply into the provided cable. No need to mess with anything in the fan control box and you have the long cable from the controller to place near the ESP32. Here is the Amazon link " I have it controlling the speed of the fan (25% to 85%) based on a DS18B20 temp sensor. I also have it controlled by a 10K POT. The temp and fan speed is displayed on a .96" I2C OLED with a Heart-Beat LED to affirm its working. Just the USB power to the ESP32 is the only external power. The PWM signal controls the 10VDC power from the two cables within the connector as drawn above. Very easy implementation once the Fan Control was figured out. Thanks for the above help.Controller replacement.jpg
The ESP32 controller plugs directly into the cable from the original controller.


I also purchased the speed controllers from Amazon "
LGDehome 10PCS DC 5V-36V 15A(Max 30A) 400W Dual High-Power MOS Transistor Driving Controller Module FET Trigger Switch Drive Board 0-20KHz PWM Electronic Switch Control Board DC Motor Speed Controller"
I bought 10 because I thought they would come in handy for other DC controllable projects. They also sell in smaller quantities. I've not had any problems using the 3.3VDC from the ESP32 to fully saturate the MOSFETS. I did use 5K frequency for the PWM.


Molex Y Splitter Cable, Computer Molex 4 Pin Power Supply Splitter Cable, 2 Female to 1 Male Molex Power Extension Cable, 2-Pack".
This is a 2-pack for around $7. I've attached 2 pictures of the interconnect. It is an EXACT fit.

Fan control box.jpg
Because I was able to use the molex connector there were NO changes within the fan control box.
Add the changes were at the end of the cable. PWM and Ground pins.



power plug.jpgmcu breadboard.jpg
 

AdaBill

Member
Can you just draw how this molex, cables and mosfet are connected together?
The 2 center pins of the connector are the ones used. A drawing of the connector and the molex is in above thread. Pins 2 and 3 of the Connector. On the dual mosfet the + connectors go straight through, they are not switched, always connected. The switching is done on the - connections. If you look at the bottom of the module you will see VIN- and VOUT-, this is where your connections are made. The Molex, chamfer UP (from the fan) from left to right 1, 2,3, 4. Pin#4 is +10VDC from the fan, not used in this connection, Pin#3 is ground-connect to VIN- on Mosfet, Pin#2 is PWM signal Ground signal to the fan, switched by the Mosfet., Pin#1 is not connected or used. ALSO, please note that Vin_ is directly connected to the ground side of the Mosfet module. In other words, the fan's ground is directly connected to your MCU's ground (ESP32). It hasn't caused any problems with my setup, using for a couple weeks now. If you don't like this cross connection use an Octo-coupler to separate the two supplies.

I have included a picture of the Molex connector(s). The Black one is from the fan, chamfer up. Pin #4 is power. It is FEMALE.
The White one is my add-on (MALE PINS). Pin #3 goes to VIN- on the mosfet module. Pin#2 goes to VOUT- on the module.
You can see that the chamfer is UP in the picture.
Molex Connector.jpg


I also show a closeup of the Mosfet Module.
The upper LEFT Screw Connection is for the VIN- Pin#3 (also connects to MCU Ground)
The upper RIGHT screw connector is for VOUT- Pin#2. when activated by the MCS it provides a PWM signal ground for the fan.


Mosfet Module.jpg

Hopefully that answers your request.
 

xthursdayx

Member
The 2 center pins of the connector are the ones used. A drawing of the connector and the molex is in above thread. Pins 2 and 3 of the Connector. On the dual mosfet the + connectors go straight through, they are not switched, always connected. The switching is done on the - connections. If you look at the bottom of the module you will see VIN- and VOUT-, this is where your connections are made. The Molex, chamfer UP (from the fan) from left to right 1, 2,3, 4. Pin#4 is +10VDC from the fan, not used in this connection, Pin#3 is ground-connect to VIN- on Mosfet, Pin#2 is PWM signal Ground signal to the fan, switched by the Mosfet., Pin#1 is not connected or used. ALSO, please note that Vin_ is directly connected to the ground side of the Mosfet module. In other words, the fan's ground is directly connected to your MCU's ground (ESP32). It hasn't caused any problems with my setup, using for a couple weeks now. If you don't like this cross connection use an Octo-coupler to separate the two supplies.

I have included a picture of the Molex connector(s). The Black one is from the fan, chamfer up. Pin #4 is power. It is FEMALE.
The White one is my add-on (MALE PINS). Pin #3 goes to VIN- on the mosfet module. Pin#2 goes to VOUT- on the module.
You can see that the chamfer is UP in the picture.
View attachment 5126977


I also show a closeup of the Mosfet Module.
The upper LEFT Screw Connection is for the VIN- Pin#3 (also connects to MCU Ground)
The upper RIGHT screw connector is for VOUT- Pin#2. when activated by the MCS it provides a PWM signal ground for the fan.


View attachment 5126979

Hopefully that answers your request.
@AdaBill Quick question: I see you have the PWM and Ground leads of the MOSFET soldered and connected into the breadboard, and then are running dupont wire connectors from those points on the breadboard to your Esp32. Which GPIO pins on the Esp32 are they connected to? Ground and GPIO5? Thanks!
 

AdaBill

Member
@AdaBill Quick question: I see you have the PWM and Ground leads of the MOSFET soldered and connected into the breadboard, and then are running dupont wire connectors from those points on the breadboard to your Esp32. Which GPIO pins on the Esp32 are they connected to? Ground and GPIO5? Thanks!
Yes, the ESP side goes to GND and GPIO5. It should be remembered that the MOSFET module is only switching the GND side of the PWM going to the internal fan circuitry through the connector on the cable provided by Infinity. The + side of the switch is NOT connected. I didn't modify anything in the Infinity fan circuitry. I can unplug my circuit and replug the 10 speed controller provided with the original system and it works without modification. It should also be remembered that the MOSFET module ties the ESP GND into the INFINITY GND, they are interconnected in the MOSFET module. I have had no problems with this interconnection and have been running the system now for 1.75 months.

As background, I have a cold basement, especially with the AC running this summer. I have connected and unused clothes chute from the 2nd floor (2 story house w/basement) and am sucking the hot air from 2nd floor single zone AC system (1st floor is controlled, 2nd floor is only controlled by the ductwork [no auto dampers] and basement is usually colder) and forcing it into basement to up-moderate the temp in basement. It also help de-stratify the various floors differentials. I leave the Infinity system run 24x7. My original plans was to have the ESP read the temp differences between floors and adjust the fan speed to compensate. using 2 DS18B20 temp sensors. I could have just used the 10 speed controller I replaced with the ESP, but at the time I thought the extra control was needed. Plus, it was FUN.

As it turns out, my wife thinks the fan running at higher speed at night causes her to NOT SLEEP!, so I usually back it down to a slower speed at night. The actual controller PWM went from 0 to 100% but I found that I only used 30% to 70% (Mapped to 0 to 100 in S/W) for adjustment ease. I currently just use a POT to run it at 50% mapped at night (acceptable for wife, get dinner) and 70% mapped during the day. I spend a lot of my time in my basement shop/lab so it is not a problem for me to make these manual changes. I'll eventually try to "Automate" it, but for now other projects are calling. I also had to purchase a small Vornado circulating fan from COSTCO ( Pivot 6X on sale recently for $40) to de-stratify the basement temp differentials. It does a great job of stirring up the air and I have it on a smart-plug from 8AM to Midnight 24x7 on 2nd slowest speed.

I have baseboard hot water heat ( circulating via water heater circuit with 24VDC thermostat) for the winter and I'll still be using the INFINITY FAN to help regulate the heat down here also. The gas furnace is 93% efficient and the Hot Water Heater is only around 75%. I'll cross that bridge for the first time this next winter.

Lots of words, but I hope that answered your question.
 

xthursdayx

Member
Lots of words, but I hope that answered your question.
Thanks a lot, you did indeed.

Have tried running multiple PWM signals off the same ESP32? I’m thinking about trying to run both light dimming and fan control off the one ESP32, but wasn’t sure if this would cause any problems.
 

xthursdayx

Member
@AdaBill do you have any concerns about having the Esp32 ground hooked directly to the fan’s ground?

I like your approach, because I prefer not to have to mess with the wiring inside the Cloudline fan control box, but was wondering if isolation is a concern. Someone in another thread mentioned that optoisolators are the “correct” way to manage pwm, but I don’t know enough about electrical circuits to understand why that is more correct than using a mosfet the way you are. I saw this post where the poster is using a PC817 optocoupler plus a couple of resistors to control pwm (via an esp32) without an additional MOSFET, either inside the fan housing, like @zen0n and @Kervork have demonstrated, or outside the housing, like your solution, but don’t know if that is a “better”/safer solution or not.

@shimbob I saw your post in one of the related threads and it sounds like you’re managing your system in a similar was to what I’m hoping to accomplish and using optoisolators for pwm fan control. Do you mind describing how you’re controlling fan pwm? Are you adding a mosfet in wiring in the fan’s control box, or just running Esp32 > optocoupler > resistor > fan?
 

shimbob

Well-Known Member
RaspberryPi gpio output pins to the optoisolators breakout board low voltage input pins, a separate 10V power supply to the optoisolators high voltage input pins, and optoisolator high voltage output pins to the fan or driver pwm input is all I need. Works great.

I added the separate 10V supply (not beefy, only like 0.5A) because I think the 4 pwm channels had too much draw on the 10V supply from the ACInfinity S6 fan and I was occasionally finding the system in a weird state prior to adding the separate supply.
 

xthursdayx

Member
Thanks a lot for the info. Do you not need any additional resistors you’re using this optoisolator breakout board instead of a PC817 and supplying 10V power directly? I’d originally wondered if I needed another power supply for running multiple pwm signals, since the esp32 only outputs 3.3V, but I wasn’t sure.
 

xthursdayx

Member
Thanks again @shimbob. Any chance you could share the additional 10v power supply you're using? I wasn't sure if I'd need an additional power supply for just the Cloudline S4, since it sounded like the 10V from the fan would be sufficient, but it sounds like it might be worth adding anyway. I'd like to use the same ESP32 to control PWM for a Mean Well LED driver (HLG-240H-48AB) on another opto-isolatior, so it'd be great if I could use the same 10v supply for both breakout boards.
 
Top