possible to use fan in on/off mode?


 

Shane Woessner

TVWBB Member
Would it be possible to use the fan in on/off mode all the time like with the less then 10% by changing this line

#define MINIMUM_FAN_SPEED 10
to read
#define MINIMUM_FAN_SPEED 90
or any other value I feel necessary? I fried my board waiting on new components now.
As seen here: http://tvwbb.com/showthread.php?103...ontroller-Part-2&p=58237&viewfull=1#post58237
I'm thinking my fan was pulling too much amperage while I was trying to tune the PID parameters. I'm at a loss.....
 
Yup that's what it is supposed to do anyway. The logic is basically if the PID wants to run the fan at any value (FANSPEED) less than your MAX, then it runs the fan at your MAX for FANSPEED/MAX seconds out of every 10 seconds. Remember the PID only updates every 2 seconds so the FANSPEED/MAX is rounded to the nearest 2 second interval.
 
Bryan,

I am a bit confused about the 2 second rounding happening in conjunction with the 2 second PID update rate... I'm not getting why they are really related.

Imagine that you have a Control Variable (CV) of 35%, so in this mode 3.5 seconds at MAX speed of every 10 second cycle. 10 Seconds becomes your new PWM frequency, and 35% becomes your new duty cycle. The PID running every 2 seconds should "update" the CV to say 45%, but the PWM Duty cycle would not be updated until the next PWM cycle, which could be up to like ~9.99 seconds away depending on how the phasing lines up. On the start of the next PWM cycle, the fan would be on at full power for 4.5 seconds of every 10 second cycle.

What am I missing here? If it indeed rounds the CV to 0,2,4,6,8,10 seconds per 10 seconds, you probably still get decent control, but it could be a lot better with more precise proportional control.

As for the pulling too much amperage, the fan should pull the most current at 100% duty cycle when the fan is stopped. If the fan pulls too much amperage for your wiring to handle, you should set the MAX value down some to avoid 100% duty cycle (12v).
 
The reason it rounds to 2 second intervals is because when running in that mode, the output is only updated when there is new input data. Input data arrives at 0.5Hz so the only possible switch points are on 2 second boundaries. The PID controller could run them independently, but that would require the output to maintain its own timer which I didn't see the point in at the time and code space was at a premium.
 
Bryan,

I see what you mean... the ability to turn on / off the PWM pin (switch it from high to low) only happens inside the PID code loop, which runs at 0.5Hz. Normally that is a not a problem since the setpoint only updates every 2 seconds anyway, you always have "fresh" data to update the pwm duty cycle with.

It might be worth separating PID setpoint and fan control and breaking the "Long PWM", or SRTP as we called it before out into a loop that runs at a much higher rate, maybe 100Hz or so. It will not hurt to update the True PWM at a faster rate than the setpoint changes at when running in normal mode, and it would allow much better proportional control of an electric heater, and for that matter the Fan. If you decide it is worth the change, you would probably want to impose an additional minimum "on" time so that duty cycles near the bottom do not cause the problem you are trying to avoid in the first place. For a BLDC fan, this would equate to the startup time, and for an SSR (Solid state Relay), it would need to stay on longer than 1/60 seconds to avoid flickering and inconsistent on times.
 
Yeah I see what you're saying. I didn't even think about it much at the time I added it. It would be pretty easy to use the fan percentage as the number of 100ms intervals to run over the 10s period. I'm not sure how much more accuracy you'd get out of it given the disparity in runtime would be 1s out of every 10s. I'm curious to see how well the HeaterMeter does just as it is now running as a sous vide machine.

Still, I'll put it on my TODO list of things to remember to think about more some day.
 
When I get around to buying a heater I'll rig it up and see how it works. I need to research a bit more, and we can probably make a sous vide thread soon to get some discussion going. DIY sous vide is nothing new, most people just use cube style PID controllers, we will use all the great things heatermeter does. Unfortunately the food will taste the same, but who else can serve their food with a graph?

Here are the initial pieces I plan to use after 10 minutes of research this morning:

http://www.amazon.com/dp/B004HHW0FU/?tag=TVWB-20

http://www.amazon.com/dp/B005D6145G/?tag=TVWB-20 <- not needed probably, but cool none the less.

http://www.amazon.com/dp/B005KPGPU4/?tag=TVWB-20

Heater (something like this, smaller ones are $10):

http://www.amazon.com/dp/B000BD8JAE/?tag=TVWB-20

This is about max of what you would want to pull through a household 120v socket. (12.5A)
 
Oh, fyi, I'm not sure if the PWM driver you are using (analogwrite) supports changing the PWM frequency, but if it does, and you can set it as low as .5 Hz, you can ditch the loop all together and let the PWM be handled in the avr's hardware PWM. Without researching it first, I somehow doubt you can pwm that slow in hardware...

Edit: Looks to not be possible. Oh well.

This is interesting though (via http://arduino.cc/en/Reference/analogWrite):

Notes and Known Issues
The PWM outputs generated on pins 5 and 6 will have higher-than-expected duty cycles. This is because of interactions with the millis() and delay() functions, which share the same internal timer used to generate those PWM outputs. This will be noticed mostly on low duty-cycle settings (e.g 0 - 10) and may result in a value of 0 not fully turning off the output on pins 5 and 6.
 
Last edited:
When I get around to buying a heater I'll rig it up and see how it works. I need to research a bit more, and we can probably make a sous vide thread soon to get some discussion going. DIY sous vide is nothing new, most people just use cube style PID controllers, we will use all the great things heatermeter does. Unfortunately the food will taste the same, but who else can serve their food with a graph?
Yeah! I was talking to my boss this morning and we decided that it would be fun to make a food-safe lmremote probe that you can put in with the food too. No other sous-vide machine has food probes either!
 
The only problem I see with that is that it would need to keep a vacuum seal on the main bag as to not let water in and juices out. Doable, but might be tricky.
 

 

Back
Top