# Rain Sensing Light Up Umbrella

1,935

10

4

Hi, all! I did this project for my Physical Computing class. The idea of this project was to create an umbrella that lights up based off of the pressure of the rain drops when they hit certain sensors on it. This project is made for people with a lot of patience and wire. Also small umbrellas, because big umbrellas are not fun.

### Teacher Notes

Teachers! Did you use this instructable in your classroom?
Add a Teacher Note to share how you incorporated it into your lesson.

## Step 1: Materials Used

- An Umbrella (Any umbrella is fine, but the bigger it is the more wire you need!)
- A lot of wire
- A lot of solder
- 9V Battery
- 8 Piezo Sensors (I bought mine from Sparkfun https://www.sparkfun.com/products/10293)
- 8 1.0M Ohm 1/4 PTH Resistors (Also from Sparkfun https://www.sparkfun.com/products/11853)
- 4051 Multiplexers (From Amazon https://www.amazon.com/CD74HC4051E-8-channel-analo...

## Step 2: The Code

Open up the Arduino program and create a new file to paste this code into.

int r0 = 0; int r1 = 0; int r2 = 0; int w0 = 0; int w1 = 0; int w2 = 0; int count = 0;

void setup() { Serial.begin(9600);

//initialize digital arduino pins as outputs to control the selecting process for our 4051 multiplexers pinMode(2, OUTPUT); //r0 pinMode(3, OUTPUT); //r1 pinMode(4, OUTPUT); //r2 pinMode(8, OUTPUT); //w0 pinMode(9, OUTPUT); //w1 pinMode(10, OUTPUT); //w2 }

void loop(){

//cycle through each piezo disk and corresponding string of LEDs for(int i = 0 ; i < 8; i++){

//send the trigger from the pressure to the LEDs writing(i); } }

//slowly prints results to the serial monitor count++; if(count % 1000 == 0){ Serial.println(sensorReading); } }

void writing(int LED){

//uses binary to select the correct output to write to on the 4051, here used as a demultiplexer w0 = bitRead(LED, 0); w1 = bitRead(LED, 1); w2 = bitRead(LED, 2); digitalWrite(8, w0); digitalWrite(9, w1); digitalWrite(10, w2);

//if measured pressure above a certain threshold, trigger string of LEDs if (sensorReading >= 15){ analogWrite(A0, sensorReading*25); delay(125); }

//otherwise, leave LEDs off else{ analogWrite(A0,0); } }

## Step 3: Prototyping

It's a good idea to test your sensors, LEDs, and multiplexers small scale first so that you are sure that everything is working. This step isn't really required, but highly recommended.

I found that using two breadboards worked better because that way it was easier to differentiate between the multiplexers to know which one handled the sensors and which one handled the LEDs.

http://www.arduino.cc/playground/Learning/4051 This schematic of the multiplexers helps you figure out the pin configuration and logic that I will refer to soon.

CONNECTING THE MULTIPLEXERS TO THE ARDUINO:
- Vcc Inputs (Pin 16) to a shared 5V power source from the Arduino.
- E (Pin 6), Vee (Pin 7), and GND (Pin 8) to shared ground source of the Arduino.
- Z (Pin 3) inputs go to an analog input on the Arduino. In this code, the chip with the sensors goes to A5, and the chip with the LEDs go to A0 on the Arduino.
- S2 (Pin 9), S1 (Pin 10), and S0 (Pin 11) go to the digital outputs on your Arduino. The chip with the sensors goes to 2, 3, 4 and the chip with the LEDs goes to 8, 9, and 10.

CONNECTING EVERYTHING ELSE TO THE MULTIPLEXERS:
The LEDs
What I did was put three LEDs in a parallel string, then wired one (any leftover) pin from the multiplexer to the positive, and ground to negative.
The Sensors
The sensor was a little bit tricky for me since the wire that was already soldered onto the piezo was very flimsy and fragile. What I did to help was solder the 1MΩ resistor to both wires of the piezo (as seen in the picture), then soldered on additional wire to "extend it". The red wire goes to the same numbered pin you used for the LEDs in the multiplexer (THIS IS VERY IMPORTANT. They have to be the same or else your LEDs and sensors will be uncoordinated!) and the black wire goes into ground.

WARNING!!!!!!!!!!

If you are only testing one sensor and one string of LEDs, you must plug the remaining empty pins of both multiplexers into ground. When these pins are left unconnected, they give random readings.

Now run the code!

## Step 4: Putting It Together

It is crucial to know how much wire and solder you need before you begin because I will tell you, it is not fun running out of wire. You can figure this out by first placing sensors and LEDs where you want them on the umbrella and then go about from there.

I held the sensors and lights down with tape, but it may be better to use hot glue as long as you don't melt any of the electronic components or the umbrella.

The Sensors:
The sensors were soldered and plugged in the same way as in the prototyping stage, just with longer wires to be able to reach the arduino from whatever panel on the umbrella.

The LEDs:
I soldered two LEDs together with wires by connecting positive lead to positive lead and negative to negative. Then I took a third and fourth wire to connect to one negative and positive lead which would extend out to the arduino to be plugged in.

Since you can't power the arduino via usb cable, you would have to use the 9V battery. Simply plug it into the arduino with the proper cable and voila!

## Step 5: Reflection

This project was not a hard one but it was very tedious and complex. I think it would have come out better if I had used a smaller umbrella and devoted more time to it. Also if I had more wire! I found my tape coming off as I opened and closed it a few times, which was very heartbreaking and I should have reinforced it better.

## Recommendations

• ### Internet of Things Class

21,623 Enrolled

## 4 Discussions

Sir how is input voltage to the arduino given in this project? Because we are unable to see the battery in the pictures

good job

but please how can i get the code ?

Cool idea. You might think about entering this into the Sensors contest that is currently running.