This shows you the differences between two versions of the page.
pm:prj2023:avaduva:wstation [2023/05/29 03:29] malina.popa [Hardware Design] |
pm:prj2023:avaduva:wstation [2023/05/30 13:16] (current) malina.popa [Software Design] |
||
---|---|---|---|
Line 38: | Line 38: | ||
==For the LCD 16x2== | ==For the LCD 16x2== | ||
- | - VSS pin on the LCD to the GND pin on the sensor DHT11; | + | - VDD pin on the LCD to the VCC pin on the sensor DHT11; |
- | - VDD pin on the LCD to the VCC pin on the sensor DHT11; | + | - VSS pin on the LCD to the GND pin on the sensor DHT11; |
- RS pin on the LCD to digital pin 12 on Arduino Uno; | - RS pin on the LCD to digital pin 12 on Arduino Uno; | ||
- E pin on the LCD to digital pin 11 on Arduino Uno; | - E pin on the LCD to digital pin 11 on Arduino Uno; | ||
Line 47: | Line 47: | ||
- D7 pin on the LCD to digital Pin 6 on Arduino Uno; | - D7 pin on the LCD to digital Pin 6 on Arduino Uno; | ||
- | ==Physical Project== | + | ===Electric Scheme=== |
- | {{https://ocw.cs.pub.ro/courses/_media/pm/prj2023/avaduva/weatherstation.png?400x200}} | + | {{https://ocw.cs.pub.ro/courses/_media/pm/prj2023/ws.png?800x400}} |
+ | ===Physical Project=== | ||
- | ===Software Design=== | + | {{https://ocw.cs.pub.ro/courses/_media/pm/prj2023/avaduva/weatherstation.png?300x200}} |
- | ==How does BMP180 work== | + | |
+ | ====Software Design==== | ||
+ | |||
+ | ===How do the sensors work=== | ||
+ | |||
+ | ==BMP180== | ||
- Sensing Principle: The BMP180 sensor uses a piezo-resistive pressure sensor to measure atmospheric pressure. It contains a microelectromechanical system (MEMS) pressure sensor that changes its resistance based on the applied pressure. The temperature is also measured using an integrated temperature sensor. | - Sensing Principle: The BMP180 sensor uses a piezo-resistive pressure sensor to measure atmospheric pressure. It contains a microelectromechanical system (MEMS) pressure sensor that changes its resistance based on the applied pressure. The temperature is also measured using an integrated temperature sensor. | ||
Line 66: | Line 72: | ||
- | ==How does DHT11 work== | + | ==DHT11== |
- Sensing Principle: The DHT11 sensor utilizes a capacitive humidity sensor to measure relative humidity (RH). It consists of two electrodes with a moisture-sensitive layer in between. The capacitance of this layer changes with the surrounding humidity, enabling RH measurement. Additionally, a thermistor (resistor that varies with temperature) is used to measure temperature. | - Sensing Principle: The DHT11 sensor utilizes a capacitive humidity sensor to measure relative humidity (RH). It consists of two electrodes with a moisture-sensitive layer in between. The capacitance of this layer changes with the surrounding humidity, enabling RH measurement. Additionally, a thermistor (resistor that varies with temperature) is used to measure temperature. | ||
Line 76: | Line 82: | ||
- Data Processing: The microcontroller receives the humidity and temperature data from the DHT11 and converts it into meaningful values. The humidity data is typically a percentage value, while the temperature data can be in Celsius or Fahrenheit, depending on the implementation. | - Data Processing: The microcontroller receives the humidity and temperature data from the DHT11 and converts it into meaningful values. The humidity data is typically a percentage value, while the temperature data can be in Celsius or Fahrenheit, depending on the implementation. | ||
- | ==How does the LCD work== | + | |
+ | ===Code Part=== | ||
+ | |||
+ | ==BMP180== | ||
+ | |||
+ | **1.** Library Initialization: | ||
+ | |||
+ | Including the BMP180 library in the Arduino sketch by adding the library header at the beginning of the code. | ||
+ | |||
+ | ''#include <Adafruit_Sensor.h>'' | ||
+ | |||
+ | ''#include <Adafruit_BMP085.h>'' | ||
+ | |||
+ | **2.** Sensor Initialization: | ||
+ | |||
+ | Creating an object for the BMP180 sensor. | ||
+ | |||
+ | ''Adafruit_BMP085 bmp;'' | ||
+ | |||
+ | **3.** Initialization: | ||
+ | |||
+ | In the ''setup()'' function of the Arduino sketch, initializing the sensor by calling the ''begin()'' function on the BMP180 object and checking if the sensor is working properly. | ||
+ | |||
+ | ''if (!bmp.begin()) {'' | ||
+ | |||
+ | ''lcd.print("BMP180 error!");'' | ||
+ | |||
+ | ''while (1);'' | ||
+ | |||
+ | '' }'' | ||
+ | |||
+ | **4.** Reading Sensor Data: | ||
+ | |||
+ | In the ''loop()'' function. | ||
+ | |||
+ | ''float temperature = bmp.readTemperature();'' | ||
+ | |||
+ | '' float pressure = bmp.readPressure() / 100.0;'' | ||
+ | |||
+ | ==DHT11== | ||
+ | |||
+ | **1.** Library Initialization: | ||
+ | |||
+ | Include the DHT sensor library in the Arduino sketch by adding the library header at the beginning of the code. | ||
+ | |||
+ | ''#include <DHT.h>'' | ||
+ | |||
+ | |||
+ | **2.**Sensor Initialization: | ||
+ | |||
+ | Define the DHT sensor type (DHT11) and the pin to which it is connected. | ||
+ | |||
+ | ''#define DHTPIN 2'' | ||
+ | |||
+ | ''#define DHTTYPE DHT11'' | ||
+ | |||
+ | ''DHT dht(DHTPIN, DHTTYPE);'' | ||
+ | |||
+ | where DHTPIN is the digital pin connected to the data pin of the DHT11, and DHTTYPE is set to DHT11. | ||
+ | |||
+ | **3.** Initialization: | ||
+ | |||
+ | In the ''setup()'' function of your Arduino sketch, initializing the DHT sensor by calling the ''begin()'' function on the DHT object. | ||
+ | |||
+ | ''dht.begin();'' | ||
+ | |||
+ | **4.** Reading Sensor Data: | ||
+ | |||
+ | ''float humidity = dht.readHumidity();'' | ||
+ | |||
+ | In the ''loop()'' function: | ||
+ | |||
+ | |||
+ | ==LCD== | ||
**1.** Library Initialization: Including the LCD library in the Arduino sketch by adding the library header at the beginning of the code. | **1.** Library Initialization: Including the LCD library in the Arduino sketch by adding the library header at the beginning of the code. | ||
Line 99: | Line 178: | ||
''lcd.print()'' to print text and the data from BMP180 and ''lcd.clear()'' to clear the display. | ''lcd.print()'' to print text and the data from BMP180 and ''lcd.clear()'' to clear the display. | ||
+ | |||
+ | |||
+ | ====Results==== | ||
+ | |||
+ | {{https://ocw.cs.pub.ro/courses/_media/pm/prj2023/weatherstation.jpg?200x275}} | ||
+ | |||
+ | ====Download==== | ||
+ | |||
+ | {{https://ocw.cs.pub.ro/courses/_media/pm/prj2023/weatherstation.rar}} | ||
+ | ====Bibliography and Sources==== | ||
+ | |||
+ | https://www.alldatasheet.com/datasheet-pdf/pdf/1132068/BOSCH/BMP180.html | ||
+ | |||
+ | https://html.alldatasheet.com/html-pdf/1440068/ETC/DHT11/60/1/DHT11.html | ||
+ | |||
+ | https://github.com/sparkfun/SparkFun-Eagle-Libraries | ||
+ | |||
+ | https://github.com/danwahl/eagle-libraries | ||
+ | |||
+ | https://github.com/adafruit/Adafruit-Eagle-Library | ||
<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> |