ESP-Now Rainstick

This fun little project will allow you the trivial joy of letting a electronic network announce that you have rain! The AI controlled, tear eliciting price’d Tesla has been rumored to have sensors that awaken the windshield wipers at the onset of rain. Being in a fully glass-enclosed cabin you would think that the obviousness of rain would make such a sensor not quite necessary, but without the roar of exploding gasoline you have to have something to brag about. The built-in capabilities of the easily used ESP-8266 microcontollers is enhanced by the local ESP-Now networking option. You don’t need a connection to the internet and all the liabilities and impracticalities that ensue. And you get to play with Bamboo sticks!

This is not a real rainstick. That is a dried cactus that makes a rain noise with cascading beans–definitely low tech. This device consists of a Master and a Slave combo. The designated Master sits outside, Lipo battery operated, solar empowered and awakened by a Adafruit hardware sleep agent that sips power and turns on a rain sensor about once every ten minutes. If it sniffs rain it sends a ESP-Now message to its only friend–a slave–that sits inside connected to power listening for messages. If it receives one it turns on a cascade of artfully placed Neopixels. The team are made out of locally sourced bamboo which is fun to work with and doesn’t require 16 hours to print.

Step 1: Gather Your Materials

Remember when you were a kid and it was suggested that you could kill someone by strapping them to a mesh over growing sharpened bamboo sticks and waiting! Well we won’t be doing that.

1. Bamboo–get a nice piece as long as you want to string Neopixels inside. ( Mine was about 6 feet) Also a chunk for the sensor housing wide enough to accommodate some electronics. (3 inches wide 8 inches long)

2. Flexible Solar Cells–like these:…

3. TP 4056 Charger board:…

4. Logic level converter:

5. Power Timer Breakout Adafruit:

6. Adafruit Feather HUZZAH with ESP8266:

7. WEMOS D1 Mini–your choice…

8. Neopixel Strip 60 Led/M

9. Lipo Battery

10. Rain Sensor–I bought this one but there are a lot of them out there:…

11. Generic ON/OFF switch

Step 2: Assemble the Electronics

Follow the Fritzing diagram on how the wiring for both devices is done. The slave unit is very simple with a perf board for mounting female headers to accommodate the WEMOS D1 Mini that has a set of male headers installed. This makes mounting and removal for adjustments and programing easy. The logic level shifter is on the other side and is tiny and easy to mount on the board. For best practices using Neopixels it is advisable to connect a resistor to the data output of the level shifter and the Neopixels and a large capacitor between the power lines to it. Make sure you use a adequate power supply and connect it separately from the WEMOS output. You can size this power source by how long your rainstick is going to be…

The Master unit is pretty easy too. I used a Adafruit Huzzah ESP8266 instead of another WEMOS D1 mini as it has its own battery power unit built in. Size whatever Lipo you want–it just has to fit inside the bamboo. The simple charge controller is connected to the solar cell and the battery and supplies power to the Power Timer Breakout and the ESP8266. Power to the rain sensor comes through the 3.3 V power on the microcontroller board. I put a switch between the Enable line from the Power Timer and the board EN pin so I could keep this line high to program it. (It is kept low even when the power to the timer is off so hard to get it working without it…) Two pins on the Huzzah are used–one for the rain sensor which brings it digitally low when water hits and one to tell the Power Timer its ok to shut it down. I did not put a battery tester on this unit but if you want to the instructions are on the Adafruit web page. It utilizes the only A0 pin on the board but you can easily program it to transmit this data to the Slave and have it output it as pixel hight.

Step 3: Build It

The bamboo is fun to work with. The pieces I used were dried and dead for a while. Sand the outside smooth. The slot for the light is easy to cut with a light saber saw. Just use some blue-tape along the whole length and roughly freehand a inch wide crack up the face leaving about 8 inches intact at the ends. The shape can be as wavy as you want to cut it. Drill two blade size holes to start your blade entrance and exit at the ends. The bamboo cuts very easily and you can go right through the nodes that have a full baffle across them. The rest of the tube is hollow. Take a chisel and wack out the inner remains of the nodes which will enable a full hollow tube. Care must be taken that you don’t start a split down the length of the bamboo, but this is easily repaired. Spray paint the inside of the tube with a flat white outdoor acrylic. The outside of the tube is coated with a couple coats of uv resistant polyurethane.

The Master unit is about 10 inch long 3 to 4 inch wide piece that will accommodate the sensor. It is chosen carefully so that it is cut about 2 inches away from a node at the top. This space will hold the sensor and allow a waterproof seal for the electronics below. You should drill a 1/4′ hole at the edge of this node-cap to allow the sensor wires to drop through. Another couple holes around the cap base will allow water collecting in this natural cup to radially leave. I had to trim the sensor plate to fit in the space and solder different connectors on to get a small hole. The sensor wires feed to a sensor comparator board that sits in the waterproof section. Again spray this unit in and out with polyurethane spray for outdoor use.

Step 4: Assemble It

The flexible solar panel is contact cement mounted to the outside of the Master Unit. The wires that connect it through small holes in the tube housing are soldered to the ends of the solar panel. Follow the instructions on how to do this on their website–it very easy. The rain sensor is mounted in the upper cup with dabs of silicon on nylon spacers that tilt the sensor at an angle so the rain doesn’t pool up. A hole is drilled in the side of the unit to accommodate the ON/OFF switch. Everything else is just stuffed inside. You can silicon a small plastic cover over the bottom as long as you leave some air holes. All wire entrances are sealed with dabs of silicon.

The slave unit is fitted with a length of Neopixels to leave a couple inches at the top and bottom. These are easily siliconed into place–make sure you strip off the silicon sleeve if yours came with one–impossible to glue to. Position the Neopixels off to the side so that it is not seen from nearly every angle but directs its light into the while painted cavity. After protecting the power source with a large capacitor the small WEMOS board will easily fit in the bottom of the tube. Although the slave unit can go outside it was not designed to be waterproof.

Step 5: Program It

This guy did a nice job of setting out some examples of sensors and ESP-Now: Andreas Spiess did a nice video with example that I used the code from to start this project. This limited Master/Slave unit does not need the internet at all so I eliminated those sections–it just transfers the information on whether it is raining or not. I decided not to use the heralded deep sleep options for the ESP as I found on a previous project it became randomly unstable after a while and would randomly run down the solar battery. The hardware option just reboots the Adafruit Huzzah once every ten minutes or so, checks the sensor for a low signal signifying rain, if it doesn’t find it sends a high/low signal to the Done pin on the timer. Else the code shifts to sending the information (really no information except the send function itself) to the slave to activate its code. The slave code just boots up the machine and waits for a message and when it gets it sets the neopixel function on for a minute. You can vary this in the software but it just continues to wait for the rain activation again. Read the comments in the software to see where to change values. The great meteor cascade code came from this source: I just added some random constants and a color change.

Step 6: Using It

The small potentiometer on the rain sensor must be adjusted for what level of drip activates the master to send a notice. You have to also adjust the Adafruit timer circuit potentiometer to determine how often your sensor turns on to check for rain–the range is from seconds to two hours–your choice. Charge up the lipo battery on the master unit and turn it on and mount it outside and it should take care of itself for energy needs unless you live in Alaska where it perpetually rains and is dark. The slave unit works anywhere within Wifi range of the master and is very resilient in waiting days for messages–just plug it into a 5 volt wall wart with enough power to supply your Neopixel length and go. If you want an occasional light display while waiting for rain this is easy to program–especially if you live somewhere where it doesn’t rain at all.

Source: ESP-Now Rainstick

Scroll to Top
Scroll to Top