# Rain Sensor?

**URL:** <https://forums.pimoroni.com/t/rain-sensor/13725>\
**Category:** Support\
**Created:** [April 30, 2020, 7:22pm UTC](https://forums.pimoroni.com/t/rain-sensor/13725 "2020-04-30T19:22:23Z")\
**Posts on this page:** 9\
**Page:** 1

<div class="post-metadata">

**Author:** ![peterb](https://avatars.discourse-cdn.com/v4/letter/p/e8c25b/32.png) [@peterb](https://forums.pimoroni.com/u/peterb)\
**Post date:** [April 30, 2020, 7:22pm UTC](https://forums.pimoroni.com/t/rain-sensor/13725/1 "2020-04-30T19:22:23Z")

</div>

Does anyone know of a solution for getting the rainfall quantity into a PI?

I have an old commercial (cheap) weather station which displays wind, rain, inside and outside temp, However the rain data stopped displaying so I took the gauge apart. It is a seesaw of two small cups, the count of ‘oscillations’ against time provides the measurement.  
If there isn’t a ‘new’ solution available I might try and convert my old bought gauge.

---

<div class="post-metadata">

**Author:** ![alphanumeric](https://sea2.discourse-cdn.com/flex016/user_avatar/forums.pimoroni.com/alphanumeric/32/2729_2.png) [@alphanumeric](https://forums.pimoroni.com/u/alphanumeric)\
**Post date:** [April 30, 2020, 8:26pm UTC](https://forums.pimoroni.com/t/rain-sensor/13725/2 "2020-04-30T20:26:35Z")

</div>

I do believe they call that a tipping bucket rain gauge  
[https://www.weathershack.com/static/ed-tipping-bucket-rain-gauge.html](https://www.weathershack.com/static/ed-tipping-bucket-rain-gauge.html)  
Maybe this will help.  
[https://pi.gate.ac.uk/posts/2014/01/25/raingauge/](https://pi.gate.ac.uk/posts/2014/01/25/raingauge/)

---

<div class="post-metadata">

**Author:** ![peterb](https://avatars.discourse-cdn.com/v4/letter/p/e8c25b/32.png) [@peterb](https://forums.pimoroni.com/u/peterb)\
**Post date:** [May 1, 2020, 9:06am UTC](https://forums.pimoroni.com/t/rain-sensor/13725/3 "2020-05-01T09:06:06Z")

</div>

Thanks for the links, that is what it is, a tipping bucket.  
RIP Maplin!  
The one I have is a magnet and reed switch but I think it is the RF section that has failed.  
If I am to get it working with a PI I will need to send the pulses by WiFi, either as they happen or the count for the last minute or five. All working off a couple of AA cells.  
This could keep me busy!

---

<div class="post-metadata">

**Author:** ![alphanumeric](https://sea2.discourse-cdn.com/flex016/user_avatar/forums.pimoroni.com/alphanumeric/32/2729_2.png) [@alphanumeric](https://forums.pimoroni.com/u/alphanumeric)\
**Post date:** [May 1, 2020, 9:58am UTC](https://forums.pimoroni.com/t/rain-sensor/13725/4 "2020-05-01T09:58:16Z")

</div>

An Arduino or Feather may be a better choice for this. They will use less power and be power failure tolerate. Feathers have a LIPO battery connector and charge circuit built in.  
Anything like a Pi won’t work very well off of 3 AA’s. You’ll get constant undervolt warnings. And using 4 AA’s will fry it.

---

<div class="post-metadata">

**Author:** ![peterb](https://avatars.discourse-cdn.com/v4/letter/p/e8c25b/32.png) [@peterb](https://forums.pimoroni.com/u/peterb)\
**Post date:** [May 1, 2020, 11:18am UTC](https://forums.pimoroni.com/t/rain-sensor/13725/5 "2020-05-01T11:18:22Z")

</div>

Alternatively I could use the old fashioned system, cable.  
Cable from the gauge to a little electronics to interface with the PI and count pulses against time, correct for collection area.

---

<div class="post-metadata">

**Author:** ![alphanumeric](https://sea2.discourse-cdn.com/flex016/user_avatar/forums.pimoroni.com/alphanumeric/32/2729_2.png) [@alphanumeric](https://forums.pimoroni.com/u/alphanumeric)\
**Post date:** [May 1, 2020, 11:24am UTC](https://forums.pimoroni.com/t/rain-sensor/13725/6 "2020-05-01T11:24:35Z")

</div>

Something like the Automation Hat or pHat may be the way to interface to the Pi.

> **[Automation HAT – Pimoroni Store](https://shop.pimoroni.com/products/automation-hat)**
>
> Take control of and monitor your world with our ultimate jack-of-all-trades Raspberry Pi HAT!

  

> **[Automation HAT Mini – Pimoroni Store](https://shop.pimoroni.com/products/automation-hat-mini)**
>
> Automate your world with Automation HAT Mini! Monitor and control up to 24V systems and see their status on the gorgeous full-colour display.

---

<div class="post-metadata">

**Author:** ![peterb](https://avatars.discourse-cdn.com/v4/letter/p/e8c25b/32.png) [@peterb](https://forums.pimoroni.com/u/peterb)\
**Post date:** [May 1, 2020, 11:50am UTC](https://forums.pimoroni.com/t/rain-sensor/13725/7 "2020-05-01T11:50:17Z")

</div>

Thanks, yes they would do it, I’ll start designing!

---

<div class="post-metadata">

**Author:** ![peterb](https://avatars.discourse-cdn.com/v4/letter/p/e8c25b/32.png) [@peterb](https://forums.pimoroni.com/u/peterb)\
**Post date:** [June 14, 2020, 6:25pm UTC](https://forums.pimoroni.com/t/rain-sensor/13725/8 "2020-06-14T18:25:39Z")

</div>

OK now ready to add the Rain Sensor to my setup. Currently I have this output from my tweaked version of `nopheads` code,

 ![MyEnviro](https://us1.discourse-cdn.com/flex016/uploads/pimoroni/original/2X/c/cebd807911fb97f175a8161536835ce9da90dc40.jpeg)  
I have also managed to get the data to Grafana via InfluxDB, makes very pretty visuals and I am still learning how to set it up. This is an example of the Particle data graphed.  
 ![Particles](https://us1.discourse-cdn.com/flex016/uploads/pimoroni/original/2X/b/bb15d3e957d75f9767fb9e5ecc4698adf11ce8c6.jpeg)  
For connecting my tipping bucket rain sensor I found this useful link: [https://projects.raspberrypi.org/en/projects/build-your-own-weather-station/8](https://projects.raspberrypi.org/en/projects/build-your-own-weather-station/8)  
The python code it suggests is:

> from gpiozero import button  
> rain\_sensor = Button(26)  
> bucket\_vol = 10.0 #10ml  
> bucket\_size = 0.12732395 #mm of rainfall  
> count = 0
> 
> def bucket\_tipped():  
> global count  
> count = count + 1  
> print (count \* bucket\_size)
> 
> def reset\_rainfall():  
> global count  
> count = 0
> 
> rain\_sensor.when\_pressed = bucket\_tipped

Which seems to be a good starting point.  
Has any on else gone down this route and have some advice/tips?  
Thanks

---

<div class="post-metadata">

**Author:** ![peterb](https://avatars.discourse-cdn.com/v4/letter/p/e8c25b/32.png) [@peterb](https://forums.pimoroni.com/u/peterb)\
**Post date:** [June 16, 2020, 8:21pm UTC](https://forums.pimoroni.com/t/rain-sensor/13725/9 "2020-06-16T20:21:15Z")

</div>

The above seems to work if the `import button` is changed to `import Button`.  
I will see how well tonight with the forecasted rain!
