Things used in this project

Hardware components:
Photon new
Particle Photon
×1
12002 04
Breadboard (generic)
×1
11026 02
Jumper wires (generic)
×1
SparkFun carbon monoxide sensor
×1
SparkFun hydrogen gas sensor
×1
SparkFun uv sensor
×1
Adafruit temperature and humidity sensor
×1
Acrylic (generic)
×1
Software apps and online services:
Adafruit Particle.io
Hand tools and fabrication machines:
Lasercutter
Laser cutter (generic)

Custom parts and enclosures

Enclosure
This is the plans for our enclosure in Adobe Illustrator. These can be cut out of acrylic on a laser cutter.
enclosure_0t5hVPZB8b.ai
Enclosure Diagram
14f2d5ac385c4c14bddca8412a6df18a zlx5nklbgv

Schematics

Greenhouse
Screen shot 2017 03 20 at 11 32 21 am b1uylvcift

Code

Hydrogen Sensor CodeArduino
Used to sense levels of hydrogen in the surrounding area.
//Takes an average of readings on a given pin
//Returns the average

int sensorValue;

void setup()
{
  Serial.begin(9600);      // sets the serial port to 9600
}

void loop()
{
  sensorValue = analogRead(0);       // read analog input pin 0
  Serial.println(sensorValue, DEC);  // prints the value read
  delay(1000);                        // wait 100ms for next reading
}


//The Arduino Map function but for floats
//From: http://forum.arduino.cc/index.php?topic=3922.0
float mapfloat(float x, float in_min, float in_max, float out_min, float out_max)
{
  return (x - in_min) * (out_max - out_min) / (in_max - in_min) + out_min;
}
Carbon Monoxide Sensor CodeArduino
Used to sense Carbon Monoxide levels in the surrounding area.
//Takes an average of readings on a given pin
//Returns the average

int sensorValue;

void setup()
{
  Serial.begin(9600);      // sets the serial port to 9600
}

void loop()
{
  sensorValue = analogRead(0);       // read analog input pin 0
  Serial.println(sensorValue, DEC);  // prints the value read
  delay(1000);                        // wait 100ms for next reading
}


//The Arduino Map function but for floats
//From: http://forum.arduino.cc/index.php?topic=3922.0
float mapfloat(float x, float in_min, float in_max, float out_min, float out_max)
{
  return (x - in_min) * (out_max - out_min) / (in_max - in_min) + out_min;
}
UV sensor codeArduino
Used to sense ultraviolet wavelength levels in the surrounding area.
int UVOUT = A0; //Output from the sensor
int REF_3V3 = A1; //3.3V power on the Arduino board

void setup()
{
  Serial.begin(9600);

  pinMode(UVOUT, INPUT);
  pinMode(REF_3V3, INPUT);

  Serial.println("ML8511 example");
}

void loop()
{
  int uvLevel = averageAnalogRead(UVOUT);
  int refLevel = averageAnalogRead(REF_3V3);

  //Use the 3.3V power pin as a reference to get a very accurate output value from sensor
  float outputVoltage = 3.3 / refLevel * uvLevel;

  float uvIntensity = mapfloat(outputVoltage, 0.99, 2.8, 0.0, 15.0); //Convert the voltage to a UV intensity level

  Serial.print("output: ");
  Serial.print(refLevel);

  Serial.print("ML8511 output: ");
  Serial.print(uvLevel);

  Serial.print(" / ML8511 voltage: ");
  Serial.print(outputVoltage);

  Serial.print(" / UV Intensity (mW/cm^2): ");
  Serial.print(uvIntensity);

  Serial.println();

  delay(100);
}

//Takes an average of readings on a given pin
//Returns the average
int averageAnalogRead(int pinToRead)
{
  byte numberOfReadings = 8;
  unsigned int runningValue = 0; 

  for(int x = 0 ; x < numberOfReadings ; x++)
    runningValue += analogRead(pinToRead);
  runningValue /= numberOfReadings;

  return(runningValue);  
}

//The Arduino Map function but for floats
//From: http://forum.arduino.cc/index.php?topic=3922.0
float mapfloat(float x, float in_min, float in_max, float out_min, float out_max)
{
  return (x - in_min) * (out_max - out_min) / (in_max - in_min) + out_min;
}
Greenhouse Measurement codeArduino
// This #include statement was automatically added by the Particle IDE.
#include <Adafruit_DHT.h>

 //bool WiFi.antennaSelect(AUTO | INTERNAL | EXTERNAL);
    
    //Takes an average of readings on a given pin
    //Returns the average
    //Output from the sensor
    int REF_3V3 = A1; //3.3V power on the Arduino board
    #define DHTPIN 4            // what pin we're connected to
    #define DHTTYPE DHT22 
 //  DHT 22 (AM2302);
    
    DHT dht(DHTPIN, DHTTYPE);
    
    double hum;                 // current hum
    double temp;     
    int sensorValueC;
    int sensorValueH;
    int UVOUT = A0;
    double  uvLevel = averageAnalogRead(UVOUT);// 
    void setup()
    {
      Serial.begin(9600);
    
      pinMode(UVOUT, INPUT);
      pinMode(REF_3V3, INPUT);
    
      Serial.println("ML8511 example");
      pinMode(DHTPIN, INPUT);
        
        Particle.variable("hum", hum);
        Particle.variable("temp", temp);
        Particle.variable("sensorValueC", sensorValueC);
        Particle.variable("sensorValueH", sensorValueH);
        Particle.variable("UVOUT", UVOUT);
    }
 
    
    
    
    void loop() {    
        
      int refLevel = averageAnalogRead(REF_3V3);
        double checkHum = dht.getHumidity();
        double checkTemp = dht.getTempFarenheit();
        
        if (checkHum > 0 && checkHum < 100)
            hum = checkHum;
            
        if (checkTemp > 32 && checkTemp < 100)
            temp = checkTemp;
        
        Serial.println("Temp: " + String(checkTemp));
        Serial.println("Hum: " + String(checkHum));
            
        delay(3000);
        
      sensorValueC= analogRead(0);       // read analog input pin 0
      Serial.println(sensorValueC, DEC);  // prints the value read
      delay(1000);           
       sensorValueH = analogRead(0);       // read analog input pin 0
      Serial.println(sensorValueH, DEC);  // prints the value read
      delay(1000);       
      float outputVoltage = 3.3 / refLevel * uvLevel;
    
      float uvIntensity = mapfloat(outputVoltage, 0.99, 2.8, 0.0, 15.0); //Convert the voltage to a UV intensity level
    
      Serial.print("output: ");
      Serial.print(refLevel);
    
      Serial.print("ML8511 output: ");
      Serial.print(uvLevel);
    
      Serial.print(" / UV Intensity (mW/cm^2): ");
      Serial.print(uvIntensity);
    
      Serial.println();
    
      delay(1000);
    }
    
   
    
    int averageAnalogRead(int pinToRead)
    {
      byte numberOfReadings = 8;
      unsigned int runningValue = 0; 
    
      for(int x = 0 ; x < numberOfReadings ; x++)
        runningValue += analogRead(pinToRead);
      runningValue /= numberOfReadings;
    
      return(runningValue);  
    }
    
    //The Arduino Map function but for floats
    //From: http://forum.arduino.cc/index.php?topic=3922.0
    float mapfloat(float x, float in_min, float in_max, float out_min, float out_max)
    {
      return (x - in_min) * (out_max - out_min) / (in_max - in_min) + out_min;
    }
    

Credits

3f5a00acf72df93528b6bb7cd0a4fd0c
Michael Ulie
1 project • 0 followers
LT student
Contact
36fda086440aa43dd1549289b5b302d1
Joseline Pintado
1 project • 0 followers
Contact
C7c3b9cd3543b412b779fa4e090ffe93
Anthony Irizarry
1 project • 0 followers
Contact

Replications

Did you replicate this project? Share it!

I made one

Love this project? Think it could be improved? Tell us what you think!

Give feedback

Comments

Sign up / LoginProjectsPlatformsTopicsContestsLiveAppsBetaBlog