Difference between revisions of "Henmulator"

From RAWiki
Jump to: navigation, search
Line 4: Line 4:
 
The '''Henmulator''' (hen ''emulator'') is [[Agronomo]] and [[Jacob Springs Farm]]'s inaugural project to incorporate open source hardware and software into useful farm devices.
 
The '''Henmulator''' (hen ''emulator'') is [[Agronomo]] and [[Jacob Springs Farm]]'s inaugural project to incorporate open source hardware and software into useful farm devices.
  
 +
==Earlier versions==
 +
Mike Soltys' engineering class.
 +
 +
==Enclosure==
 
==Arduino Code==
 
==Arduino Code==
  
Line 10: Line 14:
 
<nowiki>
 
<nowiki>
 
/*
 
/*
 +
 
  *
 
  *
 +
 
  * Hardware
 
  * Hardware
 +
 
  * - Arduino hardware (@todo)
 
  * - Arduino hardware (@todo)
 +
 
  * - HTU21D
 
  * - HTU21D
 +
 
  *
 
  *
 +
 
  * Ardunio (@todo)
 
  * Ardunio (@todo)
 +
 
  *
 
  *
 +
 
  *
 
  *
 +
 
  * HTU21D
 
  * HTU21D
 +
 
  * SparkFun HTU21D Humidity sensor.
 
  * SparkFun HTU21D Humidity sensor.
 +
 
  * Link to SparkFun's underlying firmware and example code.
 
  * Link to SparkFun's underlying firmware and example code.
 +
 
  * https://github.com/sparkfun/HTU21D_Breakout
 
  * https://github.com/sparkfun/HTU21D_Breakout
 +
 
  *
 
  *
 +
 
  */
 
  */
 +
 +
  
 
// included Arduino libraries
 
// included Arduino libraries
 +
 
#include <HTU21D.h>
 
#include <HTU21D.h>
 +
 +
  
 
// global constants
 
// global constants
 +
 
#define UPPER_TEMP_THRESHOLD 38 //ideal is 37.5 for hatching 15.5 for holding
 
#define UPPER_TEMP_THRESHOLD 38 //ideal is 37.5 for hatching 15.5 for holding
 +
 
#define LOWER_TEMP_THRESHOLD 37 //ideal is 37.2 for hatching 13 for holding
 
#define LOWER_TEMP_THRESHOLD 37 //ideal is 37.2 for hatching 13 for holding
 +
 +
  
 
// local variables
 
// local variables
 +
 
int lightState = HIGH;
 
int lightState = HIGH;
 +
 
int humidState = HIGH;
 
int humidState = HIGH;
 +
 
int lightPin = 11;
 
int lightPin = 11;
 +
 
int humidPin = 13;
 
int humidPin = 13;
 +
 +
  
 
HTU21D sensorchip;
 
HTU21D sensorchip;
 +
 +
  
 
void setup()
 
void setup()
 +
 
{
 
{
 +
 
   Serial.begin(9600);
 
   Serial.begin(9600);
 +
 
   sensorchip.begin();
 
   sensorchip.begin();
 +
 
   pinMode (lightPin, OUTPUT);
 
   pinMode (lightPin, OUTPUT);
 +
 
   pinMode (humidPin, OUTPUT);
 
   pinMode (humidPin, OUTPUT);
 +
 
   digitalWrite(lightPin, lightState);
 
   digitalWrite(lightPin, lightState);
 +
 
   digitalWrite(humidPin, humidState);
 
   digitalWrite(humidPin, humidState);
 +
 
}
 
}
 +
 +
  
 
void loop() {
 
void loop() {
 +
 
   // temperature
 
   // temperature
 +
 
   float temp = sensorchip.readTemperature();
 
   float temp = sensorchip.readTemperature();
 +
 
   if (temp == 988) {
 
   if (temp == 988) {
 +
 
     return;
 
     return;
 +
 
   }
 
   }
 +
 
   else if (temp > UPPER_TEMP_THRESHOLD)
 
   else if (temp > UPPER_TEMP_THRESHOLD)
 +
 
   {
 
   {
 +
 
     lightState = LOW;
 
     lightState = LOW;
 +
 
     digitalWrite(lightPin, lightState);
 
     digitalWrite(lightPin, lightState);
 +
 
   }
 
   }
 +
 
   else if(temp < LOWER_TEMP_THRESHOLD)
 
   else if(temp < LOWER_TEMP_THRESHOLD)
 +
 
   {
 
   {
 +
 
     lightState = HIGH;
 
     lightState = HIGH;
 +
 
     digitalWrite(lightPin, lightState);
 
     digitalWrite(lightPin, lightState);
 +
 
   }
 
   }
 +
 +
  
 
   // humidity
 
   // humidity
 +
 
   float humidity = sensorchip.readHumidity();
 
   float humidity = sensorchip.readHumidity();
 +
 
   if (temp == 988) {
 
   if (temp == 988) {
 +
 
     return;
 
     return;
 +
 
   }
 
   }
 +
 
   else if (temp > UPPER_TEMP_THRESHOLD)
 
   else if (temp > UPPER_TEMP_THRESHOLD)
 +
 
   {
 
   {
 +
 
     lightState = LOW;
 
     lightState = LOW;
 +
 
     digitalWrite(lightPin, lightState);
 
     digitalWrite(lightPin, lightState);
 +
 
   }
 
   }
 +
 
   else if(temp < LOWER_TEMP_THRESHOLD)
 
   else if(temp < LOWER_TEMP_THRESHOLD)
 +
 
   {
 
   {
 +
 
     lightState = HIGH;
 
     lightState = HIGH;
 +
 +
 +
 
     digitalWrite(lightPin, lightState);
 
     digitalWrite(lightPin, lightState);
 +
 
   }
 
   }
 +
 
} </nowiki>
 
} </nowiki>

Revision as of 11:52, 7 February 2015

Jacob Springs and Agronomo's prototype Henmulator arduino controlled incubator


The Henmulator (hen emulator) is Agronomo and Jacob Springs Farm's inaugural project to incorporate open source hardware and software into useful farm devices.

Earlier versions

Mike Soltys' engineering class.

Enclosure

Arduino Code

The following is the arduino code for the first working version of the henmulator

/* * * Hardware * - Arduino hardware (@todo) * - HTU21D * * Ardunio (@todo) * * * HTU21D * SparkFun HTU21D Humidity sensor. * Link to SparkFun's underlying firmware and example code. * https://github.com/sparkfun/HTU21D_Breakout * */ // included Arduino libraries #include <HTU21D.h> // global constants #define UPPER_TEMP_THRESHOLD 38 //ideal is 37.5 for hatching 15.5 for holding #define LOWER_TEMP_THRESHOLD 37 //ideal is 37.2 for hatching 13 for holding // local variables int lightState = HIGH; int humidState = HIGH; int lightPin = 11; int humidPin = 13; HTU21D sensorchip; void setup() { Serial.begin(9600); sensorchip.begin(); pinMode (lightPin, OUTPUT); pinMode (humidPin, OUTPUT); digitalWrite(lightPin, lightState); digitalWrite(humidPin, humidState); } void loop() { // temperature float temp = sensorchip.readTemperature(); if (temp == 988) { return; } else if (temp > UPPER_TEMP_THRESHOLD) { lightState = LOW; digitalWrite(lightPin, lightState); } else if(temp < LOWER_TEMP_THRESHOLD) { lightState = HIGH; digitalWrite(lightPin, lightState); } // humidity float humidity = sensorchip.readHumidity(); if (temp == 988) { return; } else if (temp > UPPER_TEMP_THRESHOLD) { lightState = LOW; digitalWrite(lightPin, lightState); } else if(temp < LOWER_TEMP_THRESHOLD) { lightState = HIGH; digitalWrite(lightPin, lightState); } }