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 03-08-13, 02:27 AM   #61
kostas
Helper EcoRenovator
 
Join Date: Dec 2012
Location: Venice, Italy
Posts: 89
Thanks: 15
Thanked 41 Times in 19 Posts
Default

As I said earlier, the DHT22 is more accurate as it ranges from -40 to +125°C with a +-0,5% accuracy.
You can find the differences between the two sensors here:
Overview | DHTxx Sensors | Adafruit Learning System

kostas is offline   Reply With Quote
The Following User Says Thank You to kostas For This Useful Post:
Mikesolar (03-08-13)
Old 03-08-13, 06:01 AM   #62
Mikesolar
Master EcoRenovator
 
Mikesolar's Avatar
 
Join Date: Aug 2012
Location: Toronto
Posts: 958
Thanks: 40
Thanked 158 Times in 150 Posts
Default

Quote:
Originally Posted by AC_Hacker View Post
Yeah, the one I have is for a more limited range. Since I want to use in inside the house, the range was not so important.

I think yours uses a different library, but everything else is pretty much the same.

If it's temperature only that you want, I really like the 1-wire sensors. They have a pretty good range of temperatures, and they're accurate.

But I also found some interesting honeywell temperature and humidity sensors that are more expensive, but I'm pretty sure they're more accurate.

I'm gonna continue on with the DHT11, until I see a definite reason to go another direction.

Best,

-AC
The ones I bought look just like yours (but are DHT22) so maybe they are not so different in the coding, we will see. Interesting thing is that the cost, even of the Honeywell units, is super cheap compared to what we pay in the controls industry when we buy from a DDC supplier. The contractor cost may be $150 for a combined sensor so to me, this a steal.

For thermisters, the standard in the HVAC controls industry is anywhere from a 1k to a 10k standard 2 wire thermister. I don't understand why Arduino decided on these "1 wire" units. Unless they are to be soldered into a board, I don't see a need for them especially if they are to be potted and outdoors.
Mikesolar is offline   Reply With Quote
Old 03-08-13, 08:19 AM   #63
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 Mikesolar View Post
...I don't understand why Arduino decided on these "1 wire" units. Unless they are to be soldered into a board, I don't see a need for them especially if they are to be potted and outdoors...
I didn't expect to like the 1-wire temperature sensors, but now I do.

The fact that they are digital is a bonus, since analog sensors suffer inaccuracies form temperature changes affecting the resistance of the wire between the sensor and the Arduino (or other cpu), and therefore the readings.

The 1-wire name is a misnomer. They really need at least 2 wires one is data+voltage and the other is ground. In this arrangement, the sensors use little capacitors to store enough charge between data pulses, to run the chip. The requirements to do this are pretty stringent and from folks I have talked to, their reputation of reliability in this configuration is not so good. But with a separate voltage wire and ground and data, they are easy to set up and very reliable. They advertise 0.1 degree accuracy.

The application where they are best used is to string several of them in series. They each have a unique identification number baked in at the factory, so it's easy to tell which data is coming from which chip.

The best part is that you can have a large string of sensors (up to 127) and they all use the same data pin on the Arduino.

I first became aware of them when I was trying to log data from my homemade heat pump and the data logger I was using only had 8 data pins, and I wanted to be able to use more sensors than that. Now I have them strung all through my house, reading the temperature of each room.

And I don't think Arduino 'decided' on the one wire sensors, I think it is more like the 1-wire sensors are so popular, a 1-wire library was included in the Arduino IDE.

You can use analog temperature sensors with Arduinos also, but you have to dedicate a separate data pin to each sensor. Analog sensors are so simple to use, no library is needed.

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

Last edited by AC_Hacker; 03-08-13 at 08:37 AM..
AC_Hacker is offline   Reply With Quote
Old 03-08-13, 12:29 PM   #64
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 Progress with LCD Display...

Before the temperature/humidity sensors came in, I was trying to get the LCD display running on the Arduino.

There's are good tutorials everywhere with libraries & sketches, and this morning I discovered that the Arduino IDE had LCD libraries & a sample sketch already installed on my computer. Things are really getting convenient.


I didn't want to solder to the LCD, so I used a flat cable and made a breakout board that had a socket strip that gave me the ability to prototype in a similar manner to the setup on my proto-board.

So the task was to download a data sheet for my LCD and make a connection scheme, so that I could make adjustments for the differences between the Arduino pinout and the Teensy pinout.

Here's the sketch I found in the Arduino IDE Library file "LiquidCrystal", with the changes I made to suit the Teensy:

Code:
/*
  LiquidCrystal Library - Hello World
 
 Demonstrates the use a 16x2 LCD display.  The LiquidCrystal
 library works with all LCD displays that are compatible with the 
 Hitachi HD44780 driver. There are many of them out there, and you
 can usually tell them by the 16-pin interface.
 
 This sketch prints "Hello World!" to the LCD 
 and shows the time. CHANGED TO SUIT 8 CHARACTER DISPLAY
 
  The circuit:
 * LCD RS pin to digital pin 12      -> 5  CHANGED
 * LCD Enable pin to digital pin 11  -> 4   CHANGED
 * LCD D4 pin to digital pin 5       ->23  CHANGED
 * LCD D5 pin to digital pin 4       ->22  CHANGED
 * LCD D6 pin to digital pin 3       ->21  CHANGED
 * LCD D7 pin to digital pin 2       ->20  CHANGED
 * LCD R/W pin to ground
 * 10K resistor:
 * ends to +5V and ground
 * wiper to LCD VO pin (pin 3)
 
 Library originally added 18 Apr 2008
 by David A. Mellis
 library modified 5 Jul 2009
 by Limor Fried (http://www.ladyada.net)
 example added 9 Jul 2009
 by Tom Igoe
 modified 22 Nov 2010
 by Tom Igoe
 
 This example code is in the public domain.

 http://www.arduino.cc/en/Tutorial/LiquidCrystal
 */

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

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

void setup() {
  // set up the LCD's number of columns and rows: CHANGED TO SUIT 8 CHAR DISPLAY
  lcd.begin(8, 2);
  // Print a message to the LCD.
  lcd.print("ACHacker");
}

void loop() {
  // set the cursor to column 0, line 1
  // (note: line 1 is the second row, since counting begins with 0):
  lcd.setCursor(0, 1);
  // print the number of seconds since reset:
  lcd.print(millis()/1000);
}
Ran first time... no issues.


Life is good.

Best,

-AC
Attached Thumbnails
Click image for larger version

Name:	ACHacker-LCD.jpg
Views:	2129
Size:	65.5 KB
ID:	3054   Click image for larger version

Name:	breakout-2.jpg
Views:	3209
Size:	52.9 KB
ID:	3055  
__________________
I'm not an HVAC technician. In fact, I'm barely even a hacker...

Last edited by AC_Hacker; 03-08-13 at 12:32 PM..
AC_Hacker is offline   Reply With Quote
Old 03-08-13, 04:48 PM   #65
stevehull
Steve Hull
 
Join Date: Dec 2012
Location: hilly, tree covered Arcadia, OK USA
Posts: 826
Thanks: 241
Thanked 165 Times in 123 Posts
Default

Quote:
Originally Posted by AC_Hacker View Post

The fact that they are digital is a bonus, since analog sensors suffer inaccuracies form temperature changes affecting the resistance of the wire between the sensor and the Arduino (or other cpu), and therefore the readings.
-AC
Really?

Digital has precision, not necessarily accuracy. There could be an entire discussion of double and triple precision data logging here

On the other hand analog thermistors have incredible precision, but less so on accuracy.

The calculation of wire resistances with temperature changes in a home environment are incredibly tiny.

For me a 10K thermistor, a bit of code (or analog device) to change the non-linear temp response, is an easy one to buy into.

But I certainly do admire your learning about data logging and instrumentation!

Steve
__________________
consulting on geothermal heating/cooling & rational energy use since 1990
stevehull is offline   Reply With Quote
Old 03-08-13, 08:27 PM   #66
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 stevehull View Post
...For me a 10K thermistor, a bit of code (or analog device) to change the non-linear temp response, is an easy one to buy into...
Wow, sounds like another fabulous thread!

Where are you going to find the time?

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

Last edited by AC_Hacker; 03-08-13 at 08:55 PM..
AC_Hacker is offline   Reply With Quote
Old 03-09-13, 10:41 AM   #67
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 Combining CO2, Humidity & Temperature...

I spent a couple of hours messing around with the sample programs for CO2, from the Telaire 6004 and temp and humidity data from the DHT11, in an effort to combine three programs into one.

I was successful, and I learned a useful technique...

The Arduino has a debug capability, but it is pretty limited, and sometimes its error messages can lead you to look in the wrong place for errors.

So at first I totally combined two programs and when I compiled, I got a crap-storm of inscrutable error messages that were quite discouraging.

So I adapted the technique such that I would add a fairly small segment of code, and compile after each addition. This let me know that if there was a conflict in that addition, it was limited to that code segment, or to the previous omission of variable declarations that particular piece of code required. This made the task of debugging much, much easier.

So, here's the total blob of working code, which I will sanitize when time permits.

Code:
/*
 
  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);

#include <dht11.h>

dht11 DHT11;

#define DHT11PIN 2

// 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;


void setup() {
  // set up the LCD's number of columns and rows: 
  lcd.begin(8, 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 
  
}

void loop() 
{
  int chk = DHT11.read(DHT11PIN);

  Serial.print("Read sensor: ");
  switch (chk)
  {
    case DHTLIB_OK: 
		Serial.println("OK"); 
		break;
    case DHTLIB_ERROR_CHECKSUM: 
		Serial.println("Checksum error"); 
		break;
    case DHTLIB_ERROR_TIMEOUT: 
		Serial.println("Time out error"); 
		break;
    default: 
		Serial.println("Unknown error"); 
		break;
  }
    // 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("%");

  // 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
  lcd.print("T");
  
   // set the cursor to column 0, line 0
  // (note: line 0 is the first row, since counting begins with 0):
  lcd.setCursor(1, 0);  
  // print the Temperature
  lcd.print(Fahrenheit(DHT11.temperature), 0);
  
  // set the cursor to column 0, line 0
  // (note: line 0 is the first row, since counting begins with 0):
  lcd.setCursor(4, 0);  
  // print the Temperature
  lcd.print("H");
  
  // set the cursor to column 0, line 0
  // (note: line 0 is the first row, since counting begins with 0):
  lcd.setCursor(5, 0);  
  // print the Temperature
  lcd.print((float)DHT11.humidity, 0);
  
  // set the cursor to column 0, line 0
  // (note: line 0 is the first row, since counting begins with 0):
  lcd.setCursor(0, 1);  
  // print the Temperature
  lcd.print("CO2 ");
  
  // set the cursor to column 0, line 0
  // (note: line 0 is the first row, since counting begins with 0):
  lcd.setCursor(4, 1);  
  // print the Temperature
  lcd.print(ppm);
  

  delay(2000);
} 
  
  
//
// END OF FILE
//
The code is working, reading all sensors, running the PWM blower, as before, and giving me a useful, but limited visual readout on the little LCD display.


Still to do:
  • Sanitize code
  • Get a larger, lighted, 16x2 LCD display
  • Determine if humidity data will be useful to the workings of the HRV
  • If humidity data is useful, how should it best be combined with the CO2 data to determine ventilation rate.

On this last point, I'm thinking of summing the CO2 curve with the humidity curve, but I'll need to consider the "comfort zone" boundaries.


Best,

-AC
Attached Thumbnails
Click image for larger version

Name:	T_H_CO2.jpg
Views:	2174
Size:	46.0 KB
ID:	3056   Click image for larger version

Name:	comfort-zone.jpeg
Views:	1579
Size:	9.6 KB
ID:	3057  
__________________
I'm not an HVAC technician. In fact, I'm barely even a hacker...

Last edited by AC_Hacker; 03-09-13 at 05:42 PM..
AC_Hacker is offline   Reply With Quote
Old 03-09-13, 01:48 PM   #68
kostas
Helper EcoRenovator
 
Join Date: Dec 2012
Location: Venice, Italy
Posts: 89
Thanks: 15
Thanked 41 Times in 19 Posts
Default

Excellent work AC
kostas is offline   Reply With Quote
The Following User Says Thank You to kostas For This Useful Post:
AC_Hacker (03-09-13)
Old 03-10-13, 05:37 PM   #69
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 Replaced DHT11 sensor... Problem solved.

The DHT11 sensor I was using did not jive with a couple of other sensors I have for comparison. I can forgive a difference of a degree, or maybe even two, but 5 degrees is just too much.

When I ordered the sensor, I ordered two, and yesterday I unplugged the old sensor, and plugged in the new sensor.

Now temperature and humidity are tracking with the accuracy I would expect.

Problem solved.

-AC
__________________
I'm not an HVAC technician. In fact, I'm barely even a hacker...
AC_Hacker is offline   Reply With Quote
Old 03-19-13, 04:15 AM   #70
JSHarris
Lurking Renovator
 
Join Date: Mar 2013
Location: UK
Posts: 2
Thanks: 0
Thanked 1 Time in 1 Post
Default

Hi, I've only just joined this forum as I found it when looking for data on the Telaire 6004 CO2 sensor.

I have spent hours looking for data on these (other than the rather sparse data sheet) and after writing to Telaire I have now obtained the full data on the UART/SPI serial data protocol that these sensors use as an option. This seems more versatile than using the analogue voltage, as the sensor can be programmed and interrogated via this connection.

I have the document from Telair as a PDF file, but am not sure of the protocol here for new members posting attachments. If anyone wants the UART/SPI datasheet for the Telair 6004 module then just yell and I'll attach it to another post.

Thanks for all the useful information in this thread, BTW, I'm planning to use my 6004 sensors, together with temp and humidity sensors, as part of a control system for my own MVHR system in my new passive house build.

Jeremy

JSHarris 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 06:23 AM.


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