Project showcase
Smart Connected Open Source Pot (Scopot)

Smart Connected Open Source Pot (Scopot) © GPL3+

A Smart Pot that has all the component inside of the pot and gives the light and humidity data to the web

  • 3,175 views
  • 1 comment
  • 29 respects

Components and supplies

Necessary tools and machines

Apps and online services

About this project

The pot will be using soil moisture sensor, a micro water pump, and an arduino mkr1000. Because of the small form factor of the arduino mkr1000, all the components needed to make this pot could fit into a 15 x 15 x 15 cm square box pot. To maintain the soil moisture a small water tank could be place inside the pot also making this look like a regular pot from the outside but smart inside the box. When the soil feels dry the water pump will automatically pump the water to the soil making its moisture back to its normal level

The soil moisture data could be uploaded to any iot platform but this time i Will use Ubidots service. Not only soil moisture data but also the activation of the water pump will be recorded. This could help to analyze different needs from different kind of plant.

The pot design was made from here (Credit: Akin Yildiz). But I Scale Up a bit to fit all my components.


Code

Scopot CodeArduino
Make sure you already have the arduino MKR1000 library
#include <SPI.h>
#include <WiFi101.h>

char ssid [] = "Wifi SSID";
char password [] = "Wifi Password";
int keyIndex = 0;
int status = WL_IDLE_STATUS;

#define errorPin 6
const int sleepTimeS = 20;// Time to sleep (in seconds):
long lastReadingTime = 0;
WiFiClient client;

String idvariable = "ubidots_variable_id";
String token = "ubidots_token";
int Relay = 12; 
const int sensorMin = 0;      // sensor minimum, discovered through experiment
const int sensorMax = 1023;    // sensor maximum, discovered through experiment

//////////////////////////////////////////////////////////////////////////////////

void setup(){

  pinMode(errorPin, OUTPUT);
  pinMode(Relay, OUTPUT);
  

  for (int i=0;i<4; i++){   // let know we are working
    digitalWrite(errorPin ,HIGH);
    delay(200);
    digitalWrite(errorPin ,LOW);
    delay(200);
  }

  // Create an instance of the server
  // specify the port to listen on as an argument

  WiFiServer server(80);
  Serial.begin(9600);
  delay(10);

 
   if (WiFi.status() == WL_NO_SHIELD) {
    Serial.println("WiFi shield not present");
    // don't continue:
    while (true);
  }
 int n = WiFi.scanNetworks();
  Serial.println("scan done");
 
  if (n == 0){
    Serial.println("no networks found");
    Serial.println("Going into sleep");
// ESP.deepSleep(sleepTimeS * 1000000);
  }

  while (status != WL_CONNECTED) {
    delay(500);
    Serial.print("Attempting to connect to SSID: ");
    Serial.println(ssid);
    status = WiFi.begin(ssid, password);
    delay(10000);
  }
  
  Serial.println("");
  Serial.println("WiFi connected");
  printWifiStatus();

  // Start the server
  server.begin();
  Serial.println("WiFi Server started");
 


}

////////////////////////////////////////////////////////////////////////////////

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");
}
void loop(){
  int value = (analogRead(A0));
  ubiSave_value(String(value));
  
  Serial.println("Ubidots data");
  Serial.println(value);
  Serial.println(" Going to Sleep for a while !" );

 
  delay(10000);// change this for the upload data time to ubidots 
  
}

void ubiSave_value(String value) {
  // if you get a connection, report back via serial:
  int num=0;
  String var = "{\"value\": " + String(value)+"}";
  num = var.length();
  if (client.connect("things.ubidots.com", 80)) {
    Serial.println("connected ubidots");
    delay(100);
    client.println("POST /api/v1.6/variables/"+idvariable+"/values HTTP/1.1");
    Serial.println("POST /api/v1.6/variables/"+idvariable+"/values HTTP/1.1");
    client.println("Content-Type: application/json");
    Serial.println("Content-Type: application/json");
    client.println("Content-Length: "+String(num));
    Serial.println("Content-Length: "+String(num));
    client.println("X-Auth-Token: "+token);
    Serial.println("X-Auth-Token: "+token);
    client.println("Host: things.ubidots.com\n");
    Serial.println("Host: things.ubidots.com\n");
    client.print(var);
    Serial.print(var+"\n");

  }
  else {
    // if you didn't get a connection to the server:
    Serial.println("ubidots connection failed");
  }

  if (!client.connected()) {
    Serial.println("NotConnected");
    Serial.println("disconnecting ubidots.");
    client.stop();
    // do nothing forevermore:
    for(;;);
  }

  if (client.available()) {
    char c = client.read();
    Serial.print(c);
  }
}

Schematics

Scopot Fritzing
Scopot%20fritz

Comments

Similar projects you might like

Smart Garden

Project showcase by patel Dipen

  • 22,301 views
  • 15 comments
  • 59 respects

Smart Home Mini Arduino - In 30 Minutes - Posting in Ubidots

Project tutorial by Andre Mendes

  • 15,149 views
  • 2 comments
  • 29 respects

Smart auto-dispensing pillbox

Project showcase by Audrey Leung

  • 9,116 views
  • 9 comments
  • 38 respects

Smart IOT Propane Monitoring Pedestal

Project in progress by Team A Bit Gassy

  • 1,282 views
  • 1 comment
  • 12 respects

Smart Garbage Monitoring System Using Arduino 101

Project tutorial by Technovation

  • 21,404 views
  • 7 comments
  • 32 respects

Arduino-Powered Smart Light (Works with Amazon Echo)

Project tutorial by Tinker Project

  • 14,710 views
  • 7 comments
  • 29 respects
Add projectSign up / Login