{"id":161184,"date":"2024-08-30T12:43:40","date_gmt":"2024-08-30T12:43:40","guid":{"rendered":"https:\/\/randomnerdtutorials.com\/?p=161184"},"modified":"2024-08-30T12:43:43","modified_gmt":"2024-08-30T12:43:43","slug":"raspberry-pi-pico-bme680-micropython","status":"publish","type":"post","link":"https:\/\/randomnerdtutorials.com\/raspberry-pi-pico-bme680-micropython\/","title":{"rendered":"Raspberry Pi Pico: BME680 Environmental Sensor (MicroPython)"},"content":{"rendered":"\n<p>Learn how to use the BME680 environmental sensor module with the Raspberry Pi Pico board programmed with MicroPython to get data about temperature, humidity, pressure, and gas (air quality). We&#8217;ll build a basic example to show you how to wire the sensor, which library you should use, and a sample code to get data from the sensor. <\/p>\n\n\n<div class=\"wp-block-image\">\n<figure class=\"aligncenter size-full\"><img data-recalc-dims=\"1\" fetchpriority=\"high\" decoding=\"async\" width=\"1200\" height=\"675\" src=\"https:\/\/i0.wp.com\/randomnerdtutorials.com\/wp-content\/uploads\/2024\/07\/Raspberry-Pi-Pico-BME680-Micropython.jpg?resize=1200%2C675&#038;quality=100&#038;strip=all&#038;ssl=1\" alt=\"Raspberry Pi Pico with BME680 Environmental Sensor MicroPython\" class=\"wp-image-161187\" srcset=\"https:\/\/i0.wp.com\/randomnerdtutorials.com\/wp-content\/uploads\/2024\/07\/Raspberry-Pi-Pico-BME680-Micropython.jpg?w=1920&amp;quality=100&amp;strip=all&amp;ssl=1 1920w, https:\/\/i0.wp.com\/randomnerdtutorials.com\/wp-content\/uploads\/2024\/07\/Raspberry-Pi-Pico-BME680-Micropython.jpg?resize=300%2C169&amp;quality=100&amp;strip=all&amp;ssl=1 300w, https:\/\/i0.wp.com\/randomnerdtutorials.com\/wp-content\/uploads\/2024\/07\/Raspberry-Pi-Pico-BME680-Micropython.jpg?resize=1024%2C576&amp;quality=100&amp;strip=all&amp;ssl=1 1024w, https:\/\/i0.wp.com\/randomnerdtutorials.com\/wp-content\/uploads\/2024\/07\/Raspberry-Pi-Pico-BME680-Micropython.jpg?resize=768%2C432&amp;quality=100&amp;strip=all&amp;ssl=1 768w, https:\/\/i0.wp.com\/randomnerdtutorials.com\/wp-content\/uploads\/2024\/07\/Raspberry-Pi-Pico-BME680-Micropython.jpg?resize=1536%2C864&amp;quality=100&amp;strip=all&amp;ssl=1 1536w\" sizes=\"(max-width: 1200px) 100vw, 1200px\" \/><\/figure><\/div>\n\n\n<p class=\"rntbox rntclgreen\"><strong>New to the Raspberry Pi Pico?<\/strong> <a href=\"https:\/\/randomnerdtutorials.com\/getting-started-raspberry-pi-pico-w\/\" title=\"\">Get started with the Raspberry Pi Pico here<\/a>.<\/p>\n\n\n\n<p><strong>Table of Contents<\/strong>:<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li><a href=\"#bme680-sensor-intro\" title=\"\">Introducing BME680 Environmental Sensor Module<\/a><\/li>\n\n\n\n<li><a href=\"#bme680-rpi-pico-wiring\" title=\"\">Wiring the BME680 to the Raspberry Pi Pico<\/a><\/li>\n\n\n\n<li><a href=\"#bme680-micropython-library\" title=\"\">BME680 MicroPython Library<\/a><\/li>\n\n\n\n<li><a href=\"#bme680-raspberry-pi-pico-code\" title=\"\">BME680 Pressure, Temperature, Humidity, and Gas Air Quality &#8211; MicroPython Code<\/a><\/li>\n<\/ul>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"prerequisites\">Prerequisites &#8211; MicroPython Firmware<\/h2>\n\n\n\n<p>To follow this tutorial you need MicroPython firmware installed in your Raspberry Pi Pico board. You also need an IDE to write and upload the code to your board. <\/p>\n\n\n\n<p>The recommended MicroPython IDE for the Raspberry Pi Pico is Thonny IDE. Follow the next tutorial to learn how to install Thonny IDE, flash MicroPython firmware, and upload code to the board.<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li><a href=\"https:\/\/randomnerdtutorials.com\/getting-started-raspberry-pi-pico-w\/#install-thonny-ide\" title=\"\">Programming Raspberry Pi Pico using MicroPython<\/a><\/li>\n<\/ul>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"bme680-sensor-intro\">Introducing BME680 Environmental Sensor Module<\/h2>\n\n\n\n<p>The BME680 is an environmental sensor that combines gas, pressure, humidity, and temperature sensors. The gas sensor can detect a broad range of gases like volatile organic compounds (VOC). For this reason, the BME680 can be used in indoor air quality control.<\/p>\n\n\n<div class=\"wp-block-image\">\n<figure class=\"aligncenter size-full\"><img data-recalc-dims=\"1\" decoding=\"async\" width=\"750\" height=\"422\" src=\"https:\/\/i0.wp.com\/randomnerdtutorials.com\/wp-content\/uploads\/2020\/07\/BME680-Gas-sensor-humidity-barometric-pressure-ambient-temperature-gas-air-quality-front.jpg?resize=750%2C422&#038;quality=100&#038;strip=all&#038;ssl=1\" alt=\"BME680 Gas sensor humidity barometric pressure ambient temperature gas air quality front\" class=\"wp-image-98118\" srcset=\"https:\/\/i0.wp.com\/randomnerdtutorials.com\/wp-content\/uploads\/2020\/07\/BME680-Gas-sensor-humidity-barometric-pressure-ambient-temperature-gas-air-quality-front.jpg?w=750&amp;quality=100&amp;strip=all&amp;ssl=1 750w, https:\/\/i0.wp.com\/randomnerdtutorials.com\/wp-content\/uploads\/2020\/07\/BME680-Gas-sensor-humidity-barometric-pressure-ambient-temperature-gas-air-quality-front.jpg?resize=300%2C169&amp;quality=100&amp;strip=all&amp;ssl=1 300w\" sizes=\"(max-width: 750px) 100vw, 750px\" \/><\/figure><\/div>\n\n\n<h3 class=\"wp-block-heading\">BME680 Measurements<\/h3>\n\n\n\n<p>The BME680 is a 4-in-1 digital sensor that measures:<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li>Temperature<\/li>\n\n\n\n<li>Humidity<\/li>\n\n\n\n<li>Barometric pressure<\/li>\n\n\n\n<li>Gas: Volatile Organic Compounds (VOC) like ethanol and carbon monoxide<\/li>\n<\/ul>\n\n\n\n<h3 class=\"wp-block-heading\">Gas Sensor<\/h3>\n\n\n\n<p>The BME680 contains a MOX (Metal-oxide) sensor that detects VOCs in the air. This sensor gives you a qualitative idea of the<strong> sum of VOCs\/contaminants<\/strong> in the surrounding air &#8211; <strong>it is not specific<\/strong> for a specific gas molecule.<\/p>\n\n\n\n<p>MOX sensors are composed of a metal-oxide surface, a sensing chip to measure changes in conductivity and a heater. It detects VOCs by adsorption of oxygen molecules on its sensitive layer. The BME680 reacts to most VOCs polluting indoor air (except CO2).<\/p>\n\n\n\n<p>When the sensor comes into contact with the reducing gases, the oxygen molecules react and increase the conductivity across the surface. As a raw signal, the BME680 outputs resistance values. These values change due to variations in VOC concentrations:<\/p>\n\n\n<div class=\"wp-block-image\">\n<figure class=\"aligncenter size-full\"><img data-recalc-dims=\"1\" decoding=\"async\" width=\"1112\" height=\"726\" src=\"https:\/\/i0.wp.com\/randomnerdtutorials.com\/wp-content\/uploads\/2020\/07\/BME680-Gas-Sensor-Resistance-How-It-Works.jpg?resize=1112%2C726&#038;quality=100&#038;strip=all&#038;ssl=1\" alt=\"BME680 Gas Environmental Air Quality Sensor Resistance How It Works\" class=\"wp-image-98136\" srcset=\"https:\/\/i0.wp.com\/randomnerdtutorials.com\/wp-content\/uploads\/2020\/07\/BME680-Gas-Sensor-Resistance-How-It-Works.jpg?w=1112&amp;quality=100&amp;strip=all&amp;ssl=1 1112w, https:\/\/i0.wp.com\/randomnerdtutorials.com\/wp-content\/uploads\/2020\/07\/BME680-Gas-Sensor-Resistance-How-It-Works.jpg?resize=300%2C196&amp;quality=100&amp;strip=all&amp;ssl=1 300w, https:\/\/i0.wp.com\/randomnerdtutorials.com\/wp-content\/uploads\/2020\/07\/BME680-Gas-Sensor-Resistance-How-It-Works.jpg?resize=1024%2C669&amp;quality=100&amp;strip=all&amp;ssl=1 1024w, https:\/\/i0.wp.com\/randomnerdtutorials.com\/wp-content\/uploads\/2020\/07\/BME680-Gas-Sensor-Resistance-How-It-Works.jpg?resize=768%2C501&amp;quality=100&amp;strip=all&amp;ssl=1 768w\" sizes=\"(max-width: 1112px) 100vw, 1112px\" \/><\/figure><\/div>\n\n\n<ul class=\"wp-block-list\">\n<li><strong>Higher <\/strong>concentration of VOCs \u00bb <strong>Lower <\/strong>resistance<\/li>\n\n\n\n<li><strong>Lower <\/strong>concentration of VOCs \u00bb <strong>Higher <\/strong>resistance<\/li>\n<\/ul>\n\n\n\n<p>The reactions that occur on the sensor surface (thus, the resistance) are influenced by parameters other than VOC concentration like temperature and humidity.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\">Relevant Information Regarding Gas Sensor<\/h3>\n\n\n\n<p>The gas sensor gives you a qualitative idea of VOCs gases in the surrounding air. So, you can get trends, compare your results, and see if the air quality is increasing or decreasing. To get precise measurements, you must calibrate the sensor against known sources and build a calibration curve.<\/p>\n\n\n\n<p>When you first get the sensor, it is recommended to run it for 48 hours before starting to collect &#8220;real&#8221; data. After that, it is also recommended to run the sensor for 30 minutes before getting a gas reading.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\">BME680 Accuracy<\/h3>\n\n\n\n<p>Here&#8217;s the accuracy of the temperature, humidity, and pressure sensors of the BME680:<\/p>\n\n\n\n<figure class=\"wp-block-table\"><table><tbody><tr><td><strong>Sensor<\/strong><\/td><td><strong>Accuracy<\/strong><\/td><\/tr><tr><td>Temperature<\/td><td>+\/- 1.0\u00baC<\/td><\/tr><tr><td>Humidity<\/td><td>+\/- 3%<\/td><\/tr><tr><td>Pressure<\/td><td>+\/- 1 hPa<\/td><\/tr><\/tbody><\/table><\/figure>\n\n\n\n<h3 class=\"wp-block-heading\">BME680 Operation Range<\/h3>\n\n\n\n<p>The following table shows the operation range for the temperature, humidity, and pressure sensors for the BME680.<\/p>\n\n\n\n<figure class=\"wp-block-table\"><table><tbody><tr><td><strong>Sensor<\/strong><\/td><td><strong>Operation <\/strong>Range<\/td><\/tr><tr><td>Temperature<\/td><td>-40 to 85 \u00baC<\/td><\/tr><tr><td>Humidity<\/td><td>0 to 100 %<\/td><\/tr><tr><td>Pressure<\/td><td>300 to 1100 hPa<\/td><\/tr><\/tbody><\/table><\/figure>\n\n\n\n<h3 class=\"wp-block-heading\">BME680 Pinout<\/h3>\n\n\n\n<p>Here&#8217;s the BME680 Pinout:<\/p>\n\n\n\n<figure class=\"wp-block-table\"><table><tbody><tr><td><strong>VCC<\/strong><\/td><td>Powers the sensor<\/td><\/tr><tr><td><strong>GND<\/strong><\/td><td>Common GND<\/td><\/tr><tr><td><strong>SCL<\/strong><\/td><td>SCL pin for I2C communication<br>SCK pin for SPI communication<\/td><\/tr><tr><td><strong>SDA<\/strong><\/td><td>SDA pin for I2C communication<br>SDI (MOSI) pin for SPI communication<\/td><\/tr><tr><td><strong>SDO<\/strong><\/td><td>SDO (MISO) pin for SPI communication<\/td><\/tr><tr><td><strong>CS<\/strong><\/td><td>Chip select pin for SPI communication<\/td><\/tr><\/tbody><\/table><\/figure>\n\n\n\n<h3 class=\"wp-block-heading\">BME680 Interface<\/h3>\n\n\n\n<p>The BME680 supports I2C and SPI Interfaces.<\/p>\n\n\n<div class=\"wp-block-image\">\n<figure class=\"aligncenter size-full\"><img data-recalc-dims=\"1\" loading=\"lazy\" decoding=\"async\" width=\"750\" height=\"422\" src=\"https:\/\/i0.wp.com\/randomnerdtutorials.com\/wp-content\/uploads\/2020\/07\/BME680-Gas-sensor-humidity-barometric-pressure-ambient-temperature-gas-air-quality-back.jpg?resize=750%2C422&#038;quality=100&#038;strip=all&#038;ssl=1\" alt=\"BME680 Gas sensor humidity barometric pressure ambient temperature gas air quality back\" class=\"wp-image-98119\" srcset=\"https:\/\/i0.wp.com\/randomnerdtutorials.com\/wp-content\/uploads\/2020\/07\/BME680-Gas-sensor-humidity-barometric-pressure-ambient-temperature-gas-air-quality-back.jpg?w=750&amp;quality=100&amp;strip=all&amp;ssl=1 750w, https:\/\/i0.wp.com\/randomnerdtutorials.com\/wp-content\/uploads\/2020\/07\/BME680-Gas-sensor-humidity-barometric-pressure-ambient-temperature-gas-air-quality-back.jpg?resize=300%2C169&amp;quality=100&amp;strip=all&amp;ssl=1 300w\" sizes=\"(max-width: 750px) 100vw, 750px\" \/><\/figure><\/div>\n\n\n<h4 class=\"wp-block-heading\">BME680 I2C<\/h4>\n\n\n\n<p>This sensor communicates using I2C communication protocol, so the wiring is straighforward. You can use any I2C pin combination of the Raspberry Pi Pico. We&#8217;ll be using GPIO 5 (SCL) and GPIO 4 (SDA). You can use any <a href=\"https:\/\/randomnerdtutorials.com\/raspberry-pi-pico-w-pinout-gpios\/#i2c\" title=\"\">other combination of I2C pins<\/a> as long as you add them to the code.<\/p>\n\n\n\n<figure class=\"wp-block-table\"><table><tbody><tr><td><strong>BME680<\/strong><\/td><td><strong>Raspberry Pi Pico<\/strong><\/td><\/tr><tr><td>Vin<\/td><td><span class=\"rnthl rntcred\">3.3V<\/span><\/td><\/tr><tr><td>GND<\/td><td><span class=\"rnthl rntcblack\">GND<\/span><\/td><\/tr><tr><td>SCL<\/td><td><span class=\"rnthl rntclgray\">GPIO 5<\/span><\/td><\/tr><tr><td>SDA<\/td><td><span class=\"rnthl rntcyellow\">GPIO 4<\/span><\/td><\/tr><\/tbody><\/table><\/figure>\n\n\n\n<p class=\"rntbox rntclgreen\">Learn more about the Raspberry Pi Pico GPIOs: <a href=\"https:\/\/randomnerdtutorials.com\/raspberry-pi-pico-w-pinout-gpios\/\">Raspberry Pi Pico and Pico W Pinout Guide: GPIOs Explained<\/a><\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Parts Required<\/h2>\n\n\n<div class=\"wp-block-image\">\n<figure class=\"aligncenter size-full\"><img data-recalc-dims=\"1\" loading=\"lazy\" decoding=\"async\" width=\"750\" height=\"422\" src=\"https:\/\/i0.wp.com\/randomnerdtutorials.com\/wp-content\/uploads\/2024\/07\/Rpi-Pico-with-BME680-sensor.jpg?resize=750%2C422&#038;quality=100&#038;strip=all&#038;ssl=1\" alt=\"Raspberry Pi Pico with BME680 environmental sensor\" class=\"wp-image-161188\" srcset=\"https:\/\/i0.wp.com\/randomnerdtutorials.com\/wp-content\/uploads\/2024\/07\/Rpi-Pico-with-BME680-sensor.jpg?w=750&amp;quality=100&amp;strip=all&amp;ssl=1 750w, https:\/\/i0.wp.com\/randomnerdtutorials.com\/wp-content\/uploads\/2024\/07\/Rpi-Pico-with-BME680-sensor.jpg?resize=300%2C169&amp;quality=100&amp;strip=all&amp;ssl=1 300w\" sizes=\"(max-width: 750px) 100vw, 750px\" \/><\/figure><\/div>\n\n\n<p>For this project, you need to wire the BME680 sensor module to the Raspberry Pi Pico I2C pins. Here\u2019s a list of parts you need for this tutorial:<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li><a style=\"font-size: inherit; background-color: initial;\" rel=\"noreferrer noopener\" href=\"https:\/\/makeradvisor.com\/tools\/bme680-gas-sensor-module\/\" target=\"_blank\">BME680 sensor module<\/a><\/li>\n\n\n\n<li><a href=\"https:\/\/makeradvisor.com\/tools\/raspberry-pi-pico-w\/\" target=\"_blank\" rel=\"noopener\" title=\"\">Raspberry Pi Pico or Pico W<\/a><\/li>\n\n\n\n<li><a aria-label=\" (opens in a new tab)\" rel=\"noreferrer noopener\" href=\"https:\/\/makeradvisor.com\/tools\/mb-102-solderless-breadboard-830-points\/\" target=\"_blank\">Breadboard<\/a><\/li>\n\n\n\n<li><a aria-label=\" (opens in a new tab)\" rel=\"noreferrer noopener\" href=\"https:\/\/makeradvisor.com\/tools\/jumper-wires-kit-120-pieces\/\" target=\"_blank\">Jumper wires<\/a><\/li>\n<\/ul>\n\n\n<p>You can use the preceding links or go directly to <a href=\"https:\/\/makeradvisor.com\/tools\/?utm_source=rnt&utm_medium=post&utm_campaign=post\" target=\"_blank\">MakerAdvisor.com\/tools<\/a> to find all the parts for your projects at the best price!<\/p><p style=\"text-align:center;\"><a href=\"https:\/\/makeradvisor.com\/tools\/?utm_source=rnt&utm_medium=post&utm_campaign=post\" target=\"_blank\"><img data-recalc-dims=\"1\" decoding=\"async\" src=\"https:\/\/i0.wp.com\/randomnerdtutorials.com\/wp-content\/uploads\/2017\/10\/header-200.png?w=1200&#038;quality=100&#038;strip=all&#038;ssl=1\"><\/a><\/p>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"bme680-rpi-pico-wiring\">Wiring the BME680 to the Raspberry Pi Pico<\/h2>\n\n\n\n<p>Wire the BME680 to any <a href=\"https:\/\/randomnerdtutorials.com\/raspberry-pi-pico-w-pinout-gpios\/#i2c\" title=\"\">combination of the Pico I2C pins<\/a>\u2014we&#8217;ll be using <span class=\"rnthl rntcyellow\">GPIO 4<\/span> (SDA) and <span class=\"rnthl rntclgray\">GPIO 5<\/span> (SCL).<\/p>\n\n\n<div class=\"wp-block-image\">\n<figure class=\"aligncenter size-full\"><img data-recalc-dims=\"1\" loading=\"lazy\" decoding=\"async\" width=\"836\" height=\"634\" src=\"https:\/\/i0.wp.com\/randomnerdtutorials.com\/wp-content\/uploads\/2024\/07\/RPi-Pico-BME680-wiring-circuit.png?resize=836%2C634&#038;quality=100&#038;strip=all&#038;ssl=1\" alt=\"Raspberry Pi Pico wiring to BME680 sensor\" class=\"wp-image-161189\" srcset=\"https:\/\/i0.wp.com\/randomnerdtutorials.com\/wp-content\/uploads\/2024\/07\/RPi-Pico-BME680-wiring-circuit.png?w=836&amp;quality=100&amp;strip=all&amp;ssl=1 836w, https:\/\/i0.wp.com\/randomnerdtutorials.com\/wp-content\/uploads\/2024\/07\/RPi-Pico-BME680-wiring-circuit.png?resize=300%2C228&amp;quality=100&amp;strip=all&amp;ssl=1 300w, https:\/\/i0.wp.com\/randomnerdtutorials.com\/wp-content\/uploads\/2024\/07\/RPi-Pico-BME680-wiring-circuit.png?resize=768%2C582&amp;quality=100&amp;strip=all&amp;ssl=1 768w\" sizes=\"(max-width: 836px) 100vw, 836px\" \/><\/figure><\/div>\n\n\n<p><strong>Recommended reading:<\/strong> <a href=\"https:\/\/randomnerdtutorials.com\/raspberry-pi-pico-w-pinout-gpios\/\">Raspberry Pi Pico and Pico W Pinout Guide: GPIOs Explained<\/a><\/p>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"bme680-micropython-library\">BME680 MicroPython Library<\/h2>\n\n\n\n<p>The MicroPython library package doesn&#8217;t come with a BME680 library by default. There are several different modules to read from the BME680 sensor. We&#8217;ll use the following module adapted from the Adafruit BME680 library.<\/p>\n\n\n<pre style=\"max-height: 40em; margin-bottom: 20px;\"><code class=\"language-python\"># Spaces, comments and some functions have been removed from the original file to save memory\n# Original source: https:\/\/github.com\/adafruit\/Adafruit_CircuitPython_BME680\/blob\/master\/adafruit_bme680.py\nimport time\nimport math\nfrom micropython import const\nfrom ubinascii import hexlify as hex\ntry:\n  import struct\nexcept ImportError:\n  import ustruct as struct\n_BME680_CHIPID = const(0x61)\n_BME680_REG_CHIPID = const(0xD0)\n_BME680_BME680_COEFF_ADDR1 = const(0x89)\n_BME680_BME680_COEFF_ADDR2 = const(0xE1)\n_BME680_BME680_RES_HEAT_0 = const(0x5A)\n_BME680_BME680_GAS_WAIT_0 = const(0x64)\n_BME680_REG_SOFTRESET = const(0xE0)\n_BME680_REG_CTRL_GAS = const(0x71)\n_BME680_REG_CTRL_HUM = const(0x72)\n_BME280_REG_STATUS = const(0xF3)\n_BME680_REG_CTRL_MEAS = const(0x74)\n_BME680_REG_CONFIG = const(0x75)\n_BME680_REG_PAGE_SELECT = const(0x73)\n_BME680_REG_MEAS_STATUS = const(0x1D)\n_BME680_REG_PDATA = const(0x1F)\n_BME680_REG_TDATA = const(0x22)\n_BME680_REG_HDATA = const(0x25)\n_BME680_SAMPLERATES = (0, 1, 2, 4, 8, 16)\n_BME680_FILTERSIZES = (0, 1, 3, 7, 15, 31, 63, 127)\n_BME680_RUNGAS = const(0x10)\n_LOOKUP_TABLE_1 = (2147483647.0, 2147483647.0, 2147483647.0, 2147483647.0, 2147483647.0,\n  2126008810.0, 2147483647.0, 2130303777.0, 2147483647.0, 2147483647.0,\n  2143188679.0, 2136746228.0, 2147483647.0, 2126008810.0, 2147483647.0,\n  2147483647.0)\n_LOOKUP_TABLE_2 = (4096000000.0, 2048000000.0, 1024000000.0, 512000000.0, 255744255.0, 127110228.0,\n  64000000.0, 32258064.0, 16016016.0, 8000000.0, 4000000.0, 2000000.0, 1000000.0,\n  500000.0, 250000.0, 125000.0)\ndef _read24(arr):\n  ret = 0.0\n  for b in arr:\n    ret *= 256.0\n    ret += float(b &amp; 0xFF)\n  return ret\nclass Adafruit_BME680:\n  def __init__(self, *, refresh_rate=10):\n    self._write(_BME680_REG_SOFTRESET, [0xB6])\n    time.sleep(0.005)\n    chip_id = self._read_byte(_BME680_REG_CHIPID)\n    if chip_id != _BME680_CHIPID:\n      raise RuntimeError('Failed 0x%x' % chip_id)\n    self._read_calibration()\n    self._write(_BME680_BME680_RES_HEAT_0, [0x73])\n    self._write(_BME680_BME680_GAS_WAIT_0, [0x65])\n    self.sea_level_pressure = 1013.25\n    self._pressure_oversample = 0b011\n    self._temp_oversample = 0b100\n    self._humidity_oversample = 0b010\n    self._filter = 0b010\n    self._adc_pres = None\n    self._adc_temp = None\n    self._adc_hum = None\n    self._adc_gas = None\n    self._gas_range = None\n    self._t_fine = None\n    self._last_reading = 0\n    self._min_refresh_time = 1000 \/ refresh_rate\n  @property\n  def pressure_oversample(self):\n    return _BME680_SAMPLERATES[self._pressure_oversample]\n  @pressure_oversample.setter\n  def pressure_oversample(self, sample_rate):\n    if sample_rate in _BME680_SAMPLERATES:\n      self._pressure_oversample = _BME680_SAMPLERATES.index(sample_rate)\n    else:\n      raise RuntimeError(&quot;Invalid&quot;)\n  @property\n  def humidity_oversample(self):\n    return _BME680_SAMPLERATES[self._humidity_oversample]\n  @humidity_oversample.setter\n  def humidity_oversample(self, sample_rate):\n    if sample_rate in _BME680_SAMPLERATES:\n      self._humidity_oversample = _BME680_SAMPLERATES.index(sample_rate)\n    else:\n      raise RuntimeError(&quot;Invalid&quot;)\n  @property\n  def temperature_oversample(self):\n      return _BME680_SAMPLERATES[self._temp_oversample]\n  @temperature_oversample.setter\n  def temperature_oversample(self, sample_rate):\n    if sample_rate in _BME680_SAMPLERATES:\n      self._temp_oversample = _BME680_SAMPLERATES.index(sample_rate)\n    else:\n      raise RuntimeError(&quot;Invalid&quot;)\n  @property\n  def filter_size(self):\n    return _BME680_FILTERSIZES[self._filter]\n  @filter_size.setter\n  def filter_size(self, size):\n    if size in _BME680_FILTERSIZES:\n      self._filter = _BME680_FILTERSIZES[size]\n    else:\n      raise RuntimeError(&quot;Invalid&quot;)\n  @property\n  def temperature(self):\n    self._perform_reading()\n    calc_temp = (((self._t_fine * 5) + 128) \/ 256)\n    return calc_temp \/ 100\n  @property\n  def pressure(self):\n    self._perform_reading()\n    var1 = (self._t_fine \/ 2) - 64000\n    var2 = ((var1 \/ 4) * (var1 \/ 4)) \/ 2048\n    var2 = (var2 * self._pressure_calibration[5]) \/ 4\n    var2 = var2 + (var1 * self._pressure_calibration[4] * 2)\n    var2 = (var2 \/ 4) + (self._pressure_calibration[3] * 65536)\n    var1 = (((((var1 \/ 4) * (var1 \/ 4)) \/ 8192) *\n      (self._pressure_calibration[2] * 32) \/ 8) +\n      ((self._pressure_calibration[1] * var1) \/ 2))\n    var1 = var1 \/ 262144\n    var1 = ((32768 + var1) * self._pressure_calibration[0]) \/ 32768\n    calc_pres = 1048576 - self._adc_pres\n    calc_pres = (calc_pres - (var2 \/ 4096)) * 3125\n    calc_pres = (calc_pres \/ var1) * 2\n    var1 = (self._pressure_calibration[8] * (((calc_pres \/ 8) * (calc_pres \/ 8)) \/ 8192)) \/ 4096\n    var2 = ((calc_pres \/ 4) * self._pressure_calibration[7]) \/ 8192\n    var3 = (((calc_pres \/ 256) ** 3) * self._pressure_calibration[9]) \/ 131072\n    calc_pres += ((var1 + var2 + var3 + (self._pressure_calibration[6] * 128)) \/ 16)\n    return calc_pres\/100\n  @property\n  def humidity(self):\n    self._perform_reading()\n    temp_scaled = ((self._t_fine * 5) + 128) \/ 256\n    var1 = ((self._adc_hum - (self._humidity_calibration[0] * 16)) -\n      ((temp_scaled * self._humidity_calibration[2]) \/ 200))\n    var2 = (self._humidity_calibration[1] *\n      (((temp_scaled * self._humidity_calibration[3]) \/ 100) +\n       (((temp_scaled * ((temp_scaled * self._humidity_calibration[4]) \/ 100)) \/\n         64) \/ 100) + 16384)) \/ 1024\n    var3 = var1 * var2\n    var4 = self._humidity_calibration[5] * 128\n    var4 = (var4 + ((temp_scaled * self._humidity_calibration[6]) \/ 100)) \/ 16\n    var5 = ((var3 \/ 16384) * (var3 \/ 16384)) \/ 1024\n    var6 = (var4 * var5) \/ 2\n    calc_hum = (((var3 + var6) \/ 1024) * 1000) \/ 4096\n    calc_hum \/= 1000\n    if calc_hum &gt; 100:\n      calc_hum = 100\n    if calc_hum &lt; 0:\n      calc_hum = 0\n    return calc_hum\n  @property\n  def altitude(self):\n    pressure = self.pressure\n    return 44330 * (1.0 - math.pow(pressure \/ self.sea_level_pressure, 0.1903))\n  @property\n  def gas(self):\n    self._perform_reading()\n    var1 = ((1340 + (5 * self._sw_err)) * (_LOOKUP_TABLE_1[self._gas_range])) \/ 65536\n    var2 = ((self._adc_gas * 32768) - 16777216) + var1\n    var3 = (_LOOKUP_TABLE_2[self._gas_range] * var1) \/ 512\n    calc_gas_res = (var3 + (var2 \/ 2)) \/ var2\n    return int(calc_gas_res)\n  def _perform_reading(self):\n    if (time.ticks_diff(self._last_reading, time.ticks_ms()) * time.ticks_diff(0, 1)\n        &lt; self._min_refresh_time):\n      return\n    self._write(_BME680_REG_CONFIG, [self._filter &lt;&lt; 2])\n    self._write(_BME680_REG_CTRL_MEAS,\n      [(self._temp_oversample &lt;&lt; 5)|(self._pressure_oversample &lt;&lt; 2)])\n    self._write(_BME680_REG_CTRL_HUM, [self._humidity_oversample])\n    self._write(_BME680_REG_CTRL_GAS, [_BME680_RUNGAS])\n    ctrl = self._read_byte(_BME680_REG_CTRL_MEAS)\n    ctrl = (ctrl &amp; 0xFC) | 0x01\n    self._write(_BME680_REG_CTRL_MEAS, [ctrl])\n    new_data = False\n    while not new_data:\n      data = self._read(_BME680_REG_MEAS_STATUS, 15)\n      new_data = data[0] &amp; 0x80 != 0\n      time.sleep(0.005)\n    self._last_reading = time.ticks_ms()\n    self._adc_pres = _read24(data[2:5]) \/ 16\n    self._adc_temp = _read24(data[5:8]) \/ 16\n    self._adc_hum = struct.unpack('&gt;H', bytes(data[8:10]))[0]\n    self._adc_gas = int(struct.unpack('&gt;H', bytes(data[13:15]))[0] \/ 64)\n    self._gas_range = data[14] &amp; 0x0F\n    var1 = (self._adc_temp \/ 8) - (self._temp_calibration[0] * 2)\n    var2 = (var1 * self._temp_calibration[1]) \/ 2048\n    var3 = ((var1 \/ 2) * (var1 \/ 2)) \/ 4096\n    var3 = (var3 * self._temp_calibration[2] * 16) \/ 16384\n    self._t_fine = int(var2 + var3)\n  def _read_calibration(self):\n    coeff = self._read(_BME680_BME680_COEFF_ADDR1, 25)\n    coeff += self._read(_BME680_BME680_COEFF_ADDR2, 16)\n    coeff = list(struct.unpack('&lt;hbBHhbBhhbbHhhBBBHbbbBbHhbb', bytes(coeff[1:39])))\n    coeff = [float(i) for i in coeff]\n    self._temp_calibration = [coeff[x] for x in [23, 0, 1]]\n    self._pressure_calibration = [coeff[x] for x in [3, 4, 5, 7, 8, 10, 9, 12, 13, 14]]\n    self._humidity_calibration = [coeff[x] for x in [17, 16, 18, 19, 20, 21, 22]]\n    self._gas_calibration = [coeff[x] for x in [25, 24, 26]]\n    self._humidity_calibration[1] *= 16\n    self._humidity_calibration[1] += self._humidity_calibration[0] % 16\n    self._humidity_calibration[0] \/= 16\n    self._heat_range = (self._read_byte(0x02) &amp; 0x30) \/ 16\n    self._heat_val = self._read_byte(0x00)\n    self._sw_err = (self._read_byte(0x04) &amp; 0xF0) \/ 16\n  def _read_byte(self, register):\n    return self._read(register, 1)[0]\n  def _read(self, register, length):\n    raise NotImplementedError()\n  def _write(self, register, values):\n    raise NotImplementedError()\nclass BME680_I2C(Adafruit_BME680):\n  def __init__(self, i2c, address=0x77, debug=False, *, refresh_rate=10):\n    self._i2c = i2c\n    self._address = address\n    self._debug = debug\n    super().__init__(refresh_rate=refresh_rate)\n  def _read(self, register, length):\n    result = bytearray(length)\n    self._i2c.readfrom_mem_into(self._address, register &amp; 0xff, result)\n    if self._debug:\n      print(&quot;\\t${:x} read &quot;.format(register), &quot; &quot;.join([&quot;{:02x}&quot;.format(i) for i in result]))\n    return result\n  def _write(self, register, values):\n    if self._debug:\n      print(&quot;\\t${:x} write&quot;.format(register), &quot; &quot;.join([&quot;{:02x}&quot;.format(i) for i in values]))\n    for value in values:\n      self._i2c.writeto_mem(self._address, register, bytearray([value &amp; 0xFF]))\n      register += 1\n<\/code><\/pre>\n\t<p style=\"text-align:center\"><a class=\"rntwhite\" href=\"https:\/\/github.com\/RuiSantosdotme\/Random-Nerd-Tutorials\/raw\/master\/Projects\/Raspberry-Pi-Pico\/MicroPython\/bme680.py\" target=\"_blank\">View raw code<\/a><\/p>\n\n\n\n<p>Upload the previous library to your Raspberry Pi Pico board (save it with the name <em>bme680.py<\/em>). Follow the instructions below to learn how to upload the library using Thonny IDE.<\/p>\n\n\n\n<p>If you\u2019re using Thonny IDE, follow the next steps:<\/p>\n\n\n\n<p><strong>1.<\/strong> Copy the library code to a new file. The <strong><a href=\"https:\/\/github.com\/RuiSantosdotme\/Random-Nerd-Tutorials\/blob\/master\/Projects\/Raspberry-Pi-Pico\/MicroPython\/bme680.py\" target=\"_blank\" rel=\"noopener\" title=\"\">BME680 library code can be found here<\/a><\/strong>.<\/p>\n\n\n\n<p><strong>2.<\/strong> Go to <strong>File<\/strong> &gt; <strong>Save as&#8230;<\/strong><\/p>\n\n\n<div class=\"wp-block-image\">\n<figure class=\"aligncenter size-full\"><img data-recalc-dims=\"1\" loading=\"lazy\" decoding=\"async\" width=\"206\" height=\"294\" src=\"https:\/\/i0.wp.com\/randomnerdtutorials.com\/wp-content\/uploads\/2020\/10\/Thonny-IDE-ESP32-ESP8266-MicroPython-Save-file-library-to-device-save-as.png?resize=206%2C294&#038;quality=100&#038;strip=all&#038;ssl=1\" alt=\"Thonny IDE ESP32 ESP8266 MicroPython Save file library to device save as\" class=\"wp-image-99603\"\/><\/figure><\/div>\n\n\n<p><strong>3.<\/strong> Select save to &#8220;<strong>Raspberry Pi Pico<\/strong>&#8220;:<\/p>\n\n\n<div class=\"wp-block-image\">\n<figure class=\"aligncenter size-full\"><img data-recalc-dims=\"1\" loading=\"lazy\" decoding=\"async\" width=\"214\" height=\"203\" src=\"https:\/\/i0.wp.com\/randomnerdtutorials.com\/wp-content\/uploads\/2023\/05\/Save-file-to-Raspberry-Pi-Pico.png?resize=214%2C203&#038;quality=100&#038;strip=all&#038;ssl=1\" alt=\"Save Files to Raspberry Pi Pico Thonny IDE\" class=\"wp-image-130899\"\/><\/figure><\/div>\n\n\n<p><strong>4.<\/strong> Name your file as <em>bme680.py<\/em> and press the OK button:<\/p>\n\n\n<div class=\"wp-block-image\">\n<figure class=\"aligncenter size-full\"><img data-recalc-dims=\"1\" loading=\"lazy\" decoding=\"async\" width=\"545\" height=\"327\" src=\"https:\/\/i0.wp.com\/randomnerdtutorials.com\/wp-content\/uploads\/2024\/07\/save-bme680-library-rpi-pico.png?resize=545%2C327&#038;quality=100&#038;strip=all&#038;ssl=1\" alt=\"BME680 library save to Raspberry Pi Pico Thonne IDE\" class=\"wp-image-161190\" srcset=\"https:\/\/i0.wp.com\/randomnerdtutorials.com\/wp-content\/uploads\/2024\/07\/save-bme680-library-rpi-pico.png?w=545&amp;quality=100&amp;strip=all&amp;ssl=1 545w, https:\/\/i0.wp.com\/randomnerdtutorials.com\/wp-content\/uploads\/2024\/07\/save-bme680-library-rpi-pico.png?resize=300%2C180&amp;quality=100&amp;strip=all&amp;ssl=1 300w\" sizes=\"(max-width: 545px) 100vw, 545px\" \/><\/figure><\/div>\n\n\n<p>And that&#8217;s it. The library was uploaded to your board. To make sure that it was uploaded successfully, go to <strong>File<\/strong> &gt; <strong>Save as&#8230;<\/strong> and select the MicroPython device. Your file should be listed there:<\/p>\n\n\n<div class=\"wp-block-image\">\n<figure class=\"aligncenter size-full\"><img data-recalc-dims=\"1\" loading=\"lazy\" decoding=\"async\" width=\"545\" height=\"327\" src=\"https:\/\/i0.wp.com\/randomnerdtutorials.com\/wp-content\/uploads\/2024\/07\/rpi-pico-bme680-library-saved-to-pico.png?resize=545%2C327&#038;quality=100&#038;strip=all&#038;ssl=1\" alt=\"BME280 Raspberry Pi pico library saved Thonny IDE\" class=\"wp-image-161191\" srcset=\"https:\/\/i0.wp.com\/randomnerdtutorials.com\/wp-content\/uploads\/2024\/07\/rpi-pico-bme680-library-saved-to-pico.png?w=545&amp;quality=100&amp;strip=all&amp;ssl=1 545w, https:\/\/i0.wp.com\/randomnerdtutorials.com\/wp-content\/uploads\/2024\/07\/rpi-pico-bme680-library-saved-to-pico.png?resize=300%2C180&amp;quality=100&amp;strip=all&amp;ssl=1 300w\" sizes=\"(max-width: 545px) 100vw, 545px\" \/><\/figure><\/div>\n\n\n<p>After uploading the library to your board, you can use the library methods by importing it at the beginning of your code.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"bme680-raspberry-pi-pico-code\">BME680 Pressure, Temperature, Humidity, and Gas Air Quality &#8211; MicroPython Code<\/h2>\n\n\n\n<p>After uploading the library to the Raspberry Pi Pico, create a new file called <em>main.py<\/em> and paste the following code. It prints the temperature, humidity, pressure, and gas resistance into the console every 5 seconds.<\/p>\n\n\n<pre style=\"max-height: 40em; margin-bottom: 20px;\"><code class=\"language-python\"># Rui Santos &amp; Sara Santos - Random Nerd Tutorials\n# Complete project details: https:\/\/RandomNerdTutorials.com\/raspberry-pi-pico-bme680-micropython\/\n\nfrom machine import Pin, I2C\nfrom time import sleep\nfrom bme680 import *\n\n# RPi Pico - Pin assignment\ni2c = I2C(id=0, scl=Pin(5), sda=Pin(4))\n\nbme = BME680_I2C(i2c=i2c)\n\nwhile True:\n  try:\n    temp = str(round(bme.temperature, 2)) + ' C'\n    #temp = (bme.temperature) * (9\/5) + 32\n    #temp = str(round(temp, 2)) + 'F'\n    \n    hum = str(round(bme.humidity, 2)) + ' %'\n    \n    pres = str(round(bme.pressure, 2)) + ' hPa'\n    \n    gas = str(round(bme.gas\/1000, 2)) + ' KOhms'\n\n    print('Temperature:', temp)\n    print('Humidity:', hum)\n    print('Pressure:', pres)\n    print('Gas:', gas)\n    print('-------')\n  except OSError as e:\n    print('Failed to read sensor.')\n \n  sleep(5)\n<\/code><\/pre>\n\t<p style=\"text-align:center\"><a class=\"rntwhite\" href=\"https:\/\/github.com\/RuiSantosdotme\/Random-Nerd-Tutorials\/raw\/master\/Projects\/Raspberry-Pi-Pico\/MicroPython\/BME680_Basic.py\" target=\"_blank\">View raw code<\/a><\/p>\n\n\n\n<h2 class=\"wp-block-heading\">How the Code Works<\/h2>\n\n\n\n<p>First, you need to import the necessary libraries, including the <span class=\"rnthl rntliteral\">bme680<\/span> module you&#8217;ve imported previously.<\/p>\n\n\n\n<pre class=\"wp-block-code language-python\"><code>from machine import Pin, I2C\nfrom time import sleep\nfrom bme680 import *<\/code><\/pre>\n\n\n\n<p>Set the I2C id, and pins. We&#8217;re using GPIOs 5 and 4, but any other <a href=\"https:\/\/randomnerdtutorials.com\/raspberry-pi-pico-w-pinout-gpios\/#i2c\" title=\"\">I2C pins<\/a> should work.<\/p>\n\n\n\n<pre class=\"wp-block-code language-python\"><code>i2c = I2C(id=0, scl=Pin(5), sda=Pin(4))<\/code><\/pre>\n\n\n\n<p class=\"rntbox rntclblue\"><strong>Note: <\/strong> GPIOs 5 and 4 belong to I2C id=0\u2014<a href=\"https:\/\/randomnerdtutorials.com\/raspberry-pi-pico-w-pinout-gpios\/#i2c\" title=\"\">check here other combinations and their ids<\/a>.<\/p>\n\n\n\n<p>Create a <span class=\"rnthl rntliteral\">BME680<\/span> object called <span class=\"rnthl rntliteral\">bme<\/span> with the I2C pins defined earlier:<\/p>\n\n\n\n<pre class=\"wp-block-code language-python\"><code>bme = BME680_I2C(i2c=i2c)<\/code><\/pre>\n\n\n\n<p>Reading temperature, humidity, pressure, and gas resistance is as simple as getting the <span class=\"rnthl rntliteral\">temperature<\/span>, <span class=\"rnthl rntliteral\">humidity<\/span>, <span class=\"rnthl rntliteral\">pressure<\/span>, and <span class=\"rnthl rntliteral\">gas<\/span> attributes from the <span class=\"rnthl rntliteral\">bme<\/span> object.<\/p>\n\n\n\n<pre class=\"wp-block-code language-python\"><code>temp = str(round(bme.temperature, 2)) + ' C'\n#temp = (bme.temperature) * (9\/5) + 32\n#temp = str(round(temp, 2)) + 'F'\n    \nhum = str(round(bme.humidity, 2)) + ' %'\n    \npres = str(round(bme.pressure, 2)) + ' hPa'\n    \ngas = str(round(bme.gas\/1000, 2)) + ' KOhms'<\/code><\/pre>\n\n\n\n<p>Finally, print the readings on the shell:<\/p>\n\n\n\n<pre class=\"wp-block-code language-python\"><code>print('Temperature: ', temp)\nprint('Humidity: ', hum)\nprint('Pressure: ', pres)\nprint('Gas:', gas)<\/code><\/pre>\n\n\n\n<p>In the end, we add a delay of 5 seconds:<\/p>\n\n\n\n<pre class=\"wp-block-code language-python\"><code>sleep(5)<\/code><\/pre>\n\n\n\n<h2 class=\"wp-block-heading\">Demonstration<\/h2>\n\n\n\n<p>Run the code on your board. <\/p>\n\n\n<div class=\"wp-block-image\">\n<figure class=\"aligncenter size-full\"><img data-recalc-dims=\"1\" loading=\"lazy\" decoding=\"async\" width=\"450\" height=\"78\" src=\"https:\/\/i0.wp.com\/randomnerdtutorials.com\/wp-content\/uploads\/2023\/06\/thonny-ide-run-code.png?resize=450%2C78&#038;quality=100&#038;strip=all&#038;ssl=1\" alt=\"Thonny IDE run code\" class=\"wp-image-132505\" srcset=\"https:\/\/i0.wp.com\/randomnerdtutorials.com\/wp-content\/uploads\/2023\/06\/thonny-ide-run-code.png?w=450&amp;quality=100&amp;strip=all&amp;ssl=1 450w, https:\/\/i0.wp.com\/randomnerdtutorials.com\/wp-content\/uploads\/2023\/06\/thonny-ide-run-code.png?resize=300%2C52&amp;quality=100&amp;strip=all&amp;ssl=1 300w\" sizes=\"(max-width: 450px) 100vw, 450px\" \/><\/figure><\/div>\n\n\n<p>New BME680 sensor readings should be displayed every 5 seconds.<\/p>\n\n\n<div class=\"wp-block-image\">\n<figure class=\"aligncenter size-full\"><img data-recalc-dims=\"1\" loading=\"lazy\" decoding=\"async\" width=\"700\" height=\"430\" src=\"https:\/\/i0.wp.com\/randomnerdtutorials.com\/wp-content\/uploads\/2024\/07\/RPi-Pico-BME680-basic-example-f.png?resize=700%2C430&#038;quality=100&#038;strip=all&#038;ssl=1\" alt=\"Raspberry Pi Pico Getting BME680 Sensor Readings - MicroPython\" class=\"wp-image-161193\" srcset=\"https:\/\/i0.wp.com\/randomnerdtutorials.com\/wp-content\/uploads\/2024\/07\/RPi-Pico-BME680-basic-example-f.png?w=700&amp;quality=100&amp;strip=all&amp;ssl=1 700w, https:\/\/i0.wp.com\/randomnerdtutorials.com\/wp-content\/uploads\/2024\/07\/RPi-Pico-BME680-basic-example-f.png?resize=300%2C184&amp;quality=100&amp;strip=all&amp;ssl=1 300w\" sizes=\"(max-width: 700px) 100vw, 700px\" \/><\/figure><\/div>\n\n\n<p><strong>Note:<\/strong> if you want a code to run automatically when the Raspberry Pi Pico boots (for example, without being connected to your computer), you need to save the file to the board with the name <span class=\"rnthl rntliteral\">main.py<\/span>.<\/p>\n\n\n\n<p>When you name a file <span class=\"rnthl rntliteral\">main.py<\/span>, the Raspberry Pi Pico will run that file automatically on boot. If you call it a different name, it will still be saved on the board filesystem, but it will not run automatically on boot.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Wrapping Up<\/h2>\n\n\n\n<p>This tutorial was a getting started guide to the BME680 environmental and air quality sensor with the Raspberry Pi Pico using MicroPython firmware.<\/p>\n\n\n\n<p>We hope you&#8217;ve found this tutorial useful. We have tutorials for other popular environmental sensors:<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li><a href=\"https:\/\/randomnerdtutorials.com\/raspberry-pi-pico-ds18b20-micropython\/\">Raspberry Pi Pico: <strong>DS18B20 Temperature Sensor<\/strong> (MicroPython) \u2013 Single and Multiple<\/a><\/li>\n\n\n\n<li><a href=\"https:\/\/randomnerdtutorials.com\/raspberry-pi-pico-dht11-dht22-micropython\/\">Raspberry Pi Pico: <strong>DHT11\/DHT22 Temperature and Humidity Sensor<\/strong> (MicroPython)<\/a><\/li>\n\n\n\n<li><a href=\"https:\/\/randomnerdtutorials.com\/raspberry-pi-pico-bme280-micropython\/\">Raspberry Pi Pico: <strong>BME280 Get Temperature, Humidity, and Pressure<\/strong> (MicroPython)<\/a><\/li>\n<\/ul>\n\n\n\n<p>You can check all our Raspberry Pi Pico projects on the following link:<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li><strong><a href=\"https:\/\/randomnerdtutorials.com\/raspberry-pi-pico-w-micropython-ebook\/\" title=\"\">Learn Raspberry Pi Pico with MicroPython (eBook)<\/a><\/strong><\/li>\n\n\n\n<li><a href=\"https:\/\/randomnerdtutorials.com\/projects-raspberry-pi-pico\/\" title=\"\">Free Raspberry Pi Pico Projects and Tutorials<\/a><\/li>\n<\/ul>\n\n\n\n<p>Thanks for reading.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Learn how to use the BME680 environmental sensor module with the Raspberry Pi Pico board programmed with MicroPython to get data about temperature, humidity, pressure, and gas (air quality). We&#8217;ll &#8230; <\/p>\n<p class=\"read-more-container\"><a title=\"Raspberry Pi Pico: BME680 Environmental Sensor (MicroPython)\" class=\"read-more button\" href=\"https:\/\/randomnerdtutorials.com\/raspberry-pi-pico-bme680-micropython\/#more-161184\" aria-label=\"Read more about Raspberry Pi Pico: BME680 Environmental Sensor (MicroPython)\">CONTINUE READING \u00bb<\/a><\/p>\n","protected":false},"author":5,"featured_media":161187,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"jetpack_post_was_ever_published":false,"_jetpack_newsletter_access":"","_jetpack_dont_email_post_to_subs":false,"_jetpack_newsletter_tier_id":0,"_jetpack_memberships_contains_paywalled_content":false,"_jetpack_memberships_contains_paid_content":false,"footnotes":""},"categories":[324,326],"tags":[],"class_list":["post-161184","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-raspberry-pi-pico","category-raspberry-pi-pico-micropython"],"aioseo_notices":[],"jetpack_featured_media_url":"https:\/\/i0.wp.com\/randomnerdtutorials.com\/wp-content\/uploads\/2024\/07\/Raspberry-Pi-Pico-BME680-Micropython.jpg?fit=1920%2C1080&quality=100&strip=all&ssl=1","jetpack_sharing_enabled":true,"_links":{"self":[{"href":"https:\/\/randomnerdtutorials.com\/wp-json\/wp\/v2\/posts\/161184","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/randomnerdtutorials.com\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/randomnerdtutorials.com\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/randomnerdtutorials.com\/wp-json\/wp\/v2\/users\/5"}],"replies":[{"embeddable":true,"href":"https:\/\/randomnerdtutorials.com\/wp-json\/wp\/v2\/comments?post=161184"}],"version-history":[{"count":4,"href":"https:\/\/randomnerdtutorials.com\/wp-json\/wp\/v2\/posts\/161184\/revisions"}],"predecessor-version":[{"id":162007,"href":"https:\/\/randomnerdtutorials.com\/wp-json\/wp\/v2\/posts\/161184\/revisions\/162007"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/randomnerdtutorials.com\/wp-json\/wp\/v2\/media\/161187"}],"wp:attachment":[{"href":"https:\/\/randomnerdtutorials.com\/wp-json\/wp\/v2\/media?parent=161184"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/randomnerdtutorials.com\/wp-json\/wp\/v2\/categories?post=161184"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/randomnerdtutorials.com\/wp-json\/wp\/v2\/tags?post=161184"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}