Skip to content

Commit fcdd767

Browse files
committed
Built site for gh-pages
1 parent 11d9dce commit fcdd767

37 files changed

Lines changed: 20 additions & 16630 deletions

.nojekyll

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
70df102a
1+
15ece35d

feed.xml

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
<?xml version="1.0" encoding="UTF-8" ?>
2+
<rss version="2.0">
3+
4+
<redirect>
5+
<newLocation>
6+
https://aefarrell.github.io/index.xml
7+
</newLocation>
8+
</redirect>
9+
10+
</rss>

images/banner.jpg

-710 KB
Binary file not shown.
-520 KB
Binary file not shown.
-1.01 MB
Binary file not shown.

index.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -195,7 +195,7 @@ <h5 class="quarto-listing-category-title">Categories</h5><div class="quarto-list
195195

196196
<div class="quarto-listing quarto-listing-container-default" id="listing-listing">
197197
<div class="list quarto-listing-default">
198-
<div class="quarto-post image-right" data-index="0" data-categories="cHl0aG9uJTJDYWlyJTIwcXVhbGl0eSUyQ2F0bW90dWJl" data-listing-date-sort="1747634400000" data-listing-file-modified-sort="1748624456088" data-listing-date-modified-sort="NaN" data-listing-reading-time-sort="15" data-listing-word-count-sort="2863">
198+
<div class="quarto-post image-right" data-index="0" data-categories="cHl0aG9uJTJDYWlyJTIwcXVhbGl0eSUyQ2F0bW90dWJl" data-listing-date-sort="1747634400000" data-listing-file-modified-sort="1748626081693" data-listing-date-modified-sort="NaN" data-listing-reading-time-sort="15" data-listing-word-count-sort="2863">
199199
<div class="thumbnail"><a href="./posts/atmotube_data_logging/index.html" class="no-external">
200200

201201
<p class="card-img-top"><img src="posts/atmotube_data_logging/index_files/figure-html/fig-1-output-1.png" class="thumbnail-image card-img"/></p>

index.xml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2310,7 +2310,7 @@ font-style: inherit;">/</span><span class="dv" style="color: #AD0000;
23102310
background-color: null;
23112311
font-style: inherit;">1000</span></span></code></pre></div>
23122312
</div>
2313-
<p>With that out of the way, there are two other components I need for this to work: a collector which will collect all of the data sent back from the atmotube and a worker which will log it to a csv. Unlike above, where I logged each advertising packet as I came in, I am going to make these run asynchronously using <code>asyncio</code>. I think this is what really <em>should</em> be done, instead of blocking for file i/o every time a callback function is triggered.</p>
2313+
<p>With that out of the way, there are two other components I need for this to work: a collector which will collect all of the data sent back from the atmotube and a worker which will log it to a csv. Unlike above, where I logged each advertising packet as it came in, I am going to make these run asynchronously using <code>asyncio</code>. I think this is what really <em>should</em> be done, instead of blocking for file i/o every time a callback function is triggered.</p>
23142314
<p>To make this happen I largely copied <a href="https://github.com/hbldh/bleak/blob/develop/examples/async_callback_with_queue.py">what was done in this example</a> which uses an async queue to pass data between the two workers. The basic idea is:</p>
23152315
<ol type="1">
23162316
<li>The collector starts up and scans for the atmotube, by MAC address.</li>
@@ -2426,7 +2426,7 @@ font-style: inherit;">None</span>)</span></code></pre></div>
24262426
<ol type="1">
24272427
<li>When the logger starts it creates a new csv file with the given <code>filename</code>, and writes the column headers.</li>
24282428
<li>The worker waits for data to appear on the queue and, once it does, takes it out (first in first out).</li>
2429-
<li>The result on the queue is lined up to the right columns in the csv, I check for the attribute <code>battery_level</code> as a lazy check of which type of result it is.</li>
2429+
<li>The result from the queue is lined up to the right columns in the csv, I check for the attribute <code>battery_level</code> as a lazy check of which type of result it is.</li>
24302430
<li>Finally the worker writes the result as new row on the csv.</li>
24312431
<li>If the result is <code>None</code>, that is a signal that the collector has finished and the loop exits.</li>
24322432
<li>Regardless, once the logger has processed the data from the queue, it calls <code>task_done()</code> to notify the queue of this and the loop begins again.</li>
@@ -2781,7 +2781,7 @@ Figure&nbsp;6: Time series data of indoor PM2.5 concentrations, a 1-hr sample us
27812781
</div>
27822782
</div>
27832783
<p>With no context it looks like something is horribly wrong, what are all those gaps in the data? My atmotube is set to only sample every 15 minutes, this is usually how I leave it to save on battery. This also explains some of the weirdness with the data, why does each sample start with a rapidly increasing concentration before levelling out? The atmotube is returning data right when the sampling fan has just turned on; this is not yet an accurate sample of the ambient air, it is the stagnant air inside the atmotube. This is a much more obvious problem with VOC data, it is clearly visible on the app as a funky saw-tooth wave where the VOC concentration plunges whenever the fan starts and, once it stops, slowly creeps up. It is an artifact of how the atmotube is sampling the air, not of how the data is being collected.</p>
2784-
<p>If the atmotube is set to always on mode, these artifacts go away, but if you want to monitor it in other configurations it is worth considering how the data should be cleaned up. For example watching for the <code>pm_sensor</code> flag to turn on then throwing out the first ~30s of pm data before looking at the rest. The GATT notifications make it very clear when the atmotube is sampling and when it isn’t. There will be a notification that <code>pm_sensor</code> has turned from 0 to 1, then data will start arriving with pm data, then a notification that the <code>pm_sensor</code> has turned from 1 to 0, followed by an empty row of pm data. See a snipped of the csv below. Note that <code>pm_sensor</code> values and actual pm values are always on seperate rows.</p>
2784+
<p>If the atmotube is set to always on mode, these artifacts go away, but if you want to monitor it in other configurations it is worth considering how the data should be cleaned up. For example watching for the <code>pm_sensor</code> flag to turn on then throwing out the first ~30s of pm data before looking at the rest. The GATT notifications make it very clear when the atmotube is sampling and when it isn’t. There will be a notification that <code>pm_sensor</code> has turned from 0 to 1, then data will start arriving with pm data, then a notification that the <code>pm_sensor</code> has turned from 1 to 0, followed by an empty row of pm data. See a snippet of the csv below. Note that <code>pm_sensor</code> values and actual pm values are always on seperate rows.</p>
27852785
<div id="ad37668e-7ef1-432e-9d48-78c614baf658" class="cell" data-execution_count="28">
27862786
<div class="sourceCode cell-code" id="cb53" style="background: #f1f3f5;"><pre class="sourceCode python code-with-copy"><code class="sourceCode python"><span id="cb53-1">df[<span class="dv" style="color: #AD0000;
27872787
background-color: null;

0 commit comments

Comments
 (0)