{"id":3431,"date":"2026-10-30T21:22:18","date_gmt":"2026-10-30T21:22:18","guid":{"rendered":"https:\/\/www.robertprice.co.uk\/robblog\/?p=3431"},"modified":"2026-10-30T21:22:19","modified_gmt":"2026-10-30T21:22:19","slug":"rc2026-part-6-reading-atmospheric-pressure-from-a-bme280-on-an-rc2014","status":"publish","type":"post","link":"https:\/\/www.robertprice.co.uk\/robblog\/rc2026-part-6-reading-atmospheric-pressure-from-a-bme280-on-an-rc2014\/","title":{"rendered":"RC2026 \u2013 Part 6 \u2013 Reading atmospheric pressure from a BME280 on an RC2014"},"content":{"rendered":"\n<p class=\"wp-block-paragraph\">In previous posts, I&#8217;ve been able to read the temperature and humidity using a BME280 sensor attached to my RC2014 computer. The BME280 has one other reading it can provide, and that is atmospheric pressure.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">As with the temperature and humidity, I need to calculate the value using the calibration data stored in the BME280. I also need the value of <code>t_fine<\/code> I stored when calculating the temperature. My previous post showed how to get these values. The <a href=\"https:\/\/www.bosch-sensortec.com\/media\/boschsensortec\/downloads\/datasheets\/bst-bme280-ds002.pdf\">BME280 datasheet <\/a>gives me the algorithm and example code to calculate the air pressure.<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>float readPressure(void) {\n    int64_t var1, var2, p;\n\n    readTemperature(); \/\/ Must be done first to set t_fine\n\n    int32_t adc_P = read24(BME280_REGISTER_PRESSUREDATA);\n    adc_P >>= 4;\n\n    var1 = ((int64_t)t_fine) - 128000;\n    var2 = var1 * var1 * (int64_t)_bme280_calib.dig_P6;\n    var2 = var2 + ((var1 * (int64_t)_bme280_calib.dig_P5) &lt;&lt; 17);\n    var2 = var2 + (((int64_t)_bme280_calib.dig_P4) &lt;&lt; 35);\n    var1 = ((var1 * var1 * (int64_t)_bme280_calib.dig_P3) >> 8) +\n           ((var1 * (int64_t)_bme280_calib.dig_P2) &lt;&lt; 12);\n    var1 =\n        (((((int64_t)1) &lt;&lt; 47) + var1)) * ((int64_t)_bme280_calib.dig_P1) >> 33;\n\n    if (var1 == 0) {\n        return 0; \/\/ avoid exception caused by division by zero\n    }\n    p = 1048576 - adc_P;\n    p = (((p &lt;&lt; 31) - var2) * 3125) \/ var1;\n    var1 = (((int64_t)_bme280_calib.dig_P9) * (p >> 13) * (p >> 13)) >> 25;\n    var2 = (((int64_t)_bme280_calib.dig_P8) * p) >> 19;\n\n    p = ((p + var1 + var2) >> 8) + (((int64_t)_bme280_calib.dig_P7) &lt;&lt; 4);\n    return (float)p \/ 256.0;\n}<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">I can plug this into existing code and get the temperature, air pressure, and humidity, then show it on the console.<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>float temperature = readTemperature();\nfloat pressure = readPressure();\nfloat humidity = readHumidity();\nprintf(\"Temperature: %.2f\u00b0C, \", temperature);\nprintf(\"Pressure: %.2f hPa, \", pressure);\nprintf(\"Humidity: %.2f %%\\n\", humidity);<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\"><\/p>\n","protected":false},"excerpt":{"rendered":"<p>In previous posts, I&#8217;ve been able to read the temperature and humidity using a BME280 sensor attached to my RC2014 computer. The BME280 has one other reading it can provide, and that is atmospheric pressure. As with the temperature and humidity, I need to calculate the value using the calibration data stored in the BME280. &hellip; <a href=\"https:\/\/www.robertprice.co.uk\/robblog\/rc2026-part-6-reading-atmospheric-pressure-from-a-bme280-on-an-rc2014\/\" class=\"more-link\">Continue reading<span class=\"screen-reader-text\"> &#8220;RC2026 \u2013 Part 6 \u2013 Reading atmospheric pressure from a BME280 on an RC2014&#8221;<\/span><\/a><\/p>\n","protected":false},"author":1,"featured_media":3387,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"inline_featured_image":false,"footnotes":""},"categories":[157,209,187],"tags":[215,117,219,213],"class_list":["post-3431","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-rc2014","category-rc2026","category-retrochallenge","tag-bme280","tag-rc2014","tag-rc2026","tag-spi"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v28.8 - https:\/\/yoast.com\/product\/yoast-seo-wordpress\/ -->\n<title>RC2026 \u2013 Part 6 \u2013 Reading atmospheric pressure from a BME280 on an RC2014 - Robert Price<\/title>\n<meta name=\"description\" content=\"This post shows how to read atmospheric air pressure using a BME280 sensor connected to an RC2014 computer.\" \/>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/www.robertprice.co.uk\/robblog\/rc2026-part-6-reading-atmospheric-pressure-from-a-bme280-on-an-rc2014\/\" \/>\n<meta property=\"og:locale\" content=\"en_GB\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"RC2026 \u2013 Part 6 \u2013 Reading atmospheric pressure from a BME280 on an RC2014 - Robert Price\" \/>\n<meta property=\"og:description\" content=\"This post shows how to read atmospheric air pressure using a BME280 sensor connected to an RC2014 computer.\" \/>\n<meta property=\"og:url\" content=\"https:\/\/www.robertprice.co.uk\/robblog\/rc2026-part-6-reading-atmospheric-pressure-from-a-bme280-on-an-rc2014\/\" \/>\n<meta property=\"og:site_name\" content=\"Robert Price\" \/>\n<meta property=\"article:published_time\" content=\"2026-10-30T21:22:18+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2026-10-30T21:22:19+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/www.robertprice.co.uk\/robblog\/assets\/BME280-RC2014.jpg\" \/>\n\t<meta property=\"og:image:width\" content=\"1600\" \/>\n\t<meta property=\"og:image:height\" content=\"1200\" \/>\n\t<meta property=\"og:image:type\" content=\"image\/jpeg\" \/>\n<meta name=\"author\" content=\"rob\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"rob\" \/>\n\t<meta name=\"twitter:label2\" content=\"Estimated reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"1 minute\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\\\/\\\/schema.org\",\"@graph\":[{\"@type\":\"Article\",\"@id\":\"https:\\\/\\\/www.robertprice.co.uk\\\/robblog\\\/rc2026-part-6-reading-atmospheric-pressure-from-a-bme280-on-an-rc2014\\\/#article\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/www.robertprice.co.uk\\\/robblog\\\/rc2026-part-6-reading-atmospheric-pressure-from-a-bme280-on-an-rc2014\\\/\"},\"author\":{\"name\":\"rob\",\"@id\":\"https:\\\/\\\/www.robertprice.co.uk\\\/robblog\\\/#\\\/schema\\\/person\\\/fac6d5b076e0e14e1fb13e15b542a6c5\"},\"headline\":\"RC2026 \u2013 Part 6 \u2013 Reading atmospheric pressure from a BME280 on an RC2014\",\"datePublished\":\"2026-10-30T21:22:18+00:00\",\"dateModified\":\"2026-10-30T21:22:19+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\\\/\\\/www.robertprice.co.uk\\\/robblog\\\/rc2026-part-6-reading-atmospheric-pressure-from-a-bme280-on-an-rc2014\\\/\"},\"wordCount\":124,\"image\":{\"@id\":\"https:\\\/\\\/www.robertprice.co.uk\\\/robblog\\\/rc2026-part-6-reading-atmospheric-pressure-from-a-bme280-on-an-rc2014\\\/#primaryimage\"},\"thumbnailUrl\":\"https:\\\/\\\/www.robertprice.co.uk\\\/robblog\\\/assets\\\/BME280-RC2014.jpg\",\"keywords\":[\"BME280\",\"RC2014\",\"RC2026\",\"SPI\"],\"articleSection\":[\"RC2014\",\"RC2026\",\"RetroChallenge\"],\"inLanguage\":\"en-GB\"},{\"@type\":\"WebPage\",\"@id\":\"https:\\\/\\\/www.robertprice.co.uk\\\/robblog\\\/rc2026-part-6-reading-atmospheric-pressure-from-a-bme280-on-an-rc2014\\\/\",\"url\":\"https:\\\/\\\/www.robertprice.co.uk\\\/robblog\\\/rc2026-part-6-reading-atmospheric-pressure-from-a-bme280-on-an-rc2014\\\/\",\"name\":\"RC2026 \u2013 Part 6 \u2013 Reading atmospheric pressure from a BME280 on an RC2014 - Robert Price\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/www.robertprice.co.uk\\\/robblog\\\/#website\"},\"primaryImageOfPage\":{\"@id\":\"https:\\\/\\\/www.robertprice.co.uk\\\/robblog\\\/rc2026-part-6-reading-atmospheric-pressure-from-a-bme280-on-an-rc2014\\\/#primaryimage\"},\"image\":{\"@id\":\"https:\\\/\\\/www.robertprice.co.uk\\\/robblog\\\/rc2026-part-6-reading-atmospheric-pressure-from-a-bme280-on-an-rc2014\\\/#primaryimage\"},\"thumbnailUrl\":\"https:\\\/\\\/www.robertprice.co.uk\\\/robblog\\\/assets\\\/BME280-RC2014.jpg\",\"datePublished\":\"2026-10-30T21:22:18+00:00\",\"dateModified\":\"2026-10-30T21:22:19+00:00\",\"author\":{\"@id\":\"https:\\\/\\\/www.robertprice.co.uk\\\/robblog\\\/#\\\/schema\\\/person\\\/fac6d5b076e0e14e1fb13e15b542a6c5\"},\"description\":\"This post shows how to read atmospheric air pressure using a BME280 sensor connected to an RC2014 computer.\",\"breadcrumb\":{\"@id\":\"https:\\\/\\\/www.robertprice.co.uk\\\/robblog\\\/rc2026-part-6-reading-atmospheric-pressure-from-a-bme280-on-an-rc2014\\\/#breadcrumb\"},\"inLanguage\":\"en-GB\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\\\/\\\/www.robertprice.co.uk\\\/robblog\\\/rc2026-part-6-reading-atmospheric-pressure-from-a-bme280-on-an-rc2014\\\/\"]}]},{\"@type\":\"ImageObject\",\"inLanguage\":\"en-GB\",\"@id\":\"https:\\\/\\\/www.robertprice.co.uk\\\/robblog\\\/rc2026-part-6-reading-atmospheric-pressure-from-a-bme280-on-an-rc2014\\\/#primaryimage\",\"url\":\"https:\\\/\\\/www.robertprice.co.uk\\\/robblog\\\/assets\\\/BME280-RC2014.jpg\",\"contentUrl\":\"https:\\\/\\\/www.robertprice.co.uk\\\/robblog\\\/assets\\\/BME280-RC2014.jpg\",\"width\":1600,\"height\":1200},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\\\/\\\/www.robertprice.co.uk\\\/robblog\\\/rc2026-part-6-reading-atmospheric-pressure-from-a-bme280-on-an-rc2014\\\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\\\/\\\/www.robertprice.co.uk\\\/robblog\\\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"RC2026 \u2013 Part 6 \u2013 Reading atmospheric pressure from a BME280 on an RC2014\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\\\/\\\/www.robertprice.co.uk\\\/robblog\\\/#website\",\"url\":\"https:\\\/\\\/www.robertprice.co.uk\\\/robblog\\\/\",\"name\":\"Robert Price\",\"description\":\"\",\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\\\/\\\/www.robertprice.co.uk\\\/robblog\\\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"en-GB\"},{\"@type\":\"Person\",\"@id\":\"https:\\\/\\\/www.robertprice.co.uk\\\/robblog\\\/#\\\/schema\\\/person\\\/fac6d5b076e0e14e1fb13e15b542a6c5\",\"name\":\"rob\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-GB\",\"@id\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/6f0eb511179100a4e968abc70403e33686e6ab3e992e392bedd2ccac01da666c?s=96&d=mm&r=g\",\"url\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/6f0eb511179100a4e968abc70403e33686e6ab3e992e392bedd2ccac01da666c?s=96&d=mm&r=g\",\"contentUrl\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/6f0eb511179100a4e968abc70403e33686e6ab3e992e392bedd2ccac01da666c?s=96&d=mm&r=g\",\"caption\":\"rob\"}}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"RC2026 \u2013 Part 6 \u2013 Reading atmospheric pressure from a BME280 on an RC2014 - Robert Price","description":"This post shows how to read atmospheric air pressure using a BME280 sensor connected to an RC2014 computer.","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/www.robertprice.co.uk\/robblog\/rc2026-part-6-reading-atmospheric-pressure-from-a-bme280-on-an-rc2014\/","og_locale":"en_GB","og_type":"article","og_title":"RC2026 \u2013 Part 6 \u2013 Reading atmospheric pressure from a BME280 on an RC2014 - Robert Price","og_description":"This post shows how to read atmospheric air pressure using a BME280 sensor connected to an RC2014 computer.","og_url":"https:\/\/www.robertprice.co.uk\/robblog\/rc2026-part-6-reading-atmospheric-pressure-from-a-bme280-on-an-rc2014\/","og_site_name":"Robert Price","article_published_time":"2026-10-30T21:22:18+00:00","article_modified_time":"2026-10-30T21:22:19+00:00","og_image":[{"width":1600,"height":1200,"url":"https:\/\/www.robertprice.co.uk\/robblog\/assets\/BME280-RC2014.jpg","type":"image\/jpeg"}],"author":"rob","twitter_card":"summary_large_image","twitter_misc":{"Written by":"rob","Estimated reading time":"1 minute"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/www.robertprice.co.uk\/robblog\/rc2026-part-6-reading-atmospheric-pressure-from-a-bme280-on-an-rc2014\/#article","isPartOf":{"@id":"https:\/\/www.robertprice.co.uk\/robblog\/rc2026-part-6-reading-atmospheric-pressure-from-a-bme280-on-an-rc2014\/"},"author":{"name":"rob","@id":"https:\/\/www.robertprice.co.uk\/robblog\/#\/schema\/person\/fac6d5b076e0e14e1fb13e15b542a6c5"},"headline":"RC2026 \u2013 Part 6 \u2013 Reading atmospheric pressure from a BME280 on an RC2014","datePublished":"2026-10-30T21:22:18+00:00","dateModified":"2026-10-30T21:22:19+00:00","mainEntityOfPage":{"@id":"https:\/\/www.robertprice.co.uk\/robblog\/rc2026-part-6-reading-atmospheric-pressure-from-a-bme280-on-an-rc2014\/"},"wordCount":124,"image":{"@id":"https:\/\/www.robertprice.co.uk\/robblog\/rc2026-part-6-reading-atmospheric-pressure-from-a-bme280-on-an-rc2014\/#primaryimage"},"thumbnailUrl":"https:\/\/www.robertprice.co.uk\/robblog\/assets\/BME280-RC2014.jpg","keywords":["BME280","RC2014","RC2026","SPI"],"articleSection":["RC2014","RC2026","RetroChallenge"],"inLanguage":"en-GB"},{"@type":"WebPage","@id":"https:\/\/www.robertprice.co.uk\/robblog\/rc2026-part-6-reading-atmospheric-pressure-from-a-bme280-on-an-rc2014\/","url":"https:\/\/www.robertprice.co.uk\/robblog\/rc2026-part-6-reading-atmospheric-pressure-from-a-bme280-on-an-rc2014\/","name":"RC2026 \u2013 Part 6 \u2013 Reading atmospheric pressure from a BME280 on an RC2014 - Robert Price","isPartOf":{"@id":"https:\/\/www.robertprice.co.uk\/robblog\/#website"},"primaryImageOfPage":{"@id":"https:\/\/www.robertprice.co.uk\/robblog\/rc2026-part-6-reading-atmospheric-pressure-from-a-bme280-on-an-rc2014\/#primaryimage"},"image":{"@id":"https:\/\/www.robertprice.co.uk\/robblog\/rc2026-part-6-reading-atmospheric-pressure-from-a-bme280-on-an-rc2014\/#primaryimage"},"thumbnailUrl":"https:\/\/www.robertprice.co.uk\/robblog\/assets\/BME280-RC2014.jpg","datePublished":"2026-10-30T21:22:18+00:00","dateModified":"2026-10-30T21:22:19+00:00","author":{"@id":"https:\/\/www.robertprice.co.uk\/robblog\/#\/schema\/person\/fac6d5b076e0e14e1fb13e15b542a6c5"},"description":"This post shows how to read atmospheric air pressure using a BME280 sensor connected to an RC2014 computer.","breadcrumb":{"@id":"https:\/\/www.robertprice.co.uk\/robblog\/rc2026-part-6-reading-atmospheric-pressure-from-a-bme280-on-an-rc2014\/#breadcrumb"},"inLanguage":"en-GB","potentialAction":[{"@type":"ReadAction","target":["https:\/\/www.robertprice.co.uk\/robblog\/rc2026-part-6-reading-atmospheric-pressure-from-a-bme280-on-an-rc2014\/"]}]},{"@type":"ImageObject","inLanguage":"en-GB","@id":"https:\/\/www.robertprice.co.uk\/robblog\/rc2026-part-6-reading-atmospheric-pressure-from-a-bme280-on-an-rc2014\/#primaryimage","url":"https:\/\/www.robertprice.co.uk\/robblog\/assets\/BME280-RC2014.jpg","contentUrl":"https:\/\/www.robertprice.co.uk\/robblog\/assets\/BME280-RC2014.jpg","width":1600,"height":1200},{"@type":"BreadcrumbList","@id":"https:\/\/www.robertprice.co.uk\/robblog\/rc2026-part-6-reading-atmospheric-pressure-from-a-bme280-on-an-rc2014\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/www.robertprice.co.uk\/robblog\/"},{"@type":"ListItem","position":2,"name":"RC2026 \u2013 Part 6 \u2013 Reading atmospheric pressure from a BME280 on an RC2014"}]},{"@type":"WebSite","@id":"https:\/\/www.robertprice.co.uk\/robblog\/#website","url":"https:\/\/www.robertprice.co.uk\/robblog\/","name":"Robert Price","description":"","potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/www.robertprice.co.uk\/robblog\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-GB"},{"@type":"Person","@id":"https:\/\/www.robertprice.co.uk\/robblog\/#\/schema\/person\/fac6d5b076e0e14e1fb13e15b542a6c5","name":"rob","image":{"@type":"ImageObject","inLanguage":"en-GB","@id":"https:\/\/secure.gravatar.com\/avatar\/6f0eb511179100a4e968abc70403e33686e6ab3e992e392bedd2ccac01da666c?s=96&d=mm&r=g","url":"https:\/\/secure.gravatar.com\/avatar\/6f0eb511179100a4e968abc70403e33686e6ab3e992e392bedd2ccac01da666c?s=96&d=mm&r=g","contentUrl":"https:\/\/secure.gravatar.com\/avatar\/6f0eb511179100a4e968abc70403e33686e6ab3e992e392bedd2ccac01da666c?s=96&d=mm&r=g","caption":"rob"}}]}},"_links":{"self":[{"href":"https:\/\/www.robertprice.co.uk\/robblog\/wp-json\/wp\/v2\/posts\/3431","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.robertprice.co.uk\/robblog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.robertprice.co.uk\/robblog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.robertprice.co.uk\/robblog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.robertprice.co.uk\/robblog\/wp-json\/wp\/v2\/comments?post=3431"}],"version-history":[{"count":2,"href":"https:\/\/www.robertprice.co.uk\/robblog\/wp-json\/wp\/v2\/posts\/3431\/revisions"}],"predecessor-version":[{"id":3435,"href":"https:\/\/www.robertprice.co.uk\/robblog\/wp-json\/wp\/v2\/posts\/3431\/revisions\/3435"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/www.robertprice.co.uk\/robblog\/wp-json\/wp\/v2\/media\/3387"}],"wp:attachment":[{"href":"https:\/\/www.robertprice.co.uk\/robblog\/wp-json\/wp\/v2\/media?parent=3431"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.robertprice.co.uk\/robblog\/wp-json\/wp\/v2\/categories?post=3431"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.robertprice.co.uk\/robblog\/wp-json\/wp\/v2\/tags?post=3431"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}