Plant watering system (#419)
* added youtube movie * plant watering system * added project entry
This commit is contained in:
parent
7ac75d646e
commit
65b2640744
@ -20,6 +20,7 @@
|
||||
* [Duct tape wallet](/projects/wallet)
|
||||
* [Watch](/projects/watch)
|
||||
* [Soil Moisture](/projects/soil-moisture)
|
||||
* [Plant Watering](/projects/plant-watering)
|
||||
* [Voting Machine](/projects/voting-machine)
|
||||
* [Infection](/projects/infection)
|
||||
* [Fireflies](/projects/fireflies)
|
||||
|
@ -111,6 +111,10 @@ Fun games to build with your @boardname@.
|
||||
"name": "Soil Moisture",
|
||||
"url":"/projects/soil-moisture",
|
||||
"imageUrl":"/static/mb/projects/soil-moisture.jpg"
|
||||
}, {
|
||||
"name": "Plant Watering",
|
||||
"url":"/projects/plant-watering",
|
||||
"imageUrl":"/static/mb/projects/plant-watering.jpg"
|
||||
}]
|
||||
```
|
||||
|
||||
|
40
docs/projects/plant-watering.md
Normal file
40
docs/projects/plant-watering.md
Normal file
@ -0,0 +1,40 @@
|
||||
# Plant Watering
|
||||
|
||||
|
||||
### ~avatar avatar
|
||||
|
||||
Water your plants automatically!
|
||||
|
||||
### ~
|
||||
|
||||
https://youtu.be/7eC_VjH1eP0
|
||||
|
||||
### ~ hint
|
||||
|
||||
This is a follow up of the **[soil moisture project](/projects/soil-moisture)**.
|
||||
|
||||
### ~
|
||||
|
||||
## Materials
|
||||
|
||||
* 1 @boardname@ with battery pack and batteries
|
||||
* 2 long nails or silver
|
||||
* 2 crocodile clips
|
||||
* 1 micro servo + 3 female-to-croc clips
|
||||
* 1 ice cream wooden stick
|
||||
* 2 elastics
|
||||
* 1 clear tape roll
|
||||
* 1 straw
|
||||
* 1 pair of scissors
|
||||
|
||||
## Activities
|
||||
|
||||
* [Make](/projects/plant-watering/make)
|
||||
* [Code](/projects/plant-watering/code)
|
||||
* [Connect](/projects/plant-watering/connect)
|
||||
|
||||
### ~button /projects/plant-watering/make
|
||||
|
||||
Let's get started!
|
||||
|
||||
### ~
|
59
docs/projects/plant-watering/code.md
Normal file
59
docs/projects/plant-watering/code.md
Normal file
@ -0,0 +1,59 @@
|
||||
# Code
|
||||
|
||||
Let's add the code so that _when the soil moisture level is low, the servo waters the plant._
|
||||
|
||||
From the **soil moisture** project, we know that the moisture is low when the ``reading`` is roughly less than ``500``.
|
||||
We can use this information to add an ``if reading < 500`` in the code.
|
||||
|
||||
```block
|
||||
let reading = 0
|
||||
if (reading < 500) { }
|
||||
```
|
||||
|
||||
The servo is connected to pin ``P2`` so we can use ``pins servo write`` block to change the angle of the servo.
|
||||
We need it to change the angle to ``0``, wait until the water has fallen off, and move it back to ``80``.
|
||||
|
||||
```block
|
||||
let reading = 0
|
||||
if (reading < 500) {
|
||||
basic.showIcon(IconNames.Umbrella)
|
||||
pins.servoWritePin(AnalogPin.P2, 0);
|
||||
basic.pause(3000)
|
||||
pins.servoWritePin(AnalogPin.P2, 80)
|
||||
basic.pause(3000)
|
||||
pins.analogWritePin(AnalogPin.P2, 0)
|
||||
}
|
||||
```
|
||||
|
||||
We insert the code above in the **forever** loop of the [soil moisture code](/projects/soil-moisture/connect).
|
||||
|
||||
```blocks
|
||||
radio.setTransmitSerialNumber(true)
|
||||
radio.setGroup(4)
|
||||
led.setBrightness(64)
|
||||
let reading = 0
|
||||
basic.forever(() => {
|
||||
pins.analogWritePin(AnalogPin.P1, 1023)
|
||||
reading = pins.analogReadPin(AnalogPin.P0)
|
||||
radio.sendNumber(reading / 4);
|
||||
pins.analogWritePin(AnalogPin.P1, 0)
|
||||
led.plotBarGraph(
|
||||
reading,
|
||||
1023
|
||||
)
|
||||
if (input.buttonIsPressed(Button.A)) {
|
||||
basic.showNumber(reading)
|
||||
}
|
||||
if (reading < 500) {
|
||||
basic.showIcon(IconNames.Umbrella)
|
||||
pins.servoWritePin(AnalogPin.P2, 0);
|
||||
basic.pause(3000)
|
||||
pins.servoWritePin(AnalogPin.P2, 80)
|
||||
basic.pause(3000)
|
||||
pins.analogWritePin(AnalogPin.P2, 0)
|
||||
}
|
||||
basic.pause(5000);
|
||||
})
|
||||
```
|
||||
|
||||
https://youtu.be/7eC_VjH1eP0
|
24
docs/projects/plant-watering/make.md
Normal file
24
docs/projects/plant-watering/make.md
Normal file
@ -0,0 +1,24 @@
|
||||
# Make
|
||||
|
||||
|
||||
## The pump
|
||||
|
||||
Follow the instructions on the move to build a mini water-pump using a @boardname@ and a servo.
|
||||
|
||||
https://youtu.be/jANCdtkJAKY
|
||||
|
||||
|
||||
## The soil moisture sensor
|
||||
|
||||
Follow the instructions of the [soil moisture project](/projects/soil-moisture) to build a soil moisture sensor
|
||||
and upload the code to your @boardname@.
|
||||
|
||||
The final wiring should look like this:
|
||||
|
||||
![](/static/mb/projects/plant-watering/make.jpg)
|
||||
|
||||
### ~button /projects/plant-watering/code
|
||||
|
||||
Code
|
||||
|
||||
### ~
|
@ -55,6 +55,8 @@ for dry dirt.
|
||||
* insert the nails in the wet dirt, press ``B`` and note the value. You should see a value close to ``1000``
|
||||
for dry dirt.
|
||||
|
||||
https://youtu.be/S8NppVT_paw
|
||||
|
||||
## Step 3: Don't waste energy!
|
||||
|
||||
![](/static/mb/projects/soil-moisture/nailsp1.jpg)
|
||||
|
BIN
docs/static/mb/projects/plant-watering.jpg
vendored
Normal file
BIN
docs/static/mb/projects/plant-watering.jpg
vendored
Normal file
Binary file not shown.
After Width: | Height: | Size: 31 KiB |
BIN
docs/static/mb/projects/plant-watering/make.jpg
vendored
Normal file
BIN
docs/static/mb/projects/plant-watering/make.jpg
vendored
Normal file
Binary file not shown.
After Width: | Height: | Size: 102 KiB |
Loading…
Reference in New Issue
Block a user