<?xml version="1.0" encoding="utf-8" standalone="yes"?><rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom"><channel><title>Hidden Markov Model on Selective Appeal Blog</title><link>https://selectiveappeal.org/tags/hidden-markov-model/</link><description>Recent content in Hidden Markov Model on Selective Appeal Blog</description><generator>Hugo</generator><language>en-us</language><copyright>Copyright © 2025 Chris Lee.</copyright><lastBuildDate>Fri, 10 Apr 2026 20:02:19 -0400</lastBuildDate><atom:link href="https://selectiveappeal.org/tags/hidden-markov-model/index.xml" rel="self" type="application/rss+xml"/><item><title>Garage state estimation in an uncertain world: sonar, ESP32, and HMMs</title><link>https://selectiveappeal.org/posts/garage133-hmm/</link><pubDate>Sat, 21 Mar 2026 00:00:00 -0400</pubDate><guid>https://selectiveappeal.org/posts/garage133-hmm/</guid><description>&lt;h2 id="introduction" class="heading "&gt;Introduction&lt;a href="#introduction" aria-labelledby="introduction"&gt;






 
 
 
 &lt;svg class="svg-inline--fa fas fa-link anchor" fill="currentColor" aria-hidden="true" role="img" viewBox="0 0 576 512" overflow="visible"&gt;&lt;use href="#fas-link"&gt;&lt;/use&gt;&lt;/svg&gt;&amp;nbsp;
 &lt;/a&gt;
&lt;/h2&gt;
&lt;p&gt;I built a device I call Garage133 (see my 
 &lt;a href="https://selectiveappeal.org/posts/garage133/"&gt;earlier post&lt;/a&gt;
)
to control our garage doors and monitor the state of the garage.
For each side, a sonar sensor determines whether the garage door is open or closed, and whether
a car is present.
This allows our home automation system to alert us if a door is left open and provides the
capability to close it remotely.&lt;/p&gt;
&lt;p&gt;The image below shows the estimated garage state as rendered in our live
Home Assistant&lt;sup id="fnref:1"&gt;&lt;a href="#fn:1" class="footnote-ref" role="doc-noteref"&gt;1&lt;/a&gt;&lt;/sup&gt; dashboard using the FloorPlan&lt;sup id="fnref:2"&gt;&lt;a href="#fn:2" class="footnote-ref" role="doc-noteref"&gt;2&lt;/a&gt;&lt;/sup&gt; card.
The rendering includes door status, car presence,&lt;sup id="fnref:3"&gt;&lt;a href="#fn:3" class="footnote-ref" role="doc-noteref"&gt;3&lt;/a&gt;&lt;/sup&gt; temperature, humidity,
motion, charging, etc&amp;hellip;&lt;/p&gt;










&lt;figure class="col-md-9 mx-auto"&gt;&lt;img class="img-fluid "
 src="https://selectiveappeal.org/posts/garage133-hmm/garage-state-image-2800x1615.png"
 srcset="https://selectiveappeal.org/posts/garage133-hmm/garage-state-image-576x332.webp 576w, https://selectiveappeal.org/posts/garage133-hmm/garage-state-image-768x443.webp 768w, https://selectiveappeal.org/posts/garage133-hmm/garage-state-image-992x572.webp 992w, https://selectiveappeal.org/posts/garage133-hmm/garage-state-image-1200x692.webp 1200w, https://selectiveappeal.org/posts/garage133-hmm/garage-state-image-1400x808.webp 1400w, https://selectiveappeal.org/posts/garage133-hmm/garage-state-image-2800x1615.webp 2800w" sizes="100vw" height="1615" width="2800" alt="Home Assitant/Floorplan render of garage state"&gt;&lt;figcaption class="figure-caption"&gt;Home Assitant/Floorplan render of garage state&lt;/figcaption&gt;
 &lt;/figure&gt;
&lt;p&gt;Garage133 basically works well.
All we &lt;em&gt;really&lt;/em&gt; need is an easy way to open and close the garage doors without overpaying for
a closed, cloud-based system like MyQ&lt;sup id="fnref:4"&gt;&lt;a href="#fn:4" class="footnote-ref" role="doc-noteref"&gt;4&lt;/a&gt;&lt;/sup&gt;, and we have that.
But the state detection logic proved surprisingly difficult to get right.
This post explores why this is—the nature of sonar—and how we solved it using Hidden Markov
Models.&lt;/p&gt;</description></item></channel></rss>