EcoRenovator  

Go Back   EcoRenovator > Improvements > Conservation
Advanced Search
 


Blog 60+ Home Energy Saving Tips Recent Posts Search Today's Posts Mark Forums Read


Reply
 
Thread Tools Display Modes
Old 04-03-13, 01:33 PM   #91
Daox
Administrator
 
Daox's Avatar
 
Join Date: Aug 2008
Location: Germantown, WI
Posts: 5,525
Thanks: 1,162
Thanked 374 Times in 305 Posts
Default

Haha, that should do it (the box).

Shouldn't be too hard to find a 3.3v linear regulator, nor expensive. I'm sure that thing doesn't require much of anything for current.

As for the wacky readings, I believe its a best practice to average out your sensor readings. I did not do this with my thermal differential controller. Instead, I added a capacitor in parallel with the sensor and this absorbs spikes, but honestly it doesn't do it very well. During the times when the temperature is close to the turn on/off, the fans will kick on and off more than I'd like. Anyway, to remedy this, you can put your sensor readings into an array, then take the average of that array and make your decisions based off of that average. This allows for any off the wall numbers to have a lesser impact. However, if that wacky reading is persistant it will still cause trouble. In any case, you should be able to programatically filter things so that it isn't an issue.

__________________
Current project -
To view links or images in signatures your post count must be 0 or greater. You currently have 0 posts.



To view links or images in signatures your post count must be 0 or greater. You currently have 0 posts.
&
To view links or images in signatures your post count must be 0 or greater. You currently have 0 posts.

Last edited by Daox; 04-03-13 at 01:43 PM..
Daox is offline   Reply With Quote
Old 04-03-13, 02:16 PM   #92
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

Quote:
Originally Posted by Daox View Post
...As for the wacky readings, I believe its a best practice to average out your sensor readings. I did not do this with my thermal differential controller...
All good advice.

But the behavior is really a bit different than the occasional spike. What happens is that the CO2 sensor suddenly jumps up an order of magnitude (I've watched it happen), and stays there. I used to build radios and this behavior reminds me of a super-heterodyne radio that has gotten just a little too much positive feedback and makes nothing but squeals.

But it hasn't done it in a week. When I get the whole thing put together, this kind of behavior will be a problem because if it happens, it is going to suddenly throw the fans full on... forever (until I pull the plug).

I'm going to take a copy of the document that was posted by JSHarris, to next Monday's meeting of the local uber-geeks and see if they can talk me through the digital interfacing issues.

I don't know how techno life is where you live, but living in a techno-rich city like Portland, which has a well developed and very helpful geek social structure is an absolute blessing.

Long live the geeks!

-AC
__________________
I'm not an HVAC technician. In fact, I'm barely even a hacker...

Last edited by AC_Hacker; 04-03-13 at 10:58 PM..
AC_Hacker is offline   Reply With Quote
Old 04-09-13, 01:23 PM   #93
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 More Progress...

I have successfully integrated the SHT15 temp & humidity sensor into my controller.

One issue with the SHT1x family of sensors is that they use a protocol and library that is very similar to the I2C protocol, but not close enough. I read many tales of weeping an wailing and gnashing of teeth in the outer darkness until I found the right library HERE that was right under my nose.

I made the required changes so that the Teensy pins were used instead of the Arduino pins as per the library and sample program.

Integrating the sample program into my central Teensy program was easy, once I calmed down and did the integration in a smaller steps "Try-Test-Try-Test, etc." manner that worked for me previously.


The photo shows the proto board with both the original sensor (DHT11) and also the SHT15, the new addition.

The Teensy runs and displays as before, only now the data is coming from the Sensorion SHT15 instead. In comparing the new readout, the temp display is within a degree, and the RH display is 4% different. I also see a very much faster response time.

After I verified that everything was functioning correctly, I removed the DHT11.

I took the working controller to the local bi-weekly DorkbotPDX meeting last night and showed it off. There was more interest than I would have suspected.

Here's the code I was able to cobble together. If you care about code, you will realize what a hack job I did... but it works:

Code:
/*
 * Example code for SHT1x or SHT7x sensors demonstrating blocking calls
 * for temperature and humidity measurement in the setup routine and
 * non-blocking calls in the main loop.  The pin 13 LED is flashed as a
 * background task while temperature and humidity measurements are made.
 * In addition, the sensor may be placed in low resolution mode by
 * uncommenting the status register write call in setup().
 */
 
 /*
 
  The circuit:
 * LCD RS pin to digital pin 12      => Teensy 5
 * LCD Enable pin to digital pin 11  => Teensy 4
 * LCD D4 pin to digital pin 5       => Teensy 23
 * LCD D5 pin to digital pin 4       => Teensy 22
 * LCD D6 pin to digital pin 3       => Teensy 21
 * LCD D7 pin to digital pin 2       => Teensy 20
 * LCD R/W pin to ground
 * 10K resistor:
 * ends to +5V and ground
 * wiper to LCD VO pin (pin 3)
 */
 
 //Celsius to Fahrenheit conversion
 double Fahrenheit(double celsius)
 {
 	return 1.8 * celsius + 32;
}

//Celsius to Kelvin conversion
double Kelvin(double celsius)
{
	return celsius + 273.15;
}

// dewPoint function NOAA
// reference: http://wahiduddin.net/calc/density_algorithms.htm 
double dewPoint(double celsius, double humidity)
{
	double A0= 373.15/(273.15 + celsius);
	double SUM = -7.90298 * (A0-1);
	SUM += 5.02808 * log10(A0);
	SUM += -1.3816e-7 * (pow(10, (11.344*(1-1/A0)))-1) ;
	SUM += 8.1328e-3 * (pow(10,(-3.49149*(A0-1)))-1) ;
	SUM += log10(1013.246);
	double VP = pow(10, SUM-3) * humidity;
	double T = log(VP/0.61078);   // temp var
	return (241.88 * T) / (17.558-T);
}

// delta max = 0.6544 wrt dewPoint()
// 5x faster than dewPoint()
// reference: http://en.wikipedia.org/wiki/Dew_point
double dewPointFast(double celsius, double humidity)
{
	double a = 17.271;
	double b = 237.7;
	double temp = (a * celsius) / (b + celsius) + log(humidity/100);
	double Td = (b * temp) / (a - temp);
	return Td;
}

// include the library code:
#include <LiquidCrystal.h>

// initialize the library with the numbers of the interface pins
LiquidCrystal lcd(5, 4, 23, 22, 21, 20);

// Define pins for CO2 Sensor
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;

 

#include <Sensirion.h>

const uint8_t dataPin =  10;            // SHT serial data (Teensy)
const uint8_t sclkPin =  11;            // SHT serial clock (Teensy)
const uint8_t ledPin  =  6;            // Arduino built-in LED (Teensy)


const uint32_t TRHSTEP   = 3000UL;     // Sensor query period
const uint32_t BLINKSTEP =  250UL;     // LED blink period

Sensirion sht = Sensirion(dataPin, sclkPin);

uint16_t rawData;
float temperature;
float humidity;
float dewpoint;

byte shtState = 0;
byte ledState = 0;

unsigned long curMillis;               // Time interval tracking
unsigned long trhMillis = 0;
unsigned long blinkMillis = 0;

void setup(){
  // set up the LCD's number of columns and rows: 
  lcd.begin(16, 2);
  // Print a message to the LCD.
  //lcd.print("ACHacker");
  
  // Setup for CO2 Sensor
  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(9600);
  pinMode(ledPin, OUTPUT);
  delay(15);                           // Wait at least 11 ms before first cmd
//  sht.writeSR(LOW_RES);                // Set sensor to low resolution
  sht.measTemp(&rawData);              // Maps to: sht.meas(TEMP, &rawData, BLOCK)
  temperature = sht.calcTemp(rawData);
  sht.measHumi(&rawData);              // Maps to: sht.meas(HUMI, &rawData, BLOCK)
  humidity = sht.calcHumi(rawData, temperature);
  dewpoint = sht.calcDewpoint(humidity, temperature);
  logData();
}

void loop()
{
  curMillis = millis();

  if (curMillis - blinkMillis >= BLINKSTEP) {    // Time to toggle the LED state?
    ledState ^= 1;
    digitalWrite(ledPin, ledState);
    blinkMillis = curMillis;
  }

  switch (shtState) {
  case 0:
    if (curMillis - trhMillis >= TRHSTEP) {      // Start new temp/humi measurement?
      sht.meas(TEMP, &rawData, NONBLOCK);
      shtState++;
      trhMillis = curMillis;
    }
    break;
  case 1:
    if (sht.measRdy()) {                         // Process temperature measurement?
      temperature = sht.calcTemp(rawData);
      sht.meas(HUMI, &rawData, NONBLOCK);
      shtState++;
    }
    break;
  case 2:
    if (sht.measRdy()) {                         // Process humidity measurement?
      humidity = sht.calcHumi(rawData, temperature);
      dewpoint = sht.calcDewpoint(humidity, temperature);
      shtState = 0;
      logData();
    }
    break;
  default:
    Serial.println("How did I get here?");
    break;
  }
}

void logData() {
  //Serial.print("Temperature = ");   Serial.print(temperature);
  //Serial.print(" C, Humidity = ");  Serial.print(humidity);
  //Serial.print(" %, Dewpoint = ");  Serial.print(dewpoint);
  //Serial.println(" C");
  
  
    // Loop for CO2 Sensor
    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     = ");      // Write 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  = ");      // Write val to serial monitor
    //Serial.println(PWM_Value + 54);
    DutyCycle = (100 * (PWM_Value + 54) / 256);   // Calculate DutyCycle
    //Serial.print("PWM DutyCycle = ");      // Write DutyCycle to serial monitor
    //Serial.print(DutyCycle);
    //Serial.println("%");

  //PRINTING TEMPERATURE
  // set the cursor to column 0, line 0
  // (note: line 0 is the first row, since counting begins with 0): %column, row%
  lcd.setCursor(0, 0);  
  // print the Temperature title
  lcd.print("Temp");
  
   // set the cursor to column 5, line 0
  // (note: line 0 is the first row, since counting begins with 0):
  lcd.setCursor(5, 0);  
  // print the Temperature valie
  //****lcd.print(Fahrenheit(DHT11.temperature), 0);
  lcd.print(Fahrenheit(temperature), 0);
  
  // set the cursor to column 7, line 0
  // (note: line 0 is the first row, since counting begins with 0): %column, row%
  lcd.setCursor(7, 0);  
  // print the Temperature 'F'
  lcd.print("F");
  
  //PRINTING RELATIVE HUMIDITY
  // set the cursor to column 10, line 0
  // (note: line 0 is the first row, since counting begins with 0):
  lcd.setCursor(10, 0);  
  // print the Relative Humidity title
  lcd.print("RH");
  
  // set the cursor to column 13, line 0
  // (note: line 0 is the first row, since counting begins with 0):
  lcd.setCursor(13, 0);  
  // print the Relative Humidity value
  //*****lcd.print((float)DHT11.humidity, 0);
  lcd.print(humidity, 0);
  
  // set the cursor to column 15, line 0
  // (note: line 0 is the first row, since counting begins with 0): %column, row%
  lcd.setCursor(15, 0);  
  // print the Relative Humidity percent sign
  lcd.print("%");
  
  
  //PRINTING CO2 READINGS
  // set the cursor to column 0, line 1
  // (note: line 0 is the first row, since counting begins with 0):
  lcd.setCursor(2, 1);  
  // print the CO2 title
  lcd.print("CO2 ");
  
  // set the cursor to column 6, line 1
  // (note: line 0 is the first row, since counting begins with 0):
  lcd.setCursor(6, 1);  
  // print the CO2 value
  lcd.print(ppm);
  
    // set the cursor to column 11, line 1
  // (note: line 0 is the first row, since counting begins with 0): %column, row%
  lcd.setCursor(11, 1);  
  // print the CO2 'ppm'
  lcd.print("ppm");
  
  
  delay(2000);

}
Best,

-AC
Attached Thumbnails
Click image for larger version

Name:	SHT15.jpg
Views:	1412
Size:	54.7 KB
ID:	3142  
__________________
I'm not an HVAC technician. In fact, I'm barely even a hacker...

Last edited by AC_Hacker; 04-09-13 at 01:25 PM..
AC_Hacker is offline   Reply With Quote
Old 02-20-14, 03:00 AM   #94
hygy
Lurking Renovator
 
Join Date: Feb 2014
Location: hungary
Posts: 4
Thanks: 0
Thanked 0 Times in 0 Posts
Default where

Hi AC_Hacker!

Can u please tell me where can I buy this cheap co2 sensor?

thanks
HyGy
hygy is offline   Reply With Quote
Old 02-20-14, 11:08 AM   #95
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

Quote:
Originally Posted by hygy View Post
Can u please tell me where can I buy this cheap co2 sensor?
Hello hygy,

I got mine from a company in the US that buys electronics inventories from failed companies that have failed, then they sell them.

That company has exhaused their supply. The sensor assembly was called the 'Sensair' as I recall, and it was for sensing the CO2 in buildings so as to control the admission of fresh air.

I had seen them at around $75 to $ 224 US, which I considered to be too expensive. So I jumped at the chance to buy some for $10.

I just now did a search on ebay for "CO2 Sensor", and I saw quite a few different sensors at a pretty reasonable price.

What kind of project are you interested in doing?

-AC
__________________
I'm not an HVAC technician. In fact, I'm barely even a hacker...
AC_Hacker is offline   Reply With Quote
Old 02-21-14, 08:24 AM   #96
hygy
Lurking Renovator
 
Join Date: Feb 2014
Location: hungary
Posts: 4
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Hi AC_Hacker,

I searched ebay for co2 sensor too, but the cheapest sensor what I found is about $40 which I considered to be too expensive.

I bouth a katalyt (petrol) stove, what I can use to heat my small tent, or in minibus. But this stove produces co2 and water vapor. So I was thinking about what if there a lot of co2 and I start to sleep, and never finish.

So maybe a good co2 sensor with an arduino and a beeper can help me.

HyGy

Quote:
Originally Posted by AC_Hacker View Post
Hello hygy,

I got mine from a company in the US that buys electronics inventories from failed companies that have failed, then they sell them.

That company has exhaused their supply. The sensor assembly was called the 'Sensair' as I recall, and it was for sensing the CO2 in buildings so as to control the admission of fresh air.

I had seen them at around $75 to $ 224 US, which I considered to be too expensive. So I jumped at the chance to buy some for $10.

I just now did a search on ebay for "CO2 Sensor", and I saw quite a few different sensors at a pretty reasonable price.

What kind of project are you interested in doing?

-AC
hygy is offline   Reply With Quote
Old 02-21-14, 10:31 AM   #97
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

Quote:
Originally Posted by hygy View Post
I searched ebay for co2 sensor too, but the cheapest sensor what I found is about $40 which I considered to be too expensive. I bouth a katalyt (petrol) stove, what I can use to heat my small tent, or in minibus. But this stove produces co2 and water vapor. So I was thinking about what if there a lot of co2 and I start to sleep, and never finish. So maybe a good co2 sensor with an arduino and a beeper can help me.
In my thread about developing a CO2 controlled Heat Recovery Ventilator, I may not have mentioned so much about my experiences of actually having a CO2 monitor in my house. I learned that far more CO2 is generated in my house than I would have ever guessed. It's coming from my gas kitchen stove, my gas clothes dryer, my gas water heater and from a gas heater I bought to warm the basement. I can see on my meter, a rise in CO2 every time I use any of those devices, and often, the rise in CO2 in my house can get to dangerous levels.

I have to say that I have done a lot of work in my house to reduce air leaks, so that is part of why a small problem (CO2) has become a big problem. And it was a big, unseen problem before, but now I can see it with my CO2 unit I built.

This CO2 buiild-up has caused me to start using induction cooking in the winter time when the house is closed.

I haven't yet created a fix for my gas dryer (maybe a heat pump clothes dryer?) or gas water-heater (heat pump water heater?), but they are on my list of things to do.

The gas heater in my basement is absolutely deadly, and it was a mistake to ever buy it. If I even run it for 15 minutes, the CO2 levels in the whole house begin to soar!

The reason I'm telling you all this is to try to impart an awareness that CO2 levels are invisible and have consequences.

Also hygy, you need to know that where ever you have open combustion, not only will you have CO2, but you will also have carbon monoxide in smaller quantities, that is even more deadly.

It would not be beautiful or heroic to be found asphyxiated, in a tent, in the forest.

Your life is worth more than $40.

Best,

-AC
__________________
I'm not an HVAC technician. In fact, I'm barely even a hacker...
AC_Hacker is offline   Reply With Quote
Old 02-21-14, 10:40 AM   #98
hygy
Lurking Renovator
 
Join Date: Feb 2014
Location: hungary
Posts: 4
Thanks: 0
Thanked 0 Times in 0 Posts
Default

About CO2 level in your house: Try to create a heat exchange ventilation, as I know this heat exhangers operates efficiently.

As I know this type of katalyt stove does not produce carbon monoxide. It uses catalytic oxidation, where the 2 main thing what is generated is CO2 and water vapor. As I read about this type of stove, people write I need to let enough ventillation. (But I want to measure it, I want to see exact numbers. Just for safety).
hygy is offline   Reply With Quote
Old 02-21-14, 10:43 AM   #99
hygy
Lurking Renovator
 
Join Date: Feb 2014
Location: hungary
Posts: 4
Thanks: 0
Thanked 0 Times in 0 Posts
Default

But thanks for warning.
hygy is offline   Reply With Quote
Old 02-21-14, 04:15 PM   #100
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

Quote:
Originally Posted by hygy View Post
About CO2 level in your house: Try to create a heat exchange ventilation, as I know this heat exhangers operates efficiently.
Thanks hygy, but the CO2 controller is actually part of a "smart" HRV project that is in the works.

Be safe camping,

-AC

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


Thread Tools
Display Modes

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 04:48 AM.


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