Difference between revisions of "Henmulator"

From RAWiki
Jump to: navigation, search
(Created page with "[[Jacob Springs and Agronomo's prototype '''Henmulator''' arduino controlled incubator]]")
 
Line 1: Line 1:
 
[[Image:HenMulator.jpg|thumb|[[Jacob Springs]] and [[Agronomo]]'s prototype '''[[Henmulator]]''' [[arduino]] controlled incubator]]
 
[[Image:HenMulator.jpg|thumb|[[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.
 +
 +
==Arduino Code==
 +
 +
The following is the arduino code for the first working version of the henmulator
 +
 +
<nowiki>
 +
/*
 +
*
 +
* 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);
 +
  }
 +
} </nowiki>

Revision as of 11:49, 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.

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); } }