I am currently working for a project which is built an arduino based incubator. however, there are several problems tat i meet. I need help urgently since de due date of my project is coming soon. I am not sure what is happening. the problems are:
The lcd 1602 not show any values that i program which are temperature and humidity.
The arduino mega will auto restart after several minutes or hours.
Sorry guys.. i am a newbie to arduino and also tis forum. i haven done the schematic diagram. i will upload it once i am done. thx to Larry for giving guidance.
#include <LiquidCrystal.h>
#include <PID_v1.h>
#include "DHT.h"
#define temLowTrigger 37.8 //Setting the trigger value for the temperture, once the temperture lower than this trigger value, the heater band will start heating
#define humLowTrigger 45 //Setting the trigger value for the humidity, once the humidity lower than this value, start humidification
#define DHTPIN A2 // 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
// 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
const int relay1 = 12; // the number of the relay 1 pin(motor)
const int relay2 = 13; // the number of the relay 2 pin(light bulb)
const int relay3 = 11;
int motorState=LOW; //motorstate used to set the motor state
unsigned long previousMillis=0; //will store last time motor was update
long OnTime=5000; //milliseconds of on-time
long OffTime=28800000; //milliseconds of off-time
DHT dht(DHTPIN, DHTTYPE);
//Pin assignments for DFRobot LCD Keypad Shield
LiquidCrystal lcd(8, 9, 4, 5, 6, 7);
//---------------------------------------------
void setup()
{
pinMode(relay1, OUTPUT);
pinMode(relay2, OUTPUT);
pinMode(relay3, OUTPUT);
lcd.begin(16, 2);
lcd.clear();
lcd.setCursor(0, 0);
lcd.print("initializing...");
lcd.setCursor(0, 1);
delay(1000);
Serial.begin(9600);
dht.begin();
delay(1000);
lcd.clear();
digitalWrite(relay1,HIGH);
digitalWrite(relay3, LOW);
digitalWrite(relay2, HIGH);
}
void loop()
{
// 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();
float t = dht.readTemperature();
// check if returns are valid, if they are NaN (not a number) then something went wrong!
if (isnan(t) || isnan(h)) {
Serial.println("error");
} else {
//Display
lcd.setCursor(0, 0);
lcd.print("H: ");
lcd.print(h);
lcd.setCursor(9, 0);
lcd.print("T: ");
lcd.print(t);
if(t < temLowTrigger)
digitalWrite(relay2, LOW);//start heating
else
digitalWrite(relay2, HIGH);
if(h< humLowTrigger)
digitalWrite(relay3, HIGH);
else
digitalWrite(relay3,LOW);
unsigned long currentMillis=millis();
if((motorState == HIGH) && (currentMillis - previousMillis >= OnTime))
{
motorState=LOW; //turn it off
previousMillis = currentMillis; //remember the time
digitalWrite(relay1,motorState); //update the actual motor state
}
else if ((motorState==LOW) && (currentMillis-previousMillis >=OffTime))
{
motorState = HIGH; //turn it on
previousMillis = currentMillis; //remember the time
digitalWrite(relay1,motorState); //update the actual LED
}
} }
What voltage is coming in from the barrel jack? Try a lower voltage, down to 7.5V.
Overheated regulator will go into thermal shutdown, then turn back on when it cools down. Then off, on, off, on.
You should be able to monitor the voltage with a meter and confirm.
240V for the light bulb and synchronous motor to turn the egg turner in interval of 8 hours once.
an ac-dc adapter for fan.. however, the ac-dc adapter i also plug into a dc-dc stepdown for humidifier
Okay Larry.. I am working on the schematic diagram..
Cross Roads,
I already measured the voltage from the regulator which is 4.96V.. but the board haven reset itself yet.. thus, i cannot measure it is there any voltage drop when the board is reset.. can i know the reason why the regulator is extremely hot?
Ya, the regulator is really hot.. so i unplug the relay that connected with humidifier and also motor.. Now, the arduino board dont reset anymore but is still very hot.. I used 12V 1A adapter to power the arduino board.
That means that the regulator needs to dump 7 volts * however many amps your circuit is drawing. A 9V adapter will allow the regulator to dump less voltage (in the form of heat).