Before I go into what I plan to do, I’ll go over what I already did.
The Twin Computer Fans
My grow tent has 2 axial fans for air exchange, one intake + one exhaust. These are basically souped up computer case fans which advertise ~180CFM. Unfortunately they are also really noisy when operating at max capacity
Another downside is that the flow of air is not particularly well directed. Great for forcing air out of a computer case, but not quite powerful enough to overcome the pressure losses of longer ducts.
The fans already have a hard time moving air, and any addition of filters or other restrictive equipment will prove to be too much for the current system. Simply put, I need more power.
These fans do, however, have an upside. It’s in the simplicity of their control.
These fans run on 24V power, which is the same as most of my other electronics. Their speed is controlled by a 25kHz PWM signal, which my controller can output natively. I can use a temperature sensor to send an analog signal to my controller, then change the speed (duty cycle) of the fans proportionally to the change in temperature. Doing this, I can have an automatic variable speed control with only 1 cable from the controller to each fan and I never even have to touch mains electricity.
Analyzing the Cloudline
This was the logical next step up. It’s an AC infinity cloudline S4. The advertised CFM rating isn’t that much higher than the computer fans, but it certainly feels as though it is. It also feels much more directed which will undoubtedly help with the ducting. It’s also designed for grow tents, not computers.
One of the main draws for these fans is the fact that their speed is controlled by a PWM signal, much like the case fans. This is very beneficial since that means I can control the speed with a low voltage digital signal, rather than messing with an analog signal connected to mains power. The controller is also detachable, meaning that I can replace it with some other circuit that will spit out a PWM signal of my choosing.
I cant find any wiring diagrams for the Cloudline, so I’ll have to probe around a bit and figure things out.
I can see that the signal is a square wave with a frequency of 5.22 kHz, and is not inverted. The rising edge is a little rounded, and I’m not certain if this is due to parasitic capacitance in the circuit or if it’s meant as a ‘soft start’ on every pulse of the fan. If I’m going to try to imitate this signal, it might be worth trying to conserve this curve as it might increase the longevity of the fan.
PLC as a Function Generator
Before I get started on the circuit, I have to adjust my controller to the new parameters of this signal. I already have a PID controller programmed onto the PLC, so in reality all I will have to do is modify the frequency of the signal.
The basic functionality of the temperature controller is this:
– A temperature sensor reads the temperature inside the tent
– The controller compares this temperature to a set point and creates an error value
– The controller outputs a signal whose duty cycle (width) is proportional to the error value
– The fan always operates at a minimum of 20% and a max of 100%
The reason for the minimum fan duty cycle is for two reasons. One is to make sure there is always some air exchange within the tent (so that oxygen is pumped out and fresh CO2 pumped in) and the other is to prevent the fan from completely turning off. Most fans will shut down if a certain minimum power is not met, so 20% duty cycle should keep the fan above that threshold.
Analog sensors like this pt100 don’t output a temperature value directly, so you have to translate the data into something more usable. In my case, I am using a transmitter to convert the resistance of the temperature sensor into a 0-10V signal that my controller can read. The controller splits this 0-10V into 4095 smaller increments, and assigns these values across the sensor’s advertised range. In this case 32-212 degrees Fahrenheit (or 0-100 Celsius for more sensible people)
This temperature is then passed on as the process variable of a controller. This value is then subtracted from the desired setpoint (in this case, 78 degrees) and a control variable (the fan duty cycle) is calculated. One issue with a system like this is that they are very hard to tune when response times are so slow, or when ambient temperatures fluctuate so wildly and unexpectedly.
The control variable is then converted to a data type the PWM output can understand, and output at the frequency desired.
The result is a 5.22 kHz square wave, and with a dummy load I can check this out on the scope. If I were to hold the temperature probe in my fingers, the PLC would react to the change in temperature and increase the duty cycle of this pulse. For the sake of taking accurate measurements, I’ll leave this signal at the minimum value.
The First Circuit
Now comes the question of how to move the controlled signal from my PLC to the fan. Because the two circuits are electrically isolated, my solution is to use an optocoupler to transfer the signal, then use a comparator with a low — but fixed — voltage on the non-inverting pin. Since optocouplers aren’t necessarily fast this comparator should immediately jump high when the voltage on the optocoupler output pin crosses that threshold. I created a diagram using common components like the 4N25 optocoupler, a 2N3094 transistor and a LM393 comparator.
I’ll throw this together on the breadboard and see where I stand with the signal.
The purple line is the PWM output of the PLC, the yellow is the output pin of the optocoupler. I can see that the 4N25 has a pretty long rise time, like 50us which could be significant after inverting.
Here we can see pulses generated by the PLC in purple and the output pulse of the comparator. There is a small propagation delay at the beginning, but we can see that the falling edge lags quite a bit behind the original signal.
Saving the original pulse as a reference, I can see that the comparator output’s delay is due to the slow rise time of the optocoupler. The opto takes about 6us to reach the threshold voltage on the non-inverting input, which is a bit much considering that translates to a 15% increase in on-time when operating at the lowest speed. It isn’t a huge problem, as I don’t think the plants will care too much about the accuracy of the fan, but if all it takes are a couple of tweaks to the circuit, why wouldn’t I fix it?
The Second Circuit
To reduce the rise time of the optocoupler, I decided to move around the components into a cascode arrangement. This will reduce the gain of the system, but should improve the bandwidth. I will also place a potentiometer on the base of the transistor to adjust the bias voltage.
Probing the collector of the 2N3904 and adjusting the potentiometer I can acquire a much faster and better looking signal. It’s impressive how much the signal can change with the same components arranged in a different way.
Probing the output of the comparator, we can see a much more square version. Adjusting the bias voltage on the 2N3904 will ultimately affect this output, so we can tune the potentiometer until the two pulse widths are the same.
I can now feed this square wave into the fan itself and observe the results. I’ll rig some wires into the connector anda use the +10V and GND of the fan itself to power my breadboard.
Adding the fan rounded the rising edge of the square wave like the one we had seen before. The old and the new are remarkably similar, and the fan is functioning well. When I apply heat to the temperature sensor, the duty cycle of the PWM signal increases as does the fan speed.
The bulk of the electronic design is done, it’s just missing some decoupling capacitors and reverse polarity protections. I’ll have to convert the circuit diagram into a CAD file, as well as design an enclosure for the board and connectors. I have some ideas on how to create a PCB using a benchtop mill and lasers, and will make my next post about that.
Me sorprendes Alexis. Me gustó mucho la explicación tan detallada. Aunque Pepa dice que lo voy a entender, no ha sido así, me he quedado con dudas. Lo que me hizo reír fue la traducción que hizo Chrome (me traduce automáticamente del Inglés al Español) y lo mejor es el título: “Los fanáticos de las computadoras gemelas”