Rain Alarm for Astrophotography proto 4 - Heated Rain Sensor

You’re reading part 4 of the Rain Alarm for Astrophotography series; part 1 is available here, part 2 here and part 3 here.

Yes, it’s been almost three years since part 3. RAfA took a long break, and I picked it back up this autumn, starting with a problem the first three prototypes never had to face: dew.

It’s not rain, it’s dew

On a clear night, everything facing the sky radiates its heat into space and cools a few degrees below the air. Below the dew point, water condenses on it: that’s dew, and on imaging nights dew is the norm. In winter, all my gear comes back wet in the morning, the ASIAIR included.

Our rain sensor can’t tell a raindrop from a dewdrop. An unheated plate on a dewy night is a rain alarm at 1 a.m. for nothing, and after a few of those, you stop using RAfA.

The black box on a wooden garden table among frosted leaves: the blue rain plate on its roof is dry inside a dark frost-free halo, white frost covers the rest of the roof, the power LED glows red
Spoiler, from night 4: Elsa came by overnight. Everything froze, except the heated plate.

The fix is simple: keep the plate a little warmer than the air, so dew never forms on it, and let the rain do the rest. Dew can only be tested for real outside, so this prototype is a complete outdoor rain sensor, box included.

A temperature axis against the air on a clear night: the dew point band 1 to 2 °C below the air, the unheated plate 5 °C below it on the side where dew forms, and the heated plate, with 0.5 W under it, between 2 °C above the air in wind and 6 °C above on a calm night
Straight from theory and heat modelling, where everything works first time. The garden gets its say further down.

Why not just buy one? I did: a cheap solar Zigbee rain detector, on the garden fence, in Home Assistant. It isn’t made for astronomy and never claimed to be, but as we’ll see, it reads dew as rain, night after night. That’s why RAfA is still worth building.

A round commercial rain detector on a black bracket, screwed to a weathered white fence, its dark face covered in frozen beads and drips, frost along its gold comb ring
The commercial detector, iced after night 4. It said “rain” all night without a drop, but it’s cute.

What heater?

I had already played with heaters back in 2023, with a few notes scribbled on paper (never again):

  • Silicone pad and film heater: tried both. They come in fixed sizes, and the power is whatever the pad makes: no way to control it.
  • PTC heater: tried too. It regulates itself, so the part chooses the power, not you: one drew 1.25A at 5V and climbed to 113°C. Perfect for boiling the rain, less so for detecting it.
  • Resistance wire, or a heater trace on a custom PCB: fiddly, or costly, with a shape frozen once made.
  • Ceramic power resistor: the winner. It’s the only one whose power I control, set by its value, and it’s compact. Ohm’s law: P = U² / R = 5² / 51 ≈ 0.49W, chosen on paper.
Heaters on a wooden table: a large clear film with a silver zigzag heating track, an orange silicone heater pad lying on it, two small aluminium PTC elements, one with a hand-written 110 label, and a white ceramic resistor with colour bands
A film heater, a silicone pad, two PTC elements (a 110 and a 200), and the ceramic resistor that won.

How much heat?

A dew strap burns around 15W, but it warms a whole telescope lens. Here, what matters is where the heat goes: straight into the plate. A resistor alone only warms the plate’s middle, as the copper rings hardly pass heat to each other, so the heat needs a smart way to spread: a thin sheet of aluminium between the resistor and the plate, the whole stack clamped together, no glue.

An exploded drawing of the heater stack: four screws above a green rain plate with copper rings, then an aluminium disc, a 51 ohm resistor and a 3D-printed clamp plate with a groove

As built, the spreader is a piece of kitchen foil. Ideally, your rain sensor PCB is single-sided. Mine has copper rings on its back too, so I had to hack an insulating layer in. Pressed this close, half a watt is enough, and low enough that drizzle still wets the plate.

So: one 51Ω resistor (rated 5W), always on. No MOSFET to switch it on and off, no temperature sensor, no regulation. For once, the complete heater driver source code fits in one line:

// The heater (51 ohm on 5 V) is always on and has no firmware part, by design.

It all draws about 0.75W from USB: four nights on a 10,000mAh power bank.

Reading the plate

In part 1, I suspected the comparator module was useless, and that one resistor plus a threshold in software would do, maybe with a capacitor. Three years later, done:

A wiring diagram: the rain plate wired to D25 of an ESP32 dev board, a 1 megohm pull-up from 3V3 and a 100 nF capacitor to ground on that line; a wet LED on D27 and a power LED on D13, each through 1 kilohm; a USB-C socket feeding 5 V to VIN and to a 51 ohm 5 W heater

The ESP32 now reads the plate directly, as a number from 0 to 4095, instead of the comparator’s wet-or-dry signal. Dry, it sits at the top, 4095. Water bridging the comb lowers its resistance and pulls the number down (part 1 explains the comb). Tap water, filtered water, rain from a bucket, even saliva: every drop on the bench read no higher than 1330. So the threshold sits at 2500, about halfway.

A vertical scale from 0 to 4095 with the wet threshold at 2500: a dry plate at 4080 to 4095, night 2's thin film at 2240 to 2500, condensation indoors at 290 to 1000, drops on the bench at 425 to 1330, and real rain at 240 to 624
Every case measured on proto 4, on one scale. The two real rains come later in this post.

The rain rule stays simple: the alarm goes off after 10 seconds of wet in a row. No radio this time: proto 4 is the sensor alone, and everything goes to a log in its flash, about two weeks of room, surviving power cuts.

Designing the box

The box isn’t a finished product, just enough to survive the garden: 3D-printed in PETG (PLA softens in the summer sun), with the plate on its sloped top so the rain runs off.

The proto 4 box pulled apart, bottom to top: the black body with the ESP32 on its perfboard hanging inside on taut wires, the light clamp plate, the 51 ohm resistor with its colour bands, the round aluminium spreader, the black lid with its square pocket, and the green rain plate with copper rings on top

As built

Proto 4, finished, and here we go with the drop test:

Five nights in the garden

Time to take it outside, under the open sky, on nights forecast dry, or nearly ¯\_(ツ)_/¯. RAfA reads the plate ten times a second, keeps the worst of the ten and logs one byte a second; afterwards, I sync that log with my home sensors and the weather data, and chart each night next to the commercial detector from the fence.

Night 1: it works

Night 1 from 17:00 to 10:00: the air falls from 9 to 2 °C with its dew point 1 to 2 °C below it; RAfA's plate dry every second while outside; the commercial detector saying rain from 01:33 to the morning

Dry every second for 15 hours, with dew everywhere else, the detector included. But the first design put the plate in the middle of the roof, not a smart idea: its halo of heat stops short of the top edge, and I suspect the dew up there will slide down onto the comb.

The box's black roof seen from above, covered in dew beads, except a darker dry halo around the blue rain plate, which is dry

Night 2: the fail

Night 2 from 17:00 to 10:00: the air staying 1 to 2 °C above a rising dew point; RAfA's plate dry except two short wet moments around 02:00 and 06:00; the commercial detector saying rain from 21:24 to the morning

Twice the plate read wet with no rain: at 02:00 a thin film, the air close to its dew point under a clear sky, and at 05:49, suspicion confirmed, a bead of dew from the roof above ran down onto the comb. So the reprinted roof moves the plate to the very top, which is the final design I kept for this prototype.

Night 3: rain nobody expected

Night 3 from 17:00 to 10:00: the day-before forecast shows no rain until 06:00 in all seven weather models, then a little from 06:00 to 08:00; rain falls from 04:50; RAfA's plate dry until then and wet from the first drops; the commercial detector saying rain from 00:26, hours before the rain

Seven weather models had a dry night, and at 04:50 it rained: RAfA read wet 70 seconds after the first drop hit its plate, while the detector had been saying “rain” on its own dew since 00:26.

Night 3 from 04:50 to 04:54, the plate's reading second by second: 4080 until a one-second dip at 04:50:21, the first drop, then falling through 3000 and under the 2500 wet threshold at 04:51:31, 70 seconds later, and on down to about 1050

Night 4: frozen, and nailed it

Night 4 from 17:00 to 10:00, the box out from 22:27: the air falling below 0 °C with its dew point lower still; RAfA's plate dry every second; the commercial detector saying rain all night

The air dropped below zero and frost covered everything but the heated plate. Kept dry every second for 10.6 hours.

The black box on a wooden garden table among frosted leaves: the blue rain plate on its roof is dry inside a dark frost-free halo, white frost covers the rest of the roof, the power LED glows red

Night 5: drizzle, and water inside

Night 5 from 17:00 to 10:00: the air and its dew point close in the evening; a drizzle from 03:39; RAfA's plate dry until the drizzle, then wet; the commercial detector saying rain from 21:54, on its own dew, then again in the drizzle

Dry through the evening dew, then a drizzle: the plate read wet 10 seconds after the first drop, and water came inside, through the plate’s two unsoldered holes. The detector said “rain” on its own dew from 21:54, until clouds rolled in after midnight and dried it off at 03:31, just in time for the real drizzle.

Night 5 from 03:40 to 03:44, the plate's reading second by second: 4080 until the first drop at 03:40:41, under the 2500 wet threshold at 03:40:51, 10 seconds later, back above it for about 40 seconds, then down to about 1400

So, does it work?

Yes. The design idea is proven: half a watt keeps the plate dry through dew and frost, and it still catches real rain in about a minute. Four clean nights out of five, two real rains caught, and the unheated commercial detector fooled every night. Two lessons: where the heat goes matters (mid-roof, dew from above reached the comb), and part 1 was right, no comparator needed.

The coldest night so far barely went below zero, and night 2’s film says half a watt is only just enough, so a clear −15°C night will be the real test, maybe with a bit more power. On paper, it’s the clear sky that steals the heat, not the cold. I’ll believe it when I see it.

Water still found its way in, though: one more thing to solve on the way to a real product.

Next step

With no radio, proto 4’s rain alarms were a line in a log and an LED nobody saw, but this is getting more and more serious. Proto 5 may be the last piece of R&D: bringing the radio and the base station back, for the full user experience. After that, we’re heading toward a commercial product, straight out of the garage.

Source code

Not sharing it this time, and honestly, it isn’t the interesting part anymore, in the age of AI.