<?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:cc="http://cyber.law.harvard.edu/rss/creativeCommonsRssModule.html">
    <channel>
        <title><![CDATA[Stories by Nipun Dharmarathne on Medium]]></title>
        <description><![CDATA[Stories by Nipun Dharmarathne on Medium]]></description>
        <link>https://medium.com/@nipundharmarathne?source=rss-7ba13af8badd------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/1*8BxpiwdGSkub_i1FALRhwg.jpeg</url>
            <title>Stories by Nipun Dharmarathne on Medium</title>
            <link>https://medium.com/@nipundharmarathne?source=rss-7ba13af8badd------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Sat, 05 Dec 2026 17:12:34 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@nipundharmarathne/feed" rel="self" type="application/rss+xml"/>
        <webMaster><![CDATA[yourfriends@medium.com]]></webMaster>
        <atom:link href="http://medium.superfeedr.com/" rel="hub"/>
        <item>
            <title><![CDATA[Why Adding Delays Didn’t Fix My UART Data Loss: Understanding Hardware Flow Control]]></title>
            <link>https://medium.com/h7w/why-adding-delays-didnt-fix-my-uart-data-loss-understanding-hardware-flow-control-abc84414e9ca?source=rss-7ba13af8badd------2</link>
            <guid isPermaLink="false">https://medium.com/p/abc84414e9ca</guid>
            <category><![CDATA[embedded-systems]]></category>
            <category><![CDATA[serial-communication]]></category>
            <category><![CDATA[lora]]></category>
            <category><![CDATA[electronics]]></category>
            <category><![CDATA[uart]]></category>
            <dc:creator><![CDATA[Nipun Dharmarathne]]></dc:creator>
            <pubDate>Sat, 08 Aug 2026 10:58:55 GMT</pubDate>
            <atom:updated>2026-08-15T07:12:38.250Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Zi4phELEfrzeZXFKrJw2_w.png" /></figure><p>While working with an <strong>EBYTE E22 LoRa module</strong>, I encountered an interesting problem with UART communication.</p><p>I was sending data continuously from a laptop to the E22 through a USB-to-TTL adapter. Small amounts of data worked fine, but when sending larger amounts continuously, some data was lost.</p><p>My first solution was simple: <strong>add delays between transmissions</strong>.</p><p>It didn’t work reliably.</p><p>The solution was to use the E22’s <strong>AUX signal as a CTS-like flow-control signal</strong>.</p><h3>The Setup</h3><p>My communication path was:</p><pre>Laptop<br>   │<br>   │ USB<br>   ▼<br>USB-to-TTL Adapter<br>   │<br>   │ UART<br>   ▼<br>EBYTE E22<br>   │<br>   │ LoRa<br>   ▼<br>Remote Device</pre><p>The laptop was sending data through UART to the E22.</p><p>The important point is that <strong>UART data reception and LoRa transmission do not necessarily happen at the same rate</strong>.</p><p>The laptop can continue sending UART bytes while the E22 is still processing previously received data or transmitting data over LoRa.</p><p>Conceptually:</p><pre>Laptop<br>   │<br>   │ DATA DATA DATA DATA DATA<br>   ▼<br>  E22<br>   │<br>   │ Internal processing<br>   ▼<br>LoRa transmission</pre><p>The E22 has finite buffering and internal processing capacity. If the host continuously supplies data faster than the module can accept and process it, the available buffer can eventually become insufficient, resulting in lost data.</p><p>This is essentially a <strong>flow-control problem</strong>.</p><h3>My First Attempt: Adding Delays</h3><p>My initial solution was to add a delay after each transmission:</p><pre>ser.write(data)<br>time.sleep(0.01)</pre><p>This improved the situation in some cases, but it wasn’t reliable.</p><p>The problem is that a fixed delay is essentially a <strong>guess</strong>.</p><p>For example:</p><pre>SEND → 10 ms → SEND → 10 ms → SEND</pre><p>What if the E22 needs more than 10 ms before it can safely accept more data?</p><pre>SEND → 10 ms → E22 still busy<br>                         ↓<br>                    DATA LOSS</pre><p>I could increase the delay:</p><pre>SEND → 50 ms → SEND → 50 ms → SEND</pre><p>but now I am unnecessarily slowing down the communication if the E22 was actually ready after a shorter period.</p><p>The real problem wasn’t finding the “correct” delay.</p><p>It was that the laptop <strong>didn’t know when the E22 was actually ready to receive more data</strong>.</p><h3>From Delays to Flow Control</h3><p>This is where hardware flow control becomes useful.</p><p>Instead of telling the sender:</p><blockquote><em>“Wait 10 ms.”</em></blockquote><p>we want the receiver to be able to say:</p><blockquote><em>“I’m busy. Wait.”</em></blockquote><p>and later:</p><blockquote><em>“I’m ready. Continue.”</em></blockquote><p>Standard UART hardware flow control commonly uses <strong>RTS (Request To Send)</strong> and <strong>CTS (Clear To Send)</strong>:</p><pre>Device A                    Device B<br>────────────────────────────────────<br><br>TX  ──────────────────────&gt; RX<br>RX  &lt;────────────────────── TX<br><br>RTS ──────────────────────&gt; CTS<br>CTS &lt;────────────────────── RTS</pre><p>The control signals allow one device to indicate whether the other device should continue transmitting.</p><h3>Using the E22 AUX Signal</h3><p>The EBYTE E22 provides an <strong>AUX pin</strong> that indicates the module’s status.</p><p>In my setup, I connected the E22 AUX pin to the CTS input of my USB-to-TTL adapter:</p><pre>USB-TTL Adapter             EBYTE E22<br>─────────────────────────────────────<br><br>TXD  ────────────────────&gt;  RXD<br>RXD  &lt;────────────────────  TXD<br>GND  ─────────────────────  GND<br>CTS  &lt;────────────────────  AUX</pre><p>After doing this, the communication became much more reliable.</p><p>Instead of relying on an arbitrary delay, I was using the E22’s status as a <strong>CTS-like flow-control signal</strong>.</p><p>The concept becomes:</p><pre>E22 ready<br>   ↓<br> SEND<br>   ↓<br>E22 busy<br>   ↓<br> WAIT<br>   ↓<br>E22 ready<br>   ↓<br> SEND</pre><p>The important difference is that the waiting is now based on the module’s state rather than an arbitrary number of milliseconds.</p><h3>AUX Is Not the Same as CTS</h3><p>There is an important technical distinction here.</p><p>The E22’s <strong>AUX pin is not a standard UART CTS signal</strong>.</p><p>AUX is an <strong>E22-specific status signal</strong>. In my setup, I was using that signal as a <strong>CTS-like flow-control signal</strong>.</p><p>So it is more accurate to say:</p><blockquote>I used the E22 AUX signal as a CTS-like flow-control signal.</blockquote><p>rather than:</p><blockquote>The E22 AUX pin is CTS.</blockquote><p>This distinction matters because AUX and CTS are not inherently the same signal or protocol.</p><p>Whether this approach works depends on the <strong>USB-to-TTL adapter</strong>, its support for CTS hardware flow control, the software/driver configuration, and the electrical compatibility and signal polarity between the AUX output and CTS input.</p><h3>The General Lesson</h3><p>Although I encountered this problem with an <strong>EBYTE E22</strong>, the underlying lesson applies to UART communication in general.</p><p>UART transfers data, but it does not automatically ensure that the receiver can always process data as quickly as the sender produces it. If the sender transmits continuously while the receiver is busy, data can eventually be lost.</p><p>Adding delays can sometimes help, but a fixed delay is still just an assumption about when the receiver will be ready.</p><p>Flow control provides a better approach: instead of guessing when the receiver is ready, the sender can respond to feedback from the receiver.</p><p>The important lesson I learned wasn’t just about the E22:</p><blockquote><strong><em>Fixed delays are assumptions. Flow control is feedback.</em></strong></blockquote><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=abc84414e9ca" width="1" height="1" alt=""><hr><p><a href="https://medium.com/h7w/why-adding-delays-didnt-fix-my-uart-data-loss-understanding-hardware-flow-control-abc84414e9ca">Why Adding Delays Didn’t Fix My UART Data Loss: Understanding Hardware Flow Control</a> was originally published in <a href="https://medium.com/h7w">T3chtsz</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[I Recently Discovered ESP32 eFuses: The Feature That Can Permanently Change Your Microcontroller]]></title>
            <link>https://medium.com/h7w/i-recently-discovered-esp32-efuses-the-feature-that-can-permanently-change-your-microcontroller-d68074f1c333?source=rss-7ba13af8badd------2</link>
            <guid isPermaLink="false">https://medium.com/p/d68074f1c333</guid>
            <category><![CDATA[microcontrollers]]></category>
            <category><![CDATA[internet-of-things]]></category>
            <category><![CDATA[cybersecurity]]></category>
            <category><![CDATA[esp32]]></category>
            <category><![CDATA[embedded-systems]]></category>
            <dc:creator><![CDATA[Nipun Dharmarathne]]></dc:creator>
            <pubDate>Sun, 02 Aug 2026 03:17:36 GMT</pubDate>
            <atom:updated>2026-08-15T07:06:23.229Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*939S2lIUXv4zf0mMmmIgug.jpeg" /></figure><p>While working with ESP32 microcontrollers, I recently came across a feature that I had never paid much attention to before: <strong>eFuses</strong>.</p><p>Most ESP32 developers are familiar with flashing firmware, erasing flash memory, changing boot modes, and debugging through UART or JTAG. But hidden inside the chip is a small set of <strong>one-time programmable memory bits</strong> that can permanently change how the ESP32 behaves.</p><p>These are called <strong>eFuses</strong>.</p><p>The interesting part is that once an eFuse is burned, it cannot be reversed.</p><h3>What Are ESP32 eFuses?</h3><p>An eFuse is a hardware-level configuration bit stored inside the ESP32 chip.</p><p>Unlike normal flash memory:</p><ul><li>Flash memory can be erased and rewritten.</li><li>eFuses can only be programmed once.</li><li>The programmed state is permanent.</li></ul><p>The term <strong>eFuse</strong> is inspired by traditional electrical fuses, where a physical element is permanently changed when the fuse is triggered. However, unlike a normal fuse that uses a metal wire that melts to break a circuit, an eFuse is a tiny programmable structure inside a semiconductor chip. It can be permanently modified by applying a controlled electrical process, allowing the chip to store hardware configuration settings that cannot be changed later.</p><p>ESP32 uses eFuses for important security and hardware configuration settings.</p><h3>Why Would We Need eFuses?</h3><p>During development, we usually want maximum access:</p><ul><li>Upload new firmware anytime.</li><li>Use JTAG debugging.</li><li>Read flash contents.</li><li>Enter the ROM bootloader.</li></ul><p>However, a production device often has different requirements.</p><p>For example: Imagine an ESP32 controlling a drone, an industrial controller, a commercial IoT product, or a smart lock. The manufacturer may not want anyone to:</p><ul><li>Replace the firmware.</li><li>Extract the software.</li><li>Modify the device behavior.</li><li>Access debugging interfaces.</li></ul><p>This is where eFuses become useful. Some of the key features that rely on eFuses are described below.</p><h4>1. Secure Boot: Only Run Trusted Firmware</h4><p>One of the most powerful ESP32 security features is <strong>Secure Boot</strong>.</p><p>Normally, the ESP32 loads firmware from flash and executes it.</p><p>With Secure Boot enabled:</p><ol><li>ESP32 starts.</li><li>The bootloader verifies the firmware signature.</li><li>Only firmware signed with the correct private key is executed.</li></ol><p>If someone modifies the firmware, the signature check fails and the ESP32 refuses to boot.</p><p>This creates a chain of trust from the hardware level.</p><h4>2. Flash Encryption: Protecting Firmware Contents</h4><p>Secure Boot prevents modified firmware from running, but it does not hide the firmware contents.</p><p>For this, ESP32 provides <strong>Flash Encryption</strong>.</p><p>With flash encryption enabled:</p><ul><li>Firmware stored in flash is encrypted.</li><li>Reading the flash externally does not reveal the actual code.</li><li>The ESP32 decrypts the data internally during execution.</li></ul><p>This is useful when protecting intellectual property or sensitive algorithms.</p><h4>3. Disabling JTAG</h4><p>JTAG is extremely useful during development.</p><p>It allows developers to debug applications, inspect processor registers, access memory, and analyze hardware behavior.</p><p>But in a final product, leaving JTAG enabled can become a security risk.</p><p>An eFuse can permanently disable JTAG access.</p><p>After burning the JTAG disable fuse:</p><ul><li>Debugging through JTAG is no longer possible.</li><li>The change cannot be undone.</li></ul><h4>4. Disabling the UART Download Mode</h4><p>One of the biggest surprises for me was that ESP32’s famous flashing method can also be disabled.</p><p>Normally, an ESP32 can enter the ROM bootloader by pulling GPIO0 low during reset.</p><p>This allows tools like:</p><pre>esptool.py</pre><p>to upload new firmware.</p><p>For production devices, this may not be desirable.</p><p>Certain ESP32 variants provide an eFuse option to disable the download mode permanently.</p><p>After this:</p><ul><li>The chip cannot be reflashed through the normal UART bootloader.</li><li>Physical access no longer allows easy firmware replacement.</li></ul><h3>The Risk: You Can Permanently Brick the Chip</h3><p>The power of eFuses is also their danger.</p><p>A mistake like:</p><ul><li>Enabling secure boot without keeping the private key,</li><li>Disabling download mode too early,</li><li>Misconfiguring flash encryption,</li></ul><p>can make the ESP32 unusable.</p><p>Before burning eFuses, it is important to:</p><ol><li>Check the current eFuse status:</li></ol><pre>espefuse.py summary</pre><ol><li>Understand exactly what each fuse does.</li><li>Keep backups of security keys.</li><li>Test the complete production process on separate hardware first.</li></ol><h3>Development vs Production</h3><p>A good workflow is:</p><h4>1. During Development</h4><p>During development, keep everything open by leaving JTAG and UART flashing enabled while disabling Secure Boot and Flash Encryption, making debugging and testing much easier.</p><h4>2. During Production</h4><p>Once the firmware is stable, enable Secure Boot and Flash Encryption, disable unnecessary debugging interfaces, and lock down the boot process.</p><h3>My Takeaway</h3><p>Before learning about eFuses, I thought of an ESP32 mainly as a programmable microcontroller: write code, flash firmware, repeat.</p><p>After discovering eFuses, I realized that ESP32 is much closer to a small secure computing platform.</p><p>A few permanent bits inside the chip can transform it from an open development board into a locked-down commercial product.</p><p>The important lesson is that hardware security is not only about software. Sometimes, the most critical decisions happen at the silicon level, and once those decisions are made, there is no undo button.</p><p><strong>Always understand the consequences before burning an eFuse.</strong></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=d68074f1c333" width="1" height="1" alt=""><hr><p><a href="https://medium.com/h7w/i-recently-discovered-esp32-efuses-the-feature-that-can-permanently-change-your-microcontroller-d68074f1c333">I Recently Discovered ESP32 eFuses: The Feature That Can Permanently Change Your Microcontroller</a> was originally published in <a href="https://medium.com/h7w">T3chtsz</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[When My First LoRa Test Failed… Because of a Jumper Wire]]></title>
            <link>https://medium.com/h7w/when-my-first-lora-test-failed-because-of-a-jumper-wire-456e9a0b59e0?source=rss-7ba13af8badd------2</link>
            <guid isPermaLink="false">https://medium.com/p/456e9a0b59e0</guid>
            <category><![CDATA[internet-of-things]]></category>
            <category><![CDATA[electronics]]></category>
            <category><![CDATA[debugging]]></category>
            <category><![CDATA[arduino]]></category>
            <category><![CDATA[lora]]></category>
            <dc:creator><![CDATA[Nipun Dharmarathne]]></dc:creator>
            <pubDate>Sun, 15 Mar 2026 05:22:56 GMT</pubDate>
            <atom:updated>2026-03-17T22:43:51.482Z</atom:updated>
            <content:encoded><![CDATA[<p>Recently I experimented with <strong>LoRa communication</strong> for the first time using the <strong>E32–433T20D LoRa module</strong>. My goal was simple: establish a basic wireless communication link between two modules and verify it through the Arduino serial monitor.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/893/1*PumB98lWGAjHScZQxAoB5A.png" /></figure><p>The setup looked straightforward, but my first attempt didn’t go as expected.</p><h3>The Setup</h3><p>For the experiment I used the following hardware:</p><ul><li>2 × <strong>E32–433T20D LoRa modules</strong></li><li>2 × USB-to-TTL converters</li><li>Jumper wires</li><li>Arduino Serial Monitor to send and receive messages</li></ul><p>Each LoRa module was connected to a TTL converter so that I could communicate with it from the computer. Then I opened two serial monitor windows to send and receive messages through the modules.</p><p>The expectation was simple:<br>Type a message on one side and see it appear on the other.</p><h3>The First Test</h3><p>After wiring everything, I powered the setup and opened the serial monitors.</p><p>I typed a message on one side.</p><p>Nothing appeared on the other side.</p><p>I tried again.</p><p>Still nothing.</p><p>Since it was my <strong>first time using a LoRa module</strong>, I immediately suspected that something might be wrong with the module itself.</p><p>Maybe:</p><ul><li>the module configuration was wrong</li><li>the baud rate was incorrect</li><li>the module was defective</li></ul><p>At this stage it’s very easy to get discouraged.</p><h3>Starting the Debugging Process</h3><p>Instead of assuming the modules were faulty, I started debugging the setup step by step.</p><p>I checked:</p><ul><li>TX and RX connections</li><li>power supply</li><li>serial monitor settings</li><li>wiring between the TTL converter and the module</li></ul><p>Everything looked correct.</p><p>But the communication still didn’t work.</p><p>Then I decided to test the <strong>jumper wires</strong> using a multimeter.</p><h3>The Real Problem</h3><p>I used the <strong>continuity test mode</strong> on the multimeter to check the wires.</p><p>That’s when I discovered the issue.</p><p>One of the jumper wires had <strong>no electrical continuity</strong>.</p><p>From the outside it looked completely normal, but internally the connection was broken.</p><p>That single faulty jumper wire prevented the LoRa modules from communicating.</p><h3>The Fix</h3><p>I replaced the faulty wire and tested the setup again.</p><p>This time the communication worked immediately.</p><p>Messages sent from one serial monitor appeared on the other side through the LoRa link.</p><p>The modules were working perfectly all along.</p><h3>Why Experiences Like This Matter</h3><p>Small issues like this are very common in electronics. Sometimes a tiny component like a jumper wire can stop an entire system from working.</p><p>For beginners, moments like this can be frustrating. When things don’t work as expected, it’s easy to think the hardware is broken or the project is too complicated.</p><p>But often, the problem is much simpler than we expect.</p><h3>Lessons Learned</h3><p>This small experiment taught me a few important lessons.</p><h4>1. Check the Basics First</h4><p>Before assuming complex problems, always check the simple things like wires and connections.</p><h4>2. Don’t Trust Jumper Wires Completely</h4><p>Jumper wires can fail internally even if they look fine.</p><h4>3. Use a Multimeter Early</h4><p>A quick continuity test can save a lot of time during debugging.</p><h4>4. Debug Systematically</h4><p>Check each component step by step instead of changing multiple things randomly.</p><h4>5. Stay Patient</h4><p>Hardware debugging requires patience. Every small issue you solve builds your experience.</p><h3>Final Thoughts</h3><p>My first LoRa experiment with the <strong>E32–433T20D module</strong> didn’t fail because of the module or configuration.</p><p>It failed because of a <strong>single faulty jumper wire</strong>.</p><p>This experience reminded me that in electronics, even the smallest components matter. And sometimes the most valuable lesson comes from the simplest problem.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=456e9a0b59e0" width="1" height="1" alt=""><hr><p><a href="https://medium.com/h7w/when-my-first-lora-test-failed-because-of-a-jumper-wire-456e9a0b59e0">When My First LoRa Test Failed… Because of a Jumper Wire</a> was originally published in <a href="https://medium.com/h7w">T3chtsz</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[A Small Geometry Trick That Simplified My Drone Coverage Algorithm]]></title>
            <link>https://medium.com/h7w/a-small-geometry-trick-that-simplified-my-drone-coverage-algorithm-dcb80205cc03?source=rss-7ba13af8badd------2</link>
            <guid isPermaLink="false">https://medium.com/p/dcb80205cc03</guid>
            <category><![CDATA[drones]]></category>
            <category><![CDATA[programming]]></category>
            <category><![CDATA[robotics]]></category>
            <category><![CDATA[algorithms]]></category>
            <category><![CDATA[geometry]]></category>
            <dc:creator><![CDATA[Nipun Dharmarathne]]></dc:creator>
            <pubDate>Sat, 14 Feb 2026 09:32:17 GMT</pubDate>
            <atom:updated>2026-02-15T03:08:40.403Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*3XO4x8Hxx84G9Oj6" /></figure><p>When I built a path-planning algorithm for an agricultural drone, the objective sounded straightforward:</p><blockquote>Cover a convex polygon field efficiently while spraying fertilizer.</blockquote><p>The solution pattern was clear. Use a zig-zag (boustrophedon-style) sweep across the area. But during implementation, I ran into a small geometric problem that turned into an important engineering lesson.</p><p>This article is about that lesson.</p><h3>The Real-World Setup</h3><p>The drone receives a convex polygon defined by GPS coordinates. To cover it, the steps are simple in theory:</p><ol><li>Generate parallel sweep lines across the polygon</li><li>Compute intersection points between each sweep line and polygon edges</li><li>Sort intersection pairs</li><li>Create zig-zag flight segments between those pairs</li></ol><p>Conceptually simple. But in practice, geometry rarely cooperates.</p><h3>The Actual Problem</h3><p>For each sweep line:</p><ul><li>I computed its intersection with every polygon edge.</li><li>That intersection was calculated using line–line intersection formulas.</li></ul><p>So, I had an intersection point. But here’s the real question:</p><blockquote>Does this intersection point actually lie on the polygon edge segment?</blockquote><p>Because line equations represent <strong>infinite lines</strong>. Polygon edges are <strong>finite segments</strong>. An intersection between infinite lines does not guarantee the intersection lies within the segment endpoints.</p><p>So, the real implementation problem was:</p><blockquote>Given a segment AB and a computed intersection point P, how do we check if P lies within AB?</blockquote><h3>The Algebraic Approach (Parametric Form)</h3><p>The classical mathematical way is to use the parametric representation of the segment.</p><p>For segment AB, any point P on the line through A and B can be written as:</p><pre>P = A + t(B−A)</pre><p>Where:</p><ul><li>A is the start point</li><li>B is the end point</li><li>t is a scalar parameter</li></ul><p>If we solve for t:</p><pre>t = (P-A) / (B-A)</pre><p>Then:</p><ul><li>If (0 ≤ t ≤ 1), P lies within the segment</li><li>If (t &lt; 0), P lies before A</li><li>If (t &gt; 1), P lies beyond B</li></ul><p>Mathematically clean. But in implementation, this means:</p><ul><li>Additional vector operations</li><li>Division (possible instability if denominator is small)</li><li>Handling vertical segments carefully</li><li>Floating-point tolerance management</li><li>Extra branching logic</li></ul><p>It works. But it felt heavier than necessary for this specific problem.</p><h3>The Geometric Insight</h3><p>Instead of solving for t, I asked a simpler question:</p><blockquote>If a point lies within a segment, what must be true geometrically?</blockquote><p>The answer is surprisingly straightforward. The point must lie inside the segment’s bounding box.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*YyVTl1WhZ9g4bG1a3TQilQ.png" /></figure><p>How do we check it?</p><p>For a segment from A(x₁, y₁) to B(x₂, y₂), a point P(x, y) lies within the segment if:</p><pre>min(x1, x2) ≤ x ≤ max(x1, x2)<br>min(y1, y2) ≤ y ≤ max(y1, y2)</pre><p>In other words, the point’s <strong>x-coordinate</strong> must lie between the x-values of the endpoints, and its <strong>y-coordinate</strong> must lie between the y-values of the endpoints</p><p>That’s it. Just comparisons. No parameter solving. No additional algebra.</p><p>If the intersection between the lines is already computed correctly, this bounding-box check is sufficient to verify segment membership.</p><h3>Why This Is Better in Practice</h3><h4>1. Fewer Floating-Point Issues</h4><p>The parametric method involves division and can be very sensitive when numbers are very small, which sometimes leads to tiny errors. Bounding-box checks, on the other hand, only use simple comparisons. This makes them much more stable and less prone to numerical problems.</p><h4>2. Easier Debugging</h4><p>If something goes wrong, you can instantly see whether P is within the min/max bounds of the segment. Parametric ttt values like 1.00000021.00000021.0000002 are confusing in comparison.</p><h4>3. Simpler and More Intuitive</h4><p>Easy to explain, read, and maintain. You can even add a tiny margin for rounding errors and it just works.</p><h3>Why This Matters in Drone Systems</h3><p>Coverage path planning may seem straightforward, but small details add up fast:</p><ul><li>You generate many sweep lines.</li><li>Each line intersects multiple polygon edges.</li><li>Every intersection must be checked and validated.</li></ul><p>Even tiny inefficiencies can snowball when repeated across all lines and edges. That’s why, in autonomous systems, simplicity is more important than complexity.</p><p>In robotics and embedded systems, simple solutions offer clear advantages:</p><ul><li>Fewer operations → more predictable behavior</li><li>Simpler logic → fewer hidden bugs</li><li>Clear geometry → easier to maintain and debug</li></ul><p>Complex math can be powerful, but unnecessary math is costly. In real-world drone systems, the simplest solution isn’t just easier. It’s more reliable.</p><h3>The Engineering Lesson</h3><p>When designing algorithms, there’s a natural tendency to reach for the most <strong>mathematically complete solution</strong>.</p><p>But engineering isn’t about elegance for its own sake. It’s about <strong>getting the job done correctly and efficiently</strong>.</p><p>In this case, both methods work:</p><ul><li>Parametric validation is correct.</li><li>Bounding-box validation is also correct.</li></ul><p>The difference? Bounding-box validation is <strong>simpler, easier to implement and easier to maintain</strong>.</p><h3>Final Thoughts</h3><p>This wasn’t a groundbreaking discovery. It was a small implementation detail inside a larger drone coverage system.</p><p>But these small decisions define robust systems. When building:</p><ul><li>UAV navigation algorithms</li><li>Coverage path planners</li><li>Real-time geometric systems</li></ul><p>Always ask:</p><blockquote>Am I choosing the simplest correct solution for this problem?</blockquote><p>Sometimes the best optimization isn’t about speed. It’s about simplicity. And in autonomous systems, simplicity is reliability.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=dcb80205cc03" width="1" height="1" alt=""><hr><p><a href="https://medium.com/h7w/a-small-geometry-trick-that-simplified-my-drone-coverage-algorithm-dcb80205cc03">A Small Geometry Trick That Simplified My Drone Coverage Algorithm</a> was originally published in <a href="https://medium.com/h7w">T3chtsz</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Ray Casting Algorithm: How I Used It to Check Whether a Drone Is Inside a Geofence]]></title>
            <link>https://medium.com/h7w/ray-casting-algorithm-how-i-used-it-to-check-whether-a-drone-is-inside-a-geofence-a21195baa15a?source=rss-7ba13af8badd------2</link>
            <guid isPermaLink="false">https://medium.com/p/a21195baa15a</guid>
            <category><![CDATA[drones]]></category>
            <category><![CDATA[embedded-systems]]></category>
            <category><![CDATA[algorithms]]></category>
            <category><![CDATA[computational-geometry]]></category>
            <category><![CDATA[geofencing]]></category>
            <dc:creator><![CDATA[Nipun Dharmarathne]]></dc:creator>
            <pubDate>Fri, 06 Feb 2026 17:08:55 GMT</pubDate>
            <atom:updated>2026-02-08T02:41:23.034Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Hw2HPGvqGsxFg4L6hZACew.png" /></figure><p>Geofencing is a core safety feature in modern drone systems. Whether you’re enforcing no-fly zones, mission boundaries, or regulatory airspace limits, you need a fast and reliable way to determine one simple thing:</p><p><strong>Is the drone inside the geofence or not?</strong></p><p>To solve this, I used the <strong>Ray Casting Algorithm</strong>, a classic computational geometry technique for the <em>point-in-polygon</em> problem. It’s simple, efficient, and works extremely well for real-time systems like drones.</p><p>This article explains how the algorithm works, why it’s a good fit for geofencing, and what to watch out for when implementing it.</p><h3>The Problem: Point Inside a Polygon</h3><p>A geofence is usually represented as a <strong>polygon</strong>, defined by a list of GPS coordinates (latitude, longitude).<br>The drone’s current position is a <strong>single point</strong>.</p><p>So the problem becomes:</p><blockquote><em>Given a point and a polygon, determine whether the point lies inside the polygon.</em></blockquote><p>This sounds easy, but once polygons become irregular (concave shapes, not just rectangles), simple bounding-box checks are no longer enough.</p><p>That’s where ray casting comes in.</p><h3>Intuition Behind the Ray Casting Algorithm</h3><p>The idea is surprisingly intuitive:</p><ol><li>From the point (drone position), cast an <strong>imaginary ray</strong> in one direction (commonly to the right).</li><li>Count how many times this ray <strong>intersects the edges</strong> of the polygon.</li><li>Apply this rule:</li></ol><ul><li><strong>Odd number of intersections → point is inside</strong></li><li><strong>Even number of intersections → point is outside</strong></li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*MiuoRx2v1JHqFyJnT_agYQ.png" /></figure><p>Why does this work?<br>Every time the ray crosses the polygon boundary, it toggles between “outside” and “inside.” If you end up inside after the last crossing, the count will be odd.</p><h3>Visual Explanation</h3><p>Imagine standing at the drone’s position and shining a laser straight to the right:</p><ul><li>If the laser crosses the fence once, you’re inside.</li><li>If it crosses twice, you’re outside again.</li><li>Crossings keep flipping your state.</li></ul><p>This logic holds for <strong>any simple polygon</strong>, even concave ones.</p><h3>Why Ray Casting Works Well for Drones</h3><p>Ray casting is a great choice for drone geofencing because:</p><ul><li>Works with <strong>arbitrary polygon shapes</strong></li><li>Computationally lightweight (O(n) per check)</li><li>Easy to implement in C/C++</li><li>Deterministic and robust for real-time checks</li></ul><p>In flight control systems, where this check may run many times per second, simplicity matters.</p><h3>Basic Algorithm Steps</h3><p>Given:</p><ul><li>A point (x, y) → the drone’s current position</li><li>A polygon with vertices [(x0,y0), (x1,y1), …, (xn,yn)] representing the geofence</li></ul><p>Steps:</p><ol><li>Initialize an <strong>intersection counter</strong> to zero.</li><li>Cast an <strong>imaginary horizontal ray to the right</strong> from the point (x, y).</li><li>Loop through each edge of the polygon (each pair of consecutive vertices).</li><li>For each edge, check whether:</li></ol><ul><li>The ray intersects the edge, <strong>and</strong></li><li>The intersection occurs <strong>to the right of the point</strong> (intersections to the left are ignored).</li></ul><p>5. If both conditions are met, increment the intersection counter.</p><p>6. After checking all polygon edges:</p><ul><li><strong>Odd number of intersections → point is inside the geofence</strong></li><li><strong>Even number of intersections → point is outside the geofence</strong></li></ul><h3>Handling GPS Coordinates</h3><p>One important note:<br>GPS coordinates (latitude, longitude) are technically on a sphere, not a plane.</p><p>In practice:</p><ul><li>For <strong>small to medium geofences</strong>, treating lat/long as (x, y) works well.</li><li>For <strong>large areas</strong>, you should first project coordinates (e.g., UTM).</li></ul><p>Most consumer and industrial drone geofences fall comfortably into the first category.</p><h3>Edge Cases to Watch Out For</h3><h4>1. Point Exactly on the Boundary</h4><p>Decide early:</p><ul><li>Is the drone considered <strong>inside</strong> if it’s exactly on the fence?</li><li>Or is that a violation?</li></ul><p>You may need an extra boundary check for this.</p><h4>2. Horizontal Edges</h4><p>Horizontal polygon edges can cause double counting if not handled carefully.<br>The standard intersection condition above avoids most of these issues.</p><h4>3. Self-Intersecting Polygons</h4><p>Ray casting assumes a <strong>simple polygon</strong>.<br>Geofences should always be validated before use.</p><h3>Performance Considerations</h3><ul><li>Time complexity: <strong>O(n)</strong> per check</li><li>Space complexity: <strong>O(1)</strong></li></ul><p>Even with hundreds of vertices, this runs fast enough for real-time flight control loops.</p><h3>Final Thoughts</h3><p>The ray casting algorithm is one of those elegant solutions that feels almost too simple — but it works.</p><p>For my drone geofencing use case, it provided:</p><ul><li>Reliable inside/outside detection</li><li>Minimal computational overhead</li><li>Easy integration into existing navigation code</li></ul><p>If you’re building geofence logic for drones, robotics, or mapping applications, ray casting is absolutely worth having in your toolkit.</p><p>Happy flying.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=a21195baa15a" width="1" height="1" alt=""><hr><p><a href="https://medium.com/h7w/ray-casting-algorithm-how-i-used-it-to-check-whether-a-drone-is-inside-a-geofence-a21195baa15a">Ray Casting Algorithm: How I Used It to Check Whether a Drone Is Inside a Geofence</a> was originally published in <a href="https://medium.com/h7w">T3chtsz</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[MAVLink Explained: The Secret Language Powering Drones and Robots]]></title>
            <link>https://medium.com/h7w/mavlink-explained-the-secret-language-powering-drones-and-robots-6cbac5e58c6f?source=rss-7ba13af8badd------2</link>
            <guid isPermaLink="false">https://medium.com/p/6cbac5e58c6f</guid>
            <category><![CDATA[drones]]></category>
            <category><![CDATA[mavlink]]></category>
            <category><![CDATA[robotics]]></category>
            <category><![CDATA[uav]]></category>
            <category><![CDATA[autonomous-vehicles]]></category>
            <dc:creator><![CDATA[Nipun Dharmarathne]]></dc:creator>
            <pubDate>Mon, 08 Dec 2025 08:09:12 GMT</pubDate>
            <atom:updated>2026-02-07T02:55:30.579Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*-vf1Mimu9jrMXbbm.jpeg" /></figure><p>Drones, autonomous vehicles, and robotics rely on <strong>fast and reliable communication</strong>. But how do these systems talk to each other in real time? The answer is <strong>MAVLink</strong> — a lightweight, powerful protocol that has become the industry standard for drone and UAV communication.</p><p>In this article, you’ll learn what MAVLink is, how it works, and why it’s essential for modern drones and autonomous systems.</p><h3>What is MAVLink?</h3><p><strong>MAVLink (Micro Air Vehicle Link)</strong> is a <strong>lightweight messaging protocol</strong> that enables communication between drones, ground control stations, and robotic systems. Originally developed for small UAVs, it now supports a wide range of robotics applications.</p><p>Key features of MAVLink include:</p><ul><li><strong>Lightweight design:</strong> Optimized for low-bandwidth connections.</li><li><strong>Flexibility:</strong> Handles telemetry, commands, and parameter updates.</li><li><strong>Cross-platform support:</strong> Works over serial, UDP, TCP, and more.</li></ul><p>Whether you’re using <strong>PX4 MAVLink</strong> or <strong>ArduPilot MAVLink</strong>, this protocol ensures that different systems can communicate seamlessly.</p><h3>How MAVLink Works</h3><p>MAVLink operates by sending <strong>structured messages</strong> between components. Each message contains:</p><ol><li><strong>Header:</strong> Identifies the system and component.</li><li><strong>Payload:</strong> Contains data like GPS coordinates, battery status, or drone commands.</li><li><strong>Checksum:</strong> Ensures the message arrives intact.</li></ol><p>This structure makes MAVLink <strong>reliable even in noisy wireless environments</strong>, which is why it’s widely adopted in drones, UAVs, and robotics.</p><h3>MAVLink Versions: 1 vs 2</h3><p>There are two main versions:</p><ol><li><strong>MAVLink 1:</strong> Legacy version, still used in many systems.</li><li><strong>MAVLink 2:</strong> The modern standard with features like:</li></ol><ul><li>Larger payloads for complex messages</li><li>Message signing for security</li><li>Extended message IDs for future-proofing</li></ul><p>Most modern drones and autonomous vehicles now use <strong>MAVLink 2</strong>.</p><h3>Why MAVLink is Important</h3><p>MAVLink powers a range of functions:</p><ul><li><strong>Telemetry streaming:</strong> Real-time drone data for position, orientation, and battery.</li><li><strong>Mission planning:</strong> Send waypoints and commands from ground stations like <strong>QGroundControl</strong>.</li><li><strong>Parameter tuning:</strong> Adjust drone behavior mid-flight.</li><li><strong>Safety monitoring:</strong> Trigger failsafe actions automatically.</li></ul><p>Its efficiency, extensibility, and interoperability make it essential for anyone working with UAVs or autonomous vehicles.</p><h3>Advantages of MAVLink</h3><ol><li><strong>Efficient communication:</strong> Works over low-bandwidth links.</li><li><strong>Extensible:</strong> Supports custom messages for specialized use cases.</li><li><strong>Interoperable:</strong> Standardized messages ensure hardware and software compatibility.</li><li><strong>Robust:</strong> Built-in checksums protect against errors.</li></ol><h3>Challenges to Consider</h3><p>While MAVLink is powerful, it has some considerations:</p><ul><li>Advanced systems require careful <strong>management of message IDs</strong>.</li><li>Security is optional; <strong>MAVLink 2 supports message signing</strong>, but encryption isn’t default.</li><li>High-rate telemetry can strain some embedded systems.</li></ul><p>Despite these challenges, MAVLink remains the <strong>go-to protocol for drones, UAVs, and robotics</strong>.</p><h3>Getting Started with MAVLink</h3><p>Here’s how you can start experimenting:</p><ol><li>Use <strong>PX4 or ArduPilot simulators</strong> to test MAVLink communication.</li><li>Connect a drone to <strong>QGroundControl</strong> via UDP, TCP, or serial.</li><li>Explore the <strong>official MAVLink documentation</strong> for message definitions and tutorials: <a href="https://mavlink.io/en/">https://mavlink.io/en/</a></li></ol><p>Even as a hobbyist, learning MAVLink unlocks the ability to <strong>control drones, robots, and autonomous vehicles</strong> reliably.</p><h3>Conclusion</h3><p>MAVLink is more than a protocol — it’s the <strong>heartbeat of modern drones and robotics</strong>. Its lightweight design, reliability, and extensibility make it essential for UAV developers, robotics enthusiasts, and autonomous vehicle engineers.</p><p>By understanding MAVLink, you gain the tools to make drones and robots communicate efficiently, safely, and intelligently.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=6cbac5e58c6f" width="1" height="1" alt=""><hr><p><a href="https://medium.com/h7w/mavlink-explained-the-secret-language-powering-drones-and-robots-6cbac5e58c6f">MAVLink Explained: The Secret Language Powering Drones and Robots</a> was originally published in <a href="https://medium.com/h7w">T3chtsz</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Stop Learning Syntax — Learn These 5 Skills Instead (JavaScript 2025 Guide)]]></title>
            <link>https://javascript.plainenglish.io/stop-learning-syntax-learn-these-5-skills-instead-javascript-2025-guide-c290dc2db7cf?source=rss-7ba13af8badd------2</link>
            <guid isPermaLink="false">https://medium.com/p/c290dc2db7cf</guid>
            <category><![CDATA[web-development]]></category>
            <category><![CDATA[coding]]></category>
            <category><![CDATA[programming]]></category>
            <category><![CDATA[javascript]]></category>
            <category><![CDATA[beginner-developers]]></category>
            <dc:creator><![CDATA[Nipun Dharmarathne]]></dc:creator>
            <pubDate>Sun, 07 Dec 2025 07:13:04 GMT</pubDate>
            <atom:updated>2026-02-13T17:11:09.724Z</atom:updated>
            <content:encoded><![CDATA[<h3>Stop Learning Syntax. Learn These 5 Skills Instead (JavaScript 2025 Guide)</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/848/1*V8ODkq_QQfhbKvT453Dcqw.png" /></figure><p>If you’re learning <strong>JavaScript in 2025</strong>, you’ve probably spent hours memorizing syntax, loops, and functions.</p><p>Here’s the harsh truth: <strong>knowing syntax alone doesn’t make you a good developer</strong>.</p><p>What really matters are <strong>practical skills</strong> that help you build projects, debug errors, and solve real-world problems.</p><p>In this guide, I’ll show the <strong>5 essential JavaScript skills every beginner should master</strong> — the ones that actually make you productive.</p><h3>1. Problem-Solving with JavaScript</h3><p>Knowing how to type for or if is useless if you can’t figure out how to solve a problem.</p><ul><li>Break problems into smaller pieces</li><li>Think logically about steps before coding</li><li>Practice with small exercises (like building a calculator, to-do app, or mini game)</li></ul><p><strong>Pro Tip:</strong> Focus on “how” to solve a problem, not just “how” to write code. This mindset will help you in every project.</p><h3>2. Reading and Understanding Error Messages</h3><p>Errors aren’t failures — they’re your fastest teachers.</p><ul><li>Learn to read console errors carefully</li><li>Understand line numbers, variable names, and messages</li><li>Google error messages effectively</li></ul><p><strong>Pro Tip:</strong> Don’t just copy solutions — understand why the error happened. That’s how you avoid the same mistake again.</p><h3>3. Debugging Effectively</h3><p>Debugging is a core skill that separates beginners from intermediate developers.</p><ul><li>Use console.log() to check variables</li><li>Use breakpoints in browser developer tools</li><li>Test small pieces of code independently</li></ul><p><strong>Pro Tip:</strong> Treat debugging like a detective game — follow clues, test hypotheses, and isolate problems.</p><h3>4. Planning Projects Before Writing Code</h3><p>Many beginners jump straight into coding — and fail.</p><ul><li>Sketch a simple flow of your project</li><li>Decide what functions, variables, and data you need</li><li>Break your project into smaller tasks</li></ul><p><strong>Pro Tip:</strong> Even 10 minutes of planning saves hours of frustration. Start with small projects like a mini calculator or weather app.</p><h3>5. Using Browser Developer Tools Like a Pro</h3><p>The browser is your best friend. It’s not just for testing — it’s a learning tool.</p><ul><li>Inspect HTML &amp; CSS elements</li><li>Monitor network requests and API calls</li><li>Test JavaScript live in the console</li></ul><p><strong>Pro Tip:</strong> Familiarity with DevTools makes debugging, testing, and experimenting much faster — and more fun.</p><h3>Final Thoughts</h3><p>If you want to <strong>learn JavaScript effectively in 2025</strong>, stop obsessing over syntax.</p><p>Focus on <strong>skills that make you productive, confident, and creative</strong>:</p><ol><li>Problem-solving</li><li>Understanding errors</li><li>Debugging</li><li>Project planning</li><li>Using developer tools</li></ol><p>When you master these skills, writing syntax becomes easy — and you’ll be ready to tackle real projects, frameworks, and APIs.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=c290dc2db7cf" width="1" height="1" alt=""><hr><p><a href="https://javascript.plainenglish.io/stop-learning-syntax-learn-these-5-skills-instead-javascript-2025-guide-c290dc2db7cf">Stop Learning Syntax — Learn These 5 Skills Instead (JavaScript 2025 Guide)</a> was originally published in <a href="https://javascript.plainenglish.io/">JavaScript in Plain English</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[I Tried Learning JavaScript the Hard Way — These 10 Lessons Would’ve Saved Me Months (2025 Guide)]]></title>
            <link>https://javascript.plainenglish.io/i-tried-learning-javascript-the-hard-way-these-10-lessons-wouldve-saved-me-months-2025-guide-5f88f3305bf2?source=rss-7ba13af8badd------2</link>
            <guid isPermaLink="false">https://medium.com/p/5f88f3305bf2</guid>
            <category><![CDATA[web-development]]></category>
            <category><![CDATA[javascript]]></category>
            <category><![CDATA[programming]]></category>
            <category><![CDATA[software-engineering]]></category>
            <category><![CDATA[coding]]></category>
            <dc:creator><![CDATA[Nipun Dharmarathne]]></dc:creator>
            <pubDate>Sat, 06 Dec 2025 06:19:10 GMT</pubDate>
            <atom:updated>2026-02-13T17:11:47.317Z</atom:updated>
            <content:encoded><![CDATA[<h3>I Tried Learning JavaScript the Hard Way. These 10 Lessons Would’ve Saved Me Months (2025 Guide)</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/859/1*CDXEiKnAN4O2P62nq2-mHA.png" /></figure><p>When I first started learning JavaScript, I thought I just needed tutorials, a laptop, and motivation.</p><p>I was wrong.</p><p>The real challenge wasn’t JavaScript itself — it was the <strong>mistakes I didn’t know I was making</strong>.<br>Mistakes that slowed me down, confused me, and made me feel like I “wasn’t meant for coding.”</p><p>If you’re learning JavaScript in 2025, this article will save you from all of that.</p><p>Here are the <strong>10 beginner mistakes</strong> I made — and the shortcuts I wish someone gave me on Day 1.</p><h3>1. Jumping Into React While My Fundamentals Were Weak</h3><p>Every beginner (including me) wants to learn React fast.</p><p>But frameworks don’t make learning easier — they make it harder if you don’t understand:</p><ul><li>variables</li><li>loops</li><li>functions</li><li>the DOM</li><li>events</li></ul><p>Once you master these, React suddenly becomes simple.</p><p><strong>Shortcut:</strong><br> Build 3–5 small vanilla JS projects before touching any framework.</p><h3>2. Relying on Tutorials More Than Writing My Own Code</h3><p>I spent months watching videos.<br>I felt productive… but I wasn’t actually coding.</p><p>Tutorials are great, but they can become a trap.</p><p><strong>Shortcut:</strong><br> Use the 80/20 rule →<br> <strong>20% tutorials, 80% building.</strong></p><h3>3. Being Scared of the Console</h3><p>I used to avoid errors because I didn’t understand them.</p><p>Then I realized something:<br> <strong>Errors are free teachers.</strong></p><p>console.log() literally explains what’s wrong in your code.</p><p><strong>Shortcut:</strong><br> Whenever something breaks, don’t panic — inspect, log, debug.</p><h3>4. Not Knowing JavaScript is “Weird on Purpose”</h3><p>JavaScript has quirks:</p><ul><li>hoisting</li><li>dynamic types</li><li>=== vs ==</li><li>closures</li><li>async behavior</li></ul><p>They confused me because I tried to treat JS like Python or C++.</p><p><strong>Shortcut:</strong><br> Learn the quirks early. They unlock everything else.</p><h3>5. Treating Asynchronous Code Like Synchronous Code</h3><p>Callbacks scared me.<br>Promises confused me.<br>Async/await looked like magic.</p><p>Once I finally understood how JavaScript handles time, APIs, and waiting…<br>My entire learning curve changed.</p><p><strong>Shortcut:</strong><br> Learn async before learning APIs — not after.</p><h3>6. Installing Libraries for Simple Things</h3><p>I used libraries for EVERYTHING:</p><ul><li>animations</li><li>alerts</li><li>simple math</li><li>even timers</li></ul><p>Then I realized I didn’t know actual JavaScript — I only knew imports.</p><p><strong>Shortcut:</strong><br> Ask yourself: <em>Can vanilla JS do this in under 10 lines?</em><br> If yes, do it yourself.</p><h3>7. Avoiding Projects Because I Felt “Not Ready Yet”</h3><p>This was the biggest mistake of all.</p><p>I kept delaying projects because I felt I needed “more knowledge.”<br>But the truth is:</p><p><strong>Projects teach you faster than tutorials ever will.</strong></p><p><strong>Shortcut:</strong><br> Start with tiny projects:</p><ul><li>calculator</li><li>to-do list</li><li>password generator</li><li>weather app</li></ul><p>Small wins → big confidence.</p><h3>8. Copy-Pasting Code Without Understanding It</h3><p>It felt fast… until I needed to edit something.</p><p>Then I was stuck.</p><p><strong>Shortcut:</strong><br> Whenever you paste code, explain it to yourself line-by-line.</p><h3>9. Thinking Senior Developers Don’t Struggle</h3><p>They struggle too — they’re just better at Googling and debugging.</p><p>The difference isn’t intelligence.<br>It’s patience.</p><p><strong>Shortcut:</strong><br> When you’re stuck, don’t quit.<br> Debug systematically:</p><ul><li>log variables</li><li>isolate code</li><li>check syntax</li><li>reduce complexity</li></ul><p>Debug like a scientist, not a magician.</p><h3>10. Forgetting That JavaScript Is a Long Game</h3><p>Most beginners quit before they see progress.</p><p>You don’t need to be perfect.<br>You just need to keep going.</p><p>Your brain rewires in the background — one project at a time.</p><p><strong>Shortcut:</strong><br> Code 30–60 minutes a day.<br> Consistency beats intensity.</p><h3>Final Thoughts</h3><p>If you’re learning JavaScript in 2025, you’re already ahead.<br>There are more resources, tools, communities, and opportunities than ever before.</p><p>The only thing that can slow you down is the fear of making mistakes.</p><p>So make them.<br>Break things.<br>Fix them.<br>Repeat.</p><p>That’s how real developers are made.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=5f88f3305bf2" width="1" height="1" alt=""><hr><p><a href="https://javascript.plainenglish.io/i-tried-learning-javascript-the-hard-way-these-10-lessons-wouldve-saved-me-months-2025-guide-5f88f3305bf2">I Tried Learning JavaScript the Hard Way — These 10 Lessons Would’ve Saved Me Months (2025 Guide)</a> was originally published in <a href="https://javascript.plainenglish.io/">JavaScript in Plain English</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[The Cognitive Divide: Why AI Could Create a New Class of “Enhanced Thinkers”]]></title>
            <link>https://medium.com/h7w/the-cognitive-divide-why-ai-could-create-a-new-class-of-enhanced-thinkers-a637fc10ecde?source=rss-7ba13af8badd------2</link>
            <guid isPermaLink="false">https://medium.com/p/a637fc10ecde</guid>
            <category><![CDATA[artificial-intelligence]]></category>
            <category><![CDATA[technology]]></category>
            <category><![CDATA[society]]></category>
            <category><![CDATA[ai-ethics]]></category>
            <category><![CDATA[future-of-work]]></category>
            <dc:creator><![CDATA[Nipun Dharmarathne]]></dc:creator>
            <pubDate>Thu, 04 Dec 2025 14:53:56 GMT</pubDate>
            <atom:updated>2026-02-07T02:50:18.224Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/918/1*kocF2XlLFxqMOSMBZYXukg.png" /></figure><h3>Introduction</h3><p>Every major technological revolution reshapes society — the printing press democratized knowledge, electricity redefined industry, and the internet connected the world.</p><p>But the rise of artificial intelligence is different.<br> Its power isn’t just in what it does.<br> Its power is in what it <em>changes inside us</em> — how we think, reason, solve problems, and even perceive the world.</p><p>We are entering a future where people who know how to use AI effectively will develop <strong>cognitive superpowers</strong>, while those who don’t may fall into a new form of digital inequality:<br> <strong>the cognitive divide.</strong></p><h3>AI as a Cognitive Amplifier</h3><p>AI is no longer just software — it’s becoming a <strong>thinking partner</strong>.</p><ul><li>Programmers use AI to write and debug code.</li><li>Writers use AI to expand ideas and break creative blocks.</li><li>Researchers use AI to analyze complex datasets in minutes.</li><li>Students use AI tutors to learn faster and more personally than ever.</li></ul><p>This turns AI into a <strong>multiplier of human intelligence</strong>, amplifying abilities in the same way calculators once amplified mathematical power.</p><p>But there’s a catch:<br> This multiplier works only for those who understand how to <em>ask</em>, <em>interpret</em>, and <em>apply</em> AI’s outputs.</p><h3>The Rise of the AI-Fluent Individual</h3><p>A new kind of person is emerging: the <strong>AI-fluent thinker</strong>.</p><p>They are not necessarily programmers or engineers.<br> They are people who:</p><ul><li>Know how to prompt AI strategically</li><li>Understand its strengths and limitations</li><li>Use AI to enhance their own reasoning</li><li>Combine human intuition with machine precision</li></ul><p>These individuals can think <strong>bigger, faster, and deeper</strong> than before.</p><p>Soon, AI fluency may be as essential as reading, writing, or digital literacy.</p><h3>The New Cognitive Gap</h3><p>The more we integrate AI into daily life, the bigger the gap becomes between:</p><h4>1. People who know how to use AI to accelerate thinking</h4><p>vs</p><h4>2. People who depend on AI passively without understanding it</h4><p>This isn’t a gap in intelligence — it’s a gap in <strong>strategy</strong>.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*jpnsPrei_tOGvTA9rq5xUw.png" /></figure><p>The first group will:</p><ul><li>Learn faster</li><li>Solve problems more creatively</li><li>Build more ambitious projects</li><li>See connections others miss</li></ul><p>The second group will:</p><ul><li>Accept AI results without questioning them</li><li>Struggle to verify truth</li><li>Become dependent instead of empowered</li></ul><p>This divide won’t be about wealth, location, or education.<br> It will be about <strong>cognitive empowerment</strong>.</p><h3>AI as a Filter of Reality</h3><p>AI doesn’t just help us think — it shapes <em>what</em> we think about.</p><p>Search engines, feeds, content recommendations, and predictive systems decide:</p><ul><li>What information we see</li><li>What opinions we encounter</li><li>What beliefs get reinforced</li><li>What opportunities become visible</li></ul><p>When AI curates reality, the skill of <strong>interpreting, questioning, and contextualizing</strong> becomes essential.</p><p>Those who master this skill will thrive.<br> Those who accept the default feed will inherit a narrower world.</p><h3>Human Skills That Become More Valuable</h3><p>Contrary to fear, AI doesn’t make humans irrelevant — it makes certain human abilities <em>more important than ever</em>:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/930/1*iExcLqKhOB7AG90eMLwb7g.png" /></figure><h4>1. Critical Thinking</h4><p>Because AI can generate credible answers that are not always correct.</p><h4>2. Creativity</h4><p>Because AI is great at remixing — but humans excel at envisioning the unseen.</p><h4>3. Judgment and Ethics</h4><p>Because AI optimizes; humans decide what should be optimized.</p><h4>4. Problem Framing</h4><p>AI can solve a problem <strong>only if you know how to define it</strong>.</p><p>These become the new “premium skills” of the AI era.</p><h3>The Path Forward: Becoming an Enhanced Thinker</h3><p>If we want to stay ahead of the cognitive divide, we need a mindset shift:</p><h4>1. Treat AI as a partner, not a shortcut</h4><p>Use it to deepen thinking, not replace it.</p><h4>2. Learn to question AI outputs</h4><p>“Is this accurate?” becomes as important as “Is this useful?”</p><h4>3. Combine human intuition with AI precision</h4><p>This hybrid is far more powerful than either alone.</p><h4>4. Stay curious and adaptable</h4><p>AI evolves weekly — staying updated is a superpower.</p><h3>Conclusion: The Future of Thought</h3><p>Artificial intelligence will not create two kinds of workers — it will create two kinds of <em>thinkers</em>.<br> Those who leverage AI to stretch their minds, and those who become passive consumers of machine-generated ideas.</p><p>The future belongs to the enhanced thinkers:<br> People who understand that intelligence isn’t replaced by AI — it’s <strong>expanded</strong> by it.</p><p>The real revolution isn’t in the technology.<br> It’s in the minds of the people who learn to use it well.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=a637fc10ecde" width="1" height="1" alt=""><hr><p><a href="https://medium.com/h7w/the-cognitive-divide-why-ai-could-create-a-new-class-of-enhanced-thinkers-a637fc10ecde">The Cognitive Divide: Why AI Could Create a New Class of “Enhanced Thinkers”</a> was originally published in <a href="https://medium.com/h7w">T3chtsz</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[From Pixels to OLED: How I Built a Browser Tool for Microcontroller Graphics]]></title>
            <link>https://javascript.plainenglish.io/from-pixels-to-oled-building-a-browser-tool-for-microcontroller-graphics-36e695091869?source=rss-7ba13af8badd------2</link>
            <guid isPermaLink="false">https://medium.com/p/36e695091869</guid>
            <category><![CDATA[iot]]></category>
            <category><![CDATA[embedded-systems]]></category>
            <category><![CDATA[javascript-development]]></category>
            <category><![CDATA[javascript]]></category>
            <category><![CDATA[arduino]]></category>
            <dc:creator><![CDATA[Nipun Dharmarathne]]></dc:creator>
            <pubDate>Sat, 22 Nov 2025 06:21:59 GMT</pubDate>
            <atom:updated>2026-02-13T16:42:10.483Z</atom:updated>
            <content:encoded><![CDATA[<p>Ever struggled to get images looking right on a tiny OLED screen? You’re not alone. That’s why I created <strong>image2oled</strong>, a browser-based tool that converts any image into <strong>crisp, monochrome, microcontroller-ready PROGMEM arrays</strong>. You can <strong>try the live demo</strong> or explore the full code on <strong>GitHub</strong> while reading.</p><p>Live Demo: <a href="https://nipundharmarathne.github.io/image2oled">https://nipundharmarathne.github.io/image2oled</a><br>GitHub Repository: <a href="https://github.com/NipunDharmarathne/image2oled">https://github.com/NipunDharmarathne/image2oled</a></p><p>This post dives into the challenges, the design, and the technical choices behind the tool — showing how a simple web app can make OLED graphics fast, easy, and fun for makers and hobbyists alike.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*YDITUQh9ilgiSDdj53oEqw.png" /><figcaption>image2oled main interface</figcaption></figure><p>Small OLED displays are everywhere in DIY electronics. From smartwatches to sensor dashboards, they’re a compact and energy-efficient way to visualize data. But anyone who has tried to display images on these tiny screens knows the pain: <strong>getting a picture to look right is harder than it seems</strong>.</p><p>I faced this problem firsthand while working on a hobby project. I wanted to display icons and logos on a 128×64 OLED. But each image had to be converted to <strong>black-and-white</strong>, resized to match the screen, dithered to preserve details, and then exported as a <strong>C array</strong> for Arduino. Doing this manually took hours — and one small mistake could ruin the output.</p><p>That’s when I decided to build <strong>image2oled</strong>, a web-based tool to automate the entire workflow.</p><h3>Why OLED Graphics Are Tricky</h3><p>OLED displays are very different from computer monitors or phones. Some key challenges:</p><ol><li><strong>Monochrome only:</strong> Many small OLEDs only display black and white. Color images must be reduced, which can destroy details.</li><li><strong>Tiny resolution:</strong> Screens can be as small as 32×32 pixels. Every pixel counts.</li><li><strong>Memory constraints:</strong> Microcontrollers have limited RAM, so images need to be stored in <strong>PROGMEM</strong> as byte arrays.</li></ol><p>Manual conversion often involves several steps:</p><ul><li>Resizing the image to match the display resolution.</li><li>Converting to grayscale and then to black-and-white.</li><li>Applying dithering to approximate shades of gray.</li><li>Exporting each row of pixels into bytes formatted for microcontrollers.</li></ul><p>Doing this repeatedly, especially with multiple images or different resolutions, is tedious and error prone.</p><h3>The Idea Behind <strong>image2oled</strong></h3><p>I wanted a <strong>simple, browser-based solution</strong>. The core goals were:</p><ul><li><strong>Upload any image</strong> and resize it to common OLED resolutions.</li><li><strong>Preview multiple dithering algorithms</strong> to see which preserves detail best.</li><li><strong>Generate ready-to-use C PROGMEM arrays</strong> for Arduino and similar microcontrollers.</li><li><strong>Run entirely in the browser</strong>, so no installation is required.</li></ul><p>With this vision, I started designing the tool.</p><h3>Key Features</h3><h4>1. Multiple Dithering Methods</h4><p>Dithering allows grayscale images to be represented on monochrome screens. Each algorithm has its own visual style. <strong>image2oled </strong>supports:</p><ul><li><strong>Threshold:</strong> Simple black-and-white conversion, fast but harsh.</li><li><strong>Floyd–Steinberg:</strong> Popular error diffusion method for smoother gradients.</li><li><strong>Atkinson:</strong> Classic Macintosh-style diffusion.</li><li><strong>Bayer 4×4:</strong> Ordered dithering using a repeating pattern.</li><li><strong>JJN (Jarvis, Judice, Ninke):</strong> Smooth diffusion for larger patterns.</li><li><strong>Stucki:</strong> Similar to Floyd–Steinberg but slightly smoother.</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*5kVJFkpQ6wXkuxfnA3_YiQ.png" /><figcaption>Comparing all dithering methods on the same image</figcaption></figure><p>This feature lets you instantly compare how each method affects the clarity of your icons or graphics.</p><h4>2. Multiple OLED Resolutions</h4><p>Different projects use different displays. <strong>image2oled </strong>supports:</p><pre>128×64, 128×32, 96×64, 64×48, 64×32, 32×32, 128×128, 256×64</pre><p>You can switch resolutions at any time, and the previews update automatically. This makes it easy to see how your image will look on the actual hardware.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*EUdfKAQzINwJHI1zTmWEWQ.gif" /><figcaption>Changing resolution dynamically and updating previews</figcaption></figure><h4>3. Live Preview</h4><p>All dithering results are displayed in separate <strong>canvas previews</strong>. This live feedback is essential because tiny OLEDs are unforgiving — a single misplaced pixel can ruin an icon. Seeing all algorithms side by side helps make quick decisions.</p><h4>4. C PROGMEM Export</h4><p>Once you choose the best dithering method, <strong>image2oled </strong>generates a <strong>ready-to-use C array</strong>:</p><pre>static const unsigned char PROGMEM image_data_array[] = {<br> 0xff,0xff,0xff,0xff,0xff, <br>  ...<br>};</pre><p>You can copy it directly into Arduino or microcontroller code. It works seamlessly with libraries like <strong>Adafruit_SSD1306</strong> or <strong>U8g2</strong>.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*5EKpzaTmlU4QsM5uHDXRNw.png" /><figcaption>Generated C array in textarea</figcaption></figure><h3>Technical Overview</h3><p><strong>image2oled </strong>is built entirely with <strong>HTML, CSS, and JavaScript</strong>, using modular design for maintainability:</p><ul><li><strong>canvasSetup.js:</strong> Initializes canvases and contexts for previews.</li><li><strong>dithering.js:</strong> Implements all dithering algorithms.</li><li><strong>imageUpload.js:</strong> Handles file input, resizing, and drawing to canvases.</li><li><strong>progmem.js:</strong> Converts canvas pixel data to byte arrays for microcontroller use.</li></ul><p>All pixel processing happens in the browser using the <strong>Canvas API</strong>, which allows instant previews without server-side processing.</p><h3>The Development Story</h3><p>Creating this tool wasn’t just about writing code — it was a journey:</p><ul><li><strong>Challenge #1:</strong> Optimizing performance for larger images. Processing each pixel in JavaScript can lag the browser if not done carefully.</li><li><strong>Challenge #2:</strong> Balancing accuracy and visual clarity. Some dithering algorithms look great in theory but lose definition at small OLED resolutions.</li><li><strong>Challenge #3:</strong> Designing a simple, responsive UI. I wanted both beginners and experienced makers to feel comfortable using it.</li></ul><p>After several iterations, the tool became lightweight, modular, and user-friendly.</p><h3>Use Cases</h3><ul><li><strong>DIY smartwatches:</strong> Display custom icons or notifications.</li><li><strong>Sensor dashboards:</strong> Show small graphics for readings or alerts.</li><li><strong>Robotics projects:</strong> Add graphical feedback to tiny displays.</li><li><strong>Educational tools:</strong> Teach students about dithering, pixel manipulation, and microcontroller graphics.</li></ul><h3>Lessons Learned</h3><ol><li><strong>Every pixel count:</strong> Tiny screens force you to think differently about design and readability.</li><li><strong>Error diffusion is powerful:</strong> Algorithms like Floyd–Steinberg or JJN can drastically improve perceived quality.</li><li><strong>Modularity matters:</strong> Keeping each function in a separate JS module makes the tool easier to maintain and expand.</li></ol><h3>Future Improvements</h3><ul><li>Batch conversion for multiple images.</li><li>Support for color OLEDs.</li><li>Animated sequences for microcontroller displays.</li><li>Improved performance for very large images.</li></ul><p>The project is open source, so anyone can contribute or extend it.</p><h3>Conclusion</h3><p><strong>image2oled</strong> transforms a frustrating, repetitive process into a <strong>simple, browser-based workflow</strong>. By combining multiple dithering algorithms, dynamic resolutions, and instant previews, it empowers makers to focus on creativity rather than tedious conversions.</p><p>The tool makes it easy to see your designs come to life — just like in the final image, where a converted graphic is displayed perfectly on a 128×64 OLED. Whether you’re designing icons, dashboards, or small OLED projects, Image-to-OLED helps turn any image into a <strong>ready-to-use C PROGMEM array</strong> for your microcontroller.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*-3gUBDhAPJSR91FgFALaoA.png" /><figcaption>Completed OLED image displayed on hardware</figcaption></figure><p>Because it’s <strong>open-source and browser-based</strong>, anyone can try it, experiment, or extend it — bringing your OLED projects from concept to reality quickly and effortlessly.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=36e695091869" width="1" height="1" alt=""><hr><p><a href="https://javascript.plainenglish.io/from-pixels-to-oled-building-a-browser-tool-for-microcontroller-graphics-36e695091869">From Pixels to OLED: How I Built a Browser Tool for Microcontroller Graphics</a> was originally published in <a href="https://javascript.plainenglish.io/">JavaScript in Plain English</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
    </channel>
</rss>