<?xml version="1.0" encoding="utf-8"?><feed xmlns="http://www.w3.org/2005/Atom" ><generator uri="https://jekyllrb.com/" version="3.10.0">Jekyll</generator><link href="https://gidge.dev/feed.xml" rel="self" type="application/atom+xml" /><link href="https://gidge.dev/" rel="alternate" type="text/html" /><updated>2026-04-11T12:42:29-04:00</updated><id>https://gidge.dev/feed.xml</id><title type="html">gidge.dev</title><subtitle>Personal website of Stephen Gidge, P.Eng. |  Let’s make great things together.</subtitle><author><name>Stephen Gidge, P.Eng.</name></author><entry><title type="html">LED Matrix Sports Scoreboard — Updates April 2026 (MLB &amp;amp; WNBA)</title><link href="https://gidge.dev/sports%20scoreboard/sports-scoreboard-apr-2026/" rel="alternate" type="text/html" title="LED Matrix Sports Scoreboard — Updates April 2026 (MLB &amp;amp; WNBA)" /><published>2026-04-11T09:00:00-04:00</published><updated>2026-04-11T09:00:00-04:00</updated><id>https://gidge.dev/sports%20scoreboard/sports-scoreboard-apr-2026</id><content type="html" xml:base="https://gidge.dev/sports%20scoreboard/sports-scoreboard-apr-2026/"><![CDATA[<p>One more major Raspberry Pi LED matrix scoreboard update for the year, the MLB and WNBA (season’s not canceled, woot) have been implemented! All expected scenes (live scores, favourite team’s next game, and standings) are fully supported. Additionally, a new layout has been created for the MLB (or baseball in general, I guess), displaying the current inning, outs, and runners on base.</p>

<p>Here’s a video of all the leagues implemented thus far, and some additional screenshots of the new functionality.</p>

<iframe width="560" height="315" src="https://www.youtube.com/embed/nLjgcG6VP90?si=5Tg6eAnO3COGG7an" title="YouTube video player" frameborder="0" allow="accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture" allowfullscreen=""></iframe>
<p><br /></p>

<figure style="text-align: center;">
  <a href="https://gidge.dev/assets/posts/sports-scoreboard/2026-04/ex_mlb_game_in_progress.jpg">
    <img src="https://gidge.dev/assets/posts/sports-scoreboard/2026-04/ex_mlb_game_in_progress.jpg" style="width: 85%;" />
  </a>
</figure>

<figure style="text-align: center;">
  <a href="https://gidge.dev/assets/posts/sports-scoreboard/2026-04/ex_mlb_standings_league.jpg">
    <img src="https://gidge.dev/assets/posts/sports-scoreboard/2026-04/ex_mlb_standings_league.jpg" style="width: 85%;" />
  </a>
</figure>

<p>You can view all the code for this project, along with installation instructions, at my GitHub Repository <a href="https://github.com/gidger/rpi-led-sports-scoreboard">here</a>.</p>

<p>If you have any questions feel free to shoot me an email at <a href="mailto: stephen@gidge.dev">stephen@gidge.dev</a>.</p>

<p>Cheers,</p>

<p><em>Stephen</em></p>]]></content><author><name>Stephen Gidge, P.Eng.</name></author><category term="Sports Scoreboard" /><category term="LED" /><category term="Raspberry Pi" /><category term="Sports" /><category term="NHL" /><category term="PWHL" /><category term="NBA" /><category term="WNBA" /><category term="MLB" /><summary type="html"><![CDATA[April 2026 updates to the Raspberry Pi LED Sports Scoreboard.]]></summary></entry><entry><title type="html">LED Matrix Sports Scoreboard — Updates February 2026 (PWHL)</title><link href="https://gidge.dev/sports%20scoreboard/sports-scoreboard-feb-2026/" rel="alternate" type="text/html" title="LED Matrix Sports Scoreboard — Updates February 2026 (PWHL)" /><published>2026-02-01T08:00:00-05:00</published><updated>2026-02-01T08:00:00-05:00</updated><id>https://gidge.dev/sports%20scoreboard/sports-scoreboard-feb-2026</id><content type="html" xml:base="https://gidge.dev/sports%20scoreboard/sports-scoreboard-feb-2026/"><![CDATA[<p>Quick update, the Raspberry Pi LED Matrix now supports the PWHL! All features from the NHL &amp; NBA are fully supported. Live scores, next game for your favourite team, and standings.</p>

<p>That’s it, that’s the update.</p>

<p>Here’s a video of it in action, as well as some additional screenshots.</p>

<iframe width="560" height="315" src="https://www.youtube.com/embed/PKHG5-QJ6yY?si=v9bJCw-oVTf6JfY1" title="YouTube video player" frameborder="0" allow="accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture" allowfullscreen=""></iframe>
<p><br /></p>

<figure style="text-align: center;">
  <a href="https://gidge.dev/assets/posts/sports-scoreboard/2026-02/ex_pwhl_game_splash.jpg">
    <img src="https://gidge.dev/assets/posts/sports-scoreboard/2026-02/ex_pwhl_game_splash.jpg" style="width: 85%;" />
  </a>
</figure>

<figure style="text-align: center;">
  <a href="https://gidge.dev/assets/posts/sports-scoreboard/2026-02/ex_pwhl_game_not_started.jpg">
    <img src="https://gidge.dev/assets/posts/sports-scoreboard/2026-02/ex_pwhl_game_not_started.jpg" style="width: 85%;" />
  </a>
</figure>

<p>Next up is implemented the WNBA and MLB. WNBA implementation is actually 99% complete already, but we’ll need to see if the 2026 season even happens before I release it…</p>

<p>You can view all the code for this project, along with installation instructions, at my GitHub Repository <a href="https://github.com/gidger/rpi-led-sports-scoreboard">here</a>.</p>

<p>If you have any questions feel free to shoot me an email at <a href="mailto: stephen@gidge.dev">stephen@gidge.dev</a>.</p>

<p>Cheers,</p>

<p><em>Stephen</em></p>]]></content><author><name>Stephen Gidge, P.Eng.</name></author><category term="Sports Scoreboard" /><category term="LED" /><category term="Raspberry Pi" /><category term="Sports" /><category term="NHL" /><category term="NBA" /><category term="PWHL" /><summary type="html"><![CDATA[February 2026 updates to the Raspberry Pi LED Sports Scoreboard.]]></summary></entry><entry><title type="html">LED Matrix Sports Scoreboard — Updates January 2026 (NBA)</title><link href="https://gidge.dev/sports%20scoreboard/sports-scoreboard-jan-2026/" rel="alternate" type="text/html" title="LED Matrix Sports Scoreboard — Updates January 2026 (NBA)" /><published>2026-01-05T08:00:00-05:00</published><updated>2026-01-05T08:00:00-05:00</updated><id>https://gidge.dev/sports%20scoreboard/sports-scoreboard-jan-2026</id><content type="html" xml:base="https://gidge.dev/sports%20scoreboard/sports-scoreboard-jan-2026/"><![CDATA[<p>Woah, a second post in as many months?! Wild, I know…</p>

<p>In the last post, I mentioned that the refactoring efforts laid the foundation to expand functionality to additional sports. Well, that’s exactly what happened. The NBA is now supported!</p>

<p>All existing NHL functionality has been created for the NBA. Live scores, next game for your favourite team, and standings! Here’s a video of it in action, as well as some additional screenshots.</p>

<iframe width="560" height="315" src="https://www.youtube.com/embed/BjqVBXsv_c8?si=tfnI6bRxXL9TylyE" title="YouTube video player" frameborder="0" allow="accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture" allowfullscreen=""></iframe>
<p><br /></p>

<figure style="text-align: center;">
  <a href="https://gidge.dev/assets/posts/sports-scoreboard/2026-01/ex_nba_fav_team_next_game.jpg">
    <img src="https://gidge.dev/assets/posts/sports-scoreboard/2026-01/ex_nba_fav_team_next_game.jpg" style="width: 85%;" />
  </a>
</figure>

<figure style="text-align: center;">
  <a href="https://gidge.dev/assets/posts/sports-scoreboard/2026-01/ex_nba_game_in_progress.jpg">
    <img src="https://gidge.dev/assets/posts/sports-scoreboard/2026-01/ex_nba_game_in_progress.jpg" style="width: 85%;" />
  </a>
</figure>

<figure style="text-align: center;">
  <a href="https://gidge.dev/assets/posts/sports-scoreboard/2026-01/ex_nba_standings_conference.jpg">
    <img src="https://gidge.dev/assets/posts/sports-scoreboard/2026-01/ex_nba_standings_conference.jpg" style="width: 85%;" />
  </a>
</figure>

<p>Next up:</p>
<ul>
  <li>Find an API for the PWHL and implement over the winter.</li>
  <li>Implement the WNBA (shares APIs with the NBA so should be easy) over the winter. The WNBA season doesn’t start until the spring, so won’t release until then as I want to test with live data.</li>
  <li>Implement MLB in the spring, once spring training has begun. This will require new some new visuals.</li>
</ul>

<p>You can view all the code for this project, along with installation instructions, at my GitHub Repository <a href="https://github.com/gidger/rpi-led-sports-scoreboard">here</a>.</p>

<p>If you have any questions feel free to shoot me an email at <a href="mailto: stephen@gidge.dev">stephen@gidge.dev</a>.</p>

<p>Cheers,</p>

<p><em>Stephen</em></p>]]></content><author><name>Stephen Gidge, P.Eng.</name></author><category term="Sports Scoreboard" /><category term="LED" /><category term="Raspberry Pi" /><category term="Sports" /><category term="NHL" /><category term="NBA" /><summary type="html"><![CDATA[January 2026 updates to the Raspberry Pi LED Sports Scoreboard.]]></summary></entry><entry><title type="html">LED Matrix NHL Scoreboard — Updates November 2025 (Docker &amp;amp; Refactor)</title><link href="https://gidge.dev/sports%20scoreboard/sports-scoreboard-nov-2025/" rel="alternate" type="text/html" title="LED Matrix NHL Scoreboard — Updates November 2025 (Docker &amp;amp; Refactor)" /><published>2025-11-28T08:00:00-05:00</published><updated>2025-11-28T08:00:00-05:00</updated><id>https://gidge.dev/sports%20scoreboard/sports-scoreboard-nov-2025</id><content type="html" xml:base="https://gidge.dev/sports%20scoreboard/sports-scoreboard-nov-2025/"><![CDATA[<p>Hey there, long time no post… Anyhow, I’m alive and here’s some updates on the NHL LED Scoreboard project.</p>

<p>Over the last month, I’ve refactored the entire solution, added new functionality, and laid the foundation to expand it to additional sports.</p>

<p>Here’s some of the new features:</p>
<ul>
  <li>Installation has moved to Docker, greatly simplifying the install and setup process.</li>
  <li>You’ll now have the ability to set a favourite team and see that team’s next game.</li>
  <li>You can view standings for any combination of wildcard, division, conference, or overall.</li>
</ul>

<iframe width="560" height="315" src="https://www.youtube.com/embed/dtqFqR9JHCA?si=C9POcf6CL1PxFehB" title="YouTube video player" frameborder="0" allow="accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture" allowfullscreen=""></iframe>
<p><br /></p>

<figure style="text-align: center;">
  <a href="https://gidge.dev/assets/posts/sports-scoreboard/2025-11/ex_nhl_fav_team_next_game.jpg">
    <img src="https://gidge.dev/assets/posts/sports-scoreboard/2025-11/ex_nhl_fav_team_next_game.jpg" style="width: 85%;" />
  </a>
</figure>

<figure style="text-align: center;">
  <a href="https://gidge.dev/assets/posts/sports-scoreboard/2025-11/ex_nhl_standings_wildcard.jpg">
    <img src="https://gidge.dev/assets/posts/sports-scoreboard/2025-11/ex_nhl_standings_wildcard.jpg" style="width: 85%;" />
  </a>
</figure>

<p>I’ll write here more often as the project progresses. Some planned upcoming functionality includes:</p>
<ul>
  <li>Expanding to additional sports. Current plan is to integrate the NBA in the winter, and MLB in the spring. American football is dumb, so someone else can tackle that one. Open source, hurrah!</li>
  <li>Add in a “leaders” scene, showing the goal/point/whatever leaders for a league.</li>
  <li>Create a local web app to configure settings via a GUI rather than manually editing config.yaml.</li>
</ul>

<p>You can view all the code for this project, along with installation instructions, at my GitHub Repository <a href="https://github.com/gidger/rpi-led-sports-scoreboard">here</a>.</p>

<p>If you have any questions feel free to shoot me an email at <a href="mailto: stephen@gidge.dev">stephen@gidge.dev</a>.</p>

<p>Cheers,</p>

<p><em>Stephen</em></p>]]></content><author><name>Stephen Gidge, P.Eng.</name></author><category term="Sports Scoreboard" /><category term="LED" /><category term="Raspberry Pi" /><category term="Sports" /><category term="NHL" /><summary type="html"><![CDATA[November 2025 updates to the Raspberry Pi LED NHL Scoreboard.]]></summary></entry><entry><title type="html">Is Toronto Bike Share for Everyone?</title><link href="https://gidge.dev/toronto%20bike%20share/is-toronto-bike-share-for-everyone/" rel="alternate" type="text/html" title="Is Toronto Bike Share for Everyone?" /><published>2022-12-30T03:00:00-05:00</published><updated>2022-12-30T03:00:00-05:00</updated><id>https://gidge.dev/toronto%20bike%20share/is-toronto-bike-share-for-everyone</id><content type="html" xml:base="https://gidge.dev/toronto%20bike%20share/is-toronto-bike-share-for-everyone/"><![CDATA[<p><b>TL;DR</b> analysis of Toronto’s Bike Share &amp; cycling infrastructure using Power BI – see interactive report below.</p>

<figure style="margin: auto;">
  <iframe title="Is Bike Share for Everyone" width="800" height="420" src="https://app.powerbi.com/view?r=eyJrIjoiNzE4ZDAwMTgtMTU2Yy00NzUzLTk4NGYtZGFjZWQ3Y2E1M2IyIiwidCI6IjNmN2FhNDA3LTJjY2EtNDI5YS04MzhlLTY0N2IxOTRlMDJiOCJ9" frameborder="0" allowfullscreen="true">
  </iframe>
  <figcaption style="text-align: left;">
    <i>Be sure to view in full screen (button in bottom right) for the best experience.</i>
  </figcaption>
</figure>
<p><br /></p>

<p>This past fall, I spent some time looking into Toronto’s Bike Share and cycling infrastructure networks. This research culminated into the report you see above.</p>

<p>Some background – I am passionate about cycling, riding nearly every day for most of the year as my primary source of transportation. As such, cycling infrastructure is of huge importance to me, as is getting more people riding during this ongoing global climate emergency.</p>

<p>But that’s not <i>really</i> why I started this project.</p>

<p>In reality, I wanted to learn more about effectively using geospatial data. I had never worked with geospatial data in the past, and this seemed like a great way to get started, as well as dive into a topic that I’m truly interested in. Wrap it all up in a public facing Power BI report and here we are!</p>

<p>For those unaware, Bike Share Toronto allows users 24/7 access to a fleet of rental bicycles designed for short trips within the city. A user can rent a bike from any station (or dock) and return it to any station within the network.</p>

<div style="margin: auto; width: 85%;">
  <figure>
    <a href="https://gidge.dev/assets/posts/toronto-bike-share/rider-station.jpg">
      <img src="https://gidge.dev/assets/posts/toronto-bike-share/rider-station.jpg" />
    </a>
    <figcaption style="text-align: left;">
      <b>Foreground</b>: Rider on Bike Share bike.<br />
      <b>Background</b>: Bike Share docking station.<br />
      <b>Source</b>: <a href="https://signalhfx.ca/toronto-bike-sharing-trips-have-surged-during-covid-19/">The Signal</a>. Photo by <b>Robyn Miyuki Hughes</b>.
    </figcaption>
  </figure>
</div>

<p>My goals for this project (besides learning more about the wild world of geospatial data) were pretty simple:</p>
<ol>
  <li>Visualize and identify areas where the Bike Share network is underdeveloped.</li>
  <li>Visualize and identify gaps within the Toronto cycling network, especially when it comes to safe, protected infrastructure.</li>
  <li>Allow a user to explore neighbourhoods that are underserviced within each network, and analyze them from the lens of income, etc.</li>
</ol>

<p>Ultimately, I wanted a user to be able to visually explore both networks and see for themselves the clear gaps that exist (especially outside of the borough of Old Toronto). I won’t push my agenda or findings any further here – if you haven’t already, explore the report above and come to your own conclusions. I’m sure you’ll discover something that you find interesting.</p>

<div style="text-align: center;">
  <i>*cough*</i> Look at cycle tracks in Scarborough. <i>*cough*</i><br /><br />
</div>

<p>As for the data feeding this report, all of it came from the Toronto Open Data Portal. Data was collected on the following topics (hyperlinks to the data sources):</p>
<ul>
  <li><a href="https://open.toronto.ca/dataset/bike-share-toronto/">Bike Share Station Info</a> &amp; <a href="">Locations</a></li>
  <li><a href="https://open.toronto.ca/dataset/bike-share-toronto-ridership-data/">Bike Share Usage</a></li>
  <li><a href="https://open.toronto.ca/dataset/bikeways/">Cycling Infrastructure Shapes</a></li>
  <li><a href="https://open.toronto.ca/dataset/neighbourhood-profiles/">Census Statistics by Social Planning Neighbourhood</a></li>
  <li><a href="https://open.toronto.ca/dataset/neighbourhoods/">Social Planning Neighbourhood Shapes</a></li>
</ul>

<p>One of the main challenges of this project was figuring out how to slice the data by social planning neighbourhood. These neighbourhoods are the way the Toronto city government divides the city’s area for urban planning purposes. Unfortunately, neither the Bike Share station locations, nor the cycling infrastructure datasets included these neighbourhoods. To remedy this, I used the GeoPandas Python package to perform a spatial join and map stations and infrastructure into their respective neighbourhoods.</p>

<p>Without getting into unnecessary details on the data used or cleansing performed, you can see a high level visual depicting the data transformations below.</p>

<div style="margin: auto; width: 95%;">
  <figure>
    <a href="https://gidge.dev/assets/posts/toronto-bike-share/data-transformation.png">
      <img src="https://gidge.dev/assets/posts/toronto-bike-share/data-transformation.png" />
    </a>
    <figcaption style="text-align: left;">
      <i>Click to enlarge.</i>
    </figcaption>
  </figure>
</div>

<p>It wouldn’t be fair for me to end this post without mentioning Bike Share Toronto’s <a href="https://parking.greenp.com/app/uploads/2022/09/BikeShareToronto_FYGP_wAppendix.pdf">Four-Year Growth Plan</a> that was unveiled as I was finishing up this project. Many of the key takeaways I wanted a user to come away with are being addressed by this plan. People with more time, resources, and knowledge than myself created it and I highly recommend checking it out if you have any interest in cycling within Toronto.</p>

<p>Additionally, you’ll notice in my Power BI report, the city is split into 140 social planning neighbourhoods. As of Spring 2022 there are now 158 neighbourhoods as the City divided some up into smaller areas as their populations grew. As of when I was building my report, the City hasn’t released compiled census data for the new set of neighbourhoods. As a result, you’ll see 140 neighbourhoods and demographic data from the 2016 census.</p>

<p>If you’re interested in making cycling a safe and accessible option for the thousands of Torontonians in which it is not, check out the final page of my report above. Also, let your <a href="https://www.toronto.ca/city-government/council/members-of-council/">City Councillor</a> know that safe cycling infrastructure is important to you, and consider donating time or money to advocacy groups such as <a href="https://www.cycleto.ca/">Cycle Toronto</a> who do great work in this space.</p>

<p>If you have any questions about this project, feel free to shoot me an email at <a href="mailto: stephen@gidge.dev">stephen@gidge.dev</a>. Also, if you’re interested in a deeper dive of the data, how this report works, or the message I want to convey, please reach out – I’m happy to chat more. I hope this makes you really think about factors that affect cycling accessibility in cities. Thanks for reading!</p>

<p>Cheers,</p>

<p><em>Stephen</em></p>]]></content><author><name>Stephen Gidge, P.Eng.</name></author><category term="Toronto Bike Share" /><category term="Data Visualization" /><category term="Sports" /><category term="Power BI" /><summary type="html"><![CDATA[A visual analysis of Toronto's Bike Share & cycling infrastructure]]></summary></entry><entry><title type="html">LED Stair Lights Part 2: Real-Time Bass Visualization</title><link href="https://gidge.dev/stair%20lights/stair-lighting-pt2/" rel="alternate" type="text/html" title="LED Stair Lights Part 2: Real-Time Bass Visualization" /><published>2021-10-24T04:00:00-04:00</published><updated>2021-10-24T04:00:00-04:00</updated><id>https://gidge.dev/stair%20lights/stair-lighting-pt2</id><content type="html" xml:base="https://gidge.dev/stair%20lights/stair-lighting-pt2/"><![CDATA[<p><em>Be sure to check out <a href="https://gidge.dev/stair%20lights/stair-lighting/">Part 1</a> focusing on basic functionality and normal operation first. It’s pretty cool, I promise!</em></p>

<p><em>And before we begin, here’s a demonstration reel of the finished product:</em></p>
<iframe width="560" height="315" src="https://www.youtube.com/embed/AO4oNaiYNIw" title="YouTube video player" frameborder="0" allow="accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture" allowfullscreen=""></iframe>
<p><br /></p>

<p>After finishing up the installation of the cascading stair lights, I was pretty pleased with the results. But whenever I simply stopped and watched them in action, I couldn’t help but think there was so much untapped potential to do more interesting things with the same lights. For a few months, I thought on-and-off about what else could be done…</p>

<p>Then I saw <em>it</em>. And I knew what I wanted to make.</p>

<p>In a the front window of a shop, I had seen an LED spectrum analyzer reacting to music, similar to the following:</p>
<iframe width="560" height="315" src="https://www.youtube.com/embed/f814I4J8dEI?start=50" title="YouTube video player" frameborder="0" allow="accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture" allowfullscreen=""></iframe>
<p><br /></p>

<p>Immediately, I knew that I wanted to utilize the stair lights to do something similar – react to music in real-time with lights cascading up in a similar fashion as the video.</p>

<p>There’s an obvious difference between the stair lights and a full spectrum analyzer that you may notice. The stairs have only one “column” of lights, whereas a full spectrum analyzer has many columns in its LED matrix – each pertaining to a set of frequencies that compose the overall sound. The more of that frequency range that is present, the more lights that are illuminated.</p>

<p>Having only one column of lights to work with left me with a decision. I could either:</p>
<ol>
  <li>Simply have it react to the music volume, ignoring individual frequencies and only looking at the overall; or</li>
  <li>Focus on a single range of frequencies and only react to those.</li>
</ol>

<p>I chose to build the latter for a couple reasons. First, it gave me a good opportunity to learn to harness Fourier transforms on an Arduino to extract specific frequency ranges. And second, I had actually already completed a project that reacts to music volume in real time years ago!</p>

<p><em>*Sitcom flashback transition*</em></p>

<p>Back in January 2016, I had built a light-up dance floor for an engineering design competition. The whole project was done on a tight timeline, so the code was as kept simple as possible to allow for more time to build and wire the actual dance floor. As a result, the Arduino simply accepted an analogue audio input (line in) and lit up a selection of lights based on the overall volume. Was a fine MVP for what it needed to be.</p>

<p>Sadly, I only have a couple videos of it in action. This floor actually got recycled and used as a light wall for a special event at my university pub a couple months later. I don’t think it survived much longer than that. Here’s all the footage I have in one video:</p>

<iframe width="560" height="315" src="https://www.youtube.com/embed/mynbzUVXnwU" title="YouTube video player" frameborder="0" allow="accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture" allowfullscreen=""></iframe>
<p><br /></p>

<p>So with that out of the way, ultimately what I decided to create was a real-time bass visualizer making use of a <a href="https://www.adafruit.com/product/1713">MAX9814 microphone module</a> for audio detection and the <a href="https://www.arduino.cc/reference/en/libraries/arduinofft/">arduinoFFT library</a> to extract the amount of bass present.</p>

<p>To support the multiple operating modes for the stairs (standard cascade and music), I’ve added a toggle button. When switching modes, all lights will flash a certain number of times to alert you to which mode you’re in. One flash for standard mode, two for music.</p>

<figure class="half">
  <a href="https://gidge.dev/assets/posts/stair-lighting/music/mode-switch-close.gif"><img src="https://gidge.dev/assets/posts/stair-lighting/music/mode-switch-close.gif" style="width: 85%;" />
  </a>
  <a href="https://gidge.dev/assets/posts/stair-lighting/music/mode-switch-far.gif"><img src="https://gidge.dev/assets/posts/stair-lighting/music/mode-switch-far.gif" style="width: 85%;" />
  </a>
</figure>

<p>The MAX9814 microphone module was chosen over the similar <a href="https://www.adafruit.com/product/1063">MAX4466 microphone module</a> due to its automatic gain control. This should better account for variability in the volume of music.</p>

<figure style="text-align: center;">
  <a href="https://gidge.dev/assets/posts/stair-lighting/music/button-mic.jpg"><img src="https://gidge.dev/assets/posts/stair-lighting/music/button-mic.jpg" style="width: 85%;" />
  </a>
  <figcaption style="text-align: left;">I still need to come up with a perminant mounting solution for the button and mic. I don't want to leave them hanging like this forever.</figcaption>
</figure>

<p>In the updated code, you’ll see a variety of new functions relating to the new music mode. I won’t get into the nitty-gritty in this blog post, but at a high level here’s the overall logic of the music_mode() function:</p>
<ul>
  <li>Audio is sampled for a period of time.</li>
  <li>This audio undergoes a Fourier transform to separate it into frequency bins (i.e. ranges) with associated amounts (e.g. how much of that frequency range was present in the sampled audio).</li>
  <li>The bass frequencies (less than ~320 Hz) are analyzed and translated into a number of lights to illuminate.</li>
  <li>If that number is higher than the number of lights currently illuminated, the lights will quickly cascade up until the correct number of lights are illuminated.</li>
  <li>The lights will cascade downwards (turn off) at a regular interval unless further bass is detected.</li>
</ul>

<p>The code can be viewed in the project’s <a href="https://github.com/gidger/under-stair-lighting">GitHub repository</a>. Music mode is currently set up for 12 stairs, but can easily be modified for any number of stairs. Be sure to adjust the scaling factors (bin_multipliers and amplitude_divisor) as well. If you have any questions or issues, feel free to reach out to me at <a href="mailto: stephen@gidge.dev">stephen@gidge.dev</a> for assistance.</p>

<p>My next steps for this project are to make a mount for the microphone module and further tune the parameters/scaling factors that convert bass into the number of stairs to illuminate. I need to dedicate some time to trying different combinations to determine what looks best. This project was never the most practical – the more people talking and walking around, the worse it performs (though that could be solved by using an analog line-in rather than a microphone). While not super practical, I do think the outcome was very cool, and I learned a lot about FFTs and more along the way. In the future, I’d like to try something similar with a more powerful board. The Arduino Mega’s clock speed placed some very real limitations on what could be done when sampling audio and performing the Fourier transform. I hope this post gave you some inspiration for ways to take an old project and breathe some creative new life into it. Thanks for reading!</p>

<p>Cheers,</p>

<p>Stephen</p>]]></content><author><name>Stephen Gidge, P.Eng.</name></author><category term="Stair Lights" /><category term="LED" /><category term="Arduino" /><category term="Home Improvement" /><category term="Music" /><summary type="html"><![CDATA[Real-Time bass visualizer, powered by Arduino and arduinoFFT.]]></summary></entry><entry><title type="html">LED Matrix NHL Scoreboard</title><link href="https://gidge.dev/sports%20scoreboard/sports-scoreboard-jul-2021/" rel="alternate" type="text/html" title="LED Matrix NHL Scoreboard" /><published>2021-07-21T09:00:00-04:00</published><updated>2021-07-21T09:00:00-04:00</updated><id>https://gidge.dev/sports%20scoreboard/sports-scoreboard-jul-2021</id><content type="html" xml:base="https://gidge.dev/sports%20scoreboard/sports-scoreboard-jul-2021/"><![CDATA[<h2 id="introduction">Introduction</h2>

<p>About five years ago I had what I thought was an interesting and novel idea – a WiFi connected scoreboard that displays NHL hockey scores in real time. This crossover between my love for hockey and my growing interest in electronics seemed like a perfect project for me at the time. The initial idea was to mimic what you’d see at your local rink, displaying the score for a single game in real time. Think like this:</p>

<figure style="text-align: center;">
  <a href="https://gidge.dev/assets/posts/sports-scoreboard/2021-07/local-rink-scoreboard.jpg">
    <img src="https://gidge.dev/assets/posts/sports-scoreboard/2021-07/local-rink-scoreboard.jpg" style="width: 85%;" />
  </a>
</figure>

<p>The only requirements I set for myself at the time were that it should run on a Raspberry Pi (as I had recently been given one as a gift), and that it should display the score in as close to real time as possible. Oh, and that it should look cool on a wall!</p>

<p>That project… never came to fruition. At the time, I was in the middle of a busy undergrad, which got in the way of dedicating any real time into it.</p>

<p>Then work got in the way.<br />
Then more school.<br />
Then more work…<br />
You can see where this is going…</p>

<p>This past winter, I decided to finally resurrect this idea. Upon researching the large seven segment displays that would be needed to display the teams and scores, I learned that they can be quite pricy. I also finally admitted that I move fairly often, making a large scoreboard a very impractical thing to own. With both of these in mind, I decided to pivot my idea and potentially make something even cooler. I have always been intrigued by LED matrices, and this seemed like the perfect opportunity to leverage the freedom they allow. My new plan was to make a scoreboard that cycles through today’s NHL games and displays the time remaining and score for each game, along with the team logos and other helpful information.</p>

<p>Upon doing some research, I found that a Reddit user by the name of /u/RiffnShred had already completed a <a href="https://www.reddit.com/r/hockey/comments/dcpa2v/nhl_led_matrix_scoreboard/">very similar project</a> in October 2019. Furthermore, the code for this project was open source and available on GitHub. RiffnShred’s project served as a huge source of inspiration for my own, especially for some graphics layouts. I began sketching  what I’d like my scoreboard to look like, both physically and what’s displayed my the matrix. Many whiteboard iterations later and I had a good sense of what I wanted to create. You’ll notice the main screen for games in progress is quite similar – as the old adage goes “imitation is the greatest form of flattery”. You can check out RiffnShred’s repository <a href="https://github.com/riffnshred/nhl-led-scoreboard">here</a>.</p>

<figure style="text-align: center;">
  <a href="https://gidge.dev/assets/posts/sports-scoreboard/2021-07/whiteboard-layout.jpg"><img src="https://gidge.dev/assets/posts/sports-scoreboard/2021-07/whiteboard-layout.jpg" style="width: 85%;" />
  </a>
  <figcaption>Early sketch of where elements should be displayed on the matrix.</figcaption>
</figure>

<p>At this time, I made another rule for myself – I would not copy code from RiffnShred’s project. I wanted this project to be a learning experience, not a copy-paste exercise. Since I’d be building it from scratch, I wanted to figure out how things work with just my knowledge, some Google-fu, and perseverance. This rule may have made the project take longer than it otherwise would have, but I wouldn’t have gained anywhere near the amount of skill in using the NHL API or an LED matrix if I just copied code. Besides, if I was going to copy-paste from RiffnShred’s work, I may have well just ran their project and given up on this whole endeavour.</p>

<p>The remainder of this blog post will dive into more details of the project, how it functions at a high level, and technology that makes it all possible. But before then, here’s a looks at the (nearly) finished product.</p>

<figure style="text-align: center;">
  <a href="https://gidge.dev/assets/posts/sports-scoreboard/2021-07/demo.gif"><img src="https://gidge.dev/assets/posts/sports-scoreboard/2021-07/demo.gif" style="width: 85%;" />
  </a>
</figure>

<h2 id="hardware">Hardware</h2>

<p>The hardware for this build is very simple. At the heart of the project is a Raspberry Pi 3B. The LED matrix is a 32x64 P4 hub75 matrix that I picked up on AliExpress for ~$20 CAD. Between the Raspberry Pi and the matrix is a Adafruit RGB Matrix Bonnet (this can be purchased from Digikey if you’re outside of the US). This bonnet makes driving the matrix with a Raspberry Pi nearly plug and play (i.e. absolutely invaluable to the project). Powering everything is a 5V 8A power supply, also from AliExpress. And that’s it!</p>

<figure style="text-align: center;">
  <a href="https://gidge.dev/assets/posts/sports-scoreboard/2021-07/rpi-far.jpg"><img src="https://gidge.dev/assets/posts/sports-scoreboard/2021-07/rpi-far.jpg" style="width: 85%;" />
  </a>
</figure>

<p>The only interesting part of the hardware is a quick and easy solder job. To use the “quality” option when driving the matrix, a wire needs to be soldered between GPIO pin 4 and pin 18 on the bonnet. This allows the Raspberry Pi to dedicate resources that would normally be for audio output to driving the LED matrix, resulting in much less flicker while the matrix is in operation. You’ll see the quality option enabled in the code during setup with the following line:</p>

<div class="language-python highlighter-rouge"><div class="highlight"><pre class="highlight"><code><span class="n">options</span><span class="p">.</span><span class="n">hardware_mapping</span> <span class="o">=</span> <span class="s">'adafruit-hat-pwm'</span>
</code></pre></div></div>

<figure style="text-align: center;">
  <a href="https://gidge.dev/assets/posts/sports-scoreboard/2021-07/rpi-close.jpg"><img src="https://gidge.dev/assets/posts/sports-scoreboard/2021-07/rpi-close.jpg" style="width: 85%;" />
  </a>
  <figcaption>Notice the small wire between pins 4 and 18.</figcaption>
</figure>

<p>For more information on the hardware needed to drive a matrix with a Raspberry Pi, you can check out Adafruit’s documentation <a href="https://learn.adafruit.com/adafruit-rgb-matrix-bonnet-for-raspberry-pi/">here</a>.</p>

<h2 id="logic--software">Logic &amp; Software</h2>

<p>All code for this project is written in Python 3.8. The basic logic of the scoreboard is very simple. Upon startup, a get request is made to the <a href="https://gitlab.com/dword4/nhlapi/-/blob/master/stats-api.md">NHL API</a>. This will return all NHL games &amp; scores for the current day, formatted in JSON. From this, a list of dictionaries is compiled. Each dictionary in this list contains key information for a single game (teams, scores, start time, time remaining, etc.). Based on this key information, an image is built for each game that will be displayed on the matrix. This image differs depending on the state of each specific game. The three most common situations are as follows:</p>

<ul>
  <li>If they game has not started, the start time of the game in the local time zone will be displayed.</li>
  <li>If the game is in progress, the score and time remaining in the period will be display (this includes intermissions).</li>
  <li>And if the game is over, the final score and end status (if the win was in OT or a shootout) are displayed.</li>
</ul>

<p>Both team’s logos will also be displayed in all situations. In total, there’s over a dozen different combinations of game statuses that have been accounted for, and due to the COVID-19 pandemic, even postponed games are accounted for! The API’s date rolls over at about 11am EST the next day, so you’ll see last nights scores when you get up in the morning (especially useful for those late west coast games).</p>

<figure style="text-align: center;">
  <a href="https://gidge.dev/assets/posts/sports-scoreboard/2021-07/demo-not-started.jpg"><img src="https://gidge.dev/assets/posts/sports-scoreboard/2021-07/demo-not-started.jpg" style="width: 85%;" />
  </a>
  <a href="https://gidge.dev/assets/posts/sports-scoreboard/2021-07/demo-ipr.jpg"><img src="https://gidge.dev/assets/posts/sports-scoreboard/2021-07/demo-ipr.jpg" style="width: 85%;" />
  </a>
  <a href="https://gidge.dev/assets/posts/sports-scoreboard/2021-07/demo-final.jpg"><img src="https://gidge.dev/assets/posts/sports-scoreboard/2021-07/demo-final.jpg" style="width: 85%;" />
  </a>
</figure>

<p>Each game in the list is looped through and its image is displayed on the matrix for a few seconds before transitioning to the next image. At the end of the loop, a new API call is made to update the dictionaries, and the loop begins anew. The old list is not discarded though, it’s actually used to determine if a team has scored. If the sore in the updated dictionary is larger than that in the old one, it is shown that the appropriate team has scored by having it’s goal counter appear red for a few seconds before fading back to its normal white.</p>

<figure style="text-align: center;">
  <a href="https://gidge.dev/assets/posts/sports-scoreboard/2021-07/demo-goal.gif"><img src="https://gidge.dev/assets/posts/sports-scoreboard/2021-07/demo-goal.gif" style="width: 85%;" />
  </a>
  <figcaption style="text-align: left;">Seems like I don't have a video of the goal animation from after I implemented the fade transition... Oops, I'll get that next season. Scan lines are due to the camera and are not visible to the human eye.</figcaption>
</figure>

<p>Images are built using the Python Imaging Library. Each image is built just before it is displayed. That is, in the split second between the fading transitions. This is to negate flicker that is caused by the computations needed to build the image. If the next image was built while something was being displayed on the matrix, some very obvious flickering would occur.  Displaying images on the matrix is handled by hzeller’s wonderful rpi-rgb-led-matrix package. This allows you to display images on the matrix and adjust the display settings with ease through it’s simple to use Python bindings. This project truly would have been impossible without it. More info on this package can be found on <a href="https://github.com/hzeller/rpi-rgb-led-matrix">hzeller’s GitHub</a>.</p>

<p>You’ll notice hzeller’s package being used anytime the options or matrix objects are mentioned within the code.</p>

<div class="language-python highlighter-rouge"><div class="highlight"><pre class="highlight"><code><span class="c1"># Configure options for the matrix.
</span><span class="n">options</span> <span class="o">=</span> <span class="n">RGBMatrixOptions</span><span class="p">()</span>
<span class="n">options</span><span class="p">.</span><span class="n">rows</span> <span class="o">=</span> <span class="mi">32</span>
<span class="n">options</span><span class="p">.</span><span class="n">cols</span> <span class="o">=</span> <span class="mi">64</span>

<span class="p">...</span>

<span class="c1"># Define a matrix object from the options.
</span><span class="n">matrix</span> <span class="o">=</span> <span class="n">RGBMatrix</span><span class="p">(</span><span class="n">options</span> <span class="o">=</span> <span class="n">options</span><span class="p">)</span>

<span class="p">...</span>

<span class="c1"># Reset the brightness and display the image.
</span><span class="n">matrix</span><span class="p">.</span><span class="n">brightness</span> <span class="o">=</span> <span class="n">maxBrightness</span>
<span class="n">matrix</span><span class="p">.</span><span class="n">SetImage</span><span class="p">(</span><span class="n">image</span><span class="p">)</span>
</code></pre></div></div>

<p>You can view all my code for this project, along with installation instructions, at my GitHub Repository <a href="https://github.com/gidger/rpi-led-sports-scoreboard">here</a>.</p>

<h2 id="next-steps">Next Steps</h2>

<p>Now the the offseason is upon us, my focus will shift to making an enclosure for the rear of the LED matrix and the Raspberry Pi, finishing up this iteration of the project. I’m also going to explore adding a photo resistor so the display brightness is determined by the ambient light of the room, rather than the time of day as it currently is.</p>

<p>I’ve also decided that I’d like to make a larger version of this project that will be a gift for a family member, so updating the code and designing and building an enclosure for that will keep me busy in the fall. Eventually I’d like to explore adding scores for other sports as well, making the scoreboard a little more of a “jack of all trades” per-say (and make it less useless in the hockey offseason). I may publish a follow-up to this post once these new features get implemented.</p>

<p>Overall, I’m super pleased with how this project turned out. I’m even more pleased with the set of skills I learned along the way. This project makes use of so many technologies that I had no prior exposure to. Driving LED matrices, harnessing a real-time score API, leveraging the Python Imaging Library, and more! I’m thrilled that I was able to build those skills through this project. More tools in the proverbial toolbox.</p>

<p>If you have any questions about any part of this project, feel free to shoot me an email at <a href="mailto: stephen@gidge.dev">stephen@gidge.dev</a>. I hope this makes you think of some ideas of your own that combine multiple of your hobbies. I’d love to see them! Thanks for reading!</p>

<p>Cheers,</p>

<p><em>Stephen</em></p>]]></content><author><name>Stephen Gidge, P.Eng.</name></author><category term="Sports Scoreboard" /><category term="LED" /><category term="Raspberry Pi" /><category term="Sports" /><category term="NHL" /><summary type="html"><![CDATA[Real time NHL hockey scoreboard, powered by Raspberry Pi.]]></summary></entry><entry><title type="html">Cascading LED Stair Lights</title><link href="https://gidge.dev/stair%20lights/stair-lighting/" rel="alternate" type="text/html" title="Cascading LED Stair Lights" /><published>2021-06-05T15:34:30-04:00</published><updated>2021-06-05T15:34:30-04:00</updated><id>https://gidge.dev/stair%20lights/stair-lighting</id><content type="html" xml:base="https://gidge.dev/stair%20lights/stair-lighting/"><![CDATA[<p>My household has a problem.</p>

<p>Okay, a minor problem – the main staircase has very poor lighting. There is no ceiling light over the stairs, and they can be quite treacherous as a result, especially overnight. Any sensible person would have thought “let’s just leave a light on in the nearest room at the top/bottom”, and we did as well… But as you can guess by the existence of this blog post, we wanted to do something a little more fun and challenging to pass the time. This is the story of how my roommate Ben and I overengineered a set of motion activated understair lights.</p>

<p>Why?</p>

<p>Well, simply put, because we could.</p>

<p>If you’re interested in learning more about how these lights came to life, check out the rest of this post. If not… well, here’s a couple gifs of the finished product (click on the images to enlarge).</p>

<div style="text-align: center;">
  <figure>
    <a href="https://gidge.dev/assets/posts/stair-lighting/build/bottom-up.gif">
      <img src="https://gidge.dev/assets/posts/stair-lighting/build/bottom-up.gif" style="width: 85%;" />
    </a>
    <a href="https://gidge.dev/assets/posts/stair-lighting/build/bottom-down.gif">
      <img src="https://gidge.dev/assets/posts/stair-lighting/build/bottom-down.gif" style="width: 85%;" />
    </a>
  </figure>
</div>

<hr />

<p>Oh hey, you’re still reading! Thanks!</p>

<p>After some light research we found inspiration in lights like these. They served as a starting point as we decided what exactly we wanted to build.</p>

<figure class="third">
    <a href="https://gidge.dev/assets/posts/stair-lighting/inspiration/understair-lights.jpg"><img src="https://gidge.dev/assets/posts/stair-lighting/inspiration/cascading-lights.gif" /></a>
    <a href="https://gidge.dev/assets/posts/stair-lighting/inspiration/understair-lights.jpg"><img src="https://gidge.dev/assets/posts/stair-lighting/inspiration/understair-lights.jpg" /></a>
    <a href="https://gidge.dev/assets/posts/stair-lighting/inspiration/led-strip-light.gif"><img src="https://gidge.dev/assets/posts/stair-lighting/inspiration/led-strip-light.gif" /></a>
</figure>

<p>Ultimately, we decided that we wanted to make understair lights that cascade on upwards when one walks up the stairs, and downwards when one walks down. The lights would also cascade off in the same direction after being lit up for a set amount of time. A cooldown delay would be implemented to prevent triggering the lights in the opposite direction if you’re slightly too slow going up/down the stairs – essentially some extra buffer time.</p>

<p>With Ben and myself both having experience with Arduinos in the past, we decided to build on the familiar platform. Each stair would have an LED strip that is connected to a shared power supply. A transistor between each LED strip and the power supply would be controlled by the Arduino and make the lights turn on and off. Ultrasonic sensors would be installed at the top and bottom of the staircase to detect when a person walks by. This would trigger the cascading animations.</p>

<p>Unfortunately, the digital pins required for 16 transistors (there’s four more stairs beyond the landing) and two ultrasonic sensors exceeds the number of pins available on a standard Arduino Uno. As we already had a couple of Arduino Unos lying around, we decided to set up a master-slave system in order to gain access to the additional digital pins.</p>

<p>Well… until one of them tragically died as all electronics eventually do. Then we decided to simplify the whole thing and order an Arduino Mega (with it’s deluge of digital pins), simplifying things greatly.</p>

<div style="text-align: center;">
  <figure>
    <a href="https://gidge.dev/assets/posts/stair-lighting/build/wires.jpg">
      <img src="https://gidge.dev/assets/posts/stair-lighting/build/wires.jpg" style="width: 85%;" />
    </a>
    <figcaption style="text-align: left;">Wires to each LED strip were routed from the Arduino via Command hooks. They did a surprisingly good job of making it look neat.</figcaption>
  </figure>
</div>

<p>After a couple iterations (and one terrifying spaghetti board that would surely not make it through airport security; see below) we settled on a super simple circuit on a breadboard. Essentially, there exists 16 identical circuits where a transistor acts as a simple “on/off” switch – each connected to a pin on the Arduino. Power cables are run from the breadboard to each stair. The ultrasonic sensors were also connected to the Arduino and placed near the top and bottom of the stairs.</p>

<figure class="half">
    <a href="https://gidge.dev/assets/posts/stair-lighting/build/spaghetti.jpg"><img src="https://gidge.dev/assets/posts/stair-lighting/build/spaghetti.jpg" /></a>
    <a href="https://gidge.dev/assets/posts/stair-lighting/build/arduino.jpg"><img src="https://gidge.dev/assets/posts/stair-lighting/build/arduino.jpg" /></a>
    <figcaption>V1 "Spaghetti Monster" (left). Yep, there's two Arduinos in there under the perf board. No, it didn't quite work...<br /> V2 (right). Looks messy, but everything is out of the way, colour coded, and labeled, so it's easy to troubleshoot.</figcaption>
</figure>

<figure class="half">
    <a href="https://gidge.dev/assets/posts/stair-lighting/build/sensor-top.jpg"><img src="https://gidge.dev/assets/posts/stair-lighting/build/sensor-top.jpg" /></a>
    <a href="https://gidge.dev/assets/posts/stair-lighting/build/sensor-bottom.jpg"><img src="https://gidge.dev/assets/posts/stair-lighting/build/sensor-bottom.jpg" /></a>
    <figcaption>Top and bottom ultrasonic sensors. Bottom is mounted further in to avoid false triggers when someone walks by the stairs without going up. Top sensor is in need of a more elegant installation...</figcaption>
</figure>

<p>If you’re interested in the code running this build, you can view the repository <a href="https://github.com/gidger/under-stair-lighting">here</a>. It’s currently set up for our 16 stair configuration, but only requires a few modifications if you’d like to make your own cascading lights. If you have any questions or issues, feel free to reach out to me at <a href="mailto: stephen@gidge.dev">stephen@gidge.dev</a> for assistance.</p>

<p>We’re not totally done with this project yet. Up next is brainstorming an enclosure for the main circuit so it’s not living out in the open forever. Following that, our focus will shift to 3D printing a mount for each ultrasonic sensor (well, once the world reopens and we have access to a 3D printer). Duct tape is working fine for now, but we’d rather not rely on it indefinitely. We’d also like to explore implementing a real-time clock to keep a single light on overnight as a night light.</p>

<p>I may publish a follow-up to this article once the last few loose ends of the project get settled. Until then, if you have any questions feel free to shoot me an email. I hope this post gave you some inspiration for your next “home improvement” project! Thanks for reading!</p>

<p>Until next time,</p>

<p>Stephen</p>

<p><em>Check out <a href="https://gidge.dev/stair%20lights/stair-lighting-pt2/">Part 2</a> for a look at how I made these lights react to music real time!</em></p>

<p>P.S. Here’s one last gif of the lights in action.</p>

<div style="text-align: center;">
  <figure>
    <a href="https://gidge.dev/assets/posts/stair-lighting/build/landing-down.gif">
      <img src="https://gidge.dev/assets/posts/stair-lighting/build/landing-down.gif" style="width: 85%;" />
    </a>
  </figure>
</div>]]></content><author><name>Stephen Gidge, P.Eng.</name></author><category term="Stair Lights" /><category term="LED" /><category term="Arduino" /><category term="Home Improvement" /><summary type="html"><![CDATA[Motion activated understair lighting, powered by Arduino.]]></summary></entry></feed>