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

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.

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.

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.

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:

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.

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.

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

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.

Night 2: the fail

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

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 4: frozen, and nailed it

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

Night 5: drizzle, and water inside

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.

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.