Introduction: Acoustic DISDRO Meter: Raspebbery Pi Open Weather Station (Part 2)
DISDRO stands for distribution of drops. The device records the size of each drop with a time stamp. The data is useful for a variety of applications, including meteorological (weather) research and farming. If the disdro is very accurate, it can measure total rainfall, like a rain gauge. It can also just be used as a simple rain detector.
A DISDRO is also usefull in calculating the rate of rain, like other computerized rain gauges (Ultrasonic Rain Gauge and tipping brackets)
I decided to build this DISDRO, because my Ultrasonic Rain Gauge is at this stage not very accurate for the first one or two mm rain because its base is not perfectly leveled and also because it can be fun.
Step 1: What You Will Need
1) Raspberry pi, as fast as possible, I used a raspberry pi 3
2) Bread board
3) Lots of jumper cables (20 will do) and a few meters of the thin electrical cable from your PI to the DISDRO
4) The MCP3008 ADC (Analog to digital converter, other ADCs may do).
5) A Piezo Electical Eliment
6) An old CD
7) Carpenters Knife
9) PLASTIK 70 (Optinal)
10) Python skills (I will provide example scripts)
Step 2: Build Your Hardware
Remove the foil from the acrylic layer of the CD. Attach the piezo to the back of the CD. The front of the CD will be used to listen to the rain. The blue cable (Signal) must be connected to channel 0 of the MCP3008, the red and black must be connected to 3.3 volt and ground respectively.
You can use conformal coating (Plastik 70) to waterproof the front of the CD and piezo. Do not spray it on the back of the cd and piezo where the wires and ceramic is attach. If the ceramic is sprayed the piezo will not vibrate properly.
Step 3: Build Your Circuit for the PI, MCP3008 and Piezo Connection
There are lots of tutors on connecting the MCP3008 and Raspberry PI. I used the Adafruit tutorial initially:
To use hardware SPI first make sure you've enabled SPI using the raspi-config tool (or go to your desktop, Applications (Start) Menue, Preferences, Raspberry Pi Configuration, Interfaces). Be sure to answer yes to both enabling the SPI interface and loading the SPI kernel module, then reboot the Pi. Now wire the MCP3008 to the Raspberry Pi as follows:
MCP3008 VDD to Raspberry Pi 3.3V
MCP3008 VREF to Raspberry Pi 3.3V
MCP3008 AGND to Raspberry Pi GND
MCP3008 DGND to Raspberry Pi GND
MCP3008 CLK to Raspberry Pi SCLK
MCP3008 DOUT to Raspberry Pi MISO
MCP3008 DIN to Raspberry Pi MOSI
MCP3008 CS/SHDN to Raspberry Pi CE0
This circuit can now be used for many analog sensors taking a 3.3 volt input, including our Piezo Electical Eliment.
Connect the Piezo Eliment Red cable (Volts in) to the PI 3.3 volts, ground to ground and the Piezo Output (Blue) to CH0 (Channel zero) of the MCP3008.
If you only have a piezo electrical element with a red and black cable (without the board), connect the red cable to channel 0 of the MCP 3008 and the black to GND. Also connect a 1 Meg Ohms resistor between MCP3008 channel 0 and ground (The Piezo and the Resistor are connected parallel). The resister will protect the MCP 3008 from current and voltage peaks created by the piezo.
I also tested the piezo with a bitscope micro in the attach video. This is however not necessary.
Step 4: The Software
I wrote a simple script using the GPIOZERO library for MCP3008. It is attached.
Make sure that SPI is enabled (Applications (Start) Menue, Preferences, Raspberry Pi Configuration, Interfaces or sudo raspi-config)
Run the script, drop some drops and see what the results is. you may have to alter the threshold in the Python Code.