Jump to content

Banner.jpg.b83b14cd4142fe10848741bb2a14c66b.jpg

Arduino dew heater control


Gina

Recommended Posts

Hi Jason,

I think I nearly there with the sketch, however, there is a problem with the libraries. I took it up with 'Pauls 72' on cloudynights. He as you probably know has written a lot of the code. He has my sketch and had it compiled after debugging mine a bit. I'm now waiting for his libraries to incorporate with my sketch. The interesting thing is that he said forget the DHT22 dht.h file, but use dht11.h (don't have this one yet), and change all lines from DHT22 to DHT11 - apparently the same protocols.

Hopefully he will get back to me later, so I'll update this thread when I have something positive to say.

Good luck with yours. What have you built in to your sketch? I presume both temp sensors and obviously LCD, and how are you controlling the duty cycle.

I made my tapes with very sticky duct tape; they work well

Link to comment
Share on other sites

  • Replies 238
  • Created
  • Last Reply

I have included the dht, dallas and lcd in mine, the code is simple using if else statements. If the dallas reads dewpoint + 2 then pwm @ 100%.

Elseif dewpoint + 3 then pwm @ 75%.

Ect.

It works on the bench just need to build the circuit and try it out.

I am also looking at a overheat alarm, but havnt sorted that yet.

Hopefully I can try it out next weekend.

Jason.

Sent from my LT15i using Tapatalk 2

Link to comment
Share on other sites

Hi Jason & Gina,

I've got this pretty much sorted now, with a compiled sketch, uploaded and seeming to do its stuff. Just a few little wrinkles to sort.

So next, is to hook up all sensors and heaters and see if the whole thing works.

More later.

Phil

Link to comment
Share on other sites

Gina,

I was just looking at your circuit diagram for the heaters and noticed you have added capacitors. Would this be for reducing noise from the PWM as well as the ferrite rings?

Jason.

Yes, it is.
Link to comment
Share on other sites

Forget what was said about the DHT11 & 22 protocols being the same; this was duff info as I've found. The DHT22 was reporting highly erroneous number, so the program couldn't determine T differences, hence the outputs coldn't switch on. The Dallas sensors are reporting correctly though, and the LCD does what its told.

So next, I will have to revert to DHT22 config, and hope it will compile.

More anon

Phil

Link to comment
Share on other sites

Note this: the proto shield I bought, an Olimex, has LED's linked to the D2 & D3 outputs. This means that the sensor signal pins cannot be pulled up to 5V. I only found this out when puzzling over why the Dallas sensors were not found when I first powered up. The pull ups were only achieving <2V ; no good at all. Cutting the links solved it.

If you have problems, check this out on your shield.

Link to comment
Share on other sites

What value/ type would you suggest? I would assume it is not as important as with other aplications.

Jason.

I suggest 100nF disc ceramic. That's what I use. The value isn't critical 10nF would probably be fine as would a higher value. Ceramic type are best for decoupling RFI.
Link to comment
Share on other sites

Hi Jason,

Still no rsolution to the DHT22 problem. So, I'm waiting for a DHT11 to come, that should work with my sketch without tweaking. The sketch and libraries were designed for it.

However, I do hope to find a 22 solution. It will work, its having the right protocols in the right places, thus allowing my sketch to recognise them.

Should have it working with the DHT11 later this week. I can then run through all the testing and setting up.

I haven't found Gina's stuff yet, got bored with trawling the pages. But thanks for the heads up.

More later

Phil

Link to comment
Share on other sites

Here are the relevant sections of code in my Peltier TEC cooling sketch :-


#define DHT22_PIN 11
#include <dht.h>
dht DHT;
// Data values
int boxTemp, humidity, dewPoint, coldFingerTemp, heatsinkTemp, ambientTemp; // values in tenths (10 x real)

//
boolean readDHT22()
{
double celsius, hum, a, b, temp, Td;
int chk = DHT.read22(DHT22_PIN);
switch (chk)
{
case DHTLIB_OK:
celsius = DHT.temperature;
hum = DHT.humidity;
a = 17.271;
b = 237.7;
temp = (a * celsius) / (b + celsius) + log(hum/100);
Td = (b * temp) / (a - temp);
boxTemp = celsius * 10;
humidity = hum * 10;
dewPoint = Td * 10;
return true;
break;
case DHTLIB_ERROR_CHECKSUM:
Serial.println(" ***** DHT22 Checksum Error *****");
return false;
break;
case DHTLIB_ERROR_TIMEOUT:
Serial.println(" ***** DHT22 Timeout Error *****");
return false;
break;
default:
Serial.println(" ***** DHT22 Error *****");
return false;
break;
}
}
//
Link to comment
Share on other sites

I think the DHT11 will be a good way to go for now Phil, it will keep you going in the right direction. Once you have more experience with the code it will be easier to modify for the DHT22.

I have made some headway this weekend, just waiting for some capacitors for the 9v regulator. I have a 12v psu feeding a made up board, this will step down to 9v for the arduinoand power and feed the heaters via the 4 mosfets. All the sensors and the lcd are also routed through it.

Jason.

Sent from my LT15i using Tapatalk 2

post-11618-135397011905_thumb.jpg

Link to comment
Share on other sites

Unfortunately the DHT11 is very limited and won't work at low temperatures. It has been replaced by the DHT22 which is far better. I have two syytems using DHT22s working perfectly - working code and the DHT library is in posts above. Apart from the camera cooling, I have the weather station working and using two DHT22s (indoor and outdoor - temperature and humidity). It took me some time to find the right combination of code and library but it CAN be done! :)

Link to comment
Share on other sites

Gina,

Thank you for the info, I'll take a close look at it later. Why I am having a problem is that the original codes were all wriiten for the DHT11, including highly specific .h and .cpp libraries; which include a lot of maths and functions related to temperature, humidity and dew point; they are utterly different to the standard libraries that one may normally use. I'll put them up for your interest later if you like. What I have to do is tweak my existing libraries so that the DHT22 is recognised. Evidently, it mostly comes down to the fact that although both sensors use a 40 bit code, but like this:

They both return 40 bits of data, 16 bits humidity + 16 bits temperature + 8 bits of checksum. It's just the DHT11 only uses the first 8 bits of the humidity and first 8 bits of the temperature.

DHT11 = 8 bits humidity, 8 bits filler, 8 bits temperature, 8 bits filler, 8 bits checksum

DHT22 = 16 bits humidity, 16 bits temperature, 8 bits checksum

So, the .cpp library I have needs to be tweaked to accommodate this difference. This and that the 22 is a 2 second device are the main differences. The slower polling rate is easily accommodated by writing in delays in the sketch code.

I should the DHT11 tomorrow. The box is now built and wired and essentially working, in that the 4 Dallas sensors all report correctly, and the LCD is doing its job. So, I may have a working system tomorrow.

The only thing I haven't done yet is to have switchable duty cycle, at the moment I just have a 100k pot to control it. I'll do the switching once I have a fully working unit. Then, all that's needed are clear night skies!

Yes, the DHT11 is limited, and of no practical use below 0 degrees C. That's a serious limitation! Shame about that.

Link to comment
Share on other sites

Jason,

Your board look very neat, well done. How are you going to control the duty cycle? I think going the switch selection route is the best one, so you know precisely what the settings are, rather than a more arbitrary pot; although that could be calibrated and scaled of course.

You can see where I am now with the code from my reply to Gina. Given some more coding knowledge, and precisely how the code controls the DHT's, I'll be able to tweak the libraries to make it all comply with the DHT22 protocols. I have ordered a couple of books on Arduino sketch writing and code definitions.

The learning curve is now less steep.

Phil

Link to comment
Share on other sites

The DHT library I uploaded to Dropbox and linked to supports both DHT11 and DHT22 - it detects which it's looking at. And it works. I've been using it in my camera cooling control all night every night for over a fortnight as well as previously to control my camera test runs at various temperatures. It functions perfectly.

A number of the Arduino digital pins produce PWM signals which are connected to the gate of a power MOSFET to control the power fed to either a Peltier TEC as in my cooling system or a resitive dew heater. You simply output between 0 and 5v as an analogue and it produces the appropriate PWM digital control signal. It's all there ready to be used.

Arduino pins for PWN are indicated with a tilde

Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue. By using this site, you agree to our Terms of Use.