I want to create this project >
if the temperature controller is
37.8 C then close the light
if the temperature controller is
< 37.7 open the Light
any help to programming this fuction?
I want to create this project >
if the temperature controller is
37.8 C then close the light
if the temperature controller is
< 37.7 open the Light
any help to programming this fuction?
Start with something easy. Do you know how to read the value of the temperature sensor ?
Do you already have a temperature sensor and, if so, which one ?
Have you done anything with the Arduino previously ?
Do you know what you are doing when it comes to mains voltage, it can be lethal.
Especially placing a switch or relay contact in the 240 VAC Return or Neutral Wire...
VERY BAD PRACTICE..
..
Ensure your relay is opto isolated.
Change your relay to switch on the hot side as opposed to the neutral side.
Adding a small cap between Vin and GND for your sensor will most likely give you better results, as this will help reduce RFI.
Then check this site out on how to convert your analog signal into tempterature, premise is analog returns 0-1023, which is quantised 0-5v, your sensor gives you values between 0-1.75v for its temperature range:
Then the programming part should be straightforward, simple case of checking if the return temperature is less than set amount and sending the signal to open the relay.
My advice would be don't play with mains electricity if you don't know what you're doing ( which clearly you don't ).
Experiment with LEDs or 12v bulbs instead.
Anything powerful enough to create heat will probalby have enought power to be fire risk. Learn about fuses.
Are really trying to control the temp of the light bulb envelop ?
My guess from the temperature values is this is some kind of incubator so you maybe need to be testing the air temp not the bulb temp.
Again, find out what you're doing before playing with potentially lethal equipment, otherwise you'll end up frying the baby, the hatchlings or yourself.
:o
tammytam:
Ensure your relay is opto isolated.Change your relay to switch on the hot side as opposed to the neutral side.
Adding a small cap between Vin and GND for your sensor will most likely give you better results, as this will help reduce RFI.
Then check this site out on how to convert your analog signal into tempterature, premise is analog returns 0-1023, which is quantised 0-5v, your sensor gives you values between 0-1.75v for its temperature range:
Then the programming part should be straightforward, simple case of checking if the return temperature is less than set amount and sending the signal to open the relay.
The arduino has an internal temp sensor which is accessible via one of the ADC inputs ( one not connected to an external pin) , so maybe strapping the arduino close to the bulb would remove the need to interface with an external sensor.
If this is for incubating chicken eggs you want to make the bulb more distant and sense the air temp. They don't want be irradiated from one side but cold on the other.
If you're just looking for a fun project to learn about Ardiuino and electronics, don't start by experimenting with living things.
i use the RHT03 temperature and humility sensor, and the code to read temp + humanity in serial monitor is :
// Example testing sketch for various DHT humidity/temperature sensors
// Written by ladyada, public domain#include "DHT.h"
#define DHTPIN 2 // what pin we're connected to
// Uncomment whatever type you're using!
//#define DHTTYPE DHT11 // DHT 11
#define DHTTYPE DHT22 // DHT 22 (AM2302)
//#define DHTTYPE DHT21 // DHT 21 (AM2301)// Connect pin 1 (on the left) of the sensor to +5V
// NOTE: If using a board with 3.3V logic like an Arduino Due connect pin 1
// to 3.3V instead of 5V!
// Connect pin 2 of the sensor to whatever your DHTPIN is
// Connect pin 4 (on the right) of the sensor to GROUND
// Connect a 10K resistor from pin 2 (data) to pin 1 (power) of the sensor// Initialize DHT sensor.
// Note that older versions of this library took an optional third parameter to
// tweak the timings for faster processors. This parameter is no longer needed
// as the current DHT reading algorithm adjusts itself to work on faster procs.
DHT dht(DHTPIN, DHTTYPE);void setup() {
Serial.begin(9600);
Serial.println("DHTxx test!");dht.begin();
}void loop() {
// Wait a few seconds between measurements.
delay(2000);// Reading temperature or humidity takes about 250 milliseconds!
// Sensor readings may also be up to 2 seconds 'old' (its a very slow sensor)
float h = dht.readHumidity();
// Read temperature as Celsius (the default)
float t = dht.readTemperature();
// Read temperature as Fahrenheit (isFahrenheit = true)
float f = dht.readTemperature(true);// Check if any reads failed and exit early (to try again).
if (isnan(h) || isnan(t) || isnan(f)) {
Serial.println("Failed to read from DHT sensor!");
return;
}// Compute heat index in Fahrenheit (the default)
float hif = dht.computeHeatIndex(f, h);
// Compute heat index in Celsius (isFahreheit = false)
float hic = dht.computeHeatIndex(t, h, false);Serial.print("Humidity: ");
Serial.print(h);
Serial.print(" %\t");
Serial.print("Temperature: ");
Serial.print(t);
Serial.print(" *C ");
Serial.print(f);
Serial.print(" *F\t");
Serial.print("Heat index: ");
Serial.print(hic);
Serial.print(" *C ");
Serial.print(hif);
Serial.println(" *F");
}
now i need if / else function? if temperature is < = 27.5 C open lamp (gnd + pin 9 = 1 close ssr) else if temperature is > 27.8 open the ssr gnd + pin 9 = 0 ?
is that correct??
hackertom:
now i need if / else function? if temperature is < = 27.5 C open lamp (gnd + pin 9 = 1 close ssr) else if temperature is > 27.8 open the ssr gnd + pin 9 = 0 ?
is that correct??
Yes.
But you should google hysteresis.
// Read temperature as Celsius (the default)
float t = dht.readTemperature();
// Read temperature as Fahrenheit (isFahrenheit = true)
float f = dht.readTemperature(true);
Haven't figured out which system your country uses yet?