EcoRenovator

EcoRenovator (https://ecorenovator.org/forum/index.php)
-   Conservation (https://ecorenovator.org/forum/forumdisplay.php?f=8)
-   -   Arduino CO2 Sensor Controls PCM Fans in HRV (https://ecorenovator.org/forum/showthread.php?t=2859)

AC_Hacker 01-29-13 02:22 PM

Arduino CO2 Sensor Controls PWM Fans in HRV
 
2 Attachment(s)
(* The title of this thread should have been "Arduino CO2 Sensor Controls PWM Fans in HRV, not "PCM" Fans. My bad. *)

EDIT (2014-06-09): For those who may doubt the need for a HRV, or a CO2 controlled HRV, here is some interesting reading. Thanks to BBP.

A new EcoRenovator from Ireland, cerberus, tipped me off to some inexpensive CO2 sensors. In the past, CO2 sensors had been pretty expensive, but the attractive price (about $10) got me started. Thanks, cerberus!

* * *

My project idea is that HRVs are used to provide fresh air and at the same time minimize home heat loss. The heat loss from the outgoing air can be reduced, but never reduced to zero.

A 'smart' HRV would sense the level of CO2 and when the level of CO2 reached a predetermined allowable level, it would run the fans. If the CO2 level was higher, it would run the fans at a higher speed, if the CO2 was lower, it would run the fans at a lower speed, and if the CO2 was acceptably low, the fans would not run at all.

EDIT: My thinking has changed on this part of the project. I'm now considering using the varying voltage from pin 4 of the CO2 sensor as an input to one of the Analog in pins on the Arduino... and controling the Arduino's PWM pin with that. I found some examples of that HERE and HERE.

This would increase the overall efficiency because the HRV heat loss would only be incurred when required.

So far, petty simple.

This project will use an Arduino to read a CO2 Sensor (Telair 6004) and then use the CO2 readings as input to control PWM fans in the HRV.

Here is a photo of one of the CO2 monotoring boards, measuring about 2" x 2" in all it's twinkling, gold-toned beauty:


An here is a diagram of the 12 pins that seen at the bottom of the photo above...



And some documents:
So the Telaire 6004 is capable of either analog output (pretty good) or digital output (pretty accurate). But so far as I have been able to determine, the digital output is not so easy to implement.

I was able to locate the following code to read the analog output pin (pin 4) on the Telaire 6004 and to blink an LED that is connected to Arduino digital output (pin 13).

Code:

/*
Analog Input
Demonstrates analog input by reading an analog sensor on analog pin 0 and
turning on and off a light emitting diode(LED) connected to digital pin 13.
The amount of time the LED will be on and off depends on
the value obtained by analogRead().
int sensorPin = A0; // select the input pin for the potentiometer
int sensorValue = 0; // variable to store the value coming from the sensor
void setup() {
}
void loop() {
// read the value from the sensor:
sensorValue = analogRead(sensorPin);
// sensorValue is the variable that stores what the CO2 reading is
// Send the value back to the computer
Serial.println(sensorValue);
}

* * *

Since I am barely able to make an Arduino blink it's little light (which is the most basic exercise in the Arduino House of Chops), I can use help.

So, I'm open to any ideas from any of you Arduino dudes & dudettes on this project. I ain't proud.

Best,

-AC

stevehull 01-29-13 08:28 PM

AC,

Using CO2 as a trigger for an HRV (or ERV) will not work as a reliable index of home air "staleness". Here is why . . .

The average adult at rest gives off about 200 ml of pure CO2 per minute. Let's think of an really airtight house with four people in it after 7 days.

Assume a house of 1200 ft2 and a height of 8 ft (volume of 9600 ft3 or 270 meters3).

Four people at the end of one week give off 8,600 L of pure CO2 (8.1 meter3).

The increase in CO2 at the end of one week in a literally airtight house with four people is 0.03% (8.1/270)- an almost vanishing small number to trigger with.

A FAR better option is to place the HRV (or ERV) air intakes in the bathrooms running at about 10-20 CFM. When either the bathroom light or shower light goes on, then the blower speed goes up 2-3 times (with a "hang" timer to keep the higher fan on for 5-10 minutes post use).

I used this exact scheme in a home I built over 20 years ago and had indoor winter humidities between 30-35% and summer between 45-50% (no higher). No steam covered windows in bathrooms, always fresh in the home and no mildew in walls.

I looked at CO2, did the calculations and am wondering why commercial units use it. People "believe" CO2 will build up, but in even a super tight home (one air change per day), the use of CO2 as a trigger doesn't cut it.

Thoughts?

Steve

kostas 01-30-13 09:49 AM

I think stevehull has a point here.
Maybe the problem is not the CO2 after all, but the stale air by its self. What makes the inside air uncomfortable is a mix of (ok, CO2), humidity, odors, smoke (for smokers and cooks), ecc, and that's not easy to detect by electronic sensors. I guess the best method is to try down and find the minimum acceptable air change for each environment.

AC_Hacker 01-30-13 09:58 AM

Quote:

Originally Posted by stevehull (Post 27823)
...Let's think of an really airtight house...

Steve, I don’t need to 'think' of a really airtight house because I live in one right now.

Quote:

Originally Posted by stevehull (Post 27823)
...CO2 at the end of one week... is 0.03% ....an almost vanishing small number to trigger with.

Vanishing to your arithmetic perhaps, but not disappearing. This is probably why CO2 sensors have been so expensive for so long.

Here are ASHRE & OSHA specs:
  • normal outdoor level: 350 - 450 ppm
  • acceptable levels: < 600 ppm
  • complaints of stiffness and odors: 600 - 1000 ppm
  • ASHRAE and OSHA standards: 1000 ppm
  • general drowsiness: 1000 - 2500 ppm
  • adverse health effects expected: 2500 - 5000 ppm
  • maximum allowed concentration within a 8 hour working period: 5000 ppm

I also previously came across some studies of German shool children that indicated a much elevated level of performance when levels of CO2 were reduced well below ASHRE standards. I just did a search for that information I had found previously, and am not able to locate it... However, I did find this:

Quote:

Elevated carbon dioxide may impair reasoning

Insufficient ventilation allows exhaled gas to build up indoors, diminishing decision-making abilities


By Janet Raloff

Web edition: October 16, 2012

Carbon dioxide has been vilified for decades as a driver of global warming. A new study finds signs that CO2, exhaled in every breath, can exert an equally worrisome threat — impaired cognition — in nearly every energy-efficient classroom, meeting hall or office space.

The work assessed decision-making in 22 healthy young adults. Their performance on six of nine tests dropped notably when researchers raised indoor carbon dioxide levels to 1,000 parts per million from a baseline of 600 ppm. On seven tests, performance fell substantially more when the room’s CO2 was boosted to 2,500 ppm, scientists report in a paper to be published in Environmental Health Perspectives.

These data are surprising, says Roger Hedrick of Architectural Energy Corp. in Boulder, Colo., because “1,000 ppm of CO2 used to be considered a benchmark of good ventilation.” Hedrick, an environmental engineer, chairs the committee that drafts commercial ventilation standards through the American Society of Heating, Refrigerating, & Air-Conditioning Engineers.

Carbon dioxide levels are often substantially higher in buildings than the 350 to 400 ppm typically found outdoors. Indoor values of 600 ppm are considered very good. But depending on how many people inhabit a room and how many times per hour its air is exchanged with outdoor air through ventilation, “there are plenty of buildings where you could easily see 2,500 ppm of CO2 — or close to it — even with ventilation designs that are fully compliant with current standards,” Hedrick says.

“We’ve seen higher CO2 levels associated with increased student absences and poorer performances on school-type tasks,” says study coauthor William Fisk of Lawrence Berkeley National Laboratory in California. “But we never thought CO2 was actually responsible. We assumed it was a proxy for other [pollutants].”

His group recruited college students to spend much of a day in a room with computers. Individuals could read or do what they wanted for much of the time. But for part of each 2.5-hour period, participants completed role-playing tests on a computer that required them to manage an organization as it underwent a series of problems or crises. Throughout each of three test segments, conducted in random order, room ventilation was kept very high. Only carbon dioxide levels varied by segment: 600 ppm, 1,000 ppm or 2,500 ppm.

The role-playing tests are more complicated than most used to measure cognitive abilities, notes epidemiologist and coauthor Mark Mendell of Lawrence Berkeley. But they offer a gauge of important real-world skills, he says. “And the magnitude of effects measured at 2,500 ppm was astonishing — so astonishing that it was almost hard to believe,” he says.

If these trends are confirmed in follow-up studies, Hedrick says, “it would be very strong evidence that ventilation rates need to be increased.” Carbon dioxide standards were developed largely with the aim of controlling body odor, he notes. High levels of CO2 were viewed as suggesting occupancy levels were climbing to where “a place may begin smelling bad.”

Classrooms are fairly densely occupied, he notes, so their carbon dioxide frequently exceeds 1,000 ppm. With an increasing push to reduce heating and cooling costs, “there are plenty of school districts using lesser amounts of ventilation,” he says. “So I would not be at all surprised to find 2,500 ppm in a lot of school districts.”

In fact, “CO2 levels are not that hard to control,” says Jack Driscoll of PID Analyzers in Sandwich, Mass. Building managers just need to measure them on a regular basis, he notes. At the American Chemical Society’s fall national meeting in Philadelphia, he described a new rapid, hand-held CO2sensor designed for classrooms and office buildings.

Citations

J.N. Driscoll et al. Wireless indoor environmental quality (IEQ) monitoring in classrooms and laboratories (VOC's, CO, CO2, and T). American Chemical Society meeting, Philadelphia, Aug. 22, 2012. [Go to]

U. Satish et al. Is CO2 an indoor pollutant? Direct effects of low-to-moderate CO2 concentrations on human decision-making performance. Environmental Health Perspectives. doi: 10.1289/ehp.1104789. [Go to]
Here are relevant specs for the Telaire 6004:
  • Measurement Range = 0 to 2000 ppm
  • Accuracy = @ 72°F (22°C) when compared against a certified factory reference ± 40 ppm + 3% of reading

My design parameters are:
  • FANS_ON @ 1000 ppm (0.1%)
  • FANS_OFF @ 300 ppm (0.03%)

I'm sure I'll be tinkering with that.

Quote:

Originally Posted by stevehull (Post 27823)
A FAR better option... bathrooms... winter humidities... No steam covered windows... no mildew in walls.

No steam covered windows, no mildewed walls? Maybe your standards are a bit low?

The CO2 monitor is the first part of the project, after I get that going I will integrate a DH22 (AKA: RHT03) into the controller to monitor humidity.

Quote:

Originally Posted by stevehull (Post 27823)
I looked at CO2... People "believe" CO2 will build up... the use of CO2 as a trigger doesn't cut it.

People "believe"?

Doesn’t cut it?

Steve, right now I live in a house that I am radically insulating & sealing. I actually have first hand experience with what it is like to not have sufficient fresh air. I don’t need to imagine what it would be like... I am there right now. It is unpleasant, I am not just dreaming up a new project.

Steve, your research would be more interesting if it actually had a bearing on what I am now experiencing.

Do you have any experience with circuit design or software?

-AC

stevehull 01-30-13 01:16 PM

AC,

I can guarantee that CO2 is not building up. Rather, "stale air" is out gassing of construction components, the infamous body odor, cooking smells, but by far the humidity is the dominant issue.

Our respiratory control system is such that even tiny increases in the ppm of CO2 (2-3 ppm) will cause us to increase ventilation rate. It is almost impossible to withstand an environment with 1000 ppm of CO2.

Let's see what your house has in it. One way to test this is to hook up the CO2 sensor and record a week's data. All houses have air leakage. I believe the very best that I know of had one complete air exchange every 48 hours. I suspect your tight house has an exchange every 30 hours or so (very, very tight construction).

I have a lot of experience with CO2 monitoring and can help you with hooking up the analog output of the CO2 sensor to the A/D port. Biu while you are there, hook up a relative humidity detector as well.

Most homes do very well by using a constant 10-20 CFM HRV (or ERV) exchange volume all day long. The reason to kick it up is shower/bathroom use.

I used a DPDT wall switch to both control the 120 V light above the shower and to increase the air CFM to 50-60 CFM with a 555 timer "one shot" to keep the HRV fan on for an additional 15 minutes after the light went off.

The wall switch just to the bathroom turned also turned on the HRV fan to high for only 5 minutes.

Measure your CO2 and humidity - let's see what the house has in it now.

Steve

AC_Hacker 01-30-13 02:01 PM

1 Attachment(s)
Quote:

Originally Posted by stevehull (Post 27833)
I can guarantee that CO2 is not building up.

Steve, I'm happy that you are offering guarantees with your opinions... this may come in handy at a later date.

In your first post, you said that:

"The average adult at rest gives off about 200 ml of pure CO2 per minute."

...and the rest of your calculations flowed from that number.

That may be a safe way to design living systems where you live, but where I live, I and most of the people I know are not content to spend their lives 'at rest'.

So, along this line, I happened across this useful chart...


And also, I looked at your ventilation rates and I calculate that your recommended rates would result in a 100% air change in 144 minutes @ 10 CFM and 72 minutes @20 CFM in my conditioned space.

I'll happily supply CO2 info when I get my circuit working, which is what I'm currently seeking help on.

Best,

-AC

Exeric 01-30-13 02:42 PM

Hi AC,
I think maybe Steve and you are talking past each other. I didn't quite realize until a few days ago what all the fuss was about HRVs. When I read an update of your thread recently about your insulation project on your house I got a real ah ha moment.

From everything I've read in that thread it sounds like the air quality problems you observe that neccessitates an HRV comes from excessive moisture tightness, not air tightness. I'm no expert but I'm very good with logic and my logic tells me that one can have near perfect air tightness and still have vapor permeability. This is the ideal. You want your home to have vapor permeability so you don't have mold problems while still making your home as airtight as possible. The opposite, perfect vapor tightness ALWAYS comes with perfect airtightness. Like I've said, I've been wrong before and may be now, but I think you are confusing the airtightness of your house as causing the air quality problems, when it is really your vapor tightness that is causing it.

There are many very good articles on the internet at both Green Building Advisor and at Building Science that explains the difference in the two concepts. I think it may also explain why a more radical solution, such as an HRV may be a good solution for you. It in fact may be the best solution for the situation you have. But in situations where the home is airtight while being vapor permeable then I agree with Steve that a simple venting plan is often sufficient.

Exeric 01-30-13 03:42 PM

Actually, Maybe an ERV would be more appropriate than an HRV because my understanding is that an ERV handles humidity as well as air and temperature exchanges. It seems like the situation AC is working with is a humid house.

Actually I'm a little confused about this. ERV's are usually used in humid climates but this isn't strictly the case in Portland, OR. Maybe someone else knows more about this, such as whether ERV's handle humidity in just one direction or both directions. If they can handle it in both directions depending on the direction of vapor drive, then an ERV seem more appropriate for AC's house, rather than an HRV.

AC_Hacker 01-30-13 04:44 PM

HRV vs. ERV
 

-AC

Exeric 01-30-13 04:58 PM

Well, that answers that. It seems to imply the humidity filtering only occurs in one direction - outside to inside. Too bad.

Exeric 01-30-13 05:05 PM

Well, I just noticed that they got the colors of the arid southwest and the pacific zone mixed up. And for the pacific zone, after the correction, they say an ERV is optional. So maybe that's the way to go for your particular situation. :)

It still would depend on the humidity filtering being bidirectional, which I don't know about.

AC_Hacker 01-30-13 06:28 PM

Quote:

Originally Posted by Exeric (Post 27841)
Well, that answers that. It seems to imply the humidity filtering only occurs in one direction - outside to inside. Too bad.

Well, the way it works is that as the higher temperature air, with it's load of water vapor, moves across a higher-to-lower temperature gradient, as the air temperature changes, if it crosses the dew point, will causes the vapor to condense and become water.

If you have a HRV, the water stays on the side of the barrier on which it condenses, and exits, usually through a tube to be disposed.

If you have an ERV, the barrier is permeable, and the water crosses through the barrier and evaporates into the air in the lower-to-higher temperature gradient.

I was very careful with my language to avoid words like "inside" and "outside" so that the description would be valid when read for heating as well as air conditioning.

* * *

So, if you wanted to ventilate AND save heat in a bathroom/shower, you would NOT use a ERV, as that would send the water vapor back into the loo. So in that case the proper choice would be a HRV.

-AC

stevehull 01-31-13 09:24 AM

AC and gang,

Good information on ERV vs HRV graphics.

First off, homes rarely have any CO2 buildup as the inherent ventilation of a home is far more than a school, office or other work space. This is because the ratio of surface area to living space is so large in a home.

Very, very tight homes still have an air turnover (with no HRV/ERV) of about 1 air change per day so CO2 is very rarely a problem in homes. With regard to "rest" recall that 6-8 hours is sleep (even less CO2 output than rest) and that few really do large workouts in the home. But we do have dishwashers, showers, and latent vapor coming off our lungs which all contributes to significant water vapor loads.

All that said, I also assume that a home has properly vented hot water heaters. furnaces, etc (if using propane/nat gas).

On the issue of ERVs moving water vapor. Yes, they are bidirectional if there is a large dew point difference between the inside and the ambient outside.

Air and water vapor permiance are important concepts. In very cold climates, the issue of water vapor permiance into walls can become very problematic. If sufficient water vapor goes into walls, there is the infamous critical freezing point in the middle of the insulation. If the insulation can become frozen and then water soaked (cellulose), then it turns to mush.

In northern climates, I far prefer to have a 6 ml poly sheet on every wall, just underneath the drywall, walls ceilings and lapped like you are building a boat. I also prefer to put a closed cell foam layer on the cold side of the wall and a water non-permiant insulation inbetween. Yes, foam is great (expensive), but fiberglass batting (R18-R20) is very acceptable if well done (properly fitted into cavity).

Obviously ANY air infiltration around electrical boxes must be sealed. The poly sheeting prevents water vapor going into walls and freezing there.

Older homes are a real pain as studs are not 16 OC and custom cutting fiberglass batts becomes very tough. Over stuffing in nooks/crannies is easy to do and almost destroys the insulation value.

In southern states, the opposite is true with the vapor barrier on the outside of the home as dew points are almost always higher there.

The use of ERV's can help a LOT with water movement as in the winter it will increase relative humidity in a home and then decrease it in summer (to a lesser extent).

HRV's don't move any water except that which may condense out on the cold side of the HRV.

But all that said, I still have a dehumidifier that kicks in here (central Oklahoma) on humid May days when there is not a large heat load, but showers, dishwasher, etc all add a lot of water vapor to the house.

I do encourage all to have a home humidity meter and to never allow it to go over 60%. I prefer to have it never go above 55%. In the winter, high humidity (in no wall vapor barrier) will accumulate in the ways "sogging" the insulation and in the summer it will contribute to mold build up in same.

AC, just get some "raw data" from the CO2 sensor ($10 is worth playing with!) and if you need help, feel free to call.

Great discussion!

Steve

AC_Hacker 01-31-13 10:50 AM

Quote:

Originally Posted by stevehull (Post 27864)
...Great discussion!...

No Steve, this in NOT a great discussion.

This is NOT a discussion thread.

My purpose in starting this thread is to build a CO2 (& ultimately humidity) sensing controller for an HRV.

The operative word is "build".

I tried to make that clear in my first post when I wrote:

Quote:

My project idea is that HRVs are used to provide fresh air and at the same time minimize home heat loss. The heat loss from the outgoing air can be reduced, but never reduced to zero.

A 'smart' HRV would sense the level of CO2 and when the level of CO2 reached a predetermined allowable level, it would run the fans. If the CO2 level was higher, it would run the fans at a higher speed, if the CO2 was lower, it would run the fans at a lower speed, and if the CO2 was acceptably low, the fans would not run at all.

This would increase the overall efficiency because the HRV heat loss would only be incurred when required.

So far, petty simple.

This project will use an Arduino to read a CO2 Sensor (Telair 6004) and then use the CO2 readings as input to control PWM fans in the HRV.
So far Steve, you have written 1117 words on the topic of why a CO2 sensing HRV controller should NOT be built.

And in response, I have written 480 words as to why I am going to proceed. Writing this has been a waste of my time, just as your writing of your 1117 words was a waste of your time... and worse yet it has discouraged interest in this project. There are quite a few Arduino-savvy members of EcoRenovator, and not a single one has posted to this thread.

I attribute this to your "Great discussion!"

I wish you would start another thread, a discussion thread, about why using CO2 monitors is futile, and leave this project thread alone. You can even request that your posts to this thread be moved to to your 'CO2 monitoring is futile' discussion thread. I'm pretty sure the administrators would do this for you.

Sincerely,

-AC

stevehull 01-31-13 01:45 PM

AC,

I apologize. Been down the road you are going (sensing CO2) many years ago and was trying to give you some factual information on sensing variables.

Again, sorry about the misunderstanding and I look forward to your HRV and CO2 build results.

Steve

AC_Hacker 01-31-13 02:59 PM

Graph of Telaire 6004 in action...
 
1 Attachment(s)
On a site that uses sensors such as the Telaire 6004 in monitoring buildings, I came across this chart of the device in action...


I would presume that the room had a lower, continuous ventilation rate, and that the 'bump' is the result of a conference. It seems tantalizingly possible that from the rate of CO2 decline at the end of the meeting, that the continuous ventilation rate could be calculated. Either room size or number of people would likely be needed.

I also learned today that current Oregon code calls for CO2 monitors on each level of new construction. Hmmmmmmm..........

-AC

Exeric 01-31-13 04:38 PM

I see that, relatively speaking, the CEO in green is blowing a lot of gas. Yup.

AC_Hacker 01-31-13 06:10 PM

Quote:

Originally Posted by Exeric (Post 27877)
I see that, relatively speaking, the CEO in green is blowing a lot of gas. Yup.

Yeah, and the 'cube farm' is very well ventilated, on average, much better than the CEO... lower CO2, clearer thinking.

This explains a lot!

-AC

AC_Hacker 02-02-13 08:57 PM

Borrowed a Friends CO2 Tracker...
 
1 Attachment(s)
I borrowed a friend's CO2 tracker and got a nice readout of room parameters.


This is with one window opened about 3/4".

I think I'm on the right track.


Best

-AC

AC_Hacker 02-06-13 02:00 AM

The Record Of The Day In CO2...
 
1 Attachment(s)
I did a rough log of today's CO2 data just to see what it looked like.


Y axis is CO2 in Parts Per Million (ppm)

X axis is time 24 hours per day (are you paying attention Piwoslaw?)

So, there's a steady increase from the time I wake up until about 10:00 when I went to do some errands. I returned at about 13:30 and logged CO2.

Around 17:00, another reading, then I took some soup to the neighbor, and stayed for a short visit and took a reading when I returned.

Shortly after that at around 19:30, a friend dropped by and we chatted for a few hours, at the end of which I took the final reading.

After he left, I opened two windows, to flush out the CO2... never did that before!

It's amazing... the record of the day in CO2.

Best,

-AC

theworldtrekker 02-06-13 06:50 PM

Not sure what sensor you were using for the plot, but I'd be careful to make sure you're not tracking something else like temperature or humidity with the sensor. Reading through the minimal spec sheet with it, it claims to need 14 days to calibrate the ABC system--I would assume uncalibrated from All Electronics by default. This also assumes that the unit sees 400ppm at least 3 times per day for calibration.

Specified accuracy is after re-zeroing process
or 14 days of continuous operation with ABC Logic.


As far as building the system, I'd try to find out the necessary protocal to interface with it over a SPI bus. You have one per arduino chip (assuming not a mega) but can select which device you want to interface with via a cs pin if you're also wanting to drive say an lcd.

AC_Hacker 02-06-13 08:35 PM

3 Attachment(s)
Quote:

Originally Posted by theworldtrekker (Post 27994)
Not sure what sensor you were using for the plot, but I'd be careful to make sure you're not tracking something else like temperature or humidity with the sensor.

I've recorded CO2 today and humidity, and RH is not moving very much... nothing like CO2. The CO2 readings I'm getting do seem to be reasonable, and when two people are here, the readings seem to make sense.

I think that one thing that makes the reading seem anomalous is that my house is small, only about 700 sq. ft. and I'm mostly living in and only conditioning a part (25%) of that area. So the respiration of one person makes a big difference, to say nothing of more than one person... which is why I want to build this HRV.

Quote:

Originally Posted by theworldtrekker (Post 27994)
As far as building the system, I'd try to find out the necessary protocal to interface with it over a SPI bus. You have one per arduino chip (assuming not a mega) but can select which device you want to interface with via a cs pin if you're also wanting to drive say an lcd.

This sounds like a good approach.

Do you know how to do this?

Here is some guy who was able to reverse engineer the digital interface to the sensor. He was going to build an Arduino library for this particular sensor, but he says that his computer crashed and he lost his work.

Homemade Arduino based Indoor Air Quality CO2 PPM, Temperature, Humidity Monitor - YouTube

...bummer.

I don't have a logic analyzer or any experience in using one, even if I did have one.

Pin 4 of the CO2 sensor is analog out, 0 volts to 4 volts, with 0v. = 0 ppm and 4v. = 2000 ppm, linear. I thought I'd run that into an A-to-D in on the Arduino. So, I think I can figure my way through this approach.

I do think that the digital approach is more accurate, but I don't have the savvy or the pre-made Arduino library to make it happen.

I already got a couple of fans that are low current, quiet, permanent magnet ECM fans. They should do the job nicely. They are 12 V and only draw 650 ma each.


Seems to me that it will be pretty straight forward to use the data from the Arduino's A-to-D and use it to control the duty cycle of a PWM going through a transistor to the fans.

I'll have to do some experimenting when it's all together to adjust the rate.

This might even be a job for PID.

So, I know a bit about Arduino programming, actually a very little bit.

If you have any suggestions, I'd like to hear.

Oh, and here's the HRV core I got:


And I even kind of have plans for the box:


So right now, I'm in the CO2 controller design stage of the project.

I tried to buy a controller from the company in Ireland that makes these things, but their controller only works on 220v 50Hz.


Best,

-AC

theworldtrekker 02-07-13 12:17 AM

Quote:

Originally Posted by AC_Hacker (Post 27995)
I've recorded CO2 today and humidity, and RH is not moving very much... nothing like CO2. The CO2 readings I'm getting do seem to be reasonable, and when two people are here, the readings seem to make sense.

Looking over the plot again I'm still not convinced you're measuring what you think you are, or else I don't understand what you're measuring. Assuming that you are in a constant volume room, exhaling a reasonably steady flow of CO2 (steady source), then I'd assume at these concentrations to see a approx linear line of increasing CO2 over time. What I see however, is a variety of different rates and unexplained drops.

Why, if you were in the house all night do you start out at ~440ppm yet end the day at 1050ppm? Why is the rate increase different between data point 2-3 and 5-6 vs 3-5 and 6-9? Why the drastic drop while you're gone until 1330, but not the same slope of drop when you go to the neighbor with soup? And finally, why when there are two people in the house is the slope of increase less than between data points 2-3 and 5-6 but the same as when you got back at 1300 until 1930?

Here are a few hypothesizes that come to mind:
1) You're measuring CO2, but CO2 in your house isn't driven by human sources. Instead it is driven by construction materials still curing. I know this plagued Biosphere II for a number of years with curing concrete (if my memory serves me).

2) You're sensor is temperature dependent. Its optical in nature and either the LED or more likely the sensing cell is temperature dependent. You've ruled out humidity it sounds like, but I would have guessed temperature is more likely to dominate anyway. Could also be some other factor that is affecting the sensor (supply voltage, saturation, location, etc).

Need more data points... Its not too hard to hook up a SD card to an arduino (SPI interface) and have it log every ~5 min. Either buy a SD shield or OSH Park ~ Welcome (from dorkbotpdx)has a nice cheap PCB service 'local' to us.

Quote:

Originally Posted by AC_Hacker (Post 27995)
Do you know how to do this?
...
I do think that the digital approach is more accurate, but I don't have the savvy or the pre-made Arduino library to make it happen.

Go with the analog approach then. I would think this type of discussion would exceed the limit of this type of forum. There is a big difference between getting the led (pin 13) to blink vs creating libraries. I know various different places have tutorials on how to write arduino libraries, but unless you're comfortable with C I'd recommend avoiding that path.

I don't know why you'd look at a PID unless you're trying to track a target value. A bang-bang controller should work for this type of scenario and be much easier to implement. The logic would be, if > y1 then fan speed = high; if < y0 then fan speed = low, else fan speed = medium. Or you could implement a proportional controller if you want it a little more continuous in fan speed variation, but leave out the integral and derivative part of the controller.

I would guess, as stevehull pointed out and I've observed in my house, that humidity will be a greater issue than CO2. So even with a CO2 sensor feed on the controller, you'll also want a humidity sensor feed as well. I'd worry more about the logic of the two combined sensors than trying to accurately track one value. If the house and sensors don't dampen the system enough, it'd be pretty easy to program some basic dampening logic into the fan controller.

AC_Hacker 02-07-13 01:32 AM

Quote:

Originally Posted by theworldtrekker (Post 27998)
What I see however, is a variety of different rates and unexplained drops.

I think that people assume that I live like they live. I don't.

I am only conditioning one room.

As I said previously, it is not a large room.

The kitchen is not heated and not conditioned and not subject to CO2 monitoring.

The bathroom is not heated and not conditioned and not subject to CO2 monitoring.

The room I sleep in is not heated and not conditioned and not subject to CO2 monitoring.

The big drop was because I left my house to run some errands. There was no one home to generate CO2. The CO2 started climbing higher when I returned... The smaller drop was when I went next door to visit a neighbor. CO2 climbed much higher when a friend dropped by.

I was pretty sure that I had explained all that before.

Quote:

Originally Posted by theworldtrekker (Post 27998)
Why, if you were in the house all night do you start out at ~440ppm yet end the day at 1050ppm?

See above... ("...not heated and not conditioned and not subject to CO2 monitoring...")

Quote:

Originally Posted by theworldtrekker (Post 27998)
Why is the rate increase different between data point 2-3 and 5-6 vs 3-5 and 6-9? Why the drastic drop while you're gone until 1330, but not the same slope of drop when you go to the neighbor with soup? And finally, why when there are two people in the house is the slope of increase less than between data points 2-3 and 5-6 but the same as when you got back at 1300 until 1930?

I'm logging by hand, I log when I'm home.

Quote:

Originally Posted by theworldtrekker (Post 27998)
Here are a few hypothesizes that come to mind:
1) You're measuring CO2, but CO2 in your house isn't driven by human sources. Instead it is driven by construction materials still curing. I know this plagued Biosphere II for a number of years with curing concrete (if my memory serves me).

In the space that is conditioned, my construction materials have been curing for 32 years. Would that be long enough?

Quote:

Originally Posted by theworldtrekker (Post 27998)
2) You're sensor is temperature dependent.

Its optical in nature and either the LED or more likely the sensing cell is temperature dependent. You've ruled out humidity it sounds like, but I would have guessed temperature is more likely to dominate anyway. Could also be some other factor that is affecting the sensor (supply voltage, saturation, location, etc). [/QUOTE]

Nope, it's been 67 degrees all the time... dead on.

Quote:

Originally Posted by theworldtrekker (Post 27998)
Need more data points... Its not too hard to hook up a SD card to an arduino (SPI interface) and have it log every ~5 min. Either buy a SD shield or OSH Park ~ Welcome (from dorkbotpdx)has a nice cheap PCB service 'local' to us.

Great! I have an Arduino, I have an Ethernet shield, write me the code and I'll run it.

Quote:

Originally Posted by theworldtrekker (Post 27998)
I would guess, as stevehull pointed out and I've observed in my house, that humidity will be a greater issue than CO2. So even with a CO2 sensor feed on the controller, you'll also want a humidity sensor feed as well. I'd worry more about the logic of the two combined sensors than trying to accurately track one value. If the house and sensors don't dampen the system enough, it'd be pretty easy to program some basic dampening logic into the fan controller.

I tracked humidity all day, and it has been within 1% of 43% all day.

Have you ever measured the CO2 of the space you live in, by any chance?

-AC

stevehull 02-07-13 07:02 AM

worldtrekker,

AC has a good sensor and it doesn't respond to humidity and temperature as do many CO2 sensors. All that said, we need to look at the total volume sampled (VERY small) inside a home that is not room to room ventilated as is in more typical (larger volume) houses. In this very specific scenario, you can have the CO2 values he has measured in the specific room he is in.

AC in in a very unusual house (700 ft2) and we need to keep that in mind.

I really like the Linear LTC1041 8 pin chip for doing exactly as you say. Proportional control for an HRV (or ERV) is clearly overkill. In keeping with ACs request that we focus on controlling the HRV, I would look at the following:

http://cds.linear.com/docs/en/datasheet/1041fa.pdf

VERY easy to hook up and only uA of current to drive it. I also like the ability to sense every few minutes to further reduce current. The inherent hysteresis eliminates the on off on "chatter" than a simple bang bang switch has. The 1041 is also cheap!

Steve

AC_Hacker 02-07-13 12:57 PM

Steve

Thanks for the chip idea, but...

Quote:

Originally Posted by stevehull (Post 28003)
...Proportional control for an HRV (or ERV) is clearly overkill...

I'm sorry Steve, but it is not 'clearly overkill' at all. In a small air volume, proportional control would be much more comfortable, and unobtrusive.

About four years ago, I graduated from an on/off gas central forced air heating system to proportional controlled (AKA: inverter technology) mini split heat pump, and the civility and comfort of a proportional system is so unquestioningly superior that I'm just not interested in going back.

Those mini splits really have set a higher bar, not only in comfort but also in economy. It's just amazing how many tiny transistors you can cram into a tiny space nowadays... and what you can do with them.

I already have an Arduino clone (Teensy) that I plan to use, and if I understand it correctly, it can function in the same way as the IC you suggested. It also has analog-to-digital built in and PCM built in, and the capacity to handle another sensor (humidity) or two.

Quote:

Originally Posted by stevehull (Post 28003)
...AC has a good sensor and it doesn't respond to humidity and temperature as do many CO2 sensors...

The sensor I'm using in my controller is just capable of measuring CO2. But I have a borrowed sensor that I have been using just to monitor my environment, and it does read temperature and humidity and CO2. The measured levels of temperature and humidity are very stable. I imagine humidity will change once I get the HRV working, and I plan to incorporate a humidity sensor into the design.


Just to help guide your thinking, the HRV core that I have is identical to the one used in THIS UNIT.

In fact I bought mine from a former US affiliate that still had one left in stock.

The favorable economic operation of this unit, and the size of the house that it is meant to service is very attractive to me, because it approximates the size of my own house. I realize that my house is on the small size... but I do plan to expand the conditioned area, but not to the whole 700 sq. ft.

So here is a description of the controller that the Irish engineers came up with... hopefully, a similar controller can be developed. I mean, they can't be that much smarter than us, can they?

Quote:

...the smart controls of the system monitor the temperatures of the 4 air-streams in the unit. The system will always run itself to maintain the highest level of efficiency while ensuring CO2 and humidity levels are regulated using sensors for each. When CO2 reaches 530ppm or humidity reaches 40%, the unit automatically slows down to trickle speed until levels become higher again. At 50m3/hour, the breathing window emits just 25dB of sound, while at high-speeds of up to 150m3/hour this increases to just 40dB. This is normally indistinguishable from normal household background noise. Breathing Window. The future of Passive House ventilation.

Cross ventilation above and beneath doors is crucial in all Passive Houses with ducted HRV, and often under-estimated at the design stage, not so with the Breathing Window. With subtle architrave ventilation detailing, threshold gaps and some ventilation of bedrooms to cross-ventilation zones, we ensure gas equalization throughout the building, with typically 2 units acting as the lungs of the house. One unit running at medium speed (100m3/hr) provides enough fresh air for 4 people (Passive House requirement are 25m3/person.hour).

Up to 15 times better heat transfer efficiency at the heat exchanger when compared to standard flat plate heat exchangers gives the breathing window higher system efficiencies.

In delivered volume comparisons, the breather window has 60% less pressure drop in the system caused by ductwork used by other units. This results in lower fan speeds, greater efficiency and greater savings for you.

Due to the small dimension of our heat exchanger, most moisture leaves the building as saturated vapour, which means less frost occurrence and less defrost cycling compared to standard units of similar efficiency. A FiWi unit tested in Iceland had a 95% lower defrost cycle rate than standard HRV units.

Standard HRV systems suffer from high thermal resistance at the exchanger surface due to the boundary air layer. As heat is exchanged by the copper wire in our FiWi exchanger, the boundary layer has little or no effect on heat exchange, increasing efficiency. Our competitors often rely on heat loss from inefficient fans to boost their efficiency figures. Our high-quality fans lose very little heat, and yet we have still measured 85% heat-exchange efficiency in an installed unit. At -10 degrees outside, a breathing window has been measured supplying fresh air of 17.5 degrees to a building at 20 degrees. Most of our competitors only achieve such results in the laboratory! We can increase this to 92% by weaving the wires closer together but the pressure drop through the heat exchanger increases canceling the gains.
So, this is the direction I am going in...

Best,

-AC

AC_Hacker 02-08-13 06:57 PM

8 Attachment(s)

I have decided to go with the Teensy++ 2.0 because:
  • They are well made
  • They are small
  • They are inexpensive ($24)
  • They use the Arduino Development Environment
  • They are compatible with the world of Arduino libraries
  • They have an Analog-to-Digital input (actually eight)
  • They have a PWM output (actually six)
  • I know the guy who makes them (PJ), so I can ask him in person for help
  • I already have one in my Geek Box

So, the Teensy comes just as in the photo above. Wires can be soldered right to the board, for experimenting, but there is much more flexibility if header pins or sockets are added to the board, which will then fit perfectly into an experimenter's bread board. I have already tried an actual bread board to align the pins and I melted the plastic (sigh).

Here is a row of header pins. These can be purchased from any electronics supply house, sometimes even Radio Shack.


It's necessary to use just a little bit of care when soldering the pins, else they won't line up perfectly with the bread board. If you use a piece of experimenter's perf board, to align the pins, they will be in good shape.

Here's the Teensy with the header pins perfectly soldered to their thru-holes.


I just happen to have a microscope lying about, so I examined my soldering job.

Upon inspection, they're not all so good...


The flaws don't look so very bad, but they are indicative of insufficient heat and bad flow. Could cause hard-to-find problems down the road. A couple of touches with the soldering iron, and re-inspection, and I'm ready for the next step. [NOTE: if you'd prefer to avoid soldering on the pins, the Teensy is also available with pins already soldered on]

The next step is to go to the Arduino Download Page and download the latest stable (no betas for me, thank you) IDE (AKA: Integrated Development Environment).

For me that would be the one for Windows...


The Arduino IDE is about 91 Mega Bytes, so depending on your bandwidth, it could take a while...

This gets installed before the Teensy programs. It doesn't seem to spread itself out all over your computer like other programs, so wherre you install it is wherre it will run from. Remember where it is installed, because you'll need to find this folder again when the Teensyduino add-on files get installed.

Also required is the Teensyduino, which is an add-on to the Arduino IDE.
So I download the Teensyduino add-on... again, in my case, it is for Windows.


...this file is about 22 Mega Bytes, so it'll take a while, also. Install this after the Arduino IDE has been installed. You'll need to install them in the same folder that contains your Arduino IDE.

Next to get is the Teensy loader, which gives you a convenient way to load and try different programs.


... this one is pretty small and is quick to download. It just runs from it's location... no formal install.

Last, is a small file, LED Blink, Both Slow & Fast that actually contains two hex files, "blink_fast.hex" and "blink_slow.hext" that are test files that you can load and run to verify that your Teensy & the Integrated Development Environment is all working as it should be.


So that concludes acquiring and setting up the Development Environment for not only regular Arduino du jour but also the nifty thrifty Teensy.


Now the programming begins, and this is the part I may need some help on.

Best,

-AC

AC_Hacker 02-09-13 11:42 AM

Most Excellent Arduino Tutorial...
 
So I'm trying to get my Arduino chops together, and have been looking at many various tutorials.


THIS ONE that I came across is the best, most detailed, most thorough I have found.

-AC

MisterFixit1952 02-10-13 12:32 AM

Great mini-tutorial. This should get me rolling on some of my deferred projects. Just needed a bit of a kick-start.

AC_Hacker 02-10-13 10:18 AM

Quote:

Originally Posted by MisterFixit1952 (Post 28041)
Great mini-tutorial. This should get me rolling on some of my deferred projects. Just needed a bit of a kick-start.

Thanks! If you see that anything is missing or in error, please send me an EcoRenovator private message and I'll edit in the corrections/additions.

We all need a kick-start from time to time.

BTW, the guy that developed the Teensy (PJ) goes to the bi-weekly DorkbotPDX meetings, and there you will find a happy, supportive community of accomplished tech-heads, including PJ. And also, since it is Portland, a variety of great micro-brews.

Best,

-AC

AC_Hacker 02-10-13 05:21 PM

Project Progress...
 
2 Attachment(s)
I was successfully able to run the Teensy "Blink Both" hex examples.

I was also able to make the Arduino "Blink" example run.

I tried different pins, changing code for each different pin, to get the feel of that.

So, I want to be able to get the Teensy to be able to print information out from the Serial Monitor.

I found a dead simple Teensy example on the Teensy site that is called "Tutorial 3: Serial Monitor & Input"

So from that page I cut the code...
Code:

void setup()  {               
  Serial.begin(38400);
}

void loop()                   
{
  Serial.println("Hello World");
  delay(1000);
}

...and pasted it into an Arduino sketch.

But compiling and running running the code did not result in my being able to see the Teensy output anything...

So after trying everything I could think of, even burning a candle to the saints (which did calm my nerves), but nothing more. So, out of despiration, I posted a message to the Teensy Forum and quicker than I could say, "this thing will never work", I had an answer...

Turns out that I needed to change a default on the Serial menu...


... and once that was done, the Teensy was more than happy to talk to me.


Road block removed... progress continues.

Best,

-AC_Hacker

AC_Hacker 02-10-13 11:27 PM

Teensy Reads Voltage on Analog pin...
 
5 Attachment(s)
More good progress to report...

My goal now is to get the Teensy to read an analog voltage and write it to the screen.

When the Teensy reads an analog signal, it has 1024 incremental steps it can express a voltage in. A value of 0 would correspond to 0 volts and a value of 1024 would correspond to 5 volts.

I combined a couple of pieces of code I found on the web...

The first was the piece of code that prints to the screen FOUND HERE and shown in the previous post

Code:

void setup()  {               
  Serial.begin(38400);
}

void loop()                   
{
  Serial.println("Hello World");
  delay(1000);
}

The next piece of code was FOUND HERE that would read a voltage from a potentiometer.

Code:

int analogPin = 3;    // potentiometer wiper (middle terminal) connected to analog pin 3
                      // outside leads to ground and +5V
int val = 0;        // variable to store the value read

void setup()
{
  Serial.begin(9600);          //  setup serial
}

void loop()
{
  val = analogRead(analogPin);    // read the input pin
  Serial.println(val);            // debug value
}

I combined them to look like this:

Code:

int analogPin = 38;    // initialize Teensy pin 38 for input of analog voltage
                      //
int val = 0;          // variable to store the value read set to zero

void setup()  {               
  Serial.begin(38400);
}

void loop()              //BEGIN LOOP
{
  val = analogRead(analogPin);    // read the Teensy input pin 38
  Serial.println(val);            // print val to serial monitor
  delay(1000);                          // delay 1 second before repeating loop
}                                // END LOOP

My Teensy setup looked like this...


Here's a close up...


And when I compiled and ran code, this is what I got.


The voltage is just stray voltage, and when I got my hand close, the reading increased.

Next I hooked up the CO2 sensor's power and ground to the proto board, and ran the analog out wire from the sensor to the analog in pin on the Teensy.


So I ran the code and this is what I got...


There was a delay of several seconds after I exhaled, until the values rose on the serial monitor.

I have made no attempt to relate the values I am seeing to CO2 ppm.

But so far, it is a go!

Best,

-AC

stevehull 02-11-13 01:27 PM

AC,

A quick calibration can be the CO2 content of your breath at the end of expiration ~ 7%.

AC_Hacker 02-12-13 10:13 AM

Exploring Pulse Width Modulation (AKA: PWM)
 
1 Attachment(s)
To make the Teensy control the speed of a fan, I will use the built-in PWM feature of the Teensy/Arduino.

The PWM pin can send out a stream of pulses, hi = 5V, lo = 0V.

The duty cycle of the PWM, the percent of time the voltage is high, can be changed in 256 steps (0 to 255) from 0% to 100%, respectively.

NOTE: My Analog read pin can read in steps of 1024, so I will need to divide my analog read values by 4 before I direct them to the PWM output.

So I located the simplest Arduino program I could find and stripped out everything I didn't need.

I ended up with this endless loop PWM program:

Code:

//PWM test; PWM Value = 0 to 255

const int Brightness =  14;          //This sets up Teensy pin 14 and names it Brightness

void setup()  {               
  pinMode(Brightness, OUTPUT);      //This makes Brightness (AKA: pin 14) an output pin
}

void loop()                        //This sets up a loop
{                                  //BEGIN LOOP
  analogWrite(FanSpeed, 255);          //This sends a value of 255 to Brightness
  delay(500);                          //Delay one half second
}                                  //REPEAT LOOP

I connected an LED to Teensy pin 14, and compiled & ran code.



LED comes on full bright.

Next I changed the 255 value to 128 and re-ran. LED came on less bright.

Ditto 64 (dimmer)
Ditto 32 (dimmer)
Ditto 16 (etc.)
.
.
.
Ditto 0 (LED off)

Everything worked as I had expected!

On to the next test.

Best,

-AC

AC_Hacker 02-13-13 11:36 PM

Video of CO2 Controller for HRV!
 
1 Attachment(s)
More progress to report...

Trying to send analog voltage from Telair to Teensy PWM pin.

Scaled the 1024 step analog read to 256 step PWM write.

Code:

int CO2_Read = 38;                  // initialize pin 38 for input of analog voltage
int PWM_feed = 14;                  // initialize Teensy pin 14 for PWM

 
void setup()  {                    // BEGIN SETUP
  pinMode(PWM_feed, OUTPUT);        // Make Brightness (AKA: pin 14) an output pin
  int CO2_Read = 0;                // variable set to zero
  int PWM_feed = 0;                // variable set to zero             
  Serial.begin(38400);
}                                  // END SETUP

int CO2_volt = 0;

void loop()             
{                                  // BEGIN LOOP
  CO2_volt = analogRead(CO2_Read);  // read the Teensy input pin 38
  PWM_feed = (CO2_volt/4);        // PWM out takes the value of CO2 volt divided
  Serial.print("PWM_feed is = ");  // print val to serial monitor
  Serial.println(PWM_feed);
  delay(1000);                            // delay 1 second before repeating loop
}                                  // END LOOP

Which yielded this result:


Then I was really interested in using setup to actually power a fan, to get some idea if this was actually feasible.

I knew that the output from the Teensy pins was pretty puny, but trying to attach ANYTHING more than an LED led to disappointment.

So I learned about various Power MOSFET transistors, as the solution. I discovered that the choices of MOSFETS that can directly interface with Teensy is fairly limited, because most MOSFETs need at least a 10v pulse to turn on the transistor, but the Teensy only has 5 volts.

I did find out that these will work:
  • RFP30N06LE
  • IRL540
  • IRLZ44N
  • ST95N2LH5
  • IRF520
... but nobody in this city has one. So I ordered 10 of the RFP30N06LE from Sparkfun... (wait a week)

I also found out that you can build a single transistor amplifier to kick the 5 volt output up to 10 volt(+) levels, which I did until the real thing arrives.

I also discovered that the single transistor amp inverts the signal, so I wrote a line of code that inverted the pulse, and I'm in business.

Code:

int CO2_Read = 38;                  // initialize pin 38 for analog voltage in
int PWM_pin = 14;                  // initialize pin 14 for PWM

 
void setup()  {                    // BEGIN SETUP
  pinMode(PWM_pin, OUTPUT);        // Make PWM_pin (AKA: pin 14) an output pin
  int CO2_Read = 0;                // variable set to zero
  int PWM_pin = 0;                  // variable set to zero             
  //Serial.begin(38400);
}                                  // END SETUP

int CO2_volt = 0;
int PWM_feed = 0;
int DutyCycle = 0;
int PWM_invert = 0;

void loop()             
{                                  // BEGIN LOOP
  CO2_volt = analogRead(CO2_Read);  // read the Teensy input pin 38
  PWM_feed = CO2_volt/4;            // Scale CO2_volts (1024) to PWM (256)
  PWM_invert = 256 - PWM_feed;  // Invert PWM_feed
  //analogWrite(PWM_pin, PWM_feed);
  analogWrite(PWM_pin, PWM_invert);
  Serial.print("PWM_feed is = ");  // print val to serial monitor
  Serial.print(PWM_feed);
  //DutyCycle = PWM_feed/256;
  DutyCycle = CO2_volt/10 ;
  Serial.print(" and duty cycle = ");
  Serial.print(DutyCycle);
  Serial.println("%");

  delay(1000);                            // delay 1 second before repeating loop
}                                  // END LOOP

See fan spin!

HRV controlled by CO2 - YouTube

Many thanks to the very helpful dorks at DorkbotPDX, you guys helped me a bunch!

Best,

-AC_Hacker

stevehull 02-14-13 08:56 AM

This is GREAT news and you have done well by hacking a control transistor to drive an output pulse.

Digital controls have incredible precision, but the analog world often is much faster. Chips like I suggested have built in hysteresis - but still need drivers like the one you just showed.

VERY nice to have the audio (aka card on bicycle wheel) to audibly demonstrate the CO2 control.

Keep going :thumbup:

Steve

AC_Hacker 02-14-13 08:44 PM

Quote:

Originally Posted by stevehull (Post 28156)
Digital controls have incredible precision, but the analog world often is much faster. Chips like I suggested have built in hysteresis - but still need drivers like the one you just showed.

Sounds like this will be an interesting project for you, I wish you the best.

Don't forget to explain everything clearly and include lots of photos.

Starting a project thread is very easy, just PRESS HERE and you're on your way...

Best,

-AC

AC_Hacker 02-18-13 11:23 AM

Code Sanitization & Refinements & the Right Power FET
 
2 Attachment(s)
As I'm learning more about programming the Teensy, I am also developing a keener appreciation for clear code.

So I have rewritten the sketch from my last post to do pretty much the same thing as before, but to be a bit cleaner.

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);  // Write PWM_Value to PWM_WritePin
  Serial.print("PWM_Value is  = ");      // print val to serial monitor
  Serial.println(PWM_Value);
  DutyCycle = (100 * PWM_Value / 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

...which has this more readable output:



I am also realizing that there are some refinements that are needed:
  • Stalled Fan Prevention
  • Pulse Width Modulation Noise
  • Use the Proper Power FET

Stalled Fan Prevention
The stalled fan issue comes about when the CO2 level is so low that the resulting duty cycle of the pulse stream is too low to overcome the 'magnetic friction' of the fans, and although the fans are receiving pulses of power, the pulses are insufficient to initiate motion, thus energy is expended, but no work is being done... not good economy.

I anticipate that the stalled fan characteristic will be different for different fans but they will each have their individual stall points.

I wrote a simple program that counted down and printed duty cycle values to the serial monitor, while it sent pulses to the fan of incrementally decreasing duty cycles. I watched the fan gradually slow down until it came to a stop. The fan stops when the duty cycle reaches 28%, which corresponds to a pulse width value of 73.

I then altered the program so that it counted up, with the fan initially being in a stopped state. The fan starts when the duty cycle reaches 36%, which corresponds to a pulse width value of 92.

The amount of air that was moved by a 36% duty cycle is pretty low, so I decided that I need to make my fan turn-on and turn-off points a bit higher than 36%, which corresponds to a PWM value of 92 (out of 256).

Pulse Width Modulation Noise
The fans I am using are extremely quiet, but the the pulses that are sent to the fan are within the range of hearing... so even when the fan is changing speed, the high-pitched whine of the pulse stream remains the same. I played too much rock & roll in the previous decades, and I can't hear the problem at all. My girlfriend however, has very good hearing and is quite uncomfortable with the high-pitched whine of the fan.

The fans will be inside a box, which should reduce the sound, but I think the problem can be entirely eliminated by increasing the frequency to some super-audible level.

The Arduino Integrated Development Environment (AKA: IDE) makes many simplifications in order to lower the threshold for entry into this interesting world. The unfortunate result of that decision is that the user does not have direct control of all the variables that might be available to someone programming in C for instance. The Arduino IDE does not give me direct access to the frequency of the PWM stream, but C does.

So it looks like I'll be headed back to the next DorkBotPDX meeting to learn a little C.

Use the Proper Power FET
This problem was a piece of cake. The new FETS came in from Sparkfun, and installing was a simple matter of pulling out the amplifying transistor plus associated parts and of course the old power FET. Then I installed the new power FET that has a lower turn-on threshold. Then, the output of the Teensy PWM pin goes straight into the gate of the new device.

Here is the before picture...



...and here's the after picture...



Much simplified!

The LEDs and their associated resistors are in the circuit just for testing purposes, so the final version will get even simpler...

Best,

-AC

Mikesolar 02-18-13 05:52 PM

So, if you don't have control over the frequency, how do you control the PWM with the arduino or can you have it do a 0-10vdc (or 0-5vdc) equivalant

AC_Hacker 02-18-13 07:54 PM

Quote:

Originally Posted by Mikesolar (Post 28286)
So, if you don't have control over the frequency, how do you control the PWM with the arduino or can you have it do a 0-10vdc (or 0-5vdc) equivalant


The above picture is a representation of a PWM wave.

If you assume that the rising edge is the beginning of each pulse, the percentage of time the wave is high during each wave is called the duty cycle. In this picture, it looks like the wave is high for about one third of the duration on the wave, so the duty cycle would be 33%.

If it was only high a quarter of the time, the duty cycle would be 25%.

So, without varying the frequency of the wave you can vary how long the wave is high.

With the Arduino, you can send a PWM pin a value between 0 and 256, to control the percentage of time that the wave is high. In the case of the first example, you would send the Arduino PWM pin a value of 256 divided by 3, so you would send it a value of 85.

In the second example you would send a value of 256/4 or 64.

If you wanted the duty cycle to be 80%, you would send a value of about 204. I'm using the Arduino in integer mode to conserve memory, so there are some math errors but they are not so important.

There's a good entry in Wikipedia that goes over this pretty well.

Does this help?

Best,

-AC


All times are GMT -5. The time now is 04:53 AM.

Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2024, vBulletin Solutions Inc.
Ad Management by RedTyger