<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0" xmlns:media="http://search.yahoo.com/mrss/"><channel><title><![CDATA[Spencer's Projects and Weblog]]></title><description><![CDATA[Topics include but are not limited to: Campervans, electronics and DIY]]></description><link>https://maroukis.net/</link><image><url>https://maroukis.net/favicon.png</url><title>Spencer&apos;s Projects and Weblog</title><link>https://maroukis.net/</link></image><generator>Ghost 5.75</generator><lastBuildDate>Fri, 03 Apr 2026 14:33:35 GMT</lastBuildDate><atom:link href="https://maroukis.net/rss/" rel="self" type="application/rss+xml"/><ttl>60</ttl><item><title><![CDATA[Seven Segment Phase 1 — Architecture Overview and Hardware Prototyping]]></title><description><![CDATA[Adventures in hardware prototyping of a custom display of seven-segment digits arranged in a matrix.]]></description><link>https://maroukis.net/sev-seg-1/</link><guid isPermaLink="false">666ee2653fccef0b4a91dc6d</guid><category><![CDATA[⚡Electronics]]></category><category><![CDATA[📐PCB Design]]></category><dc:creator><![CDATA[Spencer Maroukis]]></dc:creator><pubDate>Sat, 22 Jun 2024 14:02:32 GMT</pubDate><media:content url="https://maroukis.net/content/images/2024/06/IMG_9382-1.JPG" medium="image"/><content:encoded><![CDATA[<img src="https://maroukis.net/content/images/2024/06/IMG_9382-1.JPG" alt="Seven Segment Phase 1 &#x2014; Architecture Overview and Hardware Prototyping"><p>Project Main page &#x1F447;&#x1F447;&#x1F447;&#x1F447; </p><figure class="kg-card kg-bookmark-card"><a class="kg-bookmark-container" href="https://maroukis.net/sev-seg/"><div class="kg-bookmark-content"><div class="kg-bookmark-title">[Active] Seven Segment Display Driver</div><div class="kg-bookmark-description">An extensible hardware and software solution for driving a wall of seven segment displays</div><div class="kg-bookmark-metadata"><img class="kg-bookmark-icon" src="https://maroukis.net/content/images/size/w256h256/2024/01/42-1.png" alt="Seven Segment Phase 1 &#x2014; Architecture Overview and Hardware Prototyping"><span class="kg-bookmark-author">Spencer&apos;s Projects and Weblog</span><span class="kg-bookmark-publisher">Spencer Maroukis</span></div></div><div class="kg-bookmark-thumbnail"><img src="https://maroukis.net/content/images/2024/05/sev-seg-block-diagram-1.png" alt="Seven Segment Phase 1 &#x2014; Architecture Overview and Hardware Prototyping"></div></a></figure><hr><h2 id="prototype-system-overview">Prototype System Overview</h2><p>For the testing prototype I dropped the &quot;daisy-chainable&quot; modules idea since it seems like setting up the two DMA channels for full duplex send/receive (Shift-Register like), allowing us to &quot;shift-through&quot; data may be difficult with the low performance C0 series STM32 chips, see <a href="https://community.st.com/t5/stm32-mcus-products/stm32f7-full-duplex-spi-slave-daisy-chain-with-shared-buffer/td-p/271882?ref=maroukis.net" rel="noreferrer">here</a>. However, this is a key part of the &quot;extensibility&quot; goal of the project, so it will have to be revisited.</p><p>The architecture of the testing prototype is as shown:</p><figure class="kg-card kg-image-card"><img src="https://maroukis.net/content/images/2024/06/39-seven-seg-architecture-1.png" class="kg-image" alt="Seven Segment Phase 1 &#x2014; Architecture Overview and Hardware Prototyping" loading="lazy" width="1235" height="1077" srcset="https://maroukis.net/content/images/size/w600/2024/06/39-seven-seg-architecture-1.png 600w, https://maroukis.net/content/images/size/w1000/2024/06/39-seven-seg-architecture-1.png 1000w, https://maroukis.net/content/images/2024/06/39-seven-seg-architecture-1.png 1235w" sizes="(min-width: 720px) 720px"></figure><p>The &quot;Manager&quot; is just a pin header for a micro to send the LED serial data to the Modules; a shift register (SR) is added as a GPIO expander for addressing, and since the SRs can be daisy-chained without additional MCU GPIO pins it is technically extensible. </p><p>The Modules center around a single STM32 each driving (4) x TM1637 LED drivers.  Each TM1637 can drive a maximum of 6 digits, which I&apos;ve utilized here by using two 3-digit displays (not shown). Thus each module controls 6*4=24 digits. </p><h3 id="timing"><strong>Timing</strong></h3><p>Each module will receive the serial data corresponding to the LED segments it is driving and store it using DMA into memory-mapped SRAM. Once the SPI serial data transfer is complete the module will shift out the data over I2C as required by the TM1637 driver. Note that we can send the data to the driver chips without displaying the data as there is a special display command code that we will send later once the Module receives a Display Enable command from the Manager. This allows us to send the display command to the driver chips in &quot;faux-parallel&quot; by interleaving the slower 250kbps I2C max speed of the TM1637 driver, resulting in all the segments updating at once (one hopes).</p><p>The timing diagram for a 24fps update rate is as shown:</p><figure class="kg-card kg-image-card kg-width-wide kg-card-hascaption"><img src="https://maroukis.net/content/images/2024/06/39-Seven-Segment-BOM---Timing---Overview-300.png" class="kg-image" alt="Seven Segment Phase 1 &#x2014; Architecture Overview and Hardware Prototyping" loading="lazy" width="2000" height="1545" srcset="https://maroukis.net/content/images/size/w600/2024/06/39-Seven-Segment-BOM---Timing---Overview-300.png 600w, https://maroukis.net/content/images/size/w1000/2024/06/39-Seven-Segment-BOM---Timing---Overview-300.png 1000w, https://maroukis.net/content/images/size/w1600/2024/06/39-Seven-Segment-BOM---Timing---Overview-300.png 1600w, https://maroukis.net/content/images/size/w2400/2024/06/39-Seven-Segment-BOM---Timing---Overview-300.png 2400w" sizes="(min-width: 1200px) 1200px"><figcaption><span style="white-space: pre-wrap;">Simplified timing calculations for a 24Hz update ratio (here 3 drivers are used instead of 4). The limiting factor is the second-to-bottom timing block which shows the dataframe for the MCU to the TM1637 LED Driver. Since this is over a 250kbps-max I2C interface, it limits the number of displays that can be connected. It takes 288us to transfer the data to the TM1637, not including the internal delay of the TM1637 to drive the digits.</span></figcaption></figure><p>For a 24Hz display refresh rate, transmitting data to each module in series can take a maximum of 42ms/N_modules or e.g. 2ms for 21 modules. Within the 2ms we just have to send the data over SPI to the STM32 Module. Here since we are not including brightness data it is just bits = (no. segments) * (no. digits) = 8 * 6 = 48 bits or 6 bytes per module. The data is stored in memory mapped SRAM and all segment data should be shifted out to the drivers after the SPI transfer from the Manager is finished. Note that the displays will not be updated at this moment, but only after the &quot;Display Enable&quot; pin is set will the MCU send the proper Display Update command to the LED drivers.</p><p>Each MCU module is driving 3 of the TM1637 driver chips at a max speed of 250kbps per the datasheet so it is most efficient to interleave the serial output to all three at the same time. Continuing with the rough calculation for a 21 module example above, this means we can get about 1500us with 250us of buffer on each side to fit within the 2ms period. The auto incrementing setting of the TM1637 chip auto-increments the address for each byte, so we just have to send the address corresponding to the first digit we want to update. To update 6 digits means we would send 9 bytes. The first two bytes are the write command and address bytes, the next six are the data with auto-incrementing enabled, and the last is the  display command, which will update the displays with the data [[1]].</p><figure class="kg-card kg-image-card kg-width-wide"><img src="https://maroukis.net/content/images/2024/06/timing-2.png" class="kg-image" alt="Seven Segment Phase 1 &#x2014; Architecture Overview and Hardware Prototyping" loading="lazy" width="2000" height="392" srcset="https://maroukis.net/content/images/size/w600/2024/06/timing-2.png 600w, https://maroukis.net/content/images/size/w1000/2024/06/timing-2.png 1000w, https://maroukis.net/content/images/size/w1600/2024/06/timing-2.png 1600w, https://maroukis.net/content/images/2024/06/timing-2.png 2178w" sizes="(min-width: 1200px) 1200px"></figure><p>[[1]]: The MCU/module will send this display update command when the Display Enable pin is set, and all the displays should be updated nearly simultaneously</p><p>So \( (250\text{kbps}/8)^{-1}\times 9\text{ bytes} \) gives 288us to update 6 digits. The theoretical display update at this speed is about 3.5kHz. This gives the theoretical maximum size display to be</p><p>$$N_{modules,max} = \frac{3.5\text{ kHz}}{24\text{ Hz}} \approx 145\text{ modules} \\ \Rightarrow 145\times 18 \approx 2600 \text{ digits}$$</p><p>This is approximately a 50 x 50 digit wall, although this doesn&apos;t include the internal delay of the driver chip to drive the digits. Each display is about 19mm tall gives almost a meter by meter wall. Note the TM1638, which can drive up to 10 digits, can run twice as fast. Just if you were wondering &#x1F609;. </p><h3 id="component-cost">Component Cost</h3><p>Component costs are shown below for the major components sourced via LCSC since that is where I could find the TM1637 the cheapest. This doesn&apos;t include discretes like resistors and capacitors or the PCB fabrication price. </p><table>
<thead>
<tr>
<th>Part</th>
<th>Cost</th>
<th>Qty per Module</th>
<th>Cost Per Module</th>
</tr>
</thead>
<tbody>
<tr>
<td>3-digit Display</td>
<td>$0.38</td>
<td>8</td>
<td>$3.04</td>
</tr>
<tr>
<td>Shift Register</td>
<td>$0.06</td>
<td>N/8</td>
<td>negligible</td>
</tr>
<tr>
<td>TM1637 LED Driver</td>
<td>$0.17</td>
<td>4</td>
<td>$0.68</td>
</tr>
<tr>
<td>STM32C011F6Px</td>
<td>$0.77</td>
<td>1</td>
<td>$0.77</td>
</tr>
<tr>
<td>TXS0108E Level Shifter</td>
<td>$0.32</td>
<td>1</td>
<td>$0.32</td>
</tr>
<tr>
<td><strong>Total</strong> (per module)</td>
<td></td>
<td></td>
<td><strong>$4.81</strong></td>
</tr>
<tr>
<td><strong>Total</strong> (per digit)</td>
<td></td>
<td></td>
<td><strong>$0.20</strong></td>
</tr>
</tbody>
</table>
<h2 id="pcb-layout">PCB Layout</h2><p>I added a bunch of 0.1&quot;/2.54mm pitch header pins for testing purposes and for the main controller/Manager. In tight places I had to go down to 0.05&quot;/1.27mm headers when I wanted to keep the test point close to the STM32 chip. </p><p>One layout mistake I made was to route power last. I started with the critical clock and data traces but then kept going and going until I finally got to power last... the increased track width forced me to move a lot of already-placed vias and continuously re-stitch power planes as I moved things around &#x1F926;.</p><p>As always, footprint datasheets were scrutinized thrice over, but only custom footprints for the TM1637 and the Seven Segment Displays were needed (the other footprints were found in the KiCad default libraries).</p><ul><li><strong>TXS1080E Level Shifter &amp; STM32C0</strong>: TSSOP-20, Body=4.4x6.5mm, Pin Pitch=0.65mm</li><li><strong>TM1637</strong>: Custom, SOC-20, Body=12.6x7.5mm, Pin Width = 1.27mm; Pin Width =0.44mm</li><li><strong>Seven Segment Displays</strong>: Custom, pin pitch is 2.54mm apart (3 digit footprint is same as 4 digit with one pin unconnected)</li></ul><figure class="kg-card kg-image-card kg-card-hascaption"><img src="https://maroukis.net/content/images/2024/06/47C5B20B-0B3A-49DF-AB70-424EEBA31575.png" class="kg-image" alt="Seven Segment Phase 1 &#x2014; Architecture Overview and Hardware Prototyping" loading="lazy" width="2000" height="1133" srcset="https://maroukis.net/content/images/size/w600/2024/06/47C5B20B-0B3A-49DF-AB70-424EEBA31575.png 600w, https://maroukis.net/content/images/size/w1000/2024/06/47C5B20B-0B3A-49DF-AB70-424EEBA31575.png 1000w, https://maroukis.net/content/images/size/w1600/2024/06/47C5B20B-0B3A-49DF-AB70-424EEBA31575.png 1600w, https://maroukis.net/content/images/2024/06/47C5B20B-0B3A-49DF-AB70-424EEBA31575.png 2104w" sizes="(min-width: 720px) 720px"><figcaption><span style="white-space: pre-wrap;">2 layer board, Ground plane front and 3V3 plane back. Solder-selectable 3V3 or 5V supply to the TM1637 is also included.</span></figcaption></figure><h3 id="power-supply-voltage-levels">Power Supply Voltage Levels</h3><p>Although the red-LEDs with their ~2V voltage drop should be able to be driven by the TM1637 at a 3V3 supply, for testing purposes I added in a 5V rail via a solderable jumper. The driver voltage is set by soldering either the 5V side or the 3V3 side. Both 5V and 3V need to be provided separately via screw terminals (no converter included).</p><figure class="kg-card kg-image-card"><img src="https://maroukis.net/content/images/2024/06/Screenshot-2024-06-22-at-8.59.56-PM.png" class="kg-image" alt="Seven Segment Phase 1 &#x2014; Architecture Overview and Hardware Prototyping" loading="lazy" width="1904" height="566" srcset="https://maroukis.net/content/images/size/w600/2024/06/Screenshot-2024-06-22-at-8.59.56-PM.png 600w, https://maroukis.net/content/images/size/w1000/2024/06/Screenshot-2024-06-22-at-8.59.56-PM.png 1000w, https://maroukis.net/content/images/size/w1600/2024/06/Screenshot-2024-06-22-at-8.59.56-PM.png 1600w, https://maroukis.net/content/images/2024/06/Screenshot-2024-06-22-at-8.59.56-PM.png 1904w" sizes="(min-width: 720px) 720px"></figure><figure class="kg-card kg-image-card kg-card-hascaption"><img src="https://maroukis.net/content/images/2024/06/Screenshot-2024-06-22-at-9.01.14-PM.png" class="kg-image" alt="Seven Segment Phase 1 &#x2014; Architecture Overview and Hardware Prototyping" loading="lazy" width="1238" height="988" srcset="https://maroukis.net/content/images/size/w600/2024/06/Screenshot-2024-06-22-at-9.01.14-PM.png 600w, https://maroukis.net/content/images/size/w1000/2024/06/Screenshot-2024-06-22-at-9.01.14-PM.png 1000w, https://maroukis.net/content/images/2024/06/Screenshot-2024-06-22-at-9.01.14-PM.png 1238w" sizes="(min-width: 720px) 720px"><figcaption><span style="white-space: pre-wrap;">The output voltage of the level shifter is set by soldering either the 3V3 or 5V jumper closed.</span></figcaption></figure><p>Here is the finished board without the headers soldered:</p><figure class="kg-card kg-image-card"><img src="https://maroukis.net/content/images/2024/06/F53AB68D-FFF8-4221-BA5F-12F87980BE13_1_105_c.jpeg" class="kg-image" alt="Seven Segment Phase 1 &#x2014; Architecture Overview and Hardware Prototyping" loading="lazy" width="1024" height="768" srcset="https://maroukis.net/content/images/size/w600/2024/06/F53AB68D-FFF8-4221-BA5F-12F87980BE13_1_105_c.jpeg 600w, https://maroukis.net/content/images/size/w1000/2024/06/F53AB68D-FFF8-4221-BA5F-12F87980BE13_1_105_c.jpeg 1000w, https://maroukis.net/content/images/2024/06/F53AB68D-FFF8-4221-BA5F-12F87980BE13_1_105_c.jpeg 1024w" sizes="(min-width: 720px) 720px"></figure><p>With the displays: </p><figure class="kg-card kg-image-card"><img src="https://maroukis.net/content/images/2024/06/IMG_9372_edited-1.JPG" class="kg-image" alt="Seven Segment Phase 1 &#x2014; Architecture Overview and Hardware Prototyping" loading="lazy" width="2000" height="1001" srcset="https://maroukis.net/content/images/size/w600/2024/06/IMG_9372_edited-1.JPG 600w, https://maroukis.net/content/images/size/w1000/2024/06/IMG_9372_edited-1.JPG 1000w, https://maroukis.net/content/images/size/w1600/2024/06/IMG_9372_edited-1.JPG 1600w, https://maroukis.net/content/images/size/w2400/2024/06/IMG_9372_edited-1.JPG 2400w" sizes="(min-width: 720px) 720px"></figure><h3 id="prototype-schematics">Prototype Schematics</h3><p>Here are some schematics:</p><figure class="kg-card kg-image-card kg-card-hascaption"><img src="https://maroukis.net/content/images/2024/06/Screenshot-2024-06-17-at-7.59.38-AM.png" class="kg-image" alt="Seven Segment Phase 1 &#x2014; Architecture Overview and Hardware Prototyping" loading="lazy" width="1772" height="1224" srcset="https://maroukis.net/content/images/size/w600/2024/06/Screenshot-2024-06-17-at-7.59.38-AM.png 600w, https://maroukis.net/content/images/size/w1000/2024/06/Screenshot-2024-06-17-at-7.59.38-AM.png 1000w, https://maroukis.net/content/images/size/w1600/2024/06/Screenshot-2024-06-17-at-7.59.38-AM.png 1600w, https://maroukis.net/content/images/2024/06/Screenshot-2024-06-17-at-7.59.38-AM.png 1772w" sizes="(min-width: 720px) 720px"><figcaption><span style="white-space: pre-wrap;">Main/Manager to Modules with Shift Register in between as a GPIO expander for the SPI chip select.</span></figcaption></figure><figure class="kg-card kg-image-card kg-card-hascaption"><img src="https://maroukis.net/content/images/2024/06/Screenshot-2024-06-17-at-7.59.58-AM.png" class="kg-image" alt="Seven Segment Phase 1 &#x2014; Architecture Overview and Hardware Prototyping" loading="lazy" width="2000" height="1374" srcset="https://maroukis.net/content/images/size/w600/2024/06/Screenshot-2024-06-17-at-7.59.58-AM.png 600w, https://maroukis.net/content/images/size/w1000/2024/06/Screenshot-2024-06-17-at-7.59.58-AM.png 1000w, https://maroukis.net/content/images/size/w1600/2024/06/Screenshot-2024-06-17-at-7.59.58-AM.png 1600w, https://maroukis.net/content/images/2024/06/Screenshot-2024-06-17-at-7.59.58-AM.png 2044w" sizes="(min-width: 720px) 720px"><figcaption><span style="white-space: pre-wrap;">Single module, with the MCU (STM32) driving the TM1637 drivers via a level shifter.</span></figcaption></figure><figure class="kg-card kg-image-card kg-card-hascaption"><img src="https://maroukis.net/content/images/2024/06/Screenshot-2024-06-17-at-8.00.11-AM.png" class="kg-image" alt="Seven Segment Phase 1 &#x2014; Architecture Overview and Hardware Prototyping" loading="lazy" width="1780" height="1230" srcset="https://maroukis.net/content/images/size/w600/2024/06/Screenshot-2024-06-17-at-8.00.11-AM.png 600w, https://maroukis.net/content/images/size/w1000/2024/06/Screenshot-2024-06-17-at-8.00.11-AM.png 1000w, https://maroukis.net/content/images/size/w1600/2024/06/Screenshot-2024-06-17-at-8.00.11-AM.png 1600w, https://maroukis.net/content/images/2024/06/Screenshot-2024-06-17-at-8.00.11-AM.png 1780w" sizes="(min-width: 720px) 720px"><figcaption><span style="white-space: pre-wrap;">TM1637 LED driver driving (2) 3-digit seven segment displays.</span></figcaption></figure><h2 id="next-up">Next Up</h2><p>Next up will be testing the hardware and writing the firmware for the Modules as well as looking into the Manager controller firmware (decoding GIF images/etc. and converting to the serial bit stream).</p><p>The final hardware will change depending on the timing and voltage requirements, as well as being made more modular.</p><p>A stretch goal would be to test firmware that allows for daisy-chaining the STM32 modules instead of using a SS chip select pin with the Shift Register. This would allow the system to work more like the daisy-chainable WS2811 or APA102 RGB LED driver chips.</p>]]></content:encoded></item><item><title><![CDATA[10,000 Hour Seven Segment Display Stopwatch]]></title><description><![CDATA[A counter to place on your desk when doing what you do. Get those reps in!]]></description><link>https://maroukis.net/10k-hours/</link><guid isPermaLink="false">663440fb3fccef0b4a91dc10</guid><category><![CDATA[⚡Electronics]]></category><dc:creator><![CDATA[Spencer Maroukis]]></dc:creator><pubDate>Wed, 01 May 2024 01:43:00 GMT</pubDate><media:content url="https://maroukis.net/content/images/2024/05/IMG_8909-1.JPG" medium="image"/><content:encoded><![CDATA[<img src="https://maroukis.net/content/images/2024/05/IMG_8909-1.JPG" alt="10,000 Hour Seven Segment Display Stopwatch"><p>Frustrated by learning arcane embedded-C commands with no documentation? HAL bloat got you down? Don&apos;t know how the hell STM32CubeIDE&apos;s build process works? Worry not, you can be comforted by the fact that those 10 hours debugging linker errors is 10 hours towards your 10,000 of mastery. And when you get there you won&apos;t even think, &quot;it&apos;s not even a real clock, there&apos;s not even an RTC module&quot; &#x2013; it doesn&apos;t matter since you&apos;re a Master now.</p><p>(yes, you can even use this timer to count your hours coding in C++, nay <strong>Python, </strong>this is an Arduino project after all)</p><figure class="kg-card kg-bookmark-card"><a class="kg-bookmark-container" href="https://github.com/smaroukis/snippets/blob/main/02-Arduino-ESP/Arduino-Mega/03-tm1637-counter/03-tm1637-counter.ino?ref=maroukis.net"><div class="kg-bookmark-content"><div class="kg-bookmark-title">snippets/02-Arduino-ESP/Arduino-Mega/03-tm1637-counter/03-tm1637-counter.ino at main &#xB7; smaroukis/snippets</div><div class="kg-bookmark-description">Contribute to smaroukis/snippets development by creating an account on GitHub.</div><div class="kg-bookmark-metadata"><img class="kg-bookmark-icon" src="https://github.githubassets.com/assets/pinned-octocat-093da3e6fa40.svg" alt="10,000 Hour Seven Segment Display Stopwatch"><span class="kg-bookmark-author">GitHub</span><span class="kg-bookmark-publisher">smaroukis</span></div></div><div class="kg-bookmark-thumbnail"><img src="https://opengraph.githubassets.com/840a519f2748ef9bc670a9af57b22d7f2677e8410b8a25695f6c23f521a059ed/smaroukis/snippets" alt="10,000 Hour Seven Segment Display Stopwatch"></div></a></figure><h3 id="fun-things-from-this-project">Fun things from this project</h3><p><code>EEPROM.write()</code> / <code>EEPROM.put()</code>  take ~3.4ms both for 3 bytes and a struct with those bytes. The docs mention that any <code>EEPROM.write()</code> will take about 3.3ms, so it&apos;s the setup and access to the ROM that busies the CPU, not necessarily how many bytes are written. </p><figure class="kg-card kg-image-card kg-card-hascaption"><img src="https://maroukis.net/content/images/2024/05/Screenshot-2024-05-02-at-6.40.00-PM.png" class="kg-image" alt="10,000 Hour Seven Segment Display Stopwatch" loading="lazy" width="1538" height="1180" srcset="https://maroukis.net/content/images/size/w600/2024/05/Screenshot-2024-05-02-at-6.40.00-PM.png 600w, https://maroukis.net/content/images/size/w1000/2024/05/Screenshot-2024-05-02-at-6.40.00-PM.png 1000w, https://maroukis.net/content/images/2024/05/Screenshot-2024-05-02-at-6.40.00-PM.png 1538w" sizes="(min-width: 720px) 720px"><figcaption><span style="white-space: pre-wrap;">Measuing </span><code spellcheck="false" style="white-space: pre-wrap;"><span>EEPROM.write()</span></code><span style="white-space: pre-wrap;"> time</span></figcaption></figure><p>1000uF capacitor across USBVCC extended 5V&#x2014;3.3V turn off time from 1.5 ms to 40ms (hopefully enough for an <code>EEPROM.write()</code>)</p><figure class="kg-card kg-image-card kg-card-hascaption"><img src="https://maroukis.net/content/images/2024/05/Screenshot-2024-05-02-at-9.55.54-PM-2.png" class="kg-image" alt="10,000 Hour Seven Segment Display Stopwatch" loading="lazy" width="1908" height="1062" srcset="https://maroukis.net/content/images/size/w600/2024/05/Screenshot-2024-05-02-at-9.55.54-PM-2.png 600w, https://maroukis.net/content/images/size/w1000/2024/05/Screenshot-2024-05-02-at-9.55.54-PM-2.png 1000w, https://maroukis.net/content/images/size/w1600/2024/05/Screenshot-2024-05-02-at-9.55.54-PM-2.png 1600w, https://maroukis.net/content/images/2024/05/Screenshot-2024-05-02-at-9.55.54-PM-2.png 1908w" sizes="(min-width: 720px) 720px"><figcaption><span style="white-space: pre-wrap;">Put the hunking cap here! (Arduino mega R3)</span></figcaption></figure><figure class="kg-card kg-gallery-card kg-width-wide kg-card-hascaption"><div class="kg-gallery-container"><div class="kg-gallery-row"><div class="kg-gallery-image"><img src="https://maroukis.net/content/images/2024/05/Screenshot-2024-05-02-at-4.39.42-PM.png" width="2000" height="1087" loading="lazy" alt="10,000 Hour Seven Segment Display Stopwatch" srcset="https://maroukis.net/content/images/size/w600/2024/05/Screenshot-2024-05-02-at-4.39.42-PM.png 600w, https://maroukis.net/content/images/size/w1000/2024/05/Screenshot-2024-05-02-at-4.39.42-PM.png 1000w, https://maroukis.net/content/images/size/w1600/2024/05/Screenshot-2024-05-02-at-4.39.42-PM.png 1600w, https://maroukis.net/content/images/size/w2400/2024/05/Screenshot-2024-05-02-at-4.39.42-PM.png 2400w" sizes="(min-width: 720px) 720px"></div><div class="kg-gallery-image"><img src="https://maroukis.net/content/images/2024/05/Screenshot-2024-05-02-at-5.35.22-PM.png" width="2000" height="1087" loading="lazy" alt="10,000 Hour Seven Segment Display Stopwatch" srcset="https://maroukis.net/content/images/size/w600/2024/05/Screenshot-2024-05-02-at-5.35.22-PM.png 600w, https://maroukis.net/content/images/size/w1000/2024/05/Screenshot-2024-05-02-at-5.35.22-PM.png 1000w, https://maroukis.net/content/images/size/w1600/2024/05/Screenshot-2024-05-02-at-5.35.22-PM.png 1600w, https://maroukis.net/content/images/size/w2400/2024/05/Screenshot-2024-05-02-at-5.35.22-PM.png 2400w" sizes="(min-width: 720px) 720px"></div></div></div><figcaption><p><span style="white-space: pre-wrap;">Test procedure: Setup the scope for single shot on a falling edge. Disconnect the USB cable powering the Arduino as quickly as possible. </span></p></figcaption></figure><p></p>]]></content:encoded></item><item><title><![CDATA[[Active] Seven Segment Display Driver]]></title><description><![CDATA[An extensible hardware and software solution for driving a wall of seven segment displays]]></description><link>https://maroukis.net/sev-seg/</link><guid isPermaLink="false">661fcf1e3fccef0b4a91dba0</guid><category><![CDATA[⚡Electronics]]></category><category><![CDATA[📐PCB Design]]></category><dc:creator><![CDATA[Spencer Maroukis]]></dc:creator><pubDate>Wed, 17 Apr 2024 13:41:04 GMT</pubDate><media:content url="https://maroukis.net/content/images/2024/05/sev-seg-block-diagram-1.png" medium="image"/><content:encoded><![CDATA[<img src="https://maroukis.net/content/images/2024/05/sev-seg-block-diagram-1.png" alt="[Active] Seven Segment Display Driver"><p><strong>Posts in this series</strong>: <a href="https://maroukis.net/sev-seg-1" rel="noreferrer">Phase 1 &#x2013; Architecture Overview and Hardware Prototyping</a></p><h2 id="overview">Overview:</h2><p>An extensible hardware and software solution for driving a wall of seven segment displays. A &quot;display module&quot; will consist of multiple LED driver chips each driving a maximum number of digits, commanded by a single STM32 driver MCU. A master controller decodes animated gifs and sends a serial byte command of SPI to the display modules, then sends a synchronized update command. Per-segment brightness control will be implemented in version 2.</p><figure class="kg-card kg-image-card"><img src="https://maroukis.net/content/images/2024/06/IMG_9372.JPG" class="kg-image" alt="[Active] Seven Segment Display Driver" loading="lazy" width="2000" height="1500" srcset="https://maroukis.net/content/images/size/w600/2024/06/IMG_9372.JPG 600w, https://maroukis.net/content/images/size/w1000/2024/06/IMG_9372.JPG 1000w, https://maroukis.net/content/images/size/w1600/2024/06/IMG_9372.JPG 1600w, https://maroukis.net/content/images/size/w2400/2024/06/IMG_9372.JPG 2400w" sizes="(min-width: 720px) 720px"></figure><p><strong>Goals</strong>:</p><ul><li>lowest possible cost &#x2013; a preliminary calculation is at $0.20/digit, so for a 36x36 digit display around $260</li><li>module-based &#x2013; user can string modules together to drive bigger and bigger display walls</li><li>(stretch/v2) individual segment-level control  &#x2014; see why this is a v2 goal below (depends on driver chip)</li><li>(stretch/v2) integrates with current libraries like <a href="https://docs.pixelmatix.com/SmartMatrix/shieldref.html?ref=maroukis.net" rel="noreferrer">SmartLED</a>/FastLED</li></ul><p><strong>Links and Supporting Posts:</strong><br>See supporting blog posts and links below. You can always <a href="https://maroukis.net/contact" rel="noreferrer">drop me a line</a> if you have comments, advice or want to collaborate.</p><ul><li>Detailed post on Tm1637 library and logic analyzer captures (In Progress)</li><li>General post on multiplexing architectures (In Progress)</li></ul><h2 id="system-architecture">System Architecture</h2><p>The system consists of </p><ul><li><strong>Manager</strong>: The main controller that packages and sends the serial bit stream for each display frame.</li><li><strong>Shift Register(s)</strong>: as a GPIO expander for the SPI CS pin for the modules. These aren&apos;t needed if we can daisy-chain modules together (see &#xA7;Scope Creep below).</li><li><strong>Modules</strong>: Each has a single STM32 MCU that drives (4) x LED Drivers (TM1637). A level shifter may be included. Since each driver can drive 6 digits each module command 24 digits.</li><li><strong>Seven-Segment Driver chip</strong>: The TM1637 driver chip can drive up to 6 digits and is commanded by a max 250kbps I2C-esque serial signal from the MCU. A library for STM32 is readily available. </li></ul><figure class="kg-card kg-image-card kg-card-hascaption"><img src="https://maroukis.net/content/images/2024/06/39-seven-seg-architecture-2.png" class="kg-image" alt="[Active] Seven Segment Display Driver" loading="lazy" width="1235" height="1077" srcset="https://maroukis.net/content/images/size/w600/2024/06/39-seven-seg-architecture-2.png 600w, https://maroukis.net/content/images/size/w1000/2024/06/39-seven-seg-architecture-2.png 1000w, https://maroukis.net/content/images/2024/06/39-seven-seg-architecture-2.png 1235w" sizes="(min-width: 720px) 720px"><figcaption><span style="white-space: pre-wrap;">The manager packages and sends the serial bit stream for each display frame, while each module&apos;s STM32 MCU drives four TM1637 LED drivers, controlling up to 24 digits per module. Modules are cascaded using a serial register for addressing. </span></figcaption></figure><p>Each STM32-based module will then send out four interleaved I2C-like signals to the TM1637 display driver chips. Since each driver chip drives 6 digits each we will update all 6 digits, giving a digit refresh rate of ~290us for a 250kbps serial clock. The TM1637 modules then continuously multiplex/refresh the displays with this given data without further commands. </p><p>Since all of the driver chips are commanded at about the same time (the STM32 can easily interleave 3 bit-banged 250kbps Clock and Data lines) we should have a synchronized update across all digits. </p><p>The timing requirements are calculated based on a 24Hz refresh rate for the whole frame, giving for example a required processing period of a module of 2ms for a 24Hz refresh rate.</p><blockquote>
<p>1/24Hz ~= 42ms &#x2192; 42ms/20modules ~= 2ms/module.</p>
</blockquote>
<p>Each module must take in the SPI data, update its internal memory mapped registers that hold the status of the display segments (or an internal array), and then wait for the command to send the data out to the TM1637 driver. In reality below only during the last module period will this command be sent since only at this time will all of the modules have their data. </p><p>Note that the limiting factor is how fast the TM1637 serial clock runs that updates the individual digits, which in this case with some buffer time is calculated around 288us for updating all 6 digits at 250kbps.[[1]] </p><h3 id="future-scope-creep">Future / Scope Creep</h3><p><strong>Daisy chaining SPI (</strong>&#x1F527;<strong>)</strong></p><p>The <a href="https://www.analog.com/en/resources/technical-articles/daisychaining-spi-devices.html?ref=maroukis.net" rel="noreferrer">daisy-chained SPI configuration</a> is on hold until I get further into the firmware capabilities of the STM32C0 series chip. Apparently implementing a full-duplex SPI peripheral is <a href="https://community.st.com/t5/stm32-mcus-products/stm32f7-full-duplex-spi-slave-daisy-chain-with-shared-buffer/td-p/271882?ref=maroukis.net" rel="noreferrer">not trivial </a>(issues with the SPI peripheral timing using a shared Tx/Rx buffer), although if the delays are deterministic and accounted for it shouldn&apos;t matter if it isn&apos;t truly fully duplex as long as the time delays aren&apos;t so large that they affect larger displays. </p><figure class="kg-card kg-image-card"><img src="https://maroukis.net/content/images/2024/05/sev-seg-block-diagram.png" class="kg-image" alt="[Active] Seven Segment Display Driver" loading="lazy" width="1486" height="838" srcset="https://maroukis.net/content/images/size/w600/2024/05/sev-seg-block-diagram.png 600w, https://maroukis.net/content/images/size/w1000/2024/05/sev-seg-block-diagram.png 1000w, https://maroukis.net/content/images/2024/05/sev-seg-block-diagram.png 1486w" sizes="(min-width: 720px) 720px"></figure><figure class="kg-card kg-image-card kg-card-hascaption"><img src="https://maroukis.net/content/images/2024/05/image.png" class="kg-image" alt="[Active] Seven Segment Display Driver" loading="lazy" width="495" height="375"><figcaption><span style="white-space: pre-wrap;">Showing the SPI daisy chained shift-register approach to sending in a whole data frame and having the modules pass the data that&apos;s not intended for them onto the next module in the chain. Once all of the modules (here 3 shown) have their data a L-&gt;H transition on the nCS line is used as an Output Enable. Source: </span><a href="https://www.analog.com/en/resources/technical-articles/daisychaining-spi-devices.html?ref=maroukis.net"><span style="white-space: pre-wrap;">https://www.analog.com/en/resources/technical-articles/daisychaining-spi-devices.html</span></a></figcaption></figure><h2 id></h2><h2 id="inspired-by">Inspired By</h2><figure class="kg-card kg-bookmark-card"><a class="kg-bookmark-container" href="http://www.skot9000.com/posts/2012/03/27/digitgrid.html?ref=maroukis.net"><div class="kg-bookmark-content"><div class="kg-bookmark-title">The DigitGrid</div><div class="kg-bookmark-description">The DigitGrid is a new type of display. Typically used to display numbers, seven segment displays have been around in various forms for over 100 years. The t&#x2026;</div><div class="kg-bookmark-metadata"><img class="kg-bookmark-icon" src="http://www.skot9000.com/favicon.ico" alt="[Active] Seven Segment Display Driver"></div></div><div class="kg-bookmark-thumbnail"><img src="http://www.skot9000.com/wp/wp-content/uploads/2012/03/DSCN3137.jpg" alt="[Active] Seven Segment Display Driver"></div></a></figure><figure class="kg-card kg-bookmark-card"><a class="kg-bookmark-container" href="https://hackaday.com/2019/12/20/movie-style-hacking-with-a-wall-of-glowing-hex/?ref=maroukis.net"><div class="kg-bookmark-content"><div class="kg-bookmark-title">Movie-Style Hacking With A Wall Of Glowing Hex</div><div class="kg-bookmark-description">Over the years, the media has managed to throw together some pretty ridiculous visual depictions of computer hacking. But perhaps none have gone as far down the road of obfuscation as The Matrix, w&#x2026;</div><div class="kg-bookmark-metadata"><img class="kg-bookmark-icon" src="https://hackaday.com/wp-content/themes/hackaday-2/img/hackaday-logo_1024x1024.png?v=3" alt="[Active] Seven Segment Display Driver"><span class="kg-bookmark-author">Hackaday</span><span class="kg-bookmark-publisher">Tom Nardi</span></div></div><div class="kg-bookmark-thumbnail"><img src="https://hackaday.com/wp-content/uploads/2019/12/hexboard_feat.jpg" alt="[Active] Seven Segment Display Driver"></div></a></figure><p></p><p></p><p>[[1]]: Note that the limiting factor is how fast the TM1637 serial clock runs that updates the individual digits, which in this case with some buffer time is calculated around 288us for updating all 6 digits at 250kbps.</p>]]></content:encoded></item><item><title><![CDATA[USB Sleuth Cable Tester]]></title><description><![CDATA[Learnings from designing, manufacturing, and testing a custom PCB for testing USB cables.]]></description><link>https://maroukis.net/usb-sleuth/</link><guid isPermaLink="false">65a73f3f80adc71d5d282262</guid><category><![CDATA[⚡Electronics]]></category><category><![CDATA[📐PCB Design]]></category><dc:creator><![CDATA[Spencer Maroukis]]></dc:creator><pubDate>Tue, 16 Jan 2024 02:11:06 GMT</pubDate><media:content url="https://maroukis.net/content/images/2024/01/featured.JPG" medium="image"/><content:encoded><![CDATA[<div class="kg-card kg-callout-card kg-callout-card-blue"><div class="kg-callout-emoji">&#x1F3C4;</div><div class="kg-callout-text">Follow this project on <a href="https://hackaday.io/project/194646-usb-sleuth-cable-tester?ref=maroukis.net" rel="noreferrer">Hackaday</a>!</div></div><h2 id="overview">Overview</h2><img src="https://maroukis.net/content/images/2024/01/featured.JPG" alt="USB Sleuth Cable Tester"><p>After being inspired by <a href="https://github.com/aroerina/LimePulse_USB_cable_checker/?ref=maroukis.net" rel="noreferrer">various</a> <a href="https://github.com/alvarop/usb_c_cable_tester?ref=maroukis.net" rel="noreferrer">USB</a> <a href="https://github.com/petl/USB-C-cable-tester-C2C-caberQU?ref=maroukis.net" rel="noreferrer">cable</a> <a href="https://www.amazon.com/Treedix-Cable-Checker-Charging-Type-C/dp/B0CFX5MXWX?ref=maroukis.net" rel="noreferrer">testers</a>, I decided to build my own to get familiar with STM32, KiCad and the USB-C standard. Mostly it was a hardware fork of <a href="https://github.com/aroerina/LimePulse_USB_cable_checker/?ref=maroukis.net" rel="noreferrer">this hackaday project</a> that had a schematic but no firmware.</p><p>The device has some benefits over a simple continuity tester:</p><ul><li>displays the as-plugged orientation of the 4 different possibilities of the USB-C to C cable</li><li>detects pullup and pulldown resistors on the CC lines as required by the USB standard for legacy cables</li><li>identifies active cable with E marker (via the pulldown resistor present on VCONN)</li><li>doesn&apos;t apply a +V to the Ground line/pin, instead it uses a MCU to test the presence of a connected ground wire</li><li>exposes various pins to test cable and internal resistors manually with a DMM</li></ul><p>I went through JLCPCB to manufacture the boards, choosing parts from their library coming from LCSC. The C code uses the STM32 HAL libraries, a further improvement would be to port this to lower level and publish a CMake file so that it is less reliant on the STM32CubeIDE. </p><p>Detailed documentation, firmware, and KiCad files are in the README on github. This blog post will describe more of my learnings and gotchas than the technical details of the project.</p><figure class="kg-card kg-bookmark-card"><a class="kg-bookmark-container" href="https://github.com/smaroukis/usb-sleuth/blob/main/README.md?ref=maroukis.net"><div class="kg-bookmark-content"><div class="kg-bookmark-title">usb-sleuth/README.md at main &#xB7; smaroukis/usb-sleuth</div><div class="kg-bookmark-description">USB cable continuity tester ++. Contribute to smaroukis/usb-sleuth development by creating an account on GitHub.</div><div class="kg-bookmark-metadata"><img class="kg-bookmark-icon" src="https://github.githubassets.com/assets/pinned-octocat-093da3e6fa40.svg" alt="USB Sleuth Cable Tester"><span class="kg-bookmark-author">GitHub</span><span class="kg-bookmark-publisher">smaroukis</span></div></div><div class="kg-bookmark-thumbnail"><img src="https://opengraph.githubassets.com/bd37758bd5d887bee916413c5afdf2e44217098469c1748ed0b1654381cbc0c4/smaroukis/usb-sleuth" alt="USB Sleuth Cable Tester"></div></a></figure><figure class="kg-card kg-gallery-card kg-width-wide kg-card-hascaption"><div class="kg-gallery-container"><div class="kg-gallery-row"><div class="kg-gallery-image"><img src="https://maroukis.net/content/images/2024/01/IMG_5877.JPG" width="2000" height="1500" loading="lazy" alt="USB Sleuth Cable Tester" srcset="https://maroukis.net/content/images/size/w600/2024/01/IMG_5877.JPG 600w, https://maroukis.net/content/images/size/w1000/2024/01/IMG_5877.JPG 1000w, https://maroukis.net/content/images/size/w1600/2024/01/IMG_5877.JPG 1600w, https://maroukis.net/content/images/size/w2400/2024/01/IMG_5877.JPG 2400w" sizes="(min-width: 720px) 720px"></div><div class="kg-gallery-image"><img src="https://maroukis.net/content/images/2024/01/IMG_6098.JPG" width="2000" height="1500" loading="lazy" alt="USB Sleuth Cable Tester" srcset="https://maroukis.net/content/images/size/w600/2024/01/IMG_6098.JPG 600w, https://maroukis.net/content/images/size/w1000/2024/01/IMG_6098.JPG 1000w, https://maroukis.net/content/images/size/w1600/2024/01/IMG_6098.JPG 1600w, https://maroukis.net/content/images/size/w2400/2024/01/IMG_6098.JPG 2400w" sizes="(min-width: 720px) 720px"></div><div class="kg-gallery-image"><img src="https://maroukis.net/content/images/2024/01/Screenshot-2024-01-17-at-1.53.03-PM.png" width="1124" height="974" loading="lazy" alt="USB Sleuth Cable Tester" srcset="https://maroukis.net/content/images/size/w600/2024/01/Screenshot-2024-01-17-at-1.53.03-PM.png 600w, https://maroukis.net/content/images/size/w1000/2024/01/Screenshot-2024-01-17-at-1.53.03-PM.png 1000w, https://maroukis.net/content/images/2024/01/Screenshot-2024-01-17-at-1.53.03-PM.png 1124w" sizes="(min-width: 720px) 720px"></div></div><div class="kg-gallery-row"><div class="kg-gallery-image"><img src="https://maroukis.net/content/images/2024/01/IMG_6365-1.JPG" width="2000" height="1500" loading="lazy" alt="USB Sleuth Cable Tester" srcset="https://maroukis.net/content/images/size/w600/2024/01/IMG_6365-1.JPG 600w, https://maroukis.net/content/images/size/w1000/2024/01/IMG_6365-1.JPG 1000w, https://maroukis.net/content/images/size/w1600/2024/01/IMG_6365-1.JPG 1600w, https://maroukis.net/content/images/size/w2400/2024/01/IMG_6365-1.JPG 2400w" sizes="(min-width: 720px) 720px"></div><div class="kg-gallery-image"><img src="https://maroukis.net/content/images/2024/01/test-c-c-active.JPG" width="2000" height="2667" loading="lazy" alt="USB Sleuth Cable Tester" srcset="https://maroukis.net/content/images/size/w600/2024/01/test-c-c-active.JPG 600w, https://maroukis.net/content/images/size/w1000/2024/01/test-c-c-active.JPG 1000w, https://maroukis.net/content/images/size/w1600/2024/01/test-c-c-active.JPG 1600w, https://maroukis.net/content/images/size/w2400/2024/01/test-c-c-active.JPG 2400w" sizes="(min-width: 720px) 720px"></div></div></div><figcaption><p><span style="white-space: pre-wrap;">Design, prototyping, pcb layout, and doing the final hand placements.</span></p></figcaption></figure><figure class="kg-card kg-image-card kg-card-hascaption"><img src="https://maroukis.net/content/images/2024/01/Screenshot-2024-01-17-at-12.47.42-PM-copy-1.png" class="kg-image" alt="USB Sleuth Cable Tester" loading="lazy" width="1940" height="1790" srcset="https://maroukis.net/content/images/size/w600/2024/01/Screenshot-2024-01-17-at-12.47.42-PM-copy-1.png 600w, https://maroukis.net/content/images/size/w1000/2024/01/Screenshot-2024-01-17-at-12.47.42-PM-copy-1.png 1000w, https://maroukis.net/content/images/size/w1600/2024/01/Screenshot-2024-01-17-at-12.47.42-PM-copy-1.png 1600w, https://maroukis.net/content/images/2024/01/Screenshot-2024-01-17-at-12.47.42-PM-copy-1.png 1940w" sizes="(min-width: 720px) 720px"><figcaption><span style="white-space: pre-wrap;">Main features of the usb-sleuth</span></figcaption></figure><h3 id="interesting-tidbits">Interesting Tidbits</h3><p><strong>Analog vs digital read on cable internal resistors: </strong>A USB A to C cable will have a 56K internal pullup from the CC pin to VBUS (since in the USB-C standard the CC pin on the host side should be pulled up to identify as a host, but of course the USB-A side doesn&apos;t have the CC pin, so it must be pulled up in the cable itself). </p><p>We test this as in the following schematic by pulling the B-side CC control pin, <code>BCC1_CTRL</code> , to 0V through a 1oK resistor and measuring the voltage at the divider point, <code>BCC1_Sense</code>. Note here we can&apos;t use a digital read.</p><div class="kg-card kg-callout-card kg-callout-card-red"><div class="kg-callout-emoji">&#x261D;&#xFE0F;</div><div class="kg-callout-text">Since the internal pullup 56K is large (weak), we must use an <b><strong style="white-space: pre-wrap;">analog read</strong></b> since 3.3V * 10 / 66 will read LOW.</div></div><figure class="kg-card kg-image-card kg-card-hascaption"><img src="https://github.com/smaroukis/usb-sleuth/raw/main/attachments/e3cffc83784986d4a272780f084790a6.jpg" class="kg-image" alt="USB Sleuth Cable Tester" loading="lazy"><figcaption><span style="white-space: pre-wrap;">Testing procedure: Pull </span><code spellcheck="false" style="white-space: pre-wrap;"><span>BCC1_CTRL</span></code><span style="white-space: pre-wrap;">&#x2192;0V. If an analog read of </span><code spellcheck="false" style="white-space: pre-wrap;"><span>BCC1_Sens</span></code><span style="white-space: pre-wrap;"> is greater than 0.15*VBUS, then the pull up is present. </span></figcaption></figure><p>In the USB B-to-C case, the B side is pulled down to <code>GND</code> pin with a 5.1K resistor. To test, instead of pulling <code>BCC1_CTRL</code> to 0V, we pull <code>ACC1</code> high through an internal pullup. Since the internal pullup is ~50K, about 10 times weaker than the 5.1K pulldown, we can use a <strong>digital read </strong>(==LOW) to check if the pulldown is present.</p><figure class="kg-card kg-image-card"><img src="https://github.com/smaroukis/usb-sleuth/raw/main/attachments/dd959de04ef8304902529b81821b52ff.jpg" class="kg-image" alt="USB Sleuth Cable Tester" loading="lazy"></figure><p>This is also documented in the <a href="https://github.com/smaroukis/usb-sleuth/?ref=maroukis.net#mcu-testing-of-rp-on-type-a-to-type-c-cable" rel="noreferrer">README</a>.</p><h3 id="key-learnings">Key Learnings:</h3><ol><li><strong>Custom footprints and multi-unit symbols</strong>: Custom footprints are a pain at first, but better to pull that tooth out sooner than later (or end up with a misaligned part); multi unit symbols are a cool feature to make it easy to draw a 4 pole DIP switch as separate switches in the schematic but link to a single component.</li><li><strong>Double check minimum clearances before routing traces</strong>: I had my minimum via size wrong from the start, which required a rework of all the traces off of the USB-C ports.</li><li><strong>USB cable standards and pullup/pulldown resistor configurations</strong>: A-to-C will have a 56K pullup, B-to-C will have a 5K1 pulldown, and an active C-to-C cable will have a ~1K pulldown.</li><li><strong>Existence of ESD diodes on MCU GPIO pins</strong>: I added an isolation switch to use during DMM testing of the resistor values, to avoid a path through ESD diodes on the GPIO pins causing bad readings. Once receiving the boards, the switch positions didn&apos;t have an impact on the measurements, so they could be removed in future hardware versions.</li><li><strong>Generating correct BOM and gerber files</strong>: In KiCad for JLCPCB, I used the  Fabrication Toolkit plugin, edited a bit of the python file, and used the DNP field of the KiCad schematic viewer to mark hand placed components which would be excluded from the auto generated BOM.</li><li><strong>Using commodity parts with JLCPCB/fab houses</strong>: Once I found out how to search for them using <em>JLCPCB/LCSC&apos;s abysmal parameter search</em>, I tried to use commodity (&quot;basic&quot;) parts since reels of these are already loaded on the pick &apos;n place machine; for each &quot;extended&quot; part number you pay a loading fee of $3 &#x2192; this fee can be avoided for things like resistors, capacitors and LEDs but not for parts like USB receptacles or resistor arrays.</li></ol><h3 id="more-specific-learnings">More Specific Learnings</h3><ul><li>JLCPCB viewer doesn&apos;t have the correct orientation of the components - they will rotate them correctly on their side (but I paid an extra dollar or two for the final production file to be sent for my approval)</li><li>I had a lot of back and forth between JLCPCB engineers about my pads sticking outside of the board edge layer &#x2013; which I designed that way just to be clipped by the board edge layer.</li><li>Renaming files and folders in the KiCad project is a bit of a workaround &#x2013; for example when I wanted to rename the directory with the custom footprints, the easiest way is to rename the file itself and then use e.g. VSCode to &quot;find/replace&quot; all occurrences of the footprint path.</li></ul><div class="kg-card kg-callout-card kg-callout-card-blue"><div class="kg-callout-emoji">&#x1F44D;</div><div class="kg-callout-text">On the other hand, KiCad&apos;s text-based file format did allow me to use this find/replace trick for other purposes, and allows easy plugin development.</div></div><h3 id="scope-creep">Scope Creep</h3><ul><li>differential pairs and the drain wire in USB 3.0 (the drain wire is a return signal for any unbalance in the differential signal, and as a heavier conductor to ground the thin shield to divert large EMI spikes to ground)</li><li>taller SMD capacitors (vs resistors) requires a wider pad in order to get a solder fillet all the way to the top of component (and avoid tombstoning)</li><li>multi unit symbols in KiCad - useful for the creating 4 individual schematic switches for the 4 pole DIP switch.</li></ul><h2 id="project-timeline-highlights">Project Timeline Highlights:</h2><ul><li>Feb 3: Published <a href="https://hackaday.io/project/194646-usb-sleuth-cable-tester?ref=maroukis.net" rel="noreferrer">Hackaday.io</a> project and was featured on <a href="https://hackaday.com/2024/02/01/eliminate-that-pesky-power-only-usb-cable-with-this-cable-tester/?ref=maroukis.net" rel="noreferrer">Hackaday.com</a> </li><li>Jan 27: STM32 HAL code finished and all tests working. Rev 1 complete &#x1F973;</li><li>Jan 17: Testing and porting Arduino code to STM32 HAL C.</li><li>Jan 3: Boards delivered.</li><li>December 21: Back and forth with JLCPCB about pads extending beyond the board edge resolved.</li><li>December 18: Sent the project for production.</li><li>December 15: BOM generation using Fabrication Outputs plugin.</li><li>December 13: USB port custom footprint edits, footprint calculator, and final edits.</li><li>December 11: Second day of routing, with challenges in USB-C routing.</li><li>December 8: PCB layout updates and considerations for taller SMD capacitors.</li><li>December 5: Investigation of ESD diodes and DMM current injection paths for Ra/Rd/Rp.</li><li>November 27: Hardware test for CC orientation, pull-down/up.</li><li>November 17: Continued layout with logic for testing, wired up to Arduino.</li><li>November 10: Bought USB-C and USB-A breakout board for testing.</li><li>November 9: Research on USB pinouts, grounding, and differential signals.</li></ul>]]></content:encoded></item><item><title><![CDATA[Comparison of GPS Modules: UBlox LEA-6H vs Blues Wireless Notecarriers]]></title><description><![CDATA[A comparison of various GPS receiver module including active antenna versus on-board chip antenna.]]></description><link>https://maroukis.net/gps-comparison/</link><guid isPermaLink="false">65a73f3f80adc71d5d282263</guid><category><![CDATA[⚡Electronics]]></category><category><![CDATA[🐍Python]]></category><dc:creator><![CDATA[Spencer Maroukis]]></dc:creator><pubDate>Wed, 01 Nov 2023 00:00:00 GMT</pubDate><media:content url="https://maroukis.net/content/images/2024/01/IMG_5744.JPG" medium="image"/><content:encoded><![CDATA[<h2 id="summary">Summary</h2><div class="kg-card kg-callout-card kg-callout-card-purple"><div class="kg-callout-emoji">&#x1F4DD;</div><div class="kg-callout-text"><b><strong style="white-space: pre-wrap;">tl;dr</strong></b> the Blues Wireless Notecarrier v2 with chip antenna outperformed the active antenna (on an older notecarrier) and the Ublox LEA-6H module, likely due to the on-board filtering and maybe assisted GPSe.</div></div><img src="https://maroukis.net/content/images/2024/01/IMG_5744.JPG" alt="Comparison of GPS Modules: UBlox LEA-6H vs Blues Wireless Notecarriers"><p>Three tests were performed:</p><ol><li>UBlox LEA-6H module vs. Notecarrier-Pi with Active Antenna</li><li>UBlox LEA-6H module vs. Notecarrier-A-v1.7 with on-board GPS Chip Antenna</li><li>UBlox LEA-6H module vs. Notecarrier-A-v2.0 with on-board GPS Chip Antenna</li></ol><p>Analysis was done using the standard <code>pandas</code>, <code>numpy</code>, and <code>matplotlib</code> python libraries. </p><figure class="kg-card kg-image-card"><img src="https://maroukis.net/content/images/2024/01/Drawing---redacted-1.png" class="kg-image" alt="Comparison of GPS Modules: UBlox LEA-6H vs Blues Wireless Notecarriers" loading="lazy" width="1365" height="588" srcset="https://maroukis.net/content/images/size/w600/2024/01/Drawing---redacted-1.png 600w, https://maroukis.net/content/images/size/w1000/2024/01/Drawing---redacted-1.png 1000w, https://maroukis.net/content/images/2024/01/Drawing---redacted-1.png 1365w" sizes="(min-width: 720px) 720px"></figure><p>Generally the Ublox LEA-6H module</p><ul><li>dropped less samples &#x2705;</li><li>got a fix on more satellites &#x2705;</li><li>was less precise / had a lot more jitter in the lat/long &#x274C;&#xA0;(sometimes on the order of 100m) - note though that I wasn&#x2019;t applying any filters to the data</li><li>seemed more affected by worse weather or less-than-ideal placement inside. &#x274C;</li></ul><p>The Notecarrier modules</p><ul><li>have much more &#x201C;precision&#x201D; (it probably does its own filtering and also might be using assisted GPS with the cell tower reads as well) &#x2705;</li><li>was less affected by worse weather or indoor placement &#x2705;</li><li>got a fix on less satellites at &#x274C;</li><li>dropped more samples &#x274C;</li></ul><p>The old notecarrier with gps chip antenna (v1.7) and the notecarrier-pi with the active antenna were about the same, but the notecarrier-a v2.0 showed a big increase in precision.</p><figure class="kg-card kg-image-card kg-card-hascaption"><img src="https://maroukis.net/content/images/2024/01/Untitled.png" class="kg-image" alt="Comparison of GPS Modules: UBlox LEA-6H vs Blues Wireless Notecarriers" loading="lazy" width="629" height="475" srcset="https://maroukis.net/content/images/size/w600/2024/01/Untitled.png 600w, https://maroukis.net/content/images/2024/01/Untitled.png 629w"><figcaption><span style="white-space: pre-wrap;">Active antenna on the notecarrier pi shows more precision than the Ublox LEA-6H module</span></figcaption></figure><blockquote>Note that below we go from a span of 4-10 meter errors to 0.85 to 1.10 meter errors. The LEA-6H histogram is not shown since it was ranging between 1 and 100 m.</blockquote><figure class="kg-card kg-image-card kg-card-hascaption"><img src="https://maroukis.net/content/images/2024/01/Untitled-1.png" class="kg-image" alt="Comparison of GPS Modules: UBlox LEA-6H vs Blues Wireless Notecarriers" loading="lazy" width="630" height="475" srcset="https://maroukis.net/content/images/size/w600/2024/01/Untitled-1.png 600w, https://maroukis.net/content/images/2024/01/Untitled-1.png 630w"><figcaption><span style="white-space: pre-wrap;">The notecarrier-a v2.0 shows a dramatic increase in precision, and also dropped less reads than than the previous versions.</span></figcaption></figure><h2 id="improvement-in-precision-on-notecard-versions">Improvement in Precision on Notecard Versions</h2><p>Notecarrier Pi with Active antenna:</p><figure class="kg-card kg-image-card"><img src="https://maroukis.net/content/images/2024/01/Untitled-3.png" class="kg-image" alt="Comparison of GPS Modules: UBlox LEA-6H vs Blues Wireless Notecarriers" loading="lazy" width="629" height="475" srcset="https://maroukis.net/content/images/size/w600/2024/01/Untitled-3.png 600w, https://maroukis.net/content/images/2024/01/Untitled-3.png 629w"></figure><p>Notearrier A v2.0</p><figure class="kg-card kg-gallery-card kg-width-wide"><div class="kg-gallery-container"><div class="kg-gallery-row"><div class="kg-gallery-image"><img src="https://maroukis.net/content/images/2024/01/output.png" width="627" height="475" loading="lazy" alt="Comparison of GPS Modules: UBlox LEA-6H vs Blues Wireless Notecarriers" srcset="https://maroukis.net/content/images/size/w600/2024/01/output.png 600w, https://maroukis.net/content/images/2024/01/output.png 627w"></div><div class="kg-gallery-image"><img src="https://maroukis.net/content/images/2024/01/Untitled-2-1.png" width="630" height="475" loading="lazy" alt="Comparison of GPS Modules: UBlox LEA-6H vs Blues Wireless Notecarriers" srcset="https://maroukis.net/content/images/size/w600/2024/01/Untitled-2-1.png 600w, https://maroukis.net/content/images/2024/01/Untitled-2-1.png 630w"></div></div></div></figure><h2 id="notecard-signal-dropped-comparison">Notecard Signal Dropped Comparison</h2><blockquote>Note we can&#x2019;t <em>really</em> compare these because they were taken on different days, but look how the Notecarrier v2.0 drops less data samples.</blockquote><figure class="kg-card kg-image-card kg-card-hascaption"><img src="https://maroukis.net/content/images/2024/01/Untitled-3-1.png" class="kg-image" alt="Comparison of GPS Modules: UBlox LEA-6H vs Blues Wireless Notecarriers" loading="lazy" width="630" height="470" srcset="https://maroukis.net/content/images/size/w600/2024/01/Untitled-3-1.png 600w, https://maroukis.net/content/images/2024/01/Untitled-3-1.png 630w"><figcaption><span style="white-space: pre-wrap;">Above: Dropped samples were replaced with error=0m so the red areas show us where samples were being dropped. Below: The notecard reports a signal value in dB, thus the the dropped samples appear a signal = 0dB</span></figcaption></figure><figure class="kg-card kg-image-card kg-card-hascaption"><img src="https://maroukis.net/content/images/2024/01/Untitled-4.png" class="kg-image" alt="Comparison of GPS Modules: UBlox LEA-6H vs Blues Wireless Notecarriers" loading="lazy" width="630" height="470" srcset="https://maroukis.net/content/images/size/w600/2024/01/Untitled-4.png 600w, https://maroukis.net/content/images/2024/01/Untitled-4.png 630w"><figcaption><span style="white-space: pre-wrap;">Above: The error of the notecard v2.0 is so low that is is squashed near to the x axis. Below: The notecard reports a signal value in dB, thus the the dropped samples appear a signal = 0dB .</span></figcaption></figure><h2 id="further">Further</h2><ul><li>Test cold start time-to-fix</li><li>Add in bearing to get the directional skew (i.e. vectorize the error)</li></ul><h1 id="appendixfull-data">Appendix - Full Data</h1><h2 id="lea-6h-vs-notecarrier-pi-w-active-antenna">LEA-6H vs Notecarrier-Pi w/ Active Antenna</h2><p>The error distance was calculated based on the distance from a &#x201C;true&#x201D; point picked on google maps, so at the &lt;5m distance the &#x201C;true&#x201D; value may have been wrong.</p><blockquote>The Notecard gps was much more precise with a smaller spread around the center. There is likely some filtering / averaging going on at the notecard level or they are using assisted GPS with the cellular tower data.</blockquote><pre><code class="language-jsx">Summary for LEA:
Rows:  8639
Error Uptime (): 100.000000% (8639/8639)
Satellites Uptime (): 100.0% (8639/8639)
Summary for Notecard:
Rows:  8639
Error Uptime (): 97.789096% (8448/8639)
Satellites Uptime (): 100.0% (8639/8639)
</code></pre><h3 id="errordistance-comparison">Error/Distance Comparison</h3><figure class="kg-card kg-gallery-card kg-width-wide kg-card-hascaption"><div class="kg-gallery-container"><div class="kg-gallery-row"><div class="kg-gallery-image"><img src="https://maroukis.net/content/images/2024/01/Untitled-7.png" width="629" height="475" loading="lazy" alt="Comparison of GPS Modules: UBlox LEA-6H vs Blues Wireless Notecarriers" srcset="https://maroukis.net/content/images/size/w600/2024/01/Untitled-7.png 600w, https://maroukis.net/content/images/2024/01/Untitled-7.png 629w"></div><div class="kg-gallery-image"><img src="https://maroukis.net/content/images/2024/01/Screenshot_2023-11-06_at_11.38.21_AM.png" width="594" height="1038" loading="lazy" alt="Comparison of GPS Modules: UBlox LEA-6H vs Blues Wireless Notecarriers"></div></div></div><figcaption><p><span style="white-space: pre-wrap;">Left: Histogram and box plots of error (m). Right: Descriptive statistics of error. </span><code spellcheck="false" style="white-space: pre-wrap;"><span>df1</span></code><span style="white-space: pre-wrap;"> is LEA-6H, </span><code spellcheck="false" style="white-space: pre-wrap;"><span>df2</span></code><span style="white-space: pre-wrap;"> is Notecard.</span></p></figcaption></figure><h3 id="uptime">Uptime</h3><p>Here we plot the same graph as above (error), but showing &#x201C;null&#x201D; values as zero. We see the Notecarrier-Pi drops a lot more data. The bottom plot is the &#x201C;signal&#x201D; value that the notecard reports, we can see some of the signal values drop to zero for the notecard, even when the Ublox module has a fix.</p><figure class="kg-card kg-image-card"><img src="https://maroukis.net/content/images/2024/01/Untitled-6.png" class="kg-image" alt="Comparison of GPS Modules: UBlox LEA-6H vs Blues Wireless Notecarriers" loading="lazy" width="630" height="470" srcset="https://maroukis.net/content/images/size/w600/2024/01/Untitled-6.png 600w, https://maroukis.net/content/images/2024/01/Untitled-6.png 630w"></figure><h3 id="number-of-satellites">Number of Satellites</h3><blockquote>Ublox module had more satellites more often (average of ~12 versus ~8 for the Notecard with active antenna)</blockquote><figure class="kg-card kg-gallery-card kg-width-wide kg-card-hascaption"><div class="kg-gallery-container"><div class="kg-gallery-row"><div class="kg-gallery-image"><img src="https://maroukis.net/content/images/2024/01/Untitled-7-1.png" width="629" height="475" loading="lazy" alt="Comparison of GPS Modules: UBlox LEA-6H vs Blues Wireless Notecarriers" srcset="https://maroukis.net/content/images/size/w600/2024/01/Untitled-7-1.png 600w, https://maroukis.net/content/images/2024/01/Untitled-7-1.png 629w"></div><div class="kg-gallery-image"><img src="https://maroukis.net/content/images/2024/01/Screenshot_2023-11-06_at_4.31.50_PM.png" width="702" height="990" loading="lazy" alt="Comparison of GPS Modules: UBlox LEA-6H vs Blues Wireless Notecarriers" srcset="https://maroukis.net/content/images/size/w600/2024/01/Screenshot_2023-11-06_at_4.31.50_PM.png 600w, https://maroukis.net/content/images/2024/01/Screenshot_2023-11-06_at_4.31.50_PM.png 702w"></div></div></div><figcaption><p><span style="white-space: pre-wrap;">Left: Histogram and box plot of number of satellites acquired. Right: Descriptive statistics, </span><code spellcheck="false" style="white-space: pre-wrap;"><span>df1</span></code><span style="white-space: pre-wrap;"> is LEA-6H, </span><code spellcheck="false" style="white-space: pre-wrap;"><span>df2</span></code><span style="white-space: pre-wrap;"> is Notecard.</span></p></figcaption></figure><figure class="kg-card kg-image-card"><img src="https://maroukis.net/content/images/2024/01/Untitled-8.png" class="kg-image" alt="Comparison of GPS Modules: UBlox LEA-6H vs Blues Wireless Notecarriers" loading="lazy" width="997" height="521" srcset="https://maroukis.net/content/images/size/w600/2024/01/Untitled-8.png 600w, https://maroukis.net/content/images/2024/01/Untitled-8.png 997w" sizes="(min-width: 720px) 720px"></figure><h2 id="lea-6h-vs-notecarrier-a-v17-w-gps-chip-antenna">LEA-6H vs Notecarrier-A-v1.7 w/ GPS Chip Antenna</h2><blockquote>Note that this test was done at a different location than the previous test.</blockquote><pre><code class="language-jsx">Summary for LEA:
Rows:  8639
Error Uptime (): 100.000000% (8639/8639)
Satellites Uptime (): 100.0% (8639/8639)
Summary for Notecard:
Rows:  8639
Error Uptime (): 86.595671% (7481/8639)
Satellites Uptime (): 100.0% (8639/8639)
</code></pre><h3 id="errordistance-comparison-1">Error/Distance Comparison</h3><figure class="kg-card kg-gallery-card kg-width-wide kg-card-hascaption"><div class="kg-gallery-container"><div class="kg-gallery-row"><div class="kg-gallery-image"><img src="https://maroukis.net/content/images/2024/01/Untitled-9.png" width="626" height="475" loading="lazy" alt="Comparison of GPS Modules: UBlox LEA-6H vs Blues Wireless Notecarriers" srcset="https://maroukis.net/content/images/size/w600/2024/01/Untitled-9.png 600w, https://maroukis.net/content/images/2024/01/Untitled-9.png 626w"></div><div class="kg-gallery-image"><img src="https://maroukis.net/content/images/2024/01/Screenshot_2023-11-06_at_4.27.23_PM.png" width="582" height="986" loading="lazy" alt="Comparison of GPS Modules: UBlox LEA-6H vs Blues Wireless Notecarriers"></div></div></div><figcaption><p><span style="white-space: pre-wrap;">Left: Error (m) histogram and box plot. Right: Summary statistics (</span><code spellcheck="false" style="white-space: pre-wrap;"><span>df1</span></code><span style="white-space: pre-wrap;"> is LEA-6H)</span></p></figcaption></figure><h3 id="uptime-1">Uptime</h3><p>Here we plot the same graph, but showing &#x201C;null&#x201D; values as zero. We see the Notecarrier-Pi drops a lot more data.</p><p>Summary:</p><ul><li>LEA-6H Error Uptime: 100% (8639/8639)</li><li>Notecarrier-A-v1.7 Error Uptime: 86.595671% (7481/8639) i.e. ~1000 dropped datapoints</li></ul><figure class="kg-card kg-image-card"><img src="https://maroukis.net/content/images/2024/01/Untitled-3-2.png" class="kg-image" alt="Comparison of GPS Modules: UBlox LEA-6H vs Blues Wireless Notecarriers" loading="lazy" width="630" height="470" srcset="https://maroukis.net/content/images/size/w600/2024/01/Untitled-3-2.png 600w, https://maroukis.net/content/images/2024/01/Untitled-3-2.png 630w"></figure><h3 id="number-of-satellites-1">Number of Satellites</h3><blockquote>Same as before, Notecarrier gets a fix on less satellites</blockquote><figure class="kg-card kg-gallery-card kg-width-wide"><div class="kg-gallery-container"><div class="kg-gallery-row"><div class="kg-gallery-image"><img src="https://maroukis.net/content/images/2024/01/Untitled-10.png" width="626" height="475" loading="lazy" alt="Comparison of GPS Modules: UBlox LEA-6H vs Blues Wireless Notecarriers" srcset="https://maroukis.net/content/images/size/w600/2024/01/Untitled-10.png 600w, https://maroukis.net/content/images/2024/01/Untitled-10.png 626w"></div><div class="kg-gallery-image"><img src="https://maroukis.net/content/images/2024/01/Screenshot_2023-11-06_at_4.31.50_PM-1.png" width="702" height="990" loading="lazy" alt="Comparison of GPS Modules: UBlox LEA-6H vs Blues Wireless Notecarriers" srcset="https://maroukis.net/content/images/size/w600/2024/01/Screenshot_2023-11-06_at_4.31.50_PM-1.png 600w, https://maroukis.net/content/images/2024/01/Screenshot_2023-11-06_at_4.31.50_PM-1.png 702w"></div></div></div></figure><figure class="kg-card kg-image-card"><img src="https://maroukis.net/content/images/2024/01/Untitled-11.png" class="kg-image" alt="Comparison of GPS Modules: UBlox LEA-6H vs Blues Wireless Notecarriers" loading="lazy" width="997" height="521" srcset="https://maroukis.net/content/images/size/w600/2024/01/Untitled-11.png 600w, https://maroukis.net/content/images/2024/01/Untitled-11.png 997w" sizes="(min-width: 720px) 720px"></figure><h2 id="lea-6h-vs-notecarrier-a-v20-w-gps-chip-antenna">LEA-6H vs. Notecarrier-A-v2.0 w/ GPS Chip Antenna</h2><pre><code>Summary for LEA:
Rows:  8638
Error Uptime (): 99.120167% (8562/8638)
Satellites Uptime (): 99.12016670525584% (8562/8638)

Summary for Notecard:
Rows:  8639
Error Uptime (): 94.281746% (8145/8639)
Satellites Uptime (): 100.0% (8639/8639)
</code></pre>
<h3 id="errordistance-comparison-2">Error/Distance Comparison</h3><p>The updated v2.0 notecarrier is very precise, so much that you can barely see its range of values when plotted on top of the Ublox module.</p><figure class="kg-card kg-image-card"><img src="https://maroukis.net/content/images/2024/01/Untitled-12-1.png" class="kg-image" alt="Comparison of GPS Modules: UBlox LEA-6H vs Blues Wireless Notecarriers" loading="lazy" width="627" height="475" srcset="https://maroukis.net/content/images/size/w600/2024/01/Untitled-12-1.png 600w, https://maroukis.net/content/images/2024/01/Untitled-12-1.png 627w"></figure><p>Zooming in on the &#x201C;error&#x201D; of the Notecarrier A v2.0 shows that its <strong>precise within 0.9 to 1.1 meters for all ~8k samples</strong></p><figure class="kg-card kg-image-card"><img src="https://maroukis.net/content/images/2024/01/Untitled-2-2.png" class="kg-image" alt="Comparison of GPS Modules: UBlox LEA-6H vs Blues Wireless Notecarriers" loading="lazy" width="630" height="475" srcset="https://maroukis.net/content/images/size/w600/2024/01/Untitled-2-2.png 600w, https://maroukis.net/content/images/2024/01/Untitled-2-2.png 630w"></figure><h3 id="uptime-2">Uptime</h3><p>We still want to see the signal uptime for the notecard, which is also improved (less datapoints at 0dB SNR for the bottom plot).</p><figure class="kg-card kg-image-card kg-card-hascaption"><img src="https://maroukis.net/content/images/2024/01/Untitled-4-1.png" class="kg-image" alt="Comparison of GPS Modules: UBlox LEA-6H vs Blues Wireless Notecarriers" loading="lazy" width="630" height="470" srcset="https://maroukis.net/content/images/size/w600/2024/01/Untitled-4-1.png 600w, https://maroukis.net/content/images/2024/01/Untitled-4-1.png 630w"><figcaption><span style="white-space: pre-wrap;">The notecarrier v2 shows less dropped samples in bottom plot.</span></figcaption></figure><h3 id="satellites">Satellites</h3><p>The Notecarrier is still only looking at between 3-9 satellites on average.</p><figure class="kg-card kg-image-card"><img src="https://maroukis.net/content/images/2024/01/Untitled-13.png" class="kg-image" alt="Comparison of GPS Modules: UBlox LEA-6H vs Blues Wireless Notecarriers" loading="lazy" width="626" height="475" srcset="https://maroukis.net/content/images/size/w600/2024/01/Untitled-13.png 600w, https://maroukis.net/content/images/2024/01/Untitled-13.png 626w"></figure><p>Time series:</p><figure class="kg-card kg-image-card"><img src="https://maroukis.net/content/images/2024/01/Untitled-14.png" class="kg-image" alt="Comparison of GPS Modules: UBlox LEA-6H vs Blues Wireless Notecarriers" loading="lazy" width="997" height="521" srcset="https://maroukis.net/content/images/size/w600/2024/01/Untitled-14.png 600w, https://maroukis.net/content/images/2024/01/Untitled-14.png 997w" sizes="(min-width: 720px) 720px"></figure>]]></content:encoded></item><item><title><![CDATA[Realtime Plotting of Sensor Data with MQTT and Python]]></title><description><![CDATA[Real time visualization of sensor data using ESP32 and RaspberryPi over WiFi and MQTT. Graphing is done with the funcanimate function in matplotlib.]]></description><link>https://maroukis.net/realtime-plotter/</link><guid isPermaLink="false">65ad10613fccef0b4a91d919</guid><category><![CDATA[⚡Electronics]]></category><category><![CDATA[🐍Python]]></category><dc:creator><![CDATA[Spencer Maroukis]]></dc:creator><pubDate>Mon, 11 Sep 2023 07:33:00 GMT</pubDate><media:content url="https://maroukis.net/content/images/2024/02/sshot_realtime_plotter.png" medium="image"/><content:encoded><![CDATA[<img src="https://maroukis.net/content/images/2024/02/sshot_realtime_plotter.png" alt="Realtime Plotting of Sensor Data with MQTT and Python"><p>The project demonstrares real time plotting of sensor data using MQTT. A Rasperry Pi functions as a MQTT broker listening to a specified topic, and the concurrent (using threads) python code logs incoming data to a csv file and concurrently plots the data in real time with matplotlib. </p><p>All the code and examples are at <a href="https://github.com/smaroukis/realtime-plotter?ref=maroukis.net" rel="noreferrer">smaroukis/realtime-plotter</a>.</p><p><strong>Scope</strong>:</p><ul><li>Setting up a mosquitto MQTT broker on the RasPi</li><li>Creating a Plotter wrapper class for the <code>matplotlib</code> <code>animatefunc</code> function</li><li>edge device code in C++/Arduino on an ESP32 to take sensor readings and send as MQTT messages to the broker</li><li>Python code to handle multiple concurrent processes using the threading library, as well as using the <code>matplotlib</code> <code>funcanimate</code> function to update a plot on the fly</li><li>Concurrently saves the data in csv or json to the disk </li></ul><p>Demo video using a temperature sensor and covering it with my finger to affect the reading:</p><figure class="kg-card kg-video-card kg-width-regular kg-card-hascaption" data-kg-thumbnail="https://maroukis.net/content/media/2024/02/2023-09-09-live-graph-trimmed_thumb.jpg" data-kg-custom-thumbnail>
            <div class="kg-video-container">
                <video src="https://maroukis.net/content/media/2024/02/2023-09-09-live-graph-trimmed.mp4" poster="https://img.spacergif.org/v1/3420x2224/0a/spacer.png" width="3420" height="2224" loop autoplay muted playsinline preload="metadata" style="background: transparent url(&apos;https://maroukis.net/content/media/2024/02/2023-09-09-live-graph-trimmed_thumb.jpg&apos;) 50% 50% / cover no-repeat;"></video>
                <div class="kg-video-overlay">
                    <button class="kg-video-large-play-icon" aria-label="Play video">
                        <svg xmlns="http://www.w3.org/2000/svg" viewbox="0 0 24 24">
                            <path d="M23.14 10.608 2.253.164A1.559 1.559 0 0 0 0 1.557v20.887a1.558 1.558 0 0 0 2.253 1.392L23.14 13.393a1.557 1.557 0 0 0 0-2.785Z"/>
                        </svg>
                    </button>
                </div>
                <div class="kg-video-player-container kg-video-hide">
                    <div class="kg-video-player">
                        <button class="kg-video-play-icon" aria-label="Play video">
                            <svg xmlns="http://www.w3.org/2000/svg" viewbox="0 0 24 24">
                                <path d="M23.14 10.608 2.253.164A1.559 1.559 0 0 0 0 1.557v20.887a1.558 1.558 0 0 0 2.253 1.392L23.14 13.393a1.557 1.557 0 0 0 0-2.785Z"/>
                            </svg>
                        </button>
                        <button class="kg-video-pause-icon kg-video-hide" aria-label="Pause video">
                            <svg xmlns="http://www.w3.org/2000/svg" viewbox="0 0 24 24">
                                <rect x="3" y="1" width="7" height="22" rx="1.5" ry="1.5"/>
                                <rect x="14" y="1" width="7" height="22" rx="1.5" ry="1.5"/>
                            </svg>
                        </button>
                        <span class="kg-video-current-time">0:00</span>
                        <div class="kg-video-time">
                            /<span class="kg-video-duration">0:06</span>
                        </div>
                        <input type="range" class="kg-video-seek-slider" max="100" value="0">
                        <button class="kg-video-playback-rate" aria-label="Adjust playback speed">1&#xD7;</button>
                        <button class="kg-video-unmute-icon" aria-label="Unmute">
                            <svg xmlns="http://www.w3.org/2000/svg" viewbox="0 0 24 24">
                                <path d="M15.189 2.021a9.728 9.728 0 0 0-7.924 4.85.249.249 0 0 1-.221.133H5.25a3 3 0 0 0-3 3v2a3 3 0 0 0 3 3h1.794a.249.249 0 0 1 .221.133 9.73 9.73 0 0 0 7.924 4.85h.06a1 1 0 0 0 1-1V3.02a1 1 0 0 0-1.06-.998Z"/>
                            </svg>
                        </button>
                        <button class="kg-video-mute-icon kg-video-hide" aria-label="Mute">
                            <svg xmlns="http://www.w3.org/2000/svg" viewbox="0 0 24 24">
                                <path d="M16.177 4.3a.248.248 0 0 0 .073-.176v-1.1a1 1 0 0 0-1.061-1 9.728 9.728 0 0 0-7.924 4.85.249.249 0 0 1-.221.133H5.25a3 3 0 0 0-3 3v2a3 3 0 0 0 3 3h.114a.251.251 0 0 0 .177-.073ZM23.707 1.706A1 1 0 0 0 22.293.292l-22 22a1 1 0 0 0 0 1.414l.009.009a1 1 0 0 0 1.405-.009l6.63-6.631A.251.251 0 0 1 8.515 17a.245.245 0 0 1 .177.075 10.081 10.081 0 0 0 6.5 2.92 1 1 0 0 0 1.061-1V9.266a.247.247 0 0 1 .073-.176Z"/>
                            </svg>
                        </button>
                        <input type="range" class="kg-video-volume-slider" max="100" value="100">
                    </div>
                </div>
            </div>
            <figcaption><p><span style="white-space: pre-wrap;">Showing real time plotting of a temperature sensor broadcasted via MQTT to a RasPi which is plotting the data using a matplotlib </span><code spellcheck="false" style="white-space: pre-wrap;"><span>funcanimate</span></code><span style="white-space: pre-wrap;"> function.</span></p></figcaption>
        </figure><h2 id="readme-description">Readme Description</h2><p>Real time data logging to csv and concurrent plotting with matplotlib, creating an mqtt client to listen to the specified topic on a specified mqtt broker/host.</p>
<p>Logger is under <code>raspi/app_logger/app.py</code>. For example:</p>
<pre><code class="language-sh">python raspi/app_logger/app.py -t # -d -h 192.168.0.17 -g 
</code></pre>
<blockquote>
<p>i.e. &quot;all topics (&quot;#&quot;), for mqtt broker on host 192.168.0.17, include plotting (-g)</p>
</blockquote>
<p>Seperate threads and callbacks are made for plotting and writing to the datafile</p>
<ul>
<li><code>log_worker</code> empties the data-to-log queue every 2 seconds</li>
<li><code>plotter.update</code> is the <code>matplotlib.animate.funcanimation</code> function that updates the graph every provided <code>interval</code> (also has a queue to process data)</li>
</ul>
<p>Esp32 code for sensor and mqtt client/publishing is also included.</p>
<h2 id="setting-up-the-esp32-sensor">Setting Up the ESP32 sensor</h2>
<p>A BME temperature sensor is used over Two-Wire/I2C.</p>
<h2 id="setting-up-the-raspimqtt-broker">Setting up the RasPi/MQTT Broker</h2>
<p><strong>On local machine</strong>:</p>
<pre><code># use SSH from a terminal to get into the Pi server
ssh pi@raspberrypi.local 
# ... enter user/pass ...
</code></pre>
<p><strong>In a server terminal (or after SSHing in)</strong>:</p>
<pre><code># print IP address (should match the one in `secrets.h`)
hostname -I 
# ...
# check the `mosquitto` status:
systemctl status mosquitto.service 
# ... if status is running try:
mosquitto_pub -d -t inTopic -m &quot;ON&quot; 
# which should turn the builtin on the ESP32 ON if it is OFF
</code></pre>
<blockquote>
<p>If necessary restart the mosquitto service with<br>
<code>sudo systemctl restart mosquitto</code></p>
</blockquote>
<blockquote>
<p>If we want to see the <code>outTopic</code> responses from the ESP32 we can open up another terminal on the MQTT broker and subscripe to this topic e.g.<br>
<code>mosquitto_sub -d -t outTopic</code><br>
Or to subscribe to all topics do:<br>
<code>mosquitto_sub -d -t &quot;#&quot;</code></p>
</blockquote>
<p><strong>Notes/Gotchas</strong></p>
<ul>
<li>the mosquitto broker has to be configured to accept anonymous connections (disabled by default)</li>
<li>put the ESP32 in &quot;flash&quot; mode by (1) pressing and holding BOOT (2) pressing and releasing ENABLE (3) releasing BOOT</li>
</ul>
<h1 id="code-descriptionesp32">Code Description - ESP32</h1>
<p>Overview:</p>
<ul>
<li>publishes values to topic as e.g. <code>GATEWAY_ID/DEVICE_ID/temperature/32.0</code></li>
<li>was implemented using C style strings, should probably be refactored to smart pointers and std library strings</li>
<li>currently implemented publishing from a bme280 temperature and humidity sensor (via Adafruit libary)</li>
</ul>
<h2 id="mqtthelper"><code>mqttHelper</code></h2>
<p>Establishes a connection to an MQTT broker, subscribes to specific topics, and publishes sensor data to MQTT topics.  including potential buffer overflow issues when dealing with large float values, minimal error handling, and limited documentation. Additionally, it lacks configurability for MQTT client parameters, making it less flexible for different MQTT broker setups</p>
<p>Need to add more error handling and confirugability for different MQTT client parameters (e.g. name, etc).</p>
<h2 id="wifihelper"><code>wifiHelper</code></h2>
<p>Sets up wifi with the <code>WiFi.h</code> library.</p>
<h2 id></h2>]]></content:encoded></item><item><title><![CDATA[Electrical Schematics for Campervan Systems]]></title><description><![CDATA[Various schematics created in AutoCAD Electrical for the design of a low voltage electrical system for camper vans.]]></description><link>https://maroukis.net/van-schematics/</link><guid isPermaLink="false">65a9227d07b967049a36e7f9</guid><category><![CDATA[⚡Power Systems]]></category><category><![CDATA[📐AutoCAD]]></category><dc:creator><![CDATA[Spencer Maroukis]]></dc:creator><pubDate>Thu, 01 Jun 2023 00:00:00 GMT</pubDate><media:content url="https://maroukis.net/content/images/2024/01/website_Elec-Design-Examples.jpg" medium="image"/><content:encoded><![CDATA[<img src="https://maroukis.net/content/images/2024/01/website_Elec-Design-Examples.jpg" alt="Electrical Schematics for Campervan Systems"><p>I&apos;ve worked on a couple projects creating electrical schematics for campervans. Using AutoCAD Electrical I created professional-grade schematics detailing the installation (done by yours truly) and protection schemes of the system.</p><p>Here are parts of various AutoCAD Electrical diagrams I created as part of these projects.</p><blockquote>See <a href="https://van.maroukis.net/06-electrical-systems?ref=maroukis.net">https://van.maroukis.net/06-electrical-systems</a> for system diagrams, also included here</blockquote><p>Example 12V Distribution: <a href="https://van.maroukis.net/img/screen-12v.png?ref=maroukis.net">https://van.maroukis.net/img/screen-12v.png</a></p><figure class="kg-card kg-image-card"><img src="https://maroukis.net/content/images/2024/01/img-_C219-Course-Autocad-Electrical-Essentials-Linkedin-Learning--.png" class="kg-image" alt="Electrical Schematics for Campervan Systems" loading="lazy" width="2000" height="1196" srcset="https://maroukis.net/content/images/size/w600/2024/01/img-_C219-Course-Autocad-Electrical-Essentials-Linkedin-Learning--.png 600w, https://maroukis.net/content/images/size/w1000/2024/01/img-_C219-Course-Autocad-Electrical-Essentials-Linkedin-Learning--.png 1000w, https://maroukis.net/content/images/size/w1600/2024/01/img-_C219-Course-Autocad-Electrical-Essentials-Linkedin-Learning--.png 1600w, https://maroukis.net/content/images/2024/01/img-_C219-Course-Autocad-Electrical-Essentials-Linkedin-Learning--.png 2004w" sizes="(min-width: 720px) 720px"></figure><p>Example Main Battery Compartment: <a href="https://van.maroukis.net/img/screen-main-bat.png?ref=maroukis.net">https://van.maroukis.net/img/screen-main-bat.png</a></p><figure class="kg-card kg-image-card"><img src="https://maroukis.net/content/images/2024/01/img-_C219-Course-Autocad-Electrical-Essentials-Linkedin-Learning---1.png" class="kg-image" alt="Electrical Schematics for Campervan Systems" loading="lazy" width="2000" height="1122" srcset="https://maroukis.net/content/images/size/w600/2024/01/img-_C219-Course-Autocad-Electrical-Essentials-Linkedin-Learning---1.png 600w, https://maroukis.net/content/images/size/w1000/2024/01/img-_C219-Course-Autocad-Electrical-Essentials-Linkedin-Learning---1.png 1000w, https://maroukis.net/content/images/size/w1600/2024/01/img-_C219-Course-Autocad-Electrical-Essentials-Linkedin-Learning---1.png 1600w, https://maroukis.net/content/images/2024/01/img-_C219-Course-Autocad-Electrical-Essentials-Linkedin-Learning---1.png 2154w" sizes="(min-width: 720px) 720px"></figure><p>Example AC system: <a href="https://van.maroukis.net/img/screen-ac.png?ref=maroukis.net">https://van.maroukis.net/img/screen-ac.png</a></p><figure class="kg-card kg-image-card"><img src="https://maroukis.net/content/images/2024/01/img-_C219-Course-Autocad-Electrical-Essentials-Linkedin-Learning---2.png" class="kg-image" alt="Electrical Schematics for Campervan Systems" loading="lazy" width="1914" height="1024" srcset="https://maroukis.net/content/images/size/w600/2024/01/img-_C219-Course-Autocad-Electrical-Essentials-Linkedin-Learning---2.png 600w, https://maroukis.net/content/images/size/w1000/2024/01/img-_C219-Course-Autocad-Electrical-Essentials-Linkedin-Learning---2.png 1000w, https://maroukis.net/content/images/size/w1600/2024/01/img-_C219-Course-Autocad-Electrical-Essentials-Linkedin-Learning---2.png 1600w, https://maroukis.net/content/images/2024/01/img-_C219-Course-Autocad-Electrical-Essentials-Linkedin-Learning---2.png 1914w" sizes="(min-width: 720px) 720px"></figure><p>Example Battery Display and Protective Relay Wiring: <a href="https://van.maroukis.net/img/screen-bmv.png?ref=maroukis.net">https://van.maroukis.net/img/screen-bmv.png</a></p><figure class="kg-card kg-image-card"><img src="https://maroukis.net/content/images/2024/01/img-_C219-Course-Autocad-Electrical-Essentials-Linkedin-Learning---3.png" class="kg-image" alt="Electrical Schematics for Campervan Systems" loading="lazy" width="1350" height="604" srcset="https://maroukis.net/content/images/size/w600/2024/01/img-_C219-Course-Autocad-Electrical-Essentials-Linkedin-Learning---3.png 600w, https://maroukis.net/content/images/size/w1000/2024/01/img-_C219-Course-Autocad-Electrical-Essentials-Linkedin-Learning---3.png 1000w, https://maroukis.net/content/images/2024/01/img-_C219-Course-Autocad-Electrical-Essentials-Linkedin-Learning---3.png 1350w" sizes="(min-width: 720px) 720px"></figure><figure class="kg-card kg-image-card kg-card-hascaption"><img src="https://maroukis.net/content/images/2024/01/bmv-relay-circuit.png" class="kg-image" alt="Electrical Schematics for Campervan Systems" loading="lazy" width="2000" height="1619" srcset="https://maroukis.net/content/images/size/w600/2024/01/bmv-relay-circuit.png 600w, https://maroukis.net/content/images/size/w1000/2024/01/bmv-relay-circuit.png 1000w, https://maroukis.net/content/images/size/w1600/2024/01/bmv-relay-circuit.png 1600w, https://maroukis.net/content/images/2024/01/bmv-relay-circuit.png 2014w" sizes="(min-width: 720px) 720px"><figcaption><span style="white-space: pre-wrap;">Annotated for description. The Victron 712 Smart BMV has a NO relay that drives the Blue Sea Systems ML-RBS Contura Switch &quot;+12V to close&quot; line (Brown wire). This relay is activated by an undervoltage condition and is a last-stop measure to protect the batteries from being over discharged.</span></figcaption></figure>]]></content:encoded></item><item><title><![CDATA[DIY Off Grid Campervan Conversion]]></title><description><![CDATA[Adventures in converting a stripped out cargo van into a off-grid campervan.]]></description><link>https://maroukis.net/campervan/</link><guid isPermaLink="false">65a73f3f80adc71d5d282261</guid><category><![CDATA[🛠️DIY]]></category><category><![CDATA[📐AutoCAD]]></category><category><![CDATA[🚐Campervan/RV]]></category><dc:creator><![CDATA[Spencer Maroukis]]></dc:creator><pubDate>Thu, 20 Apr 2023 02:06:00 GMT</pubDate><media:content url="https://maroukis.net/content/images/2024/01/10-header-cropped.jpg" medium="image"/><content:encoded><![CDATA[<img src="https://maroukis.net/content/images/2024/01/10-header-cropped.jpg" alt="DIY Off Grid Campervan Conversion"><p>Over two years my partner and I took a bare metal cargo van and converted it to an off-grid camper van including running water, an <a href="https://van.maroukis.net/08-shower-toilet-heater?ref=maroukis.net">indoor shower</a>, a <a href="https://van.maroukis.net/04-ceiling-skylight-fan?ref=maroukis.net">skylight</a>, <a href="https://van.maroukis.net/06-electrical-systems?ref=maroukis.net">solar powered</a> induction cooktop, <a href="https://van.maroukis.net/water-heater?ref=maroukis.net">engine-heated hot water</a>, and more.</p><p>Of note was the focus on going propane-less by using the engine coolant as a hot water heater and installing 600W of solar on the roof with 380Ah of Litihum Iron Phosphate batteries to power an induction stove.</p><hr><p>A full project website has been built to share the work and help other builders out there: </p><figure class="kg-card kg-bookmark-card"><a class="kg-bookmark-container" href="https://van.maroukis.net/?ref=maroukis.net"><div class="kg-bookmark-content"><div class="kg-bookmark-title">Off-Grid Van Conversion &#x2013;</div><div class="kg-bookmark-description">An off-grid campervan with a Japanese-farmhouse aeshtetic.</div><div class="kg-bookmark-metadata"><img class="kg-bookmark-icon" src="https://van.maroukis.net/img/favicon.png" alt="DIY Off Grid Campervan Conversion"></div></div><div class="kg-bookmark-thumbnail"><img src="https://van.maroukis.net/img/social.jpg" alt="DIY Off Grid Campervan Conversion"></div></a></figure><hr><figure class="kg-card kg-gallery-card kg-width-wide"><div class="kg-gallery-container"><div class="kg-gallery-row"><div class="kg-gallery-image"><img src="https://maroukis.net/content/images/2024/01/hardwood-2.jpeg" width="1200" height="900" loading="lazy" alt="DIY Off Grid Campervan Conversion" srcset="https://maroukis.net/content/images/size/w600/2024/01/hardwood-2.jpeg 600w, https://maroukis.net/content/images/size/w1000/2024/01/hardwood-2.jpeg 1000w, https://maroukis.net/content/images/2024/01/hardwood-2.jpeg 1200w" sizes="(min-width: 720px) 720px"></div><div class="kg-gallery-image"><img src="https://maroukis.net/content/images/2024/01/about-finished.jpg" width="1200" height="900" loading="lazy" alt="DIY Off Grid Campervan Conversion" srcset="https://maroukis.net/content/images/size/w600/2024/01/about-finished.jpg 600w, https://maroukis.net/content/images/size/w1000/2024/01/about-finished.jpg 1000w, https://maroukis.net/content/images/2024/01/about-finished.jpg 1200w" sizes="(min-width: 720px) 720px"></div><div class="kg-gallery-image"><img src="https://maroukis.net/content/images/2024/01/final-kitchen.jpg" width="1200" height="900" loading="lazy" alt="DIY Off Grid Campervan Conversion" srcset="https://maroukis.net/content/images/size/w600/2024/01/final-kitchen.jpg 600w, https://maroukis.net/content/images/size/w1000/2024/01/final-kitchen.jpg 1000w, https://maroukis.net/content/images/2024/01/final-kitchen.jpg 1200w" sizes="(min-width: 720px) 720px"></div></div><div class="kg-gallery-row"><div class="kg-gallery-image"><img src="https://maroukis.net/content/images/2024/01/10-header-carousel.jpg" width="1200" height="900" loading="lazy" alt="DIY Off Grid Campervan Conversion" srcset="https://maroukis.net/content/images/size/w600/2024/01/10-header-carousel.jpg 600w, https://maroukis.net/content/images/size/w1000/2024/01/10-header-carousel.jpg 1000w, https://maroukis.net/content/images/2024/01/10-header-carousel.jpg 1200w" sizes="(min-width: 720px) 720px"></div><div class="kg-gallery-image"><img src="https://maroukis.net/content/images/2024/01/ladder-tire-rack-outside-shower.jpg" width="1200" height="900" loading="lazy" alt="DIY Off Grid Campervan Conversion" srcset="https://maroukis.net/content/images/size/w600/2024/01/ladder-tire-rack-outside-shower.jpg 600w, https://maroukis.net/content/images/size/w1000/2024/01/ladder-tire-rack-outside-shower.jpg 1000w, https://maroukis.net/content/images/2024/01/ladder-tire-rack-outside-shower.jpg 1200w" sizes="(min-width: 720px) 720px"></div></div></div></figure><p></p><p></p>]]></content:encoded></item><item><title><![CDATA[Temporary Microgrid Design and Test Procedures]]></title><description><![CDATA[How do you provide power to a remote area when you lose access to the transmission system? Bring in the diesel gen-sets and re-do all the equipment settings.]]></description><link>https://maroukis.net/microgrid/</link><guid isPermaLink="false">65b9b4843fccef0b4a91d9d9</guid><category><![CDATA[⚡Power Systems]]></category><dc:creator><![CDATA[Spencer Maroukis]]></dc:creator><pubDate>Fri, 01 May 2020 00:00:00 GMT</pubDate><media:content url="https://maroukis.net/content/images/2024/01/IMG_1952.JPG" medium="image"/><content:encoded><![CDATA[<img src="https://maroukis.net/content/images/2024/01/IMG_1952.JPG" alt="Temporary Microgrid Design and Test Procedures"><p>This post details the engineering procedure of designing, developing a test program, and commissioning a temporary, 12kV-connected microgrid to support transmission work or a substation replacement.</p><p>The necessity of the a temporary microgrid comes from maintenance or emergencies in the electric grid system that renders a substation unable to provide power to the area. This could be due to transmission line work on a sparsely-connected grid system or due to emergency failure of substation equipment.</p><p>The project has a few main steps</p><ol><li>Look for alternative solutions to temporary generators&#x2013; can the load be supported by other distribution backties in the area? What if we just did the work during the night during low loads? Many times it is historical evidence that provides the justification &#x2013; &quot;we tried to offload the substation to the local network but we received many voltage complaints from customers&quot;. The power flow simulation software can only do so much and power engineers should lean on the side of safety and avoid pushing the system to its limits, especially for untried situations.</li><li>Feeder load calculations for the substation offload &#x2013; to determine the amount of generation we need to procure, we look at historical loads for the area around this same season and take into account any system abnormalities, weather, or other reasons that the load might be different in the future. We also take into account minimum load requirements, reactive power flow, and the three-phase load balance of the system. </li></ol><figure class="kg-card kg-image-card kg-card-hascaption"><img src="https://maroukis.net/content/images/2024/01/Screenshot-2024-01-31-at-12.01.49-PM.png" class="kg-image" alt="Temporary Microgrid Design and Test Procedures" loading="lazy" width="1052" height="620" srcset="https://maroukis.net/content/images/size/w600/2024/01/Screenshot-2024-01-31-at-12.01.49-PM.png 600w, https://maroukis.net/content/images/size/w1000/2024/01/Screenshot-2024-01-31-at-12.01.49-PM.png 1000w, https://maroukis.net/content/images/2024/01/Screenshot-2024-01-31-at-12.01.49-PM.png 1052w" sizes="(min-width: 720px) 720px"><figcaption><span style="white-space: pre-wrap;">Looking at historical loads to determine the expected peak value during the microgrid deployment.</span></figcaption></figure><p>The generators also need a minimum amount of load to prevent &quot;wetstacking&quot;. For example, the total minimum load should be greater than 30% of the total rated nameplate. </p><p>Also further de-rating of the generator is required if a majority of the load is single phase, which often happens in the same areas that have weak backties and require this type of work.</p><p>In addition to current, we must also take into account the power factor and VARs on the system. Typically diesel generators don&apos;t run too well supplying power to capacitive loads (leading power factor) and a &quot;maximum reverse kVAR&quot; will be supplied by the manufacturer. </p><figure class="kg-card kg-image-card kg-card-hascaption"><img src="https://maroukis.net/content/images/2024/01/Screenshot-2024-01-31-at-12.13.21-PM.png" class="kg-image" alt="Temporary Microgrid Design and Test Procedures" loading="lazy" width="1582" height="1094" srcset="https://maroukis.net/content/images/size/w600/2024/01/Screenshot-2024-01-31-at-12.13.21-PM.png 600w, https://maroukis.net/content/images/size/w1000/2024/01/Screenshot-2024-01-31-at-12.13.21-PM.png 1000w, https://maroukis.net/content/images/2024/01/Screenshot-2024-01-31-at-12.13.21-PM.png 1582w" sizes="(min-width: 720px) 720px"><figcaption><span style="white-space: pre-wrap;">Cummins synchronous machine capability curve. The generator is more stable exporting VARs (supply a lagging system) than it is absorbing VARs (supplying a leading system).</span></figcaption></figure><ol start="3"><li>Fault calculations and revised system settings &#x2013; since we will be disconnected from the transmission system, our fault duty will be reduced. We have to look at the data sheet of the generators and see how much fault current they will contribute to a bolted fault. We model this in our power flow simulation software to see what the minimum fault current seen down the line and have to check that our protective equipment will trip for this amount of current.</li></ol><figure class="kg-card kg-image-card kg-card-hascaption"><img src="https://maroukis.net/content/images/2024/01/Screenshot-2024-01-31-at-12.07.54-PM.png" class="kg-image" alt="Temporary Microgrid Design and Test Procedures" loading="lazy" width="1156" height="1440" srcset="https://maroukis.net/content/images/size/w600/2024/01/Screenshot-2024-01-31-at-12.07.54-PM.png 600w, https://maroukis.net/content/images/size/w1000/2024/01/Screenshot-2024-01-31-at-12.07.54-PM.png 1000w, https://maroukis.net/content/images/2024/01/Screenshot-2024-01-31-at-12.07.54-PM.png 1156w" sizes="(min-width: 720px) 720px"><figcaption><span style="white-space: pre-wrap;">Example fault calculations to determine the zero, positive, and negative sequence reactances that allows us to model the system.</span></figcaption></figure><blockquote>Generator specs: The generator used was a 480V 4-pole 60 Hz generator is powered by a Cummins diesel prime mover. The three-phase synchronous generator has a separately excited permanent magnetic generator for field excitation. The generator is stepped up to the distribution &quot;primary&quot; voltage by appropriate step up transformers. </blockquote><ol start="4"><li>Single Line Diagram creation &#x2013; Once the number and size of generators is chosen, a schematic is created to show the connection to the existing system</li></ol><figure class="kg-card kg-image-card"><img src="https://maroukis.net/content/images/2024/01/Screenshot-2024-01-31-at-11.49.13-AM.png" class="kg-image" alt="Temporary Microgrid Design and Test Procedures" loading="lazy" width="1698" height="1088" srcset="https://maroukis.net/content/images/size/w600/2024/01/Screenshot-2024-01-31-at-11.49.13-AM.png 600w, https://maroukis.net/content/images/size/w1000/2024/01/Screenshot-2024-01-31-at-11.49.13-AM.png 1000w, https://maroukis.net/content/images/size/w1600/2024/01/Screenshot-2024-01-31-at-11.49.13-AM.png 1600w, https://maroukis.net/content/images/2024/01/Screenshot-2024-01-31-at-11.49.13-AM.png 1698w" sizes="(min-width: 720px) 720px"></figure><ol start="5"><li>Test Program &#x2013; one of the most critical points is writing a test program for the operators to execute that makes sure the temporary generator(s) are safely connected and disconnected from the grid. This involves detailed steps on open/close/test operations for the field personnel. The test program will depend on whether the generators are synchronizing into the existing distribution system or supplying an islanded system. </li><li>Construction &#x2013; construction should be verified to align with the schematic. An important consideration is the grounding scheme, since many times there may not be a substation grounding grid to tie into, and a new multi-point grounding grid should be created that can handle the fault duty. Soil tests should be performed to make sure the resistance is adequately low enough to provide a good fault path.</li></ol><figure class="kg-card kg-image-card"><img src="https://maroukis.net/content/images/2024/01/IMG_1954.JPG" class="kg-image" alt="Temporary Microgrid Design and Test Procedures" loading="lazy" width="2000" height="1500" srcset="https://maroukis.net/content/images/size/w600/2024/01/IMG_1954.JPG 600w, https://maroukis.net/content/images/size/w1000/2024/01/IMG_1954.JPG 1000w, https://maroukis.net/content/images/size/w1600/2024/01/IMG_1954.JPG 1600w, https://maroukis.net/content/images/size/w2400/2024/01/IMG_1954.JPG 2400w" sizes="(min-width: 720px) 720px"></figure><ol start="7"><li>Commissioning and Operations - once the site is constructed and the test program is approved, ideally the engineer who designed the program will be on-site for the commissioning. I was lucky enough to have this opportunity a few times, and typically I would monitor the loads and voltages to make sure they were in line with what I had calculated for that hour of the day. It&apos;s a good idea to check the loads and voltages during peak to make sure the voltage regulator on the generator is working properly.</li></ol>]]></content:encoded></item></channel></rss>