Amateur astronomy is a big thing for me. I love looking at the wonders of the night sky while everyone around me is fast asleep. It helps me decompress from the stress of my day job and I find that it puts all of my “earthly woes” into perspective, once I get into the zone. I highly recommend you give it a go!
You do not need much to get started: the first instrument I pointed at the night sky were 10×50 binoculars. These days, you can get a decent refractor or a catadioptric for a few hundred bucks – just don’t fall for the department store Christmas specials. Educate yourself and read up a bit – like on the really excellent Cloudy Nights forum!
As with every other hobby you take seriously, amateur astronomy can be a major time sink. Since my spare time is pretty limited, stargazing is in constant competition with my EE aspirations – which is why projects that combine these two hobbies are always very welcome.
This dew controller project will do exactly that.
Let’s get started!
Dew formation on their optical instruments can be a major challenge for astronomers during the colder months of the year. Let’s see what exactly dew is, and where it comes from.
Dew is nothing more than water in the form of droplets that appears on exposed objects due to condensation. As the exposed surface cools by radiating its heat, atmospheric moisture condenses at a rate greater than that at which it can evaporate, resulting in the formation of water droplets. This process starts as soon as the air cools down to a temperature called the dew point. Past the dew point, water will condense on any surface that is colder than the air around it.
In simpler terms: the moisture contained in the surrounding air will start to condense on your telescope as soon as your instrument’s temperature falls below the dew point. The same thing happens when you take a bottle of beer out of the refrigerator: the bottle is cooler than the surrounding air, so it starts to drip with condensation.
If this happens, your observing session is usually over. Wiping the moisture off your optics does not help, because it starts to form again as soon as you stop wiping. The fact that you should never touch the optics on your telescope doesn’t exactly help, either. What to do, then? Well, there are actually a few options available to you. First of all, you should shield your optics. This will reduce its exposure to the elements and limit the amount of heat that your scope radiates into the night sky. Another option is to shield your site; trees are your friends here.
However, there are times when these passive methods are not enough. This is where dew heaters come into play. These little gizmos use heating straps to apply a constant level of heat to the sensible parts of your instrument to keep its temperature above the dew point. Voilà, no more dew! We’re going to build one.
Let’s talk a bit about the feature list of our future dew controller.
First of all, we’d like to have four individual channels. One for the main telescope optics, one for the eyepiece, one for the finderscope, and a reserve channel.
The channels should be controlled automatically, without human intervention. And since the controller will be powered from the same rechargeable battery as the rest of the astro gear, it should be as energy efficient as possible. It should only provide power to an individual heating strap if there is a risk of dew formation and heating is actually required: this will save energy. To achieve this, the controller must approximate the dew point based on the current ambient conditions, and only turn on the corresponding heating element if the temperature at its point of measurement falls below the dew point.
The controller should have a status display to show what’s what. In order to maintain a good dark adaptation, this display color must be red.
In order to allow for a graceful shutdown of the telescope mount in the odd case that the field battery runs empty, the dew controller should turn itself off as soon as a predefined low-voltage threshold has been detected.
The construction of commercial heating straps is not very complex: they consist of some sort of resistive wiring (probably nichrome wire) woven in a flexible cloth shell and some insulation material. They work by converting electric energy to heat.
Hook them across a 12 V supply and they start to radiate heat. We can calculate the amount of power they put out using the Joule-Lenz and Ohm laws:
I have two of these at hand, one for the main telescope optics and a smaller one for the eyepiece :
|Kendrick KL2008||11 Watts, 0.9 A @ 12 V|
|Kendrick KL2006||4 Watts, 0.3 A @ 12 V|
Pulse Width Modulation
Since we’d like to throttle the heater output so that it radiates just enough energy to keep the instrument above the dew point, we’re going to need a method to modulate the heater output. For this, we’ll use a technique called pulse width modulation (PWM). This method can be used to control the average voltage (and thus, current) that is fed to an inert load by turning the switch between the supply and the load on and off at a very fast rate.
The ratio between the periods when the switch is on, compared to the off periods, determines the average power delivered to the heater. This ratio is called the duty cycle.
The main advantage of regulating power output using PWM is that the power loss in the switching device (we’ll use a MOSFET for this) is very low. When the switch is off, there is virtually no current through the load, so there is no loss. Cool.
When the switch is on, the calculation gets a bit more involved. Let’s take it one step at a time.
When turned on, the voltage drop across a MOSFET (its drain-to-source voltage, VDS) is a function of the current flowing through the transistor. According to its specifications, the OTA heating strap pulls 0.9 A of current at 12 V. Our design will use an IRF640 N-channel MOSFET as switching transistor, and according to its datasheet, VDS at an ID of 0.9 A is approximately 125 mV.
The datasheet also tells us that the MOSFET’s resistance when fully turned on (Rds(on)) is 180 mΩ with the junction at room temperature; according to the normalized on-resistance vs. temperature graph we’ll have to multiply this by a factor of 1.6 for a more realistic junction temperature of 100 °C. Given that Presistive = I2 * R, we can determine that the IRF640 will dissipate 0.92 * 0.18 * 1.6 = 250 mW when sourcing 0.9 A to the heater.
But this is not the whole picture. We also have to look at power loss during switch transitions. This is not easy, because it depends on many variables that are hard to quantify. However, for the sake of completeness we’ll give it a go.
We can calculate the switching power loss of a MOSFET using the formula Pswitching = (Crss * Vin2 * fsw * Iload) / Igate.
Crss is the MOSFET’s reverse-transfer capacitance (a data-sheet parameter, here 130 pF); fsw is the switching frequency (we’ll go with 4 kHz); and Igate is the MOSFET gate-driver’s sink and source current at the MOSFET’s turn-on threshold (Qg where the VGS of the gate charge curve’s is flat, divided by transition time; for the IRF640 this gives 15 nC / 20 ns = 0.75 nA).
Plug all the numbers in the aforementioned formula and you end up with a dissipation of 0.08 mW per transition. Utterly negligible.
Putting it all together, and supposing a duty cycle of 50% (and ignoring the switching losses), we lose 0.25 * 0 + 0.25 * 0.5 = 125 mW to switching.
Compare this to a design where we use the transistor as a purely resistive device: in order to provide 50% of maximum power, the MOSFET would have to dissipate 12 V * 0.5 * 0,9 A = 5.4 W of power. This is 40 times worse than the PWM circuit’s performance. PWM is the way to go, no questions asked.
So now, we’ll have to think about how are we going to generate the PWM signal necessary to switch the transistor. Since we’ll be needing a microcontroller anyhow for the calculation of the dew point, the easy solution would be to have it generate a simple squarewave and use that. But we’re not going to go down that road, we’re going to complicate things a bit.
We’re going with a 555 oscillator circuit that generates a nice 4k sawtooth waveform. We will then feed the 555s output into an op-amp wired up as a comparator, and this little fellow will compare the sawtooth signal to a reference voltage that will be programmed by our microcontroller. The resulting output is a clean PWM signal, with a duty cycle that is freely programmable via a microcontroller. Exactly what we want.
In order to have a precise setup, the comparator’s reference input will come from a DAC; using an analog output from the microcontroller would be just too fiddly. Since we won’t need too much resolution, we’re going with an 8-bit DAC, giving us 256 different reference voltages to work with. This is more than enough.
Dew point calculation and sensors
There is a nifty formula that approximates the dew point reasonably well to within 1 °C:
All we need to know are the current ambient temperature T and the relative humidity RH. As luck would have it, there is a nice low-cost digital temperature and humidity sensor that can measure exactly those two metrics and send them to a microcontroller using the I2C protocol: the DHT22. With this little guy hooked up to our microcontroller, we’re ready to calculate the dew point.
Next, we’ll need sensors to measure the temperature at the individual heater straps. For this we’ll use DS18B20 temperature probes. I managed to find them online in a prewired and waterproofed package, so that’s one less thing to worry about. The only caveat with these guys is that they don’t use I2C but communicate via the Dallas OneWire protocol; this means that we’ll have to implement a second communication protocol next to I2C in the firmware. But this won’t be a problem, OneWire is pretty easy to set up.
Sensor-wise, this is it. We’re now able to measure the ambient temperature and relative humidity, calculate the dew point and compare it to the different measurement points next to our heaters. If the microcontroller detects that the temperature at one of these measurement points risks falling below the dew point, it can enable the corresponding heating strap just enough to keep the local temperature above the dew formation point.
We’re almost there!
The PWM subcircuit and the MOSFET switching mechanics are the main brainteasers in this design. The rest of the circuitry is there mainly for support reasons.
Vin is going to be somewhere between 11 V and 13 V, so we need regulators to convert this down to the 5 V and the 3.3 V needed by some of the ICs. For efficiency reasons we are going to use a buck converter to generate the 5 V supply.
The microcontroller needs a bit of supporting circuitry too, and since our design spec calls for a display, it would be a good idea to provide for that, also.
I should probably note that I also put protective flyback diodes across the switching transistors in order to cope with the inductance of the heaters. I’m not really sure they are necessary but they won’t hurt, either.
The final design will also integrate a USB hub with one up- and three downstream ports, the fourth downstream port will be connected to a FTDI USB-to-UART chip to allow remote operation and monitoring of our appliance via a desktop computer. The other 3 ports are there for convenience and to keep the cabling mess at the telescope to a minimum.
Here are the schematics of the (so far) finished appliance. As for all of my EDA stuff I used KiCad for the design. You can download a PDF version of the complete schematics here.
Before going all-out on SMD parts I wanted to build a prototype of what we just discussed. Since I don’t have all the components in SMD form on stock, I went for a through-hole design. As you can see, the resulting PCB doesn’t look half bad.
A few words on the firmware. The basic control loop is not very complicated: read ambient sensor, calculate dew point, compare it with data from the temperature probes at the heaters, decide if a heater needs to be turned on and at what level, rinse, repeat.
The only thing that made me work a bit was to find a way to handle the thermal mass of the telescope itself. Imagine that the microcontroller determines that it is time to fire up a heater. It will take the scope a bit of time to warm up, and during that delay the microcontroller sees that it is still too cold; so it ramps the heater up even further. Until the scope has reached its desired temperature the heater is now way too hot, wasting energy and pumping too much heat into the optical instrument. The controller then shuts off the heater, and the scope cools too much. This kind of oscillation is not good since it wastes energy and might introduce thermal stress in the optical assembly.
The solution here is to work with offsets: I made the firmware start the heater a bit early, so that there is now an offset between the calculated dew point and the point at which the heater starts. Also, the ramp-up and ramp-down functions are now working asymmetrically, so that the controller applies much more heat in the beginning of the heating phase and tapers off once a certain threshold is reached.
After populating the board and flashing the microcontroller, it was time to turn the prototype on for the first time. Surprisingly enough it worked just fine, right out of the box.
At this time, the prototype firmware is simulating a dew point that lies below the temperature of the attached heater sensor. The microcontroller correctly determined that it must turn on the corresponding heating element.
The switching action is nice and clean, rising and falling edges are well defined, there is no overshoot, and very little ringing.
Looks like this thing works just fine!
The next steps will be to redesign the PCB for SMD parts, I expect this to go reasonably well. This will be the first project that I will solder using my yet to build reflow oven, so I suppose that the next installment of this series will be published after that little project has been finished.
Until then – clear skies!
This is part one of a series of articles on the design and construction of an electronic dew controller. To see all the articles at a glance, click on the “Dew Controller” tag in the tag cloud.