Introduction: Audio Sensor to Measure Rain Intensity
For an assignment for the TU Delft we (Irene and Philippine) have made an audio sensor that measures rain intensity. This is also known as a disdrometer.
Step 1: Materials
We have used the following materials for this device:
- A photon
- A breadboard
- SparkFun sound detector
- 3 header pins
- 3 female wires
- A petri dish
- Material to elevate the device (in our case a plastic lid)
- A plastic cup
- Duct tape
- Wires (to extend the female wires)
And the following tools:
- Soldering gear
Step 2: Placement of the Wires
First, solder the three header pins onto the GND, VCC and Envelope circles of the SparkleFun sound detector. Make sure to attach them to back side of the sound detector (the side that is completely flat), this is better for the placement of the sound detector in the petri dish.
If you want the wires to be longer, like we wanted (to prevent water coming near the photon), cut the female wires somewhere. Attach an extra wire to the now open ends of the female by soldering the two parts together. Cover the attachments with duct tape.
Then you need to connect wires to the sound detector and the photon. Connect a wire from the GND on the sound detector to the GND on the photon (red wire in the picture), another wire from VCC on the sound detector to 3V3 on the photon (green wire) and the last wire from ENVELOPE on the sound detector to A0 on the photon (blue wire).
Step 3: Assemble the Device
Using duct tape, attach the sound detector to the upper part of the petri dish with the front facing upward. Hold the upperpart of the petri dish at an angle and fill the inside with cotton pads. Duct tape the upper and lower part of the petri dish together and place it on top of something to elevate it (in our case a plastic lid).
We have simulated rain by making a hole in the bottom of a plastic cup: if you fill the cup with water, the water will leave the cup in the form of rain drops.
Step 4: Write a Code
We have written the code that is shown in the image.
We have set the threshold for our code on 850, to distinguish a raindrop from background noise. An amplitude higher than 850 indicates a raindrop and make the count go up by one. The device measures the sound per one tenth of a second and counts the number of raindrops per minute. This number is then printed in a google spreadsheet. If you want to know which value for a threshold will be the best in your situation, leave out the slashes in the 17th and 18th line and test what amplitude you get when you let it rain on your device.
Step 5: Calculate the Depth of the Rainfall
With this code, you measure the number of raindrops per minute. If you want to know the depth per minute, you should first measure the radius of your petri dish with a ruler. The area of the surface of the petri dish is A = π * r^2.
Then you should measure the volume of a rain drop. We did that by filling our plastic cup by an amount of water, and counting the number of raindrops that fell out of it. Dividing the amount of water by the number of raindrops, you have the volume of one raindrop.
If you divide the volume of one raindrop by the area of the petri dish, the outcome will be the depth of the rain per raindrop. If you multiply the number of raindrops per minute by the depth per raindrop, you have calculated the depth of the water that has fallen on your device in one minute.