Rain Sensor Circuit Margins

Rain Sensor Circuit Margins

Ada re-derives this chapter’s own numbers step by step, at full precision

foundations
math-foundations
calculation-audit
sensors
Ada ADA · CALCULATION AUDIT

Rain Sensor Circuit Margins

Check the circuit as a chain: divider range first, then filter attenuation, then transistor drive. Each number below comes from the rain-sensor design values already stated in the chapter.

A rain-sensor circuit uses a 47 kOhm pull-up against a sensor resistance that swings from 1 MOhm dry to 10 kOhm in heavy rain, an RC filter built from 10 kOhm and 1 uF to knock down 20 kHz motor noise, and a 1 kOhm base resistor driving a 500 mA relay coil from a GPIO limited to 12 mA — the whole design costing EUR 0.48 in parts. This audit asks the question those three margins invite: do the divider range, the filter attenuation, and the transistor drive current all actually clear their limits at once, or does one of them run out of headroom?

Companion to the chapter Sensor Circuit Fundamentals — every number here comes from that chapter.

See the relationship before changing it

The figure reads from left to right. The blue card is rain-sensor resistance. The middle card applies this page's rule. The green card is divider voltage. Walk the arrows once: set the input, apply the rule, then read the result with its unit.

The retained audit below checks several chapter fixtures. This model keeps those stated values fixed and changes only rain-sensor resistance, so the numeric fixture does not switch without explanation.

Rain-sensor resistance changes divider voltage An input card leads through the rule voltage = 3.3 V x sensor resistance / (47 kOhm + sensor resistance) to the divider voltage result. INPUT PAGE INPUT APPLY THE RULE predict calculate check units OUTPUT RESULT
Walk the arrows. Falling sensor resistance pulls the divider output down through a measurable rain range.

Derive the baseline in four named moves

  1. 1

    Name the input. The chapter baseline is 10 kOhm.

  2. 2

    Name the relationship. voltage = 3.3 V x sensor resistance / (47 kOhm + sensor resistance)

  3. 3

    Substitute with units. 3.3 x 10 / (47 + 10) = 0.5789 V

  4. 4

    Read the result. Keep the unit beside the value. Use it only inside the technical boundary on this page.

Predict, then change rain-sensor resistance

Try Predict the direction of voltage = 3.3 V x sensor resistance / (47 kOhm + sensor resistance). Test another rain-sensor resistance, then compare divider voltage.

10 kOhm
Chapter baseline
Divider voltage

Observe Falling sensor resistance pulls the divider output down through a measurable rain range. Reset rain-sensor resistance to 10 and compare divider voltage.

Explain Falling sensor resistance pulls the divider output down through a measurable rain range.

Check yourself

What should you do before trusting a moved-control result?
Answer: Predict its direction, apply the shown relationship, keep the units, and reset to the worked baseline.
What does this small model leave out?
Answer: Only rain-sensor resistance moves here. Field effects named in the technical boundary stay fixed.
Try

Treat the 47 kOhm, 3.3 V rain divider and its 1 MOhm, 100 kOhm, and 10 kOhm sensor states as the fixed case; predict the ordering before Check audit.

Observe

Vout steps from 3.1519 V dry to 0.5789 V heavy-rain; the 10 kOhm/1 uF filter reduces a 50 mV, 20 kHz spike to about 0.0398 mV.

Explain

The resistive divider maps falling sensor resistance into voltage, while the RC network attenuates motor noise because 20 kHz lies far above its 15.915 Hz cutoff.

Divider arithmetic

With a 47 kOhm pull-up and a 3.3 V rail, the sensor-bottom divider gives Vout = 3.3 * Rsensor / (47000 + Rsensor). Dry at 1 MOhm gives 3.3 * 1000000 / 1047000 = 3.1519 V. Light rain at 100 kOhm gives 3.3 * 100000 / 147000 = 2.2449 V. Heavy rain at 10 kOhm gives 3.3 * 10000 / 57000 = 0.5789 V. The heavy-rain current is 3.3 / 57000 = 0.00005789 A = 0.0579 mA, below the 0.5 mA budget.

Filter arithmetic

For the selected 10 kOhm and 1 uF filter, RC = 10000 * 0.000001 = 0.010 s and fc = 1 / (2 * pi * 0.010) = 15.915 Hz. A 20 kHz motor spike is 20000 / 15.915 = 1256.6 times above cutoff. The first-order magnitude is 1 / sqrt(1 + 1256.6^2) = 0.0007957, which is 20 * log10(0.0007957) = -61.98 dB. A 50 mV spike becomes 50 * 0.0007957 = 0.0398 mV, safely below the 12-bit ADC step 3.3 / 4095 = 0.0008059 V = 0.8059 mV.

Relay-drive arithmetic

The 500 mA relay coil with beta 200 needs 500 / 200 = 2.5 mA of base current. The base resistor drops 3.3 - 0.7 = 2.6 V, so the computed value is 2.6 / 0.0025 = 1040 Ohm. The selected 1 kOhm resistor drives 2.6 / 1000 = 0.0026 A = 2.6 mA, still under the 12 mA GPIO limit while giving enough transistor drive for the 500 mA coil.

Ada’s conclusion: the chosen values pass the three margins at once. The divider stays inside the ADC range, the filter reduces the 20 kHz spike below one ADC count, and the GPIO current remains well below its limit while controlling the relay.

Every number above is taken from the chapter’s own rain-sensor design values and re-derived step by step.

Technical boundaries: The DC divider and first-order RC model exclude wet-surface hysteresis, sensor corrosion, component tolerance, ADC loading, relay-coil transients, transistor saturation spread, and broadband motor interference.

Ready: work the ledger before checking it.