Hello, I am Some what New to Coding and i am taking on a somewhat new project for me. I am Building a power supply and i am making a Arduino Fan controller for it. I would like For the 16x2 display To show something like this (Look at The Image Hard to explain)
But I Just don't know how to do the code, so can someone help me. The original code was found on this website http://www.electroschematics.com/9540/arduino-fan-speed-controlled-temperature/ But i modified everything for my needs current the LCD Please Help Here is my current code[code]
// PWM and Speed Control for Power Supply Project
#include <LiquidCrystal.h>
LiquidCrystal lcd(7,6,5,4,3,2);
int tempPin1 = A1; // the output pin of LM35
int tempPin2 = A2; // the output pin of LM35
int tempPin3 = A3; // the output pin of LM35
int tempPin4 = A4; // the output pin of LM35
int tempPin5 = A5; // the output pin of LM35
int fan1 = 11; // the pin where fan is
int fan2 = 12; // the pin where fan is
int fan3 = 13; // the pin where fan is
int relay1 =14; // The pin where the relay is
int relay2 =15; //The pin where the relay is
int relay3 =16; //The pin where the relay is
int relay4 =9; //The pin where the relay is
int led = 8; // led pin
int temp1;
int temp2;
int temp3;
int temp4;
int temp5;
int tempMin = 30; // the temperature to start the fan & First Relay stage
int tempMax = 70; // the maximum temperature when fan is at 100
int temprelay = 50; // Tempture second relay stage starts.
int fanSpeed;
int fanLCD;
int readTemp1() { // get the temperature and convert it to celsius
temp1 = analogRead(tempPin1);
return temp1 * 0.48828125; }
int readTemp2() { // get the temperature and convert it to celsius
temp2 = analogRead(tempPin2);
return temp2 * 0.48828125; }
int readTemp3() { // get the temperature and convert it to celsius
temp3 = analogRead(tempPin3);
return temp3 * 0.48828125; }
int readTemp4() { // get the temperature and convert it to celsius
temp4 = analogRead(tempPin4);
return temp4 * 0.48828125; }
int readTemp5() { // get the temperature and convert it to celsius
temp5 = analogRead(tempPin5);
return temp5 * 0.48828125; }
void setup() {
pinMode(fan1, OUTPUT);
pinMode(fan2, OUTPUT);
pinMode(fan3, OUTPUT);
pinMode(relay1, OUTPUT);
pinMode(relay2, OUTPUT);
pinMode(relay3, OUTPUT);
pinMode(relay4, OUTPUT);
pinMode(led, OUTPUT);
pinMode(tempPin1, INPUT);
pinMode(tempPin2, INPUT);
pinMode(tempPin3, INPUT);
pinMode(tempPin4, INPUT);
pinMode(tempPin5, INPUT);
lcd.begin(16,2);
}
void loop() { // Fan 1-3 Temp sensor 3-5
temp3 = readTemp3(); // get the temperature
if(temp3 < tempMin) { // if temp is lower than minimum temp
fanSpeed = 0; // fan is not spinning
digitalWrite(fan1, LOW);
}
if((temp3 >= tempMin) && (temp3 <= tempMax)) { // if temperature is higher than minimum temp
fanSpeed = map(temp3, tempMin, tempMax, 32, 255); // the actual speed of fan
fanLCD = map(temp3, tempMin, tempMax, 0, 100); // speed of fan to display on LCD
analogWrite(fan1, fanSpeed); // spin the fan at the fanSpeed speed
}
temp4 = readTemp4(); // get the temperature
if(temp4 < tempMin) { // if temp is lower than minimum temp
fanSpeed = 0; // fan is not spinning
digitalWrite(fan2, LOW);
}
if((temp4 >= tempMin) && (temp4 <= tempMax)) { // if temperature is higher than minimum temp
fanSpeed = map(temp4, tempMin, tempMax, 32, 255); // the actual speed of fan
fanLCD = map(temp4, tempMin, tempMax, 0, 100); // speed of fan to display on LCD
analogWrite(fan2, fanSpeed); // spin the fan at the fanSpeed speed
}
temp5 = readTemp5(); // get the temperature
if(temp5 < tempMin) { // if temp is lower than minimum temp
fanSpeed = 0; // fan is not spinning
digitalWrite(fan3, LOW);
}
if((temp5 >= tempMin) && (temp5 <= tempMax)) { // if temperature is higher than minimum temp
fanSpeed = map(temp5, tempMin, tempMax, 32, 255); // the actual speed of fan
fanLCD = map(temp5, tempMin, tempMax, 0, 100); // speed of fan to display on LCD
analogWrite(fan3, fanSpeed); // spin the fan at the fanSpeed speed
}
temp1 = readTemp1(); // get the temperature
if(temp1 < tempMin) { // if temp is lower than minimum temp
digitalWrite(relay1, LOW);
}
if((temp1 >= tempMin) && (temp1 < temprelay)) { // if temp is Greater than minimum temp but lower then relay temp
digitalWrite(relay1, HIGH); // Turn Realy One On
}
if(temp1 >= temprelay) { // If Temp 1 Is equal or greater then Temp Realy
digitalWrite(relay1, LOW); // Turn Relay 1 Off
delay (200); // Delay
digitalWrite(relay2, HIGH); // Turn Relay 2 on
}
temp2 = readTemp2(); // get the temperature
if(temp2 < tempMin) { // if temp is lower than minimum temp
digitalWrite(relay3, LOW);
}
if((temp2 >= tempMin) && (temp2 < temprelay)) { // if temp is Greater than minimum temp but lower then relay temp
digitalWrite(relay3, HIGH); // Turn Realy Three On
}
if(temp3 >= temprelay) { // If Temp 3 Is equal or greater then Temp Realy
digitalWrite(relay3, LOW); // Turn Relay 3 Off
delay (200); // Delay
digitalWrite(relay4, HIGH); // Turn Relay 4 on
}
if(temp1,temp2,temp3,temp4,temp5 > tempMax) { // if temp is higher than tempMax
digitalWrite(led, HIGH); // turn on led
} else { // else turn of led
digitalWrite(led, LOW);
}
lcd.print("TEMP: ");
lcd.print(temp1); // display the temperature
lcd.print("C ");
lcd.setCursor(0,1); // move cursor to next line
lcd.print("FANS: ");
lcd.print(fanLCD); // display the fan speed
lcd.print("%");
delay(200);
lcd.clear();
}
[/code]