mirror of
https://github.com/mytechnotalent/Embedded-Hacking.git
synced 2026-07-12 23:26:33 +02:00
97 lines
4.8 KiB
XML
97 lines
4.8 KiB
XML
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 1200 800">
|
|
<style>
|
|
.bg{fill:#0a0a0f}.pnl{fill:#12121a;stroke:#1a1a2e}.hdr{fill:#12121a}
|
|
.title{font:bold 42px 'Courier New',monospace;fill:#00ff41}
|
|
.sub{font:bold 28px 'Courier New',monospace;fill:#00d4ff}
|
|
.txt{font:24px 'Courier New',monospace;fill:#c0c0c0}
|
|
.dim{font:20px 'Courier New',monospace;fill:#888}
|
|
.grn{font:bold 24px 'Courier New',monospace;fill:#00ff41}
|
|
.red{font:bold 24px 'Courier New',monospace;fill:#ff0040}
|
|
.cyn{font:bold 24px 'Courier New',monospace;fill:#00d4ff}
|
|
.amb{font:bold 24px 'Courier New',monospace;fill:#ffaa00}
|
|
.badge{stroke:#00ff41;rx:14}
|
|
</style>
|
|
<rect class="bg" width="1200" height="800"/>
|
|
<rect class="hdr" x="0" y="0" width="1200" height="100" rx="0"/>
|
|
<text class="title" x="600" y="52" text-anchor="middle">PWM Basics</text>
|
|
<text class="dim" x="600" y="88" text-anchor="middle">Pulse Width Modulation for Servo Control</text>
|
|
|
|
<!-- What is PWM -->
|
|
<rect class="pnl" x="30" y="110" width="1140" height="160" rx="8"/>
|
|
<text class="sub" x="50" y="150">What is PWM?</text>
|
|
<text class="txt" x="50" y="185">Rapidly switching a signal ON and OFF</text>
|
|
<text class="dim" x="50" y="213">Ratio of on-time to off-time controls power</text>
|
|
|
|
<!-- PWM waveform diagram -->
|
|
<text class="grn" x="650" y="155">HIGH</text>
|
|
<line x1="700" y1="165" x2="700" y2="195" stroke="#00ff41" stroke-width="2"/>
|
|
<line x1="700" y1="165" x2="830" y2="165" stroke="#00ff41" stroke-width="2"/>
|
|
<line x1="830" y1="165" x2="830" y2="195" stroke="#00ff41" stroke-width="2"/>
|
|
<line x1="830" y1="195" x2="920" y2="195" stroke="#888" stroke-width="2"/>
|
|
<line x1="920" y1="195" x2="920" y2="165" stroke="#00ff41" stroke-width="2"/>
|
|
<line x1="920" y1="165" x2="1050" y2="165" stroke="#00ff41" stroke-width="2"/>
|
|
<line x1="1050" y1="165" x2="1050" y2="195" stroke="#00ff41" stroke-width="2"/>
|
|
<line x1="1050" y1="195" x2="1140" y2="195" stroke="#888" stroke-width="2"/>
|
|
<text class="dim" x="650" y="230">ON</text>
|
|
<text class="dim" x="750" y="230">OFF</text>
|
|
<text class="dim" x="850" y="230">ON</text>
|
|
<text class="dim" x="990" y="230">OFF</text>
|
|
|
|
<!-- Servo Pulse Widths -->
|
|
<rect class="pnl" x="30" y="290" width="1140" height="260" rx="8"/>
|
|
<text class="sub" x="50" y="330">Servo PWM (50Hz = 20ms period)</text>
|
|
|
|
<!-- 0 degrees -->
|
|
<text class="amb" x="50" y="370">0deg (1ms pulse):</text>
|
|
<line x1="330" y1="355" x2="380" y2="355" stroke="#00ff41" stroke-width="3"/>
|
|
<line x1="380" y1="355" x2="380" y2="375" stroke="#00ff41" stroke-width="2"/>
|
|
<line x1="380" y1="375" x2="900" y2="375" stroke="#888" stroke-width="1" stroke-dasharray="3"/>
|
|
<text class="dim" x="400" y="370">1ms HIGH</text>
|
|
<text class="dim" x="700" y="370">19ms LOW</text>
|
|
|
|
<!-- 90 degrees -->
|
|
<text class="amb" x="50" y="420">90deg (1.5ms pulse):</text>
|
|
<line x1="330" y1="405" x2="410" y2="405" stroke="#00ff41" stroke-width="3"/>
|
|
<line x1="410" y1="405" x2="410" y2="425" stroke="#00ff41" stroke-width="2"/>
|
|
<line x1="410" y1="425" x2="900" y2="425" stroke="#888" stroke-width="1" stroke-dasharray="3"/>
|
|
<text class="dim" x="430" y="420">1.5ms HIGH</text>
|
|
<text class="dim" x="700" y="420">18.5ms LOW</text>
|
|
|
|
<!-- 180 degrees -->
|
|
<text class="amb" x="50" y="470">180deg (2ms pulse):</text>
|
|
<line x1="330" y1="455" x2="440" y2="455" stroke="#00ff41" stroke-width="3"/>
|
|
<line x1="440" y1="455" x2="440" y2="475" stroke="#00ff41" stroke-width="2"/>
|
|
<line x1="440" y1="475" x2="900" y2="475" stroke="#888" stroke-width="1" stroke-dasharray="3"/>
|
|
<text class="dim" x="460" y="470">2ms HIGH</text>
|
|
<text class="dim" x="700" y="470">18ms LOW</text>
|
|
|
|
<text class="dim" x="50" y="510">Pulse WIDTH determines angle, not duty cycle</text>
|
|
<text class="dim" x="50" y="535">Total period always 20ms (50Hz)</text>
|
|
|
|
<!-- Angle Table -->
|
|
<rect class="pnl" x="30" y="570" width="555" height="190" rx="8"/>
|
|
<text class="sub" x="50" y="610">Angle to Pulse Width</text>
|
|
|
|
<text class="amb" x="50" y="645">Angle</text>
|
|
<text class="amb" x="180" y="645">Pulse</text>
|
|
<text class="amb" x="340" y="645">Ticks (1MHz)</text>
|
|
<line x1="50" y1="655" x2="565" y2="655" stroke="#1a1a2e" stroke-width="1"/>
|
|
<text class="txt" x="50" y="685">0deg</text>
|
|
<text class="grn" x="180" y="685">1000us</text>
|
|
<text class="dim" x="340" y="685">1000</text>
|
|
<text class="txt" x="50" y="715">90deg</text>
|
|
<text class="grn" x="180" y="715">1500us</text>
|
|
<text class="dim" x="340" y="715">1500</text>
|
|
<text class="txt" x="50" y="745">180deg</text>
|
|
<text class="grn" x="180" y="745">2000us</text>
|
|
<text class="dim" x="340" y="745">2000</text>
|
|
|
|
<!-- Formula -->
|
|
<rect class="pnl" x="615" y="570" width="555" height="190" rx="8"/>
|
|
<text class="sub" x="635" y="610">Formula</text>
|
|
<text class="cyn" x="635" y="650">pulse = 1000 + (angle/180) x 1000</text>
|
|
<text class="dim" x="635" y="685">Example for 90deg:</text>
|
|
<text class="txt" x="635" y="715">1000 + (90/180) x 1000</text>
|
|
<text class="grn" x="635" y="745">= 1500us = 1500 ticks</text>
|
|
</svg>
|