Commit 382c5a39 authored by Kencho Wangdi's avatar Kencho Wangdi
Browse files

files

parent 23b77717
Pipeline #319276 passed with stage
in 47 seconds
#include "DHT.h"
#include <WiFi.h>
#define DHT11Pin 19
#define DHTType DHT11
//OLED
#include <Wire.h>
#include <Adafruit_GFX.h>
#include <Adafruit_SSD1306.h>
DHT HT(DHT11Pin,DHTType);
float humi;
float tempC;
float tempF;
const char* ssid = "dd-wrt_vap"; // your network SSID (name)
const char* password = "fab172030!"; // your network password
const int TEMP_THRESHOLD_UPPER = 28; // upper threshold of temperature, change to your desire value
const int TEMP_THRESHOLD_LOWER = 25; // lower threshold of temperature, change to your desire value
const int HUM_THRESHOLD_LOWER = 70;
//OLED define
#define SCREEN_WIDTH 128 // OLED display width, in pixels
#define SCREEN_HEIGHT 64 // OLED display height, in pixels
// Declaration for an SSD1306 display connected to I2C (SDA, SCL pins)
Adafruit_SSD1306 display(SCREEN_WIDTH, SCREEN_HEIGHT, &Wire, -1);
void setup() {
pinMode(12,OUTPUT);
pinMode(13,OUTPUT);
pinMode(19,OUTPUT);
Serial.begin(9600);
//For DHT11
HT.begin();
//For OLED I2C
if(!display.begin(SSD1306_SWITCHCAPVCC, 0x3C)) { // Address 0x3D for 128x64
Serial.println(F("SSD1306 allocation failed"));
for(;;);
}
display.display(); //Display logo
delay(1000);
display.clearDisplay();
}
void loop() {
delay(1000); //wait for few measurement.
humi = HT.readHumidity();
tempC = HT.readTemperature();
tempF = HT.readTemperature(true);
if(WiFi.status() != WL_CONNECTED){
Serial.print("Attempting to connect");
while(WiFi.status() != WL_CONNECTED){
WiFi.begin(ssid, password);
delay(5000);
}
Serial.println("\nConnected.");
}
display.clearDisplay();
oledDisplayHeader();
oledDisplay(3,5,28,humi,"%");
oledDisplay(2,70,16,tempC,"C");
oledDisplay(2,70,44,tempF,"F");
display.display();
if( tempC >TEMP_THRESHOLD_UPPER)
{
digitalWrite(13,HIGH); // turn on fan
}
else if(tempC < TEMP_THRESHOLD_LOWER)
{
digitalWrite(12, LOW); // turn on Heater
}
if( humi< HUM_THRESHOLD_LOWER )
{
digitalWrite(19,LOW);// dc motor turn on
}
else{
digitalWrite(19,HIGH);
delay(2000);
}
}
void oledDisplayHeader(){
display.setTextSize(1);
display.setTextColor(WHITE);
display.setCursor(0, 0);
display.print("Humidity");
display.setCursor(60, 0);
display.print("Temperature");
}
void oledDisplay(int size, int x,int y, float value, String unit){
int charLen=12;
int xo=x+charLen*3.2;
int xunit=x+charLen*3.6;
int xval = x;
display.setTextSize(size);
display.setTextColor(WHITE);
if (unit=="%"){
display.setCursor(x, y);
display.print(value,0);
display.print(unit);
} else {
if (value>99){
xval=x;
} else {
xval=x+charLen;
}
display.setCursor(xval, y);
display.print(value,0);
display.drawCircle(xo, y+2, 2, WHITE); // print degree symbols ( )
display.setCursor(xunit, y);
display.print(unit);
}
}
This diff is collapsed.
<?xml version="1.0" standalone="no"?>
<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN"
"http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
<svg
xmlns:svg="http://www.w3.org/2000/svg"
xmlns="http://www.w3.org/2000/svg"
xmlns:xlink="http://www.w3.org/1999/xlink"
version="1.1"
width="29.700220cm" height="21.000720cm" viewBox="0 0 297002200 210007200">
<title>SVG Picture created as final project-Edge_Cuts.svg date 2022/07/11 15:16:47 </title>
<desc>Picture generated by PCBNEW </desc>
<g style="fill:#000000; fill-opacity:1.000000;stroke:#000000; stroke-opacity:1.000000;
stroke-linecap:round; stroke-linejoin:round;"
transform="translate(0 0) scale(1 1)">
</g>
<g style="fill:#000000; fill-opacity:0.0;
stroke:#000000; stroke-width:0.000000; stroke-opacity:1;
stroke-linecap:round; stroke-linejoin:round;">
</g>
<g style="fill:#000000; fill-opacity:0.0;
stroke:#000000; stroke-width:800000.000000; stroke-opacity:1;
stroke-linecap:round; stroke-linejoin:round;">
<path d="M59500000 48000000
L65500000 48000000
" />
<path d="M129000000 42500000
L139500000 50000000
" />
<path d="M107500000 75000000
L107500000 74000000
" />
<path d="M83000000 73500000
L98500000 73500000
" />
<path d="M113500000 33000000
L84500000 33000000
" />
<path d="M129000000 42500000
L129000000 29500000
" />
<path d="M129000000 27500000
L113500000 27500000
" />
<path d="M60000000 35000000
L58000000 37000000
" />
<path d="M58000000 37000000
L58000000 45500000
" />
<path d="M65500000 55000000
L65500000 71000000
" />
<path d="M107500000 74000000
L118000000 74000000
" />
<path d="M73000000 71000000
L80500000 71000000
" />
<path d="M118000000 74000000
L119500000 75500000
" />
<path d="M83000000 35000000
L60000000 35000000
" />
<path d="M73500000 71000000
L65500000 71000000
" />
<path d="M58000000 45500000
L59000000 47000000
" />
<path d="M113500000 27500000
L113500000 33000000
" />
<path d="M80500000 71000000
L83000000 73500000
" />
<path d="M65500000 48000000
L65500000 49000000
" />
<path d="M107500000 76500000
L107500000 75000000
" />
<path d="M59000000 47000000
L59500000 48000000
" />
<path d="M84500000 33000000
L83000000 35000000
" />
<path d="M139500000 61000000
L139500000 75500000
" />
<path d="M119500000 75500000
L139500000 75500000
" />
<path d="M139500000 56000000
L139500000 61000000
" />
<path d="M102500000 76500000
L102500000 73500000
" />
<path d="M102500000 73500000
L98500000 73500000
" />
<path d="M139500000 50000000
L139500000 53000000
" />
<path d="M65500000 49000000
L65500000 55000000
" />
<path d="M129000000 29500000
L129000000 27500000
" />
<path d="M139500000 53000000
L139500000 56000000
" />
<path d="M102500000 76500000
L107500000 76500000
" />
<g >
</g>
<g >
</g>
<g >
</g>
<g >
</g>
<g >
</g>
<g >
</g>
<g >
</g>
<g >
</g>
<g >
</g>
<g >
</g>
<g >
</g>
<g >
</g>
<g >
</g>
<g >
</g>
<g >
</g>
<g >
</g>
<g >
</g>
<g >
</g>
<g >
</g>
<g >
</g>
<g >
</g>
<g >
</g>
<g >
</g>
<g >
</g>
<g >
</g>
</g>
</svg>
This diff is collapsed.
......@@ -394,6 +394,10 @@ The greenhouse was successfully completed.
![type:video](../videos/presentation.mp4)
## Original Files
Download all the original files from here.
[Final project](../files/finalproject.rar)
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment