Introduction: Take Care of Your Plants
Plants bring light and color into our house but unfortunately it is not so easy to take care of them. One needs to know how to grow them and give them the proper care so that they can grow over time. We wanted to create a system that would help us give our plants the care they deserve.
Our system supports the following scenarios:
1. The CPX measures the moisture level in the plant and displays these values in the Blynk app continuously. If the moisture values of the plant are too high or too low, an appropriate indication will appear in the app and we will know how to water the plant according to its moisture value.
2. In order to prevent damage to the leaves of the plant (by pests or insects), in case of an abnormal movement around the plant the CPX will detect this and warn this in a mobile message. In addition, the CPX will beep to move the pests away.
3. In order to make sure that we do not forget to water the plant, every two days (or another set time frame that is set) a watering task is automatically created in Google Tasks. In addition the CPX neopixels turn on.
4. Clicking the right or left button on the CPX will complete the watering task on Google Tasks and turn off the neopixels. According to the button that was pressed the Blynk app will present the last person who watered the plant.
5. To encourage the growth of the plant, you can activate a melody from the Blynk app that the CPX will play to the plant.
Supplies
Our project based on the Adafruit Circuit Playground Express uses Blynk and Integromat.
The ESP8266 connects to the Circuit Playground by UART for a WiFi connection. The UART connection:
- GND - GND
- VCC - VCC
- RX - TX
- TX - RX
In addition, we need:
- Circuit Playground Express
- Battery Holder
- 3 X AAA Batteries
- Cable
- Nail
Step 1: Meet the Technologies
CPX : The Circuit Playground is family of small microcontroller boards with LEDs, buttons, and sensors built in.
Blynk: An IoT platform for iOS or Android smartphones that is used to control Arduino, Raspberry Pi and NodeMCU via the Internet.
Integromat: A platform that enables automation of processes between different systems and / or web applications.
Step 2: Preparations
- Install Arduino software from the following link: https://www.arduino.cc/en/Main/Software
- Install adafruit driver from the following link: http://bit.ly/adafruit-windows-drivers (only for Windows)
- Install the board manager SAMD from the following link: http://bit.ly/playground-arduino
- Create a user on Blynk from the following link: https://sgp1.blynk.cloud/dashboard/login
- Create new template, fill the details and choose "Arduino" in HARDWARE and WiFi in CONNECTION TYPE
- Create new device on the template you created before
- On Device Info you will find Template ID, Device Name and Auth Token.
- Download Blynk application to your mobile
- Create a user on Integromat from the following link: https://www.integromat.com
- Downland Integromat application to your mobile
Step 3: Moisture Scenario
On Blynk website:
- Open the Blynk website and enter to your template that you have created before
- Create new virtual pin datastream with double data type (we chose V0)
On Blynk app:
- Open the Blynk app and enter to your device that you have created before
- Click on the settings symbol and then press on the + button
- Add Gauge display and fill the title and the appropriate datastream (we chose V0)
Step 4: Movement Alert Scenario
On Integromat website:
Webhook:
- Open the Integromat website and create a new scenario
- Add "Webhook" module (Custom webhook trigger), click on the "Add" button and change the Webhook name
- Copy the given URL, paste it on a new tab in your browser and add to it "?value=msg"
- Click enter and make sure that "Accepted" message appeared
Apple iOS:
- Add "Apple iOS" module (or Android according to your device) with "Send a push notification" action and connect the Webhook module to it
- Add your device by scanning the QR code that presented with the Integromat app (make sure that you allow notifications on your app settings)
- Choose the device that you created
- Write the notification's title
- Choose "value" on the notification's body (value is the string given by webhook)
- Click on "ok" button
- Set up a filter between the modules: set the condition to be "value" that equal to the message you sent from webhook
Press the clock symbol and choose how often you want to be notified and turn on the scheduling switch.
On Blynk website:
- Open the Blynk website and enter to the template
- Create new virtual pin datastream with string data type (we chose V1)
- Click on the settings symbol and choose Webhooks
- Create new Webhook:
- Fill the WEBHOOK NAME
- Choose "Device sends data to datastream" on WEBHOOK TRIGGER EVENT
- Choose your device that you created before
- Choose the virtual pin (V1) on DATASTREAM
- Paste the URL from Integromat (from webhook step 3)
- On Query parameters choose "device_pinValue"
- Click on Save Webhook button
Step 5: Create Watering Task Scenario
On Integromat website:
Google Tasks:
- Open the Integromat website and create a new scenario
- Add "Google Tasks" module (Create a Task trigger)
- Create a connection (choose "My Google connection"), choose your Task List ID, select "Create a Task" method and fill the task title
- Click on "OK" button
HTTP:
- Add "HTTP" module (Make a request) and connect the Google Tasks module to it
- Fill the URL as follow: https://blynk.cloud/external/api/update?token={token}&{pin}=1 and click on "OK" button
- Blynk.cloud should be the IP of your Blynk server, token should be your BLYNK_AUTH_TOKEN and pin should be the virtual pin that was created in Blynk website (we chose V2)
Press the clock symbol and choose how often you want to create task and turn on the scheduling switch.
On Blynk website:
- Open the Blynk website and enter to the template
- Create new virtual pin datastream with integer data type (we chose V2)
Step 6: Watering Task Was Completed
On Integromat website:
Webhook:
- Open the Integromat website and create a new scenario
- Add "Webhook" module (Custom webhook trigger) and choose the webhook you created in Movement Alert Scenario
Google Tasks:
- Add "Google Tasks" module (Update a Task action) and connect the Webhook module to it
- Choose "My Google connection", your Task List ID and Task ID
- Click on the "Show advances settings" checkbox and click on "Yes" in Complete a Task
- Click on "OK" button
- Set up a filter between the modules: set the condition to be "value" that equal to the message you sent from webhook
On Blynk website:
- Open the Blynk website and enter to the template
- Create new virtual pin datastream with string data type (we chose V4)
On Blynk app:
- Open the Blynk app and enter to your device that you have created before
- Click on the settings symbol and then press on the + button
- Add Labeled Value display and choose the appropriate datastream (we chose V4)
Step 7: Playing Melody Scenario
On Blynk website:
- Open the Blynk website and enter to the template
- Create new virtual pin datastream with integer data type (we chose V3)
On Blynk app:
- Open the Blynk app and enter to your device that you have created before
- Click on the settings symbol and then press on the + button
- Add Button controller and choose the appropriate datastream (we chose V3)
Step 8: Code and CPX
To connect the CPX and the code that was written in Arduino you need to:
- Download the attached file (.ino file) and make the following changes:
- Change the value of "auth" to your Blynk Auth Token
- Change the value of "ssid" to your wifi network name
- Change the value of "pass" to your wifi password
- Connect the CPX to your computer and upload the code
- Disconnect the CPX from the computer and connect it to the battery holder
- Place the CPX on the plants
- Connect one side of the cable to the nail and the other side to the CPX (A3) and put the nail in the plant's soil