MotasGoat
Published © MPL-2.0

LT_Ovalle Temp & Time Sensitive Automatic Light Switch

Bearded Dragon Tank Heat and Light controlled by Temperature Sensor and Clock, automating environment control within the tank.

IntermediateFull instructions provided20
LT_Ovalle Temp & Time Sensitive Automatic Light Switch

Things used in this project

Hardware components

Photon 2
Particle Photon 2
×1
SG90 Micro-servo motor
SG90 Micro-servo motor
×2
NTC Thermistor Resistor MF52-103
×1
Copper Wire
×16
Resistor 10k ohm
Resistor 10k ohm
×1
Breadboard (generic)
Breadboard (generic)
×2
Wooden Slab
×2
Duct Tape
×1

Software apps and online services

Particle Build Web IDE
Particle Build Web IDE

Story

Read more

Schematics

Complete Schematic

NTC Thermistor Schematic

Code

Code For Photon

C/C++
To sense and control the temperature and time using the Photon as well as using the SRS Thermistor Formula to convert the readings from the thermistor to temperature values.
Servo myServo1;
Servo myServo2;
int ThermistorPin = 12; // digital pin for reading thermistor
int Vo; 
float R1 = 10000; // Normal Resistance
float logR2, R2, T, Tc, Tf;
float c1 = 16.59490821e-03, c2 = -23.35666205e-04, c3 = 103.1153499e-07; // SRS Thermistor Calculator Constants

void setup() {
Serial.begin(9600); // Serial output solely for debugging (Highly Reccomended)
myServo1.attach(13); // Servo Pins 
myServo2.attach(14); 
myServo1.write(0);
myServo2.write(0);

}

void loop() {
  Time.zone(-6); // Central Time Zone
  Vo = analogRead(ThermistorPin); // Raw Thermistor ADC Value
  R2 = R1 * (1023.0 / (float)Vo - 1.0); // Resistance read from Thermistor
  logR2 = log(R2);
  T = (1.0 / (c1 + c2*logR2 + c3*logR2*logR2*logR2)); // Resistancee to Temperature Conversion (Kelvin)
  Tc = T - 273.15; // Kelvin to Celsius
  Tf = (Tc * 9.0)/ 5.0 + 32.0;  // Celsius to Farenheit
  Serial.print(R2); // Printing of Resistance (Debugging)
  Serial.print("Time :"); // Printing of time (Debugging)
  Serial.print(Time.hour());
  Serial.print("Temperature: "); // Printing of Temperature in Farenheit (Debugging)
  Serial.print(Tf);
  Serial.print(" F; ");
  if (Tf < 80) // Temperature Parameters for Control
  {
    myServo1.write(80); // Turns On Heat Lamp
    delay(3000);
  }
  else if (Tf > 100){
      myServo1.write(0); // Turns Off Heat Lamp
  }
  if (Time.hour() == 6) // Time Parameters for Control
  {
      myServo2.write(100); // Turns On UV Light
  }
  if (Time.hour() == 18)
  {
      myServo2.write(0); // Turns Off UV Light
      delay(3000);
  }
  delay(500);
}

Credits

MotasGoat
1 project • 0 followers
Contact

Comments

Please log in or sign up to comment.