EcoRenovator  

Go Back   EcoRenovator > Improvements > Conservation
Advanced Search
 


Blog 60+ Home Energy Saving Tips Recent Posts


 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
Old 02-22-13, 10:17 PM   #11
AC_Hacker
Supreme EcoRenovator
 
AC_Hacker's Avatar
 
Join Date: Mar 2009
Location: Portland, OR
Posts: 4,004
Thanks: 303
Thanked 723 Times in 534 Posts
Default Revisiting the 'stalled fan' issue...

I've been doing more experimenting with the 'stalled fan' issue mentioned previously.

My current solution is to add an integer number to the PWM_Value, this way when the CO2 level drops, as when I'm away from the house, the fans will be kept just barely turning. In the unusual event that a gust of wind happened to be exactly enough to stop the fan, I wanted the fan to be able to restart, at a very low speed, even when CO2 values were at their minimum, which means that I need a PCM_value of 92 minimum, which translates to a minimum duty cycle of 36%.

The range of CO2 ppm that is conveyed by the sensor's analog value is:
0 volt = 0 ppm
4 volt = 2000 ppm

... and this will yield the following PWM_Value in my Teensy:
0 ppm = 0 PWM_Value
2000 ppm = 256 PWM_Value

So, I set up the ratio:

(300 ppm) / (2000 ppm) = (x PWM_Value) / (256 PWM_Value)

Therefore:

(x PWM_Value) = ((300 ppm) * (256 PWM_Value)) / (2000 ppm)

So: x PWM_Value = 53.6 (when ppm is 300)


But the fans have a minimum start-up threshold of 90 PCM_value, so:

90 - 38.4 = 53.6 (rounding up to 54)

I'll 'pad' my PCM_value by adding 54, as in the code below:


Code:
int CO2_ReadPin = 38;                    // initialize pin 38 for analog voltage in
int PWM_WritePin = 14;                   // initialize pin 14 for PWM
int CO2_Value;
int PWM_Value;
int DutyCycle;
int ppm;
 
void setup()   {                         // BEGIN SETUP
  pinMode(PWM_WritePin, OUTPUT);         // Make PWM_pin (AKA: pin 14) an output pin
  int CO2_Value = 0;                     // variable set to zero
  int PWM_Value = 0;                     // variable set to zero
  int DutyCycle = 0;                     // variable set to zero  
  int ppm = 0;                           // variable set to zero 
  Serial.begin(38400);                   // Initialize Serial Monitor
}                                        // END SETUP

void loop()               
{                                        // BEGIN LOOP
  CO2_Value = analogRead(CO2_ReadPin);   // read Teensy input pin 38
  unsigned int ppm = ((unsigned long)analogRead(CO2_ReadPin) * 2500)/1024;  // calc ppm
  Serial.print("CO2 level     = ");      // print ppm to serial monitor
  Serial.print(ppm); 
  Serial.println(" ppm");
  PWM_Value = CO2_Value/4;               // Scale CO2_Value (range = 1024) to PWM_Value (range = 256)
  analogWrite(PWM_WritePin, (PWM_Value + 54));  // Write PWM_Value to PWM_WritePin
  Serial.print("PWM_Value is  = ");      // print val to serial monitor
  Serial.println(PWM_Value + 54);
  DutyCycle = (100 * (PWM_Value + 54) / 256);   // Calculate DutyCycle
  Serial.print("PWM DutyCycle = ");      // Print DutyCycle to serial monitor
  Serial.print(DutyCycle);
  Serial.println("%");

  Serial.println();                      // print null line to serial monitor

  delay(1000);			         // delay 1 second before repeating loop
}                                        // END LOOP
So far, I have tested it out for several days, and no problem.

Best,

-AC

__________________
I'm not an HVAC technician. In fact, I'm barely even a hacker...
AC_Hacker is offline   Reply With Quote
 



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -5. The time now is 02:51 AM.


Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2024, vBulletin Solutions Inc.
Ad Management by RedTyger
Inactive Reminders By Icora Web Design