meta data for this page
Differences
This shows you the differences between two versions of the page.
Both sides previous revisionPrevious revisionNext revision | Previous revision | ||
groups:mg:temperature_pressure_and_humidity_monitoring [2022/01/21 13:18] – fiene | groups:mg:temperature_pressure_and_humidity_monitoring [2024/03/20 09:37] (current) – Admin: Syntax-Update (Migration from deprecated "fontcolor" plugin to "color" plugin) klaus | ||
---|---|---|---|
Line 3: | Line 3: | ||
===== Hardware ===== | ===== Hardware ===== | ||
- | Besides a Raspberry Pi - in use is the Raspberry Pi 2 Model B V1.1, the datatransfer takes place over a ethernetcable, | + | Besides a Raspberry Pi - in use is the Raspberry Pi 2 Model B V1.1, the datatransfer takes place over a ethernetcable, |
+ | \\ | ||
+ | The only difference between AM2302 and DHT22 is that one has an integrated 5,1 K Pullup-Resistor and attached cables and the other one has pins and needs an external Pullup-Resistor (around 10 K) between the dataconnection and the VCC-Pin, both cases are covered below. | ||
First, you need to connect the sensors as following. | First, you need to connect the sensors as following. | ||
Line 29: | Line 31: | ||
The communication with the sensors is written in C, but there are Python-packages from Adafruit to easily integrate the communication in personal codes and applications. Here's a short overview on how to read out the sensors: | The communication with the sensors is written in C, but there are Python-packages from Adafruit to easily integrate the communication in personal codes and applications. Here's a short overview on how to read out the sensors: | ||
- | After setting up the Raspberry Pi you need to enable I2C and 1-Wire connection. Enter the command '' | + | After setting up and updating |
+ | You can check if the I2C kernel module is currently loaded by entering the command '' | ||
+ | |||
+ | '' | ||
+ | '' | ||
+ | |||
+ | If you don't see anything like this, there are several things to do, to force your Raspberry Pi to load the module. Here are just some of them: | ||
+ | * Edit the configfile - which decides which modules should be loaded while booting - with '' | ||
+ | * If you can't find the i2c-1 bus in /dev, start the i2c module manually by entering '' | ||
Next you need to install some packages using the following commands: | Next you need to install some packages using the following commands: | ||
- | '' | + | '' |
+ | '' | ||
+ | '' | ||
+ | '' | ||
- | '' | + | To check if your Raspberry Pi found the sensor and to get it's address, enter '' |
+ | '' | ||
+ | |||
+ | the sensor has the address 0x76. If you can't see any entry and i2c is enabled and running, check your wires and connections. | ||
+ | Now you can write your python script! First create a file with e.g. '' | ||
+ | |||
+ | |||
+ | < | ||
+ | <color # | ||
+ | |||
+ | **<color # | ||
+ | <color # | ||
+ | <color # | ||
+ | |||
+ | i2c = busio.I2C(board.SCL, | ||
+ | bmp280 = adafruit_bmp280.Adafruit_BMP280_I2C(i2c, | ||
+ | |||
+ | <color # | ||
+ | <color # | ||
+ | </ | ||
+ | |||
+ | You can execute the program with '' | ||
+ | Now we take care of the software for the AM2302 sensor. Therefor you don't even need to write a script. | ||
Go to your home directory with '' | Go to your home directory with '' | ||
Line 48: | Line 84: | ||
'' | '' | ||
- | From now on you can manually read out humidity and temperatur by entering the following command. The first number is the argument for the sensormodel you use (11,22, or 2302), the second argument is the GPIO pin number (not the physical pin number!) you attached your dataconnection to. | + | From now on you can manually read out humidity and temperatur by entering the following command |
+ | |||
+ | '' | ||
+ | |||
+ | When you implement a continuous monitoring be aware that the AM2302 can only read a value every 3 seconds, otherwise it'll hang itself up - due to the slow 1-wire connection - and needs to be restartet (unplugged). | ||
+ | |||
+ | ===== Grafana ===== | ||
+ | |||
+ | If used continually, | ||
+ | |||
+ | ===== Applications ===== | ||
- | '''' | + | Currently this sensor isn't in use anywhere, but one will monitor the conditions in the resonator in ResLab. |