Introduction: SMART GROWING POT(SGP)
HELLO guys!
This is my 1st Instructables project! its called Smart Growing Pot
It is my Finally Year Project currently and i am graduating at the end of this month.
i was notified that i has been selected to participate in a special raffle for a Dremel!
So in this project i will share to you how the project works, and all the development process
Step 1: CHAPTER 1 INTRODUCTION
1.0 PROBLEM STATEMENT
- Not enough time for gardening as gardeners are working and having vacation at the same time.
- Unpredictable weather in Malaysia causes gardening to be more difficult
. - Plant does not grew up according to plan and easily died.
1.1 TARGET USER
- Housewives
- Gardener that working and love to go vacation
1.2 OBJECTIVES
- To identify the important elements in gardening.
- To develop a Smart Growing Pot by implementing the identified important elements
- To evaluate the test result from the prototype.
Step 2: CHAPTER 2 METHODOLOGY
Collect requirement from respondents
-interview
-survey
Materials needed
- Arduino Mega
- Breadboard
- Jumper wires
- Wifi Shield
- 3 sensors ( temp , light, soil )
- Resistors
- Speaker
- Plant
- Acrylic glass
-IC Board
Step 3: CHAPTER 3 TESTING
Observation testing
1. Test between Normal vs Controlled condition
- Normal condition : 1 volunteer will take care of the plant normally with normal daily routine ( working)
- Controlled condition : 1 volunteer will take care of the plant with SGP system.
Step 4: CODE
Source Code
#include
#include
#include
#include "SD.h"
#define SD_ChipSelectPin 4
#include "TMRpcm.h"
#include "SPI.h"
#include
#include
#include
int sensor_light = A5;
int value_light;
int sensor_temp = A0;
int value_temp;
int sensor_water = A3;
int value_water;
int red = 3;
int yellow = 6;
int blue = 5;
int green =2;
int pumpPin = 44;
LiquidCrystal lcd(47, 45, 37, 33, 31, 24);
int backLight = 28;
char ssid[] = "LAKEVILLE"; // network SSID (name)
char pass[] = "abcd1234"; // network password
int keyIndex = 0; // network key Index number (needed only for WEP)
int status = WL_IDLE_STATUS;
WiFiServer server(80);
// ThingSpeak Settings
char thingSpeakAddress[] = "api.thingspeak.com";
String APIKey = "80OVCF5JFVA6H9A5"; // enter your channel's Write API Key
const int updateThingSpeakInterval = 20 * 1000; // 20 second interval at which to update ThingSpeak
// Variable Setup
long lastConnectionTime = 0;
boolean lastConnected = false;
// Initialize Arduino Ethernet Client
WiFiClient client;
TMRpcm tmrpcm;
void setup() {
tmrpcm.speakerPin = 11;
tmrpcm.setVolume(5);
// Start Serial for debugging on the Serial Monitor
Serial.begin(9600);
lcd.begin(16, 2);
pinMode (3, OUTPUT); //red led - temp
pinMode (6, OUTPUT); //yellow led - light
pinMode (5, OUTPUT); //blue led - water
pinMode (2, OUTPUT); //green led - overall health
pinMode(backLight, OUTPUT);
digitalWrite(backLight, HIGH);
pinMode(pumpPin,OUTPUT);
Serial.print("Initializing SD card...");
if (!SD.begin(4)) {
Serial.println(" failed!");
while(true);
}
Serial.println(" done.");
while (!Serial) {
; // wait for serial port to connect. Needed for Leonardo only
}
// check for the presence of the shield:
if (WiFi.status() == WL_NO_SHIELD) {
Serial.println("WiFi shield not present");
// don't continue:
while (true);
}
// attempt to connect to Wifi network:
while ( status != WL_CONNECTED) {
Serial.print("Attempting to connect to SSID: ");
Serial.println(ssid);
// Connect to WPA/WPA2 network. Change this line if using open or WEP network:
status = WiFi.begin(ssid, pass);
// wait 10 seconds for connection:
delay(10000);
}
// you're connected now, so print out the status:
printWifiStatus();
}
void loop() {
// read values from pins and store as strings
delay(1000);
status=0;
value_temp = analogRead(sensor_temp);
float celcius = (value_temp/5.6);
value_light = analogRead(sensor_light);
value_light = map(value_light,1000,0,0,100);
delay(500);
value_water = analogRead(sensor_water);
//value_water = map(value_water,1023,0,0,100);
// String light = String analogRead(A0); // read light value
String temp=String(celcius);// turn integer to string
String light=String(value_light);// turn integer to string
String water=String(value_water);// turn integer to string
lcd.setCursor(0, 0);
lcd.print("SUN:");
lcd.print(light);
lcd.print(" TEM:");
lcd.print(temp);
lcd.setCursor(0, 1);
lcd.print("WATER:");
lcd.print(water);
// find temp value
//float voltage = analogRead(A1) * (3.3 / 1024); // convert 0-1023 range to 3.3V range
//int tempVal = (voltage - 0.5) * 100; // convert voltage to temperature in *C
//String temp = String(tempVal);
// Print Update Response to Serial Monitor
if (client.available()) {
char c = client.read();
Serial.print(c);
}
// Disconnect from ThingSpeak
if (!client.connected() && lastConnected) {
Serial.println("...disconnected");
Serial.println();
client.stop();
}
// Update ThingSpeak
if (!client.connected() && (millis() - lastConnectionTime > updateThingSpeakInterval)) {
updateThingSpeak("field1=" + light + "&field2=" + temp + "&field3=" + water);
Serial.println(light);
Serial.println(temp);
Serial.println(water);
}
lastConnected = client.connected();
if (value_temp < 100){
digitalWrite (3, HIGH); // plant too cold - red led on
status=1;
}else{
digitalWrite (3, LOW); // normal temp - red led off
}
if (value_light < 30) {
digitalWrite (6, HIGH); // not enough light - yellow led on
status=1;
}else{
digitalWrite (6, LOW); // enough light - yellow led off
}
if (value_water > 700) {
digitalWrite (5, HIGH); // plant thirsty - blue led on
digitalWrite(pumpPin,HIGH);
delay(1000);
digitalWrite(pumpPin, LOW);
status=1;
}else{
digitalWrite (5, LOW); // soil is moist - blue led off
digitalWrite(pumpPin,LOW);
}
if(status==0) {
digitalWrite (2, HIGH);
delay(300); // wait for a second
digitalWrite(2, LOW); // turn the LED off by making the voltage LOW
tmrpcm.play("15sec.wav");
delay(10000);
// delay(300); // wait for a second);
}else{
digitalWrite (2, LOW);
}
}
void updateThingSpeak(String tsData) {
if (client.connect(thingSpeakAddress, 80)) {
client.print("POST /update HTTP/1.1\n");
client.print("Host: api.thingspeak.com\n");
client.print("Connection: close\n");
client.print("X-THINGSPEAKAPIKEY: " + APIKey + "\n");
client.print("Content-Type: application/x-www-form-urlencoded\n");
client.print("Content-Length: ");
client.print(tsData.length());
client.print("\n\n");
client.print(tsData);
lastConnectionTime = millis();
if (client.connected()) {
Serial.println("Connecting to ThingSpeak...");
Serial.println();
client.flush();
// client.stop();
}
}
}
void printWifiStatus() {
// print the SSID of the network you're attached to:
Serial.print("SSID: ");
Serial.println(WiFi.SSID());
// print your WiFi shield's IP address:
IPAddress ip = WiFi.localIP();
Serial.print("IP Address: ");
Serial.println(ip);
// print the received signal strength:
long rssi = WiFi.RSSI();
Serial.print("signal strength (RSSI):");
Serial.print(rssi);
Serial.println(" dBm");
}

Participated in the
Backyard Contest 2016
6 Comments
5 years ago
great stuff.!! are you familiar with my work.?
i can suggest updating to nodemcu + blynk to display data and control watering/light from smartphone
Reply 5 years ago
yeah bro, thanks a lot. will try to modify it soon :)
5 years ago
Great indoor gardening setup
Reply 5 years ago
thanks a lot! :D
5 years ago
Nice project! I am currently building something very similar (Instructable coming after the Instructable for my Boombox), and congrats for your award.
Reply 5 years ago
thanks bro, not yet complete, still in final exam week, will be continue after my final exam finish