View Full Version here: : Really easy to make arduino dew heater controller

10-04-2016, 05:04 PM

I needed a dew heater, so thought it was a good time to revisit the excellent Dew Heater controller built in IceInSpace 2010 by Bob Stephens. I had two reasons for doing this:
1. There are some great modular arduino products which make it extremely easy to make. The Nano has a great extension I/O board so all the components CAN BE attached with pre-made connectors. There is NO circuit board making. There is NO soldering onto circuit boards. The ONLY soldering is for the plugs and sockets to connect it to the outside world.
2. Arduino based modules are now very cheap. Apart from the heater straps it costs ~$40 for a 1x channel build (Jan-Feb 2016).
3. Except for the heater it uses very little power. In fact, you can leave it on all the time to monitor temp/humidity – only plug in the heater if needed.
The 1st attached pic show it connected and its inside connections

How the controller works & software
The controller is similar to the build by Bob Stephens (with additional liberation of software from other sources) so I won’t go into details. It is Arduino based and feedback controlled, briefly:
1. DHT22 senses ambient temperature & humidity. The dew point is calculated.
2. DS18B20 temperature sensor placed inside the heater strap senses the temperature of the element to be heated. You’ll need 1x for each bit of glass to be heated. I haven’t done the code for multiple channels yet, but will do so if any interest.
3. Calculate the difference = ( heated element - ambient dew point ).
4. Send a PWM output from the Arduino based on this difference. I have used a threshold for activation of the heater of 5oC above ambient dew point (this is what most seem to use - can be changed in the software). So the PWM output = 0% at +5 oC (and above this) to 100% at 0 oC.
5. This PWM output drives the heater strap via a MOSFET driver module. The heater output increases as the temperature difference between heated element and ambient decreases.
6. The display swaps between showing (1) the ambient temperature, humidity and dew point and (2) the heater temperature, difference to dew point, and heater drive level.

The parts
The parts as follows. The 2nd attached pic shows the main Arduino bits.
• Arduino bits ($10-11 – ebay O/S vendors): Arduino Nano; Nano V3.0 prototype shield I/O extension board expansion module.
• The sensors ($10.50 – ebay O/S vendors): DHT22 Digital temperature/humidity sensor; DS18B20 digital temperature 1-wire sensor (need an extra DS18B20 for each additional heater). The beauty of these is that they are digital – they are plug and play as they do not need calibrating.
• Display ($7 - $12 – ebay local & O/S vendors). I used a 0.96” I2C SPI serial 128x64 OLED display - it is small, so if you only want 1x heater channel it all fits in a small light (box) that I Velcro onto the scope. You can use other display eg 20x4 red LCD display. Any display is fine just as long it is an I2C serial display as it only require 2x connection leads (it wont use up all of the Arduino analog/digital ports if you need multiple heater channels) plus 2x power leads.
• MOSFET driver for heater (ebay O/S vendors). $3.50 1x channel module and ($10 for a 4x channel module).
• Hardware (Jaycar). ~$10-15 for Jiffy box, plugs/sockets, wires and 1x resistor.
• Heater strap (Jaycar & Bunnings). Whatever you want. I won’t describe the heater straps here – I use nichrome as its much easier than resistors (and not difficult to connect to wire as some would have you believe).

The nice thing about the extension I/O board is that each Arduino analog/digital/I2C input/output has pins for that input/output & +5VDCC/GND. So you can just plug the pre-made connectors into the IO board. For the MOSFET driver and display just plug the other end into that module. For the sensors (DHT22, DS18B20), just cut one end off and solder onto the appropriate lead or socket (and cover with heatshrink = wonderful stuff).

The circuit
The circuit and how you put it together as follows (shown in the 3rd attached pic). A few things to note:
• The DHT22 attaches to the outside of the box. So get 3x connectors, cut off one end, solder to the DHT22 leads and cover soldering with heatshrink (1.5 – 2.55mm). See the 4th attached pic.
• Have used parasitic mode for the BS18B20 (so only need 2x wires instead of 3x). So you can’t go wrong wiring it up. Just connect the 2 outside ones together – these go to GND; the central one goes to the signal of digital 12. If you cover up all the solder joints and its connections to the 2 core wire with heatshrink it is nice and watertight (see 4th attached pic). There might also have to be a one line change to code in the library of you find it doesn’t work (I can provide details).
• The serial display – just needs 4x wires. Don’t forget to swap over the SCL & SDA connections between display and extension I/O board.
• MOSFET driver connections = easy.
• Power – run the 12V input to both the Arduino extension IO board and the MOSFET driver.

Getting it going
Before you do the whole build its best to put it together in stages and test each bit.
1. First put Arduino on your PC or Mac, load up the attached sketch (it will need a few libraries uploaded – should happen automatically). Don’t worry if you haven’t used Arduino before – its not too hard.
2. At this stage its best to put it together in stages to check it works. (1) plug in the DHT22 and check that it reads the ambient temp/humidity. (2) plug in the Ds18B20 and check that it reads heater sensor temp and calculates the heater output. (3) Plug in MOSFET driver and heater strap – does it heat it.
3. Put it all together in a jiffy box.

Cheers, Chris

10-04-2016, 05:45 PM
Your definition of "easy" may not be agreed upon by everyone... The instructions that you posted look complicated enough. Nevertheless, it's going in my TODO bookmarks folder. Thanks! ;)

10-04-2016, 07:16 PM
I will bookmark this page, it looks a great little project, after I manage to do a stepper controller for a moonlite focuser. May take a while, so hopefully the page doesn't disappear.

Thanks for putting this up, will save the zip file for future references..

10-04-2016, 08:02 PM
Hi Chris,

Can dew not or kendrick dew straps be used with this device??


11-04-2016, 10:18 AM
Thank you for the detailed write up. Very interesting. I've just started my Arduino adventure, so really interesting post.


11-04-2016, 11:15 AM

Just depends upon the current they draw. I've used IRF520 MOSFET module. This can do 1amp as is, and up to 5amps with a heatsink. I've used it on a 4" refractor and an 8" SCT and its fine without a heatsink - but conditions don't require a massive heat drive in Sydney. The rule of thumb is that if the mosfet feels too hot then it isn't coping - so add a heatsink or go for a higher power module.

I couldn't find the specs on the Kendrik straps. But the Astrozap 4" heater is 0.6A, 6" is 0.8A and 8" is 1.2A - so it will be fine with those. Just look up whatever heater strap you have and see what current it draws then compare to the above IRF520 specs. And don't forget - most of the time the heater will be running on a low duty cycle if conditions aren't terrible. So if the heater is running 50% duty cycle this equates 0.6A for the above 8" strap.

The thing about the setup I have described is that it uses simple interchangeable modules, so if you need higher power then just get a higher power mosfet module. I'll have a look for some higher power modules when I get a chance. But really, if your need to draw more than 5amps - thats 60W ! Might as well pull out a hair dryer !!!!

Thanks for your interest. Chris

11-04-2016, 02:39 PM
Thanks Chris,

I'd be looking at this for a warming the mirror of a 10inch RC. The strap wraps around the inside edge of the tube and heats the mirror by radiant heat.

I only want to keep the mirror a degree or so above ambient dew point.

The current draw would be 1.6 amps at maximum. Any suggestion of what model Mofset I would require? (Much to learn about all this stuff!)


11-04-2016, 05:51 PM
Hi Chris,

Well done with this device.

The funny thing is, I have made one almost exactly the same as yours. As I was reading your article I was thinking, that sounds familiar.

Same temp sensors and humidity sensor.

The difference with mine is I am using the Freetronics N-MOSFET Driver which can handle up to 40 Amps so pulling up to 3 amps, does not even get hot. Also have 2 channels.

I have also taken advantage of the USB connection and do stats that can be imported into Excel to show all parameter info. That way the unit can be monitored all night to check the performance. As I'm always using the laptop, I have written some software to show all the parameters live.

Apart from fully auto mode, I aslo have a manual mode built in where 4 different settings for each channel can be set. Also these settings can be custonised to whatever suits the users scope/location. To top it off, it starts to the sound of Black Dog by Led Zeppelin!

I use 2 LED's to display the modes and that also helps to keep things light as it's mounted on the tube.

Great minds think alike. I'll post details of mine when I get a chance.




11-04-2016, 07:39 PM
Sounds very interesting Damien!


11-04-2016, 10:14 PM
I like the Zeppelin touch ! What about Sabbath, Pigs of War, with them coming out for a tour ?

Manual mode - good idea.
I was after an easy build that wouldn't scare people too much.
Love to see your build. Yes, it takes as long to write it up as design it.

17-04-2016, 11:06 PM
Hi Chris,

Just wondering if you've had a chance to find any higher power modules. I'm a complete novice at this sort of electronics, so really appreciate any assistance you can offer.

Can you suggest a heatsink for the MOSFET module pictured in your build? I'd like to be able to cope with a 2 amp load through the dew strip.

I had a look at the N-MOSFET that Damien suggested. I'm not sure if that is compatible with your project - I think it triggers differently?



18-04-2016, 03:10 PM
The IRF520 module will be fine at 2A if heatsinked.
Get a TO-220 Heatsink (6021 Type) from jaycar. Its $1.45, plus paste and washer.
I'll measure what mine is doing over the next few nights - with heaters for 4" and 8" scopes.

Or use the freetronics NDRIVE Damien suggested - that's great and only $4 ! The freetronics site has the wiring for it also.

Just remember to run the 12V and GND from the power input directly to whatever mosfet module you use and also to the arduino (as in the diagrams and pics in my post). The mosfet power doesn't come from the arduino.

18-04-2016, 05:59 PM
Thanks Chris,

Will start accumulating some bits and pieces.


18-04-2016, 06:09 PM

A guinea pig !! Good luck.
PM if need any help.


19-04-2016, 10:30 PM
Thanks Chris,

You may regret your offer of assistance. I have zero experience with electronics!

Most of the parts are on a slow boat from SE Asia, so I don't expect to have all the bits for a month or so.


01-05-2016, 09:36 AM
Chris thanks for the kind words about my older design. Glad to see that it continues to be of use. Thanks also for sharing what you have done and the benefits that brings to others. Love the power of the web to enable us to share and build on others work (as much of mine was done by pulling other stuff together). Bob

03-05-2016, 09:17 AM

More than useful. It had to change for me as I'm a messy solderer. I wonder what the next version will look like, Damien's sounds pretty intense.


03-05-2016, 10:17 PM
HI again to all,
Sorry about the late reply.
I've added some pics to show what I've done.

How it works is fairly simple:
With the switch in the manual position, the unit will use presets that have been pre designated. In one of the photos, you can see the heater settings can be set for each channel and each channel has 4 heater settings that can be selected by using the small push button. These settings get downloaded and saved in the eeprom.

By pressing this button in, it will cycle through the different heat settings and beep and flash to let you know which setting has been selected. 1 flash and beep for level 1, keep holding the button in,,,2 flash and beeps for Level 2 .......etc. When using the software, it will display the selected settings. The unit does not need the software to run, it's stand alone, but the software is a bonus.

When the switch is in automatic mode, the unit just works and uses the sensors to detect the ambient temp, RH, and heater temperatures to set the heater output PWM. My favorite setting.

The software is fairly straight forward in respect to features, and multiple files can be saved with different settings, (perhaps for different locations).
The unit is very light itself which is great for mounting on the telescope tube.

You can use any software to read in the values as the data is simple and easily imported.

The Humidity/temp sensor on the top, I just wrapped white electrical tape around it for a little protection.

There are a few prototype holes drilled where they should not be, lol.
The centre connection on the front has 2 RCA connectors for the dew heaters and the central connector is for power. I love these power connectors and try to fit to all my gear as I have several 5 amp power supplies with the same mating connectors. The 2 LED's below this are the indicators.

The rear connections are for the 2 temp sensors with the USB in the middle. Below the USB is the small button for selection and the switch below that to select modes. Always use a fuse somewhere logical in the power feed. I have an inline one I use, not shown.

I use DEW NOT heaters as they are reasonably priced and work well.
The photos show the software, (excuse my galaxy pic, couldn't help myself), in operation as well as the settings form.

I've really appreciated reading about your project and I'm guessing you got a buzz when it was working as I did. This is fun stuff.

There is also another guy here on IIS, (Garbz), who has also built an amazing all things device. Look it up. He really knows what he is doing and helped me with some advice on saving memory!


03-05-2016, 10:18 PM
Other pics attached.

Data in Excel with graph.



04-05-2016, 08:42 AM
Nice build Damien !

07-05-2016, 10:50 PM
Many thanks Chris.

Your Oled display rocks by the way, no PC needed!

Black Sabbath, yeah, got me thinking now... Going to see Iron Maiden on Thurs, Hmmmm

Oops, just noticed, the Mosfets are 20Amp not 40.

Happy to share any other info if need be.



12-05-2016, 05:58 PM
Hi Chris,

Finally got the bits together.

Have managed to finally get an appropriate USB driver for the clone Arduino Nano so I can connect it to my Mac. Sketch has been uploaded and it appears to work! I will have to buy the resistor and sockets and wire them up tomorrow. I'll let you know if the heater gets warm...

Very cool to get this working - feel like a real electronics geek!


12-05-2016, 06:10 PM

Can you please clarify what wattage resistor is needed?

4.7k ohm 0.25W, 0.5W or 1W??


05-07-2016, 08:58 PM
Hi Chris,

Finally reporting back in with the field test of the controller.

The temps at Leyburn were -2 degrees and there was a thick frost on the ground in the morning. The controller was covered in frost where I had it mounted on top of the optical tube. The temperature sensor was a snug fit into one of the collimation bolt holes on the lens cell. The front objective was clear of dew all night. On the occasions I checked the screen, it was running the heater at ~40% to maintain the lens cell 2-3 degrees above the dew point calculated by the unit. I had the dew strap wrapped around the outside of the dew shield - there’s a 1cm gap between the dew shield and lens cell, but it still worked fine.

I highly recommend this unit to others. I'm going to build another unit for a mate with a 14inch OTA - hopefully the mofset plus heatsink will cope with the higher amperage. Better do some calculations.

Thanks again for publishing this design.


10-07-2016, 07:38 AM
Hey guys, had a chance to lurk today and thought I'd comment on this.

First of nice work looking very good. There seems to be a bit of talk about power draw and MOSFETs so I thought I'd add some advice to the selection:

Firstly you're measuring humidity to calculate dewpoint right at the case of the electronics. If you get hot enough to need a heatsink then this is a really bad MOSFET choice. One-Two degrees of heat passing through the case to your DHT22 will throw out your calculations, and self heating prevents the DHT22 from reading 100% humidity so your dewpoint will follow the temperature and things just don't work (found this out the hard way).

So MOSFET selection. This SHOULD be a non-issue, but the IRF520 is not too good of a choice here. For a dew heater the duty cycles are very slow so a MOSFET will not spend any time in the active region, it will either be on or off. The active region becomes a problem when you're switching in the 100kHz kind of region, but for this application one of the most important numbers is R_ds(on) for the MOSFET.

The IRF520 has a Resistance Drain - Source in On state [R_ds(on)] of 0.27ohm. What this means is that when the power is being applied to the heater the mosfet looks like a 0.27ohm resistor. Drawing 2A through your heater? That's over half a watt for the MOSFET. Thermal resistance Junction to Ambient [R_thJA] for the IRF520 is 62 C/W so the junction of the MOSFET will be 30degrees higher than the ambient temperature. This isn't an issue for the MOSFET, but if you enclose it into a small black box, maybe add a second one for another dew strap you'll quickly turn your box into a heatsource right next to the temperature measurement.

So for ideal component selection rather than looking at the Amps D-S rating, instead look for a low R_ds(on) rating.

If you feel inclined to experiment more you could look at the part I used in my little dew heater controller which was an IR3315 High-Side Switch. This has a couple of awesome advantages over using an N-channel MOSFET:

It has an R_ds(on) of 0.02ohm so an order of magnitude better than the IRF520
It is high-side switch so it switches off the VCC line rather than switching off the Ground. Using an N-channel FET as a low-side switch is not an issue for a dewstrap ... unless you have a short circuit. On a low side switch there's always 12V on the output, so a short circuit to the telescope itself (most likely place, and usually grounded) is a short circuit even when your circuit is off.
Speaking of short circuits using a single resistor the IR3315 can be configured for current limiting, so a short circuit won't damage anything even when you crank the dewheater to 11 :)

Just some free tips :). It's a very nice and simple build all the same so thanks for sharing it with everyone.

(edit: Poo! I just forgot one very important detail. The IR3315 being a high side device needs 12V to turn it on. I installed a MOSFET driver before it, a TC4426. That complicates things.)

Also David for resistor wattage it's a simple calculation:
Volts (V) = Amps (I) * Resistance (R).
Power (P) = Volts (V) * Amps (I)

Put them together:
P = V^2 / R.
P = (5*5) / 4700
P = 0.005W so a resistor rated to 0.25W is more than adequate, and as a general rule of thumb typically every time you see a resistor in any kind of digital signal (e.g. 5V output of an Arduino) vs power (+12V side) service it's almost universally okay to select the lowest power rating.

16-07-2016, 06:30 PM
Been running mine now for a few months. Some cold dewy nights running at 50-70% power. The mosfet doesnt get very hot.

Under these conditions I've measured surrounding ambient temp - is the same as the reading i get with the sensor.

No probs.

Cheers Chris

22-07-2016, 04:03 PM
Hi Chris
I noticed your sketch for the nano dew heater has a button and a potentiometer but the wiring diagram does not show it.
Can you help me out with a revised diagram.

22-07-2016, 04:26 PM
Sorry loaded wrong sketch:lol:

26-07-2016, 04:35 PM
Congratulations to ChrisV on a nice project!

I hope nobody is offended if I "hijack" this thread - but I was just perusing the JayCar site (that's what I do when it's cloudy, so there's no point in taking the telescope out!), and I came across this project:


The parts list runs to a total of about $90 at JayCar (or less if you already have some of the basic components, or shop on eBay):

XC4520 Temperature and Humidity Module: $9.95
XC4454 LCD and Button Shield: $19.95
XC4410 Duinotech Uno Board: $29.95
RN3440 10K Thermistor: $1.75
RR0596 10K resistors: $0.55
RR0572 1K resistors: $0.55
ZT2468 MOSFET: $5.95
XC4482 Proto Shield: $15.95
WC6028 Plug-socket leads: $5.95
RR3264 5W 39Ohm Resistor: $0.48

I haven't done a detailed comparison against Chris's project, and I don't know whether this is a "fork" of his project (or Bob Stephens' 2010 project which he references), but there might be some handy hints for selecting / designing components and wiring, and / or optimising code, for anybody who is thinking of making something similar.

26-07-2016, 10:34 PM
This is a good project guys...Following with interest...keep up the good work.:thumbsup:

28-07-2016, 11:28 PM

Interesting. Different to my build - which I ripped a lot from Bob's. My idea was to try and make an easy build with the nice pre-made modules now available (cheaper on ebay).

Bob's (and mine) use a better temp sensor than the thermistor which isn't as sensitive and can be a bit unstable. But the Jaycar version has some nice ideas.

I'll incorporate some of their ideas when I finally getting around to making mine multichannel.

05-08-2016, 08:48 PM
Attached is an update to the dew heater - includes instructions and updated code. The updates are:

1. changes to the code as one of the arduino libraries was altered which affected its running (well, crashed it actually).

2. You can now run 0- 3 heaters from it, each with their own sensor. It will automatically detect if the number of sensors connected.
- if so = it will control its heater and display its data.
- if not = it will turn off the drive to its heater and not display its data.
NB- there is a change to the pins connecting sensors and heaters.

3. some changes to components - there were some good suggestions about the MOSFET (eg from Damien/Redbeard & Chris/Garbz)

4. Have included more detailed instructions, including how & what arduino libraries to install

Cheers, Chris

06-08-2016, 06:10 PM
Another update. This version has some testing sketches, so that you can check that each sensor works before putting it all together. Also instructions on that testing.

The final test sketch lets you run it using the computer as the display. So lets you test everything except the display.
Some might like to modify for different types of display. Redtail found a nice red 16x2 LCD display and he's helping me get it going.

06-08-2016, 11:36 PM
I would like to thank Chris for all his hard work and lightning fast response.
Another excellent project.:thanx:

18-08-2016, 08:50 PM
Superb project Chris and sorry for this probably stupid noob question!
I have got all the pieces and went for the Freetronics MOSFET a la Damien.
The wiring diagram on the freetronics website has thrown me (I'm not well up in such matters).
The S connection is from the -(ve) from the 12V battery supply, the G connector to the arduino board but the D connection should come from the negative side of the load? What would that be and then where does the +(ve) wire from the battery go??

Sorry for my confused state..:help:

18-08-2016, 11:57 PM
Freetronics has a diagram

Take the +12v and gnd directly from where the power comes in to your unit.

19-08-2016, 12:39 AM
You're pretty much on the money. S connection OK, G connection OK, and the D connection is also OK as you connect it to the negative end of the load. Then all you do is connect the positive side of the load to the positive (+) battery. So it's like the load is in series between positive and the mosfet.



19-08-2016, 09:24 AM
Thanks Damien.
So the load in our example would be the dew band? The D connection goes to the negative of the dew band, positive battery wire to the dew band too, well, the RCA connectors anyway..


21-08-2016, 05:15 AM
Yep, That's it. :thumbsup:

All correct!


26-08-2016, 10:25 AM
Just had a look at a new Linux device (a Kickstarter project) https://www.indiegogo.com/projects/omega2-5-linux-computer-with-wi-fi-made-for-iot#/ which opens some interesting opportunities in this space. Towards the end of the article it lists a bunch of third part modules which can be used including Current sensing, temp humidity sensors, display etc. I2C, wifi and other bits already on board.

Not available yet from what I can see but an interesting option for the next iteration of dew controllers (and other smart telescope accessories) .

28-08-2016, 03:05 AM
Just be careful with how smart you want to make it. "Linux device" is a bit misleading in what people think it means. Most Linux devices like a Raspberry Pi run the full OS like Debian and can do almost anything. The predecessor to this one ran OpenWRT which is in comparison quite limiting.

Still way overpowered and should be able to easily control a dew heater (as well as many other things) but just go in with the right expectations.

08-09-2016, 09:33 AM
Considering making myself one of these. Looks like a great project. What size of project box is needed for a 4 channel controller?

09-09-2016, 11:28 PM
Good questions. Not quite sure how much heat that would generate inside the box. What sort of elements would it be driving ? For an OTA and other things ?

13-09-2016, 07:00 AM
I am about to start assembling the components for this controller. I am a bit lost with the power aspect.
The extension board has a 5.5mm socket. The wiring diagram shows 12v supply. I assume the 12v supply from the battery pack plugs in here.
Do I need to do anything to my Arduino before I apply power? I don't want it going BANG on me.

It is my understanding that an Arduino is 5v when powered through USB but can take 12v supply through VIN. I take it then plugging the battery into the 5.5mm socket it is connected through VIN then???

Sorry for the noob questions. I'm picking this up bit by bit as I progress with the build......

18-09-2016, 02:44 AM
Well, build complete...... almost. MOSFET is in the post, arriving Wednesday...
Power applied to partial build just to check. Did find one issue. Connections for screen asked for SCL and SCA leads to be crossed. When I did this the screen did not work. When I put them the "wrong" way, it all works perfectly.... GO figure

18-09-2016, 12:56 PM
Hi Shand,
I have just tested my new build of this unit all is working except the heater temp sensors do you get a reading of temperature Under the Status on your DS18B20 ?Currently my is returning Status = Error

thank Peter

18-09-2016, 02:01 PM

The two most obvious things are wrong input port or ds18b20 not wired correctly. Just check that - check the i/o you are connected to compared to the code , and . If still not working PM me.

And make sure you have the updated code i posted recently .


22-09-2016, 05:58 PM
Up and Running!! :D Thanks Chris for your support
and everyone else who contributed to this great project :thumbsup::thumbsup:

28-09-2016, 09:52 PM

Got mine finished. Once heaters arrive I can test it completely....

29-09-2016, 12:42 AM
Nice !

And an update. Now does 4 channels.

10-10-2016, 10:50 PM
Thanks Chris you are a star....great project

11-10-2016, 01:27 AM
Nice one Chris....... need to drill another hole now..... :)

11-10-2016, 10:39 AM
Excellent - will try this out in due course!


11-10-2016, 01:36 PM
Great project. Built in a few hours including a couple of homemade heater straps, and used to great effect last night. Thanks Chris for sharing such a good project.

11-10-2016, 04:08 PM
Thanks all, any problems post or PM me.


20-10-2016, 11:36 PM
Ok, thanks to ChrisV for his help with this.... (would never have been done otherwise...)

I ordered the wrong screen from ebay (2004A) when I first went to build this controller. Re-ordered with the correct OLED one.
The LCD eventually arrived from China and its a HUGE screen compared to the OLED one.

Due to the size of the box I used (to get use of the 4 channels on the MOSFET eventually) I think the larger LCD screen just looks better....


This is the CODE used for the LCD in case anyone else fancies doing the same.....

21-10-2016, 05:10 AM
Well done Shand:thumbsup:

24-10-2016, 11:01 AM
Hi Chris,

Thought it worth mentioning a few issues I ran into over the weekend with the latest update. I had not been running a screen with my unit which has been running great on two channels using the 2nd August update, but when a 128x64 oled arrived Friday, I decided to install it, and also update to the most recent code release.

Much frustration ensued until i realized the display initialize is 0x3D. This seems contrary to your notes in the code. The SSD1306 screen I used is in the link below, I'm not sure why it would be different to what you used originally, but maybe something I missed?


Anyway, with that issue out of the way, the next glitch had the display not advance past the intro screen (threshold/cutoff etc..). And this one I can't seem to work out. The code seem's identical with regards to screen function across the two updates, I haven't line for lined the code but from a quick scroll I couldn't find any reasons why it should not work (screen only that is, heater function was fine). If I swap back to the August-2nd update code, make the 0x3c - 0x3D change, everything runs fine.

I will keep hunting for the issue, but thought I would let you know what I experienced.

12-12-2016, 08:41 AM
Chris, Awesome design. I love that this can be put together with no bread boarding or soldering. Thank you for sharing!

Is there any chance you could make a code revision to display in Fahrenheit?

Thank you,

16-12-2016, 01:55 AM
Hi Chris,

Thanks for a great project. Im currently 'trying' to make it work. After a lot of head scratching over v.3 and the dht error, I finally decided to read the entire thread and found v.4! This has compiled nicely.

Im now battling a multi-format OLED which is configured in some odd way, I think for 3SPI. Hopefully get the display working (another, I2C only one on order anyway) soon, and can crack on with the sensors!


16-12-2016, 04:12 AM
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!


16-12-2016, 04:47 AM
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.

25-12-2016, 03:49 AM
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.

Happy Holidays!








14-01-2017, 06:18 AM
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.

14-01-2017, 09:05 AM
I did similar but held in place with double sided tape. Silicon adhesive might be better !

26-01-2018, 10:18 PM
Hello Everyone,

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

Changed to
Serial.print("C Ambtemp: "); Serial.write((ambtemp/10)%10+'0');Serial.print("C AmbHum: ");

Serial.write((ambhum/10)%10+'0');Serial.print("% dptemp: ");


// 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!");

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.

Kind Regards

Graham Galea.

27-01-2018, 12:45 AM
I thought this thread died and went to the thread-afterlife.

I haven't tried the jaycar one. I finally put the latest version of the dew heater described in this thread on github

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.


27-01-2018, 01:26 AM
Hi Graham,

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.

27-01-2018, 12:08 PM
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.

27-01-2018, 01:25 PM
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 (https://www.adafruit.com/product/2652) to find the Arduino drivers.

28-01-2018, 04:53 AM
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.

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. :camera:

28-01-2018, 10:00 AM
That's pretty tight for processing !! I didn't have to worry about economy - which is a good thing given my hack coding skills.

On mine I had a sliding scale of heater power. Kicks in when within 5C (or maybe it was 6) of dew point. And increases by 20% with each degree.

I dare not check the calibration on my dht11 using your salt bath. It would probably be way out ...

28-01-2018, 11:16 AM
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.

Thanks ChrisV, Garbz and Luka for the feedback.

Kind Regards

Graham Galea.

28-01-2018, 11:28 AM

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

28-01-2018, 11:43 AM

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?


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

28-01-2018, 11:49 AM
Thanks Luka, will have a look at them.

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.

28-01-2018, 10:52 PM
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:

That one is an order of magnitude more efficient than the full formula.

I changed that to:

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 :lol:

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.

28-01-2018, 11:55 PM
So go the simple calculation. The big error is all down at low humidity which is when you are unlikely to need much dew heating

29-01-2018, 07:39 AM
Hello All,

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.

Kind Regards

Graham Galea

25-03-2018, 05:32 PM
Updates etc are now on Github

22-07-2018, 11:27 AM
Hi Chris, I am having a few issues with the dew heater, I was hoping that you might be able to help me out.

1. the DHT22 is reading WAY his, like 235 degrees high, and a corresponding 1000% humidity.

2. the temp sensor is not reading at all. When I run the test code it errors out citing pin 3,5,6 but the instructions say to use pin 12, though Ising 3,5,6 produce the same results.

I am wondering if you have a version of the code that works with a single sensor and heater, Im wanting to use it for camera use, so only need one.


22-07-2018, 05:50 PM
Its been a while since I've looked at the build.

Are you using a nano?

To start, have you tried the v4a-test-DHT22, its on the github link from post #80. That will just test the DHT22 - on pin 2. Don't worry about connecting the DS18B20 sensors or the heater mosfets. This will print the data via the serial monitor on your computer (rather than the OLED display).

When you get that sorted I can help you out with a single channel version - its a minor change.

23-07-2018, 08:55 AM
Hey, THANKS for picking up the response so fast.

Yes, Nano, and the latest test file from GitHub.
Heres the output.

Dew Heater Controller
DHT22 test - serial output to computer
Digital pin Status Temp (C) Humidity (%) Dew Point
2 OK 230.4 998.4 397.0
2 OK 230.4 1024.0 399.5
2 OK 230.4 998.4 397.0

24-07-2018, 03:32 PM
To round out the solution in case anyone else has the same issue that I did......

It turns out that I have a DHT11 temp/humidity sensor, not the DHT22.
The fix was to simply replace every occurrence of DHT22 with DHT11 in the code and it works a treat now.


25-07-2018, 03:08 PM
Glad to see you got it resolved. Be interesting to see how it goes.

Looks like the DHT11 has lower temperature accuracy than the DHT22, ±2C versus ±0.5C. Also it says its best for 20-80% humidity versus 0-100% humidity for the DHT22.

I'm sure it will all be fine as its all pretty gross control - fuzzy logic-like.