RG-15 Rain Sensor¶
The Hydreon RG-15 is an optical rain sensor used in SQMeter to flag sky quality readings taken during active rainfall. Rain causes light scattering that makes SQM values unreliable, so the RG-15 lets the firmware mark affected readings accordingly. It is an optional peripheral.
Specifications¶
| Spec | Value |
|---|---|
| Supply voltage | 5 V or 12 V |
| Interface | UART (serial) |
| Default baud rate | 9600 |
| Output | ASCII polled or event-driven |
| Rain rate range | 0–999 mm/hr |
| Operating temp | −40 °C to +60 °C |
Wiring¶
The connector on the RG-15 PCB is labelled J2. Pin 1 is closest to the housing edge marked with a triangle.
| J2 Pin | Label | Connect to |
|---|---|---|
| 1 | GND | ESP32 GND |
| 2 | V+ | 5 V supply |
| 3 | OUT (open-collector) | Not required — leave unconnected |
| 4 | Serial OUT (TX from sensor) | ESP32 RX GPIO (default: GPIO 18) |
| 5 | Serial IN (RX into sensor) | ESP32 TX GPIO (default: GPIO 19) |
Pin direction
J2 pin 4 is the sensor's TX line — connect it to the ESP32 RX pin. J2 pin 5 is the sensor's RX line — connect it to the ESP32 TX pin.
Voltage levels
The RG-15 serial lines operate at 5 V. Most ESP32 GPIO inputs are 5 V-tolerant, but verify your specific board before connecting without a level shifter.
Serial protocol¶
The firmware communicates with the RG-15 over UART at 9600 baud, 8N1 by default.
Poll command¶
In polling mode the firmware sends R\n to request a reading. The sensor responds with one ASCII line:
| Field | Description |
|---|---|
Acc |
Accumulation since the last poll (mm or in) |
EventAcc |
Accumulation since the start of the current rain event |
TotalAcc |
Cumulative total since the sensor last powered on |
RInt |
Current rain intensity (mm/h or in/h) |
Optional flag characters may appear after the unit suffix:
| Character | Meaning |
|---|---|
i |
Hardware / lens fault |
o |
Emitter saturation |
Configuration commands¶
The firmware sends these commands on startup to apply the configured mode:
| Command | Effect |
|---|---|
M |
Set metric output (mm) |
I |
Set imperial output (inches) |
H |
Set high resolution (0.01 mm / 0.001 in) |
L |
Set low resolution (0.2 mm / 0.01 in) |
DIP switches vs serial configuration¶
The RG-15 has DIP switches on the PCB that set defaults for units and resolution. On every power cycle the sensor reads the DIP switches and resets to those defaults.
SQMeter re-applies the configured units and resolution over serial each time the firmware starts or the sensor is reconfigured. This ensures the sensor operates in the mode you specified regardless of the DIP switch positions.
If you set units or resolution to "switch", the firmware does not send the corresponding command and the DIP switch setting is used instead.
Configuration¶
Add or update the rain block in the device settings page, or via POST /api/config:
"rain": {
"enabled": true,
"rxPin": 18,
"txPin": 19,
"baudRate": 9600,
"mode": "polling",
"resolution": "high",
"units": "metric"
}
| Field | Type | Default | Description |
|---|---|---|---|
enabled |
boolean | false |
Enable the RG-15 sensor |
rxPin |
integer | 18 |
ESP32 GPIO connected to sensor Serial OUT |
txPin |
integer | 19 |
ESP32 GPIO connected to sensor Serial IN |
baudRate |
integer | 9600 |
Serial baud rate (2400, 4800, 9600, 19200) |
mode |
string | "polling" |
"polling" or "continuous" |
resolution |
string | "high" |
"high", "low", or "switch" |
units |
string | "metric" |
"metric", "imperial", or "switch" |
Mode¶
- polling — firmware sends
Reach poll cycle and reads the response. Most predictable. - continuous — firmware drains the serial buffer and parses whatever the sensor sends automatically. Use when DIP switch 3 is UP (auto-send mode).
REST API¶
GET /api/sensors includes a rainSensor object when the RG-15 is enabled and initialised:
{
"rainSensor": {
"isRaining": false,
"acc": 0.000,
"eventAcc": 0.000,
"totalAcc": 12.340,
"rInt": 0.000,
"lensBad": false,
"emSat": false,
"status": 0
}
}
| Field | Description |
|---|---|
isRaining |
true if rain intensity is above zero |
acc |
Accumulation since last poll |
eventAcc |
Current rain event accumulation |
totalAcc |
Lifetime accumulation |
rInt |
Rain intensity in configured units per hour |
lensBad |
true if the sensor reported a hardware / lens fault |
emSat |
true if the sensor reported emitter saturation |
status |
0 = OK, 1 = not initialised, 2 = read error, 3 = timeout |
GET /api/status includes an rg15 entry under sensors:
MQTT¶
When MQTT is enabled, the rain sensor reading is included in the published payload under the rain key:
{
"rain": {
"isRaining": false,
"acc": 0.000,
"eventAcc": 0.000,
"totalAcc": 12.340,
"rInt": 0.000
}
}
The MQTT topic is configured by mqtt.topic (default: sqm/data).
Sensor placement¶
- Mount outdoors with an unobstructed view of the sky.
- Keep away from roof overhang drip zones — drips from overhangs trigger false positives.
- Mount on a level surface so water drains correctly.
- Avoid locations where debris or bird activity is likely.
Freezing climates
Hydreon offers the RG-15H heated variant for installations where icing is a concern. It is a drop-in replacement — the interface and wiring are identical.
Troubleshooting¶
| Symptom | Likely cause | Fix |
|---|---|---|
status: 2 (read error) |
Wiring fault or wrong pins | Verify J2 pin 4 → ESP32 RX, J2 pin 5 → ESP32 TX |
status: 3 (timeout) |
Sensor not sending data | Check power, baud rate, and mode setting |
| Values always zero | Sensor in DIP switch units that differ from config | Set resolution/units to match, or use "switch" mode |
lensBad: true |
Lens fouled or hardware fault | Clean the lens; replace sensor if fault persists |
emSat: true |
Very intense light source near sensor | Check for direct sunlight hitting the emitter |