{"id":312,"date":"2022-09-23T22:14:16","date_gmt":"2022-09-23T12:44:16","guid":{"rendered":"https:\/\/sighmon.com\/says\/?p=312"},"modified":"2022-09-23T22:59:44","modified_gmt":"2022-09-23T13:29:44","slug":"co2-sensor-ios-macos-app","status":"publish","type":"post","link":"https:\/\/sighmon.com\/says\/co2-sensor-ios-macos-app\/","title":{"rendered":"CO2 sensor and iOS\/macOS app"},"content":{"rendered":"\n<p>After giving the <a href=\"https:\/\/sighmon.com\/says\/co2-x-covid-19-x-live-music\/\">Badger2040 CO2 monitor<\/a> to my parents I decided to build one for myself. An enhancement I wanted this time around was to be able to save data with the location attached. This meant buying a CPU with Bluetooth, and writing an iOS app to get the location data from my phone.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Hardware<\/h2>\n\n\n\n<p>I ended up with this setup for $162.50:<\/p>\n\n\n\n<ul class=\"wp-block-list\"><li><a href=\"https:\/\/www.adafruit.com\/product\/5190\">Adafruit SCD-41 CO2 sensor<\/a><\/li><li><a href=\"https:\/\/www.adafruit.com\/product\/5405\">Adafruit ESP32-C3 QT Py dev board<\/a><\/li><li><a href=\"https:\/\/www.adafruit.com\/product\/5397\">Adafruit battery charger for QT Py<\/a><\/li><li><a href=\"https:\/\/www.adafruit.com\/product\/4399\">Adafruit Qwiic cable<\/a><\/li><li>Recycled Nokia BP-6MT 3.7V battery<\/li><\/ul>\n\n\n\n<h2 class=\"wp-block-heading\">Software<\/h2>\n\n\n\n<h3 class=\"wp-block-heading\">Bluetooth sensor<\/h3>\n\n\n\n<p>I wanted to keep the Bluetooth ESP32 sensor code the same as the <a href=\"https:\/\/github.com\/Sensirion\/arduino-ble-gadget\">Sensirion BLE gadget<\/a> sample code, so that my iOS app would be compatible with all Sensirion sensors.<\/p>\n\n\n\n<p>But I also wanted the device to connect to my WiFi when I was home so that I could measure the CO2 over time via Prometheus\/Grafana, and also have Apple HomeKit connect to it so that I could ask Siri for the current levels.<\/p>\n\n\n\n<p>Find the code here: <a href=\"https:\/\/github.com\/sighmon\/co2_sensor_scd4x_esp32_http_server\/tree\/add\/4-adafruit-qt-py-esp32-c3\">add\/4-adafruit-qt-py-esp32-c3<\/a><\/p>\n\n\n\n<p>And the HomeKit accessory code here: <a href=\"https:\/\/github.com\/sighmon\/homekit-scd4x\">homekit-scd4x<\/a><\/p>\n\n\n\n<figure class=\"wp-block-image size-large\"><a href=\"https:\/\/sighmon.com\/says\/wp-content\/uploads\/2022\/09\/scd4x-esp32-c3-scaled.jpg\"><img loading=\"lazy\" decoding=\"async\" width=\"1024\" height=\"645\" src=\"https:\/\/sighmon.com\/says\/wp-content\/uploads\/2022\/09\/scd4x-esp32-c3-1024x645.jpg\" alt=\"\" class=\"wp-image-324\" srcset=\"https:\/\/sighmon.com\/says\/wp-content\/uploads\/2022\/09\/scd4x-esp32-c3-1024x645.jpg 1024w, https:\/\/sighmon.com\/says\/wp-content\/uploads\/2022\/09\/scd4x-esp32-c3-300x189.jpg 300w, https:\/\/sighmon.com\/says\/wp-content\/uploads\/2022\/09\/scd4x-esp32-c3-768x484.jpg 768w, https:\/\/sighmon.com\/says\/wp-content\/uploads\/2022\/09\/scd4x-esp32-c3-1536x968.jpg 1536w, https:\/\/sighmon.com\/says\/wp-content\/uploads\/2022\/09\/scd4x-esp32-c3-2048x1291.jpg 2048w, https:\/\/sighmon.com\/says\/wp-content\/uploads\/2022\/09\/scd4x-esp32-c3-1568x988.jpg 1568w\" sizes=\"auto, (max-width: 1024px) 100vw, 1024px\" \/><\/a><figcaption>The SCD-41 CO2 sensor connected to an ESP32-C3 QT Py microprocessor plugged into an old Nokia battery.<\/figcaption><\/figure>\n\n\n\n<figure class=\"wp-block-image size-large\"><a href=\"https:\/\/sighmon.com\/says\/wp-content\/uploads\/2022\/09\/scd-41-co2-temperature-humidity.png\"><img loading=\"lazy\" decoding=\"async\" width=\"1024\" height=\"650\" src=\"https:\/\/sighmon.com\/says\/wp-content\/uploads\/2022\/09\/scd-41-co2-temperature-humidity-1024x650.png\" alt=\"\" class=\"wp-image-325\" srcset=\"https:\/\/sighmon.com\/says\/wp-content\/uploads\/2022\/09\/scd-41-co2-temperature-humidity-1024x650.png 1024w, https:\/\/sighmon.com\/says\/wp-content\/uploads\/2022\/09\/scd-41-co2-temperature-humidity-300x190.png 300w, https:\/\/sighmon.com\/says\/wp-content\/uploads\/2022\/09\/scd-41-co2-temperature-humidity-768x487.png 768w, https:\/\/sighmon.com\/says\/wp-content\/uploads\/2022\/09\/scd-41-co2-temperature-humidity-1536x975.png 1536w, https:\/\/sighmon.com\/says\/wp-content\/uploads\/2022\/09\/scd-41-co2-temperature-humidity-2048x1299.png 2048w, https:\/\/sighmon.com\/says\/wp-content\/uploads\/2022\/09\/scd-41-co2-temperature-humidity-1568x995.png 1568w\" sizes=\"auto, (max-width: 1024px) 100vw, 1024px\" \/><\/a><figcaption>When the sensor is at home it connects to my WiFi and its data is graphed nicely by Grafana.<\/figcaption><\/figure>\n\n\n\n<h3 class=\"wp-block-heading\">iOS\/macOS app<\/h3>\n\n\n\n<p>Prototyping in SwiftUI is a really great experience, so it wasn&#8217;t long before I had CO2 readings showing up in my app. Next I added location data to the readings, and saved those in Core Data so they could be synced across Apple devices via iCloud.<\/p>\n\n\n\n<p>I noticed myself staring at the screen a lot as the as the data streamed in, and wondered if I could avoid having to look while understanding the data. This led me to add sound and haptic feedback.<\/p>\n\n\n\n<p>When sound is turned on, the app now plays two notes. The first is middle-C to signify what 1,000 ppm (parts per million) sounds like, and the second is the note corresponding to the current reading. This makes it easy to know if the reading is higher or lower than 1,000 ppm.<\/p>\n\n\n\n<p>The app also vibrates corresponding to the current reading &#8211; softly for under 850 ppm (safe levels), harder for over 1,000 ppm, and four vibrations in a row for over 2,000 ppm.<\/p>\n\n\n\n<p>As well as light and dark mode, I also added the ability for the screen to be coloured. Green for under 850 ppm, yellow under 1,500 ppm, orange under 2,000 ppm, and red for readings above that.<\/p>\n\n\n\n<p>Find the code here: <a href=\"https:\/\/github.com\/sighmon\/ios-ble-co2-sensor\">ios-ble-co2-sensor<\/a><\/p>\n\n\n\n<figure class=\"wp-block-gallery aligncenter has-nested-images columns-default is-cropped wp-block-gallery-1 is-layout-flex wp-block-gallery-is-layout-flex\">\n<figure class=\"wp-block-image size-large\"><a href=\"https:\/\/sighmon.com\/says\/wp-content\/uploads\/2022\/09\/co2-sensor-ios-home.png\"><img loading=\"lazy\" decoding=\"async\" width=\"515\" height=\"1024\" data-id=\"317\" src=\"https:\/\/sighmon.com\/says\/wp-content\/uploads\/2022\/09\/co2-sensor-ios-home-515x1024.png\" alt=\"\" class=\"wp-image-317\" srcset=\"https:\/\/sighmon.com\/says\/wp-content\/uploads\/2022\/09\/co2-sensor-ios-home-515x1024.png 515w, https:\/\/sighmon.com\/says\/wp-content\/uploads\/2022\/09\/co2-sensor-ios-home-151x300.png 151w, https:\/\/sighmon.com\/says\/wp-content\/uploads\/2022\/09\/co2-sensor-ios-home-768x1526.png 768w, https:\/\/sighmon.com\/says\/wp-content\/uploads\/2022\/09\/co2-sensor-ios-home-773x1536.png 773w, https:\/\/sighmon.com\/says\/wp-content\/uploads\/2022\/09\/co2-sensor-ios-home.png 956w\" sizes=\"auto, (max-width: 515px) 100vw, 515px\" \/><\/a><\/figure>\n\n\n\n<figure class=\"wp-block-image size-large\"><a href=\"https:\/\/sighmon.com\/says\/wp-content\/uploads\/2022\/09\/co2-sensor-ios-archive-detail.png\"><img loading=\"lazy\" decoding=\"async\" width=\"515\" height=\"1024\" data-id=\"320\" src=\"https:\/\/sighmon.com\/says\/wp-content\/uploads\/2022\/09\/co2-sensor-ios-archive-detail-515x1024.png\" alt=\"\" class=\"wp-image-320\" srcset=\"https:\/\/sighmon.com\/says\/wp-content\/uploads\/2022\/09\/co2-sensor-ios-archive-detail-515x1024.png 515w, https:\/\/sighmon.com\/says\/wp-content\/uploads\/2022\/09\/co2-sensor-ios-archive-detail-151x300.png 151w, https:\/\/sighmon.com\/says\/wp-content\/uploads\/2022\/09\/co2-sensor-ios-archive-detail-768x1526.png 768w, https:\/\/sighmon.com\/says\/wp-content\/uploads\/2022\/09\/co2-sensor-ios-archive-detail-773x1536.png 773w, https:\/\/sighmon.com\/says\/wp-content\/uploads\/2022\/09\/co2-sensor-ios-archive-detail.png 956w\" sizes=\"auto, (max-width: 515px) 100vw, 515px\" \/><\/a><\/figure>\n\n\n\n<figure class=\"wp-block-image size-large\"><a href=\"https:\/\/sighmon.com\/says\/wp-content\/uploads\/2022\/09\/co2-sensor-ios-green.png\"><img loading=\"lazy\" decoding=\"async\" width=\"515\" height=\"1024\" data-id=\"319\" src=\"https:\/\/sighmon.com\/says\/wp-content\/uploads\/2022\/09\/co2-sensor-ios-green-515x1024.png\" alt=\"\" class=\"wp-image-319\" srcset=\"https:\/\/sighmon.com\/says\/wp-content\/uploads\/2022\/09\/co2-sensor-ios-green-515x1024.png 515w, https:\/\/sighmon.com\/says\/wp-content\/uploads\/2022\/09\/co2-sensor-ios-green-151x300.png 151w, https:\/\/sighmon.com\/says\/wp-content\/uploads\/2022\/09\/co2-sensor-ios-green-768x1526.png 768w, https:\/\/sighmon.com\/says\/wp-content\/uploads\/2022\/09\/co2-sensor-ios-green-773x1536.png 773w, https:\/\/sighmon.com\/says\/wp-content\/uploads\/2022\/09\/co2-sensor-ios-green.png 956w\" sizes=\"auto, (max-width: 515px) 100vw, 515px\" \/><\/a><\/figure>\n\n\n\n<figure class=\"wp-block-image size-large\"><a href=\"https:\/\/sighmon.com\/says\/wp-content\/uploads\/2022\/09\/co2-sensor-ios-yellow.png\"><img loading=\"lazy\" decoding=\"async\" width=\"515\" height=\"1024\" data-id=\"321\" src=\"https:\/\/sighmon.com\/says\/wp-content\/uploads\/2022\/09\/co2-sensor-ios-yellow-515x1024.png\" alt=\"\" class=\"wp-image-321\" srcset=\"https:\/\/sighmon.com\/says\/wp-content\/uploads\/2022\/09\/co2-sensor-ios-yellow-515x1024.png 515w, https:\/\/sighmon.com\/says\/wp-content\/uploads\/2022\/09\/co2-sensor-ios-yellow-151x300.png 151w, https:\/\/sighmon.com\/says\/wp-content\/uploads\/2022\/09\/co2-sensor-ios-yellow-768x1526.png 768w, https:\/\/sighmon.com\/says\/wp-content\/uploads\/2022\/09\/co2-sensor-ios-yellow-773x1536.png 773w, https:\/\/sighmon.com\/says\/wp-content\/uploads\/2022\/09\/co2-sensor-ios-yellow.png 956w\" sizes=\"auto, (max-width: 515px) 100vw, 515px\" \/><\/a><\/figure>\n\n\n\n<figure class=\"wp-block-image size-large\"><a href=\"https:\/\/sighmon.com\/says\/wp-content\/uploads\/2022\/09\/co2-sensor-ios-orange.png\"><img loading=\"lazy\" decoding=\"async\" width=\"515\" height=\"1024\" data-id=\"322\" src=\"https:\/\/sighmon.com\/says\/wp-content\/uploads\/2022\/09\/co2-sensor-ios-orange-515x1024.png\" alt=\"\" class=\"wp-image-322\" srcset=\"https:\/\/sighmon.com\/says\/wp-content\/uploads\/2022\/09\/co2-sensor-ios-orange-515x1024.png 515w, https:\/\/sighmon.com\/says\/wp-content\/uploads\/2022\/09\/co2-sensor-ios-orange-151x300.png 151w, https:\/\/sighmon.com\/says\/wp-content\/uploads\/2022\/09\/co2-sensor-ios-orange-768x1526.png 768w, https:\/\/sighmon.com\/says\/wp-content\/uploads\/2022\/09\/co2-sensor-ios-orange-773x1536.png 773w, https:\/\/sighmon.com\/says\/wp-content\/uploads\/2022\/09\/co2-sensor-ios-orange.png 956w\" sizes=\"auto, (max-width: 515px) 100vw, 515px\" \/><\/a><\/figure>\n\n\n\n<figure class=\"wp-block-image size-large\"><a href=\"https:\/\/sighmon.com\/says\/wp-content\/uploads\/2022\/09\/co2-sensor-ios-red.png\"><img loading=\"lazy\" decoding=\"async\" width=\"515\" height=\"1024\" data-id=\"323\" src=\"https:\/\/sighmon.com\/says\/wp-content\/uploads\/2022\/09\/co2-sensor-ios-red-515x1024.png\" alt=\"\" class=\"wp-image-323\" srcset=\"https:\/\/sighmon.com\/says\/wp-content\/uploads\/2022\/09\/co2-sensor-ios-red-515x1024.png 515w, https:\/\/sighmon.com\/says\/wp-content\/uploads\/2022\/09\/co2-sensor-ios-red-151x300.png 151w, https:\/\/sighmon.com\/says\/wp-content\/uploads\/2022\/09\/co2-sensor-ios-red-768x1526.png 768w, https:\/\/sighmon.com\/says\/wp-content\/uploads\/2022\/09\/co2-sensor-ios-red-773x1536.png 773w, https:\/\/sighmon.com\/says\/wp-content\/uploads\/2022\/09\/co2-sensor-ios-red.png 956w\" sizes=\"auto, (max-width: 515px) 100vw, 515px\" \/><\/a><\/figure>\n<figcaption class=\"blocks-gallery-caption\">Screenshots of the iOS app showing different CO2 readings.<\/figcaption><\/figure>\n\n\n\n<figure class=\"wp-block-embed is-type-video is-provider-vimeo wp-block-embed-vimeo wp-embed-aspect-16-9 wp-has-aspect-ratio\"><div class=\"wp-block-embed__wrapper\">\n<iframe loading=\"lazy\" title=\"CO2 sensor x iOS\" src=\"https:\/\/player.vimeo.com\/video\/749526208?dnt=1&amp;app_id=122963\" width=\"640\" height=\"360\" frameborder=\"0\" allow=\"autoplay; fullscreen; picture-in-picture; clipboard-write\"><\/iframe>\n<\/div><figcaption>Hear the CO2 values increase after I breathe on it.<\/figcaption><\/figure>\n\n\n\n<p>Xcode lets any SwiftUI iOS app become a macOS app with the click of a button. I was sceptical whether Bluetooth would still work, but to my amazement it all Just Worked&#x2122;&#xfe0f;.<\/p>\n\n\n\n<figure class=\"wp-block-gallery has-nested-images columns-default is-cropped wp-block-gallery-2 is-layout-flex wp-block-gallery-is-layout-flex\">\n<figure class=\"wp-block-image size-large\"><a href=\"https:\/\/sighmon.com\/says\/wp-content\/uploads\/2022\/09\/co2-sensor-macos-home.png\"><img loading=\"lazy\" decoding=\"async\" width=\"920\" height=\"1024\" data-id=\"342\" src=\"https:\/\/sighmon.com\/says\/wp-content\/uploads\/2022\/09\/co2-sensor-macos-home-920x1024.png\" alt=\"\" class=\"wp-image-342\" srcset=\"https:\/\/sighmon.com\/says\/wp-content\/uploads\/2022\/09\/co2-sensor-macos-home-920x1024.png 920w, https:\/\/sighmon.com\/says\/wp-content\/uploads\/2022\/09\/co2-sensor-macos-home-269x300.png 269w, https:\/\/sighmon.com\/says\/wp-content\/uploads\/2022\/09\/co2-sensor-macos-home-768x855.png 768w, https:\/\/sighmon.com\/says\/wp-content\/uploads\/2022\/09\/co2-sensor-macos-home.png 1060w\" sizes=\"auto, (max-width: 920px) 100vw, 920px\" \/><\/a><\/figure>\n\n\n\n<figure class=\"wp-block-image size-large\"><a href=\"https:\/\/sighmon.com\/says\/wp-content\/uploads\/2022\/09\/co2-sensor-macos-archive-detail.png\"><img loading=\"lazy\" decoding=\"async\" width=\"920\" height=\"1024\" data-id=\"345\" src=\"https:\/\/sighmon.com\/says\/wp-content\/uploads\/2022\/09\/co2-sensor-macos-archive-detail-920x1024.png\" alt=\"\" class=\"wp-image-345\" srcset=\"https:\/\/sighmon.com\/says\/wp-content\/uploads\/2022\/09\/co2-sensor-macos-archive-detail-920x1024.png 920w, https:\/\/sighmon.com\/says\/wp-content\/uploads\/2022\/09\/co2-sensor-macos-archive-detail-269x300.png 269w, https:\/\/sighmon.com\/says\/wp-content\/uploads\/2022\/09\/co2-sensor-macos-archive-detail-768x855.png 768w, https:\/\/sighmon.com\/says\/wp-content\/uploads\/2022\/09\/co2-sensor-macos-archive-detail.png 1060w\" sizes=\"auto, (max-width: 920px) 100vw, 920px\" \/><\/a><\/figure>\n\n\n\n<figure class=\"wp-block-image size-large\"><a href=\"https:\/\/sighmon.com\/says\/wp-content\/uploads\/2022\/09\/co2-sensor-macos-green.png\"><img loading=\"lazy\" decoding=\"async\" width=\"920\" height=\"1024\" data-id=\"343\" src=\"https:\/\/sighmon.com\/says\/wp-content\/uploads\/2022\/09\/co2-sensor-macos-green-920x1024.png\" alt=\"\" class=\"wp-image-343\" srcset=\"https:\/\/sighmon.com\/says\/wp-content\/uploads\/2022\/09\/co2-sensor-macos-green-920x1024.png 920w, https:\/\/sighmon.com\/says\/wp-content\/uploads\/2022\/09\/co2-sensor-macos-green-269x300.png 269w, https:\/\/sighmon.com\/says\/wp-content\/uploads\/2022\/09\/co2-sensor-macos-green-768x855.png 768w, https:\/\/sighmon.com\/says\/wp-content\/uploads\/2022\/09\/co2-sensor-macos-green.png 1060w\" sizes=\"auto, (max-width: 920px) 100vw, 920px\" \/><\/a><\/figure>\n\n\n\n<figure class=\"wp-block-image size-large\"><a href=\"https:\/\/sighmon.com\/says\/wp-content\/uploads\/2022\/09\/co2-sensor-macos-yellow.png\"><img loading=\"lazy\" decoding=\"async\" width=\"920\" height=\"1024\" data-id=\"347\" src=\"https:\/\/sighmon.com\/says\/wp-content\/uploads\/2022\/09\/co2-sensor-macos-yellow-920x1024.png\" alt=\"\" class=\"wp-image-347\" srcset=\"https:\/\/sighmon.com\/says\/wp-content\/uploads\/2022\/09\/co2-sensor-macos-yellow-920x1024.png 920w, https:\/\/sighmon.com\/says\/wp-content\/uploads\/2022\/09\/co2-sensor-macos-yellow-269x300.png 269w, https:\/\/sighmon.com\/says\/wp-content\/uploads\/2022\/09\/co2-sensor-macos-yellow-768x855.png 768w, https:\/\/sighmon.com\/says\/wp-content\/uploads\/2022\/09\/co2-sensor-macos-yellow.png 1060w\" sizes=\"auto, (max-width: 920px) 100vw, 920px\" \/><\/a><\/figure>\n\n\n\n<figure class=\"wp-block-image size-large\"><a href=\"https:\/\/sighmon.com\/says\/wp-content\/uploads\/2022\/09\/co2-sensor-macos-orange.png\"><img loading=\"lazy\" decoding=\"async\" width=\"920\" height=\"1024\" data-id=\"344\" src=\"https:\/\/sighmon.com\/says\/wp-content\/uploads\/2022\/09\/co2-sensor-macos-orange-920x1024.png\" alt=\"\" class=\"wp-image-344\" srcset=\"https:\/\/sighmon.com\/says\/wp-content\/uploads\/2022\/09\/co2-sensor-macos-orange-920x1024.png 920w, https:\/\/sighmon.com\/says\/wp-content\/uploads\/2022\/09\/co2-sensor-macos-orange-269x300.png 269w, https:\/\/sighmon.com\/says\/wp-content\/uploads\/2022\/09\/co2-sensor-macos-orange-768x855.png 768w, https:\/\/sighmon.com\/says\/wp-content\/uploads\/2022\/09\/co2-sensor-macos-orange.png 1060w\" sizes=\"auto, (max-width: 920px) 100vw, 920px\" \/><\/a><\/figure>\n\n\n\n<figure class=\"wp-block-image size-large\"><a href=\"https:\/\/sighmon.com\/says\/wp-content\/uploads\/2022\/09\/co2-sensor-macos-red.png\"><img loading=\"lazy\" decoding=\"async\" width=\"920\" height=\"1024\" data-id=\"346\" src=\"https:\/\/sighmon.com\/says\/wp-content\/uploads\/2022\/09\/co2-sensor-macos-red-920x1024.png\" alt=\"\" class=\"wp-image-346\" srcset=\"https:\/\/sighmon.com\/says\/wp-content\/uploads\/2022\/09\/co2-sensor-macos-red-920x1024.png 920w, https:\/\/sighmon.com\/says\/wp-content\/uploads\/2022\/09\/co2-sensor-macos-red-269x300.png 269w, https:\/\/sighmon.com\/says\/wp-content\/uploads\/2022\/09\/co2-sensor-macos-red-768x855.png 768w, https:\/\/sighmon.com\/says\/wp-content\/uploads\/2022\/09\/co2-sensor-macos-red.png 1060w\" sizes=\"auto, (max-width: 920px) 100vw, 920px\" \/><\/a><\/figure>\n<figcaption class=\"blocks-gallery-caption\">The app running on macOS<\/figcaption><\/figure>\n\n\n\n<h2 class=\"wp-block-heading\">A case for the sensor<\/h2>\n\n\n\n<p>The next step was to design a 3D printable case for the sensors. I started drawing the sizes of each component in 2D using InDesign to give me an easy way of dragging around components for the smallest footprint.<\/p>\n\n\n\n<p>The first dream I had was of a round case, but I wasn&#8217;t sure about size so I designed a compact version as well.<\/p>\n\n\n\n<figure class=\"wp-block-gallery has-nested-images columns-default is-cropped wp-block-gallery-3 is-layout-flex wp-block-gallery-is-layout-flex\">\n<figure class=\"wp-block-image size-large\"><a href=\"https:\/\/sighmon.com\/says\/wp-content\/uploads\/2022\/09\/co2-sensor-case-v1.png\"><img loading=\"lazy\" decoding=\"async\" width=\"736\" height=\"1024\" data-id=\"326\" src=\"https:\/\/sighmon.com\/says\/wp-content\/uploads\/2022\/09\/co2-sensor-case-v1-736x1024.png\" alt=\"\" class=\"wp-image-326\" srcset=\"https:\/\/sighmon.com\/says\/wp-content\/uploads\/2022\/09\/co2-sensor-case-v1-736x1024.png 736w, https:\/\/sighmon.com\/says\/wp-content\/uploads\/2022\/09\/co2-sensor-case-v1-216x300.png 216w, https:\/\/sighmon.com\/says\/wp-content\/uploads\/2022\/09\/co2-sensor-case-v1-768x1068.png 768w, https:\/\/sighmon.com\/says\/wp-content\/uploads\/2022\/09\/co2-sensor-case-v1-1105x1536.png 1105w, https:\/\/sighmon.com\/says\/wp-content\/uploads\/2022\/09\/co2-sensor-case-v1-1473x2048.png 1473w, https:\/\/sighmon.com\/says\/wp-content\/uploads\/2022\/09\/co2-sensor-case-v1.png 1536w\" sizes=\"auto, (max-width: 736px) 100vw, 736px\" \/><\/a><\/figure>\n\n\n\n<figure class=\"wp-block-image size-large\"><a href=\"https:\/\/sighmon.com\/says\/wp-content\/uploads\/2022\/09\/co2-sensor-case-v2.png\"><img loading=\"lazy\" decoding=\"async\" width=\"736\" height=\"1024\" data-id=\"327\" src=\"https:\/\/sighmon.com\/says\/wp-content\/uploads\/2022\/09\/co2-sensor-case-v2-736x1024.png\" alt=\"\" class=\"wp-image-327\" srcset=\"https:\/\/sighmon.com\/says\/wp-content\/uploads\/2022\/09\/co2-sensor-case-v2-736x1024.png 736w, https:\/\/sighmon.com\/says\/wp-content\/uploads\/2022\/09\/co2-sensor-case-v2-216x300.png 216w, https:\/\/sighmon.com\/says\/wp-content\/uploads\/2022\/09\/co2-sensor-case-v2-768x1068.png 768w, https:\/\/sighmon.com\/says\/wp-content\/uploads\/2022\/09\/co2-sensor-case-v2-1105x1536.png 1105w, https:\/\/sighmon.com\/says\/wp-content\/uploads\/2022\/09\/co2-sensor-case-v2-1473x2048.png 1473w, https:\/\/sighmon.com\/says\/wp-content\/uploads\/2022\/09\/co2-sensor-case-v2.png 1536w\" sizes=\"auto, (max-width: 736px) 100vw, 736px\" \/><\/a><\/figure>\n<figcaption class=\"blocks-gallery-caption\">The round version one on the left, the more compact version two on the right.<\/figcaption><\/figure>\n\n\n\n<p>After a few hours in <a href=\"https:\/\/www.freecadweb.org\">FreeCAD<\/a> both versions came together quite quickly.<\/p>\n\n\n\n<p>Find the code here: <a href=\"https:\/\/github.com\/sighmon\/co2-sensor-case\">co2-sensor-case<\/a><\/p>\n\n\n\n<figure class=\"wp-block-gallery has-nested-images columns-default is-cropped wp-block-gallery-4 is-layout-flex wp-block-gallery-is-layout-flex\">\n<figure class=\"wp-block-image size-large\"><a href=\"https:\/\/sighmon.com\/says\/wp-content\/uploads\/2022\/09\/co2-sensor-case-freecad-v1.png\"><img loading=\"lazy\" decoding=\"async\" width=\"1024\" height=\"839\" data-id=\"330\" src=\"https:\/\/sighmon.com\/says\/wp-content\/uploads\/2022\/09\/co2-sensor-case-freecad-v1-1024x839.png\" alt=\"\" class=\"wp-image-330\" srcset=\"https:\/\/sighmon.com\/says\/wp-content\/uploads\/2022\/09\/co2-sensor-case-freecad-v1-1024x839.png 1024w, https:\/\/sighmon.com\/says\/wp-content\/uploads\/2022\/09\/co2-sensor-case-freecad-v1-300x246.png 300w, https:\/\/sighmon.com\/says\/wp-content\/uploads\/2022\/09\/co2-sensor-case-freecad-v1-768x629.png 768w, https:\/\/sighmon.com\/says\/wp-content\/uploads\/2022\/09\/co2-sensor-case-freecad-v1-1536x1258.png 1536w, https:\/\/sighmon.com\/says\/wp-content\/uploads\/2022\/09\/co2-sensor-case-freecad-v1-1568x1284.png 1568w, https:\/\/sighmon.com\/says\/wp-content\/uploads\/2022\/09\/co2-sensor-case-freecad-v1.png 1844w\" sizes=\"auto, (max-width: 1024px) 100vw, 1024px\" \/><\/a><\/figure>\n\n\n\n<figure class=\"wp-block-image size-large\"><a href=\"https:\/\/sighmon.com\/says\/wp-content\/uploads\/2022\/09\/co2-sensor-case-freecad-v2.png\"><img loading=\"lazy\" decoding=\"async\" width=\"1024\" height=\"839\" data-id=\"329\" src=\"https:\/\/sighmon.com\/says\/wp-content\/uploads\/2022\/09\/co2-sensor-case-freecad-v2-1024x839.png\" alt=\"\" class=\"wp-image-329\" srcset=\"https:\/\/sighmon.com\/says\/wp-content\/uploads\/2022\/09\/co2-sensor-case-freecad-v2-1024x839.png 1024w, https:\/\/sighmon.com\/says\/wp-content\/uploads\/2022\/09\/co2-sensor-case-freecad-v2-300x246.png 300w, https:\/\/sighmon.com\/says\/wp-content\/uploads\/2022\/09\/co2-sensor-case-freecad-v2-768x629.png 768w, https:\/\/sighmon.com\/says\/wp-content\/uploads\/2022\/09\/co2-sensor-case-freecad-v2-1536x1258.png 1536w, https:\/\/sighmon.com\/says\/wp-content\/uploads\/2022\/09\/co2-sensor-case-freecad-v2-1568x1284.png 1568w, https:\/\/sighmon.com\/says\/wp-content\/uploads\/2022\/09\/co2-sensor-case-freecad-v2.png 1844w\" sizes=\"auto, (max-width: 1024px) 100vw, 1024px\" \/><\/a><\/figure>\n<figcaption class=\"blocks-gallery-caption\">The round version one on the left, the more compact version two on the right.<\/figcaption><\/figure>\n\n\n\n<p>After seeing them both in 3D I decided on the more compact design and sent it off to <a href=\"https:\/\/kad3d.tech\">Kad3D<\/a> to be printed. A week later it arrived!<\/p>\n\n\n\n<figure class=\"wp-block-gallery has-nested-images columns-default is-cropped wp-block-gallery-5 is-layout-flex wp-block-gallery-is-layout-flex\">\n<figure class=\"wp-block-image size-large\"><a href=\"https:\/\/sighmon.com\/says\/wp-content\/uploads\/2022\/09\/co2-sensor-case-top-scaled.jpg\"><img loading=\"lazy\" decoding=\"async\" width=\"1024\" height=\"767\" data-id=\"331\" src=\"https:\/\/sighmon.com\/says\/wp-content\/uploads\/2022\/09\/co2-sensor-case-top-1024x767.jpg\" alt=\"\" class=\"wp-image-331\" srcset=\"https:\/\/sighmon.com\/says\/wp-content\/uploads\/2022\/09\/co2-sensor-case-top-1024x767.jpg 1024w, https:\/\/sighmon.com\/says\/wp-content\/uploads\/2022\/09\/co2-sensor-case-top-300x225.jpg 300w, https:\/\/sighmon.com\/says\/wp-content\/uploads\/2022\/09\/co2-sensor-case-top-768x575.jpg 768w, https:\/\/sighmon.com\/says\/wp-content\/uploads\/2022\/09\/co2-sensor-case-top-1536x1151.jpg 1536w, https:\/\/sighmon.com\/says\/wp-content\/uploads\/2022\/09\/co2-sensor-case-top-2048x1534.jpg 2048w, https:\/\/sighmon.com\/says\/wp-content\/uploads\/2022\/09\/co2-sensor-case-top-1568x1175.jpg 1568w\" sizes=\"auto, (max-width: 1024px) 100vw, 1024px\" \/><\/a><\/figure>\n\n\n\n<figure class=\"wp-block-image size-large\"><a href=\"https:\/\/sighmon.com\/says\/wp-content\/uploads\/2022\/09\/co2-sensor-case-bottom-scaled.jpg\"><img loading=\"lazy\" decoding=\"async\" width=\"1024\" height=\"767\" data-id=\"332\" src=\"https:\/\/sighmon.com\/says\/wp-content\/uploads\/2022\/09\/co2-sensor-case-bottom-1024x767.jpg\" alt=\"\" class=\"wp-image-332\" srcset=\"https:\/\/sighmon.com\/says\/wp-content\/uploads\/2022\/09\/co2-sensor-case-bottom-1024x767.jpg 1024w, https:\/\/sighmon.com\/says\/wp-content\/uploads\/2022\/09\/co2-sensor-case-bottom-300x225.jpg 300w, https:\/\/sighmon.com\/says\/wp-content\/uploads\/2022\/09\/co2-sensor-case-bottom-768x575.jpg 768w, https:\/\/sighmon.com\/says\/wp-content\/uploads\/2022\/09\/co2-sensor-case-bottom-1536x1151.jpg 1536w, https:\/\/sighmon.com\/says\/wp-content\/uploads\/2022\/09\/co2-sensor-case-bottom-2048x1534.jpg 2048w, https:\/\/sighmon.com\/says\/wp-content\/uploads\/2022\/09\/co2-sensor-case-bottom-1568x1175.jpg 1568w\" sizes=\"auto, (max-width: 1024px) 100vw, 1024px\" \/><\/a><\/figure>\n\n\n\n<figure class=\"wp-block-image size-large\"><a href=\"https:\/\/sighmon.com\/says\/wp-content\/uploads\/2022\/09\/co2-sensor-case-open-scaled.jpg\"><img loading=\"lazy\" decoding=\"async\" width=\"1024\" height=\"767\" data-id=\"333\" src=\"https:\/\/sighmon.com\/says\/wp-content\/uploads\/2022\/09\/co2-sensor-case-open-1024x767.jpg\" alt=\"\" class=\"wp-image-333\" srcset=\"https:\/\/sighmon.com\/says\/wp-content\/uploads\/2022\/09\/co2-sensor-case-open-1024x767.jpg 1024w, https:\/\/sighmon.com\/says\/wp-content\/uploads\/2022\/09\/co2-sensor-case-open-300x225.jpg 300w, https:\/\/sighmon.com\/says\/wp-content\/uploads\/2022\/09\/co2-sensor-case-open-768x575.jpg 768w, https:\/\/sighmon.com\/says\/wp-content\/uploads\/2022\/09\/co2-sensor-case-open-1536x1151.jpg 1536w, https:\/\/sighmon.com\/says\/wp-content\/uploads\/2022\/09\/co2-sensor-case-open-2048x1535.jpg 2048w, https:\/\/sighmon.com\/says\/wp-content\/uploads\/2022\/09\/co2-sensor-case-open-1568x1175.jpg 1568w\" sizes=\"auto, (max-width: 1024px) 100vw, 1024px\" \/><\/a><\/figure>\n\n\n\n<figure class=\"wp-block-image size-large\"><a href=\"https:\/\/sighmon.com\/says\/wp-content\/uploads\/2022\/09\/co2-sensor-case-phone-scaled.jpg\"><img loading=\"lazy\" decoding=\"async\" width=\"2560\" height=\"1920\" data-id=\"315\" src=\"https:\/\/sighmon.com\/says\/wp-content\/uploads\/2022\/09\/co2-sensor-case-phone-scaled.jpg\" alt=\"\" class=\"wp-image-315\" srcset=\"https:\/\/sighmon.com\/says\/wp-content\/uploads\/2022\/09\/co2-sensor-case-phone-scaled.jpg 2560w, https:\/\/sighmon.com\/says\/wp-content\/uploads\/2022\/09\/co2-sensor-case-phone-300x225.jpg 300w, https:\/\/sighmon.com\/says\/wp-content\/uploads\/2022\/09\/co2-sensor-case-phone-1024x768.jpg 1024w, https:\/\/sighmon.com\/says\/wp-content\/uploads\/2022\/09\/co2-sensor-case-phone-768x576.jpg 768w, https:\/\/sighmon.com\/says\/wp-content\/uploads\/2022\/09\/co2-sensor-case-phone-1536x1152.jpg 1536w, https:\/\/sighmon.com\/says\/wp-content\/uploads\/2022\/09\/co2-sensor-case-phone-2048x1536.jpg 2048w, https:\/\/sighmon.com\/says\/wp-content\/uploads\/2022\/09\/co2-sensor-case-phone-1568x1176.jpg 1568w\" sizes=\"auto, (max-width: 2560px) 100vw, 2560px\" \/><\/a><\/figure>\n<figcaption class=\"blocks-gallery-caption\">The CO2 sensor case printed in 0.1mm height PLA. A perfect fit.<\/figcaption><\/figure>\n\n\n\n<h2 class=\"wp-block-heading\">Performance and ethics<\/h2>\n\n\n\n<p>I&#8217;m really happy with version one of the sensor and app. I currently have the CO2 sensor reading and advertising its data every 5 seconds over Bluetooth and WiFi. With the radios both set to full power, my 13 year old Nokia battery lasts for ~8 hours before needing a charge via USB-C.<\/p>\n\n\n\n<p>This is fine for now, but I might work on two-way Bluetooth communication so that I can reduce the radio power and increase the time between readings for longer battery life.<\/p>\n\n\n\n<p>Another thing to consider is the ethics of saving and sharing CO2 readings. Should I share the open data for the safety of the public? Or should I disclose my findings to the owners first, recommending changes before publishing the data publicly? <\/p>\n\n\n\n<p>Perhaps a Tweet-bot with a 14 day disclosure delay timer is in order.<\/p>\n\n\n\n<p>In the meantime, Siri has the best advice &#8211; clear the air with ventilation.<\/p>\n\n\n\n<figure class=\"wp-block-embed is-type-video is-provider-vimeo wp-block-embed-vimeo wp-embed-aspect-16-9 wp-has-aspect-ratio\"><div class=\"wp-block-embed__wrapper\">\n<iframe loading=\"lazy\" title=\"CO2 sensor x Siri\" src=\"https:\/\/player.vimeo.com\/video\/752832227?dnt=1&amp;app_id=122963\" width=\"640\" height=\"360\" frameborder=\"0\" allow=\"autoplay; fullscreen; picture-in-picture; clipboard-write\"><\/iframe>\n<\/div><figcaption>Asking Siri what the CO2 readings are in my office, with the iOS app open beside it.<\/figcaption><\/figure>\n","protected":false},"excerpt":{"rendered":"<p>Building a portable CO2 sensor with data logging, Apple Siri\/HomeKit integration, and an iOS\/macOS app.<\/p>\n","protected":false},"author":1,"featured_media":315,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[8,31,9],"tags":[76,11,72,33,75,14],"class_list":["post-312","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-arduino","category-ios","category-sensors","tag-3d-printing","tag-arduino","tag-co2","tag-ios","tag-macos","tag-sensors","entry"],"_links":{"self":[{"href":"https:\/\/sighmon.com\/says\/wp-json\/wp\/v2\/posts\/312","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/sighmon.com\/says\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/sighmon.com\/says\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/sighmon.com\/says\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/sighmon.com\/says\/wp-json\/wp\/v2\/comments?post=312"}],"version-history":[{"count":10,"href":"https:\/\/sighmon.com\/says\/wp-json\/wp\/v2\/posts\/312\/revisions"}],"predecessor-version":[{"id":348,"href":"https:\/\/sighmon.com\/says\/wp-json\/wp\/v2\/posts\/312\/revisions\/348"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/sighmon.com\/says\/wp-json\/wp\/v2\/media\/315"}],"wp:attachment":[{"href":"https:\/\/sighmon.com\/says\/wp-json\/wp\/v2\/media?parent=312"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/sighmon.com\/says\/wp-json\/wp\/v2\/categories?post=312"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/sighmon.com\/says\/wp-json\/wp\/v2\/tags?post=312"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}