I am belongs to a village and we have our own firm. During staying at my village we were getting plenty of fresh vegetables/herb leaves from our firm (see above images).But now the situation is different, as I am staying in a city no more fresh vegetables/herb leaves. I have to buy these from the store which are not at all fresh. Apart from these they are grown by using harmful pesticides which is not good for health. So I am planning to firming herbs at my balcony which is completely fresh and harmless. But firming is a time consuming process. I always forget to give water in my flower plants. This leads to give the idea of automated gardening system.
The system is designed to sense soil moisture, amount of light falling on the plants and water flow rate. When the moisture content in the soil is too low, the system will give command to start a pump and water the soil. The flow meter monitor the water consumption.
Apart from this the Arduino and ESP8266 it will transmit information on moisture level, ambient light and flow rate to the web .You can monitor all the data from your smart phone by using mobile app. Then a twit can be send to your account automatically if the moisture falls below a given threshold value. Care for the environment has become very important in recent years and there is an increasing demand for "green" applications that can help reduce CO2 emissions or make a more efficient management of energy consumed.
Hardwares Required:- Arduino UNO
- ESP8266 (WiFi Module)
- Temperature Sensor
- Humidity Sensor
- Moisture sensor
- Sunlight Sensor
- Relay Shield
- DC Water Pump
- Pipes and Connecting Wires
- Power Supply
Arduino refers to an open-source electronics platform or board and the software used to program it. Arduino is designed to make electronics more accessible to artists, designers, hobbyists and ayone interested in creating interactive objects or environments. An Arduino board can be purchased pre-assembled or, because the hardware design is open source, built by hand. Either way, users can adapt the boards to their needs, as well as update and distribute their own versions.
ESP8266(WiFi Module)The ESP8266 WiFi Module is a self contained SOC with integrated TCP/IP protocol stack that can give any microcontroller access to your WiFi network. The ESP8266 is capable of either hosting an application or offloading all Wi-Fi networking functions from another application processor.
Interface both Arduino and Esp8266 based on the below connection configurations:
- VCC shall be connected to the 3.3V power supply
- GPIO0 and GPIO2 are general purpose digital ports. GPIO0 also controls the module mode (programming or normal operation). In our case (normal operation), it shall be connected to 3.3V (high). GPIO2 is not used in this example, so I put it on 3.3V to simplify the connections
- CH_PD: Chip enable. Keep it on high (3.3V) for normal operation
- RST: Reset. Keep it on high (3.3V) for normal operation. Put it on 0V to reset the chip.
- Tx: Goes to Arduino Rx
- Rx: Goes to Arduino Tx
- GND is ground
Then, you need to take a few steps to be able to configure the ESP8266 with the Arduino IDE:
- Start the Arduino IDE and open the Preferences window.
Enter the following URL: http://arduino.esp8266.com/package_esp8266com_index.json into Additional Board Manager URLs field.
- Open Boards Manager from Tools > Board menu and install the esp8266 platform.
Now, we are going to check that the Arduino IDE is correctly working, and connect your chip to your local WiFi network.
To do so, we need to write the code first, and then upload it to the board. The code is will be quite simple: we just want to connect to the local WiFi network, and print the IP address of the board. This is the code to connect to the network:
// Import required libraries
#include "ESP8266WiFi.h"
// WiFi parameters
const char* ssid = "your_wifi_name";
const char* password = "your_wifi_password";
void setup(void)
{
// Start Serial
Serial.begin(115200);
// Connect to WiFi
WiFi.begin(ssid, password);
while (WiFi.status() != WL_CONNECTED) {
delay(500);
Serial.print(".");
}
Serial.println("");
Serial.println("WiFi connected");
// Print the IP address
Serial.println(WiFi.localIP());
}
void loop() {
}
You can simply copy the lines of code above, and copy them into the Arduino IDE that you downloaded. Of course, put your own WiFi name & password in the code. Save this file with a name of your choice.
Now, also go in Tools-->Boards, and select the board you are using. If you are not sure about which board to choose, simply choose “Generic ESP8266 Module”. Also select the correct Serial port that corresponds to the Arduino UNO your are using.
After that, we need to put the board in bootloader mode, so we can program it. To do so, connect the pin GPIO 0 to the ground, via the cable we plugged into GPIO 0 before. Then, power cycle the board but switching the power supply off & then on again.
Now, upload the code to the board, and open the Serial monitor when this is done. Also set the Serial monitor speed to 115200. Now, disconnect the cable between GPIO 0 and GND, and power cycle the board again. You should see the following message:
WiFi connected
192.168.1.108
If you can see this message and an IP, congratulations, your board is now connected to your WiFi network!
Project ImplementationCayenne is a IoT cloud platform which is very simple in developing a dashboard monitoring for IoT boards like Arduino, ESP8266 (WiFi Module) and it is a drag and drag system to develop complete system.
Cayenne has two componets
1) Cayenne Mobile Apps
2)Cayenne Online Dashboard
In my case i used Cayenne mobile app for Monitoring,because of its ease of use.
Cayenne is having many features like
- GUI based Dashboard
- Monitoring
- Triggering and
- Alerts Notifications.
Here I will explain how i created my Cayenne Mobile App dashboard,
Step1:
- Download and install Cayenne Mobile App from Google Play Store or IOS Store
Lets get started with Cayenne, Before getting into cayenne have look at this Getting started guide/docs from Cayenne developers..
https://mydevices.com/cayenne/docs/getting-started/
- If you don't have a new Cayenne account, Click Create my Free Account.
- After creating account,Click Sign in to my Account.
Step 2:
- In Login page use your Login credentials to open your Account. You need to give Email Id and Password to open.
- Then select Login option to open your Cayenne Account.
Step 3:
- Dashboard will display the list of devices which you configured with Cayenne,If wants to add new devices to cayenne then Click on Plus symbol. It was shown with Arrow mark in the below picture.
- It will move on to next page i.e Add Device. Here you need to select the suitable Hardware for your project. Eg: Arduino, Raspberry Pi or using Your OWN Thing(Cayenne API). Most easy way to configure is by using Cayenne API. Easy to configure all hardware devices to Cayenne using its API via MQTT protocol. In my Project I used Cayenne API.
Step 5:
- Select Cayenne API in the list of options. After clicking it will go to the next step. In this step, Select Hardware type i.e Arduino MQTT SDK.
- Copy MQTT Username, Password and Client ID from the Dashboard and paste in your Arduino Code.
// Cayenne authentication info. This should be obtained from the Cayenne Dashboard.
char username[] = "MQTT_USERNAME";
char password[] = "MQTT_PASSWORD";
char clientID[] = "CLIENT_ID";
Mqtt server:
mqtt.mydevices.com
Host port: 1883
Device Name: Device 51dB
Note:
- In order to use Cayenne API, you need to add Cayenne MQTT library to Arduino IDE. For Arduino you need to add Cayenne MQTT Arduino Library ESP8266, you need to add Cayenne MQTT ESP8266 Library.
- If you added both library your Code will not work it will show ERROR. I had same problem when I am working on my project.
- If Arduino UNO with WiFi Shield or Ethernet shield is used in you project Add Cayenne MQTT Arduino.
- If Esp8266 is Used with Arduino Add Cayenne MQTT ESP8266 Library.
Step 6:
- New Device will be added to the Devices Page. Click on this Device name to add sensors and other Widgets. To change device Name Click settings to change.
Step 7:
- There is No Active widgets or Sensors in this device. Click +ADD to add the Sensors and Widgets you want to use in your projects.
Step 8:
- Add Device
1) Actuators
2) Sensors
3) Widgets
Widgets are used to control a device and are used to show the visualization of data coming from a device.
VALUE displays a measurement value from a sensor or device.
To add Value Widgets you need give the following details in the widget.
- Specify Sensor NAME (Value)
- Select Device name
- Select Connectivity i.e Digital,Analog or Virtual.
- Choose Pin Number
- Then ADD Widget
Line Charts displays live or historical data from the attached device.
To Add Line Charts you need to give the following details in the widget.
- Specify Sensor NAME (Line Chart)
- Select Device name (Arduino UNO)
- Select Connectivity i.e Digital, Analog or Virtual.
- Choose Pin Number
- After filling in each of the fields for your widget,Click Add Widget
Gauge which displays the current value of a sensor within a given range of values. Good, warning and danger value ranges can be defined in settings.
To Add Gauge you need to give the following details in the widget.
- Give your Sensor NAME (Gauge)
- Select Device name (Arduino UNO)
- Select Connectivity i.e Digital,Analog or Virtual.
- Choose Pin Number
- Select Maximum and Minimum Values
- After filling in each of the fields for your widget,Click Add Widget
- After Adding all the Sensors and Custom Widgets, we need to configure Device pins and virtual pins to get the data/Information from the all the sensors.
- In my project I used Soil Moisture,Temperature,Sunlight and Humidity sensors.
- Soil Moisture Value is HIGH, Alert Message will be sent If it exceeds Threshold Value.
- To turn Off Water pump, Click Motor button to Switch OFF the Water Pump.
- Soil Moisture Value is LOW
- Click Motor button to Switch ON the Water Pump.
Line Charts displays live or historical data from the attached device. Historical data can be filtered by minute, hour, day, week, month, year or a custom date range. The data can be easily downloaded for viewing or consumption.
- Temperature Readings are taken and plotted in the Line charts.
- Humidity Graph is plotted in the Line chart format.
- Sunlight Values are plotted.
- Soil Moisture Sensor Values are plotted in the Line Charts.
Cayenne is having an Triggers and Alert Features to make your project more sensitive.I had used this feature to get Alert Notification when Moisture Value exceeds my Threshold value which I had given.
Step 1:
- In order to create this alerts you need to click on Triggers and Alerts Option in Cayenne Mobile App
Step 2:
- And need to give the Trigger Name in the text Box. Then you have to Click on IF Option in the app and Select the sensor which you need to Set Alerts and specify type of Sensor like Analog or Digital in my case Analog Sensor
Step 3:
- Then,using Slider Option Select the Threshold Value in the Box i.e it starts From 0.0 and ends with 1024.0.
- Use Radio Button to choose Sensor Above or Sensor Below in the option. After clicking on the Radio Button,we need to give Mobile Number/Email for notifications Alerts which should to specified in THEN
Step4:
- In this Final Step, need to SWITCH ON Alert!!! Notifications in the Cayenne App. If you don't want any Alerts you can Click this Option and Switch OFF easily.
Step 6:
- Cayenne Notification Message sent to my Mobile number which explains clearly that Soil Moisture sensor reached my Threshold value (i.e) Greater than 200. This notification feature is really helpful to get the updates about the Garden system. Easy to track the gardening plants.
This Video explains the working of my Garden Automation System and Cayenne Dashboard.
Have a look at it!!
Comments