Components and supplies
Funduino LCM1602 i2c
DHT22 Temperature Sensor
Capacitor 10 µF
9V 1A Switching Wall Power Supply
Resistor 10k ohm
18 ohm 1W resistor
Arduino Nano R3
Linear Regulator (7805)
3V-6V submersible water pump
5V Relay module
Tools and machines
Soldering iron (generic)
Project description
Code
Newliquidcrystal_1.3.5.zip
arduino
Load one part of this file as a library in Arduino. The library; LiquidCrystal_I2C.h has to be included.
1inary file (no preview
Humidor_compleet_4_met_data_logging.ino
arduino
The code for the Humidiuno with data logging to the SD card.
1#include "DHT.h" // Library for the DHT sensor. Download available in Arduino project hub. 2#include "Wire.h" // Library for communication with i2c devices. 3#include "LiquidCrystal_I2C.h" // Library for the LCD. Download available in Arduino project hub. 4#include <SD.h> 5#include <SPI.h> 6File myFile; 7int pinCS = 10; // Pin 10 on Arduino Uno 8 9#define DHTPIN 7 // Digital Pin used for the sensor. If you use a DHT11 make sure to use a analog pin. 10#define DHTTYPE DHT22 // Define the sensor type you are using. 11 12const int buttonPin = 3; 13const int pMotor = 9; 14int buttonState = 0; 15int timeT = 0; 16int countPump = 0; 17float hum; 18float temp; 19float htCalcA; 20float htCalcB; 21float htCalcC; 22float htCalcD; 23float htCalcE; 24DHT dht(DHTPIN, DHTTYPE); // DHT sensor initialiseren 25LiquidCrystal_I2C lcd(0x3F, 2, 1, 0, 4, 5, 6, 7, 3, POSITIVE); //initialize LCD 26 27void setup() 28{ 29 Serial.begin(9600); 30 pinMode(pinCS, OUTPUT); 31 lcd.begin(16,2); 32 lcd.clear(); 33 lcd.noBacklight(); 34 pinMode(buttonPin, INPUT); 35 pinMode(pMotor, OUTPUT); 36 37 // SD Card Initialization 38 if (SD.begin()) 39 { 40 Serial.println("SD card is ready to use."); 41 } else 42 { 43 Serial.println("SD card initialization failed"); 44 return; 45 } 46} 47 48void loop() 49{ 50 temp = dht.readTemperature(); 51 myFile = SD.open("test.txt", FILE_WRITE); 52 myFile.println("temp ="); 53 myFile.println(temp); 54 myFile.close(); // close the file 55 hum = dht.readHumidity(); 56 myFile = SD.open("test.txt", FILE_WRITE); 57 myFile.println("hum ="); 58 myFile.println(hum); 59 myFile.close(); // close the file 60 timeT = 0; 61 digitalWrite(pMotor, LOW); 62 /* Following calculations are based on formulas used for the psychrometric chart. 63 * As a beginner I split the calculation in five parts. If you have a way to do it all at once, please let me know. 64 */ 65 htCalcA = 17.2694*temp/(238.3+temp); 66 myFile = SD.open("test.txt", FILE_WRITE); 67 myFile.println("htCalcA ="); 68 myFile.println(htCalcA); 69 myFile.close(); // close the file 70 htCalcB = 0.61078*7.501*(exp(htCalcA)); 71 myFile = SD.open("test.txt", FILE_WRITE); 72 myFile.println("htCalcB ="); 73 myFile.println(htCalcB); 74 myFile.close(); // close the file 75 htCalcC = 76000/hum; 76 myFile = SD.open("test.txt", FILE_WRITE); 77 myFile.println("htCalcC ="); 78 myFile.println(htCalcC); 79 myFile.close(); // close the file 80 htCalcD = (htCalcC / htCalcB)-1; 81 myFile = SD.open("test.txt", FILE_WRITE); 82 myFile.println("htCalcD ="); 83 myFile.println(htCalcD); 84 myFile.close(); // close the file 85 htCalcE = 620.69*(1/htCalcD); 86 myFile = SD.open("test.txt", FILE_WRITE); 87 myFile.println("htCalcE ="); 88 myFile.println(htCalcE); 89 myFile.close(); // close the file 90 91 if (htCalcE < 10.70 && countPump >=47) 92 /* First we check if the humidity is high enough. After that we have to make sure the pump will not add too much water to the 93 * humidifier. The evaporation of water to the air is a slow proces. The humidity will not rise immediatly after adding water 94 * to the humidifier. Therefore we add a counter; countPump. It will increase everytime it did not pump and the humidity is 95 * not above 11.00 and can reach 47 in four hours. See while statement furter in the code to see why. 96 * You can change the values if you like. 97 */ 98 { 99 digitalWrite(pMotor, HIGH); 100 delay(180); //Change this value to regulate the amount of water that is pumped. For me between 150ms and 180ms is perfect. 101 digitalWrite(pMotor, LOW); 102 countPump = 0; 103 104 myFile = SD.open("test.txt", FILE_WRITE); 105 myFile.println("1: Water has been pumped."); 106 myFile.println(countPump); 107 myFile.close(); // close the file 108 109 } 110 111 else if (htCalcE > 11.00) 112 { 113 digitalWrite(pMotor, LOW); 114 countPump = 0; 115 116 myFile = SD.open("test.txt", FILE_WRITE); 117 myFile.println("2: The humidity is too high."); 118 myFile.println(countPump); 119 myFile.close(); // close the file 120 } 121 else 122 { 123 digitalWrite(pMotor, LOW); 124 countPump ++; 125 126 myFile = SD.open("test.txt", FILE_WRITE); 127 myFile.println("Humidity is between 10.70 and 11:00."); 128 myFile.println(countPump); 129 myFile.close(); // close the file 130 } 131 132 133 134 while(timeT < 1200) 135 /*So this while loop will be active until timeT becomes 1200. The while loop takes 250ms per time. When you 136 *push the button you will turn on the screen and the screen will be turned on for 5 seconds. timeT will increase 20. 137 138 *As long as the program runs the while loop de code above this loop will not run. The humidor can't check temp en hum and it 139 *can't start the motor. You can make this while loop much longer if you want. 140 */ 141 142 { 143 // start while loop 144 buttonState = digitalRead(buttonPin); 145 if (buttonState == HIGH) 146 { 147 //start if statement 148 //show on LCD 149 temp = dht.readTemperature(); 150 hum = dht.readHumidity(); 151 lcd.backlight(); 152 lcd.clear(); 153 lcd.setCursor(2, 0); 154 lcd.print("Humi= "); 155 lcd.print(hum); 156 lcd.print("%"); 157 lcd.setCursor(2, 1); 158 lcd.print("Temp= "); 159 lcd.print(temp); 160 lcd.print("C"); 161 delay(5000);//scherm is on for 5 seconds. 162 lcd.clear(); 163 lcd.noBacklight(); //LCD off 164 timeT +20; 165 }// end if statement 166 else 167 { 168 timeT ++; 169 }//end else statement 170 171 delay(250);//delay of 0.25 seconds the while statement is in total 1200*250=300000 mSeconds. So 5 minutes. 172 }//end while loop 173}// end loop() 174 175/* I don't now exactly how the Arduino Community works, but i've used a lot of code and knowledge from others so you are free to use 176 and change this code above. Enjoy - Matthias Dankers*/ 177
Humidor Arduino code
arduino
1#include "DHT.h" // Library for the DHT sensor. Download available in Arduino project hub. 2#include "Wire.h" // Library for communication with i2c devices. 3#include "LiquidCrystal_I2C.h" // Library for the LCD. Download available in Arduino project hub. 4 5#define DHTPIN 7 // Digital Pin used for the sensor. If you use a DHT11 make sure to use a analog pin. 6#define DHTTYPE DHT22 // Define the sensor type you are using. 7 8const int buttonPin = 3; 9const int pMotor = 9; 10int buttonState = 0; 11int timeT = 0; 12int countPump = 0; 13float hum; 14float temp; 15float htCalcA; 16float htCalcB; 17float htCalcC; 18float htCalcD; 19float htCalcE; 20DHT dht(DHTPIN, DHTTYPE); // DHT sensor initialiseren 21LiquidCrystal_I2C lcd(0x3F, 2, 1, 0, 4, 5, 6, 7, 3, POSITIVE); //initialize LCD 22 23void setup() 24{ 25 Serial.begin(9600); 26 lcd.begin(16,2); 27 lcd.clear(); 28 lcd.noBacklight(); 29 pinMode(buttonPin, INPUT); 30 pinMode(pMotor, OUTPUT); 31} 32 33void loop() 34{ 35 temp = dht.readTemperature(); 36 hum = dht.readHumidity(); 37 timeT = 0; 38 digitalWrite(pMotor, LOW); 39 /* Following calculations are based on formulas used for the psychrometric chart. 40 * As a beginner I split the calculation in five parts. If you have a way to do it all at once, please let me know. 41 */ 42 htCalcA = 17.2694*temp/(238.3+temp); 43 htCalcB = 0.61078*7.501*(exp(htCalcA)); 44 htCalcC = 76000/hum; 45 htCalcD = (htCalcC / htCalcB)-1; 46 htCalcE = 620.69*(1/htCalcD); 47 48 if (htCalcE < 10.70 && countPump >=48) 49 /* First we check if the humidity is high enough. After that we have to make sure the pump will not add too much water to the 50 * humidifier. The evaporation of water to the air is a slow proces. The humidity will not rise immediatly after adding water 51 * to the humidifier. Therefore we add a counter; countPump. It will increase everytime it did not pump and the humidity is 52 * not above 11.00 and can reach 48 in four hours. See while statement furter in the code to see why. 53 * You can change the values if you like. 54 */ 55 { 56 digitalWrite(pMotor, HIGH); 57 delay(1000); //Change this value to regulate the amount of water that is pumped. It is now 1 second. 58 digitalWrite(pMotor, LOW); 59 countPump = 0; 60 } 61 62 else if (htCalcE > 11.00) 63 { 64 digitalWrite(pMotor, LOW); 65 countPump = 0; 66 } 67 else 68 { 69 digitalWrite(pMotor, LOW); 70 countPump ++; 71 } 72 73 74 75 while(timeT < 1200) 76 /*So this while loop will be active until timeT becomes 1200. The while loop takes 250ms per time. When you 77 *push the button you will turn on the screen and the screen will be turned on for 5 seconds. timeT will increase 20. 78 79 *As long as the program runs the while loop de code above this loop will not run. The humidor can't check temp en hum and it 80 *can't start the motor. You can make this while loop much longer if you want. 81 */ 82 83 { 84 // start while loop 85 buttonState = digitalRead(buttonPin); 86 if (buttonState == HIGH) 87 { 88 //start if statement 89 //show on LCD 90 temp = dht.readTemperature(); 91 hum = dht.readHumidity(); 92 lcd.backlight(); 93 lcd.clear(); 94 lcd.setCursor(2, 0); 95 lcd.print("Humi= "); 96 lcd.print(hum); 97 lcd.print("%"); 98 lcd.setCursor(2, 1); 99 lcd.print("Temp= "); 100 lcd.print(temp); 101 lcd.print("C"); 102 delay(5000);//LCD is on for 5 seconds. 103 lcd.clear(); 104 lcd.noBacklight(); //LCD off 105 timeT +20; 106 }// end if statement 107 else 108 { 109 timeT ++; 110 }//end else statement 111 112 delay(250);//delay of 0.25 seconds the while statement is in total 1200*250=300000 mSeconds. So 5 minutes. 113 }//end while loop 114}// end loop() 115 116/* I don't now exactly how the Arduino Community works, but i've used a lot of code and knowledge from others so you are free to use 117 and change this code above. Enjoy - Matthias Dankers*/ 118
Humidor Arduino no comments
arduino
1#include "DHT.h" 2#include "Wire.h" 3#include "LiquidCrystal_I2C.h" 4 5#define DHTPIN 7 6#define DHTTYPE DHT22 7 8const int buttonPin = 3; 9const int pMotor = 9; 10int buttonState = 0; 11int timeT = 0; 12int countPump = 0; 13float hum; 14float temp; 15float htCalcA; 16float htCalcB; 17float htCalcC; 18float htCalcD; 19float htCalcE; 20DHT dht(DHTPIN, DHTTYPE); 21LiquidCrystal_I2C lcd(0x3F, 2, 1, 0, 4, 5, 6, 7, 3, POSITIVE); 22 23void setup() 24{ 25 Serial.begin(9600); 26 lcd.begin(16,2); 27 lcd.clear(); 28 lcd.noBacklight(); 29 pinMode(buttonPin, INPUT); 30 pinMode(pMotor, OUTPUT); 31} 32void loop() 33{ 34 temp = dht.readTemperature(); 35 hum = dht.readHumidity(); 36 timeT = 0; 37 digitalWrite(pMotor, LOW); 38 htCalcA = 17.2694*temp/(238.3+temp); 39 htCalcB = 0.61078*7.501*(exp(htCalcA)); 40 htCalcC = 76000/hum; 41 htCalcD = (htCalcC / htCalcB)-1; 42 htCalcE = 620.69*(1/htCalcD); 43 44 if (htCalcE < 10.70 && countPump >=48) 45 { 46 digitalWrite(pMotor, HIGH); 47 delay(1000); 48 digitalWrite(pMotor, LOW); 49 countPump = 0; 50 } 51 else if (htCalcE > 11.00) 52 { 53 digitalWrite(pMotor, LOW); 54 countPump = 0; 55 } 56 else 57 { 58 digitalWrite(pMotor, LOW); 59 countPump ++; 60 } 61 while(timeT < 1200) 62 { 63 // start while loop 64 buttonState = digitalRead(buttonPin); 65 if (buttonState == HIGH) 66 { 67 temp = dht.readTemperature(); 68 hum = dht.readHumidity(); 69 lcd.backlight(); 70 lcd.clear(); 71 lcd.setCursor(2, 0); 72 lcd.print("Humi= "); 73 lcd.print(hum); 74 lcd.print("%"); 75 lcd.setCursor(2, 1); 76 lcd.print("Temp= "); 77 lcd.print(temp); 78 lcd.print("C"); 79 delay(5000); 80 lcd.clear(); 81 lcd.noBacklight(); 82 timeT +20; 83 } 84 else 85 { 86 timeT ++; 87 } 88 delay(250); 89 } 90 91/* I don't now exactly how the Arduino Community works, but i've used a lot of code and knowledge from others so you are free to use 92 and change this code above. Enjoy - Matthias Dankers*/ 93
Humidor Arduino code
arduino
1#include "DHT.h" // Library for the DHT sensor. Download available in 2 Arduino project hub. 3#include "Wire.h" // Library for communication with i2c 4 devices. 5#include "LiquidCrystal_I2C.h" // Library for the LCD. Download available 6 in Arduino project hub. 7 8#define DHTPIN 7 // Digital Pin used for the sensor. 9 If you use a DHT11 make sure to use a analog pin. 10#define DHTTYPE DHT22 // Define 11 the sensor type you are using. 12 13const int buttonPin = 3; 14const int pMotor 15 = 9; 16int buttonState = 0; 17int timeT = 0; 18int countPump = 0; 19float hum; 20float 21 temp; 22float htCalcA; 23float htCalcB; 24float htCalcC; 25float htCalcD; 26float 27 htCalcE; 28DHT dht(DHTPIN, DHTTYPE); // DHT sensor initialiseren 29LiquidCrystal_I2C 30 lcd(0x3F, 2, 1, 0, 4, 5, 6, 7, 3, POSITIVE); //initialize LCD 31 32void setup() 33{ 34 35 Serial.begin(9600); 36 lcd.begin(16,2); 37 lcd.clear(); 38 lcd.noBacklight(); 39 40 pinMode(buttonPin, INPUT); 41 pinMode(pMotor, OUTPUT); 42} 43 44void 45 loop() 46{ 47 temp = dht.readTemperature(); 48 hum = dht.readHumidity(); 49 50 timeT = 0; 51 digitalWrite(pMotor, LOW); 52 /* Following calculations are 53 based on formulas used for the psychrometric chart. 54 * As a beginner I split 55 the calculation in five parts. If you have a way to do it all at once, please let 56 me know. 57 */ 58 htCalcA = 17.2694*temp/(238.3+temp); 59 htCalcB = 0.61078*7.501*(exp(htCalcA)); 60 61 htCalcC = 76000/hum; 62 htCalcD = (htCalcC / htCalcB)-1; 63 htCalcE = 620.69*(1/htCalcD); 64 65 66 if (htCalcE < 10.70 && countPump >=48) 67 /* First we check if the humidity 68 is high enough. After that we have to make sure the pump will not add too much water 69 to the 70 * humidifier. The evaporation of water to the air is a slow proces. 71 The humidity will not rise immediatly after adding water 72 * to the humidifier. 73 Therefore we add a counter; countPump. It will increase everytime it did not pump 74 and the humidity is 75 * not above 11.00 and can reach 48 in four hours. See 76 while statement furter in the code to see why. 77 * You can change the values 78 if you like. 79 */ 80 { 81 digitalWrite(pMotor, HIGH); 82 delay(1000); 83 //Change this value to regulate the amount of water that is pumped. It is now 1 84 second. 85 digitalWrite(pMotor, LOW); 86 countPump = 0; 87 } 88 89 90 else if (htCalcE > 11.00) 91 { 92 digitalWrite(pMotor, LOW); 93 94 countPump = 0; 95 } 96 else 97 { 98 digitalWrite(pMotor, LOW); 99 100 countPump ++; 101 } 102 103 104 105 while(timeT < 1200) 106 /*So 107 this while loop will be active until timeT becomes 1200. The while loop takes 250ms 108 per time. When you 109 *push the button you will turn on the screen and the screen 110 will be turned on for 5 seconds. timeT will increase 20. 111 112 *As long as 113 the program runs the while loop de code above this loop will not run. The humidor 114 can't check temp en hum and it 115 *can't start the motor. You can make this while 116 loop much longer if you want. 117 */ 118 119 { 120 // start while loop 121 122 buttonState = digitalRead(buttonPin); 123 if (buttonState == HIGH) 124 125 { 126 //start if statement 127 //show on LCD 128 temp = dht.readTemperature(); 129 130 hum = dht.readHumidity(); 131 lcd.backlight(); 132 lcd.clear(); 133 134 lcd.setCursor(2, 0); 135 lcd.print("Humi= "); 136 lcd.print(hum); 137 138 lcd.print("%"); 139 lcd.setCursor(2, 1); 140 lcd.print("Temp= 141 "); 142 lcd.print(temp); 143 lcd.print("C"); 144 delay(5000);//LCD 145 is on for 5 seconds. 146 lcd.clear(); 147 lcd.noBacklight(); //LCD off 148 149 timeT +20; 150 }// end if statement 151 else 152 { 153 timeT 154 ++; 155 }//end else statement 156 157 delay(250);//delay of 0.25 seconds 158 the while statement is in total 1200*250=300000 mSeconds. So 5 minutes. 159 }//end 160 while loop 161}// end loop() 162 163/* I don't now exactly how the Arduino Community 164 works, but i've used a lot of code and knowledge from others so you are free to 165 use 166 and change this code above. Enjoy - Matthias Dankers*/ 167
Newliquidcrystal_1.3.5.zip
arduino
Load one part of this file as a library in Arduino. The library; LiquidCrystal_I2C.h has to be included.
1inary file (no preview
Humidor_compleet_4_met_data_logging.ino
arduino
The code for the Humidiuno with data logging to the SD card.
1#include "DHT.h" // Library for the DHT sensor. Download available in Arduino project hub. 2#include "Wire.h" // Library for communication with i2c devices. 3#include "LiquidCrystal_I2C.h" // Library for the LCD. Download available in Arduino project hub. 4#include <SD.h> 5#include <SPI.h> 6File myFile; 7int pinCS = 10; // Pin 10 on Arduino Uno 8 9#define DHTPIN 7 // Digital Pin used for the sensor. If you use a DHT11 make sure to use a analog pin. 10#define DHTTYPE DHT22 // Define the sensor type you are using. 11 12const int buttonPin = 3; 13const int pMotor = 9; 14int buttonState = 0; 15int timeT = 0; 16int countPump = 0; 17float hum; 18float temp; 19float htCalcA; 20float htCalcB; 21float htCalcC; 22float htCalcD; 23float htCalcE; 24DHT dht(DHTPIN, DHTTYPE); // DHT sensor initialiseren 25LiquidCrystal_I2C lcd(0x3F, 2, 1, 0, 4, 5, 6, 7, 3, POSITIVE); //initialize LCD 26 27void setup() 28{ 29 Serial.begin(9600); 30 pinMode(pinCS, OUTPUT); 31 lcd.begin(16,2); 32 lcd.clear(); 33 lcd.noBacklight(); 34 pinMode(buttonPin, INPUT); 35 pinMode(pMotor, OUTPUT); 36 37 // SD Card Initialization 38 if (SD.begin()) 39 { 40 Serial.println("SD card is ready to use."); 41 } else 42 { 43 Serial.println("SD card initialization failed"); 44 return; 45 } 46} 47 48void loop() 49{ 50 temp = dht.readTemperature(); 51 myFile = SD.open("test.txt", FILE_WRITE); 52 myFile.println("temp ="); 53 myFile.println(temp); 54 myFile.close(); // close the file 55 hum = dht.readHumidity(); 56 myFile = SD.open("test.txt", FILE_WRITE); 57 myFile.println("hum ="); 58 myFile.println(hum); 59 myFile.close(); // close the file 60 timeT = 0; 61 digitalWrite(pMotor, LOW); 62 /* Following calculations are based on formulas used for the psychrometric chart. 63 * As a beginner I split the calculation in five parts. If you have a way to do it all at once, please let me know. 64 */ 65 htCalcA = 17.2694*temp/(238.3+temp); 66 myFile = SD.open("test.txt", FILE_WRITE); 67 myFile.println("htCalcA ="); 68 myFile.println(htCalcA); 69 myFile.close(); // close the file 70 htCalcB = 0.61078*7.501*(exp(htCalcA)); 71 myFile = SD.open("test.txt", FILE_WRITE); 72 myFile.println("htCalcB ="); 73 myFile.println(htCalcB); 74 myFile.close(); // close the file 75 htCalcC = 76000/hum; 76 myFile = SD.open("test.txt", FILE_WRITE); 77 myFile.println("htCalcC ="); 78 myFile.println(htCalcC); 79 myFile.close(); // close the file 80 htCalcD = (htCalcC / htCalcB)-1; 81 myFile = SD.open("test.txt", FILE_WRITE); 82 myFile.println("htCalcD ="); 83 myFile.println(htCalcD); 84 myFile.close(); // close the file 85 htCalcE = 620.69*(1/htCalcD); 86 myFile = SD.open("test.txt", FILE_WRITE); 87 myFile.println("htCalcE ="); 88 myFile.println(htCalcE); 89 myFile.close(); // close the file 90 91 if (htCalcE < 10.70 && countPump >=47) 92 /* First we check if the humidity is high enough. After that we have to make sure the pump will not add too much water to the 93 * humidifier. The evaporation of water to the air is a slow proces. The humidity will not rise immediatly after adding water 94 * to the humidifier. Therefore we add a counter; countPump. It will increase everytime it did not pump and the humidity is 95 * not above 11.00 and can reach 47 in four hours. See while statement furter in the code to see why. 96 * You can change the values if you like. 97 */ 98 { 99 digitalWrite(pMotor, HIGH); 100 delay(180); //Change this value to regulate the amount of water that is pumped. For me between 150ms and 180ms is perfect. 101 digitalWrite(pMotor, LOW); 102 countPump = 0; 103 104 myFile = SD.open("test.txt", FILE_WRITE); 105 myFile.println("1: Water has been pumped."); 106 myFile.println(countPump); 107 myFile.close(); // close the file 108 109 } 110 111 else if (htCalcE > 11.00) 112 { 113 digitalWrite(pMotor, LOW); 114 countPump = 0; 115 116 myFile = SD.open("test.txt", FILE_WRITE); 117 myFile.println("2: The humidity is too high."); 118 myFile.println(countPump); 119 myFile.close(); // close the file 120 } 121 else 122 { 123 digitalWrite(pMotor, LOW); 124 countPump ++; 125 126 myFile = SD.open("test.txt", FILE_WRITE); 127 myFile.println("Humidity is between 10.70 and 11:00."); 128 myFile.println(countPump); 129 myFile.close(); // close the file 130 } 131 132 133 134 while(timeT < 1200) 135 /*So this while loop will be active until timeT becomes 1200. The while loop takes 250ms per time. When you 136 *push the button you will turn on the screen and the screen will be turned on for 5 seconds. timeT will increase 20. 137 138 *As long as the program runs the while loop de code above this loop will not run. The humidor can't check temp en hum and it 139 *can't start the motor. You can make this while loop much longer if you want. 140 */ 141 142 { 143 // start while loop 144 buttonState = digitalRead(buttonPin); 145 if (buttonState == HIGH) 146 { 147 //start if statement 148 //show on LCD 149 temp = dht.readTemperature(); 150 hum = dht.readHumidity(); 151 lcd.backlight(); 152 lcd.clear(); 153 lcd.setCursor(2, 0); 154 lcd.print("Humi= "); 155 lcd.print(hum); 156 lcd.print("%"); 157 lcd.setCursor(2, 1); 158 lcd.print("Temp= "); 159 lcd.print(temp); 160 lcd.print("C"); 161 delay(5000);//scherm is on for 5 seconds. 162 lcd.clear(); 163 lcd.noBacklight(); //LCD off 164 timeT +20; 165 }// end if statement 166 else 167 { 168 timeT ++; 169 }//end else statement 170 171 delay(250);//delay of 0.25 seconds the while statement is in total 1200*250=300000 mSeconds. So 5 minutes. 172 }//end while loop 173}// end loop() 174 175/* I don't now exactly how the Arduino Community works, but i've used a lot of code and knowledge from others so you are free to use 176 and change this code above. Enjoy - Matthias Dankers*/ 177
Humidor Arduino no comments
arduino
1#include "DHT.h" 2#include "Wire.h" 3#include "LiquidCrystal_I2C.h" 4 5#define 6 DHTPIN 7 7#define DHTTYPE DHT22 8 9const int buttonPin = 3; 10const int pMotor 11 = 9; 12int buttonState = 0; 13int timeT = 0; 14int countPump = 0; 15float hum; 16float 17 temp; 18float htCalcA; 19float htCalcB; 20float htCalcC; 21float htCalcD; 22float 23 htCalcE; 24DHT dht(DHTPIN, DHTTYPE); 25LiquidCrystal_I2C lcd(0x3F, 2, 1, 0, 4, 26 5, 6, 7, 3, POSITIVE); 27 28void setup() 29{ 30 Serial.begin(9600); 31 lcd.begin(16,2); 32 33 lcd.clear(); 34 lcd.noBacklight(); 35 pinMode(buttonPin, INPUT); 36 pinMode(pMotor, 37 OUTPUT); 38} 39void loop() 40{ 41 temp = dht.readTemperature(); 42 hum = 43 dht.readHumidity(); 44 timeT = 0; 45 digitalWrite(pMotor, LOW); 46 htCalcA 47 = 17.2694*temp/(238.3+temp); 48 htCalcB = 0.61078*7.501*(exp(htCalcA)); 49 htCalcC 50 = 76000/hum; 51 htCalcD = (htCalcC / htCalcB)-1; 52 htCalcE = 620.69*(1/htCalcD); 53 54 55 if (htCalcE < 10.70 && countPump >=48) 56 { 57 digitalWrite(pMotor, 58 HIGH); 59 delay(1000); 60 digitalWrite(pMotor, LOW); 61 countPump 62 = 0; 63 } 64 else if (htCalcE > 11.00) 65 { 66 digitalWrite(pMotor, 67 LOW); 68 countPump = 0; 69 } 70 else 71 { 72 digitalWrite(pMotor, 73 LOW); 74 countPump ++; 75 } 76 while(timeT < 1200) 77 { 78 // 79 start while loop 80 buttonState = digitalRead(buttonPin); 81 if (buttonState 82 == HIGH) 83 { 84 temp = dht.readTemperature(); 85 hum = dht.readHumidity(); 86 87 lcd.backlight(); 88 lcd.clear(); 89 lcd.setCursor(2, 0); 90 91 lcd.print("Humi= "); 92 lcd.print(hum); 93 lcd.print("%"); 94 95 lcd.setCursor(2, 1); 96 lcd.print("Temp= "); 97 lcd.print(temp); 98 99 lcd.print("C"); 100 delay(5000); 101 lcd.clear(); 102 lcd.noBacklight(); 103 104 timeT +20; 105 } 106 else 107 { 108 timeT ++; 109 } 110 111 delay(250); 112 } 113 114/* I don't now exactly how the Arduino Community works, 115 but i've used a lot of code and knowledge from others so you are free to use 116 117 and change this code above. Enjoy - Matthias Dankers*/ 118
DHT_Library.zip
arduino
Load this library in Arduino.
1inary file (no preview
Downloadable files
Humidiuno electronics Fritzing
Humidiuno electronics Fritzing
Humidor electronics Fritzing - Image
Humidor electronics Fritzing - Image
Humidiuno electronics Fritzing
Humidiuno electronics Fritzing
Humidor electronics Fritzing - Image
Humidor electronics Fritzing - Image
Documentation
Humidor box
Solidworks humidor box. The holes for the LCD and analog hygrometer might not be in the correct size and it depends on the parts you are using.
Humidor box
Humidor box lid
Solidworks humidor box lid.
Humidor box lid
Humidor box lid
Solidworks humidor box lid.
Humidor box lid
Humidor box
Solidworks humidor box. The holes for the LCD and analog hygrometer might not be in the correct size and it depends on the parts you are using.
Humidor box
Comments
Only logged in users can leave comments
MatthiasDankers
0 Followers
•0 Projects
Table of contents
Intro
7
0