NOTICE: This forum has been archived (i.e. registration and posting is disabled).
Please go to the new forum at https://forum.kylegabriel.com
[Solved] Controlling an EC-Fan via PWM
Maybe a Mycodo user has already got an EC-Fan integrated into their setup and can help me out.
I have a brushless electronically commutated centrifugal exhaust fan whose speed I would like to regulate via PWM 1-10kHz through Mycodo. The fan sends back the RPM via Open Collector and offers a 10v 1.1mA power supply for external controllers. Having 0 background in electrical engineering, what exact hardware would i need to realise this? From what i have read so far ( https://www.raspberrypi.org/forums/viewtopic.php?f=37&t=220214) i will need to buy an opto-isolator and a bunch of resistors to do this? Alternatively to PWM the fan-speed can also be adjusted via an analog 0-10v signal.
Here is the documentation and wiring-diagram of my specific EC-Fan, however the connection-standard seems to be identical across all manufacturers of EC-Fans - the standalone controllers sold for these fans work across all manufacturers: (page 19-21 seem to be of interest): https://www.ziehl-abegg.com/de-en/service/downloads?tx_hbziehlabegg_downloads%5Baction%5D=preview&tx_hbziehlabegg_downloads%5Bcontroller%5D=Download&tx_hbziehlabegg_downloads%5Bfile%5D=22448&cHash=dfafd78f14d911d8f2ec2c6c0997d39a
I don't have much experience controlling fans via PWM. It's not apparent to me from the datasheet what voltage is needed for the PWM signal. It might be better to use a transistor or MOSFET with the Pi's PWM signal so you're not directly connecting the Pi to the PWM input of the fan. However, this might not be an issue if you use a voltage divider (if 10 volts is needed) and you don't exceed the current limitation of the GPIO. I have so many Pis lying around I'd be tempted to just hook it up and run a few experiments. Alternatively, the first digital-to-analog converter has been added to the Mycodo repertoire recently (in the yet-to-be released v8.9.0), the MCP4728, which allows you to generate voltages that can be used to control your fan. So, you have both options available to experiment with.
I came across a post in a forum where someone had a schematic that stated "PWM 10Vmin", that would also make sense as the power the controller is supplied with by the fan is 10V.
Probably it makes sense trying to go the PWM route before going the DAC route and keeping that as a backup plan. Would you agree?
EC Fans are pretty cool and worth checking out, they come in many different shapes and sizes. Their purchase price can be a bit higher but due to their ability to operate more efficiently than conventional fans they have seen widespread introduction under the EU's ecodesign directive. I upgraded my ventilation to an EC Fan when i first started experimenting with monitoring my grow environment using a Pi, having in mind the possibilities of environmental control.
I have also searched for exact this topic and i came across this post:
Its just a led controlled with a raspi pwm pin.
Hope this helps someone!
that's not exactly what I'm looking for as , unlike conventional fans, EC fan RPM isn't controlled by the voltage they are supplied with but rather electronically - what I need is basically a solution to get a 10V 1-10kHz PWM Signal out of the Pi. It seems like a possible solution would be to use the 1.1mA 10VCC coming out of the Fan and an opto-coupler.
Could someone with a bit of knowledge please look over the attached schematic i found on an abandoned thread in a Forum? Can I replace the 420 Ohm resistor with a 470 Ohm one?
The author states their schematic works, however the signal would be inverted, i.e. at 0% duty cycle the fan runs with 100% RPM and at 100% duty cycle it runs with 0% RPM. How would one inverse that? They also provided a schematic for getting the open collector Tachometer to work, i will post that one too.
**Disclaimer I am new to Mycodo 👍 and Automation so this is just to help point someone in the right direction. Follow manufacturer instructions**
Sound like a L298N would work for you provided your AMP draw is not more then it can handle or relay would be required and need to be turned on before the PWM is sent.
The L298N needs external 12volt power to operate the motors. It can also use this 12 volt for 5v power to operate the board. Or you can supply the 5v power from elsewhere, you have to remove the jumper(jumper not near any others.
This has 2 channels 1.5-2amp depends on manufacturer
jumpers on the enable pins disable the pwm and run it a max
GPIO pins to operate:
1. ch1 Enable 1 (remove jumper, PWM signal
2. ch2 IN1 (switch IN1 and IN2 between HIGH & LOW to Reverse directions
3. ch3 IN2
This board needs ground to the pi.
EDIT This board uses 0.7 volts per channel to operate. There are other better solutions that dont waste as much voltage. In you case the voltage loss is not a problem needing 10v I went with the l298n since i am cheap. I have tested it. working on getting into my prototype.
Could someone with a bit of knowledge please look over the attached schematic
Schematic looks good. It's the same found on the datasheet ( https://www.farnell.com/datasheets/73758.pdf ).
Sound like a L298N would work for you
I don't think the L298N is appropriate here. The Pi can generate a PWM signal, it's now merely about getting to the correct voltage the fan can accept.
The PWM signal is not powering his fan, it's merely a signal. Therefore a cheaper chip like a simple transistor is all that's needed to use the Pi's PWM signal to generate a higher voltage PWM signal for the fan's input. Using a L298N seems like overkill.
Hey guys, just wanted to report that i have been successful in controlling the EC fan via PWM using the following schematic:
The only thing this setup wont do is read the fan-RPM via open collector, this isn't a big issue though as i have compared it with a bought controller for the fan and the speed corresponds to the inverted duty cycle.
I found the same issue with my terrabloom fan when controlling with a similar circuit, that the PWM control is inverted, causing the fan to go full speed when the Pi shuts down or restarts. I've been meaning to sit down to redesign the circuit so it's not inverted.
Can you help me create a set of functions that allow me to set a default duty cycle, maximum duty cycle, minimum duty cycle to then use fan speed in conjunction with my IR-heater PID to regulate both temperature and humidity? i.e. when the temperature is under the PID setpoint the duty cycle decreases so less energy is needed for the heater to increase temperature unless the humidity is above a certain setpoint / when it gets hot in summer the fan increases.
That sounds complex. At the moment I don't think I can devote the kind of time I think would be needed to develop such a function.
i have extended my existing circuit by another transistor to invert the duty cycle. Also, i have added the possibility to read out the RPM via OpenCollector:
The Signal(Revolutions) Input would be the correct one to read out the RPM, correct?
Figured it out, reading the RPM works great. However, I have a feature request for controlling the fan speed. Can you please update the Bang-bang function to allow 2 duty cycle setpoints to have a simple two-speed control with hysteresis for the exhaust fan?