Well, its progressing! After a battle with the display, I now have it running on breadboard with the DHT22, showing the Ambient conditions,
I wonder though if you could clarify something for me please Chris? I also have the DS18 connected, but not yet the MOSFET driver and heater. Should I be seeing readings from the DS18? At what point in the build should I be seeing data other than the Ambient readings?
I recall seeing someone mention a pushbutton somewhere in the thread, but dont see one in your diagrams?
EDIT - Just found the v.4 update 2 folder, thanks! The test sketches were what I needed - my DS18 looks like its duff! Only reading 0.75V parasitic power at the signal pin! Typical, one of the few items I dont have spares of!
Cheers
Martin
Last edited by MartinG7MRV; 16-12-2016 at 06:23 AM.
Reason: extra info
I have a holiday project!! Almost all orders are placed. One question, is the 4.3k resistor 1/8W?
I think I will use a Powerpole panel mount for the 12v.
My long term plan is to put a RigRunner, this dew controller, Small USB hub, and an Intel compute stick on board which is piggy backed to my OTA. The intel stick will run BYEOS, PHD2, Astrotortilla, etc. Everything will be powered off powerpoles and I will only have one single cable coming from scope to the battery.
Yay, mine works. Thank you Chris. This is so cool! I just need a Fahrenheit code update for my Yank brain!
I ran into a few issues so let me list them here for others. This was my 1st arduino build so these are probably all noobie mistakes!
1) I used a 4.7KW 1/4W resistor (no issue but was unsure if I should use a 1/8w or 1/4w)
2) I could not get the sketches to compile until I added the Adafruit unified sensor library.
3) I could not get the DHT22 to read any temperatures. Maybe this is due to how I wired the mono jack. I ordered mono but it appears I got stereo. Originally I had digital 10 signal going to one end of the resistor and digital 10 VCC going to the jack along with the other end of the resistor. I switched signal and VCC on the extension board and then I could read temps.
4) I could not get the display to work by following the diagram (crossing SDA to SCL). When I hooked up SDA from the display to SDA extension board (and SCL to SCL) the display worked.
5) The MOSFET was coming on when it should but I had a constantly warm heater strap. Originally, I had the heater connected to Vin and GND and the 12v supply to V+ and V-. As soon as I switched those the heater only came on when the controller told it to.
By the way, I am using 12v power source with power pole connector. It has 7x USB2.0 ports and is made by Modern Robotics in the US. IT's about $90. I plan to have an ulta light, low power imaging solution using an Intel compute stick as the PC. The stick, powered USB / 12v hub, dew controller will all mount on my scope with only 1 wire coming up to the scope. I put an inline meter off the battery output. At idle this dew controller pulls 0.5W, with 1x 3" heater strap at 100%, I am pulling 5.8W.
Hello, I am curious how folks have mounted their LCD? There is very little room around the LCD. I am thinking about using a nibbler to cut out the rectangular hole slightly smaller than the LCD then finish with a file. Install the LCD from the underside of the case and use silicone adhesive to secure it in place.
My wife bought a Dew strap for Xmas, not realising it needed a Dew controller. After searching the internet, I settled on the Jaycar Arduino Dew Heater project. [www.jaycar.com.au]. This is my first Arduino project and the first time since the early 90's I have tried programming, therefore I thought I'd take the easy way out and build an established kit with existing code.
However, the code from the website kept on giving me Checksum errors when reading the DHT11 module. After further research, I was able to modify the code to get around the Checksum error. See below
Offending code was if(DHT11.getStatus()==IDDHTLIB_OK){
ambtemp=DHT11.getCelsius()*10;
ambhum=DHT11.getHumidity()*10;
dptemp=DHT11.getDewPointSlow()*10;
}else{
thermerror=thermerror|2;
}
Changed to ambtemp=DHT11.getCelsius()*10;
Serial.print("C Ambtemp: "); Serial.write((ambtemp/10)%10+'0');Serial.print("C AmbHum: ");
// Check if any reads failed and exit early (to try again).
if (isnan(ambhum) || isnan(ambtemp) || isnan(dptemp)) {
Serial.println("Failed to read from DHT sensor!");
thermerror=thermerror|2;
return;
}
This got me around the CRC error but Ambient Temperature, Humidity and Dew point still weren't displaying itself onto the LCD screen.
Further research I discovered that it wasn't uncommon to have issues reading the DHT11 module. In fact many libraries have been written to try to overcome this. Therefore I decided to try some of the different libraries. Without going into too much detail, I settled on the DHT.H library. I was able to get the LCD screen to display everything once the code was modified to suit the new library.
I don't know if the code is perfect as I am dubious on the Dew Point reading its given and welcome feedback. Anyway, attached is the full modified code for the Jaycar Dew Heater kit using he DHT.H library. Hope this helps anyone who also decided to try it and found similar issues.
It has two possible ways to calculate dew point. They are the standard formalae (at least as far as I know).
This project used a tiny 128x64 display. I noticed a lot of people use the 16*2 or 16*4 displays. I'll do another version for these in a while - but I still reckon that little display is way better !!!
I've now stuck mine in a larger box which also has 12v outputs, usb power out, a usb hub. So its all in one thing.
The calculation for Dewpoint follows some well established formulas. They are of varying complexity and efficiency. The detailed formulas produce no error, the simplified formulas are accurate >50%RH which if you're looking to calculate the dewpoint to turn on heaters is good enough since you're going to be interested in the point where the RH is close to 100% anyway.
As for the DHT11, there are some serious variances in quality. The RH it spits out is highly dependent on temperature and I found some variance in the accuracy of the temperature part.
Both Temp and RH are easy enough to test yourself. Stick your DHT11 next to a temperature gauge you know is accurate (surely everyone has those lying around right? ) and compare it as temperatures change.
To test the RH accuracy create a saturated salt solution. Get some table salt and mix it with water. Well over mix it. Add way more salt than will dissolve in the water. Then seal your solution air tight with the sensor. (I did this by mixing it in a small dish and putting that dish and the sensor in a zip lock bag and then sealing the last part of the zip lock where the sensor cable came in with some blutack. Leave it over night and the next morning you should have a calibrated environment with 75.3%RH at 25C or 75.1%RH at 30C, and frankly if you're reading between 70 and 80 on a DHT11 you're already better than expected.
Fundamentally there's a different problem though. The DHT11 tops out at 90%RH and is lucky to read above 80%. If you turn on dew heaters at 80% that's fine, but if you turn on your dew heaters based on a calculation of dew point and difference of your actual temperature you won't actually ever get to your dew point. The calculation will use RH which may top out at 80% after which as the actual temperature drops your calculated dew point will drop with it and the two will never converge as you will for ever think your relative humidity is not 100% and by definition then the current temperature is above the dewpoint.
My suggestion is jump on ebay and buy a 10 pack of DHT22 sensors and then put them through the salt test till you find one that performs acceptably. Or spend big and get better sensor, but you may struggle to find an Arduino library for proper sensors as the cheap ones are favoured for obvious reasons.
I don't know what the jaycar one uses to calculate dew point. Mine uses:
dewPointAmbient = (logEx - 0.66077)*237.3/(0.66077+7.5-logEx);
logEx=0.66077 + 7.5*temperatureAmbient/(237.3+temperatureAmbient) + (log10(humidityAmbient) - 2);
This is reasonably accurate (unlike simpler formulae that have huge errors at humidity below 50%).
As Gabrz says the DHT11 can have trouble above 80% humidity. I figure this could lead to an error of about 2C in the dew point calculation. I'm not going to lose sleep over that. There's probably more errors due to placement of the scope lens temperature probes which provide the feedback control to the heater (difference between ambient dew point and temperature of scope glass which has to be heated).
Also the Jaycar uses as resistor to sense scope temp? I don't think think will work as well as the DS18B20s (which theoretically doesn't require any calibration)
Edit: actually error might be a bit more, maybe 3-4C error between humidity at 80% v 100%. But for the purposes of a controller I don't think it matters too much, the other errors probably have a bigger impact.
Last edited by ChrisV; 27-01-2018 at 12:15 PM.
Reason: mistake in calculating dew point error
Chris you're right with the errors 3-4 degC is a good estimate. Assuming it caps at 80% RH at 5degC the dewpoint will be calculated at 1.8C
I would factor in a small error band in this and turn on my dew heaters when I'm within 5-6 degC of the dew point just to be on the safe side.
Sidenote:
I needed the simplified formula because my dew heater had to handle powersuplies, USB interfaces, autofocus and a lot of other things so I had no spare microcontroller cycles to waste on doing a logarithm
Actually I was so tight that I optimised the simplified instruction to avoid dividing by 5 as well by pre-multiplying by 410 and then logically shifting right by 11.
The proper formula took 4678 instructions and 1658b of code (20% of the microcontroller's program space). The simplified formula was 407 instructions, and 268b of code. My final one was 74 instructions and 68 bytes.
I took the Dew heater kit out last night and it seemed to work. IE: Heater strap connected correctly to the MOSFET, heating up. The thermistor and Ambient temperature reading correctly. However, the Ambience Humidity was reading 99% and Dew Point 42C. I suspect this is not right.
ChrisV, I used your code for the Dew Point. Thankyou.
However, I suspect the Dew Point reading of 42C is not right because of the high Ambient Humidity in the calculation.
Next steps. Calibrate the DHT11 as proposed by Garbz. I may also upgrade to a DHT22 and DS18B20s.
I'd love to get a copy of your simplified formula for Dew Point. Below are the 3 versions I have been using. I don't know which one is more economical when it comes to microcontroller cycles.
Side Note: I just realised ChrisV had a simpler version of his code commented out. Didn't see it earlier. I'll try that next.
// Read Dew Point Slow in Celcius;
// delta max = 0.6544 wrt dewPoint()
// 5x faster than dewPoint()
// reference: http://en.wikipedia.org/wiki/Dew_point
double a = 17.271;
double b = 237.7;
double temp_ = (a * (double) ambtemp) / (b + (double) ambtemp) + log( (double) ambhum/100);
int Td = (b * temp_) / (a - temp_);
Serial.write((Td/10)%10+'0');Serial.print("C dptemp: ");
// dewPoint function NOAA
// reference: http://wahiduddin.net/calc/density_algorithms.htm
double A0= 373.15/(273.15 + (double) ambtemp);
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) * (double) ambhum;
double T = log(VP/0.61078); // temp var
dptemp = ( (241.88 * T) / (17.558-T));
Serial.write((dptemp/10)%10+'0');Serial.print("C dewPointAmbient: ");
// Calc dew point if no error reading DHT11. ChrisV code.
// simple calc = dewPointAmbient = temperatureAmbient - ((100 - humidityAmbient)/5.0);
// more complex calc
double logEx=0.66077 + 7.5*ambtemp/(237.3+ambtemp) + (log10(ambhum) - 2);
dewPointAmbient = (logEx - 0.66077)*237.3/(0.66077+7.5-logEx);
Serial.write((dewPointAmbient/10)%10+'0');
That's weird. The dew point should approach the ambient temp as humidity approaches 100%. I'll check with mine.
What was the ambient temperature?
Chris
Edit: I just realised you are using the Jaycar one. I don't think its very good - I wouldn't trust the way they measure temperature with resistors, plus it uses the DHT11 versus the DHT22 in mine and others
Quote:
Originally Posted by GRM
Hello All,
I took the Dew heater kit out last night and it seemed to work. IE: Heater strap connected correctly to the MOSFET, heating up. The thermistor and Ambient temperature reading correctly. However, the Ambience Humidity was reading 99% and Dew Point 42C. I suspect this is not right.
ChrisV, I used your code for the Dew Point. Thankyou.
However, I suspect the Dew Point reading of 42C is not right because of the high Ambient Humidity in the calculation.
Next steps. Calibrate the DHT11 as proposed by Garbz. I may also upgrade to a DHT22 and DS18B20s.
I might also try and make another version with a dedicated circuit board. I've been following the onstep project and they now make them with the easyEDA website which is very quick and cheap.
Quote:
Originally Posted by luka
Can I suggest that you look into the Bosch BME280 sensors. Superior than the DHT sensors and also measures pressure.
You can get them from AliExpress or ebay for about $5.
Follow the links here to find the Arduino drivers.
I'd love to get a copy of your simplified formula for Dew Point. Below are the 3 versions I have been using. I don't know which one is more economical when it comes to microcontroller cycles.
Microcontrollers hate logarithms, floating point and division. However if you're just calculating a dew point and you don't have concerns about sleeping to save battery life then there's really no benefit. I'm using a slight variant of the "simple calc" formula you already listed:
Quote:
dew_point = t-(100-h)/5.0;
That one is an order of magnitude more efficient than the full formula.
I changed that to:
Quote:
dew_point = t-((100-h)*410>>11);
and I used deci-degrees for everything i.e. 15 = 1.5C The result is a pure simple integer maths and critically, no division. A floating point division takes 100s of instructions. A logical shift right takes a single instruction (or 11 in this case).
1>>11 = 1/(2^11) = 0.00048828125. If you pre-multiply by 411 you get 0.20068359375. Very close to what you get if you divide something by 5.
Okay that is probably all of no interest to you
But this here may be more interesting to you:
Below I've graphed the relative error for dew point calculations at 5C. Note at 0C the max error increases to +1.2C and at -5 it's +1.5C. However the dewpoint calculation error decreases the closer to the dewpoint you get. At 90%RH you're at 0.5C error.
I quoted the wrong humidity in previous response. It wasn't 99%. I got confused with the Heater output.
Anyway, I went back to the original code because I wasn't happy with the Dew point reading. Made some modifications to how data was read, copying code from the library example. The new code got around the original DHT faulty problem.
Code and Dew Point reading working as it should.
Yes, I am still using the Jaycar version but will be upgrading to ChrisV version once I buy the new parts.