User Tools

Site Tools


amc2022:groups:start

Differences

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

Link to this comparison view

Both sides previous revisionPrevious revision
Next revision
Previous revision
amc2022:groups:start [2022/09/09 20:42] – [DHT11 Sensor Module] emilie001amc2022:groups:start [2022/09/10 23:57] (current) – [Video] emilie001
Line 13: Line 13:
   * 10k potentiometer   * 10k potentiometer
   * 220 ohm resistor   * 220 ohm resistor
-  * Bread boards+  * Breadboards
   * male-to-male jumper cable   * male-to-male jumper cable
  
 ====Elegoo Uno==== ====Elegoo Uno====
-The Elegoo Uno is a microcontroller board that can be programmed with Arduino IDE. It has several pins than be set as in or output for data with using different functions. By installing additional libraries into Arduino IDE the board is able to communicate with a variety of sensors modules and other micro controllers the board has a great range of use.+The Elegoo Uno is a microcontroller board that can be programmed with Arduino IDE. It has several pins than can be set as in or output for data by using different functions. By installing additional libraries into Arduino IDE the board is able to communicate with a variety of sensor modules and other microcontrollers the board has a great range of use.
 ===How to use the Elegoo Uno===  ===How to use the Elegoo Uno=== 
 As mentioned above the Uno is programable with Arduino IDE. To program it you have to connect the board via USB. The written code can then be compiled and uploaded onto the microcontroller.  As mentioned above the Uno is programable with Arduino IDE. To program it you have to connect the board via USB. The written code can then be compiled and uploaded onto the microcontroller. 
 ====LCD Display==== ====LCD Display====
-The LCD display can be used to print values obtained from the measurement of a sensor. It can be used instead of the serial monitor to make a system independent and mobile. The display needs a 5V power supply. Depending on how many of the pins are utilized it can either be used in 4-bit or 8-bit mode. Because of limited availability of digital output pins on the Eleggoo Uno  4-bit or 4-wire mode is usually preferred.+The LCD display can be used to print values obtained from the measurement of a sensor. It can be used instead of the serial monitor to make a system independent and mobile. The display needs a 5V power supply. Depending on how many of the pins are utilized it can either be used in 4-bit or 8-bit mode. Because of the limited availability of digital output pins on the Eleggoo Uno  4-bit or 4-wire mode is usually preferred.
  
 ===How to use the LCD=== ===How to use the LCD===
-The LCD module has 16 different pins connected to the board as shown in figure x. The 10k potentiometer connected to the V0 pin can change the brightness and contrast of the display when being turned rather than setting the brightness to one particular level. To program the LCD the library LiquidCrystal needs to be installed. To test if the set-up works [[https://www.arduino.cc/en/Tutorial/LibraryExamples/HelloWorld| this example]] included in the library was used.\\+The LCD module has 16 different pins connected to the board as shown in <imgref image1>. The 10k potentiometer connected to the V0 pin can change the brightness and contrast of the display when being turned rather than setting the brightness to one particular level. To program the LCD the library LiquidCrystal needs to be installed. To test if the set-up works [[https://www.arduino.cc/en/Tutorial/LibraryExamples/HelloWorld| this example]] included in the library was used.\\
  
 <imgcaption image1|LCD Set-up (Source: https://www.arduino.cc/wiki/static/7d7b6e99f40c7e55f2e9c6175c6db5b5/c1b63/LCD_Base_bb_Fritz.png>{{https://www.arduino.cc/wiki/static/7d7b6e99f40c7e55f2e9c6175c6db5b5/c1b63/LCD_Base_bb_Fritz.png?450}}</imgcaption> <imgcaption image1|LCD Set-up (Source: https://www.arduino.cc/wiki/static/7d7b6e99f40c7e55f2e9c6175c6db5b5/c1b63/LCD_Base_bb_Fritz.png>{{https://www.arduino.cc/wiki/static/7d7b6e99f40c7e55f2e9c6175c6db5b5/c1b63/LCD_Base_bb_Fritz.png?450}}</imgcaption>
Line 56: Line 56:
  
 <WRAP half column> <WRAP half column>
-The DHT11 is a sensor that can measure temperature and humidity. It is pre-calibrated and can measure temperatures between 0 – 50°C with an accuracy of ± 2°C and relative humidity between 20 – 90 % with an accuracy of ± 5%. The resolution for both is 16-bit. The sensor needs a power supply of 3V and up to 5.5 V and during measurement has an operating current of 0.5 mA up to 2.5mA.+The DHT11 is a sensor that can measure temperature and humidity. It is pre-calibrated and can measure temperatures between 0 – 50°C with an accuracy of ± 2°C and relative humidity between 20 – 90 % with an accuracy of ± 5%. The resolution for both is 16-bit. The sensor needs a power supply of 3V and up to 5.5 V and during measurement has an operating current of 0.5 mA up to 2.5mA. The sensor can be seen in <imgref dht11.jpeg>
  
 </WRAP> </WRAP>
Line 70: Line 70:
  
 ===How to use DHT11=== ===How to use DHT11===
-In order to use the sensor module it has to be appropriately connected to the microcontroller board. The module has three pins, VCC, Ground and a data pin (see figure x). The VCC is connected to the 5V power outlet, GND is connected to GND and the data pin is connected to a digital output pin as shown in figure.\\ To program the sensor the right Arduino library has to be installed, in this case the DHT.h library. To test if the sensor was set up properly the following code was used. The heat index was mainly included to test printing characters in as many positions of the LCD as possible and would later be replaced with the CO<sub>2</sub> concentration.+In order to use the sensor moduleit has to be appropriately connected to the microcontroller board. The module has three pins, VCC, Ground and a data pin (see <imgref dht11.jpeg>). The VCC is connected to the 5V power outlet, GND is connected to GND and the data pin is connected to a digital output pin.\\ To program the sensor the right Arduino library has to be installed, in this case the DHT.h library. To test if the sensor was set up properly the following code was used. The heat index was mainly included to test printing characters in as many positions of the LCD as possible and would later be replaced with the CO<sub>2</sub> concentration.
  
 <code c++> <code c++>
Line 96: Line 96:
 float temp = dht.readTemperature(); // Read temperature in celcius float temp = dht.readTemperature(); // Read temperature in celcius
 float hum = dht.readHumidity(); // Read relative humidity in % float hum = dht.readHumidity(); // Read relative humidity in %
-float hi = dht.computeHeatIndex(temp, hum); // Heat index gives the temperature that is felt by humans; dependend on temp. & humidity+float hi = dht.computeHeatIndex(temp, hum); // Heat index gives the temperature that is felt by humans; depending on temp. & humidity
  
 lcd.setCursor(0,0); // setCursor function sets where the text start 0 is the first line and first field lcd.setCursor(0,0); // setCursor function sets where the text start 0 is the first line and first field
Line 120: Line 120:
 <WRAP group> <WRAP group>
 <WRAP half column> <WRAP half column>
-The MQ 135 is a sensor that measures the concentration of CO2 and other gases in air. It needs a 5V power supply to operate and has a working current of 150mA. The module has one digital and one analog pin for data output. The material used to sense the gas concentration is SnO<sub>2</sub> which is a metal oxide semiconductor which changes its resistance in contact with gases. R<sub>0</sub> is the internal resistance of the sensor in clean air, and R<sub>S</sub> is the resistance of the sensor in contact with different gases. With the R<sub>0</sub> and R<sub>S</sub> values the concentration in ppm can be calculated.+The MQ 135 is a sensor that measures the concentration of CO2 and other gases in air. It needs a 5V power supply to operate and has a working current of 150mA. The module has one digital and one analog pin for data output. The material used to sense the gas concentration is SnO<sub>2</sub> which is a metal oxide semiconductor which changes its resistance in contact with gases. R<sub>0</sub> is the internal resistance of the sensor in clean air, and R<sub>S</sub> is the resistance of the sensor in contact with different gases. With the R<sub>0</sub> and R<sub>S</sub> values the concentration in ppm can be calculated. The stainless steel mesh layer as seen in <imgref mq135.jpeg> is there to protect the sensor from particular matter and other disturbances.
 </WRAP> </WRAP>
  
 <WRAP half column> <WRAP half column>
  
-<imgcaption image1|DHT11>{{ :amc2022:groups:mq135.jpeg?200 }}</imgcaption>+<imgcaption mq135.jpeg|MQ135 sensor Module (Taken by Emilie Streichsbier)>{{ :amc2022:groups:mq135.jpeg?200 }}</imgcaption>
 </WRAP> </WRAP>
 </WRAP> </WRAP>
Line 144: Line 144:
 <WRAP group> <WRAP group>
 <WRAP half column> <WRAP half column>
-The DS1307 is a real-time clock module which can be used to measure time. Once the RTC is initialized by setting it to the current time including year, month and day of the week it continuously counts time.  It needs a supply voltage of 5V. If the main power source is disrupted the RTC switches its power supply to a 3V button battery to ensure the continues measurement of time. +The DS1307 is a real-time clock module which can be used to measure time. Once the RTC is initialized by setting it to the current time including year, month and day of the week it continuously counts time.  It needs a supply voltage of 5V. If the main power source is disrupted the RTC switches its power supply to a 3V button battery to ensure the continuous measurement of time. 
 </WRAP> </WRAP>
  
 <WRAP half column> <WRAP half column>
-{{ :amc2022:groups:rtc.jpeg?200 }} +<imgcaption rtc.jpeg|RTC DS1307 Module (Taken by Emilie Streichsbier>{{ :amc2022:groups:rtc.jpeg?200 }}</imgcaption>
-<imgcaption image1|></imgcaption>+
 </WRAP> </WRAP>
 </WRAP> </WRAP>
Line 156: Line 155:
 ===How to use DS1307=== ===How to use DS1307===
 To access the current time the RTC has to be set once. To set it with the serial monitor [[https://elektro.turanis.de/html/prj060/index.html | this code]] was used. The Wire library and later to access and display the time the libraries DS1307RTC, DS1307 and TimeLib had to be installed.\\ To access the current time the RTC has to be set once. To set it with the serial monitor [[https://elektro.turanis.de/html/prj060/index.html | this code]] was used. The Wire library and later to access and display the time the libraries DS1307RTC, DS1307 and TimeLib had to be installed.\\
-{{:amc2022:groups:settingtime.jpeg?400}}+<imgcaption settingtime.jpeg|Setting the time in the serial monitor>{{:amc2022:groups:settingtime.jpeg?400}}</imgcaption>
  
  
 The project went through different development phases. The circuit as well as the code have been changed over time. Every sensor was tested separately before combining the system together. At first, the LCD display was set up as the basis of the project as described [[https://wiki.eolab.de/doku.php?id=amc2022:groups:start#LCD Display|above]]. Then the DHT11 was added next. After that, the RTC was initiated and incorporated to print the time on the LCD. Lastly, the MQ135 was calibrated and added to the system. Initially, the LCD showed the heat index obtained by the DHT11, which was replaced by the CO<sub>2</sub> concentration. Because of lacking space on the display, the concentration is not displayed with its appropriate unit (ppm) and CO<sub>2</sub> had to be abbreviated as "C" The calibration and troubleshooting process for the MQ135 is further described in the chapter [[https://wiki.eolab.de/doku.php?id=amc2022:groups:start#Results and Discussion|Results and Discussion]]. The project went through different development phases. The circuit as well as the code have been changed over time. Every sensor was tested separately before combining the system together. At first, the LCD display was set up as the basis of the project as described [[https://wiki.eolab.de/doku.php?id=amc2022:groups:start#LCD Display|above]]. Then the DHT11 was added next. After that, the RTC was initiated and incorporated to print the time on the LCD. Lastly, the MQ135 was calibrated and added to the system. Initially, the LCD showed the heat index obtained by the DHT11, which was replaced by the CO<sub>2</sub> concentration. Because of lacking space on the display, the concentration is not displayed with its appropriate unit (ppm) and CO<sub>2</sub> had to be abbreviated as "C" The calibration and troubleshooting process for the MQ135 is further described in the chapter [[https://wiki.eolab.de/doku.php?id=amc2022:groups:start#Results and Discussion|Results and Discussion]].
- 
- 
  
  
 =====Results and Discussion===== =====Results and Discussion=====
-As described above the building of the system was done stepwise to make sure each part was working correctly. The final set-up included two breadboards because the LCD took up more space than expected.  +As described above the building of the system was done stepwise to make sure that the functionality of each part was understood and everything was working correctly. The final set-up included two breadboards because the LCD took up more space than expected. In <imgref finalsetup.jpeg> the exact setup can be seen. The first line of LCD displayed the room temperature in Celsius and the hours and minutes. The second line shows the relative humidity in percent and the CO<sub>2</sub> concentration in ppm. Due to limited space, the unit could not be displayed.  
-{{ :amc2022:groups:finalsetup.jpeg?600 }} +<imgcaption finalsetup.jpeg| Final set-up (Taken by Emilie Streichsbier)>{{ :amc2022:groups:finalsetup.jpeg?600 }}</imgcaption> 
- +The resulting schematics of the final composition can be seen in <imgref roomclimate_sketch_2_schemfinal.png>.  
-The resulting schematics of the final composition can be seen in figure xx.  +<imgcaption roomclimate_sketch_2_schemfinal.png|Schematics of the room climate station, created with fritzing>{{:amc2022:groups:roomclimate_sketch_2_schemfinal.png}} 
-{{:amc2022:groups:roomclimate_sketch_2_schemfinal.png}} +</imgcaption>
-<imgcaption image6|>Schematics of the roomclimate station</imgcaption>+
 The code was written in a similar way though it was mostly one piece of code that was expanded over time.  The code was written in a similar way though it was mostly one piece of code that was expanded over time. 
 <code c++> <code c++>
Line 260: Line 256:
   * The relative humidity suddenly was lower than during any test before. Usually varying from 45 to 60% it suddenly never measured a value over 40% even when placed in rooms with higher humidity.   * The relative humidity suddenly was lower than during any test before. Usually varying from 45 to 60% it suddenly never measured a value over 40% even when placed in rooms with higher humidity.
 As the MQ135 heats up significantly when in use this might be an explanation for the changed results of the DHT11. To test that the MQ135 was removed from the breadboard to eliminate the suspected interference. The DHT11 still measured temperatures that were unrealistic. Right next to an open window and an outside temperature of 20°C the sensor showed a temperature of 25°C. Even with the expected margin of error that measurement is not reasonable. The humidity measurements seemed to improve, returning to their previous range between 45 and 60%.\\ As the MQ135 heats up significantly when in use this might be an explanation for the changed results of the DHT11. To test that the MQ135 was removed from the breadboard to eliminate the suspected interference. The DHT11 still measured temperatures that were unrealistic. Right next to an open window and an outside temperature of 20°C the sensor showed a temperature of 25°C. Even with the expected margin of error that measurement is not reasonable. The humidity measurements seemed to improve, returning to their previous range between 45 and 60%.\\
-Additionally, the CO<sub>2</sub> concentrations were always above the recommended 1400 ppm. Often the measurement was well over 3000 ppm even after airing out for a long period of time. According to the MQ135 [[https://cdn.shopify.com/s/files/1/1509/1638/files/MQ-135_Gas_Sensor_Modul_Datenblatt_AZ-Delivery_Vertriebs_GmbH_94c8b153-6f8e-4696-8cfa-0d8ba832d603.pdf?v=1608535104|datasheet]] the sensor needs a period of up to 48 hours to preheat. But even after over 96 hours without interruption, the measurements were still too high.\\ Additional sources suggested that the MQ135 had to be calibrated by heating up and then measuring and manually correcting the given R<sub>0</sub> in the MQ135 library. After changing the R<sub>0</sub> from originally 76.63 to 45.68 the quality of the measurement did not increase.\\ Lastly, the sensitivity of the sensor module was adjusted by turning the on-board potentiometer on the back of the sensor module. With each change in sensitivity, the sensor ran for at least one hour. Although there was a definite change in the measurements even at the lowest sensitivity the value for the CO<sub>2</sub> concentration was constantly above 1200 ppm at first.\\ After randomly pulling the plug and putting it back in the concentration varied between 250 and 650 ppm at the lowest sensitivity setting. It cannot distinctly be concluded what fixed the sensor’s measurement. Even though the obtained values for the CO<sub>2</sub> concentration seem much more appropiate, it cannot be said for sure whether they are correct or not.+Additionally, the CO<sub>2</sub> concentrations were always above the recommended 1400 ppm. Often the measurement was well over 3000 ppm even after airing out for a long period of time. According to the MQ135 [[https://cdn.shopify.com/s/files/1/1509/1638/files/MQ-135_Gas_Sensor_Modul_Datenblatt_AZ-Delivery_Vertriebs_GmbH_94c8b153-6f8e-4696-8cfa-0d8ba832d603.pdf?v=1608535104|datasheet]] the sensor needs a period of up to 48 hours to preheat. But even after over 96 hours without interruption, the measurements were still too high.\\ Additional sources suggested that the MQ135 had to be calibrated by heating up and then measuring and manually correcting the given R<sub>0</sub> in the MQ135 library. After changing the R<sub>0</sub> from originally 76.63 to 45.68 the quality of the measurement did not increase. This code was used to obtain the new R<sub>0</sub> displayed in the serial monitor. The value was only changed after the sensor ran for at least 24 hours undisturbed and did not change anymore. 
 +<code c++> 
 +#include "MQ135.h" 
 +void setup (){ 
 +Serial.begin (9600); 
 +
 +void loop() { 
 +MQ135 gasSensor = MQ135(A0); // Attach sensor to pin A0 
 +float rzero = gasSensor.getRZero(); 
 +Serial.println (rzero); 
 +delay(1000); 
 +
 +</code> 
 + 
 +Lastly, the sensitivity of the sensor module was adjusted by turning the on-board potentiometer on the back of the sensor module. With each change in sensitivity, the sensor ran for at least one hour. Although there was a definite change in the measurements even at the lowest sensitivity the value for the CO<sub>2</sub> concentration was constantly above 1200 ppm at first.\\ After randomly pulling the plug and putting it back in the concentration varied between 350 and 1000 ppm at the lowest sensitivity setting. It cannot distinctly be concluded what improved the sensor’s measurements. Even though the obtained values for the CO<sub>2</sub> concentration seem much more appropriate, it cannot be said for sure whether they are correct or not.
 =====Conclusion and Outlook===== =====Conclusion and Outlook=====
 All in all, the system is functional. The communication between the sensors, the microcontroller and the LCD is working. It is unsure how accurate the obtained measurements are but as it is the system could be used as tool to give meaningful information and improve indoor air quality.\\ All in all, the system is functional. The communication between the sensors, the microcontroller and the LCD is working. It is unsure how accurate the obtained measurements are but as it is the system could be used as tool to give meaningful information and improve indoor air quality.\\
-Building and expanding the system stepwise helped to understand the different components and the code better. If this same project had to be recreated a bigger LCD and a more controllable environment to calibrate and set-up the gas sensor would be recommended. The bigger LCD would increase the accessibility and even more variables could be displayed. Additionally, things like the unit of CO<sub>2</sub> concentration could be included with no problem.+Building and expanding the system stepwise helped to understand the different components and the code better. If this same project had to be recreated a bigger LCD and a more controllable environment to calibrate and set-up the gas sensor would be recommended. The bigger LCD would increase the accessibility and even more variables could be displayed. Additionally, things like the unit of CO<sub>2</sub> concentration could be included with no problem.\\ 
 + 
 +====Video==== 
 +{{youtube>fCxlqfbRjq8?}} 
 + 
  
  
 =====References===== =====References=====
 +  * https://cdn.shopify.com/s/files/1/1509/1638/files/MQ-135_Gas_Sensor_Modul_Datenblatt_AZ-Delivery_Vertriebs_GmbH_94c8b153-6f8e-4696-8cfa-0d8ba832d603.pdf?v=1608535104
 +  * https://circuitdigest.com/article/16x2-lcd-display-module-pinout-datasheet
 +  * https://elektro.turanis.de/html/prj060/index.html
 +  * https://epow0.org/~amki/car_kit/Datasheet/ELEGOO%20UNO%20R3%20Board.pdf
 +  * https://www.mouser.com/datasheet/2/758/DHT11-Technical-Data-Sheet-Translated-Version-1143054.pdf
 +  * https://www.olimex.com/Products/Components/Sensors/Gas/SNS-MQ135/resources/SNS-MQ135.pdf
 +  * https://www.roboter-bausatz.de/projekte/dht11-temperatur-sensor-per-arduino-auslesen
 +  * https://www.sparkfun.com/datasheets/Components/DS1307.pdf
 +  * https://www.umweltbundesamt.de/sites/default/files/medien/pdfs/kohlendioxid_2008.pdf
 +
amc2022/groups/start.1662748920.txt.gz · Last modified: 2022/09/09 20:42 by emilie001