amsfofanaBrittany CurrieKhalid Bedaiwi
Published © CC BY-NC

MEGR 3171: Smart Planter

It helps detect when a plant was too cold/hot if it was getting enough light, and if it needed water.

BeginnerFull instructions provided5 hours442
MEGR 3171: Smart Planter

Things used in this project

Hardware components

Argon
Particle Argon
×3
Grove - Light Sensor
Seeed Studio Grove - Light Sensor
×1
Grove - Temperature Sensor
Seeed Studio Grove - Temperature Sensor
×1
Seeed Studio Grove - Capacitive Soil Moisture Sensor
×1
Seeed Studio Grove - 4 pin Male Jumper to Grove 4 pin Conversion Cable
×1
Solderless Breadboard Half Size
Solderless Breadboard Half Size
×1

Software apps and online services

Ubidots
Ubidots
Particle Build Web IDE
Particle Build Web IDE

Hand tools and fabrication machines

3D Printer (generic)
3D Printer (generic)

Story

Read more

Custom parts and enclosures

Smart Planter Top

This is the part the plant goes in.

Smart Planter Bottom

This is the part the argon goes in.

Smart Planter Top .stl

This is the stl file for the top part of the planter.

Smart Planter Bottom .stl

this is the stl file for the bottom part of the planter.

Schematics

Planter Argon Circuit

This diagram shows how to wire the sensors to the argon inside the planter. Note any additional argons don't need to be wired to anything just plugged into a computer that can receive serial signals.

Communication Flow Chart

This chart shows how the three argons communicate with each other and share data.

Code

Share Data 1

Arduino
This is the code to share planter data with one additional argon.
void setup() {
    pinMode(D7, OUTPUT);
    Particle.subscribe("Sent", sent, MY_DEVICES);
    Particle.subscribe("Light Level", lightLevelRecived, MY_DEVICES);
    Particle.subscribe("Moisture Level", MoistLevelRecived, MY_DEVICES);
    Particle.subscribe("Temp Level", tempRecived, MY_DEVICES);
}

void loop() {
    Serial.begin(9600);
}

//Take recived data and output it to serial
void lightLevelRecived(const char *event, const char *data) {
    Serial.print("Light Level: ");
    Serial.println(data);
}

void MoistLevelRecived(const char *event, const char *data) {
    Serial.print("Moisture Level: ");
    Serial.println(data);
}

void tempRecived(const char *event, const char *data) {
    Serial.print("Temp: ");
    Serial.println(data);
}

//Blink twice once data is sent and say its revived
void sent(const char *event, const char *data) {
    digitalWrite(D7, HIGH);
    delay(500);
    digitalWrite(D7, LOW);
    delay(500);
    digitalWrite(D7, HIGH);
    delay(500);
    digitalWrite(D7, LOW);
    Particle.publish("1 Recived", PRIVATE);
}

Planter Code

Arduino
This is the code for the Argon in the planter.
#include "Ubidots.h"


const char *WEBHOOK_NAME = "Ubidots";
Ubidots ubidots("webhook", UBI_PARTICLE);


void setup()
{
  pinMode(D7, OUTPUT);
  Particle.subscribe("1 Recived", recived1, MY_DEVICES);
  Particle.subscribe("2 Recived", recived2, MY_DEVICES);
}

void loop()
{
    //Read Light Sensor
    double lightAnalogVal = analogRead(A0);
    float lightLevel = map(lightAnalogVal, 0.0, 4095.0, 0.0, 100.0);
    
    //Read Moisture Sensor
    double MoistAnalogVal = analogRead(A1);
    float MoistLevel = map(MoistAnalogVal, 0.0, 4095.0, 0.0, 100.0);
    
    //Read the input and convert to C
    float a = analogRead(A2);
    float temp=a/100;
    
    //Send data to Ubidots to graph
    ubidots.add("Light", lightLevel); 
    ubidots.add("Moisture", MoistLevel);
    ubidots.add("Temp", temp);
    delay(1000);
    
    //Send data to orthe argons
    Particle.publish("Light Level", String(lightLevel), PRIVATE);
    delay(1000);
    Particle.publish("Moisture Level", String(MoistLevel), PRIVATE);
    delay(1000);
    Particle.publish("Temp Level", String(temp), PRIVATE);
    delay(1000);
    
    //say its been sent
    Particle.publish("Sent", PRIVATE);
    
    bool bufferSent = false;

    bufferSent = ubidots.send(WEBHOOK_NAME, PUBLIC); // Will use particle webhooks to send data

    //Wait 1m 4sec befor sending new data 
    delay(64000);
}

//Blink twice to say data has been recived by argon 1
void recived1(const char *event, const char *data) {
    digitalWrite(D7, HIGH);
    delay(500);
    digitalWrite(D7, LOW);
    delay(500);
    digitalWrite(D7, HIGH);
    delay(500);
    digitalWrite(D7, LOW);
    delay(1000);
}

//Blink twice to say data has been recived by argon 2
void recived2(const char *event, const char *data) {
    digitalWrite(D7, HIGH);
    delay(500);
    digitalWrite(D7, LOW);
    delay(500);
    digitalWrite(D7, HIGH);
    delay(500);
    digitalWrite(D7, LOW);
    delay(1000);
}

Share Data 2

Arduino
This is the code to share planter data with the second additional argon.
void setup() {
    pinMode(D7, OUTPUT);
    Particle.subscribe("Sent", sent, MY_DEVICES);
    Particle.subscribe("Light Level", lightLevelRecived, MY_DEVICES);
    Particle.subscribe("Moisture Level", MoistLevelRecived, MY_DEVICES);
    Particle.subscribe("Temp Level", tempRecived, MY_DEVICES);
}

void loop() {
    Serial.begin(9600);
}

//Take recived data and output it to serial
void lightLevelRecived(const char *event, const char *data) {
    Serial.print("Light Level: ");
    Serial.println(data);
}

void MoistLevelRecived(const char *event, const char *data) {
    Serial.print("Moisture Level: ");
    Serial.println(data);
}

void tempRecived(const char *event, const char *data) {
    Serial.print("Temp: ");
    Serial.println(data);
}

//Blink twice once data is sent and say its revived
void sent(const char *event, const char *data) {
    digitalWrite(D7, HIGH);
    delay(500);
    digitalWrite(D7, LOW);
    delay(500);
    digitalWrite(D7, HIGH);
    delay(500);
    digitalWrite(D7, LOW);
    Particle.publish("2 Recived", PRIVATE);
}

Credits

amsfofana

amsfofana

1 project • 0 followers
Studying Mechanical Engineering student
Brittany Currie

Brittany Currie

1 project • 4 followers
Mechanical engineering student at The University of North Carolina at Charlotte.
Khalid Bedaiwi

Khalid Bedaiwi

1 project • 0 followers

Comments

Add projectSign up / Login