<?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: Hedy</title>
    <description>The latest articles on DEV Community by Hedy (@carolineee).</description>
    <link>https://dev.to/carolineee</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%2F1235784%2F7ca9b5fb-3787-4b71-91bf-b19f25ed7eae.jpg</url>
      <title>DEV Community: Hedy</title>
      <link>https://dev.to/carolineee</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/carolineee"/>
    <language>en</language>
    <item>
      <title>Why Your Phone Speaker Sounds Muffled and How to Troubleshoot It</title>
      <dc:creator>Hedy</dc:creator>
      <pubDate>Wed, 04 Nov 2026 06:25:15 +0000</pubDate>
      <link>https://dev.to/carolineee/why-your-phone-speaker-sounds-muffled-and-how-to-troubleshoot-it-2g0f</link>
      <guid>https://dev.to/carolineee/why-your-phone-speaker-sounds-muffled-and-how-to-troubleshoot-it-2g0f</guid>
      <description>&lt;h2&gt;
  
  
  Start with the symptom, not a purchase
&lt;/h2&gt;

&lt;p&gt;When dealing with phone speakers, it is tempting to jump from muffled audio to the conclusion that the hardware must be replaced. That shortcut is expensive and frequently unhelpful. A problem can originate in settings, signal routing, physical contamination, a worn component, or the way a browser or application handles input. Some causes can be checked in minutes, while others deserve a trained technician. The useful question is not simply “Does it work?” but “Under what conditions does it fail, and can the behavior be repeated?” This guide offers a measured way to find out without treating every software test as a definitive hardware diagnosis.&lt;/p&gt;

&lt;p&gt;The most plausible starting explanations include a blocked speaker grille, incorrect audio routing, or trapped moisture. Those are hypotheses, not findings about your particular device. A sound comparison, key-event test, or controlled mouse movement can narrow possibilities, but it cannot examine sealed electronics or certify that a product is undamaged. Write down what happened before the problem began and exactly what you observe now. That small habit often proves more useful than trying five random fixes in a row.&lt;/p&gt;

&lt;h2&gt;
  
  
  First checks: remove the easy variables
&lt;/h2&gt;

&lt;p&gt;Before opening hardware or changing advanced settings, begin with a familiar recording, disconnect Bluetooth, remove the case, and compare media from two applications. Keep your test environment simple. Use a familiar source, a stable surface, a repeatable sequence, and a level or intensity that is safe for the device. If an external accessory is involved, test with and without it. Rebooting can clear temporary software states, but it should not replace observing the original failure first. If there is visible damage, unusual heat, a burning smell, or suspected electrical exposure, stop the test and follow the manufacturer's service instructions instead.&lt;/p&gt;

&lt;p&gt;Consider the difference between a symptom that happens everywhere and one that happens in only one program. A failure limited to a single game, browser tab, or playback app may involve an app-level setting or permission. An issue that persists across applications and another compatible host is stronger evidence of a device-level fault. Even then, compatibility, drivers, and cable quality remain possible variables. The aim is to narrow the search before spending money, not to produce a false yes-or-no verdict.&lt;/p&gt;

&lt;h2&gt;
  
  
  Three situations that look similar but require different responses
&lt;/h2&gt;

&lt;p&gt;&lt;strong&gt;Scenario one.&lt;/strong&gt; A commuter notices that podcasts become dull after a rainy walk. The phone rings normally, yet speech in videos seems covered by a blanket. That pattern suggests testing the bottom loudspeaker separately from the earpiece instead of assuming both are damaged. The lesson is to match the test to the actual symptom rather than relying on a generic “device broken” label. Document both what fails and what still works. Functioning related features can help isolate the issue, although they do not rule out every form of damage.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Scenario two.&lt;/strong&gt; After switching off Bluetooth, the same recording suddenly sounds clear. This is a routing problem rather than physical dirt. No amount of brushing would have repaired it. This example shows why it is helpful to change just one variable and then repeat the original action. If the symptom disappears, verify the improvement once more before declaring the issue solved. Temporary improvement is useful evidence, not always proof of a permanent fix.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Scenario three.&lt;/strong&gt; A different phone gradually becomes quiet over months, particularly when used in a dusty workshop. A careful inspection of the grille and a soft dry brush are better first actions than aggressive audio playback. Here, context matters as much as the test result. Recent exposure, the user's environment, accessory changes, and the timing of the failure can all change the best next step. A careful, modest intervention is usually preferable to forcing a component beyond its intended operating conditions.&lt;/p&gt;

&lt;h2&gt;
  
  
  Use browser-based tools as a second opinion
&lt;/h2&gt;

&lt;p&gt;For a quick structured check, try the &lt;a href="https://fixnhandy.com/phone-speaker-muffled/" rel="noopener noreferrer"&gt;Phone Speaker Muffled&lt;/a&gt; resource. It is an interactive browser tool, not a substitute for manufacturer diagnostics or professional repair. Its main value is helping users repeat a known action and observe whether the symptom occurs consistently. If you need a complementary perspective, the &lt;a href="https://fixnhandy.com/headphone-test/" rel="noopener noreferrer"&gt;Headphone Test&lt;/a&gt; can help separate nearby possibilities or cross-check another aspect of performance. Open both links only when their functions relate to your actual symptoms; more tests do not necessarily provide better evidence.&lt;/p&gt;

&lt;p&gt;A useful protocol has four parts. First, establish a baseline before making changes. Second, change one setting or condition. Third, repeat the baseline test using comparable input. Fourth, record whether the outcome improved, worsened, or stayed unchanged. This approach helps avoid placebo effects, accidental volume changes, and claims based on one unusual reading. Browser tests are convenient and accessible, but browser event timing, permissions, output processing, operating-system behavior, and hardware limits may affect results.&lt;/p&gt;

&lt;h2&gt;
  
  
  Interpret the evidence carefully
&lt;/h2&gt;

&lt;p&gt;Calls can involve a different earpiece from the bottom loudspeaker. A speakerphone test does not automatically diagnose the private call earpiece. A reported number or a successful on-screen indicator is one piece of evidence, not a complete picture. Cross-check the test with ordinary tasks that originally revealed the problem. If an input test looks normal yet an application still misbehaves, investigate that application and its configuration rather than immediately assuming the test is incorrect. Conversely, if a test reproduces the issue, try a controlled alternate setup before attributing it solely to physical damage.&lt;/p&gt;

&lt;p&gt;Use the same audio clip at a comfortable volume before and after a single intervention. A louder clip is not proof of improved fidelity. This gives you a simple record to compare later or share with support. Include the date, device model if relevant, operating-system version, connections, settings, and a short description of what changed. You do not need laboratory equipment to perform a useful first-pass diagnosis. You do need consistent conditions and a willingness to label uncertainty rather than forcing a confident conclusion from limited observations.&lt;/p&gt;

&lt;h2&gt;
  
  
  Reasonable fixes before replacing hardware
&lt;/h2&gt;

&lt;p&gt;Where the product remains safe to operate, consider a clean, dry, soft brush for accessible grille dust; patience and gentle drying after moisture exposure. Follow the device maker's official care and maintenance guidance, especially for batteries, moisture, delicate ports, adhesives, and warranty seals. Prioritize reversible interventions: changing a setting, trying another supported port, checking a connection, or cleaning only surfaces that the manufacturer says may be cleaned. Preserve your previous settings so you can undo an unsuccessful change. If a problem appears after a system update, note the version and see whether the vendor has documented the behavior.&lt;/p&gt;

&lt;p&gt;Do not combine several interventions and then assume the last one worked. For example, changing settings, restarting, moving to a new port, and cleaning the device simultaneously makes the cause impossible to isolate. Instead, rerun the same short test after each action. When the symptom improves, use the device normally for a reasonable period and watch for recurrence. Intermittent failures are often the hardest to diagnose and deserve several observations rather than a premature replacement decision.&lt;/p&gt;

&lt;h2&gt;
  
  
  Mistakes that make troubleshooting harder
&lt;/h2&gt;

&lt;p&gt;Avoid sharp tools, heat guns, compressed air, and repeated full-volume tones. Water-ejection tones can sometimes shift surface droplets, but they cannot repair internal liquid damage. An aggressive “fix” can create more damage than the original problem. The same applies to unverified repair claims that promise a universal solution. Resist the urge to run high-intensity tests repeatedly; a test that creates discomfort, heat, abnormal noise, or unstable operation should be stopped. Do not assume that a tool showing 100% completion means the underlying hardware has been restored. Completion means a procedure ran, not that every fault was corrected.&lt;/p&gt;

&lt;p&gt;Another common mistake is ignoring the context around the problem. Is the symptom new? Does it follow a software update, spill, impact, or new peripheral? Does it occur only after a long session? Does a second compatible device behave differently under the same conditions? These comparisons are often more diagnostic than collecting a dozen arbitrary performance scores. Keep notes brief enough that you will actually use them, but specific enough that someone else could repeat your test.&lt;/p&gt;

&lt;h2&gt;
  
  
  When a repair or replacement is the sensible choice
&lt;/h2&gt;

&lt;p&gt;Seek qualified repair or consider replacement when you observe a sudden distortion following a drop, persistent crackling, or no sound after basic software checks. If the device is under warranty, consult the manufacturer before opening it or using third-party solvents. For low-cost peripherals, repairability, switch availability, and the cost of a replacement may influence the decision. For phones, laptops, or other costly electronics, data backup and professional assessment can matter more than the apparent price of a minor component. If the problem creates a safety concern, prioritize safety over finishing a diagnostic checklist.&lt;/p&gt;

&lt;p&gt;A decision should include the age of the device, severity and frequency of the failure, available manufacturer support, and whether a workaround interferes with daily use. Not every irregular result justifies purchasing new hardware. Equally, not every malfunction can be solved from a website. The best outcome is an informed choice based on repeatable observations and appropriate technical advice.&lt;/p&gt;

&lt;h2&gt;
  
  
  A practical ten-minute workflow
&lt;/h2&gt;

&lt;ol&gt;
&lt;li&gt;
&lt;strong&gt;Describe the failure:&lt;/strong&gt; Write one sentence specifying what fails and when.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Check the obvious:&lt;/strong&gt; Review connections, applicable permissions, mode settings, and recent changes.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Establish a baseline:&lt;/strong&gt; Reproduce the symptom once under ordinary, safe conditions.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Run a targeted test:&lt;/strong&gt; Use &lt;a href="https://fixnhandy.com/phone-speaker-muffled/" rel="noopener noreferrer"&gt;Phone Speaker Muffled&lt;/a&gt; to investigate the symptom rather than chasing unrelated numbers.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Cross-check:&lt;/strong&gt; Compare a second relevant behavior using &lt;a href="https://fixnhandy.com/speaker-test/" rel="noopener noreferrer"&gt;Speaker Test&lt;/a&gt; when appropriate.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Change one factor:&lt;/strong&gt; Apply a low-risk, reversible adjustment.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Repeat exactly:&lt;/strong&gt; Use comparable inputs and observe whether the result really changes.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Decide what follows:&lt;/strong&gt; Continue normally, consult official support, or stop using unsafe hardware.&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;This ten-minute outline is not a guaranteed repair timetable. It is a way to organize the first few minutes so that you finish with more information than you started with. Some devices require specialized measurement, disassembly, or replacement parts. A clear symptom history helps professionals work faster and reduces the chance of paying for unrelated work.&lt;/p&gt;

&lt;h2&gt;
  
  
  Frequently asked questions
&lt;/h2&gt;

&lt;h3&gt;
  
  
  Can an online tool prove that the hardware is broken?
&lt;/h3&gt;

&lt;p&gt;No. It can provide evidence by reproducing a symptom or displaying events and outputs visible to the browser. Drivers, permissions, scheduling, and connected equipment can influence those observations. Definitive component-level diagnosis may require vendor software or physical testing.&lt;/p&gt;

&lt;h3&gt;
  
  
  Should I try multiple fixes at the same time?
&lt;/h3&gt;

&lt;p&gt;Usually not. Change one variable at a time so a genuine improvement can be attributed to an identifiable cause. If the device is unsafe or wet, follow safety guidance immediately rather than a controlled experimental sequence.&lt;/p&gt;

&lt;h3&gt;
  
  
  What if a test says everything works but I still notice the problem?
&lt;/h3&gt;

&lt;p&gt;Recreate the exact conditions in which you originally encountered the issue. A short generic test may not include the same application, duration, position, load, or input combination. Record that limitation instead of discarding either observation.&lt;/p&gt;

&lt;h3&gt;
  
  
  Is it worth paying for repair?
&lt;/h3&gt;

&lt;p&gt;Compare the repair estimate with replacement cost, warranty status, environmental impact, and the device's remaining usefulness. A diagnosis should inform that decision, not automatically prescribe one outcome.&lt;/p&gt;

&lt;h2&gt;
  
  
  Final thoughts
&lt;/h2&gt;

&lt;p&gt;A smart troubleshooting process replaces guesswork with careful comparison. For phone speakers, the key is to reproduce muffled audio, rule out common external causes, and avoid changes that create new risks. Free browser-based tools can make the first stage faster and easier to document, but the result still needs interpretation. Start with the simplest relevant check, record what you learn, and move toward professional help when the evidence points beyond safe at-home troubleshooting.&lt;/p&gt;

</description>
    </item>
    <item>
      <title>How to Read Resistor Color Codes and Avoid Common Identification Errors</title>
      <dc:creator>Hedy</dc:creator>
      <pubDate>Wed, 04 Nov 2026 06:07:31 +0000</pubDate>
      <link>https://dev.to/carolineee/how-to-read-resistor-color-codes-and-avoid-common-identification-errors-14op</link>
      <guid>https://dev.to/carolineee/how-to-read-resistor-color-codes-and-avoid-common-identification-errors-14op</guid>
      <description>&lt;h1&gt;
  
  
  How to Read Resistor Color Codes and Avoid Common Identification Errors
&lt;/h1&gt;

&lt;p&gt;A resistor may be one of the least expensive parts on a circuit board, but identifying the wrong value can make an otherwise sound design behave unpredictably. A misplaced decimal point can change an LED current by a factor of ten. A misunderstood tolerance band can turn a perfectly good component into a false troubleshooting lead. And when a resistor has been overheated, reading the colors can become considerably harder than a textbook diagram suggests.&lt;/p&gt;

&lt;p&gt;This guide explains how to identify through-hole and surface-mount resistors, verify their values, and decide when a visual marking is not enough. It is intended for students, makers, repair technicians, and engineers checking a prototype or an unknown &lt;a href="https://mozpcb.com/" rel="noopener noreferrer"&gt;PCB&lt;/a&gt;.&lt;/p&gt;

&lt;h2&gt;
  
  
  Why resistor identification deserves a second check
&lt;/h2&gt;

&lt;p&gt;Most fixed resistors are nonpolarized, so they can be installed in either direction. Their markings, however, are not arbitrary. Standard axial resistors use colored bands that encode a resistance value and, usually, a tolerance. Surface-mount resistors may instead use three-digit or four-digit codes, specialized codes, or no marking at all.&lt;/p&gt;

&lt;p&gt;Identification matters for at least three reasons. First, a resistor's nominal value determines current and voltage relationships in the surrounding circuit. Second, its tolerance defines an initial range rather than an exact measured value. Third, a replacement with the same ohmic value may still be unsuitable because its power, voltage, pulse, size, or temperature specifications differ.&lt;/p&gt;

&lt;p&gt;The simplest workflow is to &lt;strong&gt;read, calculate, measure, and verify against the circuit&lt;/strong&gt;—in that order.&lt;/p&gt;

&lt;h2&gt;
  
  
  Understanding the four-band system
&lt;/h2&gt;

&lt;p&gt;A standard four-band resistor uses two significant digits, one multiplier, and one tolerance band.&lt;/p&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Band position&lt;/th&gt;
&lt;th&gt;Meaning&lt;/th&gt;
&lt;th&gt;Example: brown–black–orange–gold&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;First&lt;/td&gt;
&lt;td&gt;First significant digit&lt;/td&gt;
&lt;td&gt;Brown = 1&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Second&lt;/td&gt;
&lt;td&gt;Second significant digit&lt;/td&gt;
&lt;td&gt;Black = 0&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Third&lt;/td&gt;
&lt;td&gt;Power-of-ten multiplier&lt;/td&gt;
&lt;td&gt;Orange = ×1,000&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Fourth&lt;/td&gt;
&lt;td&gt;Tolerance&lt;/td&gt;
&lt;td&gt;Gold = ±5%&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;p&gt;The example gives &lt;code&gt;(10 × 1,000) Ω = 10,000 Ω&lt;/code&gt;, or &lt;strong&gt;10 kΩ ±5%&lt;/strong&gt;. That means the initial value may fall between 9.5 kΩ and 10.5 kΩ under the manufacturer's specified conditions. The tolerance does not guarantee the part stays within that range after every combination of thermal stress, aging, and overload.&lt;/p&gt;

&lt;p&gt;The digit colors are black 0, brown 1, red 2, orange 3, yellow 4, green 5, blue 6, violet 7, gray 8, and white 9. Multiplier colors follow the same powers of ten, with gold and silver commonly representing ×0.1 and ×0.01. Gold and silver also appear as tolerance colors, so band &lt;em&gt;position&lt;/em&gt; is essential.&lt;/p&gt;

&lt;p&gt;When the bands are hard to distinguish, an interactive &lt;a href="https://mozelectronics.com/free-resistor-color-code-calculator-tool/" rel="noopener noreferrer"&gt;resistor color code calculator&lt;/a&gt; can help you test alternative readings for three-, four-, five-, or six-band parts. It is especially useful when red and orange or brown and violet are difficult to separate under workshop lighting.&lt;/p&gt;

&lt;h2&gt;
  
  
  Five bands: three significant digits change the calculation
&lt;/h2&gt;

&lt;p&gt;Precision metal-film resistors often use five bands. In a common five-band arrangement, the first three bands are significant digits, the fourth is the multiplier, and the fifth is the tolerance.&lt;/p&gt;

&lt;p&gt;Consider &lt;strong&gt;brown–black–black–red–brown&lt;/strong&gt;:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Brown, black, black becomes &lt;code&gt;100&lt;/code&gt;.&lt;/li&gt;
&lt;li&gt;Red is a multiplier of &lt;code&gt;100&lt;/code&gt;.&lt;/li&gt;
&lt;li&gt;Brown in the tolerance position means &lt;code&gt;±1%&lt;/code&gt;.&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;The resistance is &lt;code&gt;100 × 100 = 10,000 Ω&lt;/code&gt;, again &lt;strong&gt;10 kΩ&lt;/strong&gt;, but with a tighter nominal tolerance than the four-band example.&lt;/p&gt;

&lt;p&gt;A six-band marking commonly adds a temperature-coefficient band. The extra band matters in measurement circuits where small temperature-driven changes affect gain, reference levels, or calibration. Always confirm a manufacturer's special marking system when a pattern does not match a standard chart.&lt;/p&gt;

&lt;h2&gt;
  
  
  Which end should you read first?
&lt;/h2&gt;

&lt;p&gt;The tolerance band is often spaced farther from the other bands, helping indicate the reading direction. Gold or silver near one end can also provide a useful clue. Neither clue is perfect, especially on compact components or parts with faded paint.&lt;/p&gt;

&lt;p&gt;If a plausible reading produces an unusual value, reverse the direction and test it again. Next, compare the result with the surrounding circuitry. A resistor connected from a microcontroller input to a logic rail might plausibly be 4.7 kΩ or 10 kΩ. A 0.1 Ω marking is less plausible for the same purpose unless the design is unusual.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Do not use plausibility as a substitute for evidence.&lt;/strong&gt; A circuit can intentionally use unusual resistor values. Schematic references, board documentation, original component lists, and a reliable meter remain more authoritative.&lt;/p&gt;

&lt;h2&gt;
  
  
  Decoding SMD resistor markings
&lt;/h2&gt;

&lt;p&gt;Some surface-mount resistors use three digits: the first two are significant digits and the third is the power-of-ten multiplier. For example, &lt;code&gt;472&lt;/code&gt; indicates &lt;code&gt;47 × 10² = 4,700 Ω&lt;/code&gt;, or 4.7 kΩ. In a common four-digit system, the first three digits are significant: &lt;code&gt;1001&lt;/code&gt; indicates &lt;code&gt;100 × 10¹ = 1,000 Ω&lt;/code&gt;.&lt;/p&gt;

&lt;p&gt;There are important exceptions. Low-value resistors may use &lt;code&gt;R&lt;/code&gt; as a decimal marker, EIA-96 markings use a different code, and tiny components may be unmarked. Never infer a high-value, high-power, or precision part solely from an unfamiliar top marking.&lt;/p&gt;

&lt;p&gt;For replacement sourcing, the &lt;a href="https://mozelectronics.com/passive-components/resistor-parts/" rel="noopener noreferrer"&gt;resistor parts category at MOZ Electronics&lt;/a&gt; can be used as a starting point for locating relevant part numbers. Check the exact manufacturer's datasheet for package, tolerance, rated power, maximum working voltage, and temperature characteristics before selecting a substitute.&lt;/p&gt;

&lt;h2&gt;
  
  
  Why an in-circuit multimeter reading may disagree
&lt;/h2&gt;

&lt;p&gt;Suppose you identify a 10 kΩ resistor visually but measure 6.8 kΩ across its pads. That discrepancy does not necessarily mean the resistor is defective.&lt;/p&gt;

&lt;p&gt;When the component remains soldered in a circuit, other current paths may be connected in parallel. Semiconductors, capacitors, and other &lt;a href="https://octatronics.com/c/passive-components/resistors" rel="noopener noreferrer"&gt;resistors&lt;/a&gt; can affect the reading depending on meter polarity and test conditions. A parallel path will often make the apparent resistance lower than the isolated component's value.&lt;/p&gt;

&lt;p&gt;For a trustworthy measurement:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Disconnect power, verify the circuit is de-energized, and safely discharge capacitors.&lt;/li&gt;
&lt;li&gt;Check the meter's range and lead resistance, particularly for low-ohmic parts.&lt;/li&gt;
&lt;li&gt;Inspect the part for thermal damage, lifted pads, or cracked solder joints.&lt;/li&gt;
&lt;li&gt;If the circuit topology permits, lift one resistor terminal or remove the component before measuring.&lt;/li&gt;
&lt;li&gt;Compare the isolated reading with the nominal tolerance and the component's condition.&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;For low-resistance current-sense components, a four-wire measurement may be necessary because test lead and contact resistance can be comparable to the part itself.&lt;/p&gt;

&lt;h2&gt;
  
  
  A practical troubleshooting example
&lt;/h2&gt;

&lt;p&gt;Imagine a 5 V control board with an indicator LED that is unexpectedly dim. The resistor appears to read red–red–brown–gold, which is &lt;strong&gt;220 Ω ±5%&lt;/strong&gt;. Assuming a 2 V LED forward drop, the nominal current would be &lt;code&gt;(5 − 2) / 220 ≈ 13.6 mA&lt;/code&gt; if that resistor is the only significant series resistance.&lt;/p&gt;

&lt;p&gt;If the resistor were instead red–red–red–gold, the value would be &lt;strong&gt;2.2 kΩ&lt;/strong&gt;, and the nominal current would be only &lt;code&gt;(5 − 2) / 2,200 ≈ 1.36 mA&lt;/code&gt;. That tenfold difference can explain a major brightness change.&lt;/p&gt;

&lt;p&gt;The next step is not automatically to replace the resistor. Verify LED polarity, supply voltage, output-pin drive capability, and actual LED forward voltage. Then measure the isolated resistor if necessary. A resistor calculation should guide diagnosis, not prematurely decide the answer.&lt;/p&gt;

&lt;h2&gt;
  
  
  Beyond the printed value: replacement checks
&lt;/h2&gt;

&lt;p&gt;Once the nominal value is known, selecting a substitute involves more than matching ohms. A 10 kΩ, 0.125 W resistor in a 0603 footprint is not automatically interchangeable with a 10 kΩ axial resistor or a 10 kΩ high-voltage specialty part. The physical dimensions, thermal environment, failure behavior, and overload ratings can differ sharply.&lt;/p&gt;

&lt;p&gt;If the original part belongs to a sensitive divider or feedback network, confirm the tolerance and temperature coefficient. If it operates across a high voltage, check voltage rating and relevant safety constraints. If it faces switch-on surges, look for pulse-handling data instead of relying only on steady-state power.&lt;/p&gt;

&lt;h2&gt;
  
  
  Final checklist
&lt;/h2&gt;

&lt;p&gt;Before you trust a resistor identification, ask whether the band direction is unambiguous, whether the value follows the marking convention, whether tolerance is interpreted correctly, and whether the value makes sense in the circuit. If the answer is uncertain, isolate and measure the component. For a replacement, use the exact datasheet rather than a generic wattage label.&lt;/p&gt;

&lt;p&gt;Resistor identification is a small task that rewards careful habits. A minute spent validating a band code can prevent hours of chasing a problem caused by a factor-of-ten mistake.&lt;/p&gt;

</description>
    </item>
    <item>
      <title>How to Use Piper on a Raspberry Pi?</title>
      <dc:creator>Hedy</dc:creator>
      <pubDate>Mon, 09 Feb 2026 10:30:43 +0000</pubDate>
      <link>https://dev.to/carolineee/how-to-use-piper-on-a-raspberry-pi-2p2l</link>
      <guid>https://dev.to/carolineee/how-to-use-piper-on-a-raspberry-pi-2p2l</guid>
      <description>&lt;p&gt;&lt;strong&gt;1. What Is Piper (and Why You’d Use It on a Raspberry Pi)&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Piper is a graphical mouse configuration tool for Linux.&lt;br&gt;
It works together with libratbag, a background service that talks directly to supported mice over USB or Bluetooth.&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%2F1u2qq4o5lbj65b9cwbuf.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%2F1u2qq4o5lbj65b9cwbuf.jpg" alt=" " width="800" height="800"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;On a &lt;a href="https://www.ampheo.com/c/raspberry-pi/raspberry-pi-boards" rel="noopener noreferrer"&gt;Raspberry Pi&lt;/a&gt;, Piper is commonly used to:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Remap mouse buttons&lt;/li&gt;
&lt;li&gt;Adjust DPI (sensitivity) levels&lt;/li&gt;
&lt;li&gt;Configure polling rate&lt;/li&gt;
&lt;li&gt;Set profiles (for gaming, CAD, robotics UI, kiosks)&lt;/li&gt;
&lt;li&gt;Store settings directly in the mouse firmware (for supported models)&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Typical use cases on Raspberry Pi:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Gaming or retro-console setups&lt;/li&gt;
&lt;li&gt;Industrial HMIs using programmable mice&lt;/li&gt;
&lt;li&gt;Lab setups where precise pointer control matters&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;2. Check Before You Start (Very Important)&lt;/strong&gt;&lt;br&gt;
&lt;strong&gt;2.1 Mouse Compatibility&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Piper does not support all mice.&lt;/p&gt;

&lt;p&gt;It supports mice that work with libratbag, including many models from:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Logitech (G series)&lt;/li&gt;
&lt;li&gt;SteelSeries&lt;/li&gt;
&lt;li&gt;Roccat&lt;/li&gt;
&lt;li&gt;Corsair (limited models)&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;If Piper opens but shows “No devices found”, the mouse is likely unsupported.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;3. Install Piper on Raspberry Pi OS&lt;/strong&gt;&lt;br&gt;
&lt;strong&gt;3.1 Update Your System&lt;/strong&gt;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;sudo apt update
sudo apt upgrade -y
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;3.2 Install Piper and libratbag&lt;/strong&gt;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;sudo apt install piper libratbagd -y
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;This installs:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;piper → graphical configuration tool&lt;/li&gt;
&lt;li&gt;libratbagd → background daemon that communicates with the mouse&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;4. Enable and Start the libratbag Service&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Piper will not work unless the service is running.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;sudo systemctl enable libratbagd
sudo systemctl start libratbagd
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Check status:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;systemctl status libratbagd
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;You should see:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;Active: active (running)
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;5. Launch Piper&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;From the desktop:&lt;/p&gt;

&lt;p&gt;Menu → Preferences → Piper&lt;/p&gt;

&lt;p&gt;Or from terminal:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;piper
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;If your mouse is supported, it will appear immediately.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;6. Using Piper: Core Functions Explained&lt;/strong&gt;&lt;br&gt;
&lt;strong&gt;6.1 Button Mapping&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;In Piper, click any mouse button and assign:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Left / Right / Middle click&lt;/li&gt;
&lt;li&gt;Keyboard keys&lt;/li&gt;
&lt;li&gt;Media controls&lt;/li&gt;
&lt;li&gt;Disabled (useful for kiosks)&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Example&lt;br&gt;
Map a side button to:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Ctrl + C for copy&lt;/li&gt;
&lt;li&gt;Ctrl + V for paste&lt;/li&gt;
&lt;li&gt;Shift for CAD navigation&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;➡ &lt;strong&gt;Engineering tip:&lt;/strong&gt;&lt;br&gt;
Button remapping is stored either in software or mouse firmware, depending on the model.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;6.2 DPI (Sensitivity) Settings&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Most gaming mice support multiple DPI stages.&lt;/p&gt;

&lt;p&gt;In Piper you can:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Enable/disable DPI steps&lt;/li&gt;
&lt;li&gt;Set exact DPI values (e.g. 400 / 800 / 1600 / 3200)&lt;/li&gt;
&lt;li&gt;Choose DPI-switch behavior&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;Best practice on Raspberry Pi:&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Desktop use: 800–1200 DPI&lt;/li&gt;
&lt;li&gt;4K display or CAD: 1600–2400 DPI&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;6.3 Polling Rate&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Polling rate defines how often the mouse reports position.&lt;/p&gt;

&lt;p&gt;Typical options:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;125 Hz&lt;/li&gt;
&lt;li&gt;250 Hz&lt;/li&gt;
&lt;li&gt;500 Hz&lt;/li&gt;
&lt;li&gt;1000 Hz&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;➡ On Raspberry Pi:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;500 Hz is usually the sweet spot&lt;/li&gt;
&lt;li&gt;1000 Hz offers minimal benefit and more USB load&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;6.4 Profiles&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Some mice allow multiple profiles:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Gaming&lt;/li&gt;
&lt;li&gt;Desktop&lt;/li&gt;
&lt;li&gt;CAD / 3D modeling&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;You can:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Switch profiles manually&lt;/li&gt;
&lt;li&gt;Assign profiles to DPI buttons&lt;/li&gt;
&lt;li&gt;Save profiles to mouse memory&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;7. Common Problems and How to Fix Them&lt;/strong&gt;&lt;br&gt;
&lt;strong&gt;Piper Opens but Shows “No Devices Found”&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Causes&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Mouse not supported&lt;/li&gt;
&lt;li&gt;libratbag service not running&lt;/li&gt;
&lt;li&gt;Insufficient permissions&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Fix&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;sudo systemctl restart libratbagd
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Try another USB port (avoid hubs).&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;DPI or Buttons Don’t Change&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Causes&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Mouse firmware doesn’t support onboard storage&lt;/li&gt;
&lt;li&gt;Profile not applied&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Fix&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Click Apply or Save to Device&lt;/li&gt;
&lt;li&gt;Replug mouse&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;Piper Crashes or Won’t Start&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Fix&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;piper --debug
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Check for missing GTK dependencies:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;sudo apt install libgtk-3-0
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;8. Headless or Minimal Raspberry Pi (No GUI)&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Piper requires a GUI.&lt;/p&gt;

&lt;p&gt;If you are running:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Raspberry Pi OS Lite&lt;/li&gt;
&lt;li&gt;Headless system&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;You must either:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Install a lightweight desktop (LXDE), or&lt;/li&gt;
&lt;li&gt;Configure mouse via libratbag CLI (advanced, limited)&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;9. Performance and Stability Notes (Real-World Use)&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Piper settings do not impact CPU load significantly&lt;/li&gt;
&lt;li&gt;Mouse polling is handled in kernel space&lt;/li&gt;
&lt;li&gt;Settings persist across reboot if stored in device&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;For industrial or kiosk deployments:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Test settings after power cycling&lt;/li&gt;
&lt;li&gt;Avoid firmware-dependent profiles if reproducibility matters&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;10. When Piper Is the Right (or Wrong) Tool&lt;/strong&gt;&lt;br&gt;
&lt;strong&gt;Use Piper if:&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;You have a supported gaming/advanced mouse&lt;/li&gt;
&lt;li&gt;You need DPI or button remapping&lt;/li&gt;
&lt;li&gt;You want a GUI-based solution&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;Avoid Piper if:&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Using generic office mice&lt;/li&gt;
&lt;li&gt;Running headless Raspberry Pi only&lt;/li&gt;
&lt;li&gt;Mouse not supported by libratbag&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;11. Final Takeaway&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Using Piper on a Raspberry Pi is straightforward once you understand its dependency on libratbag and device support.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Workflow summary:&lt;/strong&gt;&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Install piper + libratbagd&lt;/li&gt;
&lt;li&gt;Enable the service&lt;/li&gt;
&lt;li&gt;Plug in a supported mouse&lt;/li&gt;
&lt;li&gt;Configure DPI, buttons, and profiles&lt;/li&gt;
&lt;li&gt;Save settings to device&lt;/li&gt;
&lt;/ol&gt;

</description>
      <category>piper</category>
      <category>raspberrypi</category>
    </item>
    <item>
      <title>How to change the VID / PID of an Arduino Nano?</title>
      <dc:creator>Hedy</dc:creator>
      <pubDate>Tue, 03 Feb 2026 10:37:35 +0000</pubDate>
      <link>https://dev.to/carolineee/how-to-change-the-vid-pid-of-an-arduino-nano-531i</link>
      <guid>https://dev.to/carolineee/how-to-change-the-vid-pid-of-an-arduino-nano-531i</guid>
      <description>&lt;p&gt;Changing the VID / PID of an &lt;a href="https://www.ampheo.com/product/a000005-25542476" rel="noopener noreferrer"&gt;Arduino Nano&lt;/a&gt; depends entirely on which USB interface chip your Nano uses. This is not a software setting you can change from a sketch; it is defined by the USB firmware of the USB-to-serial chip.&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%2Fztxukflo4rz2vxyji9ip.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%2Fztxukflo4rz2vxyji9ip.jpg" alt=" " width="750" height="359"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Below is a clear decision path → implementation steps → risks and procurement implications.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;1. First: Identify which Arduino Nano you have (this decides everything)&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;There are three common Nano variants in the wild:&lt;/p&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Nano type&lt;/th&gt;
&lt;th&gt;USB chip&lt;/th&gt;
&lt;th&gt;VID/PID changeable?&lt;/th&gt;
&lt;th&gt;How&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;&lt;strong&gt;Original Nano&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;FT232RL&lt;/td&gt;
&lt;td&gt;Yes&lt;/td&gt;
&lt;td&gt;Reprogram EEPROM&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;strong&gt;Clone Nano (most common)&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;CH340 / CH341&lt;/td&gt;
&lt;td&gt;No (practically)&lt;/td&gt;
&lt;td&gt;Fixed in silicon&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;strong&gt;Newer Nano (ATmega328P + ATmega16U2)&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;ATmega16U2&lt;/td&gt;
&lt;td&gt;Yes&lt;/td&gt;
&lt;td&gt;Flash USB firmware&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;p&gt;Most cheap Nano boards use CH340 → VID/PID cannot realistically be changed.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;2. How to check which USB chip you have (don’t skip this)&lt;/strong&gt;&lt;br&gt;
&lt;strong&gt;On Windows&lt;/strong&gt;&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Plug in Nano&lt;/li&gt;
&lt;li&gt;Open Device Manager → Ports (COM &amp;amp; LPT)&lt;/li&gt;
&lt;li&gt;Check device name:&lt;/li&gt;
&lt;li&gt;USB Serial Converter → FT232&lt;/li&gt;
&lt;li&gt;USB-SERIAL CH340 → &lt;a href="https://www.ampheo.com/product/ch340t-27265631" rel="noopener noreferrer"&gt;CH340&lt;/a&gt;
&lt;/li&gt;
&lt;li&gt;Arduino USB Serial → &lt;a href="https://www.ampheo.com/search/ATmega16U2" rel="noopener noreferrer"&gt;ATmega16U2&lt;/a&gt;
&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;&lt;strong&gt;On Linux / macOS&lt;/strong&gt;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;lsusb
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Example:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;0403:6001  → FTDI (FT232)
1a86:7523  → CH340
2341:0043  → Arduino VID (16U2)
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;3. Case A — Nano with FT232RL (VID/PID CAN be changed)&lt;/strong&gt;&lt;br&gt;
&lt;strong&gt;What you need&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;FTDI drivers installed&lt;/li&gt;
&lt;li&gt;FT_Prog (FTDI official utility, Windows)&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;Step-by-step&lt;/strong&gt;&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Install FT_Prog&lt;/li&gt;
&lt;li&gt;Plug in Nano&lt;/li&gt;
&lt;li&gt;Open FT_Prog → Scan and Parse&lt;/li&gt;
&lt;li&gt;Navigate to:
&lt;/li&gt;
&lt;/ol&gt;
&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;USB Device Descriptor
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;


&lt;ol&gt;
&lt;li&gt;Change:&lt;/li&gt;
&lt;/ol&gt;

&lt;ul&gt;
&lt;li&gt;Vendor ID&lt;/li&gt;
&lt;li&gt;Product ID&lt;/li&gt;
&lt;/ul&gt;

&lt;ol&gt;
&lt;li&gt;Program device&lt;/li&gt;
&lt;li&gt;Unplug and replug&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;&lt;strong&gt;Important warnings&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Do NOT use a VID you do not own&lt;/li&gt;
&lt;li&gt;Changing VID/PID may break drivers&lt;/li&gt;
&lt;li&gt;Windows may require driver reinstallation&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;Procurement note&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;If you need custom VID/PID for a product, FT232 is acceptable only for low volume / internal tools. For shipping products, VID licensing matters.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;4. Case B — Nano with CH340 / CH341 (VID/PID NOT changeable)&lt;/strong&gt;&lt;br&gt;
&lt;strong&gt;Reality check&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;VID/PID is hard-coded&lt;/li&gt;
&lt;li&gt;No EEPROM&lt;/li&gt;
&lt;li&gt;No official flashing tools&lt;/li&gt;
&lt;li&gt;Internet “guides” claiming success are wrong or misleading&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;Your options&lt;/strong&gt;&lt;/p&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Option&lt;/th&gt;
&lt;th&gt;Result&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;Try to flash&lt;/td&gt;
&lt;td&gt;Impossible&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Mask VID/PID in OS&lt;/td&gt;
&lt;td&gt;Hacky&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Replace USB chip&lt;/td&gt;
&lt;td&gt;Not realistic&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Use different Nano&lt;/td&gt;
&lt;td&gt;Correct approach&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;p&gt;&lt;strong&gt;Procurement implication&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;If you need VID/PID control, do not buy CH340-based Nanos.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;5. Case C — Nano with ATmega16U2 (VID/PID fully programmable)&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;(Some “official-style” Nanos or custom boards)&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;What you need&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;ISP programmer (USBasp / AVRISP / another Arduino)&lt;/li&gt;
&lt;li&gt;DFU or ISP flashing tools&lt;/li&gt;
&lt;li&gt;Custom USB firmware&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;High-level steps&lt;/strong&gt;&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Put ATmega16U2 into DFU or ISP mode&lt;/li&gt;
&lt;li&gt;Modify USB descriptors in firmware:
&lt;/li&gt;
&lt;/ol&gt;
&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;#define USB_VENDOR_ID  0xXXXX
#define USB_PRODUCT_ID 0xYYYY
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;


&lt;ol&gt;
&lt;li&gt;Compile&lt;/li&gt;
&lt;li&gt;Flash firmware&lt;/li&gt;
&lt;li&gt;Replug device&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;&lt;strong&gt;Advantages&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Full USB control&lt;/li&gt;
&lt;li&gt;Can implement HID, CDC, composite devices&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;Risks&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Easy to brick USB interface&lt;/li&gt;
&lt;li&gt;Requires firmware + USB knowledge&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;6. Why Arduino sketches cannot change VID/PID&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Your &lt;a href="https://www.onzuu.com/search/ATmega328P" rel="noopener noreferrer"&gt;ATmega328P&lt;/a&gt; sketch never talks USB.&lt;/p&gt;

&lt;p&gt;USB is handled by:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;FT232 → external IC&lt;/li&gt;
&lt;li&gt;CH340 → external IC&lt;/li&gt;
&lt;li&gt;ATmega16U2 → separate MCU&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;So:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;Serial.begin();
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;cannot affect VID/PID.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;7. When do you actually NEED to change VID/PID?&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Valid reasons:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Custom PC software binding&lt;/li&gt;
&lt;li&gt;USB driver matching&lt;/li&gt;
&lt;li&gt;Composite USB device&lt;/li&gt;
&lt;li&gt;Product branding&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Invalid reasons:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;“Just curiosity”&lt;/li&gt;
&lt;li&gt;Fixing driver problems&lt;/li&gt;
&lt;li&gt;Bypassing OS permissions&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;8. Best practice recommendations (engineering + purchasing)&lt;/strong&gt;&lt;br&gt;
If you just want Arduino compatibility&lt;/p&gt;

&lt;p&gt;Do NOT change VID/PID&lt;/p&gt;

&lt;p&gt;If you need custom VID/PID&lt;/p&gt;

&lt;p&gt;Use:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Arduino with ATmega16U2&lt;/li&gt;
&lt;li&gt;Native USB MCU (&lt;a href="https://www.ampheo.com/search/ATmega32U4" rel="noopener noreferrer"&gt;ATmega32U4&lt;/a&gt;, RP2040, &lt;a href="https://www.ampheo.com/search/STM32" rel="noopener noreferrer"&gt;STM32&lt;/a&gt;, ESP32-Sx)&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;If you’re building a product&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Do NOT ship with Arduino VID&lt;/li&gt;
&lt;li&gt;Buy your own VID or use USB-IF PID programs&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;9. Quick decision summary&lt;/strong&gt;&lt;/p&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Your Nano has…&lt;/th&gt;
&lt;th&gt;Can you change VID/PID?&lt;/th&gt;
&lt;th&gt;Recommended action&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;FT232&lt;/td&gt;
&lt;td&gt;Yes&lt;/td&gt;
&lt;td&gt;Use FT_Prog carefully&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;CH340&lt;/td&gt;
&lt;td&gt;No&lt;/td&gt;
&lt;td&gt;Replace board&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;ATmega16U2&lt;/td&gt;
&lt;td&gt;Yes&lt;/td&gt;
&lt;td&gt;Flash custom firmware&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;p&gt;&lt;strong&gt;Final takeaway&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Changing &lt;a href="https://www.ampheoelec.de/product/a000005-25542476" rel="noopener noreferrer"&gt;Arduino Nano&lt;/a&gt; VID/PID is a hardware decision, not a software trick.&lt;/p&gt;

&lt;p&gt;If VID/PID control matters:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Choose the right USB interface chip&lt;/li&gt;
&lt;li&gt;Decide this before procurement&lt;/li&gt;
&lt;li&gt;Don’t try to “fix it later in firmware”&lt;/li&gt;
&lt;/ul&gt;

</description>
      <category>arduinonano</category>
      <category>vid</category>
      <category>pid</category>
      <category>atmega16u2</category>
    </item>
    <item>
      <title>How to activate/deactivate other circuits with higher voltage from a microcontroller?</title>
      <dc:creator>Hedy</dc:creator>
      <pubDate>Fri, 30 Jan 2026 10:37:33 +0000</pubDate>
      <link>https://dev.to/carolineee/how-to-activatedeactivate-other-circuits-with-higher-voltage-from-a-microcontroller-2298</link>
      <guid>https://dev.to/carolineee/how-to-activatedeactivate-other-circuits-with-higher-voltage-from-a-microcontroller-2298</guid>
      <description>&lt;p&gt;To switch (activate/deactivate) higher-voltage circuits from a &lt;a href="https://www.ampheo.com/c/microcontrollers" rel="noopener noreferrer"&gt;microcontroller&lt;/a&gt;, you’re really choosing an isolation + switching method that matches:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Voltage &amp;amp; current of the load&lt;/li&gt;
&lt;li&gt;AC vs DC&lt;/li&gt;
&lt;li&gt;Switching speed (slow on/off vs PWM)&lt;/li&gt;
&lt;li&gt;Isolation requirement (safety/EMC)&lt;/li&gt;
&lt;li&gt;Failure mode you can tolerate (stuck ON is dangerous)&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;Below is a practical decision guide, then concrete wiring patterns and real part examples.&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%2Fmtni8oxhxt7ttnse6d3y.jpeg" 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%2Fmtni8oxhxt7ttnse6d3y.jpeg" alt=" " width="800" height="600"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;1) Decision logic: pick your switching “class”&lt;/strong&gt;&lt;br&gt;
&lt;strong&gt;A) DC load, low/medium current, want efficiency → MOSFET switch&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Best for: 12V/24V solenoids, LED strips, &lt;a href="https://www.onzuu.com/category/ac-dc-motors" rel="noopener noreferrer"&gt;DC motors&lt;/a&gt; (on/off), heaters&lt;/li&gt;
&lt;li&gt;Pros: efficient, cheap, fast (PWM capable)&lt;/li&gt;
&lt;li&gt;Cons: needs correct &lt;a href="https://www.onzuu.com/category/fets-mosfets" rel="noopener noreferrer"&gt;MOSFET&lt;/a&gt; + gate drive + protection&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;Choose low-side vs high-side&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Low-side (N-MOSFET): easiest, cheapest&lt;/li&gt;
&lt;li&gt;High-side (P-MOSFET or high-side driver): needed when load must stay referenced to ground or for automotive conventions&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;B) AC mains load (110/230VAC) → &lt;a href="https://www.onzuu.com/category/relays" rel="noopener noreferrer"&gt;Relay&lt;/a&gt; or Triac SSR&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Best for: lamps, heaters, mains pumps&lt;/li&gt;
&lt;li&gt;Pros: simple, isolation is common, safe when done right&lt;/li&gt;
&lt;li&gt;Cons: mechanical relays wear; triac SSRs leak current and aren’t for DC&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;C) Need galvanic isolation or noisy environment → Optocoupler + switch&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Best for: industrial systems, long cables, high EMI, safety isolation&lt;/li&gt;
&lt;li&gt;Pros: strong noise immunity, safety barrier&lt;/li&gt;
&lt;li&gt;Cons: slower, extra BOM, layout/creepage rules&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;D) Need to switch “anything” including unknown loads → Relay&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Best for: prototypes, universal switching, low frequency&lt;/li&gt;
&lt;li&gt;Pros: load-agnostic, real isolation&lt;/li&gt;
&lt;li&gt;Cons: size, coil power, lifetime, contact arcing&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;2) The most common (and safest) patterns&lt;/strong&gt;&lt;br&gt;
&lt;strong&gt;Pattern 1 — DC load with low-side N-MOSFET (most common)&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Use when: DC loads where switching the return (ground) is acceptable.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Wiring&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Load + → +V (e.g., 12V)&lt;/li&gt;
&lt;li&gt;Load − → MOSFET Drain&lt;/li&gt;
&lt;li&gt;MOSFET Source → GND&lt;/li&gt;
&lt;li&gt;MCU GPIO → gate &lt;a href="https://www.onzuu.com/category/resistors" rel="noopener noreferrer"&gt;resistor&lt;/a&gt; → MOSFET Gate&lt;/li&gt;
&lt;li&gt;Gate pulldown to GND&lt;/li&gt;
&lt;li&gt;Flyback diode across load if inductive (relay/solenoid/motor)&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;Typical values&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Gate resistor: 33–220 Ω&lt;/li&gt;
&lt;li&gt;Gate pulldown: 100 kΩ&lt;/li&gt;
&lt;li&gt;Flyback diode: Schottky/fast diode sized for current&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;Part selection&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;MOSFET: logic-level N-MOSFET (low Rds(on) at 3.3V/5V gate)&lt;/li&gt;
&lt;li&gt;If PWM or large MOSFET: consider a gate driver&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;Example parts (no vendor preference, just common families)&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;N-MOSFETs: &lt;a href="https://www.onzuu.com/search/IRLZ44N" rel="noopener noreferrer"&gt;IRLZ44N&lt;/a&gt; (older but common), &lt;a href="https://www.onzuu.com/product/alpha-and-omega-semiconductor-inc-ao3400a-5190082" rel="noopener noreferrer"&gt;AO3400A&lt;/a&gt; (small loads), AOD4184A (mid power)&lt;/li&gt;
&lt;li&gt;Flyback diode: &lt;a href="https://www.onzuu.com/search/SS34" rel="noopener noreferrer"&gt;SS34&lt;/a&gt;, &lt;a href="https://www.onzuu.com/search/1N5819" rel="noopener noreferrer"&gt;1N5819&lt;/a&gt; (small), &lt;a href="https://www.onzuu.com/search/UF4007" rel="noopener noreferrer"&gt;UF4007&lt;/a&gt; (faster than 1N4007)&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Procurement impact: MOSFET selection changes thermal design and heatsink needs; diode selection changes EMI and reliability.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Pattern 2 — DC load with high-side switch (safer ground, common in automotive)&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Use when: you can’t “lift” the load ground, or you need the load referenced to chassis ground.&lt;/p&gt;

&lt;p&gt;Options:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;P-MOSFET high-side (simple for low current)&lt;/li&gt;
&lt;li&gt;Dedicated high-side switch IC (best for robustness)&lt;/li&gt;
&lt;li&gt;N-MOSFET + driver/charge pump (for high current, low losses)&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;&lt;strong&gt;Recommended for products: High-side switch IC&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Built-in current limit, thermal shutdown, diagnostics (depends on part)&lt;/li&gt;
&lt;li&gt;Much more tolerant of shorts and hot-plug&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;Example part families&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;High-side switch ICs: BTS/PROFET-style, &lt;a href="https://www.onzuu.com/search/TPS1H" rel="noopener noreferrer"&gt;TPS1H&lt;/a&gt;/&lt;a href="https://www.onzuu.com/search/TPS2H" rel="noopener noreferrer"&gt;TPS2H&lt;/a&gt;-style, VNQ/VND-style&lt;br&gt;
(choose by voltage/current/channel count)&lt;/p&gt;

&lt;p&gt;Procurement impact: IC high-side switches reduce field failures and simplify safety compliance, but cost more than a discrete MOSFET.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Pattern 3 — Relay module (universal on/off, slow switching)&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Use when: AC mains, unknown load type, or you need real isolation.&lt;/p&gt;

&lt;p&gt;MCU cannot drive relay coil directly (usually).&lt;br&gt;
Use:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;NPN transistor or N-MOSFET coil driver&lt;/li&gt;
&lt;li&gt;Flyback diode across coil&lt;/li&gt;
&lt;li&gt;Separate supply for the coil (often 5V or 12V)&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;Example driver parts&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;NPN: &lt;a href="https://www.onzuu.com/search/2N2222" rel="noopener noreferrer"&gt;2N2222&lt;/a&gt;, &lt;a href="https://www.ampheo.com/search/S8050" rel="noopener noreferrer"&gt;S8050&lt;/a&gt;
&lt;/li&gt;
&lt;li&gt;Coil diode: &lt;a href="https://www.onzuu.com/search/1N4148" rel="noopener noreferrer"&gt;1N4148&lt;/a&gt; (small relays) or &lt;a href="https://www.onzuu.com/search/1N4007" rel="noopener noreferrer"&gt;1N4007&lt;/a&gt;
&lt;/li&gt;
&lt;li&gt;Relay: SRD-05VDC-SL-C class modules (for learning), or industrial relays for products&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Procurement impact: Relays have lifecycle (mechanical), contact ratings, and sourcing variability; specify contact type and derate.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Pattern 4 — Solid-state relay (SSR)&lt;/strong&gt;&lt;br&gt;
&lt;strong&gt;For AC loads: Triac SSR&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Pros: silent, long life, easy isolation&lt;/li&gt;
&lt;li&gt;Cons: leakage current, heat at high current, not for DC&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;Examples&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;SSR modules: SSR-xxDA style (AC output, DC input control)&lt;/li&gt;
&lt;li&gt;Prefer “zero-cross” for heaters/lamps, “random turn-on” for phase control&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;For DC loads: MOSFET SSR&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Pros: isolation + DC switching&lt;/li&gt;
&lt;li&gt;Cons: higher cost, on-resistance causes heat&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;3) Protection you should almost always add (affects success rate)&lt;/strong&gt;&lt;br&gt;
&lt;strong&gt;Inductive loads (relays, &lt;a href="https://www.onzuu.com/category/solenoids" rel="noopener noreferrer"&gt;solenoids&lt;/a&gt;, motors)&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Flyback diode (DC) or RC snubber / MOV (AC)&lt;/li&gt;
&lt;li&gt;Optional: TVS diode on the supply rail to clamp spikes&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;MCU pin protection&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;If the switch driver is off-board / long cable:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;series resistor (100–1k)&lt;/li&gt;
&lt;li&gt;ESD diode/TVS near connector&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Procurement impact: Adding protection parts is cheap insurance—dramatically reduces returns and “random reset” complaints.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;4) Quick “choose this” table&lt;/strong&gt;&lt;/p&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Your load&lt;/th&gt;
&lt;th&gt;Best default&lt;/th&gt;
&lt;th&gt;Notes&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;12V LED strip (on/off or PWM)&lt;/td&gt;
&lt;td&gt;Low-side N-MOSFET&lt;/td&gt;
&lt;td&gt;Add fuse if long strip&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;24V solenoid&lt;/td&gt;
&lt;td&gt;Low-side N-MOSFET + flyback&lt;/td&gt;
&lt;td&gt;Diode must handle current&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;DC motor (on/off)&lt;/td&gt;
&lt;td&gt;N-MOSFET + flyback/TVS&lt;/td&gt;
&lt;td&gt;For direction control use H-bridge&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;AC heater/lamp&lt;/td&gt;
&lt;td&gt;Relay or AC SSR&lt;/td&gt;
&lt;td&gt;SSR leaks; relay clicks&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Automotive load&lt;/td&gt;
&lt;td&gt;High-side switch IC&lt;/td&gt;
&lt;td&gt;Handles faults better&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;High noise/industrial&lt;/td&gt;
&lt;td&gt;Optocoupler + MOSFET/relay&lt;/td&gt;
&lt;td&gt;Layout &amp;amp; creepage matter&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;p&gt;&lt;strong&gt;5) Two common failure modes (and fixes)&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;1. MCU resets when load switches&lt;/strong&gt;&lt;br&gt;
Cause: supply dip / ground bounce / EMI&lt;br&gt;
Fix: separate power rails, star ground, bulk cap (≥470 µF) near load, diode/TVS, shorten high-current loop.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;2. MOSFET runs hot&lt;/strong&gt;&lt;br&gt;
Cause: wrong MOSFET (not logic-level), high Rds(on), inadequate gate drive&lt;br&gt;
Fix: choose MOSFET specified at your gate voltage, reduce switching losses, add driver or heatsinking.&lt;/p&gt;

</description>
      <category>microcontroller</category>
      <category>relays</category>
      <category>solenoids</category>
      <category>motors</category>
    </item>
    <item>
      <title>How to program STM32 microcontroller?</title>
      <dc:creator>Hedy</dc:creator>
      <pubDate>Mon, 26 Jan 2026 09:47:22 +0000</pubDate>
      <link>https://dev.to/carolineee/how-to-program-stm32-microcontroller-2951</link>
      <guid>https://dev.to/carolineee/how-to-program-stm32-microcontroller-2951</guid>
      <description>&lt;p&gt;Programming an &lt;a href="https://www.ampheo.com/search/STM32" rel="noopener noreferrer"&gt;STM32&lt;/a&gt; is a pipeline of four layers:&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;1. Write firmware (source code)&lt;/strong&gt;&lt;br&gt;
You write C/C++ (sometimes Rust) that configures peripherals (GPIO, UART, timers, ADC, etc.) and implements your application logic.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;2. Build (compile + link) into a binary&lt;/strong&gt;&lt;br&gt;
Your toolchain (GCC/Clang/IAR/Keil) turns code into:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;.elf (debuggable output)&lt;/li&gt;
&lt;li&gt;.bin / .hex (flashable image)&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;3. Program (flash) the binary into on-chip Flash&lt;/strong&gt;&lt;br&gt;
STM32 stores your firmware in internal Flash. You load it using one of the supported programming paths:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;SWD (Serial Wire Debug) via ST-LINK/J-LINK (most common)&lt;/li&gt;
&lt;li&gt;ROM bootloader (UART/I2C/SPI/USB DFU depending on chip) for “no debugger” flashing&lt;/li&gt;
&lt;li&gt;Mass storage drag-and-drop (on boards with built-in ST-LINK)&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;4. Reset + boot sequence runs your app&lt;/strong&gt;&lt;br&gt;
On reset, the MCU fetches the reset vector from Flash and starts executing. BOOT pins (e.g., BOOT0) decide whether it boots from Flash or jumps to ROM bootloader.&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%2F0brf4sq04zgqedwwfct2.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%2F0brf4sq04zgqedwwfct2.jpg" alt=" " width="686" height="386"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Key concept: SWD vs Bootloader&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;SWD = best for development (debugging, breakpoints, “connect under reset”, fastest iteration)&lt;/li&gt;
&lt;li&gt;Bootloader = best for production updates or rescue when SWD isn’t available&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;Practical paths (the 3 common ways)&lt;/strong&gt;&lt;br&gt;
&lt;strong&gt;A) SWD programming (recommended for engineering work)&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Hardware: ST-LINK/V2 (or onboard ST-LINK on Nucleo/Discovery)&lt;/p&gt;

&lt;p&gt;Signals you need (typical):&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;SWDIO&lt;/li&gt;
&lt;li&gt;SWCLK&lt;/li&gt;
&lt;li&gt;GND&lt;/li&gt;
&lt;li&gt;3V3 (VTref, recommended)&lt;/li&gt;
&lt;li&gt;NRST (optional but very helpful)&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Why it’s the best&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;You can flash + debug in one click&lt;/li&gt;
&lt;li&gt;You can recover chips with “connect under reset”&lt;/li&gt;
&lt;li&gt;Works even if your firmware breaks clocks/peripherals&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;B) ROM bootloader (no debugger required)&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Most &lt;a href="https://www.ampheoelec.de/search/STM32" rel="noopener noreferrer"&gt;STM32&lt;/a&gt; families include a factory ROM bootloader.&lt;/p&gt;

&lt;p&gt;Typical boot entry logic&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Set BOOT0 = 1&lt;/li&gt;
&lt;li&gt;Reset&lt;/li&gt;
&lt;li&gt;MCU runs the ROM bootloader and waits for UART/USB DFU/etc.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Why it’s used&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Production line flashing&lt;/li&gt;
&lt;li&gt;Field firmware update&lt;/li&gt;
&lt;li&gt;“My SWD pins are not accessible” scenarios&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;C) Drag-and-drop (only on some dev boards)&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Boards with ST-LINK often expose a “USB drive”. Copy .bin → it flashes.&lt;br&gt;
Good for beginners, but SWD debugging is still the real workflow.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Example 1: STM32F103C8T6 (“Blue Pill”) via ST-LINK (SWD)&lt;/strong&gt;&lt;br&gt;
What you use&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;MCU/Board: &lt;a href="https://www.ampheo.com/product/stm32f103c8t6-131876" rel="noopener noreferrer"&gt;STM32F103C8T6&lt;/a&gt; (Blue Pill)&lt;/li&gt;
&lt;li&gt;Programmer: ST-LINK/V2&lt;/li&gt;
&lt;li&gt;IDE: STM32CubeIDE (or CubeProgrammer for pure flashing)&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Wiring (most common)&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;ST-LINK SWDIO → Blue Pill PA13&lt;/li&gt;
&lt;li&gt;ST-LINK SWCLK → Blue Pill PA14&lt;/li&gt;
&lt;li&gt;ST-LINK GND → GND&lt;/li&gt;
&lt;li&gt;ST-LINK 3V3 (VTref) → 3V3&lt;/li&gt;
&lt;li&gt;(Optional) ST-LINK NRST → NRST&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Workflow&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Create a project in STM32CubeIDE for STM32F103C8T6.&lt;/li&gt;
&lt;li&gt;Configure GPIO for an LED pin (many Blue Pills use PC13 LED).&lt;/li&gt;
&lt;li&gt;Build → get .elf and .bin.&lt;/li&gt;
&lt;li&gt;Click Debug (or Run). CubeIDE flashes via ST-LINK and starts debugging.&lt;/li&gt;
&lt;li&gt;Verify by toggling the LED in a loop.&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;Why this works well: F103 + SWD is simple, stable, and very common.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Example 2: STM32F401RE (Nucleo-F401RE) “one cable” programming + debug&lt;/strong&gt;&lt;br&gt;
What you use&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Board: &lt;a href="https://www.onzuu.com/product/stmicroelectronics-nucleo-f401re-3236041" rel="noopener noreferrer"&gt;Nucleo-F401RE&lt;/a&gt; (&lt;a href="https://www.ampheo.com/search/STM32F401RE" rel="noopener noreferrer"&gt;STM32F401RE&lt;/a&gt;)&lt;/li&gt;
&lt;li&gt;Tool: The board’s onboard ST-LINK&lt;/li&gt;
&lt;li&gt;Connection: USB cable only&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Workflow&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Plug the Nucleo into PC via USB.&lt;/li&gt;
&lt;li&gt;Build your project in CubeIDE.&lt;/li&gt;
&lt;li&gt;Click Debug → it flashes and debugs automatically.&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;Best part: No external programmer wiring needed.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Example 3: STM32G030F6P6 (or similar) via UART bootloader (no ST-LINK)&lt;/strong&gt;&lt;br&gt;
What you use&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;MCU: &lt;a href="https://www.ampheo.com/product/stm32g030f6p6-129893" rel="noopener noreferrer"&gt;STM32G030F6P6&lt;/a&gt; (common low-cost &lt;a href="https://www.ampheo.com/search/STM32G0" rel="noopener noreferrer"&gt;STM32G0&lt;/a&gt;)&lt;/li&gt;
&lt;li&gt;Tool: USB-to-UART adapter (3.3V logic)&lt;/li&gt;
&lt;li&gt;Software: STM32CubeProgrammer&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Typical steps (conceptual)&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Wire UART:&lt;/li&gt;
&lt;/ol&gt;

&lt;ul&gt;
&lt;li&gt;MCU USART_RX ↔ adapter TX&lt;/li&gt;
&lt;li&gt;MCU USART_TX ↔ adapter RX&lt;/li&gt;
&lt;li&gt;GND ↔ GND&lt;/li&gt;
&lt;/ul&gt;

&lt;ol&gt;
&lt;li&gt;Pull BOOT0 high (how you do this depends on your PCB/board).&lt;/li&gt;
&lt;li&gt;Reset the MCU.&lt;/li&gt;
&lt;li&gt;In CubeProgrammer: choose UART, select COM port → Connect.&lt;/li&gt;
&lt;li&gt;Program .bin/.hex.&lt;/li&gt;
&lt;li&gt;Set BOOT0 low again and reset → app boots from Flash.&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;Why this matters: You can program a bare chip even without SWD access.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Common “it won’t program” reasons (fast diagnosis)&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;No common ground between programmer and target&lt;/li&gt;
&lt;li&gt;BOOT0 left high → MCU stuck in bootloader&lt;/li&gt;
&lt;li&gt;Wrong voltage / unstable power&lt;/li&gt;
&lt;li&gt;SWD pins reused / noisy wiring → lower SWD speed, use short wires&lt;/li&gt;
&lt;li&gt;Need NRST for “connect under reset” recovery&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;Quick rule-of-thumb for choosing the programming method&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Developing firmware + debugging → SWD with ST-LINK&lt;/li&gt;
&lt;li&gt;Factory flashing / field updates → ROM bootloader (UART/USB DFU)&lt;/li&gt;
&lt;li&gt;Learning on Nucleo → onboard ST-LINK is easiest&lt;/li&gt;
&lt;/ul&gt;

</description>
      <category>stm32</category>
      <category>stm32f103c8t6</category>
      <category>nucleof401re</category>
      <category>stm32cubeide</category>
    </item>
    <item>
      <title>How to pause FPGA based digital clock through buttons on FPGA?</title>
      <dc:creator>Hedy</dc:creator>
      <pubDate>Fri, 23 Jan 2026 10:15:07 +0000</pubDate>
      <link>https://dev.to/carolineee/how-to-pause-fpga-based-digital-clock-through-buttons-on-fpga-1ddf</link>
      <guid>https://dev.to/carolineee/how-to-pause-fpga-based-digital-clock-through-buttons-on-fpga-1ddf</guid>
      <description>&lt;p&gt;&lt;strong&gt;1) what “pause” means in an FPGA digital clock&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;A typical &lt;a href="https://www.ampheo.com/c/fpgas-field-programmable-gate-array" rel="noopener noreferrer"&gt;FPGA&lt;/a&gt; digital clock has at least two parts:&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%2F9wtxrlomyxujrjt6192j.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%2F9wtxrlomyxujrjt6192j.jpg" alt=" " width="800" height="450"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;1. Time base (tick generator)&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Creates a clean 1 Hz (or 100 Hz) “tick” from the FPGA system clock (e.g., 50 MHz / 100 MHz).&lt;/li&gt;
&lt;li&gt;This tick drives seconds/minutes/hours counters.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;2. Timekeeping counters + display driver&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Counters update time on each tick.&lt;/li&gt;
&lt;li&gt;Display driver (7-segment / LCD / VGA) continuously refreshes.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;To “pause the clock” with a button, the safest approach is:&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Best practice: freeze timekeeping, not the whole FPGA clock&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Keep the FPGA system clock running normally (display scanning still works).&lt;/li&gt;
&lt;li&gt;Pause only the time update by using a run enable (run=1) / pause (run=0) flag.&lt;/li&gt;
&lt;li&gt;When paused, you stop consuming the 1 Hz tick (or stop incrementing counters).&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Why?&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;You avoid glitchy clock gating.&lt;/li&gt;
&lt;li&gt;Timing closure stays clean.&lt;/li&gt;
&lt;li&gt;Display remains stable and readable.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;2) Button theory: why you must condition button signals&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;A push button is:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Asynchronous to the FPGA clock → can cause metastability&lt;/li&gt;
&lt;li&gt;Bouncy → a single press can generate many transitions&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;So the standard chain is:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;2-FF synchronizer (bring button into clk domain)&lt;/li&gt;
&lt;li&gt;Debounce &lt;a href="https://www.onzuu.com/category/filters" rel="noopener noreferrer"&gt;filter&lt;/a&gt; (counter or shift register)&lt;/li&gt;
&lt;li&gt;Edge detect (make a one-clock “pressed” pulse)&lt;/li&gt;
&lt;li&gt;Toggle run flag (run &amp;lt;= ~run on each press)&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;This ensures one press = one toggle, reliably.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;3) Architecture for a pauseable FPGA digital clock&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Signals&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;tick_1hz_pulse — one-cycle pulse each second (generated from sysclk)&lt;/li&gt;
&lt;li&gt;run — 1 = running, 0 = paused&lt;/li&gt;
&lt;li&gt;sec, min, hour counters&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;Update rule&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;If run==1 and tick_1hz_pulse==1 → increment time&lt;/li&gt;
&lt;li&gt;Else → hold time steady&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;Display rule&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Display driver runs continuously (always refresh)&lt;/li&gt;
&lt;li&gt;It reads sec/min/hour and shows them&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;4) Real example (Artix-7 FPGA digital clock paused by a button)&lt;/strong&gt;&lt;br&gt;
&lt;strong&gt;Example target hardware&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;FPGA family: Xilinx &lt;a href="https://www.vemeko.com/artix-7-fpga/" rel="noopener noreferrer"&gt;Artix-7&lt;/a&gt;
&lt;/li&gt;
&lt;li&gt;Typical dev board: Basys 3 (&lt;a href="https://www.ampheo.com/search/XC7A35T" rel="noopener noreferrer"&gt;XC7A35T&lt;/a&gt;) or Nexys A7 (&lt;a href="https://www.ampheo.com/search/XC7A100T" rel="noopener noreferrer"&gt;XC7A100T&lt;/a&gt;)&lt;/li&gt;
&lt;li&gt;System clock: 100 MHz (common on these boards)&lt;/li&gt;
&lt;li&gt;Inputs: btn_pause&lt;/li&gt;
&lt;li&gt;Outputs: 7-segment display (HH:MM) or LEDs&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Below is a Verilog reference design showing:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Button conditioning&lt;/li&gt;
&lt;li&gt;1 Hz tick generator&lt;/li&gt;
&lt;li&gt;Time counters (HH:MM:SS internally)&lt;/li&gt;
&lt;li&gt;Pause via run enable&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;A) Button conditioner (sync + debounce + press pulse)&lt;/strong&gt;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;module button_conditioner #(
    parameter integer CLK_HZ = 100_000_000,
    parameter integer DEBOUNCE_MS = 20
)(
    input  wire clk,
    input  wire rst,
    input  wire btn_async,
    output wire pressed_pulse
);
    // 1) Synchronize
    reg [1:0] sync;
    always @(posedge clk) begin
        if (rst) sync &amp;lt;= 2'b00;
        else     sync &amp;lt;= {sync[0], btn_async};
    end
    wire btn_sync = sync[1];

    // 2) Debounce
    localparam integer COUNT_MAX = (CLK_HZ/1000)*DEBOUNCE_MS;
    reg [$clog2(COUNT_MAX+1)-1:0] cnt;
    reg btn_stable;

    always @(posedge clk) begin
        if (rst) begin
            cnt        &amp;lt;= 0;
            btn_stable &amp;lt;= 1'b0;
        end else begin
            if (btn_sync == btn_stable) begin
                cnt &amp;lt;= 0;
            end else begin
                if (cnt == COUNT_MAX[$clog2(COUNT_MAX+1)-1:0]) begin
                    btn_stable &amp;lt;= btn_sync;
                    cnt &amp;lt;= 0;
                end else begin
                    cnt &amp;lt;= cnt + 1'b1;
                end
            end
        end
    end

    // 3) Rising-edge detect
    reg btn_d;
    always @(posedge clk) begin
        if (rst) btn_d &amp;lt;= 1'b0;
        else     btn_d &amp;lt;= btn_stable;
    end
    assign pressed_pulse = btn_stable &amp;amp; ~btn_d;
endmodule
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;B) 1 Hz tick generator (from 100 MHz)&lt;/strong&gt;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;module tick_1hz #(
    parameter integer CLK_HZ = 100_000_000
)(
    input  wire clk,
    input  wire rst,
    output reg  tick_pulse
);
    localparam integer DIV = CLK_HZ; // 100M cycles -&amp;gt; 1 second
    reg [$clog2(DIV)-1:0] c;

    always @(posedge clk) begin
        if (rst) begin
            c &amp;lt;= 0;
            tick_pulse &amp;lt;= 1'b0;
        end else begin
            tick_pulse &amp;lt;= 1'b0;
            if (c == DIV-1) begin
                c &amp;lt;= 0;
                tick_pulse &amp;lt;= 1'b1; // one-cycle tick
            end else begin
                c &amp;lt;= c + 1'b1;
            end
        end
    end
endmodule
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;C) Digital clock core with pause (HH:MM:SS)&lt;/strong&gt;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;module digital_clock_pause (
    input  wire clk,          // 100 MHz
    input  wire rst,
    input  wire btn_pause_async,
    output reg  run_led,        // shows running/paused
    output reg [5:0] sec,
    output reg [5:0] min,
    output reg [4:0] hour
);
    wire pause_press;
    button_conditioner #(.CLK_HZ(100_000_000), .DEBOUNCE_MS(20))
    u_btn (.clk(clk), .rst(rst), .btn_async(btn_pause_async), .pressed_pulse(pause_press));

    // run flag toggles on each press
    reg run;
    always @(posedge clk) begin
        if (rst) run &amp;lt;= 1'b1;
        else if (pause_press) run &amp;lt;= ~run;
    end

    always @(posedge clk) begin
        if (rst) run_led &amp;lt;= 1'b1;
        else     run_led &amp;lt;= run;
    end

    wire tick_1s;
    tick_1hz #(.CLK_HZ(100_000_000)) u_tick (.clk(clk), .rst(rst), .tick_pulse(tick_1s));

    // Timekeeping: only updates when run==1 AND tick arrives
    always @(posedge clk) begin
        if (rst) begin
            sec  &amp;lt;= 0;
            min  &amp;lt;= 0;
            hour &amp;lt;= 0;
        end else if (run &amp;amp;&amp;amp; tick_1s) begin
            if (sec == 59) begin
                sec &amp;lt;= 0;
                if (min == 59) begin
                    min &amp;lt;= 0;
                    if (hour == 23) hour &amp;lt;= 0;
                    else            hour &amp;lt;= hour + 1'b1;
                end else begin
                    min &amp;lt;= min + 1'b1;
                end
            end else begin
                sec &amp;lt;= sec + 1'b1;
            end
        end
        // else paused: hold sec/min/hour
    end
endmodule
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;How “pause” works here&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;The 1 Hz tick keeps being generated.&lt;/li&gt;
&lt;li&gt;When paused, the counters simply ignore the tick.&lt;/li&gt;
&lt;li&gt;Your display logic can keep refreshing uninterrupted.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;5) How to connect this to a 7-segment display (concept)&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;On boards like Basys 3, the 7-segment is multiplexed:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;You run a scan timer (e.g., 1 kHz–10 kHz)&lt;/li&gt;
&lt;li&gt;Cycle through digits and drive segment lines&lt;/li&gt;
&lt;li&gt;Convert hour/min/sec to BCD digits&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Important: don’t pause the scan timer, only pause timekeeping.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;6) Practical model examples (real FPGA targets)&lt;/strong&gt;&lt;br&gt;
&lt;strong&gt;Xilinx examples (common)&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Basys 3 (XC7A35T, 100 MHz clock) — ideal for button + 7-seg digital clock demos&lt;/li&gt;
&lt;li&gt;Nexys A7 (&lt;a href="https://www.ampheoelec.de/search/XC7A100T" rel="noopener noreferrer"&gt;XC7A100T&lt;/a&gt;, 100 MHz clock) — similar approach, more resources&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;Intel examples&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;DE10-Lite (&lt;a href="https://www.vemeko.com/max-10-cplds/" rel="noopener noreferrer"&gt;MAX 10&lt;/a&gt;) — same RTL idea (sync/debounce + run enable), just different pin constraints.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;7) Common mistakes (and quick fixes)&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;Mistake: Button causes multiple pause toggles&lt;br&gt;
Fix: Debounce + edge detect (as above)&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Mistake: Trying to gate the clock with the button&lt;br&gt;
Fix: Use run enable on counters instead&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Mistake: Display goes blank when paused&lt;br&gt;
Fix: Keep display scan logic always running&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Mistake: Multi-clock designs pause only one domain&lt;br&gt;
Fix: Synchronize run into each clock domain (or centralize timekeeping to one domain)&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

</description>
      <category>fpga</category>
      <category>digitalclock</category>
      <category>artix7</category>
      <category>xc7a35t</category>
    </item>
    <item>
      <title>How to Use printf() on STM32 via Serial (UART)?</title>
      <dc:creator>Hedy</dc:creator>
      <pubDate>Thu, 22 Jan 2026 10:30:44 +0000</pubDate>
      <link>https://dev.to/carolineee/how-to-use-printf-on-stm32-via-serial-uart-40k9</link>
      <guid>https://dev.to/carolineee/how-to-use-printf-on-stm32-via-serial-uart-40k9</guid>
      <description>&lt;p&gt;Below is a practical, step-by-step guide to using printf() on an &lt;a href="https://www.ampheo.com/search/STM32" rel="noopener noreferrer"&gt;STM32&lt;/a&gt; via a serial (UART) wire, written for real projects (CubeIDE / HAL style).&lt;br&gt;
This is the most common and reliable debugging method on STM32.&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%2Fnzoov2m98xe5yxoe0mgs.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%2Fnzoov2m98xe5yxoe0mgs.jpg" alt=" " width="800" height="393"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;1. Theory: How printf() Works on STM32&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;printf() does not magically know where to print.&lt;br&gt;
On STM32, you must redirect the standard output (stdout) to a UART peripheral.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Data flow&lt;/strong&gt;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;printf()
  ↓
_putchar() / _write()
  ↓
UART TX register
  ↓
USB-UART adapter
  ↓
PC serial terminal
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;So the core steps are:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Initialize UART&lt;/li&gt;
&lt;li&gt;Retarget printf() to UART&lt;/li&gt;
&lt;li&gt;Connect UART TX to a PC&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;&lt;strong&gt;2. Hardware Setup (Serial Wire)&lt;/strong&gt;&lt;br&gt;
&lt;strong&gt;2.1 Required Hardware&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;STM32 board (e.g. &lt;a href="https://www.onzuu.com/search/Nucleo" rel="noopener noreferrer"&gt;Nucleo&lt;/a&gt;, Black Pill, Blue Pill)&lt;/li&gt;
&lt;li&gt;USB-to-UART adapter (3.3 V logic!)&lt;/li&gt;
&lt;li&gt;PC with serial terminal&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;2.2 Typical Wiring&lt;/strong&gt;&lt;/p&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;USB-UART&lt;/th&gt;
&lt;th&gt;STM32&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;TX&lt;/td&gt;
&lt;td&gt;RX (e.g. PA10 for USART1)&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;RX&lt;/td&gt;
&lt;td&gt;TX (e.g. PA9 for USART1)&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;GND&lt;/td&gt;
&lt;td&gt;GND&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;p&gt;Do NOT connect 5 V to STM32 UART pins&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;3. Configure UART (STM32CubeIDE / HAL)&lt;/strong&gt;&lt;br&gt;
&lt;strong&gt;Example: USART1 @ 115200 baud&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Mode: Asynchronous&lt;/li&gt;
&lt;li&gt;Word length: 8 bits&lt;/li&gt;
&lt;li&gt;Parity: None&lt;/li&gt;
&lt;li&gt;Stop bits: 1&lt;/li&gt;
&lt;li&gt;Flow control: None&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;CubeIDE will generate:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;UART_HandleTypeDef huart1;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;4. Retarget printf() to UART (HAL)&lt;/strong&gt;&lt;br&gt;
&lt;strong&gt;4.1 Add this code (GCC / CubeIDE)&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;In main.c or a separate retarget.c:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;#include &amp;lt;stdio.h&amp;gt;
#include "stm32f4xx_hal.h"

extern UART_HandleTypeDef huart1;

int _write(int file, char *ptr, int len)
{
    HAL_UART_Transmit(&amp;amp;huart1, (uint8_t *)ptr, len, HAL_MAX_DELAY);
    return len;
}
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;This redirects all printf() output to USART1.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;4.2 Use printf() normally&lt;/strong&gt;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;printf("Hello STM32!\r\n");
printf("ADC value = %d\r\n", adc_value);
printf("Voltage = %.2f V\r\n", voltage);
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;5. PC Side: Serial Terminal&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Use any terminal:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;PuTTY&lt;/li&gt;
&lt;li&gt;Tera Term&lt;/li&gt;
&lt;li&gt;
&lt;a href="https://www.ampheo.com/c/development-board-arduino" rel="noopener noreferrer"&gt;Arduino&lt;/a&gt; Serial Monitor&lt;/li&gt;
&lt;li&gt;minicom (Linux)&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;Settings&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Baud rate: 115200&lt;/li&gt;
&lt;li&gt;Data bits: 8&lt;/li&gt;
&lt;li&gt;Parity: None&lt;/li&gt;
&lt;li&gt;Stop bits: 1&lt;/li&gt;
&lt;li&gt;Line ending: CR+LF recommended&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;6. Common Problems &amp;amp; Fixes&lt;/strong&gt;&lt;br&gt;
&lt;strong&gt;Nothing prints&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;TX/RX swapped&lt;/li&gt;
&lt;li&gt;Wrong UART instance&lt;/li&gt;
&lt;li&gt;Baud rate mismatch&lt;/li&gt;
&lt;li&gt;Forgot \r\n&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;Output is garbled&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Wrong baud rate&lt;/li&gt;
&lt;li&gt;Clock configuration incorrect&lt;/li&gt;
&lt;li&gt;USB-UART is 5 V logic&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;printf() causes huge flash usage&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;printf() pulls in heavy formatting code.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Fix&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Enable newlib-nano&lt;/li&gt;
&lt;li&gt;Avoid floats if possible&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;CubeIDE:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;Project → Properties → C/C++ Build → Settings
→ MCU Settings → Use newlib-nano
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;7. Lightweight Alternatives (Recommended for Production)&lt;/strong&gt;&lt;br&gt;
&lt;strong&gt;7.1 sprintf() + HAL_UART_Transmit()&lt;/strong&gt;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;char buf[64];
sprintf(buf, "Temp=%d\r\n", temp);
HAL_UART_Transmit(&amp;amp;huart1, (uint8_t*)buf, strlen(buf), 100);
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;7.2 puts() (very small footprint)&lt;/strong&gt;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;puts("System started\r\n");
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;8. Performance Tips (Important!)&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;printf() is blocking&lt;/li&gt;
&lt;li&gt;Avoid calling it in:

&lt;ul&gt;
&lt;li&gt;Interrupts&lt;/li&gt;
&lt;li&gt;High-frequency loops&lt;/li&gt;
&lt;/ul&gt;


&lt;/li&gt;

&lt;li&gt;Use DMA for high-speed logging&lt;/li&gt;

&lt;li&gt;Throttle output frequency&lt;/li&gt;

&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;9. Example: STM32 Black Pill (&lt;a href="https://www.ampheo.com/search/STM32F401" rel="noopener noreferrer"&gt;STM32F401&lt;/a&gt;/F411)&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;UART&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;USART1&lt;/li&gt;
&lt;li&gt;TX = PA9&lt;/li&gt;
&lt;li&gt;RX = PA10&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;Code&lt;/strong&gt;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;printf("Black Pill ready\r\n");
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;Terminal&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;115200 baud&lt;/li&gt;
&lt;li&gt;CRLF&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;Key Engineering Takeaway&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;On &lt;a href="https://www.ampheoelec.de/search/STM32" rel="noopener noreferrer"&gt;STM32&lt;/a&gt;, printf() is a debugging tool, not a logging system.&lt;br&gt;
Use it wisely, retarget it properly, and never trust it inside interrupts.&lt;/p&gt;

</description>
      <category>stm32</category>
      <category>printf</category>
      <category>serial</category>
      <category>nucleo</category>
    </item>
    <item>
      <title>How to Overclock a Raspberry Pi?</title>
      <dc:creator>Hedy</dc:creator>
      <pubDate>Wed, 21 Jan 2026 09:28:26 +0000</pubDate>
      <link>https://dev.to/carolineee/how-to-overclock-a-raspberry-pi-go0</link>
      <guid>https://dev.to/carolineee/how-to-overclock-a-raspberry-pi-go0</guid>
      <description>&lt;p&gt;Overclocking a &lt;a href="https://www.ampheo.com/c/raspberry-pi/raspberry-pi-boards" rel="noopener noreferrer"&gt;Raspberry Pi&lt;/a&gt; means running the CPU, GPU, and memory at higher frequencies than default to gain extra performance. It’s popular for media centers, light servers, emulation, and development work—but it must be done carefully.&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%2Fou6ysx7y3qneph6wvf92.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%2Fou6ysx7y3qneph6wvf92.jpg" alt=" " width="800" height="485"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Below is a step-by-step, engineering-oriented guide, including limits, cooling, and recovery.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;1. Before You Overclock (Very Important)&lt;/strong&gt;&lt;br&gt;
&lt;strong&gt;Supported Models&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Overclocking works best on:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Raspberry Pi 3B / 3B+&lt;/li&gt;
&lt;li&gt;&lt;a href="https://www.ampheo.com/search/Raspberry%20Pi%204%20Model%20B" rel="noopener noreferrer"&gt;Raspberry Pi 4 Model B&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;
&lt;a href="https://www.ampheo.com/search/Raspberry%20Pi%205" rel="noopener noreferrer"&gt;Raspberry Pi 5&lt;/a&gt; (more advanced cooling required)&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;What You Need&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Proper cooling (heatsink + fan strongly recommended)&lt;/li&gt;
&lt;li&gt;Stable &lt;a href="https://www.onzuu.com/category/external-internal-power-supply" rel="noopener noreferrer"&gt;power supply&lt;/a&gt;

&lt;ul&gt;
&lt;li&gt;Pi 4: ≥ 5V / 3A&lt;/li&gt;
&lt;li&gt;Pi 5: ≥ 5V / 5A&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;Updated OS
&lt;/li&gt;
&lt;/ul&gt;
&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;sudo apt update &amp;amp;&amp;amp; sudo apt upgrade -y
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;


&lt;p&gt;&lt;strong&gt;2. Check Current Frequencies &amp;amp; Temperature&lt;/strong&gt;&lt;br&gt;
&lt;strong&gt;CPU Frequency&lt;/strong&gt;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;vcgencmd measure_clock arm
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;Temperature&lt;/strong&gt;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;vcgencmd measure_temp
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Throttling starts at 80°C.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;3. Overclocking Method (config.txt)&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Raspberry Pi overclocking is done via:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;/boot/config.txt
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;Open the file&lt;/strong&gt;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;sudo nano /boot/config.txt
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;4. Safe Overclock Settings (By Model)&lt;/strong&gt;&lt;br&gt;
&lt;strong&gt;Raspberry Pi 4 (Recommended Starting Point)&lt;/strong&gt;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;arm_freq=1800
gpu_freq=600
over_voltage=4
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;More Aggressive (Requires Good Cooling)&lt;/strong&gt;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;arm_freq=2000
gpu_freq=750
over_voltage=6
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Typical defaults:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;CPU: 1500 MHz&lt;/li&gt;
&lt;li&gt;GPU: 500 MHz&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;Raspberry Pi 3B+&lt;/strong&gt;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;arm_freq=1400
gpu_freq=400
over_voltage=2
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;Raspberry Pi 5 (Advanced)&lt;/strong&gt;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;arm_freq=2600
over_voltage=4
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;a href="https://www.ampheoelec.de/search/Pi%205" rel="noopener noreferrer"&gt;Pi 5&lt;/a&gt; must have an active cooler.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;5. Save &amp;amp; Reboot&lt;/strong&gt;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;sudo reboot
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;After reboot, verify:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;vcgencmd measure_clock arm
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;6. Stress Test (Do NOT Skip)&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Install stress tool:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;sudo apt install stress -y
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Run CPU stress test:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;stress --cpu 4 --timeout 300
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Monitor temperature:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;watch -n 1 vcgencmd measure_temp
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;If you see:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;sudden reboots&lt;/li&gt;
&lt;li&gt;throttling messages&lt;/li&gt;
&lt;li&gt;temperature &amp;gt; 80°C&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;→ Reduce frequency or improve cooling.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;7. Throttling &amp;amp; Stability Check&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Check throttling flags:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;vcgencmd get_throttled
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;ul&gt;
&lt;li&gt;0x0 → No throttling&lt;/li&gt;
&lt;li&gt;Other values → Power or thermal issues&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;8. Cooling Strategies (Critical for Engineers)&lt;/strong&gt;&lt;/p&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Cooling Method&lt;/th&gt;
&lt;th&gt;Suitable For&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;Passive heatsink&lt;/td&gt;
&lt;td&gt;Mild overclock&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Heatsink + fan&lt;/td&gt;
&lt;td&gt;Most setups&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Active cooler (Pi 5)&lt;/td&gt;
&lt;td&gt;Heavy overclock&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Metal case (heat spreader)&lt;/td&gt;
&lt;td&gt;Silent builds&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;p&gt;Cooling matters more than voltage.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;9. Power Stability Tips&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Use short, thick USB-C cables&lt;/li&gt;
&lt;li&gt;Avoid cheap power adapters&lt;/li&gt;
&lt;li&gt;Check undervoltage warning:
&lt;/li&gt;
&lt;/ul&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;vcgencmd get_throttled
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;10. How to Recover from a Failed Overclock&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;If your Pi won’t boot:&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Method A: Edit SD Card on Another PC&lt;/strong&gt;&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Insert SD card into another computer&lt;/li&gt;
&lt;li&gt;Open config.txt&lt;/li&gt;
&lt;li&gt;Remove overclock lines&lt;/li&gt;
&lt;li&gt;Save and reinsert&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;&lt;strong&gt;Method B: Safe Mode (Pi 4/5)&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Hold SHIFT during boot (HDMI connected).&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;11. Does Overclocking Void Warranty?&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Old models: yes (historically)&lt;/li&gt;
&lt;li&gt;Newer models: Raspberry Pi firmware no longer permanently flags overclocking
Still:&lt;/li&gt;
&lt;li&gt;Physical damage from heat not covered&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;12. When Overclocking Makes Sense&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;✅ Emulation&lt;br&gt;
✅ Media encoding&lt;br&gt;
✅ Compiling code&lt;br&gt;
✅ Light servers&lt;/p&gt;

&lt;p&gt;❌ 24/7 mission-critical systems&lt;br&gt;
❌ High-temperature environments&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Recommended Safe Rule of Thumb&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Moderate frequency + excellent cooling + stable power&lt;br&gt;
beats extreme overclocking every time.&lt;/p&gt;

</description>
      <category>raspberrypi</category>
      <category>overclock</category>
      <category>raspberrypi4modelb</category>
      <category>raspberrypi5</category>
    </item>
    <item>
      <title>How to turn on an Arduino LED in Tinkercad?</title>
      <dc:creator>Hedy</dc:creator>
      <pubDate>Tue, 20 Jan 2026 09:14:24 +0000</pubDate>
      <link>https://dev.to/carolineee/how-to-turn-on-an-arduino-led-in-tinkercad-7nd</link>
      <guid>https://dev.to/carolineee/how-to-turn-on-an-arduino-led-in-tinkercad-7nd</guid>
      <description>&lt;p&gt;Here’s the simplest, step-by-step way to turn on an &lt;a href="https://www.ampheo.com/c/development-board-arduino" rel="noopener noreferrer"&gt;Arduino&lt;/a&gt; LED in Tinkercad, perfect for beginners.&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%2Fck48wllxfsouf6gnryad.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%2Fck48wllxfsouf6gnryad.png" alt=" " width="725" height="453"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Step 1: Open Tinkercad Circuits&lt;/strong&gt;&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Go to Tinkercad&lt;/li&gt;
&lt;li&gt;Click Circuits&lt;/li&gt;
&lt;li&gt;Click Create new Circuit&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;You’ll see an empty workspace.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Step 2: Add Components&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;From the components panel (right side), drag in:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;a href="https://www.ampheo.com/product/a000046-25542493" rel="noopener noreferrer"&gt;Arduino Uno&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;LED&lt;/li&gt;
&lt;li&gt;
&lt;a href="https://www.onzuu.com/category/resistors" rel="noopener noreferrer"&gt;Resistor&lt;/a&gt; (220 Ω or 330 Ω is ideal)&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;Step 3: Wire the LED Correctly&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;LEDs are polarized, so direction matters.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Correct wiring&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Arduino pin 13 → Resistor&lt;/li&gt;
&lt;li&gt;Resistor → LED long leg (Anode +)&lt;/li&gt;
&lt;li&gt;LED short leg (Cathode −) → Arduino GND&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;Why the resistor?&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;It limits current and prevents the LED from burning out.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Step 4: Write the Arduino Code&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Click Code → Text and paste this:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;void setup() {
  pinMode(13, OUTPUT);   // Set pin 13 as output
}

void loop() {
  digitalWrite(13, HIGH); // Turn LED ON
}
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;This turns the LED on continuously.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Step 5: Start the Simulation&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Click Start Simulation&lt;/p&gt;

&lt;p&gt;The LED should light up immediately.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Common Beginner Mistakes (and Fixes)&lt;/strong&gt;&lt;/p&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Problem&lt;/th&gt;
&lt;th&gt;Fix&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;LED doesn’t turn on&lt;/td&gt;
&lt;td&gt;Flip the LED (polarity matters)&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;LED very dim&lt;/td&gt;
&lt;td&gt;Wrong resistor value (use 220–330 Ω)&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Nothing happens&lt;/td&gt;
&lt;td&gt;Make sure simulation is running&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Wired to wrong pin&lt;/td&gt;
&lt;td&gt;Code and wiring pin numbers must match&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;p&gt;&lt;strong&gt;Bonus: Blink the LED (Optional)&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Replace loop() with this:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;void loop() {
  digitalWrite(13, HIGH);
  delay(1000);            // 1 second ON
  digitalWrite(13, LOW);
  delay(1000);            // 1 second OFF
}
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Now the LED will blink every second.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Pro Tip (Tinkercad shortcut)&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Arduino pin 13 already has a built-in LED.&lt;br&gt;
You can skip all wiring and just run:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;void setup() {
  pinMode(13, OUTPUT);
  digitalWrite(13, HIGH);
}
void loop() {}
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The tiny LED on the &lt;a href="https://www.ampheoelec.de/c/development-board-arduino" rel="noopener noreferrer"&gt;Arduino board&lt;/a&gt; will turn on.&lt;/p&gt;

</description>
      <category>arduino</category>
      <category>tinkercad</category>
      <category>arduinouno</category>
      <category>led</category>
    </item>
    <item>
      <title>How to simulate microcontroller output with maximum current and high voltage?</title>
      <dc:creator>Hedy</dc:creator>
      <pubDate>Mon, 19 Jan 2026 10:30:03 +0000</pubDate>
      <link>https://dev.to/carolineee/how-to-simulate-microcontroller-output-with-maximum-current-and-high-voltage-55im</link>
      <guid>https://dev.to/carolineee/how-to-simulate-microcontroller-output-with-maximum-current-and-high-voltage-55im</guid>
      <description>&lt;p&gt;A &lt;a href="https://www.ampheo.com/c/microcontrollers" rel="noopener noreferrer"&gt;microcontroller&lt;/a&gt; (MCU) pin can’t directly output “maximum current + high voltage.” In theory, an MCU GPIO is a logic-level signal source (3.3 V / 5 V, limited current), and any “high voltage / high current output” is created by an external power stage that the GPIO controls.&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%2Fnjss4bmlh9koppynfa51.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%2Fnjss4bmlh9koppynfa51.jpg" alt=" " width="800" height="533"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;What you’re really doing is simulating a “power output” that is commanded by a microcontroller:&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;MCU GPIO (logic) → level shift / gate drive → power switch (&lt;a href="https://www.onzuu.com/category/fets-mosfets" rel="noopener noreferrer"&gt;MOSFET&lt;/a&gt;/&lt;a href="https://www.onzuu.com/category/igbts" rel="noopener noreferrer"&gt;IGBT&lt;/a&gt;/high-side switch) → external HV supply → load&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Below: theory first, then real, concrete part-number examples (no vendor names needed in your final article if you prefer, but I’m using well-known model numbers here so it’s actionable).&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;1) Theory: model the MCU output correctly&lt;/strong&gt;&lt;br&gt;
&lt;strong&gt;1.1 GPIO is not a power source&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;A GPIO pin behaves roughly like:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;A voltage source (VDD, e.g., 3.3 V)&lt;/li&gt;
&lt;li&gt;With finite output resistance (so voltage droops as current increases)&lt;/li&gt;
&lt;li&gt;With strict absolute max limits (overcurrent can cause latch-up, permanent damage)&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;So you should never “maximize” current from the pin. Instead you use it as a control signal.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;1.2 High voltage and high current come from the external supply&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;To simulate an MCU “power output,” you provide:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;HV supply (12 V / 24 V / 48 V / 60–400 V, depending on your target)&lt;/li&gt;
&lt;li&gt;Current capability (amps to tens of amps)&lt;/li&gt;
&lt;li&gt;A switch (MOSFET/IGBT) that connects/disconnects the load&lt;/li&gt;
&lt;li&gt;Protection (flyback &lt;a href="https://www.onzuu.com/category/diodes" rel="noopener noreferrer"&gt;diode&lt;/a&gt;, &lt;a href="https://www.onzuu.com/category/tvs-diodes" rel="noopener noreferrer"&gt;TVS&lt;/a&gt;, current limiting, fusing)&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;1.3 Two switching topologies&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Low-side switching (most common, simplest)&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Load to +HV&lt;/li&gt;
&lt;li&gt;Switch to ground&lt;/li&gt;
&lt;li&gt;Best for: &lt;a href="https://www.onzuu.com/category/solenoids" rel="noopener noreferrer"&gt;solenoids&lt;/a&gt;, &lt;a href="https://www.onzuu.com/category/motors-actuators-solenoids-and-drivers" rel="noopener noreferrer"&gt;motors&lt;/a&gt;, heaters, LED strips, &lt;a href="https://www.onzuu.com/category/relays" rel="noopener noreferrer"&gt;relays&lt;/a&gt;
&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;High-side switching (when load must stay at ground)&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Switch connects +HV to load&lt;/li&gt;
&lt;li&gt;Best for: automotive-style wiring, grounded loads, “sourcing” outputs&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;1.4 “Maximum current” is a power-stage problem&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;If you want “max current simulation,” you control it by:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;A bench supply current limit (simple)&lt;/li&gt;
&lt;li&gt;A sense &lt;a href="https://www.onzuu.com/category/resistors" rel="noopener noreferrer"&gt;resistor&lt;/a&gt; + current limiter (accurate)&lt;/li&gt;
&lt;li&gt;A high-side/low-side current monitor and firmware control&lt;/li&gt;
&lt;li&gt;An electronic fuse / hot-swap controller for safety&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;1.5 If you need analog high-voltage outputs&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;For 0–10 V: PWM/&lt;a href="https://www.onzuu.com/category/digital-to-analog-converters" rel="noopener noreferrer"&gt;DAC&lt;/a&gt; → op-amp (powered from higher rail) → 0–10 V&lt;/li&gt;
&lt;li&gt;For 4–20 mA: PWM/DAC → current-loop driver → loop supply (often 24 V)&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;2) Practical simulation recipes (what engineers actually do)&lt;/strong&gt;&lt;br&gt;
&lt;strong&gt;Recipe A — High-voltage ON/OFF (DC loads): MOSFET low-side&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Goal: MCU pin “simulates” switching a 24 V load at several amps.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Blocks&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;MCU GPIO → gate resistor + pulldown&lt;/li&gt;
&lt;li&gt;Logic-level N-MOSFET (or gate driver + MOSFET for bigger loads)&lt;/li&gt;
&lt;li&gt;Flyback diode if inductive&lt;/li&gt;
&lt;li&gt;TVS on supply for transient suppression&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Why it works: MCU only charges/discharges a gate (microamps average); the MOSFET and supply deliver amps.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Recipe B — High-side “sourcing” output (automotive/industrial)&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Goal: Simulate a PLC/ECU output that sources 24 V to a load.&lt;/p&gt;

&lt;p&gt;Use either:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;A high-side switch IC (easiest + protections)&lt;/li&gt;
&lt;li&gt;Or P-MOSFET + driver (good for moderate voltage/current)&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;Recipe C — High voltage (tens to hundreds of volts): isolated gate drive + MOSFET/IGBT&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Goal: Simulate an MCU controlling a 100–400 V power stage (e.g., DC bus).&lt;/p&gt;

&lt;p&gt;You typically need:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Isolation (digital isolator or optocoupler)&lt;/li&gt;
&lt;li&gt;Gate driver (often isolated)&lt;/li&gt;
&lt;li&gt;MOSFET/IGBT with correct voltage/current ratings&lt;/li&gt;
&lt;li&gt;Snubbers/TVS, creepage/clearance rules, and safe probing&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;3) Real-world example builds (with actual model numbers)&lt;/strong&gt;&lt;br&gt;
&lt;strong&gt;Example 1: “STM32 outputs 24 V / 5 A ON/OFF” (industrial load)&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;MCU (logic source)&lt;/strong&gt;: &lt;a href="https://www.ampheo.com/product/stm32f103c8t6-131876" rel="noopener noreferrer"&gt;STM32F103C8T6&lt;/a&gt; (3.3 V GPIO)&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Power stage (low-side):&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;MOSFET: &lt;a href="https://www.onzuu.com/search/IRLZ44N" rel="noopener noreferrer"&gt;IRLZ44N&lt;/a&gt; (easy-to-find logic-level MOSFET; fine for learning/low-frequency switching)&lt;/li&gt;
&lt;li&gt;Gate resistor: 33 Ω&lt;/li&gt;
&lt;li&gt;Gate pulldown: 100 kΩ&lt;/li&gt;
&lt;li&gt;Flyback diode (inductive loads): &lt;a href="https://www.onzuu.com/search/SS54" rel="noopener noreferrer"&gt;SS54&lt;/a&gt; or &lt;a href="https://www.onzuu.com/search/1N5822" rel="noopener noreferrer"&gt;1N5822&lt;/a&gt; (Schottky, choose current/voltage margin)&lt;/li&gt;
&lt;li&gt;Supply protection: &lt;a href="https://www.onzuu.com/search/SMBJ33A" rel="noopener noreferrer"&gt;SMBJ33A&lt;/a&gt; TVS (for 24 V-ish rails; pick TVS rating based on your system)&lt;/li&gt;
&lt;li&gt;Add a fuse on the 24 V input&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;How to “simulate maximum current” safely:&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Use a bench supply at 24 V&lt;/li&gt;
&lt;li&gt;Set current limit to 0.5 A first, verify switching&lt;/li&gt;
&lt;li&gt;Increase limit gradually to your target (e.g., 5 A)&lt;/li&gt;
&lt;li&gt;Start with a dummy load: a power resistor (e.g., 4.7 Ω / 50 W) or an electronic load&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;Notes:&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;IRLZ44N is not a “modern best-in-class” MOSFET, but it’s a classic demonstration part.&lt;/li&gt;
&lt;li&gt;For faster PWM, higher efficiency, or tight thermal limits, you’d select a newer MOSFET with lower RDS(on) at VGS=2.5–4.5 V.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;Example 2: “Arduino-like GPIO simulates a 12 V relay driver”&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;*&lt;em&gt;MCU: *&lt;/em&gt;&lt;a href="https://www.ampheo.com/search/ATmega328P" rel="noopener noreferrer"&gt;ATmega328P&lt;/a&gt; (5 V GPIO)&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Driver stage (because relay coils are inductive):&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;a href="https://www.onzuu.com/category/transistors" rel="noopener noreferrer"&gt;Transistor&lt;/a&gt;: &lt;a href="https://www.onzuu.com/search/2N2222" rel="noopener noreferrer"&gt;2N2222&lt;/a&gt; (or similar BJT) or a small logic MOSFET like &lt;a href="https://www.onzuu.com/product/alpha-and-omega-semiconductor-inc-ao3400a-5190082" rel="noopener noreferrer"&gt;AO3400A&lt;/a&gt;
&lt;/li&gt;
&lt;li&gt;Flyback diode: &lt;a href="https://www.onzuu.com/search/1N4148" rel="noopener noreferrer"&gt;1N4148&lt;/a&gt; (small relay) or &lt;a href="https://www.onzuu.com/search/1N4007" rel="noopener noreferrer"&gt;1N4007&lt;/a&gt; (general) / &lt;a href="https://www.onzuu.com/search/SS14" rel="noopener noreferrer"&gt;SS14&lt;/a&gt; (fast Schottky)&lt;/li&gt;
&lt;li&gt;Base/gate resistor: BJT base ~1 kΩ; MOSFET gate ~33 Ω&lt;/li&gt;
&lt;li&gt;Pull-down: 100 kΩ (MOSFET)&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;Why this is a good “simulation”:&lt;/strong&gt;&lt;br&gt;
It mimics what a real MCU-controlled output stage does: logic controls a switch, and the external supply drives the coil.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Example 3: “3.3 V MCU simulates a 24 V high-side output with protections”&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;MCU:&lt;/strong&gt; &lt;a href="https://www.ampheo.com/search/STM32G0" rel="noopener noreferrer"&gt;STM32G0&lt;/a&gt; series (3.3 V GPIO)&lt;/p&gt;

&lt;p&gt;High-side switch IC: &lt;a href="https://www.onzuu.com/search/BTS500" rel="noopener noreferrer"&gt;BTS500xx&lt;/a&gt; / &lt;a href="https://www.onzuu.com/search/VNQ" rel="noopener noreferrer"&gt;VNQxxx&lt;/a&gt;-style high-side switch families (automotive protected high-side switches)&lt;/p&gt;

&lt;p&gt;These parts typically include:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;current limit&lt;/li&gt;
&lt;li&gt;thermal shutdown&lt;/li&gt;
&lt;li&gt;short-circuit protection&lt;/li&gt;
&lt;li&gt;diagnostic output (optional)&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;How to test:&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;GPIO drives the enable/input&lt;/li&gt;
&lt;li&gt;Put load between output and ground&lt;/li&gt;
&lt;li&gt;Use supply current limit + fuse for safety&lt;/li&gt;
&lt;li&gt;Scope the output during switching; watch inrush&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;(Exact suffix depends on your current rating/channel count; choose according to your “max current” target.)&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Example 4: “MCU simulates high voltage (e.g., 200–400 V) switching”&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;MCU:&lt;/strong&gt; &lt;a href="https://www.ampheo.com/search/STM32F4" rel="noopener noreferrer"&gt;STM32F4&lt;/a&gt; series (timers for PWM)&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Isolation + driver:&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Digital isolator: ADuM1100 (or similar)&lt;/li&gt;
&lt;li&gt;Isolated gate driver: &lt;a href="https://www.onzuu.com/search/ACPL-332J" rel="noopener noreferrer"&gt;ACPL-332J&lt;/a&gt; (optocoupler driver) or transformer/isolated driver module&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;Power switch:&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;MOSFET: choose 600 V class for 400 V bus (part depends heavily on current and switching frequency)&lt;/li&gt;
&lt;li&gt;Add RC snubber + TVS as needed&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;Safety reality check:&lt;/strong&gt;&lt;br&gt;
At these voltages, simulation becomes a high-energy power electronics build. Use isolation, creepage/clearance, proper probing, and staged bring-up.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;4) Measurement and “simulation credibility”&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;To claim you are simulating an MCU “max current / high voltage output,” you should measure:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Load current (shunt + amplifier, or a Hall sensor)&lt;/li&gt;
&lt;li&gt;MOSFET temperature (IR camera / thermocouple)&lt;/li&gt;
&lt;li&gt;Switching waveform (VDS/VCE, gate voltage, ringing)&lt;/li&gt;
&lt;li&gt;Supply dips and transients&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;Useful current-sense examples (real parts)&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;High-side current monitor: &lt;a href="https://www.onzuu.com/search/INA219" rel="noopener noreferrer"&gt;INA219&lt;/a&gt; (simple I²C), &lt;a href="https://www.onzuu.com/search/INA226" rel="noopener noreferrer"&gt;INA226&lt;/a&gt;
&lt;/li&gt;
&lt;li&gt;Hall sensor (isolated current): &lt;a href="https://www.ampheo.com/search/ACS712" rel="noopener noreferrer"&gt;ACS712&lt;/a&gt; / &lt;a href="https://www.ampheo.com/search/ACS758" rel="noopener noreferrer"&gt;ACS758&lt;/a&gt;
&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;5) A simple selection checklist (so you don’t smoke boards)&lt;/strong&gt;&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;&lt;p&gt;Define Vload (12/24/48/… V) and Iload (A).&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Pick topology:&lt;/p&gt;&lt;/li&gt;
&lt;/ol&gt;

&lt;ul&gt;
&lt;li&gt;low-side MOSFET (default)&lt;/li&gt;
&lt;li&gt;high-side switch (if needed)&lt;/li&gt;
&lt;/ul&gt;

&lt;ol&gt;
&lt;li&gt;Choose switch ratings:&lt;/li&gt;
&lt;/ol&gt;

&lt;ul&gt;
&lt;li&gt;VDS ≥ 2× supply (more if inductive/noisy)&lt;/li&gt;
&lt;li&gt;Id ≥ load current with thermal margin&lt;/li&gt;
&lt;/ul&gt;

&lt;ol&gt;
&lt;li&gt;Add protections:&lt;/li&gt;
&lt;/ol&gt;

&lt;ul&gt;
&lt;li&gt;flyback diode (inductive)&lt;/li&gt;
&lt;li&gt;fuse&lt;/li&gt;
&lt;li&gt;TVS&lt;/li&gt;
&lt;li&gt;current limit (bench supply or eFuse)&lt;/li&gt;
&lt;/ul&gt;

&lt;ol&gt;
&lt;li&gt;Validate with a dummy load, then real load.&lt;/li&gt;
&lt;/ol&gt;

</description>
      <category>microcontroller</category>
      <category>simulate</category>
      <category>stm32f103c8t6</category>
      <category>atmega328p</category>
    </item>
    <item>
      <title>How to use FPGA to implement PID?</title>
      <dc:creator>Hedy</dc:creator>
      <pubDate>Wed, 14 Jan 2026 08:45:56 +0000</pubDate>
      <link>https://dev.to/carolineee/how-to-use-fpga-to-implement-pid-7kg</link>
      <guid>https://dev.to/carolineee/how-to-use-fpga-to-implement-pid-7kg</guid>
      <description>&lt;p&gt;Implementing a PID on an &lt;a href="https://www.ampheo.com/c/fpgas-field-programmable-gate-array" rel="noopener noreferrer"&gt;FPGA&lt;/a&gt; is very doable—and usually better than a &lt;a href="https://www.ampheo.com/c/microcontrollers" rel="noopener noreferrer"&gt;microcontroller&lt;/a&gt; when you need high sample rate, low jitter, and deterministic latency. The key is to implement a discrete-time PID using fixed-point math, with proper saturation/anti-windup, and a clean sample tick.&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%2Fngqs2ulgazz6xz906dkk.jpeg" 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%2Fngqs2ulgazz6xz906dkk.jpeg" alt=" " width="800" height="533"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Below is a practical, FPGA-friendly way to do it.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;1) Pick a discrete PID form that’s FPGA-friendly&lt;/strong&gt;&lt;br&gt;
Standard (position) form&lt;br&gt;
​&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%2Fednmygpxt5e4zjd4br47.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%2Fednmygpxt5e4zjd4br47.png" alt=" " width="479" height="89"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Works, but the integral sum can grow large and you’ll spend effort managing overflow.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;FPGA-friendly (incremental / velocity) form (recommended)&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;This form reduces accumulator range issues and is easy to pipeline:&lt;/p&gt;

&lt;p&gt;𝑢[𝑛]=𝑢[𝑛−1]+𝐴(𝑒[𝑛]−𝑒[𝑛−1])+𝐵𝑒[𝑛]+𝐶(𝑒[𝑛]−2𝑒[𝑛−1]+𝑒[𝑛−2])&lt;/p&gt;

&lt;p&gt;Where typically:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;𝐴=𝐾𝑝&lt;/li&gt;
&lt;li&gt;𝐵=𝐾𝑖𝑇𝑠&lt;/li&gt;
&lt;li&gt;𝐶=𝐾𝑑/𝑇𝑠&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;Why it’s great on FPGA&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Uses only a few differences + multiplies + adds each sample&lt;/li&gt;
&lt;li&gt;One state register for output (u[n-1]) + small history (e[n-1], e[n-2])&lt;/li&gt;
&lt;li&gt;Easy saturation at the end&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;2) Build the FPGA PID datapath (what blocks you implement)&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;At each sample tick:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Error&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;e = setpoint - measurement&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Differences&lt;/li&gt;
&lt;/ol&gt;

&lt;ul&gt;
&lt;li&gt;de = e - e1&lt;/li&gt;
&lt;li&gt;dde = e - 2*e1 + e2&lt;/li&gt;
&lt;/ul&gt;

&lt;ol&gt;
&lt;li&gt;Multiply&lt;/li&gt;
&lt;/ol&gt;

&lt;ul&gt;
&lt;li&gt;p_term = A * de&lt;/li&gt;
&lt;li&gt;i_term = B * e&lt;/li&gt;
&lt;li&gt;d_term = C * dde&lt;/li&gt;
&lt;/ul&gt;

&lt;ol&gt;
&lt;li&gt;Accumulate output&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;u = u_prev + p_term + i_term + d_term&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Saturation + anti-windup&lt;/li&gt;
&lt;/ol&gt;

&lt;ul&gt;
&lt;li&gt;Clamp u to actuator limits&lt;/li&gt;
&lt;li&gt;If saturated, optionally stop/limit integral contribution (details below)&lt;/li&gt;
&lt;/ul&gt;

&lt;ol&gt;
&lt;li&gt;Update history registers&lt;/li&gt;
&lt;/ol&gt;

&lt;ul&gt;
&lt;li&gt;e2 &amp;lt;= e1&lt;/li&gt;
&lt;li&gt;e1 &amp;lt;= e&lt;/li&gt;
&lt;li&gt;u_prev &amp;lt;= u_sat&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;3) Fixed-point design (the “make it work in hardware” part)&lt;/strong&gt;&lt;br&gt;
&lt;strong&gt;Choose a Q format&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Example starting point:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Error e: signed 16-bit&lt;/li&gt;
&lt;li&gt;Coefficients A,B,C: signed 18-bit (fits nicely with DSP slices)&lt;/li&gt;
&lt;li&gt;Internal products: 34–36-bit&lt;/li&gt;
&lt;li&gt;Accumulator/output: 32–40-bit, then truncate/round to actuator width&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Typical formats:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Signals: Q1.15 (16-bit signed)&lt;/li&gt;
&lt;li&gt;Coeffs: Q3.14 or Q5.12 depending on your gain range&lt;/li&gt;
&lt;li&gt;Accumulator: keep extra headroom: Q8.24 or similar&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;Scaling workflow (practical)&lt;/strong&gt;&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Decide actuator output range (e.g., PWM duty 0…65535)&lt;/li&gt;
&lt;li&gt;Decide measurement and setpoint scaling (&lt;a href="https://www.onzuu.com/category/analog-to-digital-converters" rel="noopener noreferrer"&gt;ADC&lt;/a&gt; counts? physical units scaled?)&lt;/li&gt;
&lt;li&gt;Pick Q formats so products don’t overflow at worst-case error&lt;/li&gt;
&lt;li&gt;Add:&lt;/li&gt;
&lt;/ol&gt;

&lt;ul&gt;
&lt;li&gt;rounding when shifting back down&lt;/li&gt;
&lt;li&gt;saturation after add/accumulate&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;4) Sample tick and determinism&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Your PID should update at a fixed rate 𝑓𝑠=1/𝑇𝑠.&lt;/p&gt;

&lt;p&gt;Common FPGA approach:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;A hardware timer/counter generates pid_tick every Ts&lt;/li&gt;
&lt;li&gt;On pid_tick, latch inputs (setpoint, measurement) and run the PID pipeline&lt;/li&gt;
&lt;li&gt;Pipeline latency might be a few FPGA clocks, but the update interval stays exact&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Tip: If your ADC sample rate is the master clock, use “ADC data valid” as pid_tick.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;5) Derivative filtering (important in real systems)&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Raw derivative amplifies noise. A common FPGA-safe solution:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Compute derivative on measurement instead of error, or&lt;/li&gt;
&lt;li&gt;Apply a 1st-order low-pass to derivative:&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;𝑑𝑓[𝑛]=𝑑𝑓[𝑛−1]+𝛼(𝑑[𝑛]−𝑑𝑓[𝑛−1])&lt;/p&gt;

&lt;p&gt;That’s just an extra multiply + accumulator (very FPGA-friendly).&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;6) Anti-windup (don’t let the integrator explode)&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Even with incremental form, the “I contribution” can drive output into saturation and keep integrating.&lt;/p&gt;

&lt;p&gt;Simple anti-windup options:&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Option A: Conditional integration (easy)&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Only apply the I term when not saturated or when error would move output back toward range.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;If u saturated high and e &amp;gt; 0 → skip I&lt;/li&gt;
&lt;li&gt;If u saturated low and e &amp;lt; 0 → skip I&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;Option B: Back-calculation (more control)&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Adjust integrator based on saturation difference:&lt;/p&gt;

&lt;p&gt;𝐼←𝐼+𝐾𝑎𝑤(𝑢𝑠𝑎𝑡−𝑢)&lt;/p&gt;

&lt;p&gt;(also &lt;a href="https://www.ampheoelec.de/c/fpgas-field-programmable-gate-array" rel="noopener noreferrer"&gt;FPGA&lt;/a&gt;-friendly, one extra multiply)&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;7) Resource mapping tips (&lt;a href="https://www.vemeko.com/product/#xilinx" rel="noopener noreferrer"&gt;Xilinx&lt;/a&gt;/&lt;a href="https://www.ampheo.com/manufacturer/intel" rel="noopener noreferrer"&gt;Intel FPGAs&lt;/a&gt;)&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Use &lt;a href="https://www.ampheo.com/c/dsp-digital-signal-processors" rel="noopener noreferrer"&gt;DSP&lt;/a&gt; slices for the multiplies (3 multiplies for P/I/D, plus optional derivative filter)&lt;/li&gt;
&lt;li&gt;Use pipelining to meet timing:

&lt;ul&gt;
&lt;li&gt;Stage 1: compute e,de,dde&lt;/li&gt;
&lt;li&gt;Stage 2: multiply&lt;/li&gt;
&lt;li&gt;Stage 3: sum + saturate&lt;/li&gt;
&lt;/ul&gt;


&lt;/li&gt;

&lt;li&gt;If you need many PID loops (multi-axis), you can:

&lt;ul&gt;
&lt;li&gt;Fully parallel: best performance, more DSP usage&lt;/li&gt;
&lt;li&gt;Time-multiplex: reuse multipliers across channels with scheduling (cheaper DSP)&lt;/li&gt;
&lt;/ul&gt;


&lt;/li&gt;

&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;8) How PID connects to the outside world on FPGA&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Typical chain:&lt;/p&gt;

&lt;p&gt;ADC / &lt;a href="https://www.ampheo.com/c/sensors" rel="noopener noreferrer"&gt;sensor&lt;/a&gt; capture → scaling → PID → output scaling → PWM / DAC / motor driver&lt;/p&gt;

&lt;p&gt;Examples:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;a href="https://www.onzuu.com/category/motors-actuators-solenoids-and-drivers" rel="noopener noreferrer"&gt;Motor&lt;/a&gt; control: PID output drives PWM duty or current reference&lt;/li&gt;
&lt;li&gt;Temperature control: PID output drives PWM to heater + SSR&lt;/li&gt;
&lt;li&gt;Position control: PID output drives torque/current loop setpoint&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;9) Verification workflow (fast and reliable)&lt;/strong&gt;&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Validate your PID gains in Python/MATLAB (floating point)&lt;/li&gt;
&lt;li&gt;Quantize to fixed point (same Q formats)&lt;/li&gt;
&lt;li&gt;Simulate HDL with a testbench using recorded signals&lt;/li&gt;
&lt;li&gt;Hardware test with step response + logging (ILA/SignalTap)&lt;/li&gt;
&lt;/ol&gt;

</description>
      <category>fpga</category>
      <category>pid</category>
      <category>adc</category>
      <category>pwm</category>
    </item>
  </channel>
</rss>
