{"id":478,"date":"2023-04-21T11:33:10","date_gmt":"2023-04-21T11:33:10","guid":{"rendered":"https:\/\/www.bleuio.com\/blog\/?p=478"},"modified":"2023-04-27T07:17:05","modified_gmt":"2023-04-27T07:17:05","slug":"create-a-real-time-desktop-co2-widget-using-javascript-and-bluetooth","status":"publish","type":"post","link":"https:\/\/www.bleuio.com\/blog\/create-a-real-time-desktop-co2-widget-using-javascript-and-bluetooth\/","title":{"rendered":"Create a real-time desktop CO2 widget using Javascript and Bluetooth"},"content":{"rendered":"\n<p>Creating a small real-time desktop CO2 widget using JavaScript and Bluetooth is a fun and engaging project that can help you understand how to work with Bluetooth communication and sensor data processing.<\/p>\n\n\n\n<p>In this project we will use <a href=\"https:\/\/bleuio.com\/\" target=\"_blank\" rel=\"noreferrer noopener\"><strong>BleuIO<\/strong><\/a> to communicate with air quality monitoring sensor to read CO2 data. BleuIO is a bluetooth low energy usb dongle that helps to create BLE application easily. The AT command available on this device makes the development faster and easier. <\/p>\n\n\n\n<p>There are many <a href=\"https:\/\/www.hibouair.com\/\">air quality sensor<\/a> available but one popular choice is the <strong>HibouAir<\/strong>. <\/p>\n\n\n\n<p>We will use <a href=\"https:\/\/www.electronjs.org\/\" target=\"_blank\" rel=\"noreferrer noopener\">electron<\/a> js and <a href=\"https:\/\/serialport.io\/docs\/\" target=\"_blank\" rel=\"noreferrer noopener\">node serial<\/a> to connect with BleuIO. After that we will use <a href=\"https:\/\/www.bleuio.com\/getting_started\/docs\/commands\/\" target=\"_blank\" rel=\"noreferrer noopener\">AT commands<\/a> to scan for nearby Bluetooth device that is advertising with a given board ID which is the air quality monitoring sensor. <\/p>\n\n\n\n<p>Requirments : <\/p>\n\n\n\n<ol class=\"wp-block-list\">\n<li><a href=\"https:\/\/bleuio.com\/\" target=\"_blank\" rel=\"noreferrer noopener\">BleuIO<\/a> <\/li>\n\n\n\n<li><a href=\"https:\/\/www.hibouair.com\/\" target=\"_blank\" rel=\"noreferrer noopener\">HibouAir &#8211; air quality monitoring sensor<\/a><\/li>\n<\/ol>\n\n\n\n<p>Note: both <a href=\"https:\/\/www.digikey.com\/en\/products\/filter\/rf-receiver-transmitter-and-transceiver-finished-units\/873?s=N4IgTCBcDaIM5wCYAZkFYQF0C%2BQ\" target=\"_blank\" rel=\"noreferrer noopener\"><strong>BleuIO<\/strong><\/a> and <strong><a href=\"https:\/\/www.digikey.com\/en\/products\/filter\/gas-sensors\/530?s=N4IgjCBcoLQBxVAYygMwIYBsDOBTANCAPZQDaIATAJwAMCAugL7NA\" target=\"_blank\" rel=\"noreferrer noopener\">HibouAir<\/a><\/strong> are available at digikey. <\/p>\n\n\n\n<p>Here are the steps you can follow to create your own widget:<\/p>\n\n\n\n<p><strong>Hardware setup : <\/strong><\/p>\n\n\n\n<p>Connect BleuIO to the computer and wait for the device to recognize it. This usually takes 10 seconds. Connect the air quality monitoring sensor HibouAir to a power cable. Make sure the device is within 50 meters. <\/p>\n\n\n\n<p><strong>Write the code :<\/strong><\/p>\n\n\n\n<p>Clone this repository from Github using <\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>git clone https:\/\/github.com\/smart-sensor-devices-ab\/bluetooth-co2-desktop-widget.git<\/code><\/pre>\n\n\n\n<p>After that go inside the directory and write <\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>npm install <\/code><\/pre>\n\n\n\n<p>on terminal. This will install necessary libraries. <\/p>\n\n\n\n<p>Inside this folder we will find three .js files and one html file. The index.html file is the frontend where we will see the real-time CO2 values. <\/p>\n\n\n\n<p>The main.js file initialize the application and creates an window of 200px X 200px<\/p>\n\n\n\n<p>render.js is the file which has all the logic go connect to BleuIO via serial port , gets real-time air quality data, decode it and finally print it on the screen. <\/p>\n\n\n\n<p><strong>Code explanation :<\/strong><\/p>\n\n\n\n<p>On render.js file, at first we make a list of devices connected to serial port.  Then we filter out only the BleuIO devices by filtering with vendorID which is <strong>2dcf<\/strong>. After that we pick the first item of the list. <\/p>\n\n\n\n<p>Once we know the path of the BleuIO device , we connect to it. <\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>ports = ports.filter((x) =&gt; x.vendorId == \"2dcf\");\n      if (ports &amp;&amp; ports.length &gt; 0) {\n        port = new SerialPort({\n          path: ports&#91;0].path,\n          baudRate: 57600,\n        });\n}<\/code><\/pre>\n\n\n\n<p>Now that we are connected to the BleuIO dongle, we can write AT commands to it and get the response. <\/p>\n\n\n\n<p>At first we write <strong>AT+DUAL<\/strong> to the dongle to put the dongle in dual role. So that we can scan for nearby devices and advertised data. <\/p>\n\n\n\n<p>to put the dongle in dual role we write <\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>port.write(Buffer.from(\"AT+DUAL\\r\"), function (err) {\n          if (err) {\n            document.getElementById(\"error\").textContent =\n              \"Error writing at dual\";\n          } else {\n            console.log('dongle in dual role')\n}<\/code><\/pre>\n\n\n\n<p>In this project I am trying to get air quality data from a HibouAir device which has a board ID of 45840D. Therefore I look for advertised data that has this specific boardID. If i write <strong>AT+FINDSCANDATA=4584OD<\/strong>, BleuIO will filter out only advertise data from this board ID. <\/p>\n\n\n\n<p>After writing this , we get a response from the dongle. To read the response from serial port we use <\/p>\n\n\n\n<pre class=\"wp-block-code\"><code> port.on(\"readable\", () =&gt; {\n          let data = port.read();\nconsole.log(data)\n})<\/code><\/pre>\n\n\n\n<p>We can push the response in an array and later decide what to do with it. <\/p>\n\n\n\n<p>When we do a AT+FINDSCANDATA=45840D<\/p>\n\n\n\n<p>the response from the dongle looks something like this <\/p>\n\n\n\n<figure class=\"wp-block-image size-large\"><img loading=\"lazy\" decoding=\"async\" width=\"1024\" height=\"223\" src=\"https:\/\/www.bleuio.com\/blog\/wp-content\/uploads\/2023\/04\/image-1024x223.png\" alt=\"\" class=\"wp-image-480\" srcset=\"https:\/\/www.bleuio.com\/blog\/wp-content\/uploads\/2023\/04\/image-1024x223.png 1024w, https:\/\/www.bleuio.com\/blog\/wp-content\/uploads\/2023\/04\/image-300x65.png 300w, https:\/\/www.bleuio.com\/blog\/wp-content\/uploads\/2023\/04\/image-768x167.png 768w, https:\/\/www.bleuio.com\/blog\/wp-content\/uploads\/2023\/04\/image-1536x335.png 1536w, https:\/\/www.bleuio.com\/blog\/wp-content\/uploads\/2023\/04\/image.png 1956w\" sizes=\"auto, (max-width: 1024px) 100vw, 1024px\" \/><\/figure>\n\n\n\n<p>Then we take the last response by using <\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>resp = readDataArray&#91;readDataArray.length - 2];<\/code><\/pre>\n\n\n\n<p>After that , get the advertised data from the string by <\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>resp.split(\" \").pop();<\/code><\/pre>\n\n\n\n<p>Now we have the advertised data in a variable. We can easily get the CO2 value from this string by selecting the position. The documentation from HibouAirs says , the CO2 value is right at the end of the string. In that case the value is 023A which is 570 is decimal. <\/p>\n\n\n\n<p>We can print this value in our screen. <\/p>\n\n\n\n<p>We can create a function that do the scanning every 20 seconds to get latest values. <\/p>\n\n\n\n<p>Here is the complete code to render.js file<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>\/\/ This file is required by the index.html file and will\n\/\/ be executed in the renderer process for that window.\n\/\/ All of the Node.js APIs are available in this process.\nconst { SerialPort } = require(\"serialport\");\nvar port;\nvar readDataArray = &#91;];\nasync function listSerialPorts() {\n  await SerialPort.list().then((ports, err) =&gt; {\n    if (err) {\n      document.getElementById(\"error\").textContent = err.message;\n      return;\n    } else {\n      document.getElementById(\"error\").textContent = \"\";\n    }\n    console.log(\"ports\", ports);\n\n    if (ports.length === 0) {\n      document.getElementById(\"error\").textContent = \"No ports discovered\";\n    } else {\n      ports = ports.filter((x) =&gt; x.vendorId == \"2dcf\");\n      if (ports &amp;&amp; ports.length &gt; 0) {\n        port = new SerialPort({\n          path: ports&#91;0].path,\n          baudRate: 57600,\n        });\n        port.write(Buffer.from(\"AT+DUAL\\r\"), function (err) {\n          if (err) {\n            document.getElementById(\"error\").textContent =\n              \"Error writing at dual\";\n          } else {\n            const myWriteFunc = () =&gt; {\n              port.write(Buffer.from(\"AT+FINDSCANDATA=5B0705=3\\r\")),\n                function (err) {\n                  if (err) {\n                    document.getElementById(\"error\").textContent =\n                      \"Error writing findscandata\";\n                  } else {\n                    console.log(\"here\");\n                  }\n                };\n            };\n            myWriteFunc();\n            setInterval(() =&gt; {\n              myWriteFunc();\n            }, 20000);\n          }\n        });\n        \/\/ Read serial port data\n        port.on(\"readable\", () =&gt; {\n          let data = port.read();\n          let enc = new TextDecoder();\n          let arr = new Uint8Array(data);\n          let removeRn = enc.decode(arr).replace(\/\\r?\\n|\\r\/gm, \"\");\n          if (removeRn != null) readDataArray.push(removeRn);\n          if (removeRn == \"SCAN COMPLETE\") {\n            console.log(readDataArray);\n            let resp = readDataArray&#91;readDataArray.length - 2];\n\n            let advData = resp.split(\" \").pop();\n            let pos = advData.indexOf(\"5B0705\");\n            console.log(\"advData\", advData);\n            console.log(\"c\", advData.substr(pos + 46, 4));\n            let co2 = parseInt(\"0x\" + advData.substr(pos + 46, 4));\n            console.log(co2);\n            document.getElementById(\"co2Val\").innerHTML = co2;\n          }\n        });\n      } else {\n        document.getElementById(\"error\").innerHTML =\n          \"No device found. Please connect a BleuIO ongle to your computer and try again.\";\n      }\n    }\n  });\n}\n\nfunction listPorts() {\n  listSerialPorts();\n  setTimeout(listPorts, 20000);\n}\n\n\/\/ Set a timeout that will check for new serialPorts every 2 seconds.\n\/\/ This timeout reschedules itself.\n\/\/setTimeout(listPorts, 2000);\n\nlistSerialPorts();<\/code><\/pre>\n\n\n\n<p>To build this app we need a library called electron-builder. To install this library we write on terminal <br>npm i&nbsp;electron-builder<\/p>\n\n\n\n<p>Once the library is build , we need to update our package json file and add build option or mac.<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>\"build\": {\n    \"appId\": \"com.co2.widget\",\n    \"productName\": \"co2-widget\",\n    \"mac\": {\n      \"category\": \"airquality.app.widget\"\n    }\n  }<\/code><\/pre>\n\n\n\n<p>We can update our script on package json like this<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>\"scripts\": {\n    \"start\": \"electron .\",\n    \"pack\": \"electron-builder --dir\",\n    \"dist\": \"electron-builder\"\n  },<\/code><\/pre>\n\n\n\n<p>Once we are done, build the app with <\/p>\n\n\n\n<p>npm run build<\/p>\n\n\n\n<p>We will see a dmg file in our dist folder. Once we run the app, the widget will look like this.<\/p>\n\n\n\n<figure class=\"wp-block-image size-large\"><img loading=\"lazy\" decoding=\"async\" width=\"1024\" height=\"576\" src=\"https:\/\/www.bleuio.com\/blog\/wp-content\/uploads\/2023\/04\/Screenshot-2023-04-21-at-16.59.12-1024x576.png\" alt=\"\" class=\"wp-image-481\" srcset=\"https:\/\/www.bleuio.com\/blog\/wp-content\/uploads\/2023\/04\/Screenshot-2023-04-21-at-16.59.12-1024x576.png 1024w, https:\/\/www.bleuio.com\/blog\/wp-content\/uploads\/2023\/04\/Screenshot-2023-04-21-at-16.59.12-300x169.png 300w, https:\/\/www.bleuio.com\/blog\/wp-content\/uploads\/2023\/04\/Screenshot-2023-04-21-at-16.59.12-768x432.png 768w, https:\/\/www.bleuio.com\/blog\/wp-content\/uploads\/2023\/04\/Screenshot-2023-04-21-at-16.59.12-1536x864.png 1536w, https:\/\/www.bleuio.com\/blog\/wp-content\/uploads\/2023\/04\/Screenshot-2023-04-21-at-16.59.12.png 1920w\" sizes=\"auto, (max-width: 1024px) 100vw, 1024px\" \/><\/figure>\n\n\n\n<p>The value will update every 20 seconds.<\/p>\n\n\n\n<p>Creating a small desktop CO2 widget using JavaScript and BlueIO is a great way to learn about these technologies and create a useful tool for monitoring indoor air quality.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Creating a small real-time desktop CO2 widget using JavaScript and Bluetooth is a fun and engaging project that can help you understand how to work with Bluetooth communication and sensor data processing. In this project we will use BleuIO to communicate with air quality monitoring sensor to read CO2 data. BleuIO is a bluetooth low [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":483,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[2],"tags":[],"class_list":["post-478","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-bleuio-tutorial"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v27.5 - https:\/\/yoast.com\/product\/yoast-seo-wordpress\/ -->\n<title>Create a real-time desktop CO2 widget using Javascript and Bluetooth - BleuIO - Create Bluetooth Low Energy application<\/title>\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.bleuio.com\/blog\/create-a-real-time-desktop-co2-widget-using-javascript-and-bluetooth\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"Create a real-time desktop CO2 widget using Javascript and Bluetooth - BleuIO - Create Bluetooth Low Energy application\" \/>\n<meta property=\"og:description\" content=\"Creating a small real-time desktop CO2 widget using JavaScript and Bluetooth is a fun and engaging project that can help you understand how to work with Bluetooth communication and sensor data processing. In this project we will use BleuIO to communicate with air quality monitoring sensor to read CO2 data. BleuIO is a bluetooth low [&hellip;]\" \/>\n<meta property=\"og:url\" content=\"https:\/\/www.bleuio.com\/blog\/create-a-real-time-desktop-co2-widget-using-javascript-and-bluetooth\/\" \/>\n<meta property=\"og:site_name\" content=\"BleuIO - Create Bluetooth Low Energy application\" \/>\n<meta property=\"article:published_time\" content=\"2023-04-21T11:33:10+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2023-04-27T07:17:05+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/www.bleuio.com\/blog\/wp-content\/uploads\/2023\/04\/create-a-realtime-co2-desktop-widget.jpg\" \/>\n\t<meta property=\"og:image:width\" content=\"800\" \/>\n\t<meta property=\"og:image:height\" content=\"450\" \/>\n\t<meta property=\"og:image:type\" content=\"image\/jpeg\" \/>\n<meta name=\"author\" content=\"BleuIO\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\\\/\\\/schema.org\",\"@graph\":[{\"@type\":\"Article\",\"@id\":\"https:\\\/\\\/www.bleuio.com\\\/blog\\\/create-a-real-time-desktop-co2-widget-using-javascript-and-bluetooth\\\/#article\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/www.bleuio.com\\\/blog\\\/create-a-real-time-desktop-co2-widget-using-javascript-and-bluetooth\\\/\"},\"author\":{\"name\":\"BleuIO\",\"@id\":\"https:\\\/\\\/www.bleuio.com\\\/blog\\\/#\\\/schema\\\/person\\\/89bc581382d5964043f96efc54b75b80\"},\"headline\":\"Create a real-time desktop CO2 widget using Javascript and Bluetooth\",\"datePublished\":\"2023-04-21T11:33:10+00:00\",\"dateModified\":\"2023-04-27T07:17:05+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\\\/\\\/www.bleuio.com\\\/blog\\\/create-a-real-time-desktop-co2-widget-using-javascript-and-bluetooth\\\/\"},\"wordCount\":737,\"commentCount\":0,\"image\":{\"@id\":\"https:\\\/\\\/www.bleuio.com\\\/blog\\\/create-a-real-time-desktop-co2-widget-using-javascript-and-bluetooth\\\/#primaryimage\"},\"thumbnailUrl\":\"https:\\\/\\\/www.bleuio.com\\\/blog\\\/wp-content\\\/uploads\\\/2023\\\/04\\\/create-a-realtime-co2-desktop-widget.jpg\",\"articleSection\":[\"BleuIO tutorial\"],\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"CommentAction\",\"name\":\"Comment\",\"target\":[\"https:\\\/\\\/www.bleuio.com\\\/blog\\\/create-a-real-time-desktop-co2-widget-using-javascript-and-bluetooth\\\/#respond\"]}]},{\"@type\":\"WebPage\",\"@id\":\"https:\\\/\\\/www.bleuio.com\\\/blog\\\/create-a-real-time-desktop-co2-widget-using-javascript-and-bluetooth\\\/\",\"url\":\"https:\\\/\\\/www.bleuio.com\\\/blog\\\/create-a-real-time-desktop-co2-widget-using-javascript-and-bluetooth\\\/\",\"name\":\"Create a real-time desktop CO2 widget using Javascript and Bluetooth - BleuIO - Create Bluetooth Low Energy application\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/www.bleuio.com\\\/blog\\\/#website\"},\"primaryImageOfPage\":{\"@id\":\"https:\\\/\\\/www.bleuio.com\\\/blog\\\/create-a-real-time-desktop-co2-widget-using-javascript-and-bluetooth\\\/#primaryimage\"},\"image\":{\"@id\":\"https:\\\/\\\/www.bleuio.com\\\/blog\\\/create-a-real-time-desktop-co2-widget-using-javascript-and-bluetooth\\\/#primaryimage\"},\"thumbnailUrl\":\"https:\\\/\\\/www.bleuio.com\\\/blog\\\/wp-content\\\/uploads\\\/2023\\\/04\\\/create-a-realtime-co2-desktop-widget.jpg\",\"datePublished\":\"2023-04-21T11:33:10+00:00\",\"dateModified\":\"2023-04-27T07:17:05+00:00\",\"author\":{\"@id\":\"https:\\\/\\\/www.bleuio.com\\\/blog\\\/#\\\/schema\\\/person\\\/89bc581382d5964043f96efc54b75b80\"},\"breadcrumb\":{\"@id\":\"https:\\\/\\\/www.bleuio.com\\\/blog\\\/create-a-real-time-desktop-co2-widget-using-javascript-and-bluetooth\\\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\\\/\\\/www.bleuio.com\\\/blog\\\/create-a-real-time-desktop-co2-widget-using-javascript-and-bluetooth\\\/\"]}]},{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\\\/\\\/www.bleuio.com\\\/blog\\\/create-a-real-time-desktop-co2-widget-using-javascript-and-bluetooth\\\/#primaryimage\",\"url\":\"https:\\\/\\\/www.bleuio.com\\\/blog\\\/wp-content\\\/uploads\\\/2023\\\/04\\\/create-a-realtime-co2-desktop-widget.jpg\",\"contentUrl\":\"https:\\\/\\\/www.bleuio.com\\\/blog\\\/wp-content\\\/uploads\\\/2023\\\/04\\\/create-a-realtime-co2-desktop-widget.jpg\",\"width\":800,\"height\":450,\"caption\":\"create a realtime co2 desktop widget\"},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\\\/\\\/www.bleuio.com\\\/blog\\\/create-a-real-time-desktop-co2-widget-using-javascript-and-bluetooth\\\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\\\/\\\/www.bleuio.com\\\/blog\\\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Create a real-time desktop CO2 widget using Javascript and Bluetooth\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\\\/\\\/www.bleuio.com\\\/blog\\\/#website\",\"url\":\"https:\\\/\\\/www.bleuio.com\\\/blog\\\/\",\"name\":\"BleuIO - Create Bluetooth Low Energy application\",\"description\":\"Learn Bluetooth Low Energy programming and build Bluetooth Low Energy Application\",\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\\\/\\\/www.bleuio.com\\\/blog\\\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"en-US\"},{\"@type\":\"Person\",\"@id\":\"https:\\\/\\\/www.bleuio.com\\\/blog\\\/#\\\/schema\\\/person\\\/89bc581382d5964043f96efc54b75b80\",\"name\":\"BleuIO\",\"sameAs\":[\"https:\\\/\\\/www.bleuio.com\\\/blog\"],\"url\":\"https:\\\/\\\/www.bleuio.com\\\/blog\\\/author\\\/biadmin\\\/\"}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"Create a real-time desktop CO2 widget using Javascript and Bluetooth - BleuIO - Create Bluetooth Low Energy application","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.bleuio.com\/blog\/create-a-real-time-desktop-co2-widget-using-javascript-and-bluetooth\/","og_locale":"en_US","og_type":"article","og_title":"Create a real-time desktop CO2 widget using Javascript and Bluetooth - BleuIO - Create Bluetooth Low Energy application","og_description":"Creating a small real-time desktop CO2 widget using JavaScript and Bluetooth is a fun and engaging project that can help you understand how to work with Bluetooth communication and sensor data processing. In this project we will use BleuIO to communicate with air quality monitoring sensor to read CO2 data. BleuIO is a bluetooth low [&hellip;]","og_url":"https:\/\/www.bleuio.com\/blog\/create-a-real-time-desktop-co2-widget-using-javascript-and-bluetooth\/","og_site_name":"BleuIO - Create Bluetooth Low Energy application","article_published_time":"2023-04-21T11:33:10+00:00","article_modified_time":"2023-04-27T07:17:05+00:00","og_image":[{"width":800,"height":450,"url":"https:\/\/www.bleuio.com\/blog\/wp-content\/uploads\/2023\/04\/create-a-realtime-co2-desktop-widget.jpg","type":"image\/jpeg"}],"author":"BleuIO","twitter_card":"summary_large_image","schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/www.bleuio.com\/blog\/create-a-real-time-desktop-co2-widget-using-javascript-and-bluetooth\/#article","isPartOf":{"@id":"https:\/\/www.bleuio.com\/blog\/create-a-real-time-desktop-co2-widget-using-javascript-and-bluetooth\/"},"author":{"name":"BleuIO","@id":"https:\/\/www.bleuio.com\/blog\/#\/schema\/person\/89bc581382d5964043f96efc54b75b80"},"headline":"Create a real-time desktop CO2 widget using Javascript and Bluetooth","datePublished":"2023-04-21T11:33:10+00:00","dateModified":"2023-04-27T07:17:05+00:00","mainEntityOfPage":{"@id":"https:\/\/www.bleuio.com\/blog\/create-a-real-time-desktop-co2-widget-using-javascript-and-bluetooth\/"},"wordCount":737,"commentCount":0,"image":{"@id":"https:\/\/www.bleuio.com\/blog\/create-a-real-time-desktop-co2-widget-using-javascript-and-bluetooth\/#primaryimage"},"thumbnailUrl":"https:\/\/www.bleuio.com\/blog\/wp-content\/uploads\/2023\/04\/create-a-realtime-co2-desktop-widget.jpg","articleSection":["BleuIO tutorial"],"inLanguage":"en-US","potentialAction":[{"@type":"CommentAction","name":"Comment","target":["https:\/\/www.bleuio.com\/blog\/create-a-real-time-desktop-co2-widget-using-javascript-and-bluetooth\/#respond"]}]},{"@type":"WebPage","@id":"https:\/\/www.bleuio.com\/blog\/create-a-real-time-desktop-co2-widget-using-javascript-and-bluetooth\/","url":"https:\/\/www.bleuio.com\/blog\/create-a-real-time-desktop-co2-widget-using-javascript-and-bluetooth\/","name":"Create a real-time desktop CO2 widget using Javascript and Bluetooth - BleuIO - Create Bluetooth Low Energy application","isPartOf":{"@id":"https:\/\/www.bleuio.com\/blog\/#website"},"primaryImageOfPage":{"@id":"https:\/\/www.bleuio.com\/blog\/create-a-real-time-desktop-co2-widget-using-javascript-and-bluetooth\/#primaryimage"},"image":{"@id":"https:\/\/www.bleuio.com\/blog\/create-a-real-time-desktop-co2-widget-using-javascript-and-bluetooth\/#primaryimage"},"thumbnailUrl":"https:\/\/www.bleuio.com\/blog\/wp-content\/uploads\/2023\/04\/create-a-realtime-co2-desktop-widget.jpg","datePublished":"2023-04-21T11:33:10+00:00","dateModified":"2023-04-27T07:17:05+00:00","author":{"@id":"https:\/\/www.bleuio.com\/blog\/#\/schema\/person\/89bc581382d5964043f96efc54b75b80"},"breadcrumb":{"@id":"https:\/\/www.bleuio.com\/blog\/create-a-real-time-desktop-co2-widget-using-javascript-and-bluetooth\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/www.bleuio.com\/blog\/create-a-real-time-desktop-co2-widget-using-javascript-and-bluetooth\/"]}]},{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/www.bleuio.com\/blog\/create-a-real-time-desktop-co2-widget-using-javascript-and-bluetooth\/#primaryimage","url":"https:\/\/www.bleuio.com\/blog\/wp-content\/uploads\/2023\/04\/create-a-realtime-co2-desktop-widget.jpg","contentUrl":"https:\/\/www.bleuio.com\/blog\/wp-content\/uploads\/2023\/04\/create-a-realtime-co2-desktop-widget.jpg","width":800,"height":450,"caption":"create a realtime co2 desktop widget"},{"@type":"BreadcrumbList","@id":"https:\/\/www.bleuio.com\/blog\/create-a-real-time-desktop-co2-widget-using-javascript-and-bluetooth\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/www.bleuio.com\/blog\/"},{"@type":"ListItem","position":2,"name":"Create a real-time desktop CO2 widget using Javascript and Bluetooth"}]},{"@type":"WebSite","@id":"https:\/\/www.bleuio.com\/blog\/#website","url":"https:\/\/www.bleuio.com\/blog\/","name":"BleuIO - Create Bluetooth Low Energy application","description":"Learn Bluetooth Low Energy programming and build Bluetooth Low Energy Application","potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/www.bleuio.com\/blog\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-US"},{"@type":"Person","@id":"https:\/\/www.bleuio.com\/blog\/#\/schema\/person\/89bc581382d5964043f96efc54b75b80","name":"BleuIO","sameAs":["https:\/\/www.bleuio.com\/blog"],"url":"https:\/\/www.bleuio.com\/blog\/author\/biadmin\/"}]}},"_links":{"self":[{"href":"https:\/\/www.bleuio.com\/blog\/wp-json\/wp\/v2\/posts\/478","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.bleuio.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.bleuio.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.bleuio.com\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.bleuio.com\/blog\/wp-json\/wp\/v2\/comments?post=478"}],"version-history":[{"count":6,"href":"https:\/\/www.bleuio.com\/blog\/wp-json\/wp\/v2\/posts\/478\/revisions"}],"predecessor-version":[{"id":489,"href":"https:\/\/www.bleuio.com\/blog\/wp-json\/wp\/v2\/posts\/478\/revisions\/489"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/www.bleuio.com\/blog\/wp-json\/wp\/v2\/media\/483"}],"wp:attachment":[{"href":"https:\/\/www.bleuio.com\/blog\/wp-json\/wp\/v2\/media?parent=478"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.bleuio.com\/blog\/wp-json\/wp\/v2\/categories?post=478"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.bleuio.com\/blog\/wp-json\/wp\/v2\/tags?post=478"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}