Hello there fellow Spacebrewers!
Snax 'n Macs here!
Have you ever wanted to remotely water your loved ones plants and couldn't ?
Have you ever wanted to do this with the ease in which you water your own plants?
Well thanks to Spacebrew now you can!
This easy to make project connects two arduino's remotely, allowing you to send information remotely from one to the other. Connecting botanophile's around the world one arduino at a time.
- 2 x Arduino's
- 1 x Servo Motor
- 1 x Photoresistor (Or any sensor you wish!)
- 1 X 10k ohm Resistor
- Foam core or another material of your choice to build a structure. Keep in mind if you are using the photoresistor you will need to be able to put a hole into your structure!
Step 1: Connecting the Photoresistor to the Arduino
- First you want to connect your photoresistor to the Arduino (refer to the schematic).
We wanted to have a pick up / set down motion of the "watering can" that triggered the change in the sensor. To do this you will need to build a platform with a small hole in it for the sensor. So that when the watering can covers the sensor, the light is reduced. We attached the photoresistor with copper tape and alligator clips.
- Next you will want to test your resistor and the sensitivity it has, this will differ from sensor to sensor. It's good to check. We used this simple sketch.
- Now you will need to connect the Arduino to Processing, in order to easily get it to talk to Processing we used the Firmata Library, which is already included in the Arduino software package but you will need to download it for processing. It can be found here.
- You will need to open the Standard Firmata example in Arduino and load this onto your board.
- Next open Processing and test that your connection is working. Open an input example from the Firmata library, this will take input from any pin, the only thing you will have to change is the array number that associates with which Arduino you are using.
Step 2: Connecting Servo Motor to Second Arduino
- First you want to connect your servo motor to the Arduino. Here's a tutorial.
- We wanted to have a 90 degree motion of the small watering cap that was triggered by when our processing sketch received a message from the photoresistor. We built a little platform with an arm out of foam core and tape. Essentially, the arm lays on top of the servo motor and tilts with the motor's motion.
- Next you will want to test your servo and make sure it is working and rotating in a way that tilts towards the vase of flowers to which you want to add water.
- Now you will need to connect the Arduino to Processing, in order to easily get it to talk to Processing we used the Firmata Servo Library, which you have already downloaded in Step 1.
- You will need to open the Servo Firmata example in Arduino and load this onto your board.
Step 3: Connecting the Local and Remote Elements
- If you haven't already, download the repo on two computers connected to your arduino set-ups.
- Open the water_can.pde processing sketch on the computer connected to the photoresistor/arduino.
- Open the plant_motor.pde processing sketch on the computer connected to the servo/arduino.
- Now it's time to connect your local photoresistor water_can.pde processing sketch to your servo (remote) plant_motor.pde sketch using Spacebrew (http://docs.spacebrew.cc/examples). This is how the two sketches are going to talk to each other. Run your processing sketches. They will then appear on the admin Spacebrew server.
- You'll want to open up the admin Spacebrew server (http://spacebrew.github.io/spacebrew/admin/admin.h... and connect your two nodes - the publisher (water_can.pde sketch) with the subscriber (servo plant_motor.pde sketch). Just click on the publisher and click on the subscriber, and they will connect.
##Note - If you change the names of the publishers and/or subscribers in your Processing sketches , and we encourage you to do so, do not use Camel Case.
Step 4: Water Your Plants
Now it's time to try out your code!
Lift your water cup on the photosensor platform to see if your code is working correctly. If all is working well, your servo should turn 90 degrees and water your plants on the other side. You'll have to add the water yourself, of course.
1. It helps to open up the serial monitor in Processing to debug. We are printing the resistor's range to the serial monitor for your convenience.
2. Every time you stop running your Processing sketch, you'll have to reconnect the nodes on the Spacebrew Admin site.
3. We added black sharpie markings to the bottom of the water cup in order to add to the sensitivity of the photoresistor to the light.