Weather Animation

Rain Cloud translates weather data into LED animations. Here's how the system works.

How weather becomes light

Every 15 minutes, the device fetches weather data from Open-Meteo. The raw data goes through two stages:

  1. Data mapping — raw API data is converted into two intermediate values: rainAmount and rainCountdown
  2. State selection — these values (plus configurable thresholds) determine which animation state is active

The two key values

rainAmount uint8 (0–255)

How much rain. Represents the intensity of precipitation right now, or the likelihood of rain if it's not currently raining.

ValueMeaning
0No rain, low probability
1–50Light rain or moderate probability
50–128Moderate rain
128–192Heavy rain
192–255Very heavy / storm (≥50 mm/h maps to 255)

When it's not currently raining but rain is expected, the amount is derived from the highest probability (2h or 12h). This gives the display a gentle "hint" of upcoming rain.

rainCountdown uint8 (0–255)

How soon rain is coming. A rough estimate of hours until precipitation, based on probability thresholds.

ValueMeaning
0Raining right now (current precipitation > 0)
2Rain likely within 2 hours (2h probability > 50%)
8Rain likely within 12 hours (12h probability > 50%)
255No rain expected

Animation states

The device has three rain animation states, evaluated in priority order. Each state has its own pulse/decay timing that controls how the three raindrop LED groups light up and fade.

Rain Soon

Highest priority — checked first

Active, fast animation with all 3 drops pulsing frequently.

Pulse: 200ms Decay: 1000ms Max drops: 3

Default trigger: current precipitation ≥ 0.1 mm/h or 2-hour probability ≥ 80%

Rain Later

Medium priority

Moderate animation with up to 2 drops active.

Pulse: 500ms Decay: 1200ms Max drops: 2

Default trigger: 2-hour probability ≥ 40% or 12-hour probability ≥ 60%

Rain Today

Lowest priority — checked last

Gentle, slow animation with a single drop pulsing occasionally.

Pulse: 1900ms Decay: 600ms Max drops: 1

Default trigger: 12-hour probability ≥ 30%

If no thresholds match, the device shows a gentle ambient wave animation (clear sky).

Pulse and decay

Each raindrop group (left, middle, right — 7 LEDs each) follows a simple cycle:

  1. A pulse timer fires every pulseInterval ms
  2. A random drop is chosen — if it's already active or the max active limit is reached, nothing happens
  3. The drop lights up at full brightness
  4. It decays linearly from full to off over decayDuration ms

Faster pulse intervals and longer decays create more overlap, making the display appear more active. Slower pulses with short decays create sparse, gentle flickers.

Storm mode

When a thunderstorm is detected (WMO weather codes 95–99), storm mode adds a sharp flash before the normal decay:

  1. Drop flashes ON at full brightness for flashOn ms (default: 80ms)
  2. Drop goes dark for flashOff ms (default: 60ms)
  3. Normal decay begins from full brightness

This creates a lightning-like strobe effect layered on top of the rain animation.

Configuring thresholds

Each rain state has three trigger conditions. If any condition is met (they're OR'd together), that state activates. Set a value to 0 to disable that condition.

ThresholdDescriptionUnit
Min PrecipitationCurrent rainfall rate to trigger this statemm/h × 10 (so 1 = 0.1 mm/h)
Min 2h Probability2-hour rain probability to trigger this state0–100%
Min 12h Probability12-hour rain probability to trigger this state0–100%

All animation timing and threshold settings can be changed on the device's local web interface (System tab). Use the animation playground to experiment with timing values before applying them to your device.

Testing

Use the Force Mode control on the device's System tab (or the serial console: weather force soon) to override the weather state and see each animation immediately. Set back to none to return to live weather data.

raincloud.eu