Chest Freezer To Refrigerator Conversion: Difference between revisions

From Open Source Ecology
Jump to navigation Jump to search
No edit summary
No edit summary
Line 11: Line 11:
*[https://www.sparkfun.com/products/13244 USB Micro Cable] $1.95
*[https://www.sparkfun.com/products/13244 USB Micro Cable] $1.95
*[http://www.homedepot.com/p/4-in-x-4-in-x-2-in-PVC-Junction-Box-E989NNJ-CAR/100404097 Junction Box] $7.23
*[http://www.homedepot.com/p/4-in-x-4-in-x-2-in-PVC-Junction-Box-E989NNJ-CAR/100404097 Junction Box] $7.23
=Arduino Code=
<nowiki>
/*
  Blink
  Turns on an LED on for one second, then off for one second, repeatedly.
  Most Arduinos have an on-board LED you can control. On the Uno and
  Leonardo, it is attached to digital pin 13. If you're unsure what
  pin the on-board LED is connected to on your Arduino model, check
  the documentation at http://www.arduino.cc
  This example code is in the public domain.
  modified 8 May 2014
  by Scott Fitzgerald
*/
//A1 read voltage
//D3 sensor power
//D5 relay low
//D7 relay high
  volatile int sensorvalue = 330;
  int triggeron = 330;
  int triggeroff = 300;
void setup() {
  digitalWrite(3, HIGH);  // turn the LED on (HIGH is the voltage level)
  digitalWrite(7, LOW);    // initialize in OFF setting
  digitalWrite(5, LOW);    // set pin 5 low
  pinMode(3, OUTPUT);
  pinMode(7, OUTPUT);
  delay(20000);
}
// the loop function runs over and over again forever
void loop() {
  sensorvalue = analogRead(A1);  // turn the LED on (HIGH is the voltage level)
if (sensorvalue > triggeron){
  digitalWrite(7, HIGH);
  delay(8000);
}
if (triggeroff > sensorvalue){
  digitalWrite(7, LOW);
  delay(8000);
}
}
</nowiki>


=Other Options=
=Other Options=

Revision as of 00:32, 9 November 2016

BOM

Arduino Code

/*
  Blink
  Turns on an LED on for one second, then off for one second, repeatedly.

  Most Arduinos have an on-board LED you can control. On the Uno and
  Leonardo, it is attached to digital pin 13. If you're unsure what
  pin the on-board LED is connected to on your Arduino model, check
  the documentation at http://www.arduino.cc

  This example code is in the public domain.

  modified 8 May 2014
  by Scott Fitzgerald
 */

//A1 read voltage
//D3 sensor power
//D5 relay low
//D7 relay high

  volatile int sensorvalue = 330;
  int triggeron = 330;
  int triggeroff = 300;

void setup() {
  digitalWrite(3, HIGH);   // turn the LED on (HIGH is the voltage level)
  digitalWrite(7, LOW);    // initialize in OFF setting
  digitalWrite(5, LOW);    // set pin 5 low
  pinMode(3, OUTPUT);
  pinMode(7, OUTPUT);
  delay(20000);
}

// the loop function runs over and over again forever
void loop() {
  sensorvalue = analogRead(A1);   // turn the LED on (HIGH is the voltage level)
if (sensorvalue > triggeron){
  digitalWrite(7, HIGH);
  delay(8000);
}
if (triggeroff > sensorvalue){
  digitalWrite(7, LOW);
  delay(8000);
}
}

 

Other Options

Further Reading