Hi,
When I integrate the PAvalue it will influenced the Temp / Fan control.
#include <LiquidCrystal.h>
float Voltage;
float TempC;
int FAN = 9; // FAN Optocoupler (CNY74-2) connected to digital PWM pin 9
int Temperature;
int PAvalue;
// int PAvalue = 0;
const int PA = 2; // analog channel 2 (PA signal Input).
const int LM35 = 0; // analog channel 0 (LM35CZ).
const int LowTemp = 30; // Setting LOW Temperature setpoint. The Fan reach full speed then temperature is more than 10°C above setpoint.
LiquidCrystal lcd(12, 11, 5, 4, 3, 2); // lcd naar Digital pin (4=2,6=3,11=4,12=5,13=6,14=7) (lcd header "gnd" = 1,(3),5,16) and (lcd header "+5 volt" = 2,15)
void setup()
{
lcd.begin(16,2);
pinMode(FAN, OUTPUT); // Set pin for output to control FAN Optocoupler.
}
void loop()
{
Temperature = analogRead(LM35); // read the value from the LM35 sensor
Voltage = Temperature * (5.0/1024); // convert reading to voltage (in V), for 5V input
TempC = ( 5.0 * Temperature * 100.0) / 1024.0; // convert voltage to temperature
lcd.setCursor(0,1);
lcd.print(TempC); // Print Celsius temperature to LCD
lcd.print((char)223); // degree symbol
lcd.print("C ");
analogWrite(FAN, constrain( (TempC - LowTemp) * 25, 0, 255)); // If the temperature is highher than the set point, run the fans.
{
}
PAvalue = analogRead(PA); // read the value from the PA output driver.
float PAVin = PAvalue * (4.5 / 1024.0);
if (PAVin>4)
{
lcd.setCursor(8, 0);
lcd.print("10");
}
else
if (PAVin>3 && PAVin<4)
{
lcd.setCursor(8, 0);
lcd.print(" 8");
}
else
if (PAVin>2 && PAVin<3)
{
lcd.setCursor(8, 0);
lcd.print(" 6");
}
else
if (PAVin>1 && PAVin<2)
{
lcd.setCursor(8, 0);
lcd.print(" 4");
}
else
if (PAVin>0.5 && PAVin<1)
{
lcd.setCursor(8, 0);
lcd.print(" 3");
}
else
if (PAVin>0 && PAVin<0.5)
{
lcd.setCursor(8, 0);
lcd.print(" 2");
}
{
lcd.setCursor(0, 0);
lcd.print("Output:");
lcd.setCursor(11, 0);
lcd.print("Watt");
lcd.setCursor(10, 1);
lcd.print(PAVin);
lcd.setCursor(15, 1);
lcd.print("V");
}
}
Do i forget something?
Any help will appriciate.
Thanks
Ed.