Return to the Cloudy Nights Telescope Reviews home pageAstronomics discounts for Cloudy Nights members
· Get a Cloudy Nights T-Shirt · Submit a Review / Article

Click here if you are having trouble logging into the forums

Privacy Policy | Please read our Terms of Service | Signup and Troubleshooting FAQ | Problems? PM a Red or a Green Gu… uh, User

Equipment Discussions >> Equipment

Pages: 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | (show all)
ThadeusB
member


Reged: 11/14/12

Loc: Somerset, UK
Re: How to make an automatic dew controller - Arduino new [Re: ThadeusB]
      #5535710 - 11/23/12 03:13 PM Attachment (49 downloads)

I'll try again!!!

Post Extras: Print Post   Remind Me!   Notify Moderator  
ThadeusB
member


Reged: 11/14/12

Loc: Somerset, UK
Re: How to make an automatic dew controller - Arduino new [Re: ThadeusB]
      #5535711 - 11/23/12 03:14 PM

That one did it.

Post Extras: Print Post   Remind Me!   Notify Moderator  
ThadeusB
member


Reged: 11/14/12

Loc: Somerset, UK
Re: How to make an automatic dew controller - Arduino new [Re: ThadeusB]
      #5535774 - 11/23/12 03:53 PM Attachment (30 downloads)

Hi Paul,

Thought I would also send the sketch with all DHT22 lines; which includes the DHT22.h and cpp files.

If you try compiling this one, you'll see that it is not far from working.

Regards

Phil


Post Extras: Print Post   Remind Me!   Notify Moderator  
Pauls72
professor emeritus
*****

Reged: 10/28/07

Loc: LaPorte, IN
Re: How to make an automatic dew controller - Arduino new [Re: ThadeusB]
      #5536101 - 11/23/12 07:06 PM Attachment (42 downloads)

Phil,

I commented out 2 lines, found one typo where you had a DHT1 instead of a DHT11.
Then I ended up using my libraries, at least one of your is different.
So attached is the updated sketch and my whole library folder.

It also was getting an error that the compiled code was too big 18.9K, the max allowed is 14K. Your sketch has the board type set to a Nano w/AT Mega168. I changed it to an Arduino UNO and it compiles. If you really do have an Nano w/AT Mega168 you will need to work at reducing the program size down some.

A couple of other things I would recommend:
Change these 4 values to 5, 10 degrees Fahrenheit difference is way more than you need.
int dewAdjust1 = 10; // Temperature difference between the Dallas one wire heater sensors and the controller DHT-11 sensor, in Fahrenheit. One for each output port so you can adjust the outputs individually.
int dewAdjust2 = 10; //
int dewAdjust3 = 10; //
int dewAdjust4 = 10; /


Since you in the UK set this value to 1 so your temperatures are displayed in Celsius.
boolean temperatureC = 0; // Set to one to display temperatures on Celsius. Note: All math and debugging is still done in Fahrenheit.

Good Luck,
Paul


Post Extras: Print Post   Remind Me!   Notify Moderator  
ThadeusB
member


Reged: 11/14/12

Loc: Somerset, UK
Re: How to make an automatic dew controller - Arduino new [Re: Pauls72]
      #5536641 - 11/24/12 04:36 AM

Hi Paul,

That was quick!! Set to a Nano was it, where is that in the code? My board is a Uno R3.

Ok, I'll give it a try now and let you know how I get on.

Very many thanks Paul.

Regards

Phil


Post Extras: Print Post   Remind Me!   Notify Moderator  
ThadeusB
member


Reged: 11/14/12

Loc: Somerset, UK
Re: How to make an automatic dew controller - Arduino new [Re: ThadeusB]
      #5536677 - 11/24/12 06:10 AM Attachment (26 downloads)

Hi Paul,

Sorry to be a pain, but your complete library was not attached. I've got your revised .ino where I can see the corrected typo. I tried compiling it with the library I have, but no go. I've attached a screen shoot of the errors.

Regarding the file size: I presume then that at 18.9k it will not upload to the Uno. That I will need to reduce the size somehow, perhaps starting with most of the comments. What do you think?

Where in the code is the board set; I can't see it anywhere.

Regards

Phil


Post Extras: Print Post   Remind Me!   Notify Moderator  
ThadeusB
member


Reged: 11/14/12

Loc: Somerset, UK
Re: How to make an automatic dew controller - Arduino new [Re: ThadeusB]
      #5536814 - 11/24/12 08:47 AM

Hi Paul,

I'm trying to find out about sketch maximum size, but have not found it yet. However, I see that the Uno has 32K flash memory of which 0.5K is used by the bootloader. my complete libray is 95.8K; is this a problem?

Please forgive my ignorance of all this, I'm a complete novice! Perhaps I should buy the Arduino book.

Regards

Phil


Post Extras: Print Post   Remind Me!   Notify Moderator  
Pauls72
professor emeritus
*****

Reged: 10/28/07

Loc: LaPorte, IN
Re: How to make an automatic dew controller - Arduino new [Re: ThadeusB]
      #5536944 - 11/24/12 10:02 AM

Phil,

The sketch source size and library source sizes makes mo difference. It's the compiled object that makes the difference.

My libraries where too big to attach, so I put them on our clubs web site:
http://michiana-astro.org/projects/dewctrl/libraries.zip

I don't put my libraries in the same folder as the sketches. Here is how I have my folders structured. The Arduino compiler knows to look in the correct folders when you have them like this.

Paul







Post Extras: Print Post   Remind Me!   Notify Moderator  
Pauls72
professor emeritus
*****

Reged: 10/28/07

Loc: LaPorte, IN
Re: How to make an automatic dew controller - Arduino new [Re: Pauls72]
      #5536975 - 11/24/12 10:24 AM

The maximum compiled sketch size is limited by the amount of flash memory on your Arduino board. It happens that in their naming convention on a lot of the boards, the first part of the number is the amount of memory.

168 = 16k
328 = 32k
1280 = 128k
2560 = 256k



I have a Uno in my Dew Controller which is 32K and an Uno clone from China that I am using for testing/experimenting which is also 32K.

The compiler tells you your object program size when it compiles successfully.



Post Extras: Print Post   Remind Me!   Notify Moderator  
Pauls72
professor emeritus
*****

Reged: 10/28/07

Loc: LaPorte, IN
Re: How to make an automatic dew controller - Arduino new [Re: Pauls72]
      #5537007 - 11/24/12 10:50 AM

Because a lot of the libraries are open source and put out in the public domain for free anyone can go and change them and they do. So you can find a lot of different versions of a library for the same device using the same name. I struggled learning this the hard way. I am by know means an Arduino or C/C++ expert, but I have learned a fair amount in building this project.

The errors generated by the compiler don't always point straight at the problem. The errors especially get convoluted when you are referencing something incorrectly in a library.

It's no problem helping you. I understand your learning pain as I went through it a few months back. It's extremely frustrating when you have no place to go for any help. In my case it forced me to learn a lot more about the Arduino and C/C++ languages.

I'm sitting here fighting with trying to integrate an Infared remote control into mine. When I just add the library in my Arduino either crashes or goes crazy. I know it's a memory conflict, I just haven't been able to find it.


Post Extras: Print Post   Remind Me!   Notify Moderator  
ThadeusB
member


Reged: 11/14/12

Loc: Somerset, UK
Re: How to make an automatic dew controller - Arduino new [Re: Pauls72]
      #5537274 - 11/24/12 01:49 PM

Paul, You're a gentleman, I really appreciate the help you are giving me. Once I have things sorted I'll be doing the same for some other people here in England. I corresponding with a couple of people who are facing the same learning curve.

However, I'll set up my filing system as you have shown, then give it another go with your libraries. Fingers crossed it will compile for me this time.

I've just ordered a couple of books on the Arduino and sketch wrting - I should have done this first. Trouble is I'm impatient and want things working immediately; I doesn't work like that though, does it.

I'll get back to you later with progress.

Very many thanks again.

Phil


Post Extras: Print Post   Remind Me!   Notify Moderator  
ThadeusB
member


Reged: 11/14/12

Loc: Somerset, UK
Re: How to make an automatic dew controller - Arduino new [Re: ThadeusB]
      #5537430 - 11/24/12 03:52 PM

Ye Gods Paul, its compiled, uploaded and apparently working!!!

The filing system has clearly worked for me, thank you.

So, one thing I must do is slow down the scrolling speed, as its a bit fast and hard to read. Although I have one Dallas hooked up, its not reading it, so I'll check that its working with a test program. The DHT22 is reading Temp and humidity, but the numbers don't add up, because I haven't yet changed all the Fahrenheit to Celsius lines.

The compiled file is 32.256KB and has obviously uploaded OK.

Later I'll hook up an output so that side of it can be read and displayed.

More later Paul, and very many thanks again.

Best regards

Phil


Post Extras: Print Post   Remind Me!   Notify Moderator  
Pauls72
professor emeritus
*****

Reged: 10/28/07

Loc: LaPorte, IN
Re: How to make an automatic dew controller - Arduino new [Re: ThadeusB]
      #5537583 - 11/24/12 05:34 PM

Glad to here you got it working.
There is no need to change the program from Fahrenheit to Celsius. If you change the one parameter then everything is displayed in Celsius.


Post Extras: Print Post   Remind Me!   Notify Moderator  
ThadeusB
member


Reged: 11/14/12

Loc: Somerset, UK
Re: How to make an automatic dew controller - Arduino new [Re: Pauls72]
      #5538091 - 11/25/12 12:13 AM

Hi Paul,

Right, now I have the system partially working, in that the Dallas sensors are detected and giving temperature readouts now in Celsius. So far so good.

However, the DHT22 is not reading correctly, giving crazy figures for temp, hum & dew. So, I ran the adafruit DHT tester sketch. When in DHT11 mode, it returned the same ball park crazy numbers; when in DHT22 mode it returned believeable numbers - temp agreed with my digital thermometer.

Sadly it seems that the protocols are different, so I'll now revert to the DHT22 configuration and try compiling again.

Never mind, it was worth a try. I'm happy though in that things are mostly working. Clearly the heater outputs can't work until the temperatures are correctly reported.

An aside: initially the Dallas senors were not detected, this was due to a jumper link on the proto shield having an LED linked to D3. This was preventing the signal pin from pulling up to 5V. There was also an LED linked to D2, but this was not cause of the DHT problem.

Its now 0510 in the morning, and I'm going to bed!!

Good progress Paul.

Cheers

Phil


Post Extras: Print Post   Remind Me!   Notify Moderator  
tecmageModerator
Carpal Tunnel
*****

Reged: 01/13/10

Loc: Glenview, IL
Re: How to make an automatic dew controller - Arduino new [Re: ThadeusB]
      #5538151 - 11/25/12 01:20 AM

Phil,
Are you sampling too fast? The DHT11 can sample every second (1Hz), but the DHT22 can sample every two seconds (.5Hz).


Post Extras: Print Post   Remind Me!   Notify Moderator  
ThadeusB
member


Reged: 11/14/12

Loc: Somerset, UK
Re: How to make an automatic dew controller - Arduino [Re: tecmage]
      #5538257 - 11/25/12 04:30 AM

Hi Richard,

You have a point there, I had forgotten about the much slower response of DHT22; I'll try that.

Thank you

Phil


Post Extras: Print Post   Remind Me!   Notify Moderator  
ThadeusB
member


Reged: 11/14/12

Loc: Somerset, UK
Re: How to make an automatic dew controller - Arduino [Re: ThadeusB]
      #5538301 - 11/25/12 05:44 AM

Hmm, it isn't clear or obvious to me how to change the sampling rate of the DHT22. Is it defined in the dht.h or dht.cpp files?

All very puzzling to this novice.


Post Extras: Print Post   Remind Me!   Notify Moderator  
tecmageModerator
Carpal Tunnel
*****

Reged: 01/13/10

Loc: Glenview, IL
Re: How to make an automatic dew controller - Arduino [Re: ThadeusB]
      #5538538 - 11/25/12 11:12 AM

Try adding a 2 second delay. Your system should handle the delay with no problem.

Post Extras: Print Post   Remind Me!   Notify Moderator  
Pauls72
professor emeritus
*****

Reged: 10/28/07

Loc: LaPorte, IN
Re: How to make an automatic dew controller - Arduino [Re: ThadeusB]
      #5539705 - 11/26/12 01:10 AM

The Delays are easy, just insert a 2000 millisecond delay in front of any call to the DHT sensor in the main program loop:

// ********************Main Program Loop********************
void loop(void)
{
if(powerupDone == 0)
{
powerup();
powerupDone ++;
}

// Keep the Analog input for the duty cycle between 0 and 1000.
dutyIn = constrain(dutyIn, 0, 1000);
dutyOut = map(dutyIn, 0, 1000, 0, 1000);
delay(2000);
int chk = DHT11.read(DHT11PIN);

//Lcd display for ambient temp, humidity and dew point on line 1. Remote temps for LX200, ED80, EP & Box on line 2.
lcd.setCursor(0,0);
lcd.print("Temp=");
if (temperatureC != 1) {
delay(2000);
lcd.print(((int)DHT11.fahrenheit()+correctionDHT), DEC);
delay(2000);
sensorhigh = (int((int)DHT11.fahrenheit())+correctionDHT);
sensorStorage(sensorhigh, 15, 25);
}
else{
delay(2000);
lcd.print(((int)DHT11.celcius()+correctionDHT), DEC);
delay(2000);
sensorhigh = (int((int)DHT11.celcius())+correctionDHT);
sensorStorage(sensorhigh, 15, 25);
}


// Display DHT-11 Humidty value
lcd.print(" Hum=");
delay(2000);
lcd.print((int)((float)DHT11.humidity), DEC);
lcd.print("%");
delay(2000);
sensorhigh = ((int)((float)DHT11.humidity));
sensorStorage(sensorhigh, 16, 26);

// Display DHT-11 Dew Point value
lcd.print(" Dew=");
if (temperatureC != 1) {
delay(2000);
lcd.print((int)((DHT11.dewPointFast()*1.8+32)), DEC);
delay(2000);
sensorhigh = ((int)(DHT11.dewPointFast()*1.8+32));
sensorStorage(sensorhigh, 17, 27);
}
else {
delay(2000);
lcd.print((int)(DHT11.dewPointFast()), DEC);
delay(2000);
sensorhigh = ((int)(DHT11.dewPointFast()));
sensorStorage(sensorhigh, 17, 27);
}

// Display the duty cycle settings


It also looks like you will need to do a little tweaking of the DHT11 library to handle the DHT22. You can see the differences in what would be required the library code here:
http://arduino.cc/playground/Main/DHTLib
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


Device data sheets.
DHT11 http://www.micro4you.com/files/sensor/DHT11.pdf
DHT22 http://dlnmh9ip6v2uc.cloudfront.net/datasheets/Sensors/Weather/RHT03.pdf


You can open up the library files (.h & .cpp) with notepad or a text editor. I prefer Textpad. http://www.textpad.com/
Just make sure you save off a copy before you do any edits.

Edited by Pauls72 (11/26/12 01:16 AM)


Post Extras: Print Post   Remind Me!   Notify Moderator  
Pauls72
professor emeritus
*****

Reged: 10/28/07

Loc: LaPorte, IN
Re: How to make an automatic dew controller - Arduino [Re: Pauls72]
      #5539743 - 11/26/12 02:07 AM

Phil,
I had a nice long explanation typed up and then closed my browser instead of just one tab and lost everything. Anyway do you understand what is going on in this line of code?

lcd.print(((int)DHT11.fahrenheit()+correctionDHT), DEC);

If not I'll type up an explanation for you on some of the basics.
Paul


Post Extras: Print Post   Remind Me!   Notify Moderator  
Pages: 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | (show all)


Extra information
8 registered and 16 anonymous users are browsing this forum.

Moderator:  zjc26138, tecmage, rflinn68 

Print Thread

Forum Permissions
      You cannot start new topics
      You cannot reply to topics
      HTML is disabled
      UBBCode is enabled


Thread views: 20632

Jump to

CN Forums Home


Cloudy Nights LLC
Cloudy Nights Sponsor: Astronomics