Differences

This shows you the differences between two versions of the page.

Link to this comparison view

pm:prj2022:cstan:date_time_temperature_and_humidity_display [2022/05/27 22:39]
aryan.zabihi [Software Design]
pm:prj2022:cstan:date_time_temperature_and_humidity_display [2022/05/27 23:24] (current)
aryan.zabihi [Bibliografie/Resurse]
Line 9: Line 9:
 ===== Descriere generală ===== ===== Descriere generală =====
  
- +Pe ecranul OLED sunt afisate data, ora, temperatura si umiditatea pe langa o iconita cu un ceas. Pentru utilizarea functiei de alarma trebuie doar sa selectam din cod ora, minutul, si secunda la care vrem sa sune.
- +
 ===== Hardware Design ===== ===== Hardware Design =====
  
Line 349: Line 347:
     display.print("​Jul"​);<​br>​     display.print("​Jul"​);<​br>​
     ​     ​
-    break;+    break;<br>
  
-    case 8: +    case 8:<br> 
-    display.setTextSize(1);​ +    display.setTextSize(1);​<br> 
-    display.setTextColor(WHITE);​ +    display.setTextColor(WHITE);​<br> 
-    display.setCursor(70,​0);​ +    display.setCursor(70,​0);​<br> 
-    display.print("​Aug"​);​+    display.print("​Aug"​);​<br>
     ​     ​
-    break;+    break;<br>
  
-    case 9: +    case 9:<br> 
-    display.setTextSize(1);​ +    display.setTextSize(1);​<br> 
-    display.setTextColor(WHITE);​ +    display.setTextColor(WHITE);​<br> 
-    display.setCursor(70,​0);​ +    display.setCursor(70,​0);​<br> 
-    display.print("​Sep"​);​+    display.print("​Sep"​);​<br>
     ​     ​
-    break;+    break;<br>
  
-    case 10: +    case 10:<br> 
-    display.setTextSize(1);​ +    display.setTextSize(1);​<br> 
-    display.setTextColor(WHITE);​ +    display.setTextColor(WHITE);​<br> 
-    display.setCursor(70,​0);​ +    display.setCursor(70,​0);​<br> 
-    display.print("​Oct"​);​+    display.print("​Oct"​);​<br>
     ​     ​
-    break;+    break;<br>
  
-    case 11: +    case 11:<br> 
-    display.setTextSize(1);​ +    display.setTextSize(1);​<br> 
-    display.setTextColor(WHITE);​+    display.setTextColor(WHITE);​<br>
     display.setCursor(70,​0);​     display.setCursor(70,​0);​
-    display.print("​Nov"​);​+    display.print("​Nov"​);​<br>
     ​     ​
-    break;+    break;<br>
  
-    case 12: +    case 12:<br> 
-    display.setTextSize(1);​ +    display.setTextSize(1);​<br> 
-    display.setTextColor(WHITE);​ +    display.setTextColor(WHITE);​<br> 
-    display.setCursor(70,​0);​ +    display.setCursor(70,​0);​<br> 
-    display.print("​Dec"​);​+    display.print("​Dec"​);​<br>
     ​     ​
-    break; +    break;<br> 
-   }+   }<br>
        
-  /////////////​HOUR HAND///////////////​ +  /////////////​HOUR HAND///////////////​<br> 
-  float x1, y1, a, b; +  float x1, y1, a, b;<br> 
-  const float pi = 3.14; +  const float pi = 3.14;<br> 
-  a=((hour-15)*30);​ +  a=((hour-15)*30);​<br> 
-  b = (a*pi)/180;+  b = (a*pi)/180;<br>
   ​   ​
-  x1=40+(9*cos(b));​ +  x1=40+(9*cos(b));​<br> 
-  y1=41+(9*sin(b));​+  y1=41+(9*sin(b));​<br>
  
-  display.drawLine(40,​41,​ x1, y1, WHITE);+  display.drawLine(40,​41,​ x1, y1, WHITE);<br>
  
-  /////////////​MINUTE HAND///////////////​ +  /////////////​MINUTE HAND///////////////​<br> 
-//  float x1, y1, a, b; +//  float x1, y1, a, b;<br> 
-//  const float pi = 3.14; +//  const float pi = 3.14;<br> 
-  a=((minute-15)*6);​ +  a=((minute-15)*6);​<br> 
-  b = (a*pi)/180;+  b = (a*pi)/180;<br>
   ​   ​
-  x1=40+(17*cos(b));​ +  x1=40+(17*cos(b));​<br> 
-  y1=41+(17*sin(b));​+  y1=41+(17*sin(b));​<br>
  
-  display.drawLine(40,​41,​ x1, y1, WHITE);+  display.drawLine(40,​41,​ x1, y1, WHITE);<br>
  
-  /////////////​SECOND HAND///////////////​ +  /////////////​SECOND HAND///////////////​<br> 
-  //float x1, y1, a, b; +  //float x1, y1, a, b;<br> 
-  a=((second-15)*6);​ +  a=((second-15)*6);​<br> 
-  b = (a*pi)/180;+  b = (a*pi)/180;<br>
   ​   ​
-  x1=40+(19*cos(b));​ +  x1=40+(19*cos(b));​<br> 
-  y1=41+(19*sin(b));​+  y1=41+(19*sin(b));​<br>
  
-  display.drawLine(40,​41,​ x1, y1, WHITE);+  display.drawLine(40,​41,​ x1, y1, WHITE);<br>
  
        
-////////////////​PARTS OF THE ANALOG CLOCK THAT WILL NOT BE MOVING////////////////​ +////////////////​PARTS OF THE ANALOG CLOCK THAT WILL NOT BE MOVING////////////////​<br> 
-display.drawCircle(40,​ 41, 22, WHITE); +display.drawCircle(40,​ 41, 22, WHITE);<br> 
-display.drawCircle(40,​ 41, 1, WHITE);+display.drawCircle(40,​ 41, 1, WHITE);<br>
  
-display.drawLine(40,​ 20, 40, 25, WHITE); //12 +display.drawLine(40,​ 20, 40, 25, WHITE); //12<br> 
-display.drawLine(40,​ 63, 40, 58, WHITE); //6 +display.drawLine(40,​ 63, 40, 58, WHITE); //6<br> 
-display.drawLine(62,​ 41, 57, 41, WHITE); //3 +display.drawLine(62,​ 41, 57, 41, WHITE); //3<br> 
-display.drawLine(19,​ 41, 24, 41, WHITE); //9 +display.drawLine(19,​ 41, 24, 41, WHITE); //9<br> 
-display.drawLine(50,​ 24, 47, 28, WHITE); //1 +display.drawLine(50,​ 24, 47, 28, WHITE); //1<br> 
-display.drawLine(57,​ 31, 53, 34, WHITE); //2 +display.drawLine(57,​ 31, 53, 34, WHITE); //2<br> 
-display.drawLine(60,​ 51, 54, 48, WHITE); //4 +display.drawLine(60,​ 51, 54, 48, WHITE); //4<br> 
-display.drawLine(51,​ 58, 48, 54, WHITE); //5 +display.drawLine(51,​ 58, 48, 54, WHITE); //5<br> 
-display.drawLine(29,​ 58, 32, 54, WHITE); //7 +display.drawLine(29,​ 58, 32, 54, WHITE); //7<br> 
-display.drawLine(21,​ 51, 25, 48, WHITE); //8+display.drawLine(21,​ 51, 25, 48, WHITE); //8<br>
  
-display.drawLine(22,​ 31, 27, 33, WHITE); //10 +display.drawLine(22,​ 31, 27, 33, WHITE); //10<br> 
-display.drawLine(30,​ 23, 32, 28, WHITE); //11+display.drawLine(30,​ 23, 32, 28, WHITE); //11<br>
   ​   ​
-}+}<br>
  
-void ReadTempAndHum () +void ReadTempAndHum ()<br> 
-+{<br> 
-    int chk = DHT.read11(DHT11_PIN);​+    int chk = DHT.read11(DHT11_PIN);​<br>
  
-  display.setTextSize(1);​ +  display.setTextSize(1);​<br> 
-  display.setTextColor(WHITE);​ +  display.setTextColor(WHITE);​<br> 
-  display.setCursor(70,​45);​ +  display.setCursor(70,​45);​<br> 
-  display.print("​Temp:​ "); +  display.print("​Temp:​ ");<br> 
-  display.print(DHT.temperature,​ 0); +  display.print(DHT.temperature,​ 0);<br> 
-  display.print("​C"​);​+  display.print("​C"​);​<br>
  
-  display.setCursor(70,​56);​ +  display.setCursor(70,​56);​<br> 
-  display.print("​Hum:​ "); +  display.print("​Hum:​ ");<br> 
-  display.print(DHT.humidity,​ 0); +  display.print(DHT.humidity,​ 0);<br> 
-  display.print("​%"​);​+  display.print("​%"​);​<br>
  
-Serial.print("​ Humidity: " ); +Serial.print("​ Humidity: " );<br> 
-Serial.print(DHT.humidity,​ 1); +Serial.print(DHT.humidity,​ 1);<br> 
-Serial.print("​%"​);​ +Serial.print("​%"​);​<br> 
-Serial.print("​ | Temperature:​ "); +Serial.print("​ | Temperature:​ ");<br> 
-Serial.print(DHT.temperature,​ 1); +Serial.print(DHT.temperature,​ 1);<br> 
-Serial.println("​C"​);​ +Serial.println("​C"​);​<br> 
-}+}<br>
  
-void loop() { +void loop() {<br> 
-  byte second, minute, hour, dayOfWeek, dayOfMonth, month, year; +  byte second, minute, hour, dayOfWeek, dayOfMonth, month, year;<br> 
-  // retrieve data from DS3231 +  // retrieve data from DS3231<br> 
-  readDS3231time(&​second,​ &​minute,​ &hour, &​dayOfWeek,​ &​dayOfMonth,​ &​month,​ +  readDS3231time(&​second,​ &​minute,​ &hour, &​dayOfWeek,​ &​dayOfMonth,​ &month,<br> 
-  &​year);​ +  &year);<br> 
-  displayTime();​ // display the real-time clock data on the Serial Monitor,+  displayTime();​ // display the real-time clock data on the Serial Monitor,<br>
    
-  DHTtimer = DHTtimer + 1;+  DHTtimer = DHTtimer + 1;<br>
  
-  //To ensure that the DHT is read only every 2 seconds, we make a count that goes for 2 seconds +  //To ensure that the DHT is read only every 2 seconds, we make a count that goes for 2 seconds<br> 
-  if (DHTtimer > 1) +  if (DHTtimer > 1)<br> 
-  { +  {<br> 
-  display.fillRect(70,​ 45, 128, 64, BLACK); +  display.fillRect(70,​ 45, 128, 64, BLACK);<br> 
-  ReadTempAndHum (); +  ReadTempAndHum ();<br> 
-  DHTtimer = 0; +  DHTtimer = 0;<br> 
-  } +  }<br> 
-  delay(1000);​+  delay(1000);​<br>
  
-  display.display();​ +  display.display();​<br> 
-  //The portion of the screen that shows the time and date are cleared +  //The portion of the screen that shows the time and date are cleared<br> 
-  display.fillRect(0,​ 0, 64, 64, BLACK); +  display.fillRect(0,​ 0, 64, 64, BLACK);<br> 
-  display.fillRect(0,​ 0, 128, 20, BLACK);+  display.fillRect(0,​ 0, 128, 20, BLACK);<br>
  
-  if (hour== h && minute== m && second == s) { +  if (hour== h && minute== m && second == s) {<br> 
-    tone(buzzer,​ 1000); +    tone(buzzer,​ 1000);<br> 
-    delay(1000);​+    delay(1000);​<br>
     ​     ​
-  }+  }<br>
   ​   ​
-}+}<br>
   ​   ​
  
Line 506: Line 504:
  
  
-    +===== Rezultate ​Obtinute ​===== 
-===== Rezultate ​Obţinute ​=====+
     ​     ​
-Proiectul a fost foarte distractiv de facut, am invatat o multime de lucruri pe parcursul acestuia si sper ca o sa mai am sansa de a lucra la alte proiecte arduino in viitor.+{{:​pm:​prj2022:​cstan:​dtthd_1.jpeg?​300|}} ​                 {{:​pm:​prj2022:​cstan:​dtthd_3.jpeg?​250|}} 
 + 
 + 
 + 
 + 
 +{{:​pm:​prj2022:​cstan:​dtthd_2.jpeg?​400|}} 
 + 
 + 
 + 
 ===== Concluzii ===== ===== Concluzii =====
  
 +Proiectul a fost foarte distractiv de facut, am invatat o multime de lucruri pe parcursul acestuia si sper ca o sa mai am sansa de a lucra la alte proiecte arduino in viitor.
 ===== Download ===== ===== Download =====
  
 +Cod:
 +
 +{{:​pm:​prj2022:​cstan:​alarm_clock.rar|}}
 +
 +Librarii:
 +
 +{{:​pm:​prj2022:​cstan:​libraries.rar|}}
  
 ===== Jurnal ===== ===== Jurnal =====
 +
 +10 mai - achizitionare componente
 +
 +10 mai - realizare proiect
 +
 +11 mai - adaptare cod, functionare partiala
 +
 +15 mai - finalizare proiect, complet functional
 +
  
 ===== Bibliografie/​Resurse ===== ===== Bibliografie/​Resurse =====
 +
 +github.com
 +
 +create.arduino.cc
  
 <​html><​a class="​media mediafile mf_pdf"​ href="?​do=export_pdf">​Export to PDF</​a></​html>​ <​html><​a class="​media mediafile mf_pdf"​ href="?​do=export_pdf">​Export to PDF</​a></​html>​
  
    
pm/prj2022/cstan/date_time_temperature_and_humidity_display.1653680383.txt.gz · Last modified: 2022/05/27 22:39 by aryan.zabihi
CC Attribution-Share Alike 3.0 Unported
www.chimeric.de Valid CSS Driven by DokuWiki do yourself a favour and use a real browser - get firefox!! Recent changes RSS feed Valid XHTML 1.0