Build a mini weather station ☂️

Make your own mini weather station to get the weather forcast by using Arduino UNO, DHT11, and LCD. Lorem ipsum dolor sit ametsdfhsdfhsdfhsdfhdsffhdshdshdshsdhdshdshsdfhdsfhdfshsdfhsdhsdhsdhdshdfhconsectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit.

Overview


Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.

Getting the items


Sale Off
Voltaat (6x10x3) Ball Bearing
3 QAR
Sale Off
Voltaat (2x5x2.5) Ball Bearing
3 QAR
Sale Off
Voltaat 12V Electric Solenoid Lock
34 QAR
Sale Off
Voltaat 12 V DC Diaphragm pump
39 QAR

Wiring it up


The connections between the components we mentioned are straight forward (you can also check the wiring):

Connections from the Arduino to the breadboard:

  • Arduino pin GND → Breadboard ground line
  • Arduino pin 5V → Breadboard 5V line

Connections from the LCD I2C driver:

  • LCD GND → Breadboard ground line
  • LCD Vcc → Breadboard 5V line
  • LCD SDA → Arduino pin A4
  • LCD SCL → Arduino pin A5

Connections from the DHT sensor:

  • DHT GND → Breadboard ground line
  • DHT Vcc → Breadboard 5V line
  • DHT Signal → Arduino pin 2

Coding


This sketch will get the distance that is detected by the ultrasonic sensor and display it on the serial monitor.


  1. #include
  2. #if defined(ESP32)
  3. #include
  4. #elif defined(ESP8266)
  5. #include
  6. #endif
  7. #include
  8.  
  9. //Provide the token generation process info.
  10. #include "addons/TokenHelper.h"
  11. //Provide the RTDB payload printing info and other helper functions.
  12. #include "addons/RTDBHelper.h"
  13.  
  14. // Insert your network credentials
  15. #define WIFI_SSID "Haya"
  16. #define WIFI_PASSWORD "12345678"
  17.  
  18. // Insert Firebase project API Key
  19. #define API_KEY "AIzaSyAqL7y_WElgCZTcnLIxyAzwZMNx0apICYA"
  20.  
  21. // Insert RTDB URLefine the RTDB URL */
  22. #define DATABASE_URL "https://oaqm-testing-default-rtdb.firebaseio.com/"
  23.  
  24. //Define Firebase Data object
  25. FirebaseData fbdo;
  26.  
  27. FirebaseAuth auth;
  28. FirebaseConfig config;
  29.  
  30. unsignedlong sendDataPrevMillis =0;
  31. int count =0;
  32. bool signupOK =false;
  33.  
  34. double Lat, Long;
  35.  
  36.  
  37. void setup(){
  38.  
  39. Serial.begin(115200);
  40.  
  41.  
  42. ////////////////////////////////////// Connecting to Wifi Code //////////////////////////////////////
  43. WiFi.begin(WIFI_SSID, WIFI_PASSWORD);
  44. Serial.print("Connecting to Wi-Fi");
  45. while(WiFi.status()!= WL_CONNECTED){
  46. Serial.print(".");
  47. delay(300);
  48. }
  49. Serial.println();
  50. Serial.print("Connected with IP: ");
  51. Serial.println(WiFi.localIP());
  52. Serial.println();
  53.  
  54. /////////////////////////////////////////////////////////////////////////////////////////////////////
  55.  
  56. ////////////////////////////////////// Connecting to Firebase //////////////////////////////////////
  57.  
  58.  
  59. /* Assign the api key (required) */
  60. config.api_key= API_KEY;
  61.  
  62. /* Assign the RTDB URL (required) */
  63. config.database_url= DATABASE_URL;
  64.  
  65. /* Sign up */
  66. if(Firebase.signUp(&config,&auth,"","")){
  67. Serial.println("ok");
  68. signupOK =true;
  69. }
  70. else{
  71. Serial.printf("%s\n", config.signer.signupError.message.c_str());
  72. }
  73.  
  74. /* Assign the callback function for the long running token generation task */
  75. config.token_status_callback= tokenStatusCallback;//see addons/TokenHelper.h
  76.  
  77. Firebase.begin(&config,&auth);
  78. Firebase.reconnectWiFi(true);
  79.  
  80. /////////////////////////////////////////////////////////////////////////////////////////////////////
  81. }
  82.  
  83. int Bar =0, CO =0, COO =0, H2S =0, HUM =0, Alcohol =0, NO2 =0, O3 =0,
  84. Rain =0, Temp =0, Wind =0, HI =0, RH =0, PM25 =0, PM10 =0;
  85.  
  86. float TVOc =0;
  87.  
  88.  
  89.  
  90. int incomingByte =0;
  91. String readBuffer;
  92.  
  93. void loop(){
  94.  
  95. ////////////////////////////////////// Reading from Arduino //////////////////////////////////////
  96. readBuffer ="";
  97.  
  98.  
  99. boolean start =false;
  100.  
  101. while(Serial.available()){
  102. incomingByte = Serial.read();
  103.  
  104. delay(5);
  105. if(start ==true){
  106. if(incomingByte !='X'){
  107. readBuffer +=char(incomingByte);
  108. }
  109. else
  110. start =false;
  111. }
  112. elseif( incomingByte =='Y'){
  113. start =true;
  114. }
  115. }
  116.  
  117. /////////////////////////////////////////////////////////////////////////////////////////////////////
  118.  
  119.  
  120. ////////////////////////////////////// Analyizing messages from the Arduino //////////////////////////////////////
  121. if(!readBuffer.equals("")){
  122.  
  123.  
  124. Serial.print("Incoming: ");
  125. Serial.println(readBuffer);
  126.  
  127.  
  128. if( readBuffer.indexOf("Alc")>=0){
  129.  
  130. Alcohol= readBuffer.substring(readBuffer.indexOf("Alc")+3).toInt();
  131. Serial.print("Message: ");
  132. Serial.println(Alcohol);
  133. }
  134.  
  135. elseif( readBuffer.indexOf("CO")>=0){
  136.  
  137. CO= readBuffer.substring(readBuffer.indexOf("CO")+2).toInt();
  138. Serial.print("Message: ");
  139. Serial.println(CO);
  140. }
  141.  
  142. elseif( readBuffer.indexOf("Rain")>=0){
  143.  
  144. Rain= readBuffer.substring(readBuffer.indexOf("Rain")+4).toInt();
  145. Serial.print("Message: ");
  146. Serial.println(Rain);
  147. }
  148.  
  149.  
  150. elseif( readBuffer.indexOf("Temp")>=0){
  151.  
  152. Temp= readBuffer.substring(readBuffer.indexOf("Temp")+4).toInt();
  153. Serial.print("Message: ");
  154. Serial.println(Temp);
  155. }
  156.  
  157. elseif( readBuffer.indexOf("HUM")>=0){
  158.  
  159. HUM= readBuffer.substring(readBuffer.indexOf("HUM")+3).toInt();
  160. Serial.print("Message: ");
  161. Serial.println(HUM);
  162. }
  163.  
  164.  
  165. elseif( readBuffer.indexOf("Rain")>=0){
  166.  
  167. Rain= readBuffer.substring(readBuffer.indexOf("Rain")+4).toInt();
  168. Serial.print("Message: ");
  169. Serial.println(Rain);
  170. }
  171.  
  172.  
  173. elseif( readBuffer.indexOf("Long")>=0){
  174.  
  175. Long= readBuffer.substring(readBuffer.indexOf("Long")+4).toFloat();
  176. Serial.print("Message: ");
  177. Serial.println(Long);
  178. }
  179.  
  180.  
  181. elseif( readBuffer.indexOf("Lat")>=0){
  182.  
  183. Lat= readBuffer.substring(readBuffer.indexOf("Lat")+3).toFloat();
  184. Serial.print("Message: ");
  185. Serial.println(Lat);
  186. }
  187.  
  188.  
  189.  
  190. /////////////////////////////////////////////////////////////////////////////////////////////////////
  191.  
  192. }
  193.  
  194. ////////////////////////////////////// Sending to Firebase //////////////////////////////////////
  195.  
  196. if(Firebase.ready()&& signupOK &&(millis()- sendDataPrevMillis >15000|| sendDataPrevMillis ==0)){
  197. sendDataPrevMillis = millis();
  198.  
  199.  
  200.  
  201. Firebase.RTDB.setInt(&fbdo,"Device2/CO", CO);
  202. delay(100);
  203. Firebase.RTDB.setInt(&fbdo,"Device2/Alcohol", Alcohol);
  204. delay(100);
  205. Firebase.RTDB.setInt(&fbdo,"Device2/Humidity", HUM);
  206. delay(100);
  207. Firebase.RTDB.setInt(&fbdo,"Device2/Rain", Rain);
  208. delay(100);
  209. Firebase.RTDB.setInt(&fbdo,"Device2/Temp", Temp);
  210. delay(100);
  211. Firebase.RTDB.setInt(&fbdo,"Device2/Latitude", Lat);
  212. delay(100);
  213. Firebase.RTDB.setInt(&fbdo,"Device2/Longitude", Long);
  214. delay(100);
  215.  
  216.  
  217. }
  218.  
  219. /////////////////////////////////////////////////////////////////////////////////////////////////////
  220. }

3D printing 


Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea Make your own mini weather station to get the weather forcast by using Arduino UNO, DHT11, and LCD. Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit.

Testing it out


Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.

Resources 


Arduino Code

LCD Library
DHt11 Library

Fritzing Wiring file

Related Tutorials


How to become very good 

Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et 

How to become very good 

Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et 

How to become very good 

Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et 

Liquid error: Could not find asset snippets/zend_pre_order_theme_snippet.liquid
Liquid error: Could not find asset snippets/uploadkit.liquid