Introduction
When we talk about air variations on the atmosphere, there are three factors that mainly influence:
Temperature
Relative humidity
Atmospheric pressure
So, would you like to know what a sensor is, how it can be used and how we can use the openmote B sensor board to measure temperature, humidity and atmospheric pressure?Â
Latest Posts
A sensor is a device that detects and responds to a physical stimulus.Â
Most sensors work by converting a physical input into an electrical signal, by processing the input signal by a circuit or microprocessor to provide a meaningful output.
Sensors can be found in a variety of applications, from automotive systems to medical devices.
BME280
As described in its webpage, the BME is a humidity sensor specially developed for mobile applications and wearables where size and low power consumption are key design parameters.Â
The unit combines high linearity and high accuracy sensors and is perfectly feasible for low current consumption, long-term stability and high EMC robustness.Â
The humidity sensor offers an extremely fast response time and therefore supports performance requirements for emerging applications such as context awareness, and high accuracy over a wide temperature range.
Download openmote B files
To be able to program the openmote with the BME280 microcontroller from the openmote sensor board, we will first have to download the openmote files which contain all the files needed.
1. So, we are going to visit this URL >>>
2. Click on the openmote-fw-20220225.tar.bz2Â
3. Once clicked, the files should be downloaded.
4. Extract the files.
5. In the openmote-fw/test/test-bme280/src/main.cpp you will find the main code that you will be able to run.
6. And in the openmote-fw/drivers/bme280 you will be able to see the driver for the temperature, humidity and pressure sensor.
Run the code
In order to run the openmote codes, install docker-compose and run any openmote test for testing different modules. In this case, we are going to make the test-bme280 run.
So, from the openmote-fw/ directory and once the docker-compose is installed, run the following command:
docker-compose run --rm openmote test-bme280
Visualize the data
What the code above does, is get the temperature, humidity and pressure values and send them to the serial port. So now, we are going to visualize that data by using the screening tool. So:
1. Update the package manager.
sudo apt update
2. Install screen.
sudo apt install screen
3. Check which is the serial port that you want to check.
ls /dev/ttyUSB*
4. In our case, we have just one openmote connected. Since when you connect an openmote to the USB, two USB ports are created and the one from which we can get the data is the highest, we are going to open the screen from that serial port. Finally, the baud rate is also needed, and it has to be the same as specified in the main code. By default: 115200.
screen /dev/ttyUSB1 115200
5. Receive the data. Exit with: Ctrl, \, and yÂ
Troubleshooting
It can be that you get an ERROR: Timeout waiting for ACK/NACK after 'Synch (0x55 0x55)' when running the code for the first time. Just upload it again, it should work when you upload the code again.
Get the temperature, humidity and pressure with the OpenMote Sensor Board