<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>DEV Community: Codetard</title>
    <description>The latest articles on DEV Community by Codetard (@anon5877).</description>
    <link>https://dev.to/anon5877</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F3373679%2F086c7259-250c-488a-90b1-4fed98e02800.jpg</url>
      <title>DEV Community: Codetard</title>
      <link>https://dev.to/anon5877</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/anon5877"/>
    <language>en</language>
    <item>
      <title>Return of Codetard: Arduino Lore</title>
      <dc:creator>Codetard</dc:creator>
      <pubDate>Mon, 19 Oct 2026 07:49:27 +0000</pubDate>
      <link>https://dev.to/anon5877/return-of-codetard-arduino-lore-1eif</link>
      <guid>https://dev.to/anon5877/return-of-codetard-arduino-lore-1eif</guid>
      <description>&lt;h2&gt;
  
  
  THE RETURN
&lt;/h2&gt;

&lt;p&gt;So I was doom scrolling and testing how wrecked my attention span can get,  when I came across a reel which was a small Arduino project and it lit my curiosity and I decided to make a tony stark inspired portfolio for myself which is still a work in progress hopefully it's done before November, you can check it on &lt;a href="https://dev.tourl"&gt;https://x.com/anon5877/status/2104931447513768448?s=20&lt;/a&gt;. Meanwhile I was working towards building this I came across a very interesting concept which today i wanna share with you all. So sit tight we are about to learn how my keyboard and a tiny chip manage to agree with everything without a shared brain.&lt;/p&gt;

&lt;h2&gt;
  
  
  LORE I - &lt;em&gt;&lt;strong&gt;Three strangers in a trench coat&lt;/strong&gt;&lt;/em&gt;
&lt;/h2&gt;

&lt;p&gt;I press a key. The ring LED on my desk obeys. Now the question is how?- how do they obey with no one in charge. When I press the keyboard carries its own tiny microcontroller and speaks a USB standard called HID (Human Interface Device). It has no idea that a ring exists. The OS(Operating system) hands the browser your keypress. The Browser-our second character-establishes a key distinction: it's a relay, not a boss. It passes messages; doesn't command anything. Now a tiny device called the Arduino Nano, an ATmega328P which is our third character which is also connected to the serial line but has no idea the keyboard exists. So - how do they agree ?&lt;/p&gt;

&lt;h2&gt;
  
  
  LORE II — &lt;em&gt;&lt;strong&gt;The Laws of the Wire&lt;/strong&gt;&lt;/em&gt;
&lt;/h2&gt;

&lt;p&gt;As I searched the depths of my codebase, I found a file called PROTOCOL.md. Yes, a simple text file-and the first thing it told me was that the wire itself knows nothing. It says the wire does not know what a message says or means. Its only job is to move bytes at a fixed speed- and hand them over in whatever clumps it feels like, which means we can never control how the bytes arrive: one read can hand you half a message, or three glued together. So structure can't come from the wire. It has to come from agreement. The agreed boundary: every message is &lt;strong&gt;LABEL:value ** and ends with **\n&lt;/strong&gt;. Why &lt;strong&gt;\n&lt;/strong&gt;: it can't appear inside a message, so it's a safe "end here" marker. The buffer: collects bytes; whenever the delimiter appears, drain everything before it as one clean message. So: irregular bytes become  messages the moment both sides agree where the fence ends.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fo10ieewopxugoscxfzux.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fo10ieewopxugoscxfzux.png" alt=" " width="800" height="193"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Messages have now structure but structure isn't agreement. Anyone can shout; these two character of our story had to agree on how to behave while shouting. There's no boss , so there are certain set of rules do all the work. Four rules. A tiny constitution.&lt;/p&gt;

&lt;h2&gt;
  
  
  &lt;strong&gt;&lt;em&gt;Law 1&lt;/em&gt;&lt;/strong&gt; -  messages say "be at X," not "do X again" → repeats are harmless → that's why there are no acks and no retries. Its like say I have a fever and I shout repeatedly that I have a fever, the shouting will not change my fever so: it is idempotent in nature.
&lt;/h2&gt;

&lt;h2&gt;
  
  
  &lt;strong&gt;&lt;em&gt;Law 2&lt;/em&gt;&lt;/strong&gt; - each value has one owner, the other mirrors → conflicts can't form.
&lt;/h2&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Message&lt;/th&gt;
&lt;th&gt;Meaning&lt;/th&gt;
&lt;th&gt;Writer&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;SPEED:12&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;animation speed — 0 to 50&lt;/td&gt;
&lt;td&gt;browser&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;POWER:200&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;LED brightness — 0 to 255&lt;/td&gt;
&lt;td&gt;browser&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;COLOR:255,0,0&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;LED colour — r, g, b&lt;/td&gt;
&lt;td&gt;Arduino&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;h2&gt;
  
  
  &lt;strong&gt;&lt;em&gt;Law 3&lt;/em&gt;&lt;/strong&gt; - neither device trusts the other; each clamps values into legal range on its own. So: no trust required between strangers.
&lt;/h2&gt;

&lt;h2&gt;
  
  
  &lt;strong&gt;&lt;em&gt;Law 4&lt;/em&gt;&lt;/strong&gt; - when the nano boots, it announces where it stands; when the browser isn't sure, it asks. (That asks command is SYNC).
&lt;/h2&gt;

&lt;p&gt;They don't coordinate - they follow the same polite rules.&lt;/p&gt;

&lt;h2&gt;
  
  
  &lt;strong&gt;&lt;em&gt;THE SIGN-OFF&lt;/em&gt;&lt;/strong&gt;
&lt;/h2&gt;

&lt;p&gt;So that's the whole trick. One keypress, three strangers who've never met, and a wire that has no idea what it's carrying.&lt;/p&gt;

&lt;p&gt;Turns out the internet runs on the exact same idea — bytes over a wire, agreed boundaries, polite rules. The whole thing, desk-sized.&lt;/p&gt;

&lt;p&gt;They never needed a common brain. They needed a contract — and a few polite rules. Two things don't agree because someone forces them to; they agree because they both keep the same promise.&lt;/p&gt;

&lt;p&gt;The build's still going — hopefully wrapped before November. You can watch the chaos here:&lt;a href="https://dev.tourl"&gt; https://x.com/anon5877&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Thanks for reading. See you in the next one — assuming I don't vanish again.&lt;/p&gt;

</description>
      <category>hardware</category>
      <category>iot</category>
      <category>programming</category>
    </item>
    <item>
      <title>Noise, Attenuation &amp; The Secret Life of Signals – A Beginner’s Dive into the Physical Layer</title>
      <dc:creator>Codetard</dc:creator>
      <pubDate>Mon, 21 Jul 2025 12:59:07 +0000</pubDate>
      <link>https://dev.to/anon5877/noise-attenuation-the-secret-life-of-signals-a-beginners-dive-into-the-physical-layer-5do</link>
      <guid>https://dev.to/anon5877/noise-attenuation-the-secret-life-of-signals-a-beginners-dive-into-the-physical-layer-5do</guid>
      <description>&lt;h1&gt;
  
  
  Hey guys, Codetard here! 👨‍💻
&lt;/h1&gt;

&lt;p&gt;If you're coming from Twitter, you probably already know me. If you're new—welcome aboard! This little corner of the internet is where I’ll be diving into different computer science topics as I journey through university. So stick around, learn with me, and let’s geek out together. 😄&lt;/p&gt;

&lt;p&gt;Today’s special topic on the menu is...&lt;/p&gt;




&lt;h2&gt;
  
  
  🌐 Attenuation and Noise in Computer Networks
&lt;/h2&gt;

&lt;p&gt;This comes from one of my favorite subjects: &lt;strong&gt;Computer Networks&lt;/strong&gt;. It’s all about how data—be it your messages, downloads, or YouTube videos—is sent across devices using the &lt;strong&gt;OSI Model&lt;/strong&gt;, which breaks communication into seven logical layers.&lt;/p&gt;

&lt;p&gt;Now, the concept we’re tackling today lives at the very bottom—the &lt;strong&gt;Physical Layer&lt;/strong&gt; (Layer 1). This is where all the actual signal transmission happens.&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;&lt;strong&gt;Bonus:&lt;/strong&gt; If you're curious to explore the entire OSI model, here's a great visual reference I found helpful:&lt;br&gt;
&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fkw2tw2mmk631qn33i063.jpg" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fkw2tw2mmk631qn33i063.jpg" alt="OSI Layers" width="560" height="456"&gt;&lt;/a&gt;&lt;/p&gt;
&lt;/blockquote&gt;




&lt;h2&gt;
  
  
  🎯 Noise – The Signal Disruptor
&lt;/h2&gt;

&lt;p&gt;Imagine sending a perfect signal—a smooth, clean &lt;strong&gt;digital sine wave&lt;/strong&gt;. It looks something like this:&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fpmaj3iuzebf68zo7az5r.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fpmaj3iuzebf68zo7az5r.png" alt="Clean Signal" width="800" height="382"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;But here’s the catch: as signals travel, they don’t always reach the destination unscathed. They often pick up &lt;strong&gt;noise&lt;/strong&gt;—unwanted interference from external sources (like electrical signals, magnetic fields, etc.).&lt;/p&gt;

&lt;p&gt;This noise distorts the wave, as you can see below:&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fqayfdumuiyk8msuyazlv.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fqayfdumuiyk8msuyazlv.png" alt="Noisy Signal" width="800" height="382"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Notice how the wave's surface becomes jagged and uneven. This is what happens when noise interferes—it messes up the shape of the signal. In real-world scenarios, this can lead to &lt;strong&gt;data loss&lt;/strong&gt;, &lt;strong&gt;errors&lt;/strong&gt;, or &lt;strong&gt;misinterpretation&lt;/strong&gt;, which is a serious concern in industries like &lt;strong&gt;satellite communication&lt;/strong&gt;, &lt;strong&gt;aviation&lt;/strong&gt;, and more.&lt;/p&gt;

&lt;h2&gt;
  
  
  NOISE TECHNICAL DOWNSIDES:-
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;Data Corruption  and Errors:- 
Unwanted disturbances in data transmission , power supply  fluctuations, or sensors readings can introduce as false readings, furthermore as we have datasets in machine learning(ML) a noisy or corrupt data can cause degradation of overall learning parameters and prediction accuracy.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fy8tddponh2f3iihh210z.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fy8tddponh2f3iihh210z.png" alt=" " width="800" height="800"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Bit error :- As you know during these transfer of data our data most of the time is converted into bits these bits hold all our information about our data but here comes our villain noise here acts and disrupts our signal which pollutes or flips a important bit like reading 0 instead of 1 this is why most files get corrupted.
&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fvksisxgfkkw51l2qau1r.png" alt=" " width="800" height="800"&gt; &lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  Noise impact on real world:-
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;Have you ever wondered why you sometimes keep experiencing 'connecting' status during a video or audio call this is because of our villain noise. Noise here corrupts our signal due to which communication apps like WhatsApp, Telegram etc. have to retransmit our signals meaning retry giving signals or if receiving messages follow a very interesting approach of checksum(A part of bit error detection method) and if detected uses the same approach of retransmitting the original signals in there queues.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fp7stxaztdneczdsy00ta.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fp7stxaztdneczdsy00ta.png" alt=" " width="800" height="800"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Environmental manipulation like water sprinkling near pollution sensors acts as measurement noise — the sensor reads cleaner air locally, but the true city-wide pollution remains unchanged.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F49d0l7nwys09jc65birz.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F49d0l7nwys09jc65birz.png" alt=" " width="800" height="800"&gt;&lt;/a&gt;&lt;/p&gt;




&lt;h2&gt;
  
  
  📉 Attenuation – The Signal Fader
&lt;/h2&gt;

&lt;p&gt;Now let’s talk about &lt;strong&gt;attenuation&lt;/strong&gt;. This is when a signal &lt;strong&gt;loses strength&lt;/strong&gt; the farther it travels.&lt;/p&gt;

&lt;p&gt;Here's a visual from my project to help you picture it:&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fcp3suxqef13lsgfv6bgr.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fcp3suxqef13lsgfv6bgr.png" alt="Attenuated Signal" width="800" height="382"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;As you can see, the wave becomes &lt;strong&gt;flatter&lt;/strong&gt; and weaker. This weakening can make the signal unreadable at the receiving end. That’s why devices like &lt;strong&gt;repeaters&lt;/strong&gt;, &lt;strong&gt;amplifiers&lt;/strong&gt;, or &lt;strong&gt;boosters&lt;/strong&gt; are used—to regenerate or strengthen the signal along its journey.&lt;/p&gt;

&lt;p&gt;This factor is critical in &lt;strong&gt;telecommunication networks&lt;/strong&gt;, especially when we're covering long distances, like undersea cables or satellite relays.&lt;/p&gt;

&lt;h2&gt;
  
  
  ATTENUATION TECHNICAL DOWNSIDES:-
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;Reduces Signal to noise ratio which we call SNR in short form and why should we considered by it. So let me tell you SNR ratio is ration between power of signal and power of noise so what attenuation does is weaken the signal over distance which directly means a low signal strength or power thus disrupting the snr ratio&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;As we know that we communicate daily worldwide so in order to make these communications more easy we have to backup our infrastructure in terms of more amplifiers, repeaters etc. Which increases our maintenance cost , power cost and human resources and their management cost. &lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  Attenuation impact on real world:-
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;Ever noticed how Wi-Fi is blazing fast when you’re near the router, but the moment you step into another room, everything slows down?
That’s attenuation in action.
What’s happening technically?&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Wi-Fi signals lose energy as they travel through air.&lt;/p&gt;

&lt;p&gt;Walls, furniture, and even humans absorb and weaken the signal.&lt;/p&gt;

&lt;p&gt;Higher-frequency Wi-Fi (like 5 GHz or 6 GHz) attenuates even faster because it can’t penetrate obstacles well.&lt;/p&gt;

&lt;p&gt;🧨 Real-world impact:&lt;/p&gt;

&lt;p&gt;You get lower bars on your phone.&lt;/p&gt;

&lt;p&gt;Download speed drops.&lt;/p&gt;

&lt;p&gt;Online games lag.&lt;/p&gt;

&lt;p&gt;YouTube drops to 360p “to save your sanity.”&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fkna7agfn60kl5pq5rslh.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fkna7agfn60kl5pq5rslh.png" alt=" " width="800" height="800"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Google Maps often becomes inaccurate—showing the blue dot drifting, spinning, or jumping to the wrong road—because GPS signals from satellites are extremely weak by the time they reach Earth, and attenuation makes them even weaker as they pass through obstacles like buildings, tunnels, malls, car roofs, and bad weather; this weakening causes your phone to lose precise satellite lock, leading to “GPS signal lost,” unreliable navigation, delayed updates, wrong directions, and frequent rerouting, all because the attenuated signal is too faint for the device to decode correctly.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F675tisxlzxu9kfvf6voh.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F675tisxlzxu9kfvf6voh.png" alt=" " width="800" height="800"&gt;&lt;/a&gt;&lt;/p&gt;




&lt;h2&gt;
  
  
  🧠 Code Logic (Used to Determine How to Handle Attenuation and Noise)
&lt;/h2&gt;

&lt;p&gt;If you're new to programming or computer simulations—don’t worry! Let's break this down together. 👇&lt;/p&gt;

&lt;p&gt;We’re using a little bit of JavaScript code to &lt;strong&gt;simulate how noise and attenuation affect a digital signal&lt;/strong&gt; as it travels.&lt;/p&gt;

&lt;p&gt;Here’s the core logic:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;noise&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="p"&gt;((&lt;/span&gt;&lt;span class="nb"&gt;Math&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;random&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt; &lt;span class="o"&gt;-&lt;/span&gt; &lt;span class="mf"&gt;0.5&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="o"&gt;*&lt;/span&gt; &lt;span class="nx"&gt;noiseLevel&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
&lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;attenuationFactor&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nb"&gt;Math&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;pow&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="mi"&gt;1&lt;/span&gt; &lt;span class="o"&gt;-&lt;/span&gt; &lt;span class="nx"&gt;attenuationLevel&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;x&lt;/span&gt; &lt;span class="o"&gt;/&lt;/span&gt; &lt;span class="nx"&gt;width&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;






&lt;h3&gt;
  
  
  🎙️ Line-by-Line Breakdown:
&lt;/h3&gt;

&lt;h4&gt;
  
  
  1. &lt;strong&gt;Noise Simulation&lt;/strong&gt;
&lt;/h4&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;noise&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="p"&gt;((&lt;/span&gt;&lt;span class="nb"&gt;Math&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;random&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt; &lt;span class="o"&gt;-&lt;/span&gt; &lt;span class="mf"&gt;0.5&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="o"&gt;*&lt;/span&gt; &lt;span class="nx"&gt;noiseLevel&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;ul&gt;
&lt;li&gt;
&lt;code&gt;Math.random()&lt;/code&gt; generates a number between &lt;code&gt;0&lt;/code&gt; and &lt;code&gt;1&lt;/code&gt;.&lt;/li&gt;
&lt;li&gt;Subtracting &lt;code&gt;0.5&lt;/code&gt; centers it around &lt;code&gt;0&lt;/code&gt;, so now the value ranges from &lt;code&gt;-0.5&lt;/code&gt; to &lt;code&gt;+0.5&lt;/code&gt;.&lt;/li&gt;
&lt;li&gt;Then we multiply it by &lt;code&gt;noiseLevel&lt;/code&gt; to &lt;strong&gt;control how intense the noise is&lt;/strong&gt;.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;👉 This simulates &lt;strong&gt;random distortion&lt;/strong&gt;—just like real-life noise that can push a signal up or down unpredictably.&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;Example: If &lt;code&gt;noiseLevel = 10&lt;/code&gt;, then &lt;code&gt;noise&lt;/code&gt; will vary randomly between &lt;code&gt;-5&lt;/code&gt; and &lt;code&gt;+5&lt;/code&gt;.&lt;/p&gt;
&lt;/blockquote&gt;




&lt;h4&gt;
  
  
  2. &lt;strong&gt;Attenuation Simulation&lt;/strong&gt;
&lt;/h4&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;attenuationFactor&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nb"&gt;Math&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;pow&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="mi"&gt;1&lt;/span&gt; &lt;span class="o"&gt;-&lt;/span&gt; &lt;span class="nx"&gt;attenuationLevel&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;x&lt;/span&gt; &lt;span class="o"&gt;/&lt;/span&gt; &lt;span class="nx"&gt;width&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;ul&gt;
&lt;li&gt;
&lt;code&gt;attenuationLevel&lt;/code&gt; is how much signal is lost per unit distance (like 0.01 for 1% loss).&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;x&lt;/code&gt; is the &lt;strong&gt;position&lt;/strong&gt; or &lt;strong&gt;distance&lt;/strong&gt; the signal has traveled.&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;width&lt;/code&gt; is the &lt;strong&gt;total distance&lt;/strong&gt; (like the full length of a cable).&lt;/li&gt;
&lt;li&gt;The formula uses &lt;strong&gt;exponential decay&lt;/strong&gt; to simulate &lt;strong&gt;gradual loss&lt;/strong&gt; over distance.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;👉 The farther the signal travels (&lt;code&gt;x&lt;/code&gt; increases), the &lt;strong&gt;smaller the attenuation factor&lt;/strong&gt; becomes, flattening the signal—just like in real life.&lt;/p&gt;




&lt;h3&gt;
  
  
  ⚡ Putting It All Together
&lt;/h3&gt;

&lt;p&gt;When we simulate a wave across a canvas or graph, we apply:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Random &lt;strong&gt;&lt;code&gt;noise&lt;/code&gt;&lt;/strong&gt; to simulate environmental disruption&lt;/li&gt;
&lt;li&gt;A &lt;strong&gt;&lt;code&gt;attenuationFactor&lt;/code&gt;&lt;/strong&gt; to reduce its strength as it travels&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;This helps us &lt;strong&gt;visualize&lt;/strong&gt; how clean signals degrade in real-world communication systems!&lt;/p&gt;




&lt;h2&gt;
  
  
  🧠 Wrap-Up
&lt;/h2&gt;

&lt;p&gt;So today we looked at two major villains in the world of signals: &lt;strong&gt;noise&lt;/strong&gt;, which distorts the signal’s shape, and &lt;strong&gt;attenuation&lt;/strong&gt;, which drains its strength. Both are super important to consider when designing any kind of network system.&lt;/p&gt;

&lt;p&gt;Hope this gave you some insights (and cool visuals) to imagine how raw digital signals behave out there in the wild! 🌍&lt;/p&gt;




&lt;h2&gt;
  
  
  🧪 Wanna Play With This IRL?
&lt;/h2&gt;

&lt;p&gt;If you want to experiment with the simulation yourself—add chaos, tweak the noise, break some signals—&lt;br&gt;
&lt;strong&gt;fork this repo and go wild&lt;/strong&gt; on your own system:&lt;/p&gt;

&lt;p&gt;👉 &lt;strong&gt;&lt;a href="https://github.com/Shivamupmanyu2005/Noise-Simulation" rel="noopener noreferrer"&gt;Noise-simulation (GitHub Repo)&lt;/a&gt;&lt;/strong&gt;&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;Warning: May cause an unhealthy obsession with sine waves. Proceed at your own risk. 😵‍💻&lt;/p&gt;
&lt;/blockquote&gt;




&lt;p&gt;More topics coming soon—until then, stay curious and keep coding.&lt;br&gt;
If you liked this blog,&lt;br&gt;
follow me on &lt;a href="https://x.com/anon5877" rel="noopener noreferrer"&gt;X&lt;/a&gt; to enjoy my shitposts (mostly coding, sometimes crying in console&lt;br&gt;
&lt;strong&gt;– Codetard, signing off ✌️&lt;/strong&gt;&lt;/p&gt;




</description>
      <category>computernetwork</category>
      <category>webdev</category>
      <category>react</category>
      <category>tailwindcss</category>
    </item>
  </channel>
</rss>
