This shows you the differences between two versions of the page.
Both sides previous revisionPrevious revisionNext revision | Previous revision | ||
en:iot-open:hardware2:sensors_environment [2023/11/14 14:53] – pczekalski | en:iot-open:hardware2:sensors_environment [2024/05/27 12:07] (current) – ktokarz | ||
---|---|---|---|
Line 1: | Line 1: | ||
- | ==== Environment Sensors ==== | + | ====== Environment Sensors |
- | + | {{: | |
- | === Temperature Sensor | + | == Temperature Sensor == |
A temperature sensor is a device used to determine the temperature of the surrounding environment. Most temperature sensors work on the principle that the material' | A temperature sensor is a device used to determine the temperature of the surrounding environment. Most temperature sensors work on the principle that the material' | ||
* **thermocouple** – consists of two junctions of dissimilar metals, | * **thermocouple** – consists of two junctions of dissimilar metals, | ||
Line 44: | Line 44: | ||
</ | </ | ||
- | === Digital Temperature Sensor | + | == Digital Temperature Sensor == |
Digital temperature sensors automatically convert the temperature reading into some known unit, e.g. Celsius, Fahrenheit or Kelvin Degrees. Digital thermometers use one of the popular communication links. An example of a digital thermometer is DS18B20 by Dallas Semiconductors (figures {{ref> | Digital temperature sensors automatically convert the temperature reading into some known unit, e.g. Celsius, Fahrenheit or Kelvin Degrees. Digital thermometers use one of the popular communication links. An example of a digital thermometer is DS18B20 by Dallas Semiconductors (figures {{ref> | ||
Line 63: | Line 63: | ||
<code c> | <code c> | ||
- | #include < | + | #include < |
- | #include < | + | #include < |
- | const int SENSOR_PIN = 13; | + | const int SENSOR_PIN = 13; |
- | OneWire oneWire(SENSOR_PIN); | + | OneWire oneWire(SENSOR_PIN); |
- | DallasTemperature tempSensor(& | + | DallasTemperature tempSensor(& |
+ | //connect oneWire to DallasTemperature library | ||
- | float tempCelsius; | + | float tempCelsius; |
void setup() | void setup() | ||
+ | |||
{ | { | ||
- | Serial.begin(9600); | + | Serial.begin(9600); |
- | tempSensor.begin(); | + | tempSensor.begin(); |
} | } | ||
void loop() | void loop() | ||
{ | { | ||
- | tempSensor.requestTemperatures(); | + | tempSensor.requestTemperatures(); |
- | tempCelsius = tempSensor.getTempCByIndex(0); | + | //command to read temperatures |
+ | tempCelsius = tempSensor.getTempCByIndex(0); | ||
+ | //read temperature (in Celsius) | ||
Serial.print(" | Serial.print(" | ||
- | Serial.print(tempCelsius); | + | Serial.print(tempCelsius); |
Serial.println(" | Serial.println(" | ||
Line 93: | Line 97: | ||
</ | </ | ||
- | === Humidity Sensor | + | < |
+ | |||
+ | == Humidity Sensor == | ||
A humidity sensor (hygrometer) is a sensor that detects the amount of water or water vapour in the environment. The most common principle of air humidity sensors is the change of capacitance or resistance of materials that absorb moisture from the atmosphere. Soil humidity sensors measure the resistance between the two electrodes. Soluble salts and water amounts influence the resistance between electrodes in the soil. The output of a humidity sensor is an analogue signal value or digital value sent with some popular protocols ((https:// | A humidity sensor (hygrometer) is a sensor that detects the amount of water or water vapour in the environment. The most common principle of air humidity sensors is the change of capacitance or resistance of materials that absorb moisture from the atmosphere. Soil humidity sensors measure the resistance between the two electrodes. Soluble salts and water amounts influence the resistance between electrodes in the soil. The output of a humidity sensor is an analogue signal value or digital value sent with some popular protocols ((https:// | ||
IoT applications include monitoring humidors, greenhouse humidity, agriculture, | IoT applications include monitoring humidors, greenhouse humidity, agriculture, | ||
Line 103: | Line 109: | ||
<figure humiditysensor2> | <figure humiditysensor2> | ||
- | {{ : | + | {{ : |
< | < | ||
</ | </ | ||
Line 128: | Line 134: | ||
</ | </ | ||
- | === Sound Sensor | + | <note important> |
+ | |||
+ | == Sound Sensor == | ||
A sound sensor is a sensor that detects vibrations in a gas, liquid or solid environment. At first, the sound wave pressure makes mechanical vibrations, which transfer to changes in capacitance, | A sound sensor is a sensor that detects vibrations in a gas, liquid or solid environment. At first, the sound wave pressure makes mechanical vibrations, which transfer to changes in capacitance, | ||
Sound sensors are used in drone detection, gunshot alert, seismic detection and vault safety alarms.\\ | Sound sensors are used in drone detection, gunshot alert, seismic detection and vault safety alarms.\\ | ||
Line 169: | Line 177: | ||
</ | </ | ||
- | === Chemical and Gas Sensor | + | == Chemical and Gas Sensor == |
Gas sensors are a group that can detect and measure the concentration of certain gasses in the air. The working principle of electrochemical sensors is to absorb the gas and create current from an electrochemical reaction. For process acceleration, | Gas sensors are a group that can detect and measure the concentration of certain gasses in the air. The working principle of electrochemical sensors is to absorb the gas and create current from an electrochemical reaction. For process acceleration, | ||
The smoke or air pollution sensors usually use LED or laser that emits light and a detector normally shaded from the light. If there are particles of smoke or polluted air inside the sensor, the light is reflected by them, which can be observed by the detector.\\ | The smoke or air pollution sensors usually use LED or laser that emits light and a detector normally shaded from the light. If there are particles of smoke or polluted air inside the sensor, the light is reflected by them, which can be observed by the detector.\\ | ||
Line 180: | Line 188: | ||
<figure gassensor2> | <figure gassensor2> | ||
- | {{ : | + | {{ : |
< | < | ||
</ | </ | ||
Line 202: | Line 210: | ||
</ | </ | ||
- | === Smoke and Air Pollution Sensors | + | == Smoke and Air Pollution Sensors == |
The smoke sensors usually emit LED light, and a detector is typically shaded from the light. If there are particles of smoke present inside the sensor, the light is reflected by them, which can be observed by the detector.\\ | The smoke sensors usually emit LED light, and a detector is typically shaded from the light. If there are particles of smoke present inside the sensor, the light is reflected by them, which can be observed by the detector.\\ | ||
Smoke detectors are used in fire alarm systems.\\ | Smoke detectors are used in fire alarm systems.\\ | ||
Line 226: | Line 234: | ||
<code c> | <code c> | ||
#include < | #include < | ||
- | # | + | # |
// Define the serial port for the PMS5003 sensor | // Define the serial port for the PMS5003 sensor | ||
Line 240: | Line 248: | ||
Serial.begin(9600); | Serial.begin(9600); | ||
| | ||
- | pinMode(SET_PIN, | + | pinMode(SET_PIN, |
+ | //(LOW) -> turns fan down | ||
pinMode(RESET_PIN, | pinMode(RESET_PIN, | ||
digitalWrite(SET_PIN, | digitalWrite(SET_PIN, | ||
Line 282: | Line 291: | ||
</ | </ | ||
- | === Air Pressure Sensor | + | == Air Pressure Sensor == |
Air pressure sensors can measure the absolute pressure in the surrounding environment. Some popular sensors use a piezo-resistive sensing element, which is then connected to the amplifier and analogue digital converter. Frint-end uses the logic to interface the microcontroller. Usually, barometric sensor readings depend on the temperature, | Air pressure sensors can measure the absolute pressure in the surrounding environment. Some popular sensors use a piezo-resistive sensing element, which is then connected to the amplifier and analogue digital converter. Frint-end uses the logic to interface the microcontroller. Usually, barometric sensor readings depend on the temperature, | ||
Popular examples of barometric sensors are BME280 and BMP280. Both include barometric sensors and temperature sensors built in for compensation and possible measurement, | Popular examples of barometric sensors are BME280 and BMP280. Both include barometric sensors and temperature sensors built in for compensation and possible measurement, | ||
Line 295: | Line 304: | ||
<figure sensor_bme280_2> | <figure sensor_bme280_2> | ||
- | {{ : | + | {{ : |
< | < | ||
</ | </ |