<?xml version='1.0' encoding='UTF-8'?><?xml-stylesheet href="http://www.blogger.com/styles/atom.css" type="text/css"?><feed xmlns='http://www.w3.org/2005/Atom' xmlns:openSearch='http://a9.com/-/spec/opensearchrss/1.0/' xmlns:blogger='http://schemas.google.com/blogger/2008' xmlns:georss='http://www.georss.org/georss' xmlns:gd="http://schemas.google.com/g/2005" xmlns:thr='http://purl.org/syndication/thread/1.0'><id>tag:blogger.com,1999:blog-7437986969318338216</id><updated>2026-04-18T04:05:55.977+05:45</updated><category term="arduino"/><category term="power supply"/><category term="Calculator"/><category term="RF"/><category term="PCB"/><category term="WISP"/><category term="op-amp"/><category term="IoT"/><category term="AM"/><category term="DC motor"/><category term="Oscillator"/><category term="amplifier"/><category term="filters"/><category term="Electronics"/><category term="ATmega328p"/><category term="Modulator"/><category term="Voltage Regulator"/><category term="web app"/><category term="FM"/><category term="NodeMCU"/><category term="electronics circuit"/><category term="Arduino Nano"/><category term="Diode"/><category term="LM358"/><category term="repair"/><category term="ATmega32"/><category term="arduino uno"/><category term="Matlab"/><category term="Stepper Motor"/><category term="BJT"/><category term="robotics"/><category term="DSP"/><category term="Programming"/><category term="ESP8266"/><category term="Arduino Project"/><category term="PIC"/><category term="inverter"/><category term="Board Explorer"/><category term="E-MOSFET"/><category term="Multivibrator"/><category term="Simulink"/><category term="transistor"/><category term="Instrumentation"/><category term="MOSFET"/><category term="555 Timer"/><category term="Control System"/><category term="JFET"/><category term="esp32"/><category term="pic16f877a"/><category term="Node-Red"/><category term="microcontroller"/><category term="Arduino Due"/><category term="LM35"/><category term="NMR"/><category term="PIR sensor"/><category term="Servo Motor"/><category term="Web Server"/><category term="stm32"/><category term="Johnny-Five"/><category term="741 op-amp"/><category term="Arduino Simulink Project"/><category term="L293D"/><category term="buck converter"/><category term="filter calculator"/><category term="troubleshooting"/><category term="Bluetooth"/><category term="Demodulator"/><category term="lab"/><category term="DHT11"/><category term="ESP32 CAM"/><category term="L298N"/><category term="Temperature Sensor"/><category term="audio"/><category term="Arduino Matlab Projects"/><category term="Arduino Mega"/><category term="IR sensor"/><category term="LDR"/><category term="LM741"/><category term="Motor Shield"/><category term="digital electronics"/><category term="drone"/><category term="AI"/><category term="Moisture Sensor"/><category term="OLED LCD"/><category term="Relay"/><category term="embedded systems"/><category term="motor"/><category term="tutorial"/><category term="AD633"/><category term="AM modulator"/><category term="EEPROM"/><category term="Gas Sensor"/><category term="LM317"/><category term="LM324"/><category term="LM393"/><category term="Mikrotik"/><category term="Power Amplifier"/><category term="Proteus"/><category term="RF module"/><category term="SMPS"/><category term="guide"/><category term="optocoupler"/><category term="radio"/><category term="simulator"/><category term="solar power"/><category term="ESP12E"/><category term="HC-05"/><category term="Joystick"/><category term="LM311"/><category term="TL494"/><category term="Ultrasonic"/><category term="VCO"/><category term="Web Tech"/><category term="boost converter"/><category term="ebook"/><category term="keypad"/><category term="3DIC"/><category term="74HC595"/><category term="ATtiny13"/><category term="D-MOSFET"/><category term="GSM"/><category term="Humidity"/><category term="MPU-6050"/><category term="Processing"/><category term="Projects"/><category term="RAMPS"/><category term="RF circuit"/><category term="RTOS"/><category term="STM32F401RE"/><category term="Sim900"/><category term="TIP122"/><category term="Thermocouple"/><category term="audio amplifier"/><category term="fiber-optics"/><category term="filter"/><category term="light"/><category term="transformer"/><category term="A4988"/><category term="AD8495"/><category term="AT89S52"/><category term="ATmega16"/><category term="ATtiny45"/><category term="Accelerometer"/><category term="BLDC motor"/><category term="Computer"/><category term="DAC"/><category term="FM Circuit"/><category term="FM transmitter"/><category term="Gyroscope"/><category term="IC"/><category term="LM386"/><category term="LM566"/><category term="Laser Diode"/><category term="MC1496"/><category term="ML"/><category term="MQ2"/><category term="MQ3"/><category term="PID control"/><category term="PM"/><category term="PWM controller"/><category term="Power Electronics"/><category term="Sound Sensor"/><category term="TIP31C"/><category term="TL072"/><category term="WPT"/><category term="ad"/><category term="chip"/><category term="circuit design"/><category term="frequency modulation"/><category term="inductor"/><category term="inductor calculator"/><category term="information theory"/><category term="inverter design"/><category term="laptop"/><category term="python"/><category term="servo"/><category term="shift register"/><category term="teensy 4.1"/><category term="ubiquiti"/><category term="varactor diode"/><category term="7805"/><category term="AD31855"/><category term="AD7840"/><category term="AI web app"/><category term="ATmega 2560"/><category term="ATtiny"/><category term="AVR"/><category term="Analog Electronics"/><category term="Arduino projects"/><category term="Arduino temperature sensor"/><category term="At"/><category term="Bluepill"/><category term="Bluetooth robot"/><category term="Board"/><category term="CMOS"/><category term="DIY electronics"/><category term="Darlington Transistor"/><category term="ESP32-CAM"/><category term="Fast PWM"/><category term="Flip-Flops"/><category term="GPIO"/><category term="GPU"/><category term="HC-SR04"/><category term="IRLZ44N"/><category term="JFET modulator"/><category term="LCD"/><category term="LM2595"/><category term="LM35 guide"/><category term="LM35 temperature sensor with Arduino"/><category term="MSP430F5529"/><category term="MSP430FR5994"/><category term="MSP430G2553"/><category term="Microcontroller Programming"/><category term="Nucleo"/><category term="OVP"/><category term="Oscillator calculator"/><category term="Oximeter"/><category term="P5"/><category term="PIC12F683"/><category term="PWM inverter"/><category term="Photodiode"/><category term="PlatformIO"/><category term="Pressure Sensor"/><category term="RC filter"/><category term="RT"/><category term="Raspberry Pi 3 Interactive Board: A Deep Dive with the Explorer Web Tool"/><category term="STM32CubeIDE"/><category term="STM32F103C8T6"/><category term="STM32L4R5ZIT6"/><category term="Scilab"/><category term="Serial"/><category term="Seven Segment Display"/><category term="Signal Generator"/><category term="TL494 explorer"/><category term="Temperature sensor project"/><category term="Timer/Counter"/><category term="VS Code"/><category term="Virtual Reality"/><category term="Visual Designer"/><category term="Voltage Controlled Oscillator"/><category term="andriod"/><category term="basic electronics"/><category term="battery"/><category term="button"/><category term="coding"/><category term="datasheet"/><category term="digital communication"/><category term="diode circuit"/><category term="download"/><category term="electronics components detection"/><category term="embedded"/><category term="entropy"/><category term="filter design tutorial"/><category term="flame sensor"/><category term="flex sensor"/><category term="flow sensor"/><category term="ic explorer"/><category term="induction motor"/><category term="input"/><category term="interrupt"/><category term="light detector"/><category term="logic gate"/><category term="phototransistor"/><category term="pic16f877a pinout"/><category term="pic18f4550"/><category term="pid controller"/><category term="radio modulation"/><category term="rain sensor"/><category term="sensor"/><category term="signal modulation"/><category term="simple electronics"/><category term="software"/><category term="transistor modulator"/><category term="web tool"/><title type='text'>ee-diary</title><subtitle type='html'>Learn the essentials of electronics engineering on this weblog,packed with electronics circuit design,circuit diagram,program codes,practical tips and expert advice. Discover the inner workings of electronics circuits. Learn the basics of circuitry and how different components interact to create electronic devices. Mastering Advanced Electronics Circuit Design Techniques: Unlock Your Creativity. Take your electronics circuit design skills to the next level with advanced techniques.</subtitle><link rel='http://schemas.google.com/g/2005#feed' type='application/atom+xml' href='http://www.ee-diary.net/feeds/posts/default'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7437986969318338216/posts/default?redirect=false'/><link rel='alternate' type='text/html' href='http://www.ee-diary.net/'/><link rel='hub' href='http://pubsubhubbub.appspot.com/'/><link rel='next' type='application/atom+xml' href='http://www.blogger.com/feeds/7437986969318338216/posts/default?start-index=26&amp;max-results=25&amp;redirect=false'/><author><name>Unknown</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><generator version='7.00' uri='http://www.blogger.com'>Blogger</generator><openSearch:totalResults>1523</openSearch:totalResults><openSearch:startIndex>1</openSearch:startIndex><openSearch:itemsPerPage>25</openSearch:itemsPerPage><entry><id>tag:blogger.com,1999:blog-7437986969318338216.post-3973695414237599584</id><published>2026-04-17T17:12:00.003+05:45</published><updated>2026-04-17T17:13:42.678+05:45</updated><category scheme="http://www.blogger.com/atom/ns#" term="inverter"/><category scheme="http://www.blogger.com/atom/ns#" term="PWM controller"/><category scheme="http://www.blogger.com/atom/ns#" term="TL494"/><title type='text'>How to Design 12V DC to 220V AC Inverter Circuit </title><content type='html'>&lt;div class=&quot;separator&quot; style=&quot;clear: both;&quot;&gt;&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiBvmosYkHtHPaeg2-eJNfjfPwlAN-SEedeOj976N6sx9sgtQ6LFT0G9nbr9gxXRL1D64iTcn2X0P0J1xW2O19zxAxPG9chJ3ncr9lEKdsbSxxUTF3AdydgJ396MMNOotxbclIMqJVf3UOy6xitfPhRxTzeM2zx5NHww2dL7dQYd7C8MTjLpe7pplNaWdz-/s1600/12V%20DC%20into%20220V%20AC%20%E2%80%93%20Design%20an%20Inverter%20Schematic%20in%20Proteus.png&quot; style=&quot;display: block; padding: 1em 0; text-align: center; &quot;&gt;&lt;img alt=&quot;12V DC into 220V AC – Design an Inverter Schematic in Proteus&quot; border=&quot;0&quot; data-original-height=&quot;1024&quot; data-original-width=&quot;1536&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiBvmosYkHtHPaeg2-eJNfjfPwlAN-SEedeOj976N6sx9sgtQ6LFT0G9nbr9gxXRL1D64iTcn2X0P0J1xW2O19zxAxPG9chJ3ncr9lEKdsbSxxUTF3AdydgJ396MMNOotxbclIMqJVf3UOy6xitfPhRxTzeM2zx5NHww2dL7dQYd7C8MTjLpe7pplNaWdz-/s1600/12V%20DC%20into%20220V%20AC%20%E2%80%93%20Design%20an%20Inverter%20Schematic%20in%20Proteus.png&quot;/&gt;&lt;/a&gt;&lt;/div&gt;&lt;p&gt;&lt;span style=&quot;font-family: inherit;&quot;&gt;&amp;nbsp;Previously I wrote about &lt;a href=&quot;https://www.ee-diary.net/2025/08/inverter-design-with-tl494-pwm.html&quot;&gt;TL494 based inverter&lt;/a&gt; designed for low frequency(50/60Hz) intended for large and heavy iron-core transformer. After revisiting it and thought I should make another TL494 based inverter which is more advanced high frequency (SMPS) inverter. The previous TL494 inverter was a simple one which used complementary power transistors TIP41 and TIP42 with fixed 50% duty cycle. Here I will be showing a professional 12V DC to 220V AC inverter designed with two BC327 driver stage and four IRFZ44N MOSFETs based output power stage.&lt;/span&gt;&lt;/p&gt;&lt;h3 style=&quot;text-align: left;&quot;&gt;Circuit Diagram&lt;/h3&gt;&lt;p&gt;&lt;span style=&quot;font-family: inherit;&quot;&gt;The following shows the circuit diagram of&amp;nbsp;12V DC to 220V AC inverter using &lt;a href=&quot;https://www.ee-diary.net/2026/04/tl494-ic-pinout-explorer-free.html&quot;&gt;TL494 PWM controller IC&lt;/a&gt;.&lt;/span&gt;&lt;/p&gt;&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjkTdOW5eAe7wA-pgOEkraGD98XFWkg3hDJu8UrPK4x9E6kbxf5sQM01Ck8RoSN_L8WxcONi4YdX43WTFnfrnHzTmvD-Ns0KOObVPZ35aDx60IZCivCypJeJOcqoNUvJlHG0eQSnO3_xdTSjwdrLojqT8mGn9cRwzH5rnXx7uOFyH6xbKzY0qiElfOxN8xQ/s1179/12v%20DC%20to%20220v%20AC%20inverter%20circuit%20schematic%20design%20in%20Proteus.png&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;span style=&quot;font-family: inherit;&quot;&gt;&lt;img alt=&quot;12v DC to 220v AC inverter circuit schematic design in Proteus&quot; border=&quot;0&quot; data-original-height=&quot;597&quot; data-original-width=&quot;1179&quot; height=&quot;324&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjkTdOW5eAe7wA-pgOEkraGD98XFWkg3hDJu8UrPK4x9E6kbxf5sQM01Ck8RoSN_L8WxcONi4YdX43WTFnfrnHzTmvD-Ns0KOObVPZ35aDx60IZCivCypJeJOcqoNUvJlHG0eQSnO3_xdTSjwdrLojqT8mGn9cRwzH5rnXx7uOFyH6xbKzY0qiElfOxN8xQ/w640-h324/12v%20DC%20to%20220v%20AC%20inverter%20circuit%20schematic%20design%20in%20Proteus.png&quot; title=&quot;12v DC to 220v AC inverter circuit schematic design in Proteus&quot; width=&quot;640&quot; /&gt;&lt;/span&gt;&lt;/a&gt;&lt;/div&gt;&lt;p&gt;&lt;span style=&quot;font-family: inherit;&quot;&gt;The design step is as follows:&lt;/span&gt;&lt;/p&gt;&lt;h3 data-path-to-node=&quot;1&quot;&gt;&lt;b data-index-in-node=&quot;0&quot; data-path-to-node=&quot;1&quot;&gt;&lt;span style=&quot;font-family: inherit;&quot;&gt;Setting up the TL494 PWM Controller&lt;/span&gt;&lt;/b&gt;&lt;/h3&gt;&lt;p data-path-to-node=&quot;2&quot;&gt;&lt;span style=&quot;font-family: inherit;&quot;&gt;Begin by placing the &lt;b data-index-in-node=&quot;21&quot; data-path-to-node=&quot;2&quot;&gt;&lt;a href=&quot;https://www.ee-diary.net/2025/08/what-is-tl494.html&quot;&gt;TL494 IC&lt;/a&gt;&lt;/b&gt;, the heart of the PWM controller. Connect &lt;b data-index-in-node=&quot;72&quot; data-path-to-node=&quot;2&quot;&gt;Pin 1 (1IN+)&lt;/b&gt; and &lt;b data-index-in-node=&quot;89&quot; data-path-to-node=&quot;2&quot;&gt;Pin 2 (1IN-)&lt;/b&gt; to the common rail. Place a &lt;b data-index-in-node=&quot;130&quot; data-path-to-node=&quot;2&quot;&gt;15nF timing capacitor (C1)&lt;/b&gt; between &lt;b data-index-in-node=&quot;165&quot; data-path-to-node=&quot;2&quot;&gt;Pin 5 (CT)&lt;/b&gt; and Ground to set the switching frequency. Finally, add a &lt;b data-index-in-node=&quot;234&quot; data-path-to-node=&quot;2&quot;&gt;5k Variable Resistor (RV1)&lt;/b&gt; and a &lt;b data-index-in-node=&quot;267&quot; data-path-to-node=&quot;2&quot;&gt;1k resistor (R1)&lt;/b&gt; to &lt;b data-index-in-node=&quot;287&quot; data-path-to-node=&quot;2&quot;&gt;Pin 6 (RT)&lt;/b&gt;; this allows for fine-tuning the frequency specifically for the ferrite transformer.&lt;/span&gt;&lt;/p&gt;&lt;h4 style=&quot;text-align: left;&quot;&gt;&lt;b data-index-in-node=&quot;0&quot; data-path-to-node=&quot;4&quot;&gt;&lt;span style=&quot;font-family: inherit;&quot;&gt;Power and Ground Railing&lt;/span&gt;&lt;/b&gt;&lt;/h4&gt;&lt;p data-path-to-node=&quot;5&quot;&gt;&lt;span style=&quot;font-family: inherit;&quot;&gt;Connect the input connector &lt;b data-index-in-node=&quot;28&quot; data-path-to-node=&quot;5&quot;&gt;J1&lt;/b&gt; and bridge &lt;b data-index-in-node=&quot;42&quot; data-path-to-node=&quot;5&quot;&gt;Pin 7 (GND)&lt;/b&gt; to the negative rail. Ensure &lt;b data-index-in-node=&quot;83&quot; data-path-to-node=&quot;5&quot;&gt;Pin 12 (VCC)&lt;/b&gt; and &lt;b data-index-in-node=&quot;100&quot; data-path-to-node=&quot;5&quot;&gt;Pin 11 (C2)&lt;/b&gt; are tied to the &lt;b data-index-in-node=&quot;128&quot; data-path-to-node=&quot;5&quot;&gt;12V supply rail&lt;/b&gt;. For proper push-pull operation, connect &lt;b data-index-in-node=&quot;185&quot; data-path-to-node=&quot;5&quot;&gt;Pin 13 (OCTRL)&lt;/b&gt; directly to &lt;b data-index-in-node=&quot;212&quot; data-path-to-node=&quot;5&quot;&gt;Pin 14 (REF)&lt;/b&gt;.&lt;/span&gt;&lt;/p&gt;&lt;h4 style=&quot;text-align: left;&quot;&gt;&lt;b data-index-in-node=&quot;0&quot; data-path-to-node=&quot;7&quot;&gt;&lt;span style=&quot;font-family: inherit;&quot;&gt;Driver Stage with BC327&lt;/span&gt;&lt;/b&gt;&lt;/h4&gt;&lt;p data-path-to-node=&quot;8&quot;&gt;&lt;span style=&quot;font-family: inherit;&quot;&gt;Place two &lt;b data-index-in-node=&quot;10&quot; data-path-to-node=&quot;8&quot;&gt;1k pull-down resistors (R2, R3)&lt;/b&gt; on the output lines from &lt;b data-index-in-node=&quot;67&quot; data-path-to-node=&quot;8&quot;&gt;Pins 9 and 10&lt;/b&gt;. Add two &lt;b data-index-in-node=&quot;90&quot; data-path-to-node=&quot;8&quot;&gt;BC327 PNP transistors (Q1, Q2)&lt;/b&gt; and two &lt;b data-index-in-node=&quot;129&quot; data-path-to-node=&quot;8&quot;&gt;1N4148 diodes (D1, D2)&lt;/b&gt; to act as the gate drivers. The emitters of these transistors will drive the MOSFET gates through &lt;b data-index-in-node=&quot;250&quot; data-path-to-node=&quot;8&quot;&gt;47-ohm resistors (R4, R5)&lt;/b&gt;.&lt;/span&gt;&lt;/p&gt;&lt;h4 style=&quot;text-align: left;&quot;&gt;&lt;b data-index-in-node=&quot;0&quot; data-path-to-node=&quot;10&quot;&gt;&lt;span style=&quot;font-family: inherit;&quot;&gt;MOSFET Power Bank&lt;/span&gt;&lt;/b&gt;&lt;/h4&gt;&lt;p data-path-to-node=&quot;11&quot;&gt;&lt;span style=&quot;font-family: inherit;&quot;&gt;Add the power MOSFETs using four &lt;b data-index-in-node=&quot;33&quot; data-path-to-node=&quot;11&quot;&gt;IRFZ44N&lt;/b&gt; units (&lt;b data-index-in-node=&quot;48&quot; data-path-to-node=&quot;11&quot;&gt;Q3, Q4, Q5, Q6&lt;/b&gt;) arranged in two parallel pairs. Each MOSFET gate must have its own &lt;b data-index-in-node=&quot;131&quot; data-path-to-node=&quot;11&quot;&gt;47-ohm resistor&lt;/b&gt; to ensure balanced switching and prevent overheating. Complete this stage by joining the sources of all MOSFETs to the common ground rail.&lt;/span&gt;&lt;/p&gt;&lt;h4 style=&quot;text-align: left;&quot;&gt;&lt;b data-index-in-node=&quot;0&quot; data-path-to-node=&quot;13&quot;&gt;&lt;span style=&quot;font-family: inherit;&quot;&gt;Final Transformer Assembly&lt;/span&gt;&lt;/b&gt;&lt;/h4&gt;&lt;p data-path-to-node=&quot;14&quot;&gt;&lt;span style=&quot;font-family: inherit;&quot;&gt;Place the &lt;b data-index-in-node=&quot;10&quot; data-path-to-node=&quot;14&quot;&gt;Step-Up Transformer (TR1)&lt;/b&gt;. The center tap of the primary winding connects directly to the &lt;b data-index-in-node=&quot;100&quot; data-path-to-node=&quot;14&quot;&gt;+12V DC input&lt;/b&gt;. Connect the drains of one MOSFET pair to one side of the primary, and the other pair to the opposite side. Finally, add a large &lt;b data-index-in-node=&quot;243&quot; data-path-to-node=&quot;14&quot;&gt;1000uF electrolytic capacitor (C2)&lt;/b&gt; across the power lines to filter out switching noise and stabilize the voltage.&lt;/span&gt;&lt;/p&gt;&lt;h3 style=&quot;text-align: left;&quot;&gt;🛠️ Components Used in This Design:&lt;/h3&gt;&lt;p data-path-to-node=&quot;14&quot;&gt;Battery&lt;span style=&quot;white-space: pre;&quot;&gt;	&lt;/span&gt;12V DC&amp;nbsp;&lt;/p&gt;&lt;p data-path-to-node=&quot;14&quot;&gt;Oscillator IC&lt;span style=&quot;white-space: pre;&quot;&gt;	&lt;/span&gt;TL494&amp;nbsp;&lt;/p&gt;&lt;p data-path-to-node=&quot;14&quot;&gt;MOSFETs&lt;span style=&quot;white-space: pre;&quot;&gt;	&lt;/span&gt;IRFZ44N (x4)&amp;nbsp;&lt;/p&gt;&lt;p data-path-to-node=&quot;14&quot;&gt;BJT&amp;nbsp; BC327(x2)&amp;nbsp;&lt;/p&gt;&lt;p data-path-to-node=&quot;14&quot;&gt;Transformer&lt;span style=&quot;white-space: pre;&quot;&gt;	&lt;/span&gt;High-Frequency Ferrite Core Transformer&amp;nbsp;&lt;/p&gt;&lt;p data-path-to-node=&quot;14&quot;&gt;Diodes&lt;span style=&quot;white-space: pre;&quot;&gt;	&lt;/span&gt;1N4148(x2)&amp;nbsp;&lt;/p&gt;&lt;p data-path-to-node=&quot;14&quot;&gt;Capacitors&lt;span style=&quot;white-space: pre;&quot;&gt;	&lt;/span&gt;1000µF, 15nF&amp;nbsp;&lt;/p&gt;&lt;p data-path-to-node=&quot;14&quot;&gt;Resistors&lt;span style=&quot;white-space: pre;&quot;&gt;	&lt;/span&gt;1k (2), 47Ω(x4)&lt;/p&gt;&lt;h3 style=&quot;text-align: left;&quot;&gt;&lt;b&gt;How to Design 12V DC to 220V AC Inverter Circuit Schematic in Proteus&lt;/b&gt;&lt;/h3&gt;&lt;p data-path-to-node=&quot;14&quot;&gt;The following video shows how to design the inverter circuit in Proteus&lt;/p&gt;&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;&lt;iframe allowfullscreen=&quot;&quot; class=&quot;BLOG_video_class&quot; height=&quot;453&quot; src=&quot;https://www.youtube.com/embed/ATFmOFDN4kQ&quot; width=&quot;544&quot; youtube-src-id=&quot;ATFmOFDN4kQ&quot;&gt;&lt;/iframe&gt;&lt;/div&gt;&lt;br /&gt;&lt;p data-path-to-node=&quot;14&quot;&gt;&lt;b&gt;Related resources&lt;/b&gt;:&lt;/p&gt;&lt;p data-path-to-node=&quot;14&quot;&gt;&lt;/p&gt;&lt;ul style=&quot;text-align: left;&quot;&gt;&lt;li&gt;&lt;a href=&quot;https://www.ee-diary.net/2026/04/how-to-build-pure-sine-wave-inverter.html&quot;&gt;How to Build a Pure Sine Wave Inverter using Arduino SPWM&lt;/a&gt;&lt;/li&gt;&lt;li&gt;&lt;a href=&quot;https://www.ee-diary.net/2025/07/cd4047-inverter-design-and-simulation.html&quot;&gt;CD4047 Inverter Design and Simulation&lt;/a&gt;&lt;/li&gt;&lt;li&gt;&lt;a href=&quot;https://www.ee-diary.net/2025/07/simple-inverter-with-arduino.html&quot;&gt;Simple Inverter with Arduino&lt;/a&gt;&lt;/li&gt;&lt;/ul&gt;&lt;p&gt;&lt;/p&gt;</content><link rel='replies' type='application/atom+xml' href='http://www.ee-diary.net/feeds/3973695414237599584/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.ee-diary.net/2026/04/how-to-design-12v-dc-to-220v-ac.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7437986969318338216/posts/default/3973695414237599584'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7437986969318338216/posts/default/3973695414237599584'/><link rel='alternate' type='text/html' href='http://www.ee-diary.net/2026/04/how-to-design-12v-dc-to-220v-ac.html' title='How to Design 12V DC to 220V AC Inverter Circuit '/><author><name>Unknown</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiBvmosYkHtHPaeg2-eJNfjfPwlAN-SEedeOj976N6sx9sgtQ6LFT0G9nbr9gxXRL1D64iTcn2X0P0J1xW2O19zxAxPG9chJ3ncr9lEKdsbSxxUTF3AdydgJ396MMNOotxbclIMqJVf3UOy6xitfPhRxTzeM2zx5NHww2dL7dQYd7C8MTjLpe7pplNaWdz-/s72-c/12V%20DC%20into%20220V%20AC%20%E2%80%93%20Design%20an%20Inverter%20Schematic%20in%20Proteus.png" height="72" width="72"/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-7437986969318338216.post-1571752933532588635</id><published>2026-04-17T17:11:00.006+05:45</published><updated>2026-04-17T17:11:56.137+05:45</updated><category scheme="http://www.blogger.com/atom/ns#" term="TL494 explorer"/><title type='text'>TL494 IC pinout explorer - Free interactive tool</title><content type='html'>
&lt;!--TL494 PWM Controller IC Explorer--&gt;
&lt;style&gt;
@import url(&#39;https://fonts.googleapis.com/css2?family=Share+Tech+Mono&amp;family=Orbitron:wght@700;900&amp;display=swap&#39;);
#tl494wrap{all:initial;display:block;position:relative;width:100%;box-sizing:border-box;font-family:&#39;Share Tech Mono&#39;,monospace;color:#d0d0d0;}
#tl494wrap *{box-sizing:border-box;margin:0;padding:0;}
.tl{width:100%;overflow:hidden;margin:0 auto;background:#161b22;border-radius:12px;padding:12px;border:1px solid #30363d;}
.tl-hdr{display:flex;align-items:center;justify-content:space-between;background:#1c2128;border:1px solid #30363d;border-radius:8px;padding:9px 14px;margin-bottom:10px;position:relative;overflow:hidden;}
.tl-hdr::before{content:&#39;&#39;;position:absolute;top:0;left:0;right:0;height:2px;background:linear-gradient(90deg,transparent,#4da6ff,#88ccff,#4da6ff,transparent);}
.tl-hdr-l{display:flex;align-items:center;gap:10px;}
.tl-logo{width:28px;height:28px;color:#4da6ff;}
.tl-title{font-family:&#39;Orbitron&#39;,sans-serif;font-size:19px;font-weight:900;color:#e6edf3;letter-spacing:.12em;display:block;}
.tl-sub{font-size:14px;color:#8b949e;margin-top:2px;display:block;}
.tl-badge{font-family:&#39;Orbitron&#39;,sans-serif;font-size:14px;font-weight:700;color:#4da6ff;background:rgba(77,166,255,0.1);border:1px solid rgba(77,166,255,0.3);border-radius:4px;padding:3px 8px;}
.tl-dot{width:7px;height:7px;border-radius:50%;background:#4da6ff;box-shadow:0 0 8px #4da6ff;animation:tlpulse 2s infinite;flex-shrink:0;}
@keyframes tlpulse{0%,100%{opacity:1;transform:scale(1);}50%{opacity:.3;transform:scale(.6);}}
.tl-mtabs{display:flex;border-bottom:1px solid #21262d;background:#0d1117;border-radius:8px 8px 0 0;overflow:hidden;}
.tl-mtab{flex:1;padding:12px 8px;font-size:14px;font-weight:700;cursor:pointer;color:#8b949e;border-bottom:2px solid transparent;text-align:center;font-family:&#39;Share Tech Mono&#39;,monospace;letter-spacing:.05em;transition:all .15s;white-space:nowrap;}
.tl-mtab:hover{color:#88ccff;background:rgba(77,166,255,0.05);}
.tl-mtab.on{color:#4da6ff;border-bottom-color:#4da6ff;background:rgba(77,166,255,0.08);}
.tl-body{display:flex;gap:10px;align-items:stretch;}
.tl-screen{flex:0 0 55%;width:55%;background:#0d1117;border:1px solid #21262d;border-radius:0 0 8px 8px;position:relative;overflow:hidden;min-height:420px;display:flex;align-items:center;justify-content:center;}
.tl-screen svg{width:100%;height:auto;display:block;}
.tl-canvas-wrap{width:100%;height:100%;display:none;flex-direction:column;}
.tl-canvas-wrap canvas{width:100%;flex:1;display:block;background:#0d1117;}
.tl-ds-wrap{width:100%;height:100%;display:none;overflow-y:auto;padding:14px;scrollbar-width:thin;scrollbar-color:#30363d transparent;}
.tl-lbl{position:absolute;bottom:6px;right:10px;font-size:11px;color:rgba(77,166,255,0.2);letter-spacing:.12em;text-transform:uppercase;pointer-events:none;}
.tl-ctrl{flex:1;min-width:0;display:flex;flex-direction:column;gap:8px;}
.tl-det{background:#1c2128;border:1px solid #30363d;border-radius:8px;overflow:hidden;}
.tl-empty{padding:22px 14px;text-align:center;}
.tl-arr{font-size:18px;display:block;margin-bottom:5px;animation:tlarg 1.8s infinite;}
@keyframes tlarg{0%,100%{opacity:.2;transform:translateX(-4px);}50%{opacity:.8;transform:translateX(4px);}}
.tl-empty p{font-size:14px;color:#8b949e;line-height:1.5;}
.tl-dc{display:none;}.tl-dc.show{display:block;}
.tl-dbar{display:flex;align-items:center;gap:9px;padding:8px 11px;border-bottom:1px solid #21262d;}
.tl-dbadge{width:50px;height:50px;border-radius:4px;display:flex;flex-direction:column;align-items:center;justify-content:center;font-size:14px;font-weight:700;flex-shrink:0;border:2px solid;gap:1px;}
.tl-dbnum{font-size:13px;opacity:.6;}
.tl-pid{font-family:&#39;Orbitron&#39;,sans-serif;font-size:18px;font-weight:900;color:#e6edf3;display:block;line-height:1;}
.tl-dfull{font-size:13px;color:#8b949e;margin-top:2px;display:block;}
.tl-funcs{display:flex;flex-wrap:wrap;gap:3px;padding:6px 11px;border-bottom:1px solid #21262d;}
.tl-chip{padding:2px 7px;border-radius:2px;font-size:13px;font-weight:700;border:1px solid;}
.tl-igrid{display:grid;grid-template-columns:1fr 1fr;}
.tl-icell{padding:5px 11px;border-bottom:1px solid #21262d;border-right:1px solid #21262d;}
.tl-icell:nth-child(2n){border-right:none;}.tl-icell:nth-last-child(-n+2){border-bottom:none;}
.tl-ilbl{font-size:12px;color:#8b949e;text-transform:uppercase;letter-spacing:.1em;margin-bottom:2px;display:block;}
.tl-ival{font-size:14px;color:#e6edf3;font-weight:700;display:block;word-break:break-word;}
.tl-alts{padding:6px 11px;border-top:1px solid #21262d;}
.tl-albl{font-size:12px;color:#8b949e;text-transform:uppercase;letter-spacing:.1em;margin-bottom:3px;display:block;}
.tl-achips{display:flex;flex-wrap:wrap;gap:3px;}
.tl-ac{padding:2px 7px;border-radius:2px;font-size:13px;background:#21262d;border:1px solid #30363d;color:#88ccff;}
.tl-note{padding:7px 11px;border-top:1px solid #21262d;font-size:13px;color:#6a9fb5;line-height:1.5;}
.tl-filt{background:#1c2128;border:1px solid #30363d;border-radius:8px;overflow:hidden;padding:7px 7px 0;}
.tl-fpbox{border:1px solid #4da6ff;border-radius:4px;padding:6px;background:#0d1117;margin-bottom:6px;}
.tl-fplbl{font-size:13px;color:#4da6ff;letter-spacing:.1em;text-transform:uppercase;margin-bottom:6px;display:block;font-weight:700;}
.tl-fbtns{display:grid;grid-template-columns:repeat(5,1fr);gap:3px;}
.tl-fb{display:flex;align-items:center;justify-content:center;height:26px;border-radius:2px;font-size:12px;font-weight:700;letter-spacing:.04em;font-family:&#39;Share Tech Mono&#39;,monospace;cursor:pointer;border:1px solid rgba(255,255,255,0.12);background:#1c2128;transition:all .1s;color:#8b949e;}
.tl-fb:hover{filter:brightness(1.4);}
.tl-fb.on{border-color:currentColor!important;box-shadow:0 0 5px currentColor;transform:translateY(1px);}
.tl-ltog{display:flex;align-items:center;justify-content:space-between;padding:6px 10px;cursor:pointer;background:#161b22;border-top:1px solid #21262d;}
.tl-ltog:hover{background:#1c2128;}
.tl-ltog span{font-size:13px;color:#8b949e;}.tl-ltog b{color:#4da6ff;}
.tl-plist{max-height:0;overflow:hidden;transition:max-height .4s ease;}
.tl-plist.open{max-height:380px;overflow-y:auto;scrollbar-width:thin;scrollbar-color:#30363d transparent;}
.tl-prow{display:flex;align-items:center;gap:5px;padding:5px 7px;cursor:pointer;border-bottom:1px solid rgba(48,54,61,.4);}
.tl-prow:hover{background:#1c2128;}.tl-prow.on{background:rgba(77,166,255,.07);border-left:2px solid #4da6ff;padding-left:5px;}
.tl-pbadge{min-width:45px;height:24px;border-radius:3px;display:flex;align-items:center;justify-content:center;font-size:11px;font-weight:700;flex-shrink:0;}
.tl-pname{font-size:11px;flex:1;color:#8b949e;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;}
.tl-ptag{padding:1px 5px;border-radius:2px;font-size:10px;font-weight:700;}
.tl-leg{display:flex;flex-wrap:wrap;gap:6px;padding:6px 8px;border-top:1px solid #21262d;}
.tl-li{display:flex;align-items:center;gap:4px;font-size:11px;color:#8b949e;}
.tl-ld{width:8px;height:8px;border-radius:2px;flex-shrink:0;}
.tl-ctrl-hdr{background:#1c2128;border:1px solid #30363d;border-radius:8px;padding:8px 12px;font-size:13px;color:#4da6ff;letter-spacing:.1em;text-transform:uppercase;font-weight:700;}
.tl-stabs{display:flex;flex-wrap:wrap;gap:4px;background:#0d1117;border:1px solid #21262d;border-radius:6px;padding:5px;}
.tl-stab{flex:1;min-width:70px;padding:5px 4px;font-size:12px;font-weight:700;cursor:pointer;color:#8b949e;border-radius:3px;text-align:center;font-family:&#39;Share Tech Mono&#39;,monospace;border:1px solid transparent;transition:all .12s;}
.tl-stab:hover{color:#88ccff;background:rgba(77,166,255,0.06);}
.tl-stab.on{color:#4da6ff;background:rgba(77,166,255,0.10);border-color:rgba(77,166,255,0.3);}
.tl-actions{background:#1c2128;border:1px solid #30363d;border-radius:8px;padding:10px 12px;display:flex;flex-direction:column;gap:8px;}
.tl-act-title{font-size:12px;color:#4da6ff;letter-spacing:.1em;text-transform:uppercase;font-weight:700;display:block;margin-bottom:4px;}
.tl-btn-row{display:flex;gap:6px;}
.tl-btn{flex:1;padding:7px 6px;border-radius:4px;font-size:12px;font-weight:700;cursor:pointer;font-family:&#39;Share Tech Mono&#39;,monospace;border:none;transition:all .12s;text-align:center;letter-spacing:.04em;}
.tl-btn-blue{background:rgba(77,166,255,.15);color:#4da6ff;border:1px solid rgba(77,166,255,.3);}
.tl-btn-green{background:rgba(80,200,160,.15);color:#50c8a0;border:1px solid rgba(80,200,160,.3);}
.tl-tt{position:absolute;background:#1c2128;border:1px solid #30363d;border-radius:6px;padding:8px 12px;font-size:12px;pointer-events:none;z-index:9999;display:none;min-width:200px;max-width:280px;box-shadow:0 6px 20px rgba(0,0,0,.5);}
.tl-tt.show{display:block;}
.tl-tn{font-family:&#39;Orbitron&#39;,sans-serif;font-size:13px;font-weight:900;display:block;margin-bottom:3px;}
.tl-td{color:#8b949e;font-size:12px;display:block;}
.tl494-pin .psq{transition:filter .12s,stroke-width .12s;}
.tl-prog{height:4px;background:#21262d;border-radius:2px;overflow:hidden;margin-top:8px;}
.tl-prog-bar{height:100%;background:#4da6ff;width:0%;transition:width .3s;}
@media(max-width:720px){.tl-body{flex-direction:column;}.tl-screen{flex:none;width:100%;min-height:300px;}.tl-ctrl{flex:none;width:100%;}}
&lt;/style&gt;

&lt;div id=&quot;tl494wrap&quot;&gt;
&lt;div class=&quot;tl&quot;&gt;

  &lt;!--HEADER--&gt;
  &lt;div class=&quot;tl-hdr&quot;&gt;
    &lt;div class=&quot;tl-hdr-l&quot;&gt;
      &lt;svg class=&quot;tl-logo&quot; viewbox=&quot;0 0 100 100&quot;&gt;
        &lt;rect fill=&quot;none&quot; height=&quot;64&quot; rx=&quot;8&quot; stroke-width=&quot;5&quot; stroke=&quot;currentColor&quot; width=&quot;64&quot; x=&quot;18&quot; y=&quot;18&quot;&gt;
        &lt;rect fill=&quot;currentColor&quot; height=&quot;40&quot; opacity=&quot;0.12&quot; rx=&quot;4&quot; width=&quot;40&quot; x=&quot;30&quot; y=&quot;30&quot;&gt;
        &lt;path d=&quot;M50 30 L50 45 M50 55 L50 70 M35 40 L45 45 M65 40 L55 45 M35 60 L45 55 M65 60 L55 55&quot; fill=&quot;none&quot; stroke-width=&quot;2&quot; stroke=&quot;currentColor&quot;&gt;
        &lt;circle cx=&quot;50&quot; cy=&quot;50&quot; fill=&quot;none&quot; r=&quot;8&quot; stroke-width=&quot;2&quot; stroke=&quot;currentColor&quot;&gt;
        &lt;line stroke-linecap=&quot;round&quot; stroke-width=&quot;3&quot; stroke=&quot;currentColor&quot; x1=&quot;18&quot; x2=&quot;4&quot; y1=&quot;25&quot; y2=&quot;25&quot;&gt;
        &lt;line stroke-linecap=&quot;round&quot; stroke-width=&quot;3&quot; stroke=&quot;currentColor&quot; x1=&quot;18&quot; x2=&quot;4&quot; y1=&quot;40&quot; y2=&quot;40&quot;&gt;
        &lt;line stroke-linecap=&quot;round&quot; stroke-width=&quot;3&quot; stroke=&quot;currentColor&quot; x1=&quot;18&quot; x2=&quot;4&quot; y1=&quot;55&quot; y2=&quot;55&quot;&gt;
        &lt;line stroke-linecap=&quot;round&quot; stroke-width=&quot;3&quot; stroke=&quot;currentColor&quot; x1=&quot;18&quot; x2=&quot;4&quot; y1=&quot;70&quot; y2=&quot;70&quot;&gt;
        &lt;line stroke-linecap=&quot;round&quot; stroke-width=&quot;3&quot; stroke=&quot;currentColor&quot; x1=&quot;82&quot; x2=&quot;96&quot; y1=&quot;30&quot; y2=&quot;30&quot;&gt;
        &lt;line stroke-linecap=&quot;round&quot; stroke-width=&quot;3&quot; stroke=&quot;currentColor&quot; x1=&quot;82&quot; x2=&quot;96&quot; y1=&quot;45&quot; y2=&quot;45&quot;&gt;
        &lt;line stroke-linecap=&quot;round&quot; stroke-width=&quot;3&quot; stroke=&quot;currentColor&quot; x1=&quot;82&quot; x2=&quot;96&quot; y1=&quot;60&quot; y2=&quot;60&quot;&gt;
        &lt;line stroke-linecap=&quot;round&quot; stroke-width=&quot;3&quot; stroke=&quot;currentColor&quot; x1=&quot;82&quot; x2=&quot;96&quot; y1=&quot;75&quot; y2=&quot;75&quot;&gt;
      &lt;/line&gt;&lt;/line&gt;&lt;/line&gt;&lt;/line&gt;&lt;/line&gt;&lt;/line&gt;&lt;/line&gt;&lt;/line&gt;&lt;/circle&gt;&lt;/path&gt;&lt;/rect&gt;&lt;/rect&gt;&lt;/svg&gt;
      &lt;div&gt;
        &lt;span class=&quot;tl-title&quot;&gt;TL494 PWM&lt;/span&gt;
        &lt;span class=&quot;tl-sub&quot;&gt;PWM Controller IC &amp;nbsp;●&amp;nbsp; DIP-16 &amp;nbsp;●&amp;nbsp; 16 pins&lt;/span&gt;
      &lt;/div&gt;
    &lt;/div&gt;
    &lt;div style=&quot;align-items: center; display: flex; gap: 8px;&quot;&gt;
      &lt;span class=&quot;tl-badge&quot;&gt;DIP-16&lt;/span&gt;
      &lt;div class=&quot;tl-dot&quot;&gt;&lt;/div&gt;
    &lt;/div&gt;
  &lt;/div&gt;

  &lt;!--MAIN 3 TABS--&gt;
  &lt;div class=&quot;tl-mtabs&quot; id=&quot;tlTabs&quot;&gt;
    &lt;div class=&quot;tl-mtab on&quot; data-mt=&quot;pin&quot;&gt;○ PIN EXPLORER&lt;/div&gt;
    &lt;div class=&quot;tl-mtab&quot; data-mt=&quot;design&quot;&gt;□ DESIGN FILES&lt;/div&gt;
    &lt;div class=&quot;tl-mtab&quot; data-mt=&quot;ds&quot;&gt;☍ DATASHEET&lt;/div&gt;
  &lt;/div&gt;

  &lt;!--BODY--&gt;
  &lt;div class=&quot;tl-body&quot;&gt;

    &lt;!--LEFT: SVG chip display--&gt;
    &lt;div class=&quot;tl-screen&quot; id=&quot;tlScreen&quot;&gt;
      &lt;span class=&quot;tl-lbl&quot; id=&quot;tlLbl&quot;&gt;TL494 PWM CONTROLLER&lt;/span&gt;
      &lt;svg id=&quot;tlSVG&quot; style=&quot;display: block; height: auto; overflow: visible; width: 100%;&quot; viewbox=&quot;0 0 220 180&quot; xmlns=&quot;http://www.w3.org/2000/svg&quot;&gt;&lt;/svg&gt;
      &lt;div class=&quot;tl-canvas-wrap&quot; id=&quot;tlCanvas&quot;&gt;
        &lt;canvas id=&quot;tlCVS&quot; style=&quot;background: #0d1117; display: block; width: 100%;&quot;&gt;&lt;/canvas&gt;
      &lt;/div&gt;
      &lt;div class=&quot;tl-ds-wrap&quot; id=&quot;tlDS&quot;&gt;
        &lt;div id=&quot;tlDSContent&quot; style=&quot;color: #8b949e; font-size: 13px; line-height: 1.7;&quot;&gt;&lt;/div&gt;
      &lt;/div&gt;
    &lt;/div&gt;

    &lt;!--RIGHT: controls--&gt;
    &lt;div class=&quot;tl-ctrl&quot; id=&quot;tlCtrl&quot;&gt;

      &lt;!--PIN EXPLORER panel--&gt;
      &lt;div id=&quot;ctrl-pin&quot; style=&quot;display: flex; flex-direction: column; gap: 8px;&quot;&gt;
        &lt;div class=&quot;tl-det&quot;&gt;
          &lt;div class=&quot;tl-empty&quot; id=&quot;tlEmpty&quot;&gt;
            &lt;span class=&quot;tl-arr&quot;&gt;←&lt;/span&gt;
            &lt;p&gt;Click any pin on the IC&lt;br /&gt;to see full specifications&lt;/p&gt;
          &lt;/div&gt;
          &lt;div class=&quot;tl-dc&quot; id=&quot;tlDC&quot;&gt;
            &lt;div class=&quot;tl-dbar&quot;&gt;
              &lt;div class=&quot;tl-dbadge&quot; id=&quot;tlBadge&quot;&gt;&lt;/div&gt;
              &lt;div&gt;&lt;span class=&quot;tl-pid&quot; id=&quot;tlPID&quot;&gt;&lt;/span&gt;&lt;span class=&quot;tl-dfull&quot; id=&quot;tlFull&quot;&gt;&lt;/span&gt;&lt;/div&gt;
            &lt;/div&gt;
            &lt;div class=&quot;tl-funcs&quot; id=&quot;tlFuncs&quot;&gt;&lt;/div&gt;
            &lt;div class=&quot;tl-igrid&quot; id=&quot;tlGrid&quot;&gt;&lt;/div&gt;
            &lt;div class=&quot;tl-alts&quot; id=&quot;tlAlts&quot; style=&quot;display: none;&quot;&gt;
              &lt;span class=&quot;tl-albl&quot;&gt;Associated Functions&lt;/span&gt;
              &lt;div class=&quot;tl-achips&quot; id=&quot;tlAChips&quot;&gt;&lt;/div&gt;
            &lt;/div&gt;
            &lt;div class=&quot;tl-note&quot; id=&quot;tlNote&quot;&gt;&lt;/div&gt;
          &lt;/div&gt;
        &lt;/div&gt;
        &lt;div class=&quot;tl-filt&quot;&gt;
          &lt;div class=&quot;tl-fpbox&quot;&gt;
            &lt;span class=&quot;tl-fplbl&quot;&gt;◆ Highlight by Function&lt;/span&gt;
            &lt;div class=&quot;tl-fbtns&quot; id=&quot;tlFBtns&quot;&gt;&lt;/div&gt;
          &lt;/div&gt;
          &lt;div class=&quot;tl-ltog&quot; onclick=&quot;tlTogList()&quot;&gt;
            &lt;span&gt;PIN LIST &amp;nbsp;&lt;b id=&quot;tlCnt&quot;&gt;&lt;/b&gt;&lt;/span&gt;
            &lt;span id=&quot;tlTIcon&quot; style=&quot;color: #4da6ff;&quot;&gt;▼ SHOW&lt;/span&gt;
          &lt;/div&gt;
          &lt;div class=&quot;tl-plist&quot; id=&quot;tlPList&quot;&gt;&lt;div id=&quot;tlRows&quot;&gt;&lt;/div&gt;&lt;/div&gt;
          &lt;div class=&quot;tl-leg&quot; id=&quot;tlLeg&quot;&gt;&lt;/div&gt;
        &lt;/div&gt;
      &lt;/div&gt;

      &lt;!--DESIGN FILES panel--&gt;
      &lt;div id=&quot;ctrl-design&quot; style=&quot;display: none; flex-direction: column; gap: 8px;&quot;&gt;
        &lt;div class=&quot;tl-ctrl-hdr&quot;&gt;Design Files — TL494 PWM Controller&lt;/div&gt;
        &lt;div class=&quot;tl-stabs&quot; id=&quot;tlStabs&quot;&gt;
          &lt;div class=&quot;tl-stab on&quot; data-st=&quot;schematic&quot;&gt;SCHEMATIC&lt;/div&gt;
          &lt;div class=&quot;tl-stab&quot; data-st=&quot;symbol&quot;&gt;SYMBOL&lt;/div&gt;
          &lt;div class=&quot;tl-stab&quot; data-st=&quot;footprint&quot;&gt;FOOTPRINT&lt;/div&gt;
        &lt;/div&gt;
        &lt;div class=&quot;tl-actions&quot;&gt;
          &lt;span class=&quot;tl-act-title&quot;&gt;PWM Calculator &amp;amp; Resources&lt;/span&gt;
          &lt;div class=&quot;tl-btn-row&quot;&gt;
            &lt;button class=&quot;tl-btn tl-btn-blue&quot; onclick=&quot;window.open(&#39;https://www.daycounter.com/Calculators/TL494/TL494-Calculator.phtml&#39;,&#39;_blank&#39;)&quot;&gt;↗ PWM Calculator&lt;/button&gt;
            &lt;button class=&quot;tl-btn tl-btn-blue&quot; onclick=&quot;window.open(&#39;https://www.ti.com/product/TL494&#39;,&#39;_blank&#39;)&quot;&gt;↗ TI Product Page&lt;/button&gt;
          &lt;/div&gt;
        &lt;/div&gt;
        &lt;div class=&quot;tl-actions&quot;&gt;
          &lt;span class=&quot;tl-act-title&quot;&gt;Quick Specs — TL494&lt;/span&gt;
          &lt;div style=&quot;color: #8b949e; font-size: 13px; line-height: 1.9;&quot;&gt;
            &lt;div style=&quot;border-bottom: 1px solid rgb(33, 38, 45); display: flex; justify-content: space-between; padding: 2px 0px;&quot;&gt;&lt;span&gt;Supply Voltage&lt;/span&gt;&lt;span style=&quot;color: #4da6ff; font-weight: 700;&quot;&gt;7V – 40V&lt;/span&gt;&lt;/div&gt;
            &lt;div style=&quot;border-bottom: 1px solid rgb(33, 38, 45); display: flex; justify-content: space-between; padding: 2px 0px;&quot;&gt;&lt;span&gt;Supply Current&lt;/span&gt;&lt;span style=&quot;color: #e0e5ec; font-weight: 700;&quot;&gt;7 mA typical&lt;/span&gt;&lt;/div&gt;
            &lt;div style=&quot;border-bottom: 1px solid rgb(33, 38, 45); display: flex; justify-content: space-between; padding: 2px 0px;&quot;&gt;&lt;span&gt;Output Current&lt;/span&gt;&lt;span style=&quot;color: #e0e5ec; font-weight: 700;&quot;&gt;200 mA per output&lt;/span&gt;&lt;/div&gt;
            &lt;div style=&quot;border-bottom: 1px solid rgb(33, 38, 45); display: flex; justify-content: space-between; padding: 2px 0px;&quot;&gt;&lt;span&gt;Max Frequency&lt;/span&gt;&lt;span style=&quot;color: #50c8a0; font-weight: 700;&quot;&gt;300 kHz&lt;/span&gt;&lt;/div&gt;
            &lt;div style=&quot;border-bottom: 1px solid rgb(33, 38, 45); display: flex; justify-content: space-between; padding: 2px 0px;&quot;&gt;&lt;span&gt;Dead-Time Control&lt;/span&gt;&lt;span style=&quot;color: #ffaa88; font-weight: 700;&quot;&gt;0% to 100% adjustable&lt;/span&gt;&lt;/div&gt;
            &lt;div style=&quot;border-bottom: 1px solid rgb(33, 38, 45); display: flex; justify-content: space-between; padding: 2px 0px;&quot;&gt;&lt;span&gt;Error Amplifiers&lt;/span&gt;&lt;span style=&quot;color: #e0e5ec; font-weight: 700;&quot;&gt;2x (voltage/current feedback)&lt;/span&gt;&lt;/div&gt;
            &lt;div style=&quot;display: flex; justify-content: space-between; padding: 2px 0px;&quot;&gt;&lt;span&gt;Package&lt;/span&gt;&lt;span style=&quot;color: #e0e5ec; font-weight: 700;&quot;&gt;DIP-16, SOIC-16&lt;/span&gt;&lt;/div&gt;
          &lt;/div&gt;
        &lt;/div&gt;
      &lt;/div&gt;

      &lt;!--DATASHEET panel with PDF upload--&gt;
      &lt;div id=&quot;ctrl-ds&quot; style=&quot;display: none; flex-direction: column; gap: 8px;&quot;&gt;
        
        &lt;!--PDF Upload Section--&gt;
        &lt;div class=&quot;tl-actions&quot;&gt;
          &lt;span class=&quot;tl-act-title&quot;&gt;📄 Upload Datasheet PDF&lt;/span&gt;
          &lt;div style=&quot;color: #8b949e; font-size: 13px; margin-bottom: 8px;&quot;&gt;
            TL494 PWM Controller Datasheet (.pdf) — Extracts key specifications
          &lt;/div&gt;
          &lt;input accept=&quot;.pdf&quot; id=&quot;tlPdfInput&quot; style=&quot;display: none;&quot; type=&quot;file&quot; /&gt;
          &lt;button class=&quot;tl-btn tl-btn-blue&quot; onclick=&quot;document.getElementById(&#39;tlPdfInput&#39;).click()&quot;&gt;
            📁 CHOOSE PDF FILE
          &lt;/button&gt;
          &lt;div id=&quot;tlFileInfo&quot; style=&quot;color: #8b949e; font-size: 12px; margin-top: 6px;&quot;&gt;
            No file selected
          &lt;/div&gt;
          &lt;div id=&quot;tlProgress&quot; style=&quot;display: none;&quot;&gt;
            &lt;div class=&quot;tl-prog&quot;&gt;
              &lt;div class=&quot;tl-prog-bar&quot; id=&quot;tlProgBar&quot;&gt;&lt;/div&gt;
            &lt;/div&gt;
          &lt;/div&gt;
          &lt;div id=&quot;tlExtractStatus&quot; style=&quot;color: #50c8a0; display: none; font-size: 12px; margin-top: 5px;&quot;&gt;&lt;/div&gt;
        &lt;/div&gt;

        &lt;!--Extracted Specifications--&gt;
        &lt;div class=&quot;tl-actions&quot; id=&quot;tlExtractedSpecs&quot; style=&quot;display: none;&quot;&gt;
          &lt;span class=&quot;tl-act-title&quot;&gt;🔍 Extracted Specifications&lt;/span&gt;
          &lt;div id=&quot;tlExtractedContent&quot; style=&quot;color: #8b949e; font-size: 13px; line-height: 1.8;&quot;&gt;&lt;/div&gt;
        &lt;/div&gt;

        &lt;!--Quick Reference--&gt;
        &lt;div class=&quot;tl-actions&quot;&gt;
          &lt;span class=&quot;tl-act-title&quot;&gt;📚 Quick Reference — TL494&lt;/span&gt;
          &lt;div id=&quot;tlDsQuick&quot;&gt;&lt;/div&gt;
        &lt;/div&gt;

        &lt;!--Resources--&gt;
        &lt;div class=&quot;tl-actions&quot;&gt;
          &lt;span class=&quot;tl-act-title&quot;&gt;🌐 Resources&lt;/span&gt;
          &lt;div class=&quot;tl-btn-row&quot;&gt;
            &lt;button class=&quot;tl-btn tl-btn-blue&quot; onclick=&quot;window.open(&#39;https://www.ti.com/lit/ds/symlink/tl494.pdf&#39;,&#39;_blank&#39;)&quot;&gt;↗ Official TI PDF&lt;/button&gt;
            &lt;button class=&quot;tl-btn tl-btn-green&quot; id=&quot;tlLoadSample&quot;&gt;▶ Load Sample Datasheet&lt;/button&gt;
          &lt;/div&gt;
        &lt;/div&gt;
      &lt;/div&gt;

    &lt;/div&gt;&lt;!--/tl-ctrl--&gt;
  &lt;/div&gt;&lt;!--/tl-body--&gt;

&lt;/div&gt;&lt;!--/tl--&gt;
&lt;/div&gt;&lt;!--/tl494wrap--&gt;

&lt;div class=&quot;tl-tt&quot; id=&quot;tlTT&quot;&gt;&lt;/div&gt;

&lt;script src=&quot;https://cdnjs.cloudflare.com/ajax/libs/pdf.js/2.16.105/pdf.min.js&quot;&gt;&lt;/script&gt;
&lt;script&gt;
(function(){
&#39;use strict&#39;;

var NS = &#39;http://www.w3.org/2000/svg&#39;;
var svg = document.getElementById(&#39;tlSVG&#39;);
function mk(t, a) {
  var e = document.createElementNS(NS, t);
  for (var k in a) e.setAttribute(k, a[k]);
  return e;
}
function ap(p, c) { p.appendChild(c); return c; }

// ── Color map for TL494 ──
var C = {
  PWR:   {c:&#39;#ff6b6b&#39;, bg:&#39;rgba(255,107,107,.14)&#39;, bd:&#39;rgba(255,107,107,.35)&#39;},
  GND:   {c:&#39;#a8a8a8&#39;, bg:&#39;rgba(168,168,168,.11)&#39;, bd:&#39;rgba(168,168,168,.28)&#39;},
  OSC:   {c:&#39;#50c8a0&#39;, bg:&#39;rgba(80,200,160,.12)&#39;,  bd:&#39;rgba(80,200,160,.30)&#39;},
  PWM:   {c:&#39;#ffaa44&#39;, bg:&#39;rgba(255,170,68,.14)&#39;,  bd:&#39;rgba(255,170,68,.35)&#39;},
  OUTPUT: {c:&#39;#4da6ff&#39;, bg:&#39;rgba(77,166,255,.12)&#39;,  bd:&#39;rgba(77,166,255,.30)&#39;},
  FEEDBACK: {c:&#39;#c8a850&#39;, bg:&#39;rgba(200,168,80,.12)&#39;,  bd:&#39;rgba(200,168,80,.30)&#39;},
  COMP:  {c:&#39;#50c8c8&#39;, bg:&#39;rgba(80,200,200,.10)&#39;,  bd:&#39;rgba(80,200,200,.27)&#39;},
  REF:   {c:&#39;#ff6b6b&#39;, bg:&#39;rgba(255,107,107,.12)&#39;, bd:&#39;rgba(255,107,107,.30)&#39;},
  DEAD:  {c:&#39;#7090a8&#39;, bg:&#39;rgba(112,144,168,.11)&#39;, bd:&#39;rgba(112,144,168,.28)&#39;},
};

function cl(t) { return C[t] || C.PWM; }

// ── Dimensions for 16-pin DIP ──
var BX=70, BY=25, BW=80, BH=130;
var PL=12, PW2=7, PITCH=BH/8;

// ── Defs ──
var defs = ap(svg, mk(&#39;defs&#39;, {}));
var gf = mk(&#39;filter&#39;, {id:&#39;tlGlow&#39;, x:&#39;-80%&#39;, y:&#39;-80%&#39;, width:&#39;260%&#39;, height:&#39;260%&#39;});
ap(gf, mk(&#39;feGaussianBlur&#39;, {stdDeviation:&#39;3&#39;, result:&#39;b&#39;}));
var fm = mk(&#39;feMerge&#39;, {});
ap(fm, mk(&#39;feMergeNode&#39;, {in:&#39;b&#39;}));
ap(fm, mk(&#39;feMergeNode&#39;, {in:&#39;SourceGraphic&#39;}));
gf.appendChild(fm);
defs.appendChild(gf);
var icg = mk(&#39;linearGradient&#39;, {id:&#39;tlBody&#39;, x1:&#39;0%&#39;, y1:&#39;0%&#39;, x2:&#39;100%&#39;, y2:&#39;100%&#39;});
ap(icg, mk(&#39;stop&#39;, {offset:&#39;0%&#39;, &#39;stop-color&#39;:&#39;#1e2430&#39;}));
ap(icg, mk(&#39;stop&#39;, {offset:&#39;100%&#39;, &#39;stop-color&#39;:&#39;#0d1018&#39;}));
defs.appendChild(icg);

// ── IC body ──
ap(svg, mk(&#39;rect&#39;, {x:BX, y:BY, width:BW, height:BH, rx:&#39;4&#39;, fill:&#39;url(#tlBody)&#39;, stroke:&#39;#2a3545&#39;, &#39;stroke-width&#39;:&#39;1.5&#39;}));
// Pin-1 notch
ap(svg, mk(&#39;circle&#39;, {cx:BX+8, cy:BY+8, r:&#39;3.5&#39;, fill:&#39;#4da6ff&#39;, stroke:&#39;#4da6ff&#39;, &#39;stroke-width&#39;:&#39;1&#39;, opacity:&#39;0.8&#39;}));
ap(svg, mk(&#39;circle&#39;, {cx:BX+8, cy:BY+8, r:&#39;1.5&#39;, fill:&#39;#4da6ff&#39;, opacity:&#39;0.9&#39;}));
// Body text
var CX = BX+BW/2, CY = BY+BH/2;
var t1 = mk(&#39;text&#39;, {x:CX, y:CY-15, fill:&#39;#3a4a5a&#39;, &#39;font-family&#39;:&#39;monospace&#39;, &#39;font-size&#39;:&#39;9&#39;, &#39;font-weight&#39;:&#39;bold&#39;, &#39;text-anchor&#39;:&#39;middle&#39;});
t1.textContent = &#39;PWM CONTROLLER&#39;; ap(svg, t1);
var t2 = mk(&#39;text&#39;, {x:CX, y:CY+2, fill:&#39;#4da6ff&#39;, &#39;font-family&#39;:&#39;monospace&#39;, &#39;font-size&#39;:&#39;11&#39;, &#39;font-weight&#39;:&#39;bold&#39;, &#39;text-anchor&#39;:&#39;middle&#39;});
t2.textContent = &#39;TL494&#39;; ap(svg, t2);
var t3 = mk(&#39;text&#39;, {x:CX, y:CY+14, fill:&#39;#2a3a48&#39;, &#39;font-family&#39;:&#39;monospace&#39;, &#39;font-size&#39;:&#39;7&#39;, &#39;text-anchor&#39;:&#39;middle&#39;});
t3.textContent = &#39;DIP-16  PWM&#39;; ap(svg, t3);

// ── Pin data for TL494 (16 pins) ──
var ALT = {
  &#39;1IN+&#39;: [&#39;Non-inverting input of Error Amp 1&#39;],
  &#39;1IN-&#39;: [&#39;Inverting input of Error Amp 1&#39;],
  &#39;FEEDBACK&#39;: [&#39;Feedback input for PWM control&#39;],
  &#39;DTC&#39;: [&#39;Dead-Time Control input (0-3.3V)&#39;],
  &#39;CT&#39;: [&#39;Timing capacitor (determines frequency)&#39;],
  &#39;RT&#39;: [&#39;Timing resistor (determines frequency)&#39;],
  &#39;GND&#39;: [&#39;Ground reference&#39;],
  &#39;C1&#39;: [&#39;Collector of Output Transistor 1&#39;],
  &#39;E1&#39;: [&#39;Emitter of Output Transistor 1&#39;],
  &#39;E2&#39;: [&#39;Emitter of Output Transistor 2&#39;],
  &#39;C2&#39;: [&#39;Collector of Output Transistor 2&#39;],
  &#39;VCC&#39;: [&#39;Supply voltage (7V to 40V)&#39;],
  &#39;OUTPUT_CTRL&#39;: [&#39;Output control (push-pull or parallel)&#39;],
  &#39;REF&#39;: [&#39;5V reference output&#39;],
  &#39;2IN-&#39;: [&#39;Inverting input of Error Amp 2&#39;],
  &#39;2IN+&#39;: [&#39;Non-inverting input of Error Amp 2&#39;]
};

var PINS = [
  {num:1, id:&#39;1IN+&#39;, lbl:&#39;1IN+&#39;, name:&#39;Error Amp 1 Non-Inverting Input&#39;, type:&#39;COMP&#39;, funcs:[&#39;COMPARATOR&#39;,&#39;INPUT&#39;], volt:&#39;-0.3 to VCC&#39;, curr:&#39;&lt; 1µA&#39;, note:&#39;Non-inverting input of first error amplifier. Used for voltage regulation feedback.&#39;},
  {num:2, id:&#39;1IN-&#39;, lbl:&#39;1IN-&#39;, name:&#39;Error Amp 1 Inverting Input&#39;, type:&#39;COMP&#39;, funcs:[&#39;COMPARATOR&#39;,&#39;INPUT&#39;], volt:&#39;-0.3 to VCC&#39;, curr:&#39;&lt; 1µA&#39;, note:&#39;Inverting input of first error amplifier. Typically connected to reference voltage.&#39;},
  {num:3, id:&#39;FEEDBACK&#39;, lbl:&#39;FB&#39;, name:&#39;Feedback Input&#39;, type:&#39;FEEDBACK&#39;, funcs:[&#39;FEEDBACK&#39;,&#39;PWM&#39;], volt:&#39;0-3.5V&#39;, curr:&#39;&lt; 1µA&#39;, note:&#39;Feedback input to PWM comparator. Connects to error amp outputs.&#39;},
  {num:4, id:&#39;DTC&#39;, lbl:&#39;DTC&#39;, name:&#39;Dead-Time Control&#39;, type:&#39;DEAD&#39;, funcs:[&#39;DEAD-TIME&#39;,&#39;CONTROL&#39;], volt:&#39;0-3.3V&#39;, curr:&#39;&lt; 1µA&#39;, note:&#39;Controls minimum off-time. 0V = 0% dead-time, 3V = 100% dead-time.&#39;},
  {num:5, id:&#39;CT&#39;, lbl:&#39;CT&#39;, name:&#39;Timing Capacitor&#39;, type:&#39;OSC&#39;, funcs:[&#39;OSCILLATOR&#39;,&#39;TIMING&#39;], volt:&#39;0-3V&#39;, curr:&#39;N/A&#39;, note:&#39;External capacitor sets oscillator frequency. f = 1.1/(RT × CT).&#39;},
  {num:6, id:&#39;RT&#39;, lbl:&#39;RT&#39;, name:&#39;Timing Resistor&#39;, type:&#39;OSC&#39;, funcs:[&#39;OSCILLATOR&#39;,&#39;TIMING&#39;], volt:&#39;0-3V&#39;, curr:&#39;N/A&#39;, note:&#39;External resistor sets oscillator frequency. Connect between pin 6 and ground.&#39;},
  {num:7, id:&#39;GND&#39;, lbl:&#39;GND&#39;, name:&#39;Ground&#39;, type:&#39;GND&#39;, funcs:[&#39;GND&#39;,&#39;POWER&#39;], volt:&#39;0V&#39;, curr:&#39;N/A&#39;, note:&#39;Common ground reference for all circuits.&#39;},
  {num:8, id:&#39;C1&#39;, lbl:&#39;C1&#39;, name:&#39;Collector Output 1&#39;, type:&#39;OUTPUT&#39;, funcs:[&#39;OUTPUT&#39;,&#39;PWM&#39;], volt:&#39;Up to 40V&#39;, curr:&#39;200mA max&#39;, note:&#39;Collector of output transistor 1. Open collector output.&#39;},
  {num:9, id:&#39;E1&#39;, lbl:&#39;E1&#39;, name:&#39;Emitter Output 1&#39;, type:&#39;OUTPUT&#39;, funcs:[&#39;OUTPUT&#39;,&#39;PWM&#39;], volt:&#39;0V to VCC&#39;, curr:&#39;200mA max&#39;, note:&#39;Emitter of output transistor 1. Usually connected to ground.&#39;},
  {num:10, id:&#39;E2&#39;, lbl:&#39;E2&#39;, name:&#39;Emitter Output 2&#39;, type:&#39;OUTPUT&#39;, funcs:[&#39;OUTPUT&#39;,&#39;PWM&#39;], volt:&#39;0V to VCC&#39;, curr:&#39;200mA max&#39;, note:&#39;Emitter of output transistor 2. Usually connected to ground.&#39;},
  {num:11, id:&#39;C2&#39;, lbl:&#39;C2&#39;, name:&#39;Collector Output 2&#39;, type:&#39;OUTPUT&#39;, funcs:[&#39;OUTPUT&#39;,&#39;PWM&#39;], volt:&#39;Up to 40V&#39;, curr:&#39;200mA max&#39;, note:&#39;Collector of output transistor 2. Open collector output.&#39;},
  {num:12, id:&#39;VCC&#39;, lbl:&#39;VCC&#39;, name:&#39;Supply Voltage&#39;, type:&#39;PWR&#39;, funcs:[&#39;POWER&#39;], volt:&#39;7V-40V&#39;, curr:&#39;7mA typical&#39;, note:&#39;Positive supply. Decouple with 0.1µF capacitor.&#39;},
  {num:13, id:&#39;OUTPUT_CTRL&#39;, lbl:&#39;OC&#39;, name:&#39;Output Control&#39;, type:&#39;PWM&#39;, funcs:[&#39;CONTROL&#39;,&#39;PWM&#39;], volt:&#39;0-5V&#39;, curr:&#39;&lt; 1µA&#39;, note:&#39;Selects output mode: &lt;0.4V = parallel mode, &gt;2.4V = push-pull mode.&#39;},
  {num:14, id:&#39;REF&#39;, lbl:&#39;REF&#39;, name:&#39;Reference Output&#39;, type:&#39;REF&#39;, funcs:[&#39;REFERENCE&#39;,&#39;POWER&#39;], volt:&#39;5V ±5%&#39;, curr:&#39;10mA max&#39;, note:&#39;5V regulated reference output. Bypass with 0.1µF capacitor.&#39;},
  {num:15, id:&#39;2IN-&#39;, lbl:&#39;2IN-&#39;, name:&#39;Error Amp 2 Inverting Input&#39;, type:&#39;COMP&#39;, funcs:[&#39;COMPARATOR&#39;,&#39;INPUT&#39;], volt:&#39;-0.3 to VCC&#39;, curr:&#39;&lt; 1µA&#39;, note:&#39;Inverting input of second error amplifier. Used for current limiting.&#39;},
  {num:16, id:&#39;2IN+&#39;, lbl:&#39;2IN+&#39;, name:&#39;Error Amp 2 Non-Inverting Input&#39;, type:&#39;COMP&#39;, funcs:[&#39;COMPARATOR&#39;,&#39;INPUT&#39;], volt:&#39;-0.3 to VCC&#39;, curr:&#39;&lt; 1µA&#39;, note:&#39;Non-inverting input of second error amplifier. Typically connected to current sense.&#39;}
];

// Assign coordinates for 16 pins (8 left, 8 right)
PINS.forEach(function(pin) {
  var n = pin.num;
  if (n &gt;= 1 &amp;&amp; n &lt;= 8) {
    var slot = n - 1;
    var cy = BY + slot * PITCH + PITCH/2;
    pin._px = BX - PL;
    pin._py = cy - PW2/2;
  } else {
    var slot = 16 - n;
    var cy = BY + slot * PITCH + PITCH/2;
    pin._px = BX + BW;
    pin._py = cy - PW2/2;
  }
});

function drawPin(pin) {
  var col = cl(pin.type);
  var px = pin._px, py = pin._py;
  var cx = px + PL/2;
  var cy = py + PW2/2;
  var g = mk(&#39;g&#39;, {&#39;class&#39;:&#39;tl494-pin&#39;, &#39;data-id&#39;:pin.id});
  g.style.cursor = &#39;pointer&#39;;
  var sq = mk(&#39;rect&#39;, {x:px, y:py, width:PL, height:PW2, rx:&#39;1&#39;, fill:col.bg, stroke:col.c, &#39;stroke-width&#39;:&#39;0.8&#39;, &#39;class&#39;:&#39;psq&#39;});
  ap(g, sq);
  var lb = mk(&#39;text&#39;, {x:String(cx), y:String(cy+2), &#39;text-anchor&#39;:&#39;middle&#39;, fill:col.c, &#39;font-size&#39;:&#39;5&#39;, &#39;font-family&#39;:&#39;monospace&#39;, &#39;font-weight&#39;:&#39;bold&#39;, &#39;pointer-events&#39;:&#39;none&#39;});
  lb.textContent = String(pin.num);
  ap(g, lb);
  ap(g, mk(&#39;rect&#39;, {x:px-3, y:py-3, width:PL+6, height:PW2+6, fill:&#39;transparent&#39;}));
  g.addEventListener(&#39;click&#39;, function(e) { e.stopPropagation(); pick(pin.id); });
  g.addEventListener(&#39;mouseenter&#39;, function(e) { hoverPin(g, pin, true); showTT(pin, e); });
  g.addEventListener(&#39;mousemove&#39;, moveTT);
  g.addEventListener(&#39;mouseleave&#39;, function() { hoverPin(g, pin, false); hideTT(); });
  svg.appendChild(g);
  var sk = mk(&#39;text&#39;, {x:String(cx), y:String(py - 3), &#39;text-anchor&#39;:&#39;middle&#39;, fill:&#39;rgba(77,166,255,0.7)&#39;, &#39;font-size&#39;:&#39;4.5&#39;, &#39;font-family&#39;:&#39;monospace&#39;, &#39;font-weight&#39;:&#39;bold&#39;, &#39;pointer-events&#39;:&#39;none&#39;});
  sk.textContent = pin.lbl;
  svg.appendChild(sk);
}

PINS.forEach(drawPin);

function hoverPin(g, p, on) {
  var sq = g.querySelector(&#39;.psq&#39;);
  var col = cl(p.type);
  if (on) {
    sq.setAttribute(&#39;fill&#39;, col.c); sq.setAttribute(&#39;stroke-width&#39;,&#39;2&#39;);
    sq.setAttribute(&#39;filter&#39;,&#39;url(#tlGlow)&#39;);
    g.querySelector(&#39;text&#39;).setAttribute(&#39;fill&#39;,&#39;#020810&#39;);
  } else if (selId === p.id) {
    sq.setAttribute(&#39;fill&#39;, col.c); sq.setAttribute(&#39;stroke&#39;, col.c);
    sq.setAttribute(&#39;stroke-width&#39;,&#39;2&#39;); sq.setAttribute(&#39;filter&#39;,&#39;url(#tlGlow)&#39;);
    g.querySelector(&#39;text&#39;).setAttribute(&#39;fill&#39;,&#39;#020810&#39;);
  } else {
    sq.setAttribute(&#39;fill&#39;, col.bg); sq.setAttribute(&#39;stroke&#39;, col.c);
    sq.setAttribute(&#39;stroke-width&#39;,&#39;1.2&#39;); sq.removeAttribute(&#39;filter&#39;);
    g.querySelector(&#39;text&#39;).setAttribute(&#39;fill&#39;, col.c);
  }
}

var selId = null, listOpen = false, fType = null;

var FILTS = [
  {l:&#39;POWER&#39;,   k:&#39;PWR&#39;,   fn:function(p){return p.type===&#39;PWR&#39;;}},
  {l:&#39;GND&#39;,     k:&#39;GND&#39;,   fn:function(p){return p.type===&#39;GND&#39;;}},
  {l:&#39;OSC&#39;,     k:&#39;OSC&#39;,   fn:function(p){return p.type===&#39;OSC&#39;;}},
  {l:&#39;PWM&#39;,     k:&#39;PWM&#39;,   fn:function(p){return p.type===&#39;PWM&#39;||p.type===&#39;OUTPUT&#39;;}},
  {l:&#39;OUTPUT&#39;,  k:&#39;OUTPUT&#39;,fn:function(p){return p.type===&#39;OUTPUT&#39;;}},
  {l:&#39;FEEDBACK&#39;,k:&#39;FEEDBACK&#39;,fn:function(p){return p.type===&#39;FEEDBACK&#39;;}},
  {l:&#39;COMP&#39;,    k:&#39;COMP&#39;,  fn:function(p){return p.type===&#39;COMP&#39;;}},
  {l:&#39;DEAD&#39;,    k:&#39;DEAD&#39;,  fn:function(p){return p.type===&#39;DEAD&#39;;}},
  {l:&#39;REF&#39;,     k:&#39;REF&#39;,   fn:function(p){return p.type===&#39;REF&#39;;}},
];

function matches(p) {
  if (!fType) return true;
  var f = FILTS.find(function(fn){return fn.k===fType;});
  return f ? f.fn(p) : true;
}

function pick(id) {
  selId = (selId===id) ? null : id;
  upBoard(); upDetail(); upList();
}

function upBoard() {
  var hasFilt = fType !== null;
  var pins = document.querySelectorAll(&#39;.tl494-pin&#39;);
  for (var i=0; i&lt;pins.length; i++) {
    var g = pins[i];
    var id = g.getAttribute(&#39;data-id&#39;);
    var p = PINS.find(function(pn){return pn.id===id;});
    if (!p) continue;
    var sq = g.querySelector(&#39;.psq&#39;);
    var col = cl(p.type);
    var act = selId === id;
    var mt = matches(p);
    if (act) {
      sq.setAttribute(&#39;fill&#39;,col.c); sq.setAttribute(&#39;stroke&#39;,col.c);
      sq.setAttribute(&#39;stroke-width&#39;,&#39;2&#39;); sq.setAttribute(&#39;filter&#39;,&#39;url(#tlGlow)&#39;);
      g.querySelector(&#39;text&#39;).setAttribute(&#39;fill&#39;,&#39;#020810&#39;); g.style.opacity=&#39;1&#39;;
    } else if (hasFilt &amp;&amp; !mt) {
      sq.setAttribute(&#39;fill&#39;,&#39;rgba(4,8,20,.5)&#39;); sq.setAttribute(&#39;stroke&#39;,&#39;rgba(20,30,60,.3)&#39;);
      sq.setAttribute(&#39;stroke-width&#39;,&#39;0.8&#39;); sq.removeAttribute(&#39;filter&#39;);
      g.querySelector(&#39;text&#39;).setAttribute(&#39;fill&#39;,&#39;rgba(30,45,80,.3)&#39;); g.style.opacity=&#39;0.15&#39;;
    } else if (hasFilt &amp;&amp; mt) {
      sq.setAttribute(&#39;fill&#39;,col.c); sq.setAttribute(&#39;stroke&#39;,col.c);
      sq.setAttribute(&#39;stroke-width&#39;,&#39;2&#39;); sq.setAttribute(&#39;filter&#39;,&#39;url(#tlGlow)&#39;);
      g.querySelector(&#39;text&#39;).setAttribute(&#39;fill&#39;,&#39;#020810&#39;); g.style.opacity=&#39;1&#39;;
    } else {
      sq.setAttribute(&#39;fill&#39;,col.bg); sq.setAttribute(&#39;stroke&#39;,col.c);
      sq.setAttribute(&#39;stroke-width&#39;,&#39;1.2&#39;); sq.removeAttribute(&#39;filter&#39;);
      g.querySelector(&#39;text&#39;).setAttribute(&#39;fill&#39;,col.c); g.style.opacity=&#39;1&#39;;
    }
  }
}

function upDetail() {
  var empty = document.getElementById(&#39;tlEmpty&#39;);
  var dc = document.getElementById(&#39;tlDC&#39;);
  if (!selId) { empty.style.display=&#39;block&#39;; dc.className=&#39;tl-dc&#39;; return; }
  var p = PINS.find(function(pn){return pn.id===selId;});
  if (!p) return;
  var col = cl(p.type);
  empty.style.display=&#39;none&#39;; dc.className=&#39;tl-dc show&#39;;
  var badge = document.getElementById(&#39;tlBadge&#39;);
  badge.style.background=col.bg; badge.style.borderColor=col.c; badge.style.color=col.c;
  badge.innerHTML=&#39;&lt;span class=&quot;tl-dbnum&quot;&gt;#&#39;+p.num+&#39;&lt;/span&gt;&#39;+p.lbl;
  var pid = document.getElementById(&#39;tlPID&#39;);
  pid.style.color=col.c; pid.textContent=p.id;
  document.getElementById(&#39;tlFull&#39;).textContent=p.name;
  var funcsHtml = &#39;&#39;;
  for (var i=0;i&lt;p.funcs.length;i++){
    var fc = C[p.funcs[i]] || col;
    funcsHtml += &#39;&lt;span class=&quot;tl-chip&quot; style=&quot;background:&#39;+fc.bg+&#39;;color:&#39;+fc.c+&#39;;border-color:&#39;+fc.bd+&#39;&quot;&gt;&#39;+p.funcs[i]+&#39;&lt;/span&gt;&#39;;
  }
  document.getElementById(&#39;tlFuncs&#39;).innerHTML = funcsHtml;
  document.getElementById(&#39;tlGrid&#39;).innerHTML =
    &#39;&lt;div class=&quot;tl-icell&quot;&gt;&lt;span class=&quot;tl-ilbl&quot;&gt;Pin&lt;/span&gt;&lt;span class=&quot;tl-ival&quot;&gt;#&#39;+p.num+&#39;&lt;/span&gt;&lt;/div&gt;&#39;+
    &#39;&lt;div class=&quot;tl-icell&quot;&gt;&lt;span class=&quot;tl-ilbl&quot;&gt;Type&lt;/span&gt;&lt;span class=&quot;tl-ival&quot; style=&quot;color:&#39;+col.c+&#39;&quot;&gt;&#39;+p.type+&#39;&lt;/span&gt;&lt;/div&gt;&#39;+
    &#39;&lt;div class=&quot;tl-icell&quot;&gt;&lt;span class=&quot;tl-ilbl&quot;&gt;Voltage&lt;/span&gt;&lt;span class=&quot;tl-ival&quot;&gt;&#39;+p.volt+&#39;&lt;/span&gt;&lt;/div&gt;&#39;+
    &#39;&lt;div class=&quot;tl-icell&quot;&gt;&lt;span class=&quot;tl-ilbl&quot;&gt;Current&lt;/span&gt;&lt;span class=&quot;tl-ival&quot;&gt;&#39;+p.curr+&#39;&lt;/span&gt;&lt;/div&gt;&#39;;
  var alts = ALT[p.id] || [];
  var as = document.getElementById(&#39;tlAlts&#39;);
  if (alts.length) {
    as.style.display=&#39;block&#39;;
    var achHtml = &#39;&#39;;
    for (var i=0;i&lt;alts.length;i++) achHtml += &#39;&lt;span class=&quot;tl-ac&quot;&gt;&#39;+alts[i]+&#39;&lt;/span&gt;&#39;;
    document.getElementById(&#39;tlAChips&#39;).innerHTML = achHtml;
  } else { as.style.display=&#39;none&#39;; }
  document.getElementById(&#39;tlNote&#39;).innerHTML = &#39;&lt;span style=&quot;color:#4da6ff;margin-right:4px;&quot;&gt;ℹ️&lt;/span&gt;&#39;+p.note;
}

function buildBtns() {
  var wrap = document.getElementById(&#39;tlFBtns&#39;);
  var html = &#39;&#39;;
  for (var i=0;i&lt;FILTS.length;i++) {
    var f = FILTS[i];
    var on = fType===f.k;
    html += &#39;&lt;div class=&quot;tl-fb&#39;+(on?&#39; on&#39;:&#39;&#39;)+&#39;&quot; data-key=&quot;&#39;+f.k+&#39;&quot;&gt;&#39;+f.l+&#39;&lt;/div&gt;&#39;;
  }
  wrap.innerHTML = html;
  var btns = wrap.querySelectorAll(&#39;.tl-fb&#39;);
  for (var i=0;i&lt;btns.length;i++) {
    btns[i].addEventListener(&#39;click&#39;, (function(b){
      return function(){
        var k = b.getAttribute(&#39;data-key&#39;);
        fType = (fType===k) ? null : k;
        buildBtns(); upBoard(); upList();
      };
    })(btns[i]));
  }
}

function upList() {
  var ps = PINS.filter(matches);
  var html = &#39;&#39;;
  for (var i=0;i&lt;ps.length;i++){
    var p=ps[i], col=cl(p.type), on=selId===p.id;
    html += &#39;&lt;div class=&quot;tl-prow&#39;+(on?&#39; on&#39;:&#39;&#39;)+&#39;&quot; data-id=&quot;&#39;+p.id+&#39;&quot; onclick=&quot;tlPick(\&#39;&#39;+p.id+&#39;\&#39;)&quot;&gt;&#39;
      +&#39;&lt;div class=&quot;tl-pbadge&quot; style=&quot;background:&#39;+col.bg+&#39;;color:&#39;+col.c+&#39;;border:1px solid &#39;+col.bd+&#39;&quot;&gt;&#39;+p.lbl+&#39;&lt;/div&gt;&#39;
      +&#39;&lt;div class=&quot;tl-pname&quot;&gt;&#39;+p.name+&#39;&lt;/div&gt;&#39;
      +&#39;&lt;span class=&quot;tl-ptag&quot; style=&quot;background:&#39;+col.bg+&#39;;color:&#39;+col.c+&#39;&quot;&gt;&#39;+p.type+&#39;&lt;/span&gt;&#39;
      +&#39;&lt;/div&gt;&#39;;
  }
  document.getElementById(&#39;tlRows&#39;).innerHTML = html;
  document.getElementById(&#39;tlCnt&#39;).textContent = ps.length+&#39; / &#39;+PINS.length;
}

(function(){
  var types = [&#39;PWR&#39;,&#39;GND&#39;,&#39;OSC&#39;,&#39;PWM&#39;,&#39;OUTPUT&#39;,&#39;FEEDBACK&#39;,&#39;COMP&#39;,&#39;DEAD&#39;,&#39;REF&#39;];
  var html=&#39;&#39;;
  for(var i=0;i&lt;types.length;i++){
    var c=cl(types[i]);
    html+=&#39;&lt;div class=&quot;tl-li&quot;&gt;&lt;span class=&quot;tl-ld&quot; style=&quot;background:&#39;+c.c+&#39;&quot;&gt;&lt;/span&gt;&#39;+types[i]+&#39;&lt;/div&gt;&#39;;
  }
  document.getElementById(&#39;tlLeg&#39;).innerHTML=html;
})();

window.tlPick = function(id){pick(id);};
window.tlTogList = function(){
  listOpen = !listOpen;
  document.getElementById(&#39;tlPList&#39;).className=&#39;tl-plist&#39;+(listOpen?&#39; open&#39;:&#39;&#39;);
  document.getElementById(&#39;tlTIcon&#39;).textContent=listOpen?&#39;▲ HIDE&#39;:&#39;▼ SHOW&#39;;
};

buildBtns(); upList();

var TT = document.getElementById(&#39;tlTT&#39;);
function showTT(p, e) {
  var col=cl(p.type);
  TT.innerHTML=&#39;&lt;span class=&quot;tl-tn&quot; style=&quot;color:&#39;+col.c+&#39;&quot;&gt;#&#39;+p.num+&#39; &#39;+p.id+&#39;&lt;/span&gt;&#39;
    +&#39;&lt;span class=&quot;tl-td&quot;&gt;&#39;+p.funcs.join(&#39; · &#39;)+&#39; | &#39;+p.volt+&#39;&lt;/span&gt;&#39;;
  TT.className=&#39;tl-tt show&#39;; moveTT(e);
}
function moveTT(e){
  var r=document.getElementById(&#39;tl494wrap&#39;).getBoundingClientRect();
  var x=e.clientX-r.left+14, y=e.clientY-r.top-8;
  if(x+280&gt;r.width) x=e.clientX-r.left-300;
  if(y+80&gt;r.height) y=e.clientY-r.top-90;
  TT.style.left=x+&#39;px&#39;; TT.style.top=y+&#39;px&#39;;
}
function hideTT(){TT.className=&#39;tl-tt&#39;;}
document.addEventListener(&#39;click&#39;,function(){if(selId){selId=null;upBoard();upDetail();upList();}});

var tabBtns = document.querySelectorAll(&#39;.tl-mtab&#39;);
var screenSVG  = document.getElementById(&#39;tlSVG&#39;);
var screenCVS  = document.getElementById(&#39;tlCanvas&#39;);
var screenDS2  = document.getElementById(&#39;tlDS&#39;);
var lblEl      = document.getElementById(&#39;tlLbl&#39;);

function showPane(mt) {
  screenSVG.style.display  = (mt===&#39;pin&#39;)    ? &#39;block&#39; : &#39;none&#39;;
  screenCVS.style.display  = (mt===&#39;design&#39;) ? &#39;flex&#39;  : &#39;none&#39;;
  screenDS2.style.display  = (mt===&#39;ds&#39;)     ? &#39;block&#39; : &#39;none&#39;;
  var panels = [&#39;ctrl-pin&#39;,&#39;ctrl-design&#39;,&#39;ctrl-ds&#39;];
  for (var i=0;i&lt;panels.length;i++){
    var el = document.getElementById(panels[i]);
    var show = panels[i]===&#39;ctrl-&#39;+mt;
    el.style.display = show ? &#39;flex&#39; : &#39;none&#39;;
  }
  if (mt===&#39;pin&#39;)    lblEl.textContent=&#39;TL494 PWM PIN EXPLORER&#39;;
  if (mt===&#39;design&#39;) lblEl.textContent=&#39;DESIGN FILES &amp; CALCULATORS&#39;;
  if (mt===&#39;ds&#39;)     { lblEl.textContent=&#39;DATASHEET REFERENCE&#39;; if(!window._dsLoaded) loadDSSample(); }
  if (mt===&#39;design&#39;) setTimeout(function(){drawCanvas(&#39;schematic&#39;);},30);
}

for (var i=0;i&lt;tabBtns.length;i++){
  tabBtns[i].addEventListener(&#39;click&#39;,(function(btn){
    return function(){
      for(var j=0;j&lt;tabBtns.length;j++) tabBtns[j].classList.remove(&#39;on&#39;);
      btn.classList.add(&#39;on&#39;);
      showPane(btn.getAttribute(&#39;data-mt&#39;));
    };
  })(tabBtns[i]));
}

var stabs = document.querySelectorAll(&#39;.tl-stab&#39;);
for (var i=0;i&lt;stabs.length;i++){
  stabs[i].addEventListener(&#39;click&#39;,(function(s){
    return function(){
      for(var j=0;j&lt;stabs.length;j++) stabs[j].classList.remove(&#39;on&#39;);
      s.classList.add(&#39;on&#39;);
      drawCanvas(s.getAttribute(&#39;data-st&#39;));
    };
  })(stabs[i]));
}

var cvs = document.getElementById(&#39;tlCVS&#39;);
var ctx = cvs.getContext(&#39;2d&#39;);

function drawCanvas(mode) {
  screenCVS.style.display=&#39;flex&#39;;
  var W = cvs.offsetWidth||400, H = cvs.offsetHeight||380;
  cvs.width=W; cvs.height=H;
  ctx.clearRect(0,0,W,H);
  if (mode===&#39;schematic&#39;) drawSchematicTL494(W,H);
  else if (mode===&#39;symbol&#39;) drawSymbolTL494(W,H);
  else if (mode===&#39;footprint&#39;) drawFootprintTL494(W,H);
}

function drawSchematicTL494(W,H){
  ctx.fillStyle=&#39;#080d16&#39;; ctx.fillRect(0,0,W,H);
  ctx.strokeStyle=&#39;rgba(77,166,255,0.05)&#39;; ctx.lineWidth=0.5;
  for(var x=0;x&lt;W;x+=20){ctx.beginPath();ctx.moveTo(x,0);ctx.lineTo(x,H);ctx.stroke();}
  for(var y=0;y&lt;H;y+=20){ctx.beginPath();ctx.moveTo(0,y);ctx.lineTo(W,y);ctx.stroke();}
  var iw=200, ih=H*0.7, ix=(W-iw)/2, iy=(H-ih)/2;
  ctx.fillStyle=&#39;#0a0e18&#39;; ctx.strokeStyle=&#39;#4da6ff&#39;; ctx.lineWidth=1.5;
  ctx.fillRect(ix,iy,iw,ih); ctx.strokeRect(ix,iy,iw,ih);
  ctx.fillStyle=&#39;#4da6ff&#39;; ctx.font=&#39;bold 10px monospace&#39;; ctx.textAlign=&#39;center&#39;;
  ctx.fillText(&#39;U1&#39;,ix+iw/2,iy+14);
  ctx.fillStyle=&#39;#4da6ff&#39;; ctx.font=&#39;bold 11px monospace&#39;;
  ctx.fillText(&#39;TL494&#39;,ix+iw/2,iy+32);
  ctx.fillStyle=&#39;#8b949e&#39;; ctx.font=&#39;8px monospace&#39;;
  ctx.fillText(&#39;PWM Controller&#39;,ix+iw/2,iy+48);
  ctx.fillStyle=&#39;#4da6ff&#39;; ctx.font=&#39;7px monospace&#39;;
  ctx.fillText(&#39;Oscillator + Error Amps + PWM&#39;,ix+iw/2,iy+64);
}

function drawSymbolTL494(W,H){
  ctx.fillStyle=&#39;#080d16&#39;; ctx.fillRect(0,0,W,H);
  var bx=W/2-65,by=H/2-85,bw=130,bh=170;
  ctx.fillStyle=&#39;#0a0e18&#39;; ctx.strokeStyle=&#39;#4da6ff&#39;; ctx.lineWidth=1.5;
  ctx.fillRect(bx,by,bw,bh); ctx.strokeRect(bx,by,bw,bh);
  ctx.fillStyle=&#39;#4da6ff&#39;; ctx.font=&#39;bold 10px Orbitron,monospace&#39;; ctx.textAlign=&#39;center&#39;;
  ctx.fillText(&#39;TL494&#39;,bx+bw/2,by+20);
  ctx.fillStyle=&#39;#8b949e&#39;; ctx.font=&#39;7px monospace&#39;;
  ctx.fillText(&#39;PWM Controller&#39;,bx+bw/2,by+34);
  var leftPins = [1,2,3,4,5,6,7,8];
  var rightPins = [16,15,14,13,12,11,10,9];
  for(var i=0;i&lt;leftPins.length;i++){
    var p = PINS.find(pn=&gt;pn.num===leftPins[i]);
    if(p){
      var y = by+45 + i*15;
      ctx.strokeStyle=&#39;#4da6ff&#39;; ctx.lineWidth=0.5;
      ctx.beginPath(); ctx.moveTo(bx-12,y); ctx.lineTo(bx,y); ctx.stroke();
      ctx.fillStyle=&#39;#88ccff&#39;; ctx.font=&#39;6px monospace&#39;; ctx.textAlign=&#39;right&#39;;
      ctx.fillText(p.lbl,bx-14,y+3);
    }
  }
  for(var i=0;i&lt;rightPins.length;i++){
    var p = PINS.find(pn=&gt;pn.num===rightPins[i]);
    if(p){
      var y = by+45 + i*15;
      ctx.strokeStyle=&#39;#4da6ff&#39;; ctx.lineWidth=0.5;
      ctx.beginPath(); ctx.moveTo(bx+bw+12,y); ctx.lineTo(bx+bw,y); ctx.stroke();
      ctx.fillStyle=&#39;#88ccff&#39;; ctx.font=&#39;6px monospace&#39;; ctx.textAlign=&#39;left&#39;;
      ctx.fillText(p.lbl,bx+bw+14,y+3);
    }
  }
}

function drawFootprintTL494(W,H){
  ctx.fillStyle=&#39;#0d1b0d&#39;; ctx.fillRect(0,0,W,H);
  var bw2=W*0.45, bh2=H*0.6, bx=(W-bw2)/2, by=(H-bh2)/2;
  ctx.fillStyle=&#39;#0a1208&#39;; ctx.strokeStyle=&#39;#4da6ff&#39;; ctx.lineWidth=0.7;
  ctx.fillRect(bx,by,bw2,bh2); ctx.strokeRect(bx,by,bw2,bh2);
  ctx.fillStyle=&#39;rgba(77,166,255,0.4)&#39;; ctx.font=&#39;bold 9px monospace&#39;; ctx.textAlign=&#39;center&#39;;
  ctx.fillText(&#39;TL494&#39;,bx+bw2/2,by+bh2/2-6);
  ctx.fillStyle=&#39;rgba(77,166,255,0.3)&#39;; ctx.font=&#39;8px monospace&#39;;
  ctx.fillText(&#39;PWM&#39;,bx+bw2/2,by+bh2/2+10);
  var N=8, pLen=14, pW=5, pitch=bh2/N;
  ctx.fillStyle=&#39;#4da6ff&#39;;
  for(var i=0;i&lt;N;i++){
    var pos=i*pitch+pitch/2;
    ctx.fillRect(bx-pLen-2,by+pos-pW/2,pLen,pW);
    ctx.fillRect(bx+bw2+2,by+pos-pW/2,pLen,pW);
  }
  ctx.fillStyle=&#39;#ffaa44&#39;; ctx.beginPath();
  ctx.arc(bx-pLen-6,by+pitch/2,3,0,Math.PI*2); ctx.fill();
}

function sec(t,rows){
  return &#39;&lt;div style=&quot;font-size:13px;color:#4da6ff;font-weight:700;letter-spacing:.1em;margin:12px 0 5px;text-transform:uppercase;&quot;&gt;&#39;+t+&#39;&lt;/div&gt;&#39;
    +&#39;&lt;div style=&quot;background:#0d1117;border:1px solid #21262d;border-radius:4px;overflow:hidden;&quot;&gt;&#39;+rows+&#39;&lt;/div&gt;&#39;;
}
function row(p,v){
  return &#39;&lt;div style=&quot;display:flex;justify-content:space-between;padding:4px 9px;border-bottom:1px solid #1a2030;font-size:13px;&quot;&gt;&#39;
    +&#39;&lt;span style=&quot;color:#8b949e;&quot;&gt;&#39;+p+&#39;&lt;/span&gt;&lt;span style=&quot;color:#e6edf3;font-weight:700;&quot;&gt;&#39;+v+&#39;&lt;/span&gt;&lt;/div&gt;&#39;;
}
function feat(t){
  return &#39;&lt;div style=&quot;padding:4px 9px;border-bottom:1px solid #1a2030;font-size:13px;color:#8b949e;display:flex;gap:6px;&quot;&gt;&#39;
    +&#39;&lt;span style=&quot;color:#4da6ff;flex-shrink:0;&quot;&gt;▶&lt;/span&gt;&#39;+t+&#39;&lt;/div&gt;&#39;;
}

function loadDSSample(){
  window._dsLoaded=true;
  var quick = document.getElementById(&#39;tlDsQuick&#39;);
  quick.innerHTML = sec(&#39;ABSOLUTE MAXIMUM RATINGS&#39;,
    row(&#39;Supply Voltage&#39;,&#39;41V&#39;)+row(&#39;Output Current&#39;,&#39;250mA&#39;)+row(&#39;Power Dissipation&#39;,&#39;1000mW&#39;)+row(&#39;Operating Temp&#39;,&#39;0°C to 70°C&#39;)+row(&#39;Storage Temp&#39;,&#39;-65°C to 150°C&#39;))
    +sec(&#39;OSCILLATOR FORMULAS&#39;,
      row(&#39;Frequency&#39;,&#39;f = 1.1 / (RT × CT)&#39;)+row(&#39;RT Range&#39;,&#39;1.8kΩ to 100kΩ&#39;)+row(&#39;CT Range&#39;,&#39;0.0047µF to 10µF&#39;)+row(&#39;Dead-Time&#39;,&#39;0% to 100% (0V to 3.3V on DTC pin)&#39;))
    +sec(&#39;KEY FEATURES&#39;,
      feat(&#39;Complete PWM control circuit&#39;)+feat(&#39;Variable frequency oscillator&#39;)+feat(&#39;Two error amplifiers&#39;)+feat(&#39;5V reference output&#39;)+feat(&#39;Push-pull or parallel output modes&#39;)+feat(&#39;Adjustable dead-time control&#39;)+feat(&#39;200mA totem-pole outputs&#39;)+feat(&#39;Widely used in SMPS, inverters, motor control&#39;));
  document.getElementById(&#39;tlDSContent&#39;).innerHTML = sec(&#39;TL494 — Complete Reference&#39;,
    row(&#39;Type&#39;,&#39;Pulse Width Modulation Controller&#39;)+row(&#39;Manufacturers&#39;,&#39;TI, ON Semi, STMicro&#39;)+row(&#39;Introduced&#39;,&#39;1970s&#39;)+row(&#39;Supply Current&#39;,&#39;7 mA typical&#39;)+row(&#39;Output Drive&#39;,&#39;200mA per output&#39;)+row(&#39;Frequency Range&#39;,&#39;1kHz to 300kHz&#39;)+row(&#39;Pin Count&#39;,&#39;16-pin DIP, SOIC&#39;))+
    sec(&#39;TYPICAL APPLICATIONS&#39;,
      feat(&#39;SMPS (Switch Mode Power Supplies)&#39;)+feat(&#39;DC-DC Converters&#39;)+feat(&#39;Battery Chargers&#39;)+feat(&#39;Inverters&#39;)+feat(&#39;Motor Speed Control&#39;)+feat(&#39;LED Drivers&#39;)+feat(&#39;Audio Amplifiers (Class D)&#39;)+feat(&#39;Solar Inverters&#39;)+feat(&#39;Electric Vehicle Chargers&#39;));
}

// ── PDF Upload and Analysis ──
var pdfInput = document.getElementById(&#39;tlPdfInput&#39;);
var extractedSpecsDiv = document.getElementById(&#39;tlExtractedSpecs&#39;);
var extractedContent = document.getElementById(&#39;tlExtractedContent&#39;);
var fileInfo = document.getElementById(&#39;tlFileInfo&#39;);
var progressDiv = document.getElementById(&#39;tlProgress&#39;);
var progBar = document.getElementById(&#39;tlProgBar&#39;);
var extractStatus = document.getElementById(&#39;tlExtractStatus&#39;);

var specPatterns = [
  { key: &#39;Supply Voltage&#39;, patterns: [/supply[\s-]*voltage/i, /vcc[\s-]*range/i, /operating[\s-]*voltage/i], unit: &#39;V&#39; },
  { key: &#39;Supply Current&#39;, patterns: [/supply[\s-]*current/i, /icc/i, /quiescent[\s-]*current/i], unit: &#39;mA&#39; },
  { key: &#39;Output Current&#39;, patterns: [/output[\s-]*current/i, /sink[\s-]*current/i, /source[\s-]*current/i], unit: &#39;mA&#39; },
  { key: &#39;Max Frequency&#39;, patterns: [/maximum[\s-]*frequency/i, /oscillator[\s-]*frequency/i], unit: &#39;kHz&#39; },
  { key: &#39;Power Dissipation&#39;, patterns: [/power[\s-]*dissipation/i, /pd[\s-]*max/i], unit: &#39;mW&#39; },
  { key: &#39;Reference Voltage&#39;, patterns: [/reference[\s-]*voltage/i, /vref/i], unit: &#39;V&#39; },
  { key: &#39;Temperature Range&#39;, patterns: [/operating[\s-]*temperature/i, /temp[\s-]*range/i], unit: &#39;°C&#39; },
  { key: &#39;Dead-Time Range&#39;, patterns: [/dead[\s-]*time/i, /dtc/i], unit: &#39;%&#39; }
];

function extractNumber(text) {
  var match = text.match(/(\d+(?:\.\d+)?)\s*(?:µ|u|micro)?\s*([mM]?[kK]?[a-zA-Z]*)/);
  if (match) {
    var num = parseFloat(match[1]);
    var unit = match[2] || &#39;&#39;;
    return { value: num, unit: unit };
  }
  return null;
}

function findSpecification(text, patterns) {
  for (var i = 0; i &lt; patterns.length; i++) {
    var pattern = patterns[i];
    var regex = new RegExp(pattern + &#39;\\s*[:=\\s]\\s*([\\d\\.]+\\s*(?:[µu]?[A-Za-z]*)?)&#39;, &#39;i&#39;);
    var match = text.match(regex);
    if (match) {
      var numMatch = extractNumber(match[1]);
      if (numMatch) {
        return numMatch.value + (numMatch.unit ? &#39; &#39; + numMatch.unit : &#39;&#39;);
      }
      return match[1].trim();
    }
  }
  return null;
}

function analyzeTL494Datasheet(text) {
  var extracted = {};
  var fullText = text;
  for (var i = 0; i &lt; specPatterns.length; i++) {
    var spec = specPatterns[i];
    var value = findSpecification(fullText, spec.patterns);
    if (value) {
      extracted[spec.key] = value;
    }
  }
  return extracted;
}

function displayExtractedSpecs(specs) {
  if (Object.keys(specs).length === 0) {
    extractedContent.innerHTML = &#39;&lt;div style=&quot;color:#8b949e; padding: 10px; text-align:center;&quot;&gt;⚠️ No specifications could be extracted from this PDF.&lt;br&gt;Try a different datasheet or use the sample data.&lt;/div&gt;&#39;;
    extractedSpecsDiv.style.display = &#39;block&#39;;
    return;
  }
  var html = &#39;&lt;div style=&quot;display:flex; flex-direction:column; gap:4px;&quot;&gt;&#39;;
  for (var key in specs) {
    html += &#39;&lt;div style=&quot;display:flex; justify-content:space-between; padding:4px 0; border-bottom:1px solid #21262d;&quot;&gt;&#39; +
            &#39;&lt;span style=&quot;color:#8b949e;&quot;&gt;&#39; + key + &#39;&lt;/span&gt;&#39; +
            &#39;&lt;span style=&quot;color:#4da6ff; font-weight:700;&quot;&gt;&#39; + specs[key] + &#39;&lt;/span&gt;&#39; +
            &#39;&lt;/div&gt;&#39;;
  }
  html += &#39;&lt;/div&gt;&#39;;
  extractedContent.innerHTML = html;
  extractedSpecsDiv.style.display = &#39;block&#39;;
}

if (pdfInput) {
  pdfInput.addEventListener(&#39;change&#39;, function(e) {
    if (!e.target.files.length) return;
    var file = e.target.files[0];
    if (!file.name.toLowerCase().endsWith(&#39;.pdf&#39;)) {
      fileInfo.innerHTML = &#39;❌ Please select a PDF file&#39;;
      return;
    }
    fileInfo.innerHTML = &#39;📄 Loading: &#39; + file.name + &#39;...&#39;;
    progressDiv.style.display = &#39;block&#39;;
    progBar.style.width = &#39;20%&#39;;
    extractStatus.style.display = &#39;none&#39;;
    var fileReader = new FileReader();
    fileReader.onload = function() {
      progBar.style.width = &#39;50%&#39;;
      var typedarray = new Uint8Array(this.result);
      pdfjsLib.getDocument(typedarray).promise.then(function(pdf) {
        progBar.style.width = &#39;70%&#39;;
        var numPages = pdf.numPages;
        var pagePromises = [];
        for (var i = 1; i &lt;= Math.min(numPages, 15); i++) {
          pagePromises.push(pdf.getPage(i).then(function(page) {
            return page.getTextContent().then(function(textContent) {
              return textContent.items.map(function(item) { return item.str; }).join(&#39; &#39;);
            });
          }));
        }
        Promise.all(pagePromises).then(function(pagesText) {
          progBar.style.width = &#39;90%&#39;;
          var fullText = pagesText.join(&#39; &#39;);
          var extractedSpecs = analyzeTL494Datasheet(fullText);
          progBar.style.width = &#39;100%&#39;;
          setTimeout(function() {
            progressDiv.style.display = &#39;none&#39;;
            progBar.style.width = &#39;0%&#39;;
            if (Object.keys(extractedSpecs).length &gt; 0) {
              fileInfo.innerHTML = &#39;✅ Extracted &#39; + Object.keys(extractedSpecs).length + &#39; specifications from: &#39; + file.name;
              extractStatus.style.display = &#39;block&#39;;
              extractStatus.innerHTML = &#39;✓ PDF analysis complete!&#39;;
              extractStatus.style.color = &#39;#50c8a0&#39;;
              setTimeout(function() { extractStatus.style.display = &#39;none&#39;; }, 3000);
            } else {
              fileInfo.innerHTML = &#39;⚠️ PDF loaded but no specifications found. Try the sample data below.&#39;;
              extractStatus.style.display = &#39;block&#39;;
              extractStatus.innerHTML = &#39;⚠️ No specifications found in this PDF&#39;;
              extractStatus.style.color = &#39;#ffaa44&#39;;
              setTimeout(function() { extractStatus.style.display = &#39;none&#39;; }, 3000);
            }
            displayExtractedSpecs(extractedSpecs);
          }, 200);
        }).catch(function(err) {
          console.error(&#39;Error extracting text:&#39;, err);
          progressDiv.style.display = &#39;none&#39;;
          fileInfo.innerHTML = &#39;❌ Error extracting text from PDF. The file may be image-based.&#39;;
          extractStatus.style.display = &#39;block&#39;;
          extractStatus.innerHTML = &#39;❌ PDF text extraction failed&#39;;
          extractStatus.style.color = &#39;#ff6b6b&#39;;
          setTimeout(function() { extractStatus.style.display = &#39;none&#39;; }, 3000);
        });
      }).catch(function(err) {
        console.error(&#39;Error loading PDF:&#39;, err);
        progressDiv.style.display = &#39;none&#39;;
        fileInfo.innerHTML = &#39;❌ Could not load PDF. Make sure it\&#39;s a valid PDF file.&#39;;
      });
    };
    fileReader.readAsArrayBuffer(file);
  });
}

function loadTL494SampleData() {
  var sampleSpecs = {
    &#39;Supply Voltage&#39;: &#39;7V - 40V&#39;,
    &#39;Supply Current&#39;: &#39;7 mA&#39;,
    &#39;Output Current&#39;: &#39;200 mA&#39;,
    &#39;Max Frequency&#39;: &#39;300 kHz&#39;,
    &#39;Power Dissipation&#39;: &#39;1000 mW&#39;,
    &#39;Reference Voltage&#39;: &#39;5.0V ±5%&#39;,
    &#39;Temperature Range&#39;: &#39;0°C to 70°C&#39;,
    &#39;Dead-Time Range&#39;: &#39;0% to 100%&#39;
  };
  displayExtractedSpecs(sampleSpecs);
  fileInfo.innerHTML = &#39;📄 Sample datasheet loaded — TL494 PWM specifications&#39;;
  extractStatus.style.display = &#39;block&#39;;
  extractStatus.innerHTML = &#39;✓ Sample data loaded successfully!&#39;;
  extractStatus.style.color = &#39;#50c8a0&#39;;
  setTimeout(function() { extractStatus.style.display = &#39;none&#39;; }, 3000);
}

var sampleBtn = document.getElementById(&#39;tlLoadSample&#39;);
if (sampleBtn) {
  sampleBtn.onclick = function() {
    loadTL494SampleData();
    loadDSSample();
  };
}

})();
&lt;/script&gt;


&lt;!-------------------------&gt;

&lt;!-------------------------&gt;

&lt;div&gt;Explore TL494 PWM Controller: pins, internal block diagram, and expert design tips to optimize power supply circuits&lt;/div&gt;

&lt;div class=&quot;separator&quot; style=&quot;display: none;&quot;&gt;&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiIco3w16ziIDn7WRMzUfTsAR5r51YNeA2m2mbf04U3N0LHJmGD-4BX8arDTt6No7vFGtBGSLDOm7USp8UiGWPlqHB7h-x5TW_WLEjpHJRORPtDA_M7S49C7uhLyk_NTkCX6ZhhevScOq3EM6Vq6QPP8CJ1hIQ90fXICy8kECtrNKVw6zWN6ROyOo0-F2H0/s1600/TL494%20chip%20explorer.png&quot; style=&quot;display: block; padding: 1em 0px; text-align: center;&quot;&gt;&lt;img alt=&quot;&quot; border=&quot;0&quot; data-original-height=&quot;768&quot; data-original-width=&quot;1376&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiIco3w16ziIDn7WRMzUfTsAR5r51YNeA2m2mbf04U3N0LHJmGD-4BX8arDTt6No7vFGtBGSLDOm7USp8UiGWPlqHB7h-x5TW_WLEjpHJRORPtDA_M7S49C7uhLyk_NTkCX6ZhhevScOq3EM6Vq6QPP8CJ1hIQ90fXICy8kECtrNKVw6zWN6ROyOo0-F2H0/s1600/TL494%20chip%20explorer.png&quot; /&gt;&lt;/a&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://www.ee-diary.net/feeds/1571752933532588635/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.ee-diary.net/2026/04/tl494-ic-pinout-explorer-free.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7437986969318338216/posts/default/1571752933532588635'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7437986969318338216/posts/default/1571752933532588635'/><link rel='alternate' type='text/html' href='http://www.ee-diary.net/2026/04/tl494-ic-pinout-explorer-free.html' title='TL494 IC pinout explorer - Free interactive tool'/><author><name>Unknown</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiIco3w16ziIDn7WRMzUfTsAR5r51YNeA2m2mbf04U3N0LHJmGD-4BX8arDTt6No7vFGtBGSLDOm7USp8UiGWPlqHB7h-x5TW_WLEjpHJRORPtDA_M7S49C7uhLyk_NTkCX6ZhhevScOq3EM6Vq6QPP8CJ1hIQ90fXICy8kECtrNKVw6zWN6ROyOo0-F2H0/s72-c/TL494%20chip%20explorer.png" height="72" width="72"/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-7437986969318338216.post-1902814006850932099</id><published>2026-04-16T02:20:00.002+05:45</published><updated>2026-04-16T02:20:42.759+05:45</updated><category scheme="http://www.blogger.com/atom/ns#" term="FM Circuit"/><category scheme="http://www.blogger.com/atom/ns#" term="FM transmitter"/><title type='text'>Simple Super Regenerative FM Receiver Circuit Design</title><content type='html'>&lt;h2 style=&quot;text-align: left;&quot;&gt;&lt;span style=&quot;font-family: inherit;&quot;&gt;Build Your Own Simple Super Regenerative FM Receiver: A Beginner&#39;s Guide to DIY Radio&lt;/span&gt;&lt;/h2&gt;&lt;p&gt;&lt;span style=&quot;font-family: inherit;&quot;&gt;Have you ever dreamed of building your own radio? The idea of capturing invisible waves from the air and transforming them into sound can seem like magic, but with a little electronics know-how, it&#39;s a completely achievable and incredibly rewarding project. For beginners diving into the fascinating world of radio frequency (RF) electronics, the super regenerative FM receiver is an excellent starting point. It’s known for its simplicity, low component count, and impressive sensitivity for such a straightforward design.&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style=&quot;font-family: inherit;&quot;&gt;In this comprehensive guide, we’re going to demystify the &quot;Simple Super Regenerative FM Receiver Circuit Design.&quot; We’ll walk you through the core principles, introduce you to the essential components, detail the circuit&#39;s operation, and provide a step-by-step construction plan. By the end of this post, you&#39;ll have the knowledge and confidence to assemble your very own FM receiver, pulling local radio stations right out of the ether. Get ready to transform theory into a tangible, working piece of technology!&lt;/span&gt;&lt;/p&gt;
&lt;h2&gt;&lt;span style=&quot;font-family: inherit;&quot;&gt;What is a Super Regenerative Receiver? A Beginner&#39;s Overview&lt;/span&gt;&lt;/h2&gt;&lt;p&gt;&lt;span style=&quot;font-family: inherit;&quot;&gt;Before we delve into the specifics of circuit design, let&#39;s understand the heart of our project: the super regenerative receiver. Unlike more complex superheterodyne receivers found in commercial radios, the super regenerative design is a marvel of simplicity and efficiency, especially for receiving Frequency Modulated (FM) signals.&lt;/span&gt;&lt;/p&gt;

&lt;h3&gt;&lt;span style=&quot;font-family: inherit;&quot;&gt;The Magic of Regeneration&lt;/span&gt;&lt;/h3&gt;

&lt;p&gt;&lt;span style=&quot;font-family: inherit;&quot;&gt;At its core, a super regenerative receiver uses a single transistor (or vacuum tube in older designs) to perform multiple tasks: RF amplification, detection (demodulation), and even some degree of selectivity. The &quot;regenerative&quot; part comes from feeding a portion of the amplified signal back to the input in a controlled positive feedback loop. This feedback significantly increases the circuit&#39;s sensitivity and gain, allowing it to pick up very weak signals. Imagine a microphone picking up its own sound from a speaker, but controlled just enough to amplify, not to create a runaway screech!&lt;/span&gt;&lt;/p&gt;

&lt;h3&gt;&lt;span style=&quot;font-family: inherit;&quot;&gt;The &quot;Super&quot; Part: Quenching&lt;/span&gt;&lt;/h3&gt;

&lt;p&gt;&lt;span style=&quot;font-family: inherit;&quot;&gt;The &quot;super&quot; in super regenerative refers to a clever technique called &quot;quenching.&quot; If the regeneration were left unchecked, the circuit would oscillate continuously, becoming a radio transmitter rather than a receiver. To prevent this, the super regenerative receiver periodically switches its oscillation on and off at a frequency much lower than the incoming radio signal (the &quot;quenching frequency&quot;). This rapid on-off cycling allows the circuit to build up oscillations due to weak incoming signals, detect them, and then &quot;reset&quot; before the oscillations become unstable. This process makes the circuit incredibly sensitive and efficient at detecting FM signals by sensing changes in the oscillation amplitude caused by the incoming FM carrier.&lt;/span&gt;&lt;/p&gt;

&lt;h2&gt;&lt;span style=&quot;font-family: inherit;&quot;&gt;Circuit Design Principles: How It All Works Together&lt;/span&gt;&lt;/h2&gt;&lt;p&gt;&lt;span style=&quot;font-family: inherit;&quot;&gt;Let&#39;s look at the conceptual breakdown of our simple super regenerative FM receiver. Understanding the flow of the signal will make the component-level discussion clearer.&lt;/span&gt;&lt;/p&gt;

&lt;h3&gt;&lt;span style=&quot;font-family: inherit;&quot;&gt;Block Diagram Concept:&lt;/span&gt;&lt;/h3&gt;
&lt;ol&gt;
    &lt;li&gt;&lt;span style=&quot;font-family: inherit;&quot;&gt;&lt;strong&gt;Antenna:&lt;/strong&gt; Captures the electromagnetic waves (radio signals) from the air.&lt;/span&gt;&lt;/li&gt;&lt;span style=&quot;font-family: inherit;&quot;&gt;&lt;br /&gt;
    &lt;/span&gt;&lt;li&gt;&lt;span style=&quot;font-family: inherit;&quot;&gt;&lt;strong&gt;Tuning &amp;amp; RF Stage (Super-Regenerative Oscillator):&lt;/strong&gt; This is where the magic happens. The incoming RF signal is fed into a transistor-based oscillator circuit. This circuit is designed to oscillate at the frequency of the desired FM station. Through regeneration and quenching, it amplifies the weak incoming signal and, simultaneously, acts as a detector.&lt;/span&gt;&lt;/li&gt;&lt;span style=&quot;font-family: inherit;&quot;&gt;&lt;br /&gt;
    &lt;/span&gt;&lt;li&gt;&lt;span style=&quot;font-family: inherit;&quot;&gt;&lt;strong&gt;Demodulation/Detection:&lt;/strong&gt; Within the super-regenerative oscillator itself, the frequency variations of the incoming FM signal are converted into amplitude variations. These amplitude changes, which represent the original audio information, are then extracted.&lt;/span&gt;&lt;/li&gt;&lt;span style=&quot;font-family: inherit;&quot;&gt;&lt;br /&gt;
    &lt;/span&gt;&lt;li&gt;&lt;span style=&quot;font-family: inherit;&quot;&gt;&lt;strong&gt;Audio Amplification:&lt;/strong&gt; The extracted audio signal is typically very weak. It needs to be boosted by an audio amplifier stage (like one built around an LM386 IC) to drive a speaker or headphones.&lt;/span&gt;&lt;/li&gt;&lt;span style=&quot;font-family: inherit;&quot;&gt;&lt;br /&gt;
    &lt;/span&gt;&lt;li&gt;&lt;span style=&quot;font-family: inherit;&quot;&gt;&lt;strong&gt;Output (Speaker/Headphones):&lt;/strong&gt; The amplified audio signal is converted into sound waves that you can hear.&lt;/span&gt;&lt;/li&gt;&lt;/ol&gt;

&lt;p&gt;&lt;span style=&quot;font-family: inherit;&quot;&gt;The beauty of the super regenerative design is how steps 2 and 3 are often combined into a single, elegant stage. The transistor handles both the high-frequency amplification and the demodulation, simplifying the overall circuit considerably.&lt;/span&gt;&lt;/p&gt;

&lt;h2&gt;&lt;span style=&quot;font-family: inherit;&quot;&gt;The Simple Super Regenerative FM Receiver Circuit&lt;/span&gt;&lt;/h2&gt;

&lt;p&gt;&lt;span style=&quot;font-family: inherit;&quot;&gt;Now, let&#39;s visualize the actual circuit and understand its sections. We&#39;ll examine a common and effective design that beginners can easily replicate.&lt;/span&gt;&lt;/p&gt;

&lt;span style=&quot;font-family: inherit;&quot;&gt;&lt;img alt=&quot;Simple Super Regenerative FM Receiver Circuit Design&quot; border=&quot;0&quot; data-original-height=&quot;595&quot; data-original-width=&quot;755&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEj_Ynb8NylW492GyOJyeqo3mCHOj8DUoegZ99HfVtuPiQB1kAtOjQezHhQP1xBYcQX-zb2CvbHCSfC26WBJCZTbHeFva50E59DRa-XBwqJxY-YNFuEyHeymk4_azXd3ziBRavgp3ARCHabYQKuI0G8EmWn3rpzYtERNKvAEWb5YbjGdCEAflo48jXGarqfy/s16000/Simple%20Super%20Regenerative%20FM%20Receiver%20Circuit%20Design.png&quot; title=&quot;Simple Super Regenerative FM Receiver Circuit Design&quot; /&gt;&lt;/span&gt;&lt;div&gt;&lt;span style=&quot;font-family: inherit;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;p class=&quot;ds-markdown-paragraph&quot; style=&quot;background-color: white; color: #0f1115; font-size: 16px; margin: 16px 0px;&quot;&gt;&lt;span style=&quot;font-family: inherit;&quot;&gt;This simple FM receiver circuit uses a minimum number of components for local FM reception. Transistor BF495 (T2), together with a 10k resistor (R1), coil L, a 22pF variable capacitor (VC), and the internal capacitances of transistor BF494 (T1), forms a Colpitts oscillator. The trimmer capacitor VC sets the oscillator&#39;s resonant frequency to match that of the desired transmitting station—in other words, it must be tunable across the FM band from 88 to 108 MHz. The information signal (the modulation from the transmitter) is extracted across resistor R1 and fed to the audio amplifier through a 220nF coupling capacitor (C1).&lt;/span&gt;&lt;/p&gt;&lt;p class=&quot;ds-markdown-paragraph&quot; style=&quot;background-color: white; color: #0f1115; font-size: 16px; margin: 16px 0px;&quot;&gt;&lt;span style=&quot;font-family: inherit;&quot;&gt;The variable capacitor should have a capacitance range from a few picofarads up to about 20 pF. A 22pF trimmer capacitor is therefore a suitable choice for VC and is readily available. If you use a capacitor with a larger value and find that you cannot cover the full FM bandwidth (88–108 MHz), try adjusting the value of VC experimentally to find the optimal capacitance.&lt;/span&gt;&lt;/p&gt;&lt;p class=&quot;ds-markdown-paragraph&quot; style=&quot;background-color: white; color: #0f1115; font-size: 16px; margin: 16px 0px;&quot;&gt;&lt;span style=&quot;font-family: inherit;&quot;&gt;The self-supporting coil L is made from four turns of 22 SWG enamelled copper wire wound on an air core with an internal diameter of 4 mm. It can be wound on any cylindrical object with a 4 mm diameter, such as a pencil or pen. After winding the required number of turns, remove the coil from the cylinder and gently stretch it slightly to prevent adjacent turns from touching each other.&lt;/span&gt;&lt;/p&gt;&lt;p class=&quot;ds-markdown-paragraph&quot; style=&quot;background-color: white; color: #0f1115; font-size: 16px; margin: 16px 0px;&quot;&gt;&lt;span style=&quot;font-family: inherit;&quot;&gt;Capacitors C3 (100nF) and C10 (100µF, 25V), together with resistor R3 (1k), form a very low-frequency band-pass filter that separates the low-frequency (audio) signal from the high-frequency components in the receiver.&lt;/span&gt;&lt;/p&gt;&lt;p class=&quot;ds-markdown-paragraph&quot; style=&quot;background-color: white; color: #0f1115; font-size: 16px; margin: 16px 0px;&quot;&gt;&lt;span style=&quot;font-family: inherit;&quot;&gt;For the antenna, you can reuse the telescopic antenna from an unused device. Alternatively, a good reception can be achieved with a piece of insulated copper wire about 60 cm long. The optimal length of copper wire can be found experimentally. For more information, you can also read:&amp;nbsp;&lt;em&gt;Different Types of Antennas&lt;/em&gt;. The performance of this tiny receiver depends on several factors, including the quality and number of turns of coil L, the type of antenna used, and the distance from the FM transmitter.&lt;/span&gt;&lt;/p&gt;&lt;p class=&quot;ds-markdown-paragraph&quot; style=&quot;background-color: white; color: #0f1115; font-size: 16px; margin: 16px 0px;&quot;&gt;&lt;span style=&quot;font-family: inherit;&quot;&gt;IC LM386 is an audio power amplifier designed for low-voltage consumer applications. It delivers 1 to 2 watts of output power, sufficient to drive any small loudspeaker. A 22k logarithmic potentiometer (VR) is connected to pin 3 for volume control, and the amplified output is taken from pin 5 of the IC. The receiver can be powered by a 6V to 9V battery.&lt;/span&gt;&lt;/p&gt;

&lt;h4 style=&quot;text-align: left;&quot;&gt;&lt;span style=&quot;font-family: inherit;&quot;&gt;Further Exploration and Enhancements&lt;/span&gt;&lt;/h4&gt;

&lt;p&gt;&lt;span style=&quot;font-family: inherit;&quot;&gt;Your journey doesn&#39;t have to end with a basic working receiver! Here are some ideas for improving your design or exploring related projects:&lt;/span&gt;&lt;/p&gt;
&lt;ul&gt;
    &lt;li&gt;&lt;span style=&quot;font-family: inherit;&quot;&gt;&lt;strong&gt;Add an RF Amplifier Stage:&lt;/strong&gt; A dedicated RF pre-amplifier stage before the super-regenerative detector can boost weak signals, improving overall sensitivity without affecting selectivity too much.&lt;/span&gt;&lt;/li&gt;&lt;span style=&quot;font-family: inherit;&quot;&gt;&lt;br /&gt;
    &lt;/span&gt;&lt;li&gt;&lt;span style=&quot;font-family: inherit;&quot;&gt;&lt;strong&gt;Better Filtering:&lt;/strong&gt; Experiment with different audio filter designs after the detector to reduce noise and improve sound quality.&lt;/span&gt;&lt;/li&gt;&lt;span style=&quot;font-family: inherit;&quot;&gt;&lt;br /&gt;
    &lt;/span&gt;&lt;li&gt;&lt;span style=&quot;font-family: inherit;&quot;&gt;&lt;strong&gt;Shielding:&lt;/strong&gt; Enclosing your circuit in a metal box can reduce RF radiation and protect it from external interference.&lt;/span&gt;&lt;/li&gt;&lt;span style=&quot;font-family: inherit;&quot;&gt;&lt;br /&gt;
    &lt;/span&gt;&lt;li&gt;&lt;span style=&quot;font-family: inherit;&quot;&gt;&lt;strong&gt;Experiment with Different Transistors:&lt;/strong&gt; Try different RF transistors to see how they impact performance.&lt;/span&gt;&lt;/li&gt;&lt;span style=&quot;font-family: inherit;&quot;&gt;&lt;br /&gt;
    &lt;/span&gt;&lt;li&gt;&lt;span style=&quot;font-family: inherit;&quot;&gt;&lt;strong&gt;Explore FM Transmitters:&lt;/strong&gt; Once you&#39;ve mastered receiving, why not try transmitting? Building a simple FM transmitter can be a great complementary project. You can learn more about related concepts by checking out these resources:
    &lt;/span&gt;&lt;ul&gt;
        &lt;li&gt;&lt;a href=&quot;https://www.ee-diary.net/2024/08/design-of-fm-transmitter-and-receiver.html&quot;&gt;&lt;span style=&quot;font-family: inherit;&quot;&gt;Design of FM Transmitter and Receiver&lt;/span&gt;&lt;/a&gt;&lt;/li&gt;&lt;span style=&quot;font-family: inherit;&quot;&gt;&lt;br /&gt;
        &lt;/span&gt;&lt;li&gt;&lt;a href=&quot;https://www.ee-diary.net/2021/03/2n3904-one-transistor-fm-transmitter.html&quot;&gt;&lt;span style=&quot;font-family: inherit;&quot;&gt;2N3904 One Transistor FM Transmitter&lt;/span&gt;&lt;/a&gt;&lt;/li&gt;&lt;span style=&quot;font-family: inherit;&quot;&gt;&lt;br /&gt;
        &lt;/span&gt;&lt;li&gt;&lt;a href=&quot;https://www.ee-diary.net/2021/03/two-transistor-fm-transmitter.html&quot;&gt;&lt;span style=&quot;font-family: inherit;&quot;&gt;Two Transistor FM Transmitter&lt;/span&gt;&lt;/a&gt;&lt;/li&gt;&lt;/ul&gt;&lt;/li&gt;&lt;/ul&gt;&lt;br /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://www.ee-diary.net/feeds/1902814006850932099/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.ee-diary.net/2026/04/simple-super-regenerative-fm-receiver.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7437986969318338216/posts/default/1902814006850932099'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7437986969318338216/posts/default/1902814006850932099'/><link rel='alternate' type='text/html' href='http://www.ee-diary.net/2026/04/simple-super-regenerative-fm-receiver.html' title='Simple Super Regenerative FM Receiver Circuit Design'/><author><name>Unknown</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEj_Ynb8NylW492GyOJyeqo3mCHOj8DUoegZ99HfVtuPiQB1kAtOjQezHhQP1xBYcQX-zb2CvbHCSfC26WBJCZTbHeFva50E59DRa-XBwqJxY-YNFuEyHeymk4_azXd3ziBRavgp3ARCHabYQKuI0G8EmWn3rpzYtERNKvAEWb5YbjGdCEAflo48jXGarqfy/s72-c/Simple%20Super%20Regenerative%20FM%20Receiver%20Circuit%20Design.png" height="72" width="72"/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-7437986969318338216.post-3695549838882425250</id><published>2026-04-15T22:25:00.002+05:45</published><updated>2026-04-15T22:31:52.432+05:45</updated><category scheme="http://www.blogger.com/atom/ns#" term="arduino"/><category scheme="http://www.blogger.com/atom/ns#" term="buck converter"/><category scheme="http://www.blogger.com/atom/ns#" term="IRLZ44N"/><category scheme="http://www.blogger.com/atom/ns#" term="LM2595"/><category scheme="http://www.blogger.com/atom/ns#" term="LM35"/><category scheme="http://www.blogger.com/atom/ns#" term="PID control"/><title type='text'>Closed-loop Temperature Controller with Arduino</title><content type='html'>&lt;p&gt;Here I am redesigning the closed loop temperature controller with Arduino that I had I designed and illustrated in&amp;nbsp;&lt;a href=&quot;https://www.ee-diary.net/2024/11/building-automatic-temperature.html&quot;&gt;Building an Automatic Temperature Controller Using Arduino and a PID Algorithm&lt;/a&gt;. While the circuit works, I wanted to make some improvements.&lt;/p&gt;&lt;h3 style=&quot;text-align: left;&quot;&gt;Circuit Diagram/Hardware&lt;/h3&gt;&lt;p&gt;Following shows the circuit diagram of the improved version of the closed loop temperature controller with Arduino Uno.&lt;/p&gt;&lt;p&gt;&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhQ6qN_q0vFAru_t6hkTZ9Frc3eForFSMlKu7sOnCE3NbrUL2RIW4SyeeMMTW_xZ5jD8nHHiwGr5l3hRMzjlqtrxHxvPSp4oRVBDloIHol4e46K27B7Mmn836BUUhGAN4tsWHPWjz82y47tizX2fZRaAj1ML5wmqFncfZYz74xMbPFyNCWR0SRFSgZUSVad/s810/7.png&quot; style=&quot;margin-left: 1em; margin-right: 1em; text-align: center;&quot;&gt;&lt;img alt=&quot;Closed-loop Temperature Controller with Arduino&quot; border=&quot;0&quot; data-original-height=&quot;544&quot; data-original-width=&quot;810&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhQ6qN_q0vFAru_t6hkTZ9Frc3eForFSMlKu7sOnCE3NbrUL2RIW4SyeeMMTW_xZ5jD8nHHiwGr5l3hRMzjlqtrxHxvPSp4oRVBDloIHol4e46K27B7Mmn836BUUhGAN4tsWHPWjz82y47tizX2fZRaAj1ML5wmqFncfZYz74xMbPFyNCWR0SRFSgZUSVad/s16000/7.png&quot; title=&quot;Closed-loop Temperature Controller with Arduino&quot; /&gt;&lt;/a&gt;&lt;/p&gt;&lt;p&gt;The following shows the previous circuit that was working fine but needed improvements.&lt;/p&gt;&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhZAcpZIOgIDoyDVWg3HefzShyTlxnYpmhz_SN5hrU7N1ya7ZqVfzOLiYQdL09kXQiUBt4V4ruN2YpM26zS0kjiW4wiYU9hsX_rRiCPYVXxqexBz9bzZT6DecBL4Fm5cW7ZEUHgkxRSckgStAIs35JxLRxzzB0nmwoqaxw718sRN9_81-vbK8bolwGcbEkf/s1179/Automatic%20Temperature%20Controller.png&quot; style=&quot;margin-left: 1em; margin-right: 1em; text-align: center;&quot;&gt;&lt;img border=&quot;0&quot; data-original-height=&quot;598&quot; data-original-width=&quot;1179&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhZAcpZIOgIDoyDVWg3HefzShyTlxnYpmhz_SN5hrU7N1ya7ZqVfzOLiYQdL09kXQiUBt4V4ruN2YpM26zS0kjiW4wiYU9hsX_rRiCPYVXxqexBz9bzZT6DecBL4Fm5cW7ZEUHgkxRSckgStAIs35JxLRxzzB0nmwoqaxw718sRN9_81-vbK8bolwGcbEkf/s16000/Automatic%20Temperature%20Controller.png&quot; /&gt;&lt;/a&gt;&lt;br /&gt;&lt;p&gt;In my previous design shown above, I relied on a simple 9V battery to power the Arduino, which was a weak point for long-term use. To solve this, &lt;b data-index-in-node=&quot;134&quot; data-path-to-node=&quot;0&quot;&gt;I integrated an LM2595 Buck Converter&lt;/b&gt; to pull power directly from the main 12V supply. By stepping this down to 5V, I eliminated the need for a second battery and improved the overall efficiency of the system.&lt;/p&gt;&lt;p data-path-to-node=&quot;1&quot;&gt;I also upgraded the switching stage. While the IRF540N used previously is powerful, it isn&#39;t a &quot;Logic Level&quot; MOSFET and doesn&#39;t fully activate at the 5V provided by the Arduino. &lt;b data-index-in-node=&quot;178&quot; data-path-to-node=&quot;1&quot;&gt;I swapped it for an IRLZ44N&lt;/b&gt;, which is designed specifically for 5V logic. This change ensures the MOSFET conducts fully and stays cool, allowing the bulb to receive maximum power.&lt;/p&gt;&lt;p data-path-to-node=&quot;2&quot;&gt;To clean up the power delivery, &lt;b data-index-in-node=&quot;32&quot; data-path-to-node=&quot;2&quot;&gt;I added a filtering network&lt;/b&gt; using 220µF and 120µF capacitors. These smooth out voltage spikes and ripples from the regulator. I also included a &lt;b data-index-in-node=&quot;176&quot; data-path-to-node=&quot;2&quot;&gt;1N5822 Schottky diode&lt;/b&gt;—a critical addition because its fast-switching speed and low forward voltage are essential for the high-frequency operation of the buck converter.&lt;/p&gt;&lt;p data-path-to-node=&quot;3&quot;&gt;Finally, I stabilized the temperature sensing by &lt;b data-index-in-node=&quot;49&quot; data-path-to-node=&quot;3&quot;&gt;powering the LM35 directly from the regulated 5V output&lt;/b&gt;. In the older version, the sensor shared a rail with a fluctuating battery; now, it has a rock-solid reference voltage for more accurate readings. I also added a gate resistor network (R1 and R2) to ensure the MOSFET gate discharges properly, preventing the load from staying partially active.&lt;/p&gt;&lt;h3&gt;Code for the Temperature Controller&lt;/h3&gt;&lt;p&gt;Below is the code for the PID-based temperature controller. This will measure the temperature from the LM35 sensor and adjust the power to the heating element to maintain a set temperature (25°C) using a relay.&lt;/p&gt;&lt;pre lang=&quot;cpp&quot;&gt;&lt;code&gt;// Pin Definitions
const int tempSensorPin = A0; // LM35 Temperature Sensor connected to A0
const int heaterPin = 9;      // Heater connected to PWM pin 9

// Parameters for optimal control
float Kp = 2.5; // Proportional gain
float Ki = 0.5; // Integral gain
float Kd = 0.1; // Derivative gain

// Variables for control
float setPoint = 30.0; // Desired temperature in °C
float currentTemp = 0.0; // Current temperature reading
float error = 0.0;       // Error value
float previousError = 0.0; // Previous error for derivative term
float integral = 0.0;    // Integral accumulator
float output = 0.0;      // Output PWM value

void setup() {
  Serial.begin(9600);
  pinMode(heaterPin, OUTPUT);
  Serial.println(&quot;Automatic Temperature Controller&quot;);
}

void loop() {
  // Read temperature from LM35 sensor
  int sensorValue = analogRead(tempSensorPin);
  currentTemp = (sensorValue * 5.0 / 1023.0) * 100.0; // Convert to Celsius

  // Calculate error
  error = setPoint - currentTemp;

  // Calculate integral term
  integral += error;

  // Calculate derivative term
  float derivative = error - previousError;

  // Compute control output
  output = Kp * error + Ki * integral + Kd * derivative;

  // Limit output to PWM range (0-255)
  output = constrain(output, 0, 255);

  // Apply control to heater
  analogWrite(heaterPin, output);

  // Update previous error
  previousError = error;

  // Print for monitoring
  Serial.print(&quot;Temperature: &quot;);
  Serial.print(currentTemp);
  Serial.print(&quot; °C, Output: &quot;);
  Serial.println(output);

  // Delay for stability
  delay(1000);
}&lt;/code&gt;&lt;/pre&gt;&lt;h3&gt;How the Code Works&lt;/h3&gt;&lt;div&gt;This code implements a &lt;b data-index-in-node=&quot;23&quot; data-path-to-node=&quot;0&quot;&gt;PID (Proportional-Integral-Derivative) control algorithm&lt;/b&gt; to maintain a target temperature of &lt;b data-index-in-node=&quot;116&quot; data-path-to-node=&quot;0&quot;&gt;30°C&lt;/b&gt;. It begins by reading the analog signal from the &lt;b data-index-in-node=&quot;170&quot; data-path-to-node=&quot;0&quot;&gt;LM35 sensor&lt;/b&gt;, converting that value into a Celsius temperature, and calculating the &lt;b data-index-in-node=&quot;253&quot; data-path-to-node=&quot;0&quot;&gt;error&lt;/b&gt;—the difference between the desired setpoint and the actual reading. The script then computes three distinct terms: the &lt;b data-index-in-node=&quot;378&quot; data-path-to-node=&quot;0&quot;&gt;Proportional&lt;/b&gt; term reacts to the current error, the &lt;b data-index-in-node=&quot;429&quot; data-path-to-node=&quot;0&quot;&gt;Integral&lt;/b&gt; term accounts for accumulated past errors to eliminate steady state offset, and the &lt;b data-index-in-node=&quot;522&quot; data-path-to-node=&quot;0&quot;&gt;Derivative&lt;/b&gt; term predicts future error trends to prevent overshoot. These components are summed to generate a control signal, which is constrained to a &lt;b data-index-in-node=&quot;673&quot; data-path-to-node=&quot;0&quot;&gt;0–255 PWM range&lt;/b&gt; and sent to the heater via pin 9, effectively adjusting the heat output in real-time to achieve a stable temperature.&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;&lt;b&gt;Video&lt;/b&gt; : How I made the circuit in Proteus&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;&lt;iframe allowfullscreen=&quot;&quot; class=&quot;BLOG_video_class&quot; height=&quot;467&quot; src=&quot;https://www.youtube.com/embed/X9SRaGuVy3A&quot; width=&quot;561&quot; youtube-src-id=&quot;X9SRaGuVy3A&quot;&gt;&lt;/iframe&gt;&lt;/div&gt;&lt;br /&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;&lt;b&gt;Related:&lt;/b&gt;&lt;/div&gt;&lt;div style=&quot;text-align: left;&quot;&gt;&lt;ul style=&quot;text-align: left;&quot;&gt;&lt;li&gt;&lt;a href=&quot;https://www.ee-diary.net/2024/11/how-to-use-arduino-as-pid-controller.html&quot;&gt;How to Use Arduino as a PID Controller with Sensors&lt;/a&gt;&lt;/li&gt;&lt;li&gt;&lt;a href=&quot;https://www.ee-diary.net/2023/04/arduino-pid-controller-temperature-pid.html&quot;&gt;Arduino PID Controller - Temperature PID Controller&lt;/a&gt;&lt;/li&gt;&lt;li&gt;&lt;a href=&quot;https://www.ee-diary.net/2025/03/pc-laptop-motherboard-pid-temperature.html&quot;&gt;PC Laptop Motherboard PID Temperature Controller with Arduino&lt;/a&gt;&lt;/li&gt;&lt;/ul&gt;&lt;/div&gt;&lt;br /&gt;</content><link rel='replies' type='application/atom+xml' href='http://www.ee-diary.net/feeds/3695549838882425250/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.ee-diary.net/2026/04/closed-loop-temperature-controller-with.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7437986969318338216/posts/default/3695549838882425250'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7437986969318338216/posts/default/3695549838882425250'/><link rel='alternate' type='text/html' href='http://www.ee-diary.net/2026/04/closed-loop-temperature-controller-with.html' title='Closed-loop Temperature Controller with Arduino'/><author><name>Unknown</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhQ6qN_q0vFAru_t6hkTZ9Frc3eForFSMlKu7sOnCE3NbrUL2RIW4SyeeMMTW_xZ5jD8nHHiwGr5l3hRMzjlqtrxHxvPSp4oRVBDloIHol4e46K27B7Mmn836BUUhGAN4tsWHPWjz82y47tizX2fZRaAj1ML5wmqFncfZYz74xMbPFyNCWR0SRFSgZUSVad/s72-c/7.png" height="72" width="72"/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-7437986969318338216.post-3709075802634488812</id><published>2026-04-14T22:45:00.003+05:45</published><updated>2026-04-14T22:45:19.937+05:45</updated><category scheme="http://www.blogger.com/atom/ns#" term="AM"/><category scheme="http://www.blogger.com/atom/ns#" term="AM modulator"/><category scheme="http://www.blogger.com/atom/ns#" term="RF circuit"/><title type='text'>How to Design Amplitude Modulator (AM) using Differential Amplifier - Improved Version</title><content type='html'>&lt;div class=&quot;separator&quot; style=&quot;display: none;&quot;&gt;&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgTCtyQqo5z15udkZA4BVto_O45YFsr1b2NNlFZQsAk30kch32kzxVxZVlb8amAHPjiEFbTeFKo0B94tTWnvHCJ_uJ7Vwlr4R5XrI_vWwIHsfK29atztePATJXHmte1AZMp2biI9JZs7rCFYJ03NIoJkIWsITVaVL7ElDplgBzGqLlDCAxLRUA5vKkRYivb/s1600/am_modulator_thumbnail.png&quot; style=&quot;display: block; padding: 1em 0px; text-align: center;&quot;&gt;&lt;img alt=&quot;am_modulator_thumbnail&quot; border=&quot;0&quot; data-original-height=&quot;720&quot; data-original-width=&quot;1280&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgTCtyQqo5z15udkZA4BVto_O45YFsr1b2NNlFZQsAk30kch32kzxVxZVlb8amAHPjiEFbTeFKo0B94tTWnvHCJ_uJ7Vwlr4R5XrI_vWwIHsfK29atztePATJXHmte1AZMp2biI9JZs7rCFYJ03NIoJkIWsITVaVL7ElDplgBzGqLlDCAxLRUA5vKkRYivb/s1600/am_modulator_thumbnail.png&quot; /&gt;&lt;/a&gt;&lt;/div&gt;&lt;p&gt;&lt;span style=&quot;font-family: inherit;&quot;&gt;&amp;nbsp;I had designed a&amp;nbsp;&lt;a href=&quot;https://www.ee-diary.net/2021/12/am-modulator-using-bjt-transistor.html&quot;&gt;Differential Amplifier AM Modulator&lt;/a&gt; previously and found that I should make some correction to the circuit as an improvement. The differential amplifier AM (Amplitude Modulation) is also called &quot;Long-Tailed Pair&quot; modulator. Here I will write about the flaws in the previous differential amplifier based AM modulator for AM transmitter and the correctness I have done.&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style=&quot;font-family: inherit;&quot;&gt;The circuit is shown below.&lt;/span&gt;&lt;/p&gt;&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEi_NASR7PlVxEZavM1_ABAIK0VkSmGP4tBvVUDmAxA59OlesA1bnapJYaKVE7KavRNF65b3ENpAOZF3EI7oNHarAyGAjvPhfb2_uZwCd1OoN7XzepQk79GNiq3TMSfkjbHzVcL_5bvIJMycjpUx8BWUc351prW7t5zKm8VjKwU0vy3ox5cNOS1HFQCqemNm/s1020/am%20circuit.png&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;span style=&quot;font-family: inherit;&quot;&gt;&lt;img alt=&quot;Differential Amplifier AM Modulator&quot; border=&quot;0&quot; data-original-height=&quot;537&quot; data-original-width=&quot;1020&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEi_NASR7PlVxEZavM1_ABAIK0VkSmGP4tBvVUDmAxA59OlesA1bnapJYaKVE7KavRNF65b3ENpAOZF3EI7oNHarAyGAjvPhfb2_uZwCd1OoN7XzepQk79GNiq3TMSfkjbHzVcL_5bvIJMycjpUx8BWUc351prW7t5zKm8VjKwU0vy3ox5cNOS1HFQCqemNm/s16000/am%20circuit.png&quot; title=&quot;Differential Amplifier AM Modulator&quot; /&gt;&lt;/span&gt;&lt;/a&gt;&lt;/div&gt;&lt;p&gt;&lt;span style=&quot;font-family: inherit;&quot;&gt;The differential amplifier-based AM modulator is much better and linear than a &lt;a href=&quot;https://www.ee-diary.net/2022/06/am-transmitter-using-single-diode.html&quot;&gt;diode-based AM modulator&lt;/a&gt;. In the above circuit, the transistor&amp;nbsp;&lt;b data-index-in-node=&quot;49&quot; data-path-to-node=&quot;1&quot;&gt;Q3&lt;/b&gt; acts as a voltage-controlled current source that &quot;feeds&quot; the differential pair (&lt;b data-index-in-node=&quot;127&quot; data-path-to-node=&quot;1&quot;&gt;Q1&lt;/b&gt; and &lt;b data-index-in-node=&quot;134&quot; data-path-to-node=&quot;1&quot;&gt;Q2&lt;/b&gt;). This circuit is actually a Gilbert mixer that multiplies the carrier (&lt;span class=&quot;math-inline&quot; data-index-in-node=&quot;101&quot; data-math=&quot;V_c&quot; style=&quot;line-height: 1.15; margin-top: 0px;&quot;&gt;$V_c$&lt;/span&gt;) and the modulating audio (&lt;span class=&quot;math-inline&quot; data-index-in-node=&quot;132&quot; data-math=&quot;V_m&quot; style=&quot;line-height: 1.15; margin-top: 0px;&quot;&gt;$V_m$&lt;/span&gt;) and results in much lower harmonic distortion. Also, by using &lt;b data-index-in-node=&quot;23&quot; data-path-to-node=&quot;4,1,0&quot;&gt;BAT1&lt;/b&gt; and &lt;b data-index-in-node=&quot;32&quot; data-path-to-node=&quot;4,1,0&quot;&gt;BAT2&lt;/b&gt; (±3.7V) gives the circuit good &quot;headroom,&quot; which helps keep the transistors in their linear region.&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;b&gt;&lt;span style=&quot;font-family: inherit;&quot;&gt;Problems &amp;amp; Solutions&lt;/span&gt;&lt;/b&gt;&lt;/p&gt;&lt;p data-path-to-node=&quot;6&quot; style=&quot;line-height: 1.15; margin-top: 0px;&quot;&gt;&lt;span style=&quot;font-family: inherit;&quot;&gt;While the circuit topology is ok, there are a few errors in the wiring and component values that might cause it to fail.&amp;nbsp;&lt;/span&gt;&lt;/p&gt;&lt;ul data-path-to-node=&quot;7&quot; style=&quot;line-height: 1.15; margin-top: 0px; padding-inline-start: 32px;&quot;&gt;&lt;li style=&quot;line-height: 1.15; margin-top: 0px;&quot;&gt;&lt;p data-path-to-node=&quot;7,0,0&quot; style=&quot;line-height: 1.15; margin-top: 0px;&quot;&gt;&lt;span style=&quot;font-family: inherit;&quot;&gt;&lt;b data-index-in-node=&quot;0&quot; data-path-to-node=&quot;7,0,0&quot; style=&quot;line-height: 1.15; margin-top: 0px;&quot;&gt;The Output Tank (C1):&lt;/b&gt;&amp;nbsp;I had set&amp;nbsp;&lt;span class=&quot;math-inline&quot; data-index-in-node=&quot;31&quot; data-math=&quot;C1&quot; style=&quot;line-height: 1.15; margin-top: 0px;&quot;&gt;$C1$&lt;/span&gt; set to &lt;b data-index-in-node=&quot;41&quot; data-path-to-node=&quot;7,0,0&quot; style=&quot;line-height: 1.15; margin-top: 0px;&quot;&gt;$0.1\mu F$&lt;/b&gt;.&lt;/span&gt;&lt;/p&gt;&lt;/li&gt;&lt;ul data-path-to-node=&quot;7,0,1&quot; style=&quot;line-height: 1.15; margin-top: 0px; padding-inline-start: 32px;&quot;&gt;&lt;li style=&quot;line-height: 1.15; margin-top: 0px;&quot;&gt;&lt;p data-path-to-node=&quot;7,0,1,0,0&quot; style=&quot;line-height: 1.15; margin-top: 0px;&quot;&gt;&lt;span style=&quot;font-family: inherit;&quot;&gt;&lt;b data-index-in-node=&quot;0&quot; data-path-to-node=&quot;7,0,1,0,0&quot; style=&quot;line-height: 1.15; margin-top: 0px;&quot;&gt;The Problem:&lt;/b&gt; At any RF frequency (like 1MHz), a &lt;span class=&quot;math-inline&quot; data-index-in-node=&quot;48&quot; data-math=&quot;0.1\mu F&quot; style=&quot;line-height: 1.15; margin-top: 0px;&quot;&gt;$0.1\mu F$&lt;/span&gt; capacitor has almost zero impedance. It will short your entire output signal directly to ground.&amp;nbsp;If the inductor&amp;nbsp;&lt;span class=&quot;math-inline&quot; data-index-in-node=&quot;26&quot; data-math=&quot;L1&quot; style=&quot;line-height: 1.15; margin-top: 0px;&quot;&gt;$L1$&lt;/span&gt;&amp;nbsp;is&amp;nbsp;&lt;span class=&quot;math-inline&quot; data-index-in-node=&quot;32&quot; data-math=&quot;25.36\mu H&quot; style=&quot;line-height: 1.15; margin-top: 0px;&quot;&gt;$25.36\mu H$&lt;/span&gt;&amp;nbsp;and we want to it working in the AM band (~1MHz),&amp;nbsp;&lt;span class=&quot;math-inline&quot; data-index-in-node=&quot;90&quot; data-math=&quot;C1&quot; style=&quot;line-height: 1.15; margin-top: 0px;&quot;&gt;$C1$&lt;/span&gt;&amp;nbsp;should be changed to around&amp;nbsp;&lt;b data-index-in-node=&quot;110&quot; data-path-to-node=&quot;7,0,1,1,0&quot; style=&quot;line-height: 1.15; margin-top: 0px;&quot;&gt;&lt;span class=&quot;math-inline&quot; data-index-in-node=&quot;110&quot; data-math=&quot;1000pF&quot; style=&quot;line-height: 1.15; margin-top: 0px;&quot;&gt;$1000pF$&lt;/span&gt;&amp;nbsp;(&lt;span class=&quot;math-inline&quot; data-index-in-node=&quot;118&quot; data-math=&quot;1nF&quot; style=&quot;line-height: 1.15; margin-top: 0px;&quot;&gt;$1nF$&lt;/span&gt;)&lt;/b&gt;. The LC then resonant at 1MHz(AM band)&lt;/span&gt;&lt;/p&gt;&lt;/li&gt;&lt;li style=&quot;line-height: 1.15; margin-top: 0px;&quot;&gt;&lt;p data-path-to-node=&quot;7,0,1,1,0&quot; style=&quot;line-height: 1.15; margin-top: 0px;&quot;&gt;&lt;span style=&quot;font-family: inherit;&quot;&gt;&lt;b data-index-in-node=&quot;0&quot; data-path-to-node=&quot;7,0,1,1,0&quot; style=&quot;line-height: 1.15; margin-top: 0px;&quot;&gt;The Fix:&lt;/b&gt;&lt;span data-index-in-node=&quot;0&quot; data-path-to-node=&quot;7,0,1,1,0&quot; style=&quot;line-height: 1.15; margin-top: 0px;&quot;&gt;&amp;nbsp;However, I changed both the values of L1 and C1. I opted for L1=100uH and C1=250pF which is standard values used in actual radios.&amp;nbsp;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;/li&gt;&lt;/ul&gt;&lt;/ul&gt;&lt;div&gt;&lt;p data-path-to-node=&quot;4&quot; style=&quot;line-height: 1.15; margin-top: 0px;&quot;&gt;&lt;span data-index-in-node=&quot;0&quot; data-path-to-node=&quot;4&quot; style=&quot;line-height: 1.15; margin-top: 0px;&quot;&gt;&lt;span style=&quot;font-family: inherit;&quot;&gt;The Math:&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;div data-path-to-node=&quot;5&quot; style=&quot;line-height: 1.15; margin-top: 0px;&quot;&gt;&lt;div class=&quot;math-block&quot; data-math=&quot;f = \frac{1}{2\pi\sqrt{100\mu\text{H} \times 250\text{pF}}} \approx 1.006\text{ MHz}&quot; style=&quot;line-height: 1.15; margin-top: 0px;&quot;&gt;&lt;span style=&quot;font-family: inherit;&quot;&gt;$$f = \frac{1}{2\pi\sqrt{100\mu\text{H} \times 250\text{pF}}} \approx 1.006\text{ MHz}$$&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;math-block&quot; data-math=&quot;f = \frac{1}{2\pi\sqrt{100\mu\text{H} \times 250\text{pF}}} \approx 1.006\text{ MHz}&quot; style=&quot;line-height: 1.15; margin-top: 0px;&quot;&gt;&lt;span style=&quot;font-family: inherit;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;&lt;/div&gt;&lt;/div&gt;&lt;ul data-path-to-node=&quot;7&quot; style=&quot;line-height: 1.15; margin-top: 0px; padding-inline-start: 32px;&quot;&gt;&lt;li style=&quot;line-height: 1.15; margin-top: 0px;&quot;&gt;&lt;p data-path-to-node=&quot;7,1,0&quot; style=&quot;line-height: 1.15; margin-top: 0px;&quot;&gt;&lt;span style=&quot;font-family: inherit;&quot;&gt;&lt;b data-index-in-node=&quot;0&quot; data-path-to-node=&quot;7,1,0&quot; style=&quot;line-height: 1.15; margin-top: 0px;&quot;&gt;Transistor Biasing (Q3):&lt;/b&gt;&amp;nbsp;At the carrier input there is the diode (&lt;b data-index-in-node=&quot;43&quot; data-path-to-node=&quot;7,1,0&quot; style=&quot;line-height: 1.15; margin-top: 0px;&quot;&gt;D1&lt;/b&gt;) and a resistor (&lt;b data-index-in-node=&quot;63&quot; data-path-to-node=&quot;7,1,0&quot; style=&quot;line-height: 1.15; margin-top: 0px;&quot;&gt;R3&lt;/b&gt;) connected at the base of &lt;span class=&quot;math-inline&quot; data-index-in-node=&quot;82&quot; data-math=&quot;Q3&quot; style=&quot;line-height: 1.15; margin-top: 0px;&quot;&gt;$Q3$&lt;/span&gt;, but the base is also connected directly to the &lt;span class=&quot;math-inline&quot; data-index-in-node=&quot;133&quot; data-math=&quot;V_c&quot; style=&quot;line-height: 1.15; margin-top: 0px;&quot;&gt;$V_c$&lt;/span&gt; input.&lt;/span&gt;&lt;/p&gt;&lt;/li&gt;&lt;ul data-path-to-node=&quot;7,1,1&quot; style=&quot;line-height: 1.15; margin-top: 0px; padding-inline-start: 32px;&quot;&gt;&lt;li style=&quot;line-height: 1.15; margin-top: 0px;&quot;&gt;&lt;p data-path-to-node=&quot;7,1,1,0,0&quot; style=&quot;line-height: 1.15; margin-top: 0px;&quot;&gt;&lt;span style=&quot;font-family: inherit;&quot;&gt;&lt;b data-index-in-node=&quot;0&quot; data-path-to-node=&quot;7,1,1,0,0&quot; style=&quot;line-height: 1.15; margin-top: 0px;&quot;&gt;The Fix:&lt;/b&gt;&amp;nbsp;We need a coupling capacitor (e.g., &lt;b data-index-in-node=&quot;46&quot; data-path-to-node=&quot;7,1,1,0,0&quot; style=&quot;line-height: 1.15; margin-top: 0px;&quot;&gt;100nF&lt;/b&gt;) between your &lt;span class=&quot;math-inline&quot; data-index-in-node=&quot;66&quot; data-math=&quot;V_c&quot; style=&quot;line-height: 1.15; margin-top: 0px;&quot;&gt;$V_c$&lt;/span&gt; source and the base of &lt;span class=&quot;math-inline&quot; data-index-in-node=&quot;93&quot; data-math=&quot;Q3&quot; style=&quot;line-height: 1.15; margin-top: 0px;&quot;&gt;$Q3$&lt;/span&gt;. Without it, the DC offset from the signal generator will fight with the biasing of &lt;span class=&quot;math-inline&quot; data-index-in-node=&quot;179&quot; data-math=&quot;D1/R3&quot; style=&quot;line-height: 1.15; margin-top: 0px;&quot;&gt;$D1/R3$&lt;/span&gt;. Similarly, I added coupling capacitor C3 of 10uF at the audio signal input for not disturbing the biasing circuit that follows it.&lt;/span&gt;&lt;/p&gt;&lt;/li&gt;&lt;/ul&gt;&lt;li&gt;&lt;span style=&quot;font-family: inherit;&quot;&gt;&lt;b&gt;Diode(D1) Orientation&lt;/b&gt;: In the original circuit, the diode D1 was oriented downwards (Cathode to Ground, Anode to Base). I changed the orientation (Anode to Ground, Cathode to Base). The diode acts as a &lt;span data-index-in-node=&quot;20&quot; data-path-to-node=&quot;0&quot; style=&quot;line-height: 1.15; margin-top: 0px;&quot;&gt;DC voltage reference&lt;/span&gt; that sets the &quot;idle&quot; current for the entire circuit by clamping the base of the tail transistor (&lt;span class=&quot;math-inline&quot; data-index-in-node=&quot;138&quot; data-math=&quot;Q3&quot; style=&quot;line-height: 1.15; margin-top: 0px;&quot;&gt;$Q3$&lt;/span&gt;). In the original orientation, it held the base at &lt;span data-index-in-node=&quot;192&quot; data-path-to-node=&quot;0&quot; style=&quot;line-height: 1.15; margin-top: 0px;&quot;&gt;$+0.7\text{V}$&lt;/span&gt;, forcing excessive current that pushed the signal against the supply rail and caused top-side clipping. By reversing the diode to clamp the base at &lt;span data-index-in-node=&quot;353&quot; data-path-to-node=&quot;0&quot; style=&quot;line-height: 1.15; margin-top: 0px;&quot;&gt;$-0.7\text{V}$&lt;/span&gt;, you reduced the total current and shifted the signal’s operating point into the center of your &lt;span data-index-in-node=&quot;462&quot; data-path-to-node=&quot;0&quot; style=&quot;line-height: 1.15; margin-top: 0px;&quot;&gt;$7.4\text{V}$&lt;/span&gt; window, providing equal headroom for the waveform to swing both up and down symmetrically.&lt;/span&gt;&lt;/li&gt;&lt;/ul&gt;&lt;ul data-path-to-node=&quot;7&quot; style=&quot;line-height: 1.15; margin-top: 0px; padding-inline-start: 32px;&quot;&gt;&lt;li&gt;&lt;span style=&quot;font-family: inherit;&quot;&gt;Emitter Resistor:&amp;nbsp;I changed the emitter resistor (previously labelled R5 now R1) value from 10k to 470ohm. R1 sets the &quot;gain&quot; of your modulator. By reducing it, you shifted the circuit from a &quot;stiff,&quot; low-current mode to a &lt;span data-index-in-node=&quot;126&quot; data-path-to-node=&quot;3&quot;&gt;high-sensitivity, high-gain mode&lt;/span&gt;, making it much more efficient at translating your carrier signal into a strong AM wave.&lt;/span&gt;&lt;/li&gt;&lt;/ul&gt;&lt;ul data-path-to-node=&quot;7&quot; style=&quot;line-height: 1.15; margin-top: 0px; padding-inline-start: 32px;&quot;&gt;&lt;li style=&quot;line-height: 1.15; margin-top: 0px;&quot;&gt;&lt;p data-path-to-node=&quot;7,2,0&quot; style=&quot;line-height: 1.15; margin-top: 0px;&quot;&gt;&lt;span style=&quot;font-family: inherit;&quot;&gt;&lt;b data-index-in-node=&quot;0&quot; data-path-to-node=&quot;7,2,0&quot; style=&quot;line-height: 1.15; margin-top: 0px;&quot;&gt;Load Balancing:&lt;/b&gt; &lt;span class=&quot;math-inline&quot; data-index-in-node=&quot;16&quot; data-math=&quot;R2&quot; style=&quot;line-height: 1.15; margin-top: 0px;&quot;&gt;$R2$&lt;/span&gt; and &lt;span class=&quot;math-inline&quot; data-index-in-node=&quot;23&quot; data-math=&quot;R6&quot; style=&quot;line-height: 1.15; margin-top: 0px;&quot;&gt;$R6$&lt;/span&gt; are &lt;span class=&quot;math-inline&quot; data-index-in-node=&quot;30&quot; data-math=&quot;4.7k\Omega&quot; style=&quot;line-height: 1.15; margin-top: 0px;&quot;&gt;$4.7k\Omega$&lt;/span&gt;. This is a bit high for high-frequency RF if you have any parasitic capacitance. Dropping them to &lt;b data-index-in-node=&quot;139&quot; data-path-to-node=&quot;7,2,0&quot; style=&quot;line-height: 1.15; margin-top: 0px;&quot;&gt;$1k\Omega$&lt;/b&gt; will give you a &quot;sharper&quot; response at the cost of a little gain.&lt;/span&gt;&lt;/p&gt;&lt;/li&gt;&lt;li style=&quot;line-height: 1.15; margin-top: 0px;&quot;&gt;&lt;p data-path-to-node=&quot;7,2,0&quot; style=&quot;line-height: 1.15; margin-top: 0px;&quot;&gt;&lt;span style=&quot;font-family: inherit;&quot;&gt;&lt;b&gt;Transistors&lt;/b&gt;: I replaced the&amp;nbsp;2N5550 BJT transistor with 2N3904 for better RF speed. When choosing a transistor for RF (Radio Frequency), the most important specification is the &lt;b data-index-in-node=&quot;93&quot; data-path-to-node=&quot;1&quot; style=&quot;line-height: 1.15; margin-top: 0px;&quot;&gt;Transition Frequency (&lt;span class=&quot;math-inline&quot; data-index-in-node=&quot;115&quot; data-math=&quot;f_T&quot; style=&quot;line-height: 1.15; margin-top: 0px;&quot;&gt;$f_T$&lt;/span&gt;)&lt;/b&gt;. This is the frequency at which the transistor&#39;s gain drops to &lt;b data-index-in-node=&quot;183&quot; data-path-to-node=&quot;1&quot; style=&quot;line-height: 1.15; margin-top: 0px;&quot;&gt;1&lt;/b&gt;. To get good performance, you want an &lt;span class=&quot;math-inline&quot; data-index-in-node=&quot;223&quot; data-math=&quot;f_T&quot; style=&quot;line-height: 1.15; margin-top: 0px;&quot;&gt;$f_T$&lt;/span&gt; that is much higher than your operating frequency (1 MHz to 4 MHz).&lt;/span&gt;&lt;/p&gt;&lt;/li&gt;&lt;li style=&quot;line-height: 1.15; margin-top: 0px;&quot;&gt;&lt;p data-path-to-node=&quot;7,2,0&quot; style=&quot;line-height: 1.15; margin-top: 0px;&quot;&gt;&lt;span style=&quot;font-family: inherit;&quot;&gt;&lt;b&gt;Practical Values&lt;/b&gt;: In the circuit I have used exact values but for practical build, I replaced them with real world actually available 220uH inductor and capacitor (100) values.&lt;/span&gt;&lt;/p&gt;&lt;/li&gt;&lt;/ul&gt;&lt;div&gt;&lt;span style=&quot;font-family: inherit;&quot;&gt;Below is the correct differential amplifier AM modulator circuit diagram designed to work at 1MHz carrier frequency.&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span style=&quot;font-family: inherit;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiDwwIJz40oIGtegrZ-zK4NQybxno82Wtq4flXJTChJKYZFL2lLV21hS5IQp2DE4VxaRJ47lgcbo7Hc_CmnWCozn1NlOvopFnBR1npSYFZO5PvjgtiHOZOrOtox02nN5z4DWYstjhyQwFZO3zffmKs4V9xsnsOXQiHNkbP8b40ikyDIq5hFbFstEBusNWeY/s950/diff%20amp%20AM%20modulator.png&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img alt=&quot;differential amplifier AM modulator&quot; border=&quot;0&quot; data-original-height=&quot;549&quot; data-original-width=&quot;950&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiDwwIJz40oIGtegrZ-zK4NQybxno82Wtq4flXJTChJKYZFL2lLV21hS5IQp2DE4VxaRJ47lgcbo7Hc_CmnWCozn1NlOvopFnBR1npSYFZO5PvjgtiHOZOrOtox02nN5z4DWYstjhyQwFZO3zffmKs4V9xsnsOXQiHNkbP8b40ikyDIq5hFbFstEBusNWeY/s16000/diff%20amp%20AM%20modulator.png&quot; title=&quot;differential amplifier AM modulator&quot; /&gt;&lt;/a&gt;&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;The below picture shows message signal, the carrier signal, the AM signal on an oscilloscope.&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgcIhkluHjzXU1foAk7-Ve0uSwmyyDrifEYRuq_QHVsDOPP6_rahtZJHuXqr1rul4S5vlVL6vN-8-n094-kGFG3pS27_mevQN9-n2TgGQJbNbx6Tc44tNFTP8IkOoVz6AQJyGRISmy9NLNfHEj0jAsGUtqj1tJMyoEuHf34VheI9cyzmMd4CUQ6YD4Z2lIe/s689/oscilloscope.png&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img alt=&quot;Am signal on oscilloscope&quot; border=&quot;0&quot; data-original-height=&quot;450&quot; data-original-width=&quot;689&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgcIhkluHjzXU1foAk7-Ve0uSwmyyDrifEYRuq_QHVsDOPP6_rahtZJHuXqr1rul4S5vlVL6vN-8-n094-kGFG3pS27_mevQN9-n2TgGQJbNbx6Tc44tNFTP8IkOoVz6AQJyGRISmy9NLNfHEj0jAsGUtqj1tJMyoEuHf34VheI9cyzmMd4CUQ6YD4Z2lIe/s16000/oscilloscope.png&quot; title=&quot;Am signal on oscilloscope&quot; /&gt;&lt;/a&gt;&lt;/div&gt;&lt;br /&gt;&lt;div&gt;Below is the setting for audio and carrier signal.&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhzIxbI2ubuTSKrfqFhbue4SO46UVc9VLz-ty4cly4jDfmaSxHl2Pg0SnzR8xUt3bo1RXfNLMrlRUc41OeotfCeYQYhg6NOhouM_vqc8yByVXDKP4vM7ekzfRw65smVNXhDlxP1Svr01vZgqd1ZebHa19A6wsgixoWTFDLvRPCvi83k66qakuO65Nyj-MK3/s505/audio.png&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img alt=&quot;audio signal&quot; border=&quot;0&quot; data-original-height=&quot;144&quot; data-original-width=&quot;505&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhzIxbI2ubuTSKrfqFhbue4SO46UVc9VLz-ty4cly4jDfmaSxHl2Pg0SnzR8xUt3bo1RXfNLMrlRUc41OeotfCeYQYhg6NOhouM_vqc8yByVXDKP4vM7ekzfRw65smVNXhDlxP1Svr01vZgqd1ZebHa19A6wsgixoWTFDLvRPCvi83k66qakuO65Nyj-MK3/s16000/audio.png&quot; title=&quot;audio signal&quot; /&gt;&lt;/a&gt;&lt;/div&gt;&lt;br /&gt;&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiKzk85S9uK8Y0Cp0J1AnPw6aWoGirHoyAzqPu1TfQLYjIMLFVHKwh4sT49CekjbxFydZoKy36KzZyQ4QQIo8JZb4uja9umJTjhkyiwbZBr6a9zJ-bwbfis6R_gCeq7i0efQKBbExGXoUsI5aZ19XsrfcXEU1voCPSwU_7qkfzTjm7jb0eF8pa6-cSk3YBZ/s505/carrier.png&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img alt=&quot;carrier signal&quot; border=&quot;0&quot; data-original-height=&quot;144&quot; data-original-width=&quot;505&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiKzk85S9uK8Y0Cp0J1AnPw6aWoGirHoyAzqPu1TfQLYjIMLFVHKwh4sT49CekjbxFydZoKy36KzZyQ4QQIo8JZb4uja9umJTjhkyiwbZBr6a9zJ-bwbfis6R_gCeq7i0efQKBbExGXoUsI5aZ19XsrfcXEU1voCPSwU_7qkfzTjm7jb0eF8pa6-cSk3YBZ/s16000/carrier.png&quot; title=&quot;carrier signal&quot; /&gt;&lt;/a&gt;&lt;/div&gt;&lt;br /&gt;&lt;div&gt;Below picture shows the spectrum showing 1MHz AM signal.&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEj-mTvU30cmVUVdxZ_xjfDKZr8dXfbY0mNTSGGyDFwe_gPIFIdSXrmVzKJjJAfbPHXGzmju9J-E7pN615_pm4Zfkzm67f5Ob5SK29649QccQzEZhjs7oQfnRosx8pUi04h2Kyyj-KXYyaw1tRNFmmFNe2PyTksd9oOfhMRRPNgnxph_xcKTR7ZZmjGMr8O6/s1351/AM%20signal%20spectrum.png&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img alt=&quot;AM signal spectrum&quot; border=&quot;0&quot; data-original-height=&quot;596&quot; data-original-width=&quot;1351&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEj-mTvU30cmVUVdxZ_xjfDKZr8dXfbY0mNTSGGyDFwe_gPIFIdSXrmVzKJjJAfbPHXGzmju9J-E7pN615_pm4Zfkzm67f5Ob5SK29649QccQzEZhjs7oQfnRosx8pUi04h2Kyyj-KXYyaw1tRNFmmFNe2PyTksd9oOfhMRRPNgnxph_xcKTR7ZZmjGMr8O6/s16000/AM%20signal%20spectrum.png&quot; title=&quot;AM signal spectrum&quot; /&gt;&lt;/a&gt;&lt;/div&gt;&lt;br /&gt;&lt;div&gt;The following video shows the&amp;nbsp;Differential Amplifier AM Modulator circuit in action.&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;&lt;iframe allowfullscreen=&quot;&quot; class=&quot;BLOG_video_class&quot; height=&quot;605&quot; src=&quot;https://www.youtube.com/embed/Hr1dltaQlks&quot; width=&quot;728&quot; youtube-src-id=&quot;Hr1dltaQlks&quot;&gt;&lt;/iframe&gt;&lt;/div&gt;&lt;br /&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;&lt;b&gt;Related Tutorials&lt;/b&gt;&lt;/div&gt;&lt;div&gt;&lt;ul style=&quot;text-align: left;&quot;&gt;&lt;li&gt;&lt;a href=&quot;https://www.ee-diary.net/2021/12/how-does-single-diode-modulator-circuit.html&quot;&gt;How does Single Diode Modulator Circuit work?&lt;/a&gt;&lt;/li&gt;&lt;li&gt;&lt;a href=&quot;https://www.ee-diary.net/2022/09/am-modulator-using-mc1496-modulator.html&quot;&gt;AM modulator using MC1496 modulator(Standard AM)&lt;/a&gt;&lt;/li&gt;&lt;/ul&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://www.ee-diary.net/feeds/3709075802634488812/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.ee-diary.net/2026/04/how-to-design-amplitude-modulator-am.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7437986969318338216/posts/default/3709075802634488812'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7437986969318338216/posts/default/3709075802634488812'/><link rel='alternate' type='text/html' href='http://www.ee-diary.net/2026/04/how-to-design-amplitude-modulator-am.html' title='How to Design Amplitude Modulator (AM) using Differential Amplifier - Improved Version'/><author><name>Unknown</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgTCtyQqo5z15udkZA4BVto_O45YFsr1b2NNlFZQsAk30kch32kzxVxZVlb8amAHPjiEFbTeFKo0B94tTWnvHCJ_uJ7Vwlr4R5XrI_vWwIHsfK29atztePATJXHmte1AZMp2biI9JZs7rCFYJ03NIoJkIWsITVaVL7ElDplgBzGqLlDCAxLRUA5vKkRYivb/s72-c/am_modulator_thumbnail.png" height="72" width="72"/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-7437986969318338216.post-2810915985909192930</id><published>2026-04-13T20:38:00.001+05:45</published><updated>2026-04-13T20:38:18.216+05:45</updated><category scheme="http://www.blogger.com/atom/ns#" term="AM"/><category scheme="http://www.blogger.com/atom/ns#" term="MC1496"/><category scheme="http://www.blogger.com/atom/ns#" term="tutorial"/><title type='text'>Improving AM modulator using MC1496 modulator</title><content type='html'>&lt;p&gt;&lt;span style=&quot;font-family: inherit;&quot;&gt;&amp;nbsp;I wrote about&amp;nbsp;&lt;a href=&quot;https://www.ee-diary.net/2022/09/am-modulator-using-mc1496-modulator.html&quot;&gt;AM modulator using MC1496 modulator&lt;/a&gt;&amp;nbsp;for AM generation four year ago in 2022. While the circuit works as I have demonstrated in video which is provided below, there is room for improvements. Here I want to write down note on how to improve this AM generation circuit.&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style=&quot;font-family: inherit;&quot;&gt;Below is the circuit diagram that I posted years ago.&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;/p&gt;&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgH5b8gZGFTb10uYbCiCgcrdqHYtL-v5uHm3fovZZoI41PCP6R0Vl23vGX9UN20vjJ7JK9Bt45KeuWjXZ0hHXHAns2xxO7uBD3xP7lblYOnaEUDSCzQ5Xh7bNIbpJU_07OaWTAKMiXOZM3CbVIgjDI_x2aSul2lteGF1gqLTUbXLmMzJGw8P4WdNiwAgoJI/s1123/MC149%20amplitude%20modulator%20circuit%20diagram.jpg&quot; imageanchor=&quot;1&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img alt=&quot;AM modulator using MC1496 modulator&quot; border=&quot;0&quot; data-original-height=&quot;576&quot; data-original-width=&quot;1123&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgH5b8gZGFTb10uYbCiCgcrdqHYtL-v5uHm3fovZZoI41PCP6R0Vl23vGX9UN20vjJ7JK9Bt45KeuWjXZ0hHXHAns2xxO7uBD3xP7lblYOnaEUDSCzQ5Xh7bNIbpJU_07OaWTAKMiXOZM3CbVIgjDI_x2aSul2lteGF1gqLTUbXLmMzJGw8P4WdNiwAgoJI/s16000/MC149%20amplitude%20modulator%20circuit%20diagram.jpg&quot; title=&quot;AM modulator using MC1496 modulator&quot; /&gt;&lt;/a&gt;&lt;/div&gt;&lt;p&gt;&lt;/p&gt;&lt;p data-path-to-node=&quot;0&quot; style=&quot;line-height: 1.15 !important; margin-top: 0px !important;&quot;&gt;&lt;span style=&quot;font-family: inherit;&quot;&gt;The circuit is a standard, technically sound application of the &lt;b data-index-in-node=&quot;64&quot; data-path-to-node=&quot;0&quot; style=&quot;line-height: 1.15 !important; margin-top: 0px !important;&quot;&gt;MC1496&lt;/b&gt; for balanced modulation. The connections match the classic datasheet configurations for a dual-supply setup.&lt;/span&gt;&lt;/p&gt;&lt;p data-path-to-node=&quot;1&quot; style=&quot;line-height: 1.15 !important; margin-top: 0px !important;&quot;&gt;&lt;span style=&quot;font-family: inherit;&quot;&gt;However, &quot;correctness&quot; in RF circuits often depends on your specific goals (DSB-SC vs. AM) and the frequencies you are handling. Here are an evaluation and some practical advice for improving the circuit:&lt;/span&gt;&lt;/p&gt;&lt;h3 data-path-to-node=&quot;2&quot; style=&quot;line-height: 1.15 !important; margin-top: 0px !important;&quot;&gt;&lt;span style=&quot;font-family: inherit;&quot;&gt;1. Functional Review&lt;/span&gt;&lt;/h3&gt;&lt;ul data-path-to-node=&quot;3&quot; style=&quot;line-height: 1.15 !important; margin-top: 0px !important; padding-inline-start: 32px;&quot;&gt;&lt;li style=&quot;line-height: 1.15 !important; margin-top: 0px !important;&quot;&gt;&lt;p data-path-to-node=&quot;3,0,0&quot; style=&quot;line-height: 1.15 !important; margin-top: 0px !important;&quot;&gt;&lt;span style=&quot;font-family: inherit;&quot;&gt;&lt;b data-index-in-node=&quot;0&quot; data-path-to-node=&quot;3,0,0&quot; style=&quot;line-height: 1.15 !important; margin-top: 0px !important;&quot;&gt;Biasing:&lt;/b&gt; Your use of &lt;b data-index-in-node=&quot;21&quot; data-path-to-node=&quot;3,0,0&quot; style=&quot;line-height: 1.15 !important; margin-top: 0px !important;&quot;&gt;+12V&lt;/b&gt; and &lt;b data-index-in-node=&quot;30&quot; data-path-to-node=&quot;3,0,0&quot; style=&quot;line-height: 1.15 !important; margin-top: 0px !important;&quot;&gt;-8V&lt;/b&gt; is excellent. The MC1496 performs much better with dual supplies than single-supply biasing, as it provides better carrier suppression and simpler input interfacing.&lt;/span&gt;&lt;/p&gt;&lt;/li&gt;&lt;li style=&quot;line-height: 1.15 !important; margin-top: 0px !important;&quot;&gt;&lt;p data-path-to-node=&quot;3,1,0&quot; style=&quot;line-height: 1.15 !important; margin-top: 0px !important;&quot;&gt;&lt;span style=&quot;font-family: inherit;&quot;&gt;&lt;b data-index-in-node=&quot;0&quot; data-path-to-node=&quot;3,1,0&quot; style=&quot;line-height: 1.15 !important; margin-top: 0px !important;&quot;&gt;Impedance Matching:&lt;/b&gt; You have &lt;b data-index-in-node=&quot;29&quot; data-path-to-node=&quot;3,1,0&quot; style=&quot;line-height: 1.15 !important; margin-top: 0px !important;&quot;&gt;51Ω&lt;/b&gt; resistors (&lt;span class=&quot;math-inline&quot; data-index-in-node=&quot;44&quot; data-math=&quot;R10, R1, R12&quot; style=&quot;line-height: 1.15 !important; margin-top: 0px !important;&quot;&gt;$R10, R1, R12$&lt;/span&gt;) at the inputs. This is correct for interfacing with standard &lt;b data-index-in-node=&quot;119&quot; data-path-to-node=&quot;3,1,0&quot; style=&quot;line-height: 1.15 !important; margin-top: 0px !important;&quot;&gt;50Ω lab instrumentation&lt;/b&gt; (like signal generators). If your source is high impedance (like a guitar or simple oscillator), these will load the signal heavily.&lt;/span&gt;&lt;/p&gt;&lt;/li&gt;&lt;/ul&gt;&lt;h3 data-path-to-node=&quot;4&quot; style=&quot;line-height: 1.15 !important; margin-top: 0px !important;&quot;&gt;&lt;span style=&quot;font-family: inherit;&quot;&gt;2. Practical Advice &amp;amp; Improvements&lt;/span&gt;&lt;/h3&gt;&lt;ul data-path-to-node=&quot;5&quot; style=&quot;line-height: 1.15 !important; margin-top: 0px !important; padding-inline-start: 32px;&quot;&gt;&lt;li style=&quot;line-height: 1.15 !important; margin-top: 0px !important;&quot;&gt;&lt;p data-path-to-node=&quot;5,0,0&quot; style=&quot;line-height: 1.15 !important; margin-top: 0px !important;&quot;&gt;&lt;b data-index-in-node=&quot;0&quot; data-path-to-node=&quot;5,0,0&quot; style=&quot;line-height: 1.15 !important; margin-top: 0px !important;&quot;&gt;&lt;span style=&quot;font-family: inherit;&quot;&gt;Carrier Nulling (The 10k Pot):&lt;/span&gt;&lt;/b&gt;&lt;/p&gt;&lt;p data-path-to-node=&quot;5,0,0&quot; style=&quot;line-height: 1.15 !important; margin-top: 0px !important;&quot;&gt;&lt;span style=&quot;font-family: inherit;&quot;&gt;The 10k potentiometer (&lt;span class=&quot;math-inline&quot; data-index-in-node=&quot;54&quot; data-math=&quot;R13/R14&quot; style=&quot;line-height: 1.15 !important; margin-top: 0px !important;&quot;&gt;$R13/R14$&lt;/span&gt; network) is highly sensitive. For a professional build, use a &lt;b data-index-in-node=&quot;124&quot; data-path-to-node=&quot;5,0,0&quot; style=&quot;line-height: 1.15 !important; margin-top: 0px !important;&quot;&gt;multi-turn (cermet) trimmer&lt;/b&gt;. A standard single-turn pot will make it very frustrating to &quot;null&quot; the carrier signal perfectly.&lt;/span&gt;&lt;/p&gt;&lt;/li&gt;&lt;li style=&quot;line-height: 1.15 !important; margin-top: 0px !important;&quot;&gt;&lt;p data-path-to-node=&quot;5,1,0&quot; style=&quot;line-height: 1.15 !important; margin-top: 0px !important;&quot;&gt;&lt;b data-index-in-node=&quot;0&quot; data-path-to-node=&quot;5,1,0&quot; style=&quot;line-height: 1.15 !important; margin-top: 0px !important;&quot;&gt;&lt;span style=&quot;font-family: inherit;&quot;&gt;Output Filtering:&lt;/span&gt;&lt;/b&gt;&lt;/p&gt;&lt;p data-path-to-node=&quot;5,1,0&quot; style=&quot;line-height: 1.15 !important; margin-top: 0px !important;&quot;&gt;&lt;span style=&quot;font-family: inherit;&quot;&gt;The output (&lt;span class=&quot;math-inline&quot; data-index-in-node=&quot;30&quot; data-math=&quot;V_o&quot; style=&quot;line-height: 1.15 !important; margin-top: 0px !important;&quot;&gt;$V_o$&lt;/span&gt;) at &lt;span class=&quot;math-inline&quot; data-index-in-node=&quot;38&quot; data-math=&quot;C3&quot; style=&quot;line-height: 1.15 !important; margin-top: 0px !important;&quot;&gt;$C3$&lt;/span&gt; will contain the sum and difference frequencies (&lt;span class=&quot;math-inline&quot; data-index-in-node=&quot;90&quot; data-math=&quot;f_c \pm f_s&quot; style=&quot;line-height: 1.15 !important; margin-top: 0px !important;&quot;&gt;$f_c \pm f_s$&lt;/span&gt;), but also potentially some high-frequency harmonics. If you are using this for a transmitter, you should add a &lt;b data-index-in-node=&quot;214&quot; data-path-to-node=&quot;5,1,0&quot; style=&quot;line-height: 1.15 !important; margin-top: 0px !important;&quot;&gt;Band-Pass Filter (BPF)&lt;/b&gt; or a &lt;b data-index-in-node=&quot;242&quot; data-path-to-node=&quot;5,1,0&quot; style=&quot;line-height: 1.15 !important; margin-top: 0px !important;&quot;&gt;Low-Pass Filter (LPF)&lt;/b&gt; after &lt;span class=&quot;math-inline&quot; data-index-in-node=&quot;270&quot; data-math=&quot;C3&quot; style=&quot;line-height: 1.15 !important; margin-top: 0px !important;&quot;&gt;$C3$&lt;/span&gt; to clean up the waveform.&lt;/span&gt;&lt;/p&gt;&lt;/li&gt;&lt;li style=&quot;line-height: 1.15 !important; margin-top: 0px !important;&quot;&gt;&lt;p data-path-to-node=&quot;5,2,0&quot; style=&quot;line-height: 1.15 !important; margin-top: 0px !important;&quot;&gt;&lt;b data-index-in-node=&quot;0&quot; data-path-to-node=&quot;5,2,0&quot; style=&quot;line-height: 1.15 !important; margin-top: 0px !important;&quot;&gt;&lt;span style=&quot;font-family: inherit;&quot;&gt;Gain Control (&lt;span class=&quot;math-inline&quot; data-index-in-node=&quot;14&quot; data-math=&quot;R2&quot; style=&quot;line-height: 1.15 !important; margin-top: 0px !important;&quot;&gt;$R2$&lt;/span&gt;):&lt;/span&gt;&lt;/b&gt;&lt;/p&gt;&lt;p data-path-to-node=&quot;5,2,0&quot; style=&quot;line-height: 1.15 !important; margin-top: 0px !important;&quot;&gt;&lt;span style=&quot;font-family: inherit;&quot;&gt;You have &lt;span class=&quot;math-inline&quot; data-index-in-node=&quot;28&quot; data-math=&quot;1k\Omega&quot; style=&quot;line-height: 1.15 !important; margin-top: 0px !important;&quot;&gt;$1k\Omega$&lt;/span&gt; for &lt;span class=&quot;math-inline&quot; data-index-in-node=&quot;41&quot; data-math=&quot;R2&quot; style=&quot;line-height: 1.15 !important; margin-top: 0px !important;&quot;&gt;$R2$&lt;/span&gt;. If you find the output signal is clipping or distorted, you can increase this value (e.g., &lt;span class=&quot;math-inline&quot; data-index-in-node=&quot;136&quot; data-math=&quot;2.2k\Omega&quot; style=&quot;line-height: 1.15 !important; margin-top: 0px !important;&quot;&gt;$2.2k\Omega$&lt;/span&gt;) to reduce the gain and improve linearity.&lt;/span&gt;&lt;/p&gt;&lt;/li&gt;&lt;li style=&quot;line-height: 1.15 !important; margin-top: 0px !important;&quot;&gt;&lt;p data-path-to-node=&quot;5,3,0&quot; style=&quot;line-height: 1.15 !important; margin-top: 0px !important;&quot;&gt;&lt;b data-index-in-node=&quot;0&quot; data-path-to-node=&quot;5,3,0&quot; style=&quot;line-height: 1.15 !important; margin-top: 0px !important;&quot;&gt;&lt;span style=&quot;font-family: inherit;&quot;&gt;Decoupling is Key:&lt;/span&gt;&lt;/b&gt;&lt;/p&gt;&lt;p data-path-to-node=&quot;5,3,0&quot; style=&quot;line-height: 1.15 !important; margin-top: 0px !important;&quot;&gt;&lt;span style=&quot;font-family: inherit;&quot;&gt;The MC1496 is sensitive to power supply noise. While you have &lt;span class=&quot;math-inline&quot; data-index-in-node=&quot;81&quot; data-math=&quot;C2&quot; style=&quot;line-height: 1.15 !important; margin-top: 0px !important;&quot;&gt;$C2$&lt;/span&gt; on the bias line, I strongly recommend adding &lt;b data-index-in-node=&quot;130&quot; data-path-to-node=&quot;5,3,0&quot; style=&quot;line-height: 1.15 !important; margin-top: 0px !important;&quot;&gt;100nF ceramic capacitors&lt;/b&gt; as close as possible to the IC pins:&lt;/span&gt;&lt;/p&gt;&lt;ul data-path-to-node=&quot;5,3,1&quot; style=&quot;line-height: 1.15 !important; margin-top: 0px !important; padding-inline-start: 32px;&quot;&gt;&lt;li style=&quot;line-height: 1.15 !important; margin-top: 0px !important;&quot;&gt;&lt;p data-path-to-node=&quot;5,3,1,0,0&quot; style=&quot;line-height: 1.15 !important; margin-top: 0px !important;&quot;&gt;&lt;span style=&quot;font-family: inherit;&quot;&gt;One from Pin 12 (+12V) to Ground.&lt;/span&gt;&lt;/p&gt;&lt;/li&gt;&lt;li style=&quot;line-height: 1.15 !important; margin-top: 0px !important;&quot;&gt;&lt;p data-path-to-node=&quot;5,3,1,1,0&quot; style=&quot;line-height: 1.15 !important; margin-top: 0px !important;&quot;&gt;&lt;span style=&quot;font-family: inherit;&quot;&gt;One from Pin 14 (-8V) to Ground.&lt;/span&gt;&lt;/p&gt;&lt;/li&gt;&lt;/ul&gt;&lt;/li&gt;&lt;/ul&gt;&lt;h3 data-path-to-node=&quot;6&quot; style=&quot;line-height: 1.15 !important; margin-top: 0px !important;&quot;&gt;&lt;span style=&quot;font-family: inherit;&quot;&gt;3. Verification Steps&lt;/span&gt;&lt;/h3&gt;&lt;p data-path-to-node=&quot;7&quot; style=&quot;line-height: 1.15 !important; margin-top: 0px !important;&quot;&gt;&lt;span style=&quot;font-family: inherit;&quot;&gt;If you are testing this on a breadboard or PCB:&lt;/span&gt;&lt;/p&gt;&lt;ol data-path-to-node=&quot;8&quot; start=&quot;1&quot; style=&quot;line-height: 1.15 !important; margin-top: 0px !important; padding-inline-start: 32px;&quot;&gt;&lt;li style=&quot;line-height: 1.15 !important; margin-top: 0px !important;&quot;&gt;&lt;p data-path-to-node=&quot;8,0,0&quot; style=&quot;line-height: 1.15 !important; margin-top: 0px !important;&quot;&gt;&lt;span style=&quot;font-family: inherit;&quot;&gt;&lt;b data-index-in-node=&quot;0&quot; data-path-to-node=&quot;8,0,0&quot; style=&quot;line-height: 1.15 !important; margin-top: 0px !important;&quot;&gt;Check DC Quiescent Volts:&lt;/b&gt; Before applying signals, ensure Pin 12 is sitting at a higher voltage than Pin 14.&lt;/span&gt;&lt;/p&gt;&lt;/li&gt;&lt;li style=&quot;line-height: 1.15 !important; margin-top: 0px !important;&quot;&gt;&lt;p data-path-to-node=&quot;8,1,0&quot; style=&quot;line-height: 1.15 !important; margin-top: 0px !important;&quot;&gt;&lt;span style=&quot;font-family: inherit;&quot;&gt;&lt;b data-index-in-node=&quot;0&quot; data-path-to-node=&quot;8,1,0&quot; style=&quot;line-height: 1.15 !important; margin-top: 0px !important;&quot;&gt;Nulling:&lt;/b&gt; Apply only the Carrier (&lt;span class=&quot;math-inline&quot; data-index-in-node=&quot;33&quot; data-math=&quot;V_c&quot; style=&quot;line-height: 1.15 !important; margin-top: 0px !important;&quot;&gt;$V_c$&lt;/span&gt;). Adjust the 10k pot until the signal at &lt;span class=&quot;math-inline&quot; data-index-in-node=&quot;78&quot; data-math=&quot;V_o&quot; style=&quot;line-height: 1.15 !important; margin-top: 0px !important;&quot;&gt;$V_o$&lt;/span&gt; is at its minimum on an oscilloscope.&lt;/span&gt;&lt;/p&gt;&lt;/li&gt;&lt;li style=&quot;line-height: 1.15 !important; margin-top: 0px !important;&quot;&gt;&lt;p data-path-to-node=&quot;8,2,0&quot; style=&quot;line-height: 1.15 !important; margin-top: 0px !important;&quot;&gt;&lt;span style=&quot;font-family: inherit;&quot;&gt;&lt;b data-index-in-node=&quot;0&quot; data-path-to-node=&quot;8,2,0&quot; style=&quot;line-height: 1.15 !important; margin-top: 0px !important;&quot;&gt;Modulation:&lt;/b&gt; Apply the modulating signal (&lt;span class=&quot;math-inline&quot; data-index-in-node=&quot;41&quot; data-math=&quot;V_s&quot; style=&quot;line-height: 1.15 !important; margin-top: 0px !important;&quot;&gt;$V_s$&lt;/span&gt;) and observe the &quot;envelope&quot; or the suppressed carrier &quot;butterfly&quot; pattern.&lt;/span&gt;&lt;/p&gt;&lt;/li&gt;&lt;/ol&gt;&lt;p data-path-to-node=&quot;9&quot; style=&quot;line-height: 1.15 !important; margin-top: 0px !important;&quot;&gt;&lt;span style=&quot;font-family: inherit;&quot;&gt;The schematic is correct and ready for prototyping. It&#39;s a solid design for a technical blog or a hardware demonstration.&lt;/span&gt;&lt;/p&gt;&lt;p data-path-to-node=&quot;9&quot; style=&quot;line-height: 1.15 !important; margin-top: 0px !important;&quot;&gt;&lt;span style=&quot;font-family: inherit;&quot;&gt;Related&lt;/span&gt;&lt;/p&gt;&lt;p data-path-to-node=&quot;9&quot; style=&quot;line-height: 1.15 !important; margin-top: 0px !important;&quot;&gt;&lt;/p&gt;&lt;ul style=&quot;text-align: left;&quot;&gt;&lt;li&gt;&lt;a href=&quot;https://www.ee-diary.net/2022/09/mc1496-balanced-modulator-demodulator.html&quot;&gt;MC1496 Balanced Modulator Demodulator(Introduction)&lt;/a&gt;&lt;/li&gt;&lt;li&gt;&lt;a href=&quot;https://www.ee-diary.net/2022/09/am-detector-demodulator-with-mc1496.html&quot;&gt;AM Detector Demodulator with MC1496&lt;/a&gt;&lt;/li&gt;&lt;li&gt;&lt;a href=&quot;https://www.ee-diary.net/2022/09/single-supply-mc1496-am-modulator.html&quot;&gt;Single Supply MC1496 AM modulator&lt;/a&gt;&lt;/li&gt;&lt;li&gt;&lt;a href=&quot;https://www.ee-diary.net/2026/03/am-modulator-using-jfet-transistor.html&quot;&gt;AM Modulator Using JFET Transistor: Circuit Design and Applications&lt;/a&gt;&lt;/li&gt;&lt;/ul&gt;&lt;p&gt;&lt;/p&gt;&lt;p&gt;&lt;br /&gt;&lt;/p&gt;</content><link rel='replies' type='application/atom+xml' href='http://www.ee-diary.net/feeds/2810915985909192930/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.ee-diary.net/2026/04/improving-am-modulator-using-mc1496.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7437986969318338216/posts/default/2810915985909192930'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7437986969318338216/posts/default/2810915985909192930'/><link rel='alternate' type='text/html' href='http://www.ee-diary.net/2026/04/improving-am-modulator-using-mc1496.html' title='Improving AM modulator using MC1496 modulator'/><author><name>Unknown</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgH5b8gZGFTb10uYbCiCgcrdqHYtL-v5uHm3fovZZoI41PCP6R0Vl23vGX9UN20vjJ7JK9Bt45KeuWjXZ0hHXHAns2xxO7uBD3xP7lblYOnaEUDSCzQ5Xh7bNIbpJU_07OaWTAKMiXOZM3CbVIgjDI_x2aSul2lteGF1gqLTUbXLmMzJGw8P4WdNiwAgoJI/s72-c/MC149%20amplitude%20modulator%20circuit%20diagram.jpg" height="72" width="72"/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-7437986969318338216.post-1868961101292666624</id><published>2026-04-13T17:58:00.002+05:45</published><updated>2026-04-13T18:25:02.633+05:45</updated><category scheme="http://www.blogger.com/atom/ns#" term="repair"/><category scheme="http://www.blogger.com/atom/ns#" term="troubleshooting"/><title type='text'>Arduino Nano Overheating Problem &amp; Solutions</title><content type='html'>&lt;div class=&quot;separator&quot; style=&quot;display: none;&quot;&gt;&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhEmkrhJl2HvhCRk5Lo335962qWjEtm9vgRtTQ1w9WvEtj2IOOEKI3c7HoSED2iuNbw97N0v_b2bA1l0dEOu6KGFQn7B6gvJ7fPDWKJJRejPbKfV19l5GaekopznIXsJFvUQV5HZGua_zaFwmuLtETrGDS9pDkVyEeQ4n9hHwmVirw4NXeSwmeI7JsnUfhk/s1600/repair%20arduino%20nano.png&quot; style=&quot;display: block; padding: 1em 0px; text-align: center;&quot;&gt;&lt;img alt=&quot;Arduino Nano Overheating Problem and Solutions&quot; border=&quot;0&quot; data-original-height=&quot;672&quot; data-original-width=&quot;1366&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhEmkrhJl2HvhCRk5Lo335962qWjEtm9vgRtTQ1w9WvEtj2IOOEKI3c7HoSED2iuNbw97N0v_b2bA1l0dEOu6KGFQn7B6gvJ7fPDWKJJRejPbKfV19l5GaekopznIXsJFvUQV5HZGua_zaFwmuLtETrGDS9pDkVyEeQ4n9hHwmVirw4NXeSwmeI7JsnUfhk/s1600/repair%20arduino%20nano.png&quot; /&gt;&lt;/a&gt;&lt;/div&gt;
&lt;p&gt;Lately, my working Arduino Nano started to overheat, and the ICs on it became very hot when connected via USB. I don’t know the reason. In fact, I now have two Arduino Nanos that are not working anymore. The other one does not have the overheating problem, but it simply will not connect.&lt;/p&gt;&lt;p&gt;My first guess was that the voltage regulator AMS1117 was the problem. I unplugged it from the USB and checked it with a multimeter in continuity mode. There was a continuity beep between pin 1, which is the ground pin, and the middle pin 2, which is the output pin. This means that the AMS1117 IC was shorted. I removed it by desoldering it from the Arduino Nano PCB, since the Arduino Nano can also work without the voltage regulator when powered via USB or by applying 5V to the +5V pin.&lt;/p&gt;&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;&lt;iframe allowfullscreen=&quot;&quot; class=&quot;BLOG_video_class&quot; height=&quot;410&quot; src=&quot;https://www.youtube.com/embed/z08pRThpYow&quot; width=&quot;492&quot; youtube-src-id=&quot;z08pRThpYow&quot;&gt;&lt;/iframe&gt;&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;After removing and reinserting the USB, the problem was not resolved — it still became hot. I was afraid that the PCB USB port might get damaged, so I unplugged it immediately. Then I inserted the Arduino into a breadboard and applied +5V to the +5V pin. I touched the chips on the Arduino to check whether they were heating up or not, and they weren’t. But soon afterward, I realized that the &lt;a href=&quot;https://www.ee-diary.net/2024/07/diy-5v-regulated-power-supply-for.html&quot;&gt;breadboard power supply voltage regulator LM7805&lt;/a&gt; was heating up. As you perhaps know the &lt;a href=&quot;https://www.ee-diary.net/2024/12/how-lm7805-series-voltage-regulator.html&quot;&gt;LM7805&lt;/a&gt; is a linear voltage regulator which heats up quickly.&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;At this point, I now have to check the other ICs as well, which is difficult. Even if I check and confirm that the ATmega328P or another IC is the problem, I have no replacement IC. Though I could desolder the same IC from another Arduino Nano that is also not working, this will take time.&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;So I started to look for solution on the internet. I found many reports of overheating problem with &lt;a href=&quot;https://www.ee-diary.net/2026/03/arduino-nano-pinout-explorer.html&quot;&gt;Arduino nano&lt;/a&gt; but no one actually solved or repaired it.&amp;nbsp;&lt;/div&gt;&lt;div&gt;&lt;p&gt;&lt;span style=&quot;white-space-collapse: preserve;&quot;&gt;Here’s a consolidated summary of how the &lt;strong&gt;Arduino Nano overheating problems started&lt;/strong&gt; across all the forum and help pages I reviewed:&lt;/span&gt;&lt;/p&gt;&lt;h3&gt;🔥 Arduino nano Overheating Causes Reported&lt;/h3&gt;&lt;ol start=&quot;1&quot;&gt;&lt;li&gt;&lt;p&gt;&lt;span style=&quot;white-space-collapse: preserve;&quot;&gt;&lt;strong&gt;Arduino Forum (Nano overheats on USB)&lt;/strong&gt;&lt;/span&gt;&lt;/p&gt;&lt;ul&gt;&lt;li&gt;&lt;p&gt;&lt;span style=&quot;white-space-collapse: preserve;&quot;&gt;Board became very hot immediately when connected via USB.&lt;/span&gt;&lt;/p&gt;&lt;/li&gt;&lt;li&gt;&lt;p&gt;&lt;span style=&quot;white-space-collapse: preserve;&quot;&gt;Likely cause: damaged ATmega328P microcontroller or shorted voltage regulator.&lt;/span&gt;&lt;/p&gt;&lt;/li&gt;&lt;li&gt;&lt;p&gt;&lt;span style=&quot;white-space-collapse: preserve;&quot;&gt;Resolution: not repaired, replacement chip suggested.&lt;/span&gt;&lt;/p&gt;&lt;/li&gt;&lt;/ul&gt;&lt;/li&gt;&lt;li&gt;&lt;p&gt;&lt;span style=&quot;white-space-collapse: preserve;&quot;&gt;&lt;strong&gt;Reddit Discussion (Nano overheats, LEDs all on)&lt;/strong&gt;&lt;/span&gt;&lt;/p&gt;&lt;ul&gt;&lt;li&gt;&lt;p&gt;&lt;span style=&quot;white-space-collapse: preserve;&quot;&gt;User powered Nano with both USB and ~12 V battery pack simultaneously.&lt;/span&gt;&lt;/p&gt;&lt;/li&gt;&lt;li&gt;&lt;p&gt;&lt;span style=&quot;white-space-collapse: preserve;&quot;&gt;Result: regulator and microcontroller fried.&lt;/span&gt;&lt;/p&gt;&lt;/li&gt;&lt;li&gt;&lt;p&gt;&lt;span style=&quot;white-space-collapse: preserve;&quot;&gt;Resolution: consensus was the board was dead, no repair.&lt;/span&gt;&lt;/p&gt;&lt;/li&gt;&lt;/ul&gt;&lt;/li&gt;&lt;li&gt;&lt;p&gt;&lt;span style=&quot;white-space-collapse: preserve;&quot;&gt;&lt;strong&gt;Electronics Stack Exchange (Nano overheats after spark)&lt;/strong&gt;&lt;/span&gt;&lt;/p&gt;&lt;ul&gt;&lt;li&gt;&lt;p&gt;&lt;span style=&quot;white-space-collapse: preserve;&quot;&gt;Spark occurred while connecting motor driver; Nano overheated even with Blink sketch.&lt;/span&gt;&lt;/p&gt;&lt;/li&gt;&lt;li&gt;&lt;p&gt;&lt;span style=&quot;white-space-collapse: preserve;&quot;&gt;Cause: suspected overvoltage damage.&lt;/span&gt;&lt;/p&gt;&lt;/li&gt;&lt;li&gt;&lt;p&gt;&lt;span style=&quot;white-space-collapse: preserve;&quot;&gt;Resolution: not solved, advice was to discard and replace.&lt;/span&gt;&lt;/p&gt;&lt;/li&gt;&lt;/ul&gt;&lt;/li&gt;&lt;li&gt;&lt;p&gt;&lt;span style=&quot;white-space-collapse: preserve;&quot;&gt;&lt;strong&gt;Electronics Forum (Uno overheats with motor shield)&lt;/strong&gt;&lt;/span&gt;&lt;/p&gt;&lt;ul&gt;&lt;li&gt;&lt;p&gt;&lt;span style=&quot;white-space-collapse: preserve;&quot;&gt;Uno overheated when powered with 12 V and motor shield attached.&lt;/span&gt;&lt;/p&gt;&lt;/li&gt;&lt;li&gt;&lt;p&gt;&lt;span style=&quot;white-space-collapse: preserve;&quot;&gt;Cause: regulator overstressed, unclear shield wiring.&lt;/span&gt;&lt;/p&gt;&lt;/li&gt;&lt;li&gt;&lt;p&gt;&lt;span style=&quot;white-space-collapse: preserve;&quot;&gt;Resolution: thread ended unresolved.&lt;/span&gt;&lt;/p&gt;&lt;/li&gt;&lt;/ul&gt;&lt;/li&gt;&lt;li&gt;&lt;p&gt;&lt;span style=&quot;white-space-collapse: preserve;&quot;&gt;&lt;strong&gt;Adafruit Forum (Uno R3 overheats)&lt;/strong&gt;&lt;/span&gt;&lt;/p&gt;&lt;ul&gt;&lt;li&gt;&lt;p&gt;&lt;span style=&quot;white-space-collapse: preserve;&quot;&gt;Uno’s ATmega328P DIP chip reached ~170°F even with simple sketches.&lt;/span&gt;&lt;/p&gt;&lt;/li&gt;&lt;li&gt;&lt;p&gt;&lt;span style=&quot;white-space-collapse: preserve;&quot;&gt;Cause: defective chip and regulator heating from 12 V input.&lt;/span&gt;&lt;/p&gt;&lt;/li&gt;&lt;li&gt;&lt;p&gt;&lt;span style=&quot;white-space-collapse: preserve;&quot;&gt;Resolution: Adafruit replaced the board, not repaired.&lt;/span&gt;&lt;/p&gt;&lt;/li&gt;&lt;/ul&gt;&lt;/li&gt;&lt;li&gt;&lt;p&gt;&lt;span style=&quot;white-space-collapse: preserve;&quot;&gt;&lt;strong&gt;Arduino Forum (Nano clone overheats only on USB)&lt;/strong&gt;&lt;/span&gt;&lt;/p&gt;&lt;ul&gt;&lt;li&gt;&lt;p&gt;&lt;span style=&quot;white-space-collapse: preserve;&quot;&gt;Nano clone overheated when powered via USB, but worked with external 5 V.&lt;/span&gt;&lt;/p&gt;&lt;/li&gt;&lt;li&gt;&lt;p&gt;&lt;span style=&quot;white-space-collapse: preserve;&quot;&gt;Cause: USB interface or regulator failure.&lt;/span&gt;&lt;/p&gt;&lt;/li&gt;&lt;li&gt;&lt;p&gt;&lt;span style=&quot;white-space-collapse: preserve;&quot;&gt;Resolution: not solved, board remained unusable.&lt;/span&gt;&lt;/p&gt;&lt;/li&gt;&lt;/ul&gt;&lt;/li&gt;&lt;li&gt;&lt;p&gt;&lt;span style=&quot;white-space-collapse: preserve;&quot;&gt;&lt;strong&gt;General Guide Article (“10 Fixes for Overheating”)&lt;/strong&gt;&lt;/span&gt;&lt;/p&gt;&lt;ul&gt;&lt;li&gt;&lt;p&gt;&lt;span style=&quot;white-space-collapse: preserve;&quot;&gt;Listed common causes: excessive current draw, short circuits, wrong supply voltage, poor heat dissipation, faulty regulators, etc.&lt;/span&gt;&lt;/p&gt;&lt;/li&gt;&lt;li&gt;&lt;p&gt;&lt;span style=&quot;white-space-collapse: preserve;&quot;&gt;Resolution: general advice only, no specific case solved.&lt;/span&gt;&lt;/p&gt;&lt;/li&gt;&lt;/ul&gt;&lt;/li&gt;&lt;/ol&gt;&lt;div&gt;&lt;/div&gt;&lt;h3&gt;✅ Overall Pattern&lt;/h3&gt;&lt;ul&gt;&lt;li&gt;&lt;p&gt;&lt;span style=&quot;white-space-collapse: preserve;&quot;&gt;&lt;strong&gt;Most overheating started from power supply issues&lt;/strong&gt;: using USB + external power simultaneously, applying 12 V to VIN, or faulty regulators.&lt;/span&gt;&lt;/p&gt;&lt;/li&gt;&lt;li&gt;&lt;p&gt;&lt;span style=&quot;white-space-collapse: preserve;&quot;&gt;&lt;strong&gt;Regulators (AMS1117, LM7805) and ATmega328P chips were the common failure points.&lt;/strong&gt;&lt;/span&gt;&lt;/p&gt;&lt;/li&gt;&lt;li&gt;&lt;p&gt;&lt;span style=&quot;white-space-collapse: preserve;&quot;&gt;&lt;strong&gt;Few cases were actually repaired&lt;/strong&gt; — most ended with replacement boards or advice to discard.&lt;/span&gt;&lt;/p&gt;&lt;/li&gt;&lt;/ul&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://www.ee-diary.net/feeds/1868961101292666624/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.ee-diary.net/2026/04/arduino-nano-overheating-problem.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7437986969318338216/posts/default/1868961101292666624'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7437986969318338216/posts/default/1868961101292666624'/><link rel='alternate' type='text/html' href='http://www.ee-diary.net/2026/04/arduino-nano-overheating-problem.html' title='Arduino Nano Overheating Problem &amp; Solutions'/><author><name>Unknown</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhEmkrhJl2HvhCRk5Lo335962qWjEtm9vgRtTQ1w9WvEtj2IOOEKI3c7HoSED2iuNbw97N0v_b2bA1l0dEOu6KGFQn7B6gvJ7fPDWKJJRejPbKfV19l5GaekopznIXsJFvUQV5HZGua_zaFwmuLtETrGDS9pDkVyEeQ4n9hHwmVirw4NXeSwmeI7JsnUfhk/s72-c/repair%20arduino%20nano.png" height="72" width="72"/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-7437986969318338216.post-8877803561273355251</id><published>2026-04-13T04:59:00.002+05:45</published><updated>2026-04-13T04:59:38.707+05:45</updated><category scheme="http://www.blogger.com/atom/ns#" term="Bluepill"/><category scheme="http://www.blogger.com/atom/ns#" term="Proteus"/><title type='text'>Simulation of Bluepill (STM32F103C8T6) LED blinking circuit in Proteus</title><content type='html'>&lt;p&gt;&amp;nbsp;I just made a&amp;nbsp;&lt;b data-index-in-node=&quot;6&quot; data-path-to-node=&quot;0&quot;&gt;Bluepill (&lt;a href=&quot;https://www.chipexplorer.net/2026/03/stm32f103c8t6.html&quot;&gt;STM32F103C8T6&lt;/a&gt;)&lt;/b&gt; simulation part in Proteus and wanted to show this here. The circuit is simple a hello world circuit, that it is a LED blinking circuit. I used the proteus default Arduino for STM32 compiler which is&amp;nbsp;arm-none-eabi-gcc. The program code is simple and one can use the same Arduino programing language.&amp;nbsp;&lt;/p&gt;&lt;p&gt;Below shows the &lt;b&gt;circuit diagram&lt;/b&gt;.&lt;/p&gt;&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhgeeMA7f7nxWAt_QlUhbza7iukTrWDjHIt1cR2rmUjnUJWHujiUW_zIbxhq2oS9DUxkdm9odYvFa0K3GpJfoRprZWTyBpMHag0itUNA0Cancgm-HPYSr8WCc2WY3fb8DYVRUYY3WECl6h5LZrOq-p74fwXQ0J2IjDOH37r-8KDK0OSY6emRLazAfR0B8Ij/s1180/Simulation%20of%20Bluepill%20(STM32F103C8T6)%20LED%20circuit%20in%20Proteus.gif&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img alt=&quot;Simulation of Bluepill(STM32F103C8T6) LED blinking circuit in Proteus&quot; border=&quot;0&quot; data-original-height=&quot;598&quot; data-original-width=&quot;1180&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhgeeMA7f7nxWAt_QlUhbza7iukTrWDjHIt1cR2rmUjnUJWHujiUW_zIbxhq2oS9DUxkdm9odYvFa0K3GpJfoRprZWTyBpMHag0itUNA0Cancgm-HPYSr8WCc2WY3fb8DYVRUYY3WECl6h5LZrOq-p74fwXQ0J2IjDOH37r-8KDK0OSY6emRLazAfR0B8Ij/s16000/Simulation%20of%20Bluepill%20(STM32F103C8T6)%20LED%20circuit%20in%20Proteus.gif&quot; title=&quot;Simulation of Bluepill(STM32F103C8T6) LED blinking circuit in Proteus&quot; /&gt;&lt;/a&gt;&lt;/div&gt;&lt;p&gt;As you can see the LED is connected to port pin PC13. The code for led blink is very simple and provided below.&lt;/p&gt;
&lt;pre lang=&quot;cpp&quot;&gt;&lt;code&gt;
/*
 * Bluepill Blink for STM32 Official Core
 * Onboard LED is connected to PC13
 */

void setup() {
  // Initialize PC13 as an output
  pinMode(PC13, OUTPUT);
}

void loop() {
  // On the Bluepill, the LED is ACTIVE LOW
  digitalWrite(PC13, LOW);  // Turn the LED ON
  delay(500);               // Wait 500ms
  
  digitalWrite(PC13, HIGH); // Turn the LED OFF
  delay(500);               // Wait 500ms
}
&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;This is the same programming code like in standard Arduino. Nothing really to explain.&lt;/p&gt;&lt;p&gt;The following &lt;b&gt;video&lt;/b&gt; shows how I built the&amp;nbsp;Bluepill(STM32F103C8T6) LED blinking circuit in Proteus.&lt;/p&gt;&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;&lt;iframe allowfullscreen=&quot;&quot; class=&quot;BLOG_video_class&quot; height=&quot;476&quot; src=&quot;https://www.youtube.com/embed/CkrRDhrebuU&quot; width=&quot;573&quot; youtube-src-id=&quot;CkrRDhrebuU&quot;&gt;&lt;/iframe&gt;&lt;/div&gt;&lt;p&gt;Bluepill uses&amp;nbsp;STM32F103C8T6 microcontroller, see the&amp;nbsp;&lt;a href=&quot;https://www.chipexplorer.net/2026/03/stm32f103c8t6.html&quot;&gt;STM32F103C8T6 chip pinout explorer&lt;/a&gt; for faster building of circuit.&amp;nbsp;&lt;/p&gt;</content><link rel='replies' type='application/atom+xml' href='http://www.ee-diary.net/feeds/8877803561273355251/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.ee-diary.net/2026/04/simulation-of-bluepill-stm32f103c8t6.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7437986969318338216/posts/default/8877803561273355251'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7437986969318338216/posts/default/8877803561273355251'/><link rel='alternate' type='text/html' href='http://www.ee-diary.net/2026/04/simulation-of-bluepill-stm32f103c8t6.html' title='Simulation of Bluepill (STM32F103C8T6) LED blinking circuit in Proteus'/><author><name>Unknown</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhgeeMA7f7nxWAt_QlUhbza7iukTrWDjHIt1cR2rmUjnUJWHujiUW_zIbxhq2oS9DUxkdm9odYvFa0K3GpJfoRprZWTyBpMHag0itUNA0Cancgm-HPYSr8WCc2WY3fb8DYVRUYY3WECl6h5LZrOq-p74fwXQ0J2IjDOH37r-8KDK0OSY6emRLazAfR0B8Ij/s72-c/Simulation%20of%20Bluepill%20(STM32F103C8T6)%20LED%20circuit%20in%20Proteus.gif" height="72" width="72"/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-7437986969318338216.post-2844640825666078323</id><published>2026-04-11T19:39:00.002+05:45</published><updated>2026-04-11T19:40:55.975+05:45</updated><category scheme="http://www.blogger.com/atom/ns#" term="arduino"/><category scheme="http://www.blogger.com/atom/ns#" term="repair"/><category scheme="http://www.blogger.com/atom/ns#" term="troubleshooting"/><title type='text'>Fixing My DIY Arduino PCB Design Mistakes After 3 Years</title><content type='html'>&lt;p&gt;&lt;span style=&quot;font-family: inherit;&quot;&gt;About three years ago, I built and manufactured a DIY Arduino board with a custom PCB design. I created the schematic and PCB layout myself and had it fabricated by &lt;b&gt;&lt;a href=&quot;https://www.nextpcb.com&quot;&gt;NextPCB&lt;/a&gt;&lt;/b&gt;. They were generous enough to manufacture and provide the board free of charge.&lt;/span&gt;&lt;/p&gt;&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhNXJoImgJv9eEctLp5ql1JhAGu-O78Ho_ZQ85pDt6ZZKnoLpQdGSZy7Dv-Wm8Y4OKGjaaJI8nFN5MoyMCWpjALzuT_3rHfwsnpW_JGOBVkf1NImjETQBXYV6LdcIz9bEPbllO-6LZM5MOKN0eca4HfSXl7HtFihXvV7uvNk-sCz-8HWbj26RkK0XDtlXo1/s437/arduino%20pcb%20board.png&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;span style=&quot;font-family: inherit;&quot;&gt;&lt;img alt=&quot;diy Arduino PCB board&quot; border=&quot;0&quot; data-original-height=&quot;355&quot; data-original-width=&quot;437&quot; height=&quot;260&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhNXJoImgJv9eEctLp5ql1JhAGu-O78Ho_ZQ85pDt6ZZKnoLpQdGSZy7Dv-Wm8Y4OKGjaaJI8nFN5MoyMCWpjALzuT_3rHfwsnpW_JGOBVkf1NImjETQBXYV6LdcIz9bEPbllO-6LZM5MOKN0eca4HfSXl7HtFihXvV7uvNk-sCz-8HWbj26RkK0XDtlXo1/w320-h260/arduino%20pcb%20board.png&quot; title=&quot;diy Arduino PCB board&quot; width=&quot;320&quot; /&gt;&lt;/span&gt;&lt;/a&gt;&lt;/div&gt;&lt;p&gt;&lt;span style=&quot;font-family: inherit;&quot;&gt;After receiving it, I assembled the components onto the board, but unfortunately, it didn’t work. That was disappointing, and despite my efforts, I couldn’t identify the fault. I had always wanted to figure out what went wrong, but between being busy and uncertain whether repair was even possible, I left it aside. At the time, everything looked fine to me, yet the problem remained hidden.&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style=&quot;font-family: inherit;&quot;&gt;This week, I finally had the chance to revisit the board. I investigated thoroughly, discovered the issues, and repaired it. Now, it works perfectly.&amp;nbsp;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;/p&gt;&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjd7G9G65mY-qsgRuOUBaW5JV0TyQ3pn6TjhT0NNrwOsn_ErkOewrTze1NpCTonFgDUMCSFAFy4Wmj12r1mSBFy1AvJZV0aFoKwrIFAg3gtgNEzj8VZSnHH8Agxs5Y3EoHncTinGvFj4zLrTNpo74O8L0oJ5unk5l3KuAxYTR2O95Td43q722i6tqbjrrmt/s1280/arduino%20board%20working.gif&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img alt=&quot;diy arduino board design working&quot; border=&quot;0&quot; data-original-height=&quot;720&quot; data-original-width=&quot;1280&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjd7G9G65mY-qsgRuOUBaW5JV0TyQ3pn6TjhT0NNrwOsn_ErkOewrTze1NpCTonFgDUMCSFAFy4Wmj12r1mSBFy1AvJZV0aFoKwrIFAg3gtgNEzj8VZSnHH8Agxs5Y3EoHncTinGvFj4zLrTNpo74O8L0oJ5unk5l3KuAxYTR2O95Td43q722i6tqbjrrmt/s16000/arduino%20board%20working.gif&quot; title=&quot;diy arduino board design working&quot; /&gt;&lt;/a&gt;&lt;/div&gt;&lt;span style=&quot;font-family: inherit;&quot;&gt;&lt;p&gt;&lt;span style=&quot;font-family: inherit;&quot;&gt;The problems were in my design—I had made a couple of mistakes in the schematic. NextPCB had manufactured the board exactly as I had designed and submitted the files, so the errors were entirely on my end. Actually, NexPCB did a fantastic job. Their tools were easy to use, process of uploading pcb design files, finding possible layout error was also fantastic. The&lt;b&gt; &lt;/b&gt;&lt;/span&gt;&lt;a href=&quot;https://www.nextpcb.com/dfm&quot; style=&quot;font-family: inherit;&quot;&gt;&lt;b&gt;NextPCB DFM tool&lt;/b&gt;&lt;/a&gt;&lt;span style=&quot;font-family: inherit;&quot;&gt;, better known as &lt;/span&gt;HQDFM&lt;span style=&quot;font-family: inherit;&quot;&gt;, is a free online Gerber viewer and Design for Manufacture (DFM) tool that helps analyze PCB production files. You can also download the &lt;a href=&quot;https://www.nextpcb.com/dfm&quot;&gt;&lt;b&gt;HQDFM tool&lt;/b&gt;&lt;/a&gt; for free.&lt;/span&gt;&lt;/p&gt;&lt;/span&gt;&lt;p&gt;&lt;/p&gt;&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjVzB-6902CLDBBl1y5wQFZv5zB2RnxHwsUQmU8xjR5KIy4PDe-xo8Aa0lST7PrBaYHvhczfGpJu2E994woisaciej90rJDUnFgTywtXcwxjVtyvHnG7stz-dCCtjMmW7yJTm9G6GH9b0BxzL6DpK4FififLWeTOru1oTK5GYx6tIfAoAR9s5poiPxENUrZ/s457/arduino%20uno%20diy.png&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;span style=&quot;font-family: inherit;&quot;&gt;&lt;img alt=&quot;DIY Arduino&quot; border=&quot;0&quot; data-original-height=&quot;457&quot; data-original-width=&quot;342&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjVzB-6902CLDBBl1y5wQFZv5zB2RnxHwsUQmU8xjR5KIy4PDe-xo8Aa0lST7PrBaYHvhczfGpJu2E994woisaciej90rJDUnFgTywtXcwxjVtyvHnG7stz-dCCtjMmW7yJTm9G6GH9b0BxzL6DpK4FififLWeTOru1oTK5GYx6tIfAoAR9s5poiPxENUrZ/s16000/arduino%20uno%20diy.png&quot; title=&quot;DIY Arduino&quot; /&gt;&lt;/span&gt;&lt;/a&gt;&lt;/div&gt;&lt;span style=&quot;font-family: inherit;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;p&gt;&lt;span style=&quot;font-family: inherit;&quot;&gt;Actually, this time around, it did not take long to find and solve the problems on the PCB board. I began troubleshooting by checking all the pins of the ATmega328P to the headers with a continuity checker. There was nothing wrong with the connection between the IC pins to the header pins. This was a bit of a relief, but at the same time it was also scary since the problem could be far more serious, possibly beyond repair. I think I did this continuity check back when I first realized the board was not working.&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style=&quot;font-family: inherit;&quot;&gt;There were several mistakes in my circuit and PCB design, and I wanted to record here my hands on experience repairing the board. The main problem was the power supply connection to the Vcc pin, incorrect use of one of the resistor value, used a capacitor which was not needed at all, connection to the Vref pin.&amp;nbsp;&lt;/span&gt;&lt;/p&gt;&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiyicon6_uwRnHT-QjptpoyknwVqYYmiUusdfSrnC3D9biVUHlf_1mdCfjChpMDz8BZ9Jtqf4hZr56pqnfqzx83qTIchHO_fq5Wp37eKsqlI_1Yb_Bm0G79Ie0ryYbauPk5zbbox_vQ6enh3H2anrWLF-WlVbjJvaFFr4xymNSVyzri_Q5l3BXNMSaaxfAh/s1179/diy%20arduino%20schematic%20diagram.png&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;span style=&quot;font-family: inherit;&quot;&gt;&lt;img alt=&quot;diy arduino schematic diagram&quot; border=&quot;0&quot; data-original-height=&quot;597&quot; data-original-width=&quot;1179&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiyicon6_uwRnHT-QjptpoyknwVqYYmiUusdfSrnC3D9biVUHlf_1mdCfjChpMDz8BZ9Jtqf4hZr56pqnfqzx83qTIchHO_fq5Wp37eKsqlI_1Yb_Bm0G79Ie0ryYbauPk5zbbox_vQ6enh3H2anrWLF-WlVbjJvaFFr4xymNSVyzri_Q5l3BXNMSaaxfAh/s16000/diy%20arduino%20schematic%20diagram.png&quot; title=&quot;diy arduino schematic diagram&quot; /&gt;&lt;/span&gt;&lt;/a&gt;&lt;/div&gt;&lt;span style=&quot;font-family: inherit;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;p&gt;&lt;span style=&quot;font-family: inherit;&quot;&gt;I will break the problem and explain individually how I repaired them.&amp;nbsp;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;b&gt;&lt;span style=&quot;font-family: inherit;&quot;&gt;1. Reset Pin 1 direct connection to Vcc pin 7&lt;/span&gt;&lt;/b&gt;&lt;/p&gt;&lt;p&gt;&lt;span style=&quot;font-family: inherit;&quot;&gt;&lt;span&gt;This was one of the main blunders. I connected the reset pin 1 directly to the Vcc pin 7. This was a&lt;/span&gt;&amp;nbsp;fatal connection. The $V_{CC}$ pin 7 is connected to power supply +5V via the $R_1$ $10 k\Omega$ resistor. That is the $R_1$ $10 k\Omega$ resistor is sitting between the $V_{CC}$ pin 7 and +5V power supply.&amp;nbsp;&lt;span&gt;This is shown in the circuit schematic and on the PCB layout.&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEi3C0PzjGoxu1aP6YPled95RVM6_nBkCviVzzKYJmlVqD0yLvd1S6Y4Ej-0CvyN7CCsUUVMtkcG_Qg9ap_S6EileGHFYrqCYtyGtnM7W3KWScAtrhYeerfRwS-9wIIKliGQCMetgt1WGDMxgeCBXK56AxJjYA6RrLut1vk93cSe3qYuu9aMN_E6NaOdqX1O/s1210/reset%20pin%201%20connected%20to%20Vcc%20pin%207%20Schematic%20and%20PCB%20layout%20view.png&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;span style=&quot;font-family: inherit;&quot;&gt;&lt;img alt=&quot;reset pin 1 connected to Vcc pin 7 Schematic and PCB layout view&quot; border=&quot;0&quot; data-original-height=&quot;545&quot; data-original-width=&quot;1210&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEi3C0PzjGoxu1aP6YPled95RVM6_nBkCviVzzKYJmlVqD0yLvd1S6Y4Ej-0CvyN7CCsUUVMtkcG_Qg9ap_S6EileGHFYrqCYtyGtnM7W3KWScAtrhYeerfRwS-9wIIKliGQCMetgt1WGDMxgeCBXK56AxJjYA6RrLut1vk93cSe3qYuu9aMN_E6NaOdqX1O/s16000/reset%20pin%201%20connected%20to%20Vcc%20pin%207%20Schematic%20and%20PCB%20layout%20view.png&quot; title=&quot;reset pin 1 connected to Vcc pin 7 Schematic and PCB layout view&quot; /&gt;&lt;/span&gt;&lt;/a&gt;&lt;/div&gt;&lt;span style=&quot;font-family: inherit;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;p&gt;&lt;span style=&quot;font-family: inherit;&quot;&gt;&lt;b&gt;The fix&lt;/b&gt;:&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style=&quot;font-family: inherit;&quot;&gt;To remedy this, I had to physically cutoff the trace between the reset pin 1 and $V_{CC}$ pin 7.&amp;nbsp;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;/p&gt;&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgctGZeVxH7y6fD95P4L-MC6RcJFk4ixS_i_U8NLdZbkBWqskNkRK-8ys4Yz1N0voM1mkso6mbu3aBdMMvHyo1tDJ0XRNRIydtArUmWAPxzE8eF4tK16E1g0MAoDfA5XDl7LnSxyfvoCxZYw8jlV95Eat8R9jNxrqobTBDTRX8mZQR0z7Xn5deUFIkUrLPM/s803/trace%20removed.png&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;span style=&quot;font-family: inherit;&quot;&gt;&lt;img alt=&quot;trace removed&quot; border=&quot;0&quot; data-original-height=&quot;349&quot; data-original-width=&quot;803&quot; height=&quot;278&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgctGZeVxH7y6fD95P4L-MC6RcJFk4ixS_i_U8NLdZbkBWqskNkRK-8ys4Yz1N0voM1mkso6mbu3aBdMMvHyo1tDJ0XRNRIydtArUmWAPxzE8eF4tK16E1g0MAoDfA5XDl7LnSxyfvoCxZYw8jlV95Eat8R9jNxrqobTBDTRX8mZQR0z7Xn5deUFIkUrLPM/w640-h278/trace%20removed.png&quot; title=&quot;trace removed&quot; width=&quot;640&quot; /&gt;&lt;/span&gt;&lt;/a&gt;&lt;/div&gt;&lt;span style=&quot;font-family: inherit;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;p&gt;&lt;/p&gt;&lt;p&gt;&lt;b&gt;&lt;span style=&quot;font-family: inherit;&quot;&gt;2. AVCC pin 20 was left unconnected.&lt;/span&gt;&lt;/b&gt;&lt;/p&gt;&lt;p&gt;&lt;span style=&quot;font-family: inherit;&quot;&gt;&lt;span&gt;Another blunder was that the $AV_{CC}$ pin 20 was left unconnected. It was just routed to the header pin as shown in the picture below.&amp;nbsp;&lt;/span&gt;&lt;span&gt;The thing is even if we aren&#39;t using the ADC,&amp;nbsp;&lt;/span&gt;&lt;span class=&quot;math-inline&quot; data-index-in-node=&quot;79&quot; data-math=&quot;AV_{CC}&quot; style=&quot;line-height: 1.15; margin-top: 0px;&quot;&gt;$AV_{CC}$&lt;/span&gt;&lt;span&gt;&amp;nbsp;must be powered for the chip to function reliably.&amp;nbsp;&lt;/span&gt;The ATmega328P uses this pin to power the internal ADC and some of the Port C I/O. If left floating, I might get erratic behavior on those pins.&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;/p&gt;&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiGxxTN1Ti-j1-XJ_1lqRj_M2hLLIk6IYabmLncMMIbhMbhMIK0ppdilktn2-0iaCzNFWgCeXV0epbexm_r_YEpgDn65qFEU3-1jcbFRPyk1I975j6-C3o5OqeAclkMu6Hhg0WEETJ13a3G5niN_SleBrMB99eYDBlnrBCP7rbQOi1Lgl0r_t9WJQJAWeca/s1150/AVCC%20unconnected.png&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;span style=&quot;font-family: inherit;&quot;&gt;&lt;img alt=&quot;AVCC pin 20 unconnected&quot; border=&quot;0&quot; data-original-height=&quot;1053&quot; data-original-width=&quot;1150&quot; height=&quot;366&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiGxxTN1Ti-j1-XJ_1lqRj_M2hLLIk6IYabmLncMMIbhMbhMIK0ppdilktn2-0iaCzNFWgCeXV0epbexm_r_YEpgDn65qFEU3-1jcbFRPyk1I975j6-C3o5OqeAclkMu6Hhg0WEETJ13a3G5niN_SleBrMB99eYDBlnrBCP7rbQOi1Lgl0r_t9WJQJAWeca/w400-h366/AVCC%20unconnected.png&quot; title=&quot;AVCC unconnected&quot; width=&quot;400&quot; /&gt;&lt;/span&gt;&lt;/a&gt;&lt;/div&gt;&lt;span data-index-in-node=&quot;0&quot; data-path-to-node=&quot;2,1,1,0,0&quot; style=&quot;font-family: inherit; line-height: 1.15; margin-top: 0px;&quot;&gt;&lt;p&gt;&lt;b data-index-in-node=&quot;0&quot; data-path-to-node=&quot;2,1,1,0,0&quot; style=&quot;font-weight: bold; line-height: 1.15; margin-top: 0px;&quot;&gt;The Fix:&lt;/b&gt;&lt;span&gt;&amp;nbsp;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span&gt;I solved this by connecting the&amp;nbsp;&lt;/span&gt;&lt;span&gt;(&lt;/span&gt;&lt;span class=&quot;math-inline&quot; data-index-in-node=&quot;25&quot; data-math=&quot;AV_{CC}&quot; style=&quot;line-height: 1.15; margin-top: 0px;&quot;&gt;$AV_{CC}$) pin&lt;/span&gt;&lt;span&gt;&amp;nbsp;20 &lt;/span&gt;&lt;span&gt;to &lt;/span&gt;&lt;span class=&quot;math-inline&quot; data-index-in-node=&quot;37&quot; data-math=&quot;V_{CC}&quot; style=&quot;line-height: 1.15; margin-top: 0px;&quot;&gt;$V_{CC}$ pin. That is, I&amp;nbsp;&lt;/span&gt;added a small jumper wire&amp;nbsp;between Pin 7 (&lt;span class=&quot;math-inline&quot; data-index-in-node=&quot;132&quot; data-math=&quot;V_{CC}&quot; style=&quot;line-height: 1.15; margin-top: 0px;&quot;&gt;$V_{CC}$&lt;/span&gt;) and Pin 20 (&lt;span class=&quot;math-inline&quot; data-index-in-node=&quot;152&quot; data-math=&quot;AV_{CC}&quot; style=&quot;line-height: 1.15; margin-top: 0px;&quot;&gt;$AV_{CC}$&lt;/span&gt;).&lt;/p&gt;&lt;p&gt;&lt;/p&gt;&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhnnq7_v4I6-l8d8J130ucTE7PZGTpNmpITkv3M9FEEtNlYlnVacDhsT6Jf-le93eGW2dsnyjjf6BeDMOxYlRd_8_M9vgSkGJIjPHodME5e6KVhOrkUSRRdVJ9_4gTJJiKhWhYD9UugA1MOM8N81QBG64_v3NBqnEQOBLWC3Y__tC9O0viiVmVN2lnfugiG/s551/pin%207%20to%20avcc%20pin%2020.png&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img alt=&quot;VCC pin 7 connected to AVCC pin 20&quot; border=&quot;0&quot; data-original-height=&quot;544&quot; data-original-width=&quot;551&quot; height=&quot;632&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhnnq7_v4I6-l8d8J130ucTE7PZGTpNmpITkv3M9FEEtNlYlnVacDhsT6Jf-le93eGW2dsnyjjf6BeDMOxYlRd_8_M9vgSkGJIjPHodME5e6KVhOrkUSRRdVJ9_4gTJJiKhWhYD9UugA1MOM8N81QBG64_v3NBqnEQOBLWC3Y__tC9O0viiVmVN2lnfugiG/w640-h632/pin%207%20to%20avcc%20pin%2020.png&quot; title=&quot;VCC pin 7 connected to AVCC pin 20&quot; width=&quot;640&quot; /&gt;&lt;/a&gt;&lt;/div&gt;&lt;span class=&quot;math-inline&quot; data-index-in-node=&quot;37&quot; data-math=&quot;V_{CC}&quot; style=&quot;line-height: 1.15; margin-top: 0px;&quot;&gt;&lt;div&gt;&lt;span style=&quot;font-family: inherit;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span style=&quot;font-family: inherit;&quot;&gt;After solving the pin 1 $V_{CC}$ problem and the connection to $AV_{CC} pin 20, I soldered a jumper wire from their junction to the +5V power rail.&lt;/span&gt;&lt;/div&gt;&lt;p&gt;&lt;/p&gt;&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhvWjVqYCuvWsPiddtHyrNm_wYgKQ53MYeUeKvn5siM2lHL6jM8ipGCmTcuSXtl0IE4HGSQoqYV8XY7k_diDtPN1GrB1MrdXoU7WsGNkJ81w4uszLk0_4-hCXSQP2GukouGnY7OZlzKL0KGgHFSTKEpuH8AyQVK15nyR_ojd304tBl58EBM41EN07WtroyJ/s506/pin1%20and%20pin%2020%20connected%20to%20power%20rail.png&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img alt=&quot;pin1 and pin 20 connected to power rail&quot; border=&quot;0&quot; data-original-height=&quot;187&quot; data-original-width=&quot;506&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhvWjVqYCuvWsPiddtHyrNm_wYgKQ53MYeUeKvn5siM2lHL6jM8ipGCmTcuSXtl0IE4HGSQoqYV8XY7k_diDtPN1GrB1MrdXoU7WsGNkJ81w4uszLk0_4-hCXSQP2GukouGnY7OZlzKL0KGgHFSTKEpuH8AyQVK15nyR_ojd304tBl58EBM41EN07WtroyJ/s16000/pin1%20and%20pin%2020%20connected%20to%20power%20rail.png&quot; title=&quot;pin1 and pin 20 connected to power rail&quot; /&gt;&lt;/a&gt;&lt;/div&gt;&lt;p&gt;&lt;/p&gt;&lt;/span&gt;&lt;p&gt;&lt;/p&gt;&lt;p&gt;&lt;b&gt;&lt;span&gt;3.&amp;nbsp;&lt;/span&gt;&lt;span&gt;Capacitor removed&lt;/span&gt;&lt;/b&gt;&lt;/p&gt;&lt;p data-path-to-node=&quot;2,0,0&quot; style=&quot;line-height: 1.15; margin-top: 0px;&quot;&gt;&lt;span class=&quot;math-inline&quot; data-index-in-node=&quot;160&quot; data-math=&quot;0.1\mu\text{F}&quot; style=&quot;line-height: 1.15; margin-top: 0px;&quot;&gt;A $0.1 \mu F$&lt;/span&gt; capacitor (&lt;span class=&quot;math-inline&quot; data-index-in-node=&quot;186&quot; data-math=&quot;C_6&quot; style=&quot;line-height: 1.15; margin-top: 0px;&quot;&gt;$C_6$&lt;/span&gt;) was connected from one end of the $R_3$ $10 k\Omega$&amp;nbsp;&lt;span class=&quot;math-inline&quot; data-index-in-node=&quot;231&quot; data-math=&quot;10\text{k}\Omega&quot; style=&quot;line-height: 1.15; margin-top: 0px;&quot;&gt;pullup&lt;/span&gt; resistor to the header pin. In Arduino-compatible designs, a &lt;span class=&quot;math-inline&quot; data-index-in-node=&quot;38&quot; data-math=&quot;0.1\mu\text{F}&quot; style=&quot;line-height: 1.15; margin-top: 0px;&quot;&gt;$0.1\mu F$&lt;/span&gt; capacitor is used for &lt;span data-index-in-node=&quot;75&quot; data-path-to-node=&quot;9&quot; style=&quot;line-height: 1.15; margin-top: 0px;&quot;&gt;Auto-Reset&lt;/span&gt;.&lt;/p&gt;&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgez12nG2s5OUIv5b6UVa3KVLn0vHzjbilOapk2WrhGsrLUN4zGy_XFYENtwXih-sWjq4-_zmLDalLJ-8c_FAjfTmAmMi4ZeeGk3XGQD86q3Hl8zyobzCY5JIR0ddeNIETIMS5EDoq9gZT6i_vhReUPyzBBgIVYh5Em9c_Eu5HBE6ebn9vdGjlTlnoMljPX/s1653/capacitor%20problem.png&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img alt=&quot;capacitor problem&quot; border=&quot;0&quot; data-original-height=&quot;597&quot; data-original-width=&quot;1653&quot; height=&quot;232&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgez12nG2s5OUIv5b6UVa3KVLn0vHzjbilOapk2WrhGsrLUN4zGy_XFYENtwXih-sWjq4-_zmLDalLJ-8c_FAjfTmAmMi4ZeeGk3XGQD86q3Hl8zyobzCY5JIR0ddeNIETIMS5EDoq9gZT6i_vhReUPyzBBgIVYh5Em9c_Eu5HBE6ebn9vdGjlTlnoMljPX/w640-h232/capacitor%20problem.png&quot; title=&quot;capacitor problem&quot; width=&quot;640&quot; /&gt;&lt;/a&gt;&lt;/div&gt;&lt;br /&gt;&lt;div class=&quot;separator&quot; style=&quot;clear: both;&quot;&gt;&lt;b&gt;The Fix&lt;/b&gt;:&amp;nbsp;&lt;/div&gt;&lt;div class=&quot;separator&quot; style=&quot;clear: both;&quot;&gt;&lt;br /&gt;&lt;/div&gt;&lt;div class=&quot;separator&quot; style=&quot;clear: both;&quot;&gt;$C_6$ was removed from that position. Perhaps at the time when I made the circuit it was intended for DTR/Auto-Reset (for programming via USB-to-Serial). It should sit between an external &quot;DTR&quot; pin and Pin 1 if that were the case. But for now, I just cut off the capacitor as I was more interested in running the board and so I simply bridged or joined its legs as shown in the picture below.&lt;/div&gt;&lt;p&gt;&lt;/p&gt;&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgsVtQnnI7Z18ZGjCXjN7SwYQ7rArfMsq1fBSJzB0EQXd5OSEPCWmuSt6uemMxknQT0-vJSuBE5dqyjjh1_QVO693opSuhBJwESkBPGmUVETXhBeSJVoHV6B1Ss6qN0dcNMH1bbld8MXk7FIEGnZjM8SQ_KlAH_ydvoZZkUWbvuFs6Axfm_gnc2da1N4uJ8/s733/capacitor%20cutoff.png&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img alt=&quot;removing capacitor&quot; border=&quot;0&quot; data-original-height=&quot;273&quot; data-original-width=&quot;733&quot; height=&quot;238&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgsVtQnnI7Z18ZGjCXjN7SwYQ7rArfMsq1fBSJzB0EQXd5OSEPCWmuSt6uemMxknQT0-vJSuBE5dqyjjh1_QVO693opSuhBJwESkBPGmUVETXhBeSJVoHV6B1Ss6qN0dcNMH1bbld8MXk7FIEGnZjM8SQ_KlAH_ydvoZZkUWbvuFs6Axfm_gnc2da1N4uJ8/w640-h238/capacitor%20cutoff.png&quot; title=&quot;removing capacitor&quot; width=&quot;640&quot; /&gt;&lt;/a&gt;&lt;/div&gt;&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;&lt;br /&gt;&lt;/div&gt;&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: left;&quot;&gt;&lt;b&gt;4.&amp;nbsp;&lt;span data-index-in-node=&quot;0&quot; data-path-to-node=&quot;6,2,0&quot; style=&quot;line-height: 1.15; margin-top: 0px;&quot;&gt;AREF Cap:&lt;/span&gt;&amp;nbsp;&lt;/b&gt;&lt;/div&gt;&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: left;&quot;&gt;&lt;br /&gt;&lt;/div&gt;&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: left;&quot;&gt;I came to know that while it is not strictly &quot;critical&quot; for the chip to boot, adding a &lt;span class=&quot;math-inline&quot; data-index-in-node=&quot;71&quot; data-math=&quot;0.1\mu\text{F}&quot; style=&quot;line-height: 1.15; margin-top: 0px;&quot;&gt;$0.1\mu\text{F}$&lt;/span&gt; cap on &lt;b data-index-in-node=&quot;93&quot; data-path-to-node=&quot;6,2,0&quot; style=&quot;line-height: 1.15; margin-top: 0px;&quot;&gt;Pin 21&lt;/b&gt; to Ground is standard practice to keep your analog readings stable. So, I connected one as shown in the picture below.&lt;/div&gt;&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: left;&quot;&gt;&lt;br /&gt;&lt;/div&gt;&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEg2UJXYRp5qae5USIOojOtePE8sl6F8Q-yIz7z17SaelFtf0sgcBM9BXnWNYWlPd4JoDRhTZ84DimrzMep4ZEtpoYPPTkZA8VnfslBGY6JtPqe8EyuG4Z_1FOwZCKChim5UMsbnVlSLeIY22HZ6WahGDaSrmIgDws04mNqnyelk_3BABApoelKu7ys8GNR9/s283/capacitor%20added%20to%20AREF%20to%20GND.png&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img alt=&quot;capacitor added to AREF to GND&quot; border=&quot;0&quot; data-original-height=&quot;200&quot; data-original-width=&quot;283&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEg2UJXYRp5qae5USIOojOtePE8sl6F8Q-yIz7z17SaelFtf0sgcBM9BXnWNYWlPd4JoDRhTZ84DimrzMep4ZEtpoYPPTkZA8VnfslBGY6JtPqe8EyuG4Z_1FOwZCKChim5UMsbnVlSLeIY22HZ6WahGDaSrmIgDws04mNqnyelk_3BABApoelKu7ys8GNR9/s16000/capacitor%20added%20to%20AREF%20to%20GND.png&quot; title=&quot;capacitor added to AREF to GND&quot; /&gt;&lt;/a&gt;&lt;/div&gt;&lt;br /&gt;&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: left;&quot;&gt;&lt;b&gt;5. The Resistor $R_2$ value&amp;nbsp;&lt;/b&gt;&lt;/div&gt;&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: left;&quot;&gt;&lt;br /&gt;&lt;/div&gt;&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: left;&quot;&gt;When I measured the voltage at the output of the LM317 voltage regulator and at the reset pin 1 of the ATmega328P IC, I got 5.6V. In my original design, I used 3.3 $k \Omega$ resistor for&amp;nbsp;$R_2$. I had used LM317 voltage regulator (I know there are better IC for this) and the output voltage was set by the&amp;nbsp;$R_1$&amp;nbsp;and&amp;nbsp;$R_2$&amp;nbsp;resistors value.&amp;nbsp;&lt;/div&gt;&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: left;&quot;&gt;&lt;br /&gt;&lt;/div&gt;&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiNcDfPHBk8ry_LFIOh9wN2hCQ7gndubJDUMgq5oUu86SeaglwDk38sUTh074ZvfHkYT9VPa3M7qOaJa8-bq49Ge7K_HojVfO60vGKh7rqUG_U_6N_Acj4esXyM-PcKi075ksDLIvISuZRshyrKIJXibI6QcXhCVM3PRHH8lIFvkRzxzXObSIkBX1EyFaGZ/s1875/resistor%20problem.png&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img alt=&quot;resistor problem&quot; border=&quot;0&quot; data-original-height=&quot;529&quot; data-original-width=&quot;1875&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiNcDfPHBk8ry_LFIOh9wN2hCQ7gndubJDUMgq5oUu86SeaglwDk38sUTh074ZvfHkYT9VPa3M7qOaJa8-bq49Ge7K_HojVfO60vGKh7rqUG_U_6N_Acj4esXyM-PcKi075ksDLIvISuZRshyrKIJXibI6QcXhCVM3PRHH8lIFvkRzxzXObSIkBX1EyFaGZ/s16000/resistor%20problem.png&quot; title=&quot;resistor problem&quot; /&gt;&lt;/a&gt;&lt;/div&gt;&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: left;&quot;&gt;&lt;span style=&quot;font-family: inherit;&quot;&gt;Since I used&amp;nbsp;&lt;/span&gt;&lt;span class=&quot;math-inline&quot; data-index-in-node=&quot;11&quot; data-math=&quot;R_1 = 1\text{k}\Omega&quot; style=&quot;font-family: inherit; line-height: 1.15; margin-top: 0px;&quot;&gt;$R_1 = 1\text{k}\Omega$&lt;/span&gt;&lt;span style=&quot;font-family: inherit;&quot;&gt; and &lt;/span&gt;&lt;span class=&quot;math-inline&quot; data-index-in-node=&quot;37&quot; data-math=&quot;R_2 = 3.3\text{k}\Omega&quot; style=&quot;font-family: inherit; line-height: 1.15; margin-top: 0px;&quot;&gt;$R_2 = 3.3\text{k}\Omega$&lt;/span&gt;&lt;span style=&quot;font-family: inherit;&quot;&gt;, the math for a LM317 adjustable regulator is:&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: left;&quot;&gt;&lt;div data-path-to-node=&quot;2&quot; style=&quot;line-height: 1.15; margin-top: 0px;&quot;&gt;&lt;div class=&quot;math-block&quot; data-math=&quot;V_{out} = 1.25 \times \left(1 + \frac{3300}{1000}\right) = 5.375\text{V}&quot; style=&quot;line-height: 1.15; margin-top: 0px;&quot;&gt;$$V_{out} = 1.25 \times \left(1 + \frac{3300}{1000}\right) = 5.375\text{V}$$&lt;/div&gt;&lt;/div&gt;&lt;p data-path-to-node=&quot;3&quot; style=&quot;line-height: 1.15; margin-top: 0px;&quot;&gt;&lt;span style=&quot;font-family: inherit;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p data-path-to-node=&quot;3&quot; style=&quot;line-height: 1.15; margin-top: 0px;&quot;&gt;&lt;span style=&quot;font-family: inherit;&quot;&gt;When one adds in the &lt;/span&gt;&lt;b data-index-in-node=&quot;20&quot; data-path-to-node=&quot;3&quot; style=&quot;font-family: inherit; line-height: 1.15; margin-top: 0px;&quot;&gt;Adjustment Pin Current&lt;/b&gt;&lt;span style=&quot;font-family: inherit;&quot;&gt; (usually about &lt;/span&gt;&lt;span class=&quot;math-inline&quot; data-index-in-node=&quot;58&quot; data-math=&quot;50\mu\text{A}&quot; style=&quot;font-family: inherit; line-height: 1.15; margin-top: 0px;&quot;&gt;$50\mu\text{A}$&lt;/span&gt;&lt;span style=&quot;font-family: inherit;&quot;&gt; to &lt;/span&gt;&lt;span class=&quot;math-inline&quot; data-index-in-node=&quot;75&quot; data-math=&quot;100\mu\text{A}&quot; style=&quot;font-family: inherit; line-height: 1.15; margin-top: 0px;&quot;&gt;$100\mu\text{A}$&lt;/span&gt;&lt;span style=&quot;font-family: inherit;&quot;&gt;) that flows through &lt;/span&gt;&lt;span class=&quot;math-inline&quot; data-index-in-node=&quot;110&quot; data-math=&quot;R_2&quot; style=&quot;font-family: inherit; line-height: 1.15; margin-top: 0px;&quot;&gt;$R_2$&lt;/span&gt;&lt;span style=&quot;font-family: inherit;&quot;&gt;, the voltage climbs even further. On the board, that current adds roughly another &lt;/span&gt;&lt;span class=&quot;math-inline&quot; data-index-in-node=&quot;197&quot; data-math=&quot;0.2\text{V}&quot; style=&quot;font-family: inherit; line-height: 1.15; margin-top: 0px;&quot;&gt;$0.2\text{V}$&lt;/span&gt;&lt;span style=&quot;font-family: inherit;&quot;&gt; to &lt;/span&gt;&lt;span class=&quot;math-inline&quot; data-index-in-node=&quot;212&quot; data-math=&quot;0.3\text{V}&quot; style=&quot;font-family: inherit; line-height: 1.15; margin-top: 0px;&quot;&gt;$0.3\text{V}$&lt;/span&gt;&lt;span style=&quot;font-family: inherit;&quot;&gt;:&lt;/span&gt;&lt;/p&gt;&lt;div data-path-to-node=&quot;4&quot; style=&quot;line-height: 1.15; margin-top: 0px;&quot;&gt;&lt;div class=&quot;math-block&quot; data-math=&quot;5.375\text{V} + (100\mu\text{A} \times 3300\Omega) \approx \mathbf{5.7\text{V}}&quot; style=&quot;line-height: 1.15; margin-top: 0px;&quot;&gt;$$5.375\text{V} + (100\mu\text{A} \times 3300\Omega) \approx \mathbf{5.7\text{V}}$$&lt;/div&gt;&lt;/div&gt;&lt;/div&gt;&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: left;&quot;&gt;&lt;br /&gt;&lt;/div&gt;&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: left;&quot;&gt;&lt;b data-index-in-node=&quot;0&quot; data-path-to-node=&quot;9,0,0&quot; style=&quot;font-family: &amp;quot;Google Sans Text&amp;quot;, sans-serif; line-height: 1.15; margin-top: 0px;&quot;&gt;The Fix:&lt;/b&gt;&amp;nbsp;&lt;/div&gt;&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: left;&quot;&gt;&lt;br /&gt;&lt;/div&gt;&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: left;&quot;&gt;I replaced the &lt;span data-index-in-node=&quot;26&quot; data-path-to-node=&quot;9,0,0&quot; face=&quot;&amp;quot;Google Sans Text&amp;quot;, sans-serif !important&quot; style=&quot;line-height: 1.15; margin-top: 0px;&quot;&gt;$3.3\text{k}\Omega$&lt;/span&gt; resistor with a &lt;span data-index-in-node=&quot;60&quot; data-path-to-node=&quot;9,0,0&quot; face=&quot;&amp;quot;Google Sans Text&amp;quot;, sans-serif !important&quot; style=&quot;line-height: 1.15; margin-top: 0px;&quot;&gt;$2.7\text{k}\Omega$&lt;/span&gt; resistor. Using&amp;nbsp;&lt;span style=&quot;font-family: inherit;&quot;&gt;&amp;nbsp;&lt;/span&gt;&lt;span data-index-in-node=&quot;60&quot; data-path-to-node=&quot;9,0,0&quot; face=&quot;&amp;quot;Google Sans Text&amp;quot;, sans-serif !important&quot; style=&quot;line-height: 1.15; margin-top: 0px;&quot;&gt;$ R_1=1\text{k}\Omega$ and&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;font-family: inherit;&quot;&gt;&amp;nbsp;&lt;/span&gt;&lt;span data-index-in-node=&quot;60&quot; data-path-to-node=&quot;9,0,0&quot; face=&quot;&amp;quot;Google Sans Text&amp;quot;, sans-serif !important&quot; style=&quot;line-height: 1.15; margin-top: 0px;&quot;&gt;$R_2=2.7\text{k}\Omega$ I got&lt;/span&gt;&lt;span style=&quot;font-family: inherit;&quot;&gt;&amp;nbsp;roughly &lt;/span&gt;&lt;span class=&quot;math-inline&quot; data-index-in-node=&quot;122&quot; data-math=&quot;5.1\text{V}&quot; face=&quot;&amp;quot;Google Sans Text&amp;quot;, sans-serif !important&quot; style=&quot;line-height: 1.15; margin-top: 0px;&quot;&gt;$4.8\text{V}$&lt;/span&gt;&lt;span style=&quot;font-family: inherit;&quot;&gt;, which is perfect.&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: left;&quot;&gt;&lt;span style=&quot;font-family: inherit;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: left;&quot;&gt;&lt;span style=&quot;font-family: inherit;&quot;&gt;So, these are the fixes I made. Below is picture that shows the bottom side of the PCB board where I made the various changes.&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: left;&quot;&gt;&lt;span style=&quot;font-family: inherit;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: left;&quot;&gt;&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiJkswflUV0do0meTzqb1HQlaCziuXVvEdamocWQYgkdbJHCIokfqSUGjpI93Pa-rIOVHq4XIZZE-F6uDKRuypEL5i_qJP-lKeLSXRr2WOKWQUxwxWW2SYsbZYGbIY-P20lf_3F9JWKGnjHePBwnYEsatkvG3f6NUhef4c7dWnjB54ISaOjsLlLyzHBmcvh/s536/repair.png&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img alt=&quot;repaired diy arduino board&quot; border=&quot;0&quot; data-original-height=&quot;536&quot; data-original-width=&quot;398&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiJkswflUV0do0meTzqb1HQlaCziuXVvEdamocWQYgkdbJHCIokfqSUGjpI93Pa-rIOVHq4XIZZE-F6uDKRuypEL5i_qJP-lKeLSXRr2WOKWQUxwxWW2SYsbZYGbIY-P20lf_3F9JWKGnjHePBwnYEsatkvG3f6NUhef4c7dWnjB54ISaOjsLlLyzHBmcvh/s16000/repair.png&quot; title=&quot;repaired diy arduino board&quot; /&gt;&lt;/a&gt;&lt;/div&gt;&lt;br /&gt;&lt;span style=&quot;font-family: inherit;&quot;&gt;The board size is comparable to the standard Arduino Uno as shown in the picture below.&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: left;&quot;&gt;&lt;span style=&quot;font-family: inherit;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiQOoJmmhnsdPg8obVUVDGWalzDehl6xOTJHwaf2-PN3Ofip1_b1nqFZogk1jZJ-xxZSzcCOkD-5M2AR2vvvghdPtrdk8bsUa_irBI0Ok2Va-gQnSp6xZlvKjl4H8IPEln3VTDXfCJdwnNMJwFELD2OE4o7U8-Yn7F71RgHjqyQn6wK9oiGrC20w9fLdBpK/s794/compare2.png&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img alt=&quot;diy arduino and standard arduino board size compared&quot; border=&quot;0&quot; data-original-height=&quot;554&quot; data-original-width=&quot;794&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiQOoJmmhnsdPg8obVUVDGWalzDehl6xOTJHwaf2-PN3Ofip1_b1nqFZogk1jZJ-xxZSzcCOkD-5M2AR2vvvghdPtrdk8bsUa_irBI0Ok2Va-gQnSp6xZlvKjl4H8IPEln3VTDXfCJdwnNMJwFELD2OE4o7U8-Yn7F71RgHjqyQn6wK9oiGrC20w9fLdBpK/s16000/compare2.png&quot; title=&quot;diy arduino and standard arduino board size compared&quot; /&gt;&lt;/a&gt;&lt;/div&gt;&lt;br /&gt;&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: left;&quot;&gt;&lt;span style=&quot;font-family: inherit;&quot;&gt;I inserted a pre-programmed Atmega328P programmed to blink a LED connected to PD2 pin to test the board. As soon as I inserted the chip into the IC holder, it turned on and started blinking. This was a big relief for me. Since I have 5 or more of these boards, I can now reuse them in various projects.&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: left;&quot;&gt;&lt;span style=&quot;font-family: inherit;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: left;&quot;&gt;I recorded all the repair work, soldering and what not if you wish to know how I did that.&lt;/div&gt;&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: left;&quot;&gt;&lt;br /&gt;&lt;/div&gt;&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;&lt;iframe allowfullscreen=&quot;&quot; class=&quot;BLOG_video_class&quot; height=&quot;440&quot; src=&quot;https://www.youtube.com/embed/MXQrQcrQgoE&quot; width=&quot;529&quot; youtube-src-id=&quot;MXQrQcrQgoE&quot;&gt;&lt;/iframe&gt;&lt;/div&gt;&lt;br /&gt;&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: left;&quot;&gt;Special thanks to &lt;b&gt;NextPCB&lt;/b&gt; for the excellent PCB board and the support. I highly recommend their&amp;nbsp;&lt;a href=&quot;https://www.nextpcb.com/dfm&quot; style=&quot;font-family: inherit;&quot;&gt;&lt;b&gt;HQDFM&lt;/b&gt;&lt;/a&gt;&amp;nbsp;tool which&lt;span style=&quot;font-family: inherit;&quot;&gt;&amp;nbsp;is a free online Gerber viewer and Design for Manufacture (DFM) tool that helps analyze PCB production files.&amp;nbsp;&lt;/span&gt;&lt;/div&gt;&lt;/span&gt;</content><link rel='replies' type='application/atom+xml' href='http://www.ee-diary.net/feeds/2844640825666078323/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.ee-diary.net/2026/04/fixing-my-diy-arduino-pcb-design.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7437986969318338216/posts/default/2844640825666078323'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7437986969318338216/posts/default/2844640825666078323'/><link rel='alternate' type='text/html' href='http://www.ee-diary.net/2026/04/fixing-my-diy-arduino-pcb-design.html' title='Fixing My DIY Arduino PCB Design Mistakes After 3 Years'/><author><name>Unknown</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhNXJoImgJv9eEctLp5ql1JhAGu-O78Ho_ZQ85pDt6ZZKnoLpQdGSZy7Dv-Wm8Y4OKGjaaJI8nFN5MoyMCWpjALzuT_3rHfwsnpW_JGOBVkf1NImjETQBXYV6LdcIz9bEPbllO-6LZM5MOKN0eca4HfSXl7HtFihXvV7uvNk-sCz-8HWbj26RkK0XDtlXo1/s72-w320-h260-c/arduino%20pcb%20board.png" height="72" width="72"/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-7437986969318338216.post-5883118343584389229</id><published>2026-04-10T17:18:00.004+05:45</published><updated>2026-04-10T17:18:43.551+05:45</updated><category scheme="http://www.blogger.com/atom/ns#" term="74HC595"/><category scheme="http://www.blogger.com/atom/ns#" term="arduino"/><category scheme="http://www.blogger.com/atom/ns#" term="LCD"/><category scheme="http://www.blogger.com/atom/ns#" term="shift register"/><title type='text'>Running Out of Pins? I2C alternative to Control a 16x2 LCD with Arduino 3 Pins</title><content type='html'>&lt;div class=&quot;separator&quot; style=&quot;display: none;&quot;&gt;&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjCvtE4IbO53Ob7hUPbYELCYeRetsWUJUWLPjGyW4_-62qVD8JoQ75NhyphenhyphenMAJbgDDGgCvM_6zicCbkO7Eg0Gw8JvFkfL3HpDCeMjjNyybSOEJQUT7kGcqsL4qtY2RXKt6P6FCuyuNxLg1weDhnNBCPG0hX5aTFmUhJPc0gLn1IN7cDNEmVywjy1GphvOGwdl/s1600/1.jpg&quot; style=&quot;display: block; padding: 1em 0px; text-align: center;&quot;&gt;&lt;img alt=&quot;&amp;lt;/pre&amp;gt;&quot; border=&quot;0&quot; data-original-height=&quot;852&quot; data-original-width=&quot;1024&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjCvtE4IbO53Ob7hUPbYELCYeRetsWUJUWLPjGyW4_-62qVD8JoQ75NhyphenhyphenMAJbgDDGgCvM_6zicCbkO7Eg0Gw8JvFkfL3HpDCeMjjNyybSOEJQUT7kGcqsL4qtY2RXKt6P6FCuyuNxLg1weDhnNBCPG0hX5aTFmUhJPc0gLn1IN7cDNEmVywjy1GphvOGwdl/s1600/1.jpg&quot; /&gt;&lt;/a&gt;&lt;/div&gt;
&lt;p&gt;&amp;nbsp;In complex project using Arduino that requires 16x2 LCD for display it can be problematic. Because using a 16x2 requires at least 6 digital pin (RS, EN, D4, D5, D6, and D7). Your digital pins and analog pins maybe exhausted because you have potentiometer and other sensors already connected. So in large projects with Arduino I/O pins quickly runs out. One may use a I2C LCD as in&lt;a href=&quot;https://www.ee-diary.net/2022/11/arduino-nano-i2c-lcd-interfacing.html&quot;&gt;Arduino Nano I2C LCD Interfacing &amp;amp; Programming&lt;/a&gt;, but you may have already used it for connecting other peripheals to the available I2C pins. Such problem forces hobbyists to either upgrade to boars like Arduino Mega or sacrifice features to keep the LCD display.&amp;nbsp;&lt;/p&gt;&lt;p&gt;The problem of I/O pin exhaustion can be solved using the 74HC595 shift register. By using the 74HC595 &quot;Serial-In, Parallel-Out&quot; (SIPO) architecture, you can control all the data and control lines of the display using only&amp;nbsp;&lt;b data-index-in-node=&quot;278&quot; data-path-to-node=&quot;4&quot;&gt;3 digital pins&lt;/b&gt;&amp;nbsp;(Data, Clock, and Latch). You can send the data like Analog sensor data to the 74HC595 in a serial stream and the shift register unpacks and sends out in parallel data to the 16x2 LCD. This effectively frees up three additional pins for other sensors or actuators while maintaining a fast, responsive interface for real-time data visualization.&lt;/p&gt;&lt;p&gt;An example circuit is shown below. Here Arduino Nano is used to read the POT value and sends the data to shift register IC serially. The Arduino 3 pins D2,D3 and D4 is connected to the shift register DS,STCP and SHCP pins respectively. The LCD16x2 pins D7 to D4 are connected to the shift register Q1 to A4 pins, the EN and RS pins are connected to the Q5 and Q6 respectively.&amp;nbsp;&lt;/p&gt;&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEg8xianHL-fdvm6btRqmrmUedSar0H9-5E6yxZV-6nQYsBNG8Mzdy4MbhXhd1d4pZwMxzH3VAxYiQ3xMvOn3GYvC7b7xadDrEYCb89-4Cp9UAJu1_z5AEjGirHtm3FNUE3x2y1gzh2QhunMd-Qyh7WXjxmZn33lMTodz3ly2LOg6PbZkNHWeVGqygbdBRsY/s675/1.png&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img alt=&quot;74HC595 shift register arduino LCD display circuit diagram&quot; border=&quot;0&quot; data-original-height=&quot;562&quot; data-original-width=&quot;675&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEg8xianHL-fdvm6btRqmrmUedSar0H9-5E6yxZV-6nQYsBNG8Mzdy4MbhXhd1d4pZwMxzH3VAxYiQ3xMvOn3GYvC7b7xadDrEYCb89-4Cp9UAJu1_z5AEjGirHtm3FNUE3x2y1gzh2QhunMd-Qyh7WXjxmZn33lMTodz3ly2LOg6PbZkNHWeVGqygbdBRsY/s16000/1.png&quot; title=&quot;74HC595 shift register arduino LCD display circuit diagram&quot; /&gt;&lt;/a&gt;&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;In the above circuit, a 10k POT is connected to Arduino A0 pin to read analog values which are then send serially to shift register 74HC595 which processes the serial data and sends them in parallel to the LCD.&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;In this way you can save the pins on Arduino and use it for other important connections.&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;Below is the program code that reads analog signal and display the analog voltage values on the 16x2 LCD.&lt;/div&gt;&lt;div&gt;
  &lt;pre lang=&quot;cpp&quot;&gt;&lt;code&gt;
#include &amp;lt;LiquidCrystal_74HC595.h&amp;gt;

// Shift Register Pins
const int dataPin  = 2; 
const int latchPin = 3; 
const int clockPin = 4; 

// Potentiometer Pin
const int potPin = A0;

// Mapping: (data, clock, latch, RS, E, D4, D5, D6, D7)
// RS=6, E=5, D4=4, D5=3, D6=2, D7=1
LiquidCrystal_74HC595 lcd(dataPin, clockPin, latchPin, 6, 5, 4, 3, 2, 1);

void setup() {
  lcd.begin(16, 2);
  lcd.print(&quot;Voltage Meter&quot;);
  delay(1000);
  lcd.clear();
}

void loop() {
  // Read the raw value (0 to 1023)
  int rawValue = analogRead(potPin);
  
  // Convert raw value to voltage (0.0 to 5.0)
  // Formula: (Raw Value * Input Voltage) / Max Resolution
  float voltage = (rawValue * 5.0) / 1023.0;

  // Display on LCD
  lcd.setCursor(0, 0);
  lcd.print(&quot;Raw: &quot;);
  lcd.print(rawValue);
  lcd.print(&quot;   &quot;); // Clear trailing digits

  lcd.setCursor(0, 1);
  lcd.print(&quot;Volt: &quot;);
  lcd.print(voltage, 2); // Display with 2 decimal places
  lcd.print(&quot; V  &quot;);

  delay(200); // Small delay to make the screen readable
}
&lt;/code&gt;&lt;/pre&gt;
&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;&lt;p data-path-to-node=&quot;0&quot; style=&quot;font-family: &amp;quot;Google Sans Text&amp;quot;, sans-serif; line-height: 1.15; margin-top: 0px;&quot;&gt;This code creates a digital voltmeter using an Arduino. It reads an analog signal from a potentiometer and displays both the raw digital value and the calculated voltage on an LCD screen.&lt;/p&gt;&lt;p data-path-to-node=&quot;1&quot; style=&quot;font-family: &amp;quot;Google Sans Text&amp;quot;, sans-serif; line-height: 1.15; margin-top: 0px;&quot;&gt;Because standard LCDs use many pins, this code uses a &lt;b data-index-in-node=&quot;54&quot; data-path-to-node=&quot;1&quot; style=&quot;line-height: 1.15; margin-top: 0px;&quot;&gt;74HC595 Shift Register&lt;/b&gt; to control the screen using only three digital pins from the Arduino.&lt;/p&gt;&lt;hr data-path-to-node=&quot;2&quot; style=&quot;font-family: &amp;quot;Google Sans Text&amp;quot;, sans-serif; line-height: 1.15; margin-top: 0px;&quot; /&gt;&lt;h3 data-path-to-node=&quot;3&quot; style=&quot;font-family: &amp;quot;Google Sans&amp;quot;, sans-serif; line-height: 1.15; margin-top: 0px;&quot;&gt;1. Library and Pin Configuration&lt;/h3&gt;&lt;p data-path-to-node=&quot;4&quot; style=&quot;font-family: &amp;quot;Google Sans Text&amp;quot;, sans-serif; line-height: 1.15; margin-top: 0px;&quot;&gt;The code starts by including the specific library needed to talk to an LCD through a shift register.&lt;/p&gt;&lt;ul data-path-to-node=&quot;5&quot; style=&quot;font-family: &amp;quot;Google Sans Text&amp;quot;, sans-serif; line-height: 1.15; margin-top: 0px; padding-inline-start: 32px;&quot;&gt;&lt;li style=&quot;line-height: 1.15; margin-top: 0px;&quot;&gt;&lt;p data-path-to-node=&quot;5,0,0&quot; style=&quot;line-height: 1.15; margin-top: 0px;&quot;&gt;&lt;b data-index-in-node=&quot;0&quot; data-path-to-node=&quot;5,0,0&quot; style=&quot;line-height: 1.15; margin-top: 0px;&quot;&gt;Shift Register Pins:&lt;/b&gt; &lt;code data-index-in-node=&quot;21&quot; data-path-to-node=&quot;5,0,0&quot; style=&quot;font-family: &amp;quot;Google Sans Text&amp;quot;, sans-serif; line-height: 1.15; margin-top: 0px;&quot;&gt;dataPin&lt;/code&gt;, &lt;code data-index-in-node=&quot;30&quot; data-path-to-node=&quot;5,0,0&quot; style=&quot;font-family: &amp;quot;Google Sans Text&amp;quot;, sans-serif; line-height: 1.15; margin-top: 0px;&quot;&gt;latchPin&lt;/code&gt;, and &lt;code data-index-in-node=&quot;44&quot; data-path-to-node=&quot;5,0,0&quot; style=&quot;font-family: &amp;quot;Google Sans Text&amp;quot;, sans-serif; line-height: 1.15; margin-top: 0px;&quot;&gt;clockPin&lt;/code&gt; are the three wires that send data from the Arduino to the 74HC595 chip.&lt;/p&gt;&lt;/li&gt;&lt;li style=&quot;line-height: 1.15; margin-top: 0px;&quot;&gt;&lt;p data-path-to-node=&quot;5,1,0&quot; style=&quot;line-height: 1.15; margin-top: 0px;&quot;&gt;&lt;b data-index-in-node=&quot;0&quot; data-path-to-node=&quot;5,1,0&quot; style=&quot;line-height: 1.15; margin-top: 0px;&quot;&gt;The Constructor:&lt;/b&gt; The line &lt;code data-index-in-node=&quot;26&quot; data-path-to-node=&quot;5,1,0&quot; style=&quot;font-family: &amp;quot;Google Sans Text&amp;quot;, sans-serif; line-height: 1.15; margin-top: 0px;&quot;&gt;LiquidCrystal_74HC595 lcd(...)&lt;/code&gt; tells the library exactly how the shift register pins are wired to the LCD&#39;s pins (RS, Enable, and Data lines).&lt;/p&gt;&lt;/li&gt;&lt;/ul&gt;&lt;hr data-path-to-node=&quot;6&quot; style=&quot;font-family: &amp;quot;Google Sans Text&amp;quot;, sans-serif; line-height: 1.15; margin-top: 0px;&quot; /&gt;&lt;h3 data-path-to-node=&quot;7&quot; style=&quot;font-family: &amp;quot;Google Sans&amp;quot;, sans-serif; line-height: 1.15; margin-top: 0px;&quot;&gt;2. The Setup Phase&lt;/h3&gt;&lt;p data-path-to-node=&quot;8&quot; style=&quot;font-family: &amp;quot;Google Sans Text&amp;quot;, sans-serif; line-height: 1.15; margin-top: 0px;&quot;&gt;The &lt;code data-index-in-node=&quot;4&quot; data-path-to-node=&quot;8&quot; style=&quot;font-family: &amp;quot;Google Sans Text&amp;quot;, sans-serif; line-height: 1.15; margin-top: 0px;&quot;&gt;setup()&lt;/code&gt; function runs once when the Arduino powers on:&lt;/p&gt;&lt;ul data-path-to-node=&quot;9&quot; style=&quot;font-family: &amp;quot;Google Sans Text&amp;quot;, sans-serif; line-height: 1.15; margin-top: 0px; padding-inline-start: 32px;&quot;&gt;&lt;li style=&quot;line-height: 1.15; margin-top: 0px;&quot;&gt;&lt;p data-path-to-node=&quot;9,0,0&quot; style=&quot;line-height: 1.15; margin-top: 0px;&quot;&gt;&lt;b data-index-in-node=&quot;0&quot; data-path-to-node=&quot;9,0,0&quot; style=&quot;line-height: 1.15; margin-top: 0px;&quot;&gt;&lt;code data-index-in-node=&quot;0&quot; data-path-to-node=&quot;9,0,0&quot; style=&quot;font-family: &amp;quot;Google Sans Text&amp;quot;, sans-serif; line-height: 1.15; margin-top: 0px;&quot;&gt;lcd.begin(16, 2)&lt;/code&gt;:&lt;/b&gt; Initializes the screen size (16 columns, 2 rows).&lt;/p&gt;&lt;/li&gt;&lt;li style=&quot;line-height: 1.15; margin-top: 0px;&quot;&gt;&lt;p data-path-to-node=&quot;9,1,0&quot; style=&quot;line-height: 1.15; margin-top: 0px;&quot;&gt;&lt;b data-index-in-node=&quot;0&quot; data-path-to-node=&quot;9,1,0&quot; style=&quot;line-height: 1.15; margin-top: 0px;&quot;&gt;Splash Screen:&lt;/b&gt; It prints &quot;Voltage Meter&quot; for one second before clearing the screen to start measurements.&lt;/p&gt;&lt;/li&gt;&lt;/ul&gt;&lt;hr data-path-to-node=&quot;10&quot; style=&quot;font-family: &amp;quot;Google Sans Text&amp;quot;, sans-serif; line-height: 1.15; margin-top: 0px;&quot; /&gt;&lt;h3 data-path-to-node=&quot;11&quot; style=&quot;font-family: &amp;quot;Google Sans&amp;quot;, sans-serif; line-height: 1.15; margin-top: 0px;&quot;&gt;3. Reading and Converting Data&lt;/h3&gt;&lt;p data-path-to-node=&quot;12&quot; style=&quot;font-family: &amp;quot;Google Sans Text&amp;quot;, sans-serif; line-height: 1.15; margin-top: 0px;&quot;&gt;Inside the &lt;code data-index-in-node=&quot;11&quot; data-path-to-node=&quot;12&quot; style=&quot;font-family: &amp;quot;Google Sans Text&amp;quot;, sans-serif; line-height: 1.15; margin-top: 0px;&quot;&gt;loop()&lt;/code&gt;, the Arduino performs the math required to turn electricity into numbers.&lt;/p&gt;&lt;ul data-path-to-node=&quot;13&quot; style=&quot;font-family: &amp;quot;Google Sans Text&amp;quot;, sans-serif; line-height: 1.15; margin-top: 0px; padding-inline-start: 32px;&quot;&gt;&lt;li style=&quot;line-height: 1.15; margin-top: 0px;&quot;&gt;&lt;p data-path-to-node=&quot;13,0,0&quot; style=&quot;line-height: 1.15; margin-top: 0px;&quot;&gt;&lt;b data-index-in-node=&quot;0&quot; data-path-to-node=&quot;13,0,0&quot; style=&quot;line-height: 1.15; margin-top: 0px;&quot;&gt;&lt;code data-index-in-node=&quot;0&quot; data-path-to-node=&quot;13,0,0&quot; style=&quot;font-family: &amp;quot;Google Sans Text&amp;quot;, sans-serif; line-height: 1.15; margin-top: 0px;&quot;&gt;analogRead(potPin)&lt;/code&gt;:&lt;/b&gt; The Arduino&#39;s Analog-to-Digital Converter (ADC) converts the voltage (0V to 5V) into a whole number between &lt;b data-index-in-node=&quot;128&quot; data-path-to-node=&quot;13,0,0&quot; style=&quot;line-height: 1.15; margin-top: 0px;&quot;&gt;0 and 1023&lt;/b&gt;.&lt;/p&gt;&lt;/li&gt;&lt;li style=&quot;line-height: 1.15; margin-top: 0px;&quot;&gt;&lt;p data-path-to-node=&quot;13,1,0&quot; style=&quot;line-height: 1.15; margin-top: 0px;&quot;&gt;&lt;b data-index-in-node=&quot;0&quot; data-path-to-node=&quot;13,1,0&quot; style=&quot;line-height: 1.15; margin-top: 0px;&quot;&gt;The Math:&lt;/b&gt; To get the actual voltage back, we use this formula:&lt;/p&gt;&lt;div data-path-to-node=&quot;13,1,1&quot; style=&quot;line-height: 1.15; margin-top: 0px;&quot;&gt;&lt;div class=&quot;math-block&quot; data-math=&quot;V_{out} = \frac{\text{Raw Value} \times 5.0}{1023}&quot; style=&quot;line-height: 1.15; margin-top: 0px;&quot;&gt;$$V_{out} = \frac{\text{Raw Value} \times 5.0}{1023}$$&lt;/div&gt;&lt;/div&gt;&lt;p data-path-to-node=&quot;13,1,2&quot; style=&quot;line-height: 1.15; margin-top: 0px;&quot;&gt;Using &lt;code data-index-in-node=&quot;7&quot; data-path-to-node=&quot;13,1,2&quot; style=&quot;font-family: &amp;quot;Google Sans Text&amp;quot;, sans-serif; line-height: 1.15; margin-top: 0px;&quot;&gt;float&lt;/code&gt; ensures the result includes decimal points (e.g., 3.45V) rather than just rounding to the nearest whole number.&lt;/p&gt;&lt;/li&gt;&lt;/ul&gt;&lt;hr data-path-to-node=&quot;14&quot; style=&quot;font-family: &amp;quot;Google Sans Text&amp;quot;, sans-serif; line-height: 1.15; margin-top: 0px;&quot; /&gt;&lt;h3 data-path-to-node=&quot;15&quot; style=&quot;font-family: &amp;quot;Google Sans&amp;quot;, sans-serif; line-height: 1.15; margin-top: 0px;&quot;&gt;4. Updating the Display&lt;/h3&gt;&lt;p data-path-to-node=&quot;16&quot; style=&quot;font-family: &amp;quot;Google Sans Text&amp;quot;, sans-serif; line-height: 1.15; margin-top: 0px;&quot;&gt;The code updates the screen every 200 milliseconds:&lt;/p&gt;&lt;ul data-path-to-node=&quot;17&quot; style=&quot;font-family: &amp;quot;Google Sans Text&amp;quot;, sans-serif; line-height: 1.15; margin-top: 0px; padding-inline-start: 32px;&quot;&gt;&lt;li style=&quot;line-height: 1.15; margin-top: 0px;&quot;&gt;&lt;p data-path-to-node=&quot;17,0,0&quot; style=&quot;line-height: 1.15; margin-top: 0px;&quot;&gt;&lt;b data-index-in-node=&quot;0&quot; data-path-to-node=&quot;17,0,0&quot; style=&quot;line-height: 1.15; margin-top: 0px;&quot;&gt;setCursor(0, 0)&lt;/b&gt;: Moves the &quot;typing cursor&quot; to the top-left.&lt;/p&gt;&lt;/li&gt;&lt;li style=&quot;line-height: 1.15; margin-top: 0px;&quot;&gt;&lt;p data-path-to-node=&quot;17,1,0&quot; style=&quot;line-height: 1.15; margin-top: 0px;&quot;&gt;&lt;b data-index-in-node=&quot;0&quot; data-path-to-node=&quot;17,1,0&quot; style=&quot;line-height: 1.15; margin-top: 0px;&quot;&gt;print(voltage, 2)&lt;/b&gt;: The &lt;code data-index-in-node=&quot;23&quot; data-path-to-node=&quot;17,1,0&quot; style=&quot;font-family: &amp;quot;Google Sans Text&amp;quot;, sans-serif; line-height: 1.15; margin-top: 0px;&quot;&gt;2&lt;/code&gt; tells the Arduino to show exactly two digits after the decimal point.&lt;/p&gt;&lt;/li&gt;&lt;li style=&quot;line-height: 1.15; margin-top: 0px;&quot;&gt;&lt;p data-path-to-node=&quot;17,2,0&quot; style=&quot;line-height: 1.15; margin-top: 0px;&quot;&gt;&lt;b data-index-in-node=&quot;0&quot; data-path-to-node=&quot;17,2,0&quot; style=&quot;line-height: 1.15; margin-top: 0px;&quot;&gt;Trailing Spaces:&lt;/b&gt; You’ll notice &lt;code data-index-in-node=&quot;31&quot; data-path-to-node=&quot;17,2,0&quot; style=&quot;font-family: &amp;quot;Google Sans Text&amp;quot;, sans-serif; line-height: 1.15; margin-top: 0px;&quot;&gt;lcd.print(&quot;   &quot;)&lt;/code&gt;. This is a clever trick to &quot;erase&quot; old characters. For example, if the value drops from &quot;1000&quot; to &quot;99&quot;, the extra spaces ensure the &quot;0&quot; from the old number isn&#39;t left behind on the screen.&lt;/p&gt;&lt;/li&gt;&lt;/ul&gt;&lt;div&gt;&lt;span face=&quot;Google Sans Text, sans-serif&quot;&gt;Watch the following circuit demo in the following video:&lt;/span&gt;&lt;/div&gt;&lt;/div&gt;&lt;div&gt;&lt;span face=&quot;Google Sans Text, sans-serif&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;&lt;iframe allowfullscreen=&quot;&quot; class=&quot;BLOG_video_class&quot; height=&quot;463&quot; src=&quot;https://www.youtube.com/embed/h8e6jvcNAMM&quot; width=&quot;557&quot; youtube-src-id=&quot;h8e6jvcNAMM&quot;&gt;&lt;/iframe&gt;&lt;/div&gt;&lt;br /&gt;&lt;span face=&quot;Google Sans Text, sans-serif&quot;&gt;&lt;b&gt;Related&lt;/b&gt;&lt;/span&gt;&lt;/div&gt;&lt;div style=&quot;text-align: left;&quot;&gt;&lt;ul style=&quot;text-align: left;&quot;&gt;&lt;li&gt;&lt;a href=&quot;https://www.ee-diary.net/2022/09/lm35-arduino-code-with-lcd.html&quot;&gt;LM35 Arduino code with LCD&lt;/a&gt;&lt;/li&gt;&lt;li&gt;&lt;a href=&quot;https://www.ee-diary.net/2020/09/arduino-keypad-and-lcd-interfacing-with.html&quot;&gt;Arduino Keypad and LCD Interfacing with Code&lt;/a&gt;&lt;/li&gt;&lt;/ul&gt;&lt;/div&gt;&lt;div style=&quot;text-align: left;&quot;&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;&lt;p&gt;&lt;br /&gt;&lt;/p&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://www.ee-diary.net/feeds/5883118343584389229/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.ee-diary.net/2026/04/running-out-of-pins-i2c-alternative-to.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7437986969318338216/posts/default/5883118343584389229'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7437986969318338216/posts/default/5883118343584389229'/><link rel='alternate' type='text/html' href='http://www.ee-diary.net/2026/04/running-out-of-pins-i2c-alternative-to.html' title='Running Out of Pins? I2C alternative to Control a 16x2 LCD with Arduino 3 Pins'/><author><name>Unknown</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjCvtE4IbO53Ob7hUPbYELCYeRetsWUJUWLPjGyW4_-62qVD8JoQ75NhyphenhyphenMAJbgDDGgCvM_6zicCbkO7Eg0Gw8JvFkfL3HpDCeMjjNyybSOEJQUT7kGcqsL4qtY2RXKt6P6FCuyuNxLg1weDhnNBCPG0hX5aTFmUhJPc0gLn1IN7cDNEmVywjy1GphvOGwdl/s72-c/1.jpg" height="72" width="72"/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-7437986969318338216.post-474513906926763637</id><published>2026-04-09T05:03:00.000+05:45</published><updated>2026-04-09T05:03:01.951+05:45</updated><category scheme="http://www.blogger.com/atom/ns#" term="arduino"/><category scheme="http://www.blogger.com/atom/ns#" term="buck converter"/><category scheme="http://www.blogger.com/atom/ns#" term="power supply"/><category scheme="http://www.blogger.com/atom/ns#" term="Voltage Regulator"/><title type='text'>Redesigned Arduino Based Buck Converter : N-Channel vs. P-Channel Buck Converter: </title><content type='html'>&lt;div class=&quot;separator&quot; style=&quot;display:none;&quot;&gt;&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjH-P4Fo6nQLuBz0TUGzKXu-MihO4pWan3CrWVouaOgqNcNn7sDsQNKjmui93voKcHHc44eYuqIk4jTIQr9J09fUKq5gGU_mVXBiGQ0-LoZSLhQW85Tr_LmqY4QHjwm8bfZ4I3uhugM05UIYEhS_ZuHAxbi3Kuj3HhIcE1jjoJBSvhslcQ_VtvnL1xRI8xF/s1600/Gemini_Generated_Image_vnscvqvnscvqvnsc.png&quot; style=&quot;display: block; padding: 1em 0; text-align: center; &quot;&gt;&lt;img alt=&quot;Redesigned Arduino Based Buck Converter&quot; border=&quot;0&quot; data-original-height=&quot;768&quot; data-original-width=&quot;1376&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjH-P4Fo6nQLuBz0TUGzKXu-MihO4pWan3CrWVouaOgqNcNn7sDsQNKjmui93voKcHHc44eYuqIk4jTIQr9J09fUKq5gGU_mVXBiGQ0-LoZSLhQW85Tr_LmqY4QHjwm8bfZ4I3uhugM05UIYEhS_ZuHAxbi3Kuj3HhIcE1jjoJBSvhslcQ_VtvnL1xRI8xF/s1600/Gemini_Generated_Image_vnscvqvnscvqvnsc.png&quot;/&gt;&lt;/a&gt;&lt;/div&gt;
&lt;p&gt;&lt;span style=&quot;font-family: inherit;&quot;&gt;&amp;nbsp;I wrote about how N-channel MOSFET on the high side in buck converter design and why it will not work in my previous note&amp;nbsp;&lt;a href=&quot;https://www.ee-diary.net/2026/04/why-high-side-n-channel-buck-converters.html&quot;&gt;Why High-Side N-Channel Buck Converters Fail&lt;/a&gt;. Although there is advantage to using n-channel on the side which is that the n-channel are fasters and cheaper than p-channel MOSFET, with additional circuit such as using charge pump or bootstrap circuit, it won&#39;t work as expected.&amp;nbsp;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style=&quot;font-family: inherit;&quot;&gt;&lt;span&gt;The main hurdle with n-channel MOSFET on the high side (connected between the source and load) is that, to&amp;nbsp;to fully turn on an N-channel MOSFET, the &lt;b data-index-in-node=&quot;79&quot; data-path-to-node=&quot;5&quot; style=&quot;line-height: 1.15; margin-top: 0px;&quot;&gt;Gate&lt;/b&gt; voltage (&lt;span class=&quot;math-inline&quot; data-index-in-node=&quot;93&quot; data-math=&quot;V_G&quot; style=&quot;line-height: 1.15; margin-top: 0px;&quot;&gt;$V_G$&lt;/span&gt;) must be significantly higher than the &lt;b data-index-in-node=&quot;136&quot; data-path-to-node=&quot;5&quot; style=&quot;line-height: 1.15; margin-top: 0px;&quot;&gt;Source&lt;/b&gt; voltage (&lt;span class=&quot;math-inline&quot; data-index-in-node=&quot;152&quot; data-math=&quot;V_S&quot; style=&quot;line-height: 1.15; margin-top: 0px;&quot;&gt;$V_S$&lt;/span&gt;). So, w&lt;/span&gt;&lt;span&gt;hen the MOSFET turns on, the Source voltage rises to nearly the supply voltage (&lt;/span&gt;&lt;span class=&quot;math-inline&quot; data-index-in-node=&quot;149&quot; data-math=&quot;V_{CC}&quot; style=&quot;line-height: 1.15; margin-top: 0px;&quot;&gt;$V_{CC}$&lt;/span&gt;&lt;span&gt;). And t&lt;/span&gt;&lt;span&gt;o stay &quot;on,&quot; we required that the gate voltage be higher than the power supply voltage plus the gate to source voltage threshold:&lt;/span&gt;$$V_G &amp;gt; V_{CC} + V_{GS(th)}$$&lt;span&gt;The result is that we&lt;/span&gt;&lt;span&gt;&amp;nbsp;can&#39;t just use the supply voltage to toggle the gate; you need a voltage &lt;/span&gt;&lt;i data-index-in-node=&quot;89&quot; data-path-to-node=&quot;6,2,0&quot; style=&quot;line-height: 1.15; margin-top: 0px;&quot;&gt;higher&lt;/i&gt;&lt;span&gt; than the supply itself.&amp;nbsp;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style=&quot;font-family: inherit;&quot;&gt;The following shows the &lt;b&gt;circuit diagram &lt;/b&gt;of buck converter with N-channel MOSFET on the high side &lt;i&gt;that will not work&lt;/i&gt;.&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;/p&gt;&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEilil-V224KOPY2v_pCYOfZazuFWd07RQtJq2Cww2y5LADkt0sD75VsKRDvf4RgVCZ1-vBnuXjRGbcp_9JCDW8DAfRDoEvbXrSlBrhxsl1GdHoq_TVuXE4ri6SoLn4tXduGaY8ytI5yyAUScqqPkyVYyQcAox18eEAB1ZnEeLeA-xGZL8RRJXbwXBlKg40z/s1170/buck%20converter.png&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;span style=&quot;font-family: inherit;&quot;&gt;&lt;img alt=&quot;buck converter circuit with n-channel mosfet on high side&quot; border=&quot;0&quot; data-original-height=&quot;425&quot; data-original-width=&quot;1170&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEilil-V224KOPY2v_pCYOfZazuFWd07RQtJq2Cww2y5LADkt0sD75VsKRDvf4RgVCZ1-vBnuXjRGbcp_9JCDW8DAfRDoEvbXrSlBrhxsl1GdHoq_TVuXE4ri6SoLn4tXduGaY8ytI5yyAUScqqPkyVYyQcAox18eEAB1ZnEeLeA-xGZL8RRJXbwXBlKg40z/s16000/buck%20converter.png&quot; title=&quot;buck converter circuit with n-channel mosfet on high side&quot; /&gt;&lt;/span&gt;&lt;/a&gt;&lt;/div&gt;&lt;span style=&quot;font-family: inherit;&quot;&gt;&lt;div&gt;&lt;span style=&quot;font-family: inherit;&quot;&gt;The detailed reasons why N-channel MOSFET on high side in buck converter is not suitable is explained in detail in my previous blog post&amp;nbsp;&lt;/span&gt;&lt;a href=&quot;https://www.ee-diary.net/2026/04/why-high-side-n-channel-buck-converters.html&quot; style=&quot;font-family: inherit;&quot;&gt;Why High-Side N-Channel Buck Converters Fail&lt;/a&gt;&lt;span style=&quot;font-family: inherit;&quot;&gt;.&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span style=&quot;font-family: inherit;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;There are couples of solutions we could use here to fix the problem. These solutions are:&lt;/span&gt;&lt;p&gt;&lt;/p&gt;&lt;ol data-path-to-node=&quot;9&quot; start=&quot;1&quot; style=&quot;line-height: 1.15; margin-top: 0px; padding-inline-start: 32px;&quot;&gt;&lt;li style=&quot;line-height: 1.15; margin-top: 0px;&quot;&gt;&lt;p data-path-to-node=&quot;9,0,0&quot; style=&quot;line-height: 1.15; margin-top: 0px;&quot;&gt;&lt;span style=&quot;font-family: inherit;&quot;&gt;&lt;b data-index-in-node=&quot;0&quot; data-path-to-node=&quot;9,0,0&quot; style=&quot;line-height: 1.15; margin-top: 0px;&quot;&gt;Charge Pumps:&lt;/b&gt; Small circuits that &quot;pump up&quot; a voltage higher than the rail.&lt;/span&gt;&lt;/p&gt;&lt;/li&gt;&lt;li style=&quot;line-height: 1.15; margin-top: 0px;&quot;&gt;&lt;p data-path-to-node=&quot;9,1,0&quot; style=&quot;line-height: 1.15; margin-top: 0px;&quot;&gt;&lt;span style=&quot;font-family: inherit;&quot;&gt;&lt;b data-index-in-node=&quot;0&quot; data-path-to-node=&quot;9,1,0&quot; style=&quot;line-height: 1.15; margin-top: 0px;&quot;&gt;Bootstrap Circuits:&lt;/b&gt; Frequently used in PWM applications (like motor drivers or buck converters). It uses a capacitor and a diode to &quot;lift&quot; the gate voltage above the rail every time the MOSFET switches.&lt;/span&gt;&lt;/p&gt;&lt;/li&gt;&lt;li style=&quot;line-height: 1.15; margin-top: 0px;&quot;&gt;&lt;p data-path-to-node=&quot;9,2,0&quot; style=&quot;line-height: 1.15; margin-top: 0px;&quot;&gt;&lt;span style=&quot;font-family: inherit;&quot;&gt;&lt;b data-index-in-node=&quot;0&quot; data-path-to-node=&quot;9,2,0&quot; style=&quot;line-height: 1.15; margin-top: 0px;&quot;&gt;High-Side Gate Driver ICs:&lt;/b&gt; Dedicated chips (like the IR2110 or similar) that handle all this headache for you.&lt;/span&gt;&lt;/p&gt;&lt;/li&gt;&lt;li style=&quot;line-height: 1.15; margin-top: 0px;&quot;&gt;&lt;p data-path-to-node=&quot;9,2,0&quot; style=&quot;line-height: 1.15; margin-top: 0px;&quot;&gt;&lt;span style=&quot;font-family: inherit;&quot;&gt;&lt;b&gt;P-channel MOSFET&lt;/b&gt;: Replace the n-channel MOSFE with p-channel MOSFET.&lt;/span&gt;&lt;/p&gt;&lt;/li&gt;&lt;/ol&gt;&lt;div&gt;&lt;span style=&quot;font-family: inherit;&quot;&gt;I used the 4th solution; I replaced the n-channel MOSFET with p-channel MOSFET. This is  the most direct way to simplify a high-side switch because it eliminates the need for voltages higher than the supply rail.&lt;/span&gt;&lt;/div&gt;&lt;h3 style=&quot;text-align: left;&quot;&gt;Circuit Schematic&lt;/h3&gt;&lt;div&gt;&lt;span style=&quot;font-family: inherit;&quot;&gt;The circuit diagram below shows n-channel MOSFET replaced by p-channel MOSFET on the high side of the Arduino based buck converter.&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span style=&quot;font-family: inherit;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEigVONbU1wvgzdtheP8OYAIO7ewEETZFEWmBHMDJxcH8h5YqswRzdDBnUZ10Xp6crXDCkeVB4T0Lr4Uyzw3TN3ZQRtFokdCskyefKTbxZJN8aYRMcwzaWuDyfzyecb1INM5yU3zIz8yJZjxY_COW0T2vm2UlnBM0xOCuVSpiQKXkF1WoadL1_ZTrvtYlp2I/s1179/buck%20converter.png&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;span style=&quot;font-family: inherit;&quot;&gt;&lt;img alt=&quot;buck converter using Arduino circuit diagram&quot; border=&quot;0&quot; data-original-height=&quot;597&quot; data-original-width=&quot;1179&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEigVONbU1wvgzdtheP8OYAIO7ewEETZFEWmBHMDJxcH8h5YqswRzdDBnUZ10Xp6crXDCkeVB4T0Lr4Uyzw3TN3ZQRtFokdCskyefKTbxZJN8aYRMcwzaWuDyfzyecb1INM5yU3zIz8yJZjxY_COW0T2vm2UlnBM0xOCuVSpiQKXkF1WoadL1_ZTrvtYlp2I/s16000/buck%20converter.png&quot; title=&quot;buck converter using Arduino circuit diagram&quot; /&gt;&lt;/span&gt;&lt;/a&gt;&lt;/div&gt;&lt;span style=&quot;font-family: inherit;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;div&gt;&lt;p data-path-to-node=&quot;0&quot; style=&quot;line-height: 1.15; margin-top: 0px;&quot;&gt;&lt;span style=&quot;font-family: inherit;&quot;&gt;This circuit is a &lt;b data-index-in-node=&quot;18&quot; data-path-to-node=&quot;0&quot; style=&quot;line-height: 1.15; margin-top: 0px;&quot;&gt;DC-to-DC Buck Converter&lt;/b&gt; designed to step down a higher DC voltage (12V) to a lower, regulated DC voltage (like 5V). It uses &lt;b data-index-in-node=&quot;142&quot; data-path-to-node=&quot;0&quot; style=&quot;line-height: 1.15; margin-top: 0px;&quot;&gt;PWM (Pulse Width Modulation)&lt;/b&gt; from an Arduino to control a high-speed electronic switch.&lt;/span&gt;&lt;/p&gt;&lt;p data-path-to-node=&quot;1&quot; style=&quot;line-height: 1.15; margin-top: 0px;&quot;&gt;&lt;span style=&quot;font-family: inherit;&quot;&gt;Here is the step-by-step breakdown of how the hardware works together:&lt;/span&gt;&lt;/p&gt;&lt;hr data-path-to-node=&quot;2&quot; style=&quot;line-height: 1.15; margin-top: 0px;&quot; /&gt;&lt;h4 style=&quot;line-height: 1.15; margin-top: 0px; text-align: left;&quot;&gt;&lt;span style=&quot;font-family: inherit;&quot;&gt;1. The Switching Stage (Control)&lt;/span&gt;&lt;/h4&gt;&lt;p data-path-to-node=&quot;4&quot; style=&quot;line-height: 1.15; margin-top: 0px;&quot;&gt;&lt;span style=&quot;font-family: inherit;&quot;&gt;The Arduino (at Pin 9) generates a PWM signal. However, an Arduino pin cannot handle 12V or the high current needed for the MOSFET.&lt;/span&gt;&lt;/p&gt;&lt;ul data-path-to-node=&quot;5&quot; style=&quot;line-height: 1.15; margin-top: 0px; padding-inline-start: 32px;&quot;&gt;&lt;li style=&quot;line-height: 1.15; margin-top: 0px;&quot;&gt;&lt;p data-path-to-node=&quot;5,0,0&quot; style=&quot;line-height: 1.15; margin-top: 0px;&quot;&gt;&lt;span style=&quot;font-family: inherit;&quot;&gt;&lt;b data-index-in-node=&quot;0&quot; data-path-to-node=&quot;5,0,0&quot; style=&quot;line-height: 1.15; margin-top: 0px;&quot;&gt;Q1 (2N2222A Transistor):&lt;/b&gt; Acts as a level-shifter. When Pin 9 goes HIGH, Q1 turns on and pulls the Gate of the MOSFET to Ground.&lt;/span&gt;&lt;/p&gt;&lt;/li&gt;&lt;li style=&quot;line-height: 1.15; margin-top: 0px;&quot;&gt;&lt;p data-path-to-node=&quot;5,1,0&quot; style=&quot;line-height: 1.15; margin-top: 0px;&quot;&gt;&lt;span style=&quot;font-family: inherit;&quot;&gt;&lt;b data-index-in-node=&quot;0&quot; data-path-to-node=&quot;5,1,0&quot; style=&quot;line-height: 1.15; margin-top: 0px;&quot;&gt;Q2 (IRF4905 P-Channel MOSFET):&lt;/b&gt; This is the main &quot;Power Switch.&quot; Because it’s a P-Channel, it turns &lt;b data-index-in-node=&quot;99&quot; data-path-to-node=&quot;5,1,0&quot; style=&quot;line-height: 1.15; margin-top: 0px;&quot;&gt;ON&lt;/b&gt; when its gate is pulled low (0V) and &lt;b data-index-in-node=&quot;139&quot; data-path-to-node=&quot;5,1,0&quot; style=&quot;line-height: 1.15; margin-top: 0px;&quot;&gt;OFF&lt;/b&gt; when the gate is pulled high (12V via resistor &lt;b data-index-in-node=&quot;190&quot; data-path-to-node=&quot;5,1,0&quot; style=&quot;line-height: 1.15; margin-top: 0px;&quot;&gt;R2&lt;/b&gt;).&lt;/span&gt;&lt;/p&gt;&lt;/li&gt;&lt;li style=&quot;line-height: 1.15; margin-top: 0px;&quot;&gt;&lt;p data-path-to-node=&quot;5,2,0&quot; style=&quot;line-height: 1.15; margin-top: 0px;&quot;&gt;&lt;span style=&quot;font-family: inherit;&quot;&gt;&lt;b data-index-in-node=&quot;0&quot; data-path-to-node=&quot;5,2,0&quot; style=&quot;line-height: 1.15; margin-top: 0px;&quot;&gt;Result:&lt;/b&gt; The 12V input is &quot;chopped&quot; into high-frequency square pulses.&lt;/span&gt;&lt;/p&gt;&lt;/li&gt;&lt;/ul&gt;&lt;h4 style=&quot;line-height: 1.15; margin-top: 0px; text-align: left;&quot;&gt;&lt;span style=&quot;font-family: inherit;&quot;&gt;2. The Power Stage (Conversion)&lt;/span&gt;&lt;/h4&gt;&lt;p data-path-to-node=&quot;7&quot; style=&quot;line-height: 1.15; margin-top: 0px;&quot;&gt;&lt;span style=&quot;font-family: inherit;&quot;&gt;The chopped 12V signal is not usable DC yet. This is where the filter components come in:&lt;/span&gt;&lt;/p&gt;&lt;ul data-path-to-node=&quot;8&quot; style=&quot;line-height: 1.15; margin-top: 0px; padding-inline-start: 32px;&quot;&gt;&lt;li style=&quot;line-height: 1.15; margin-top: 0px;&quot;&gt;&lt;p data-path-to-node=&quot;8,0,0&quot; style=&quot;line-height: 1.15; margin-top: 0px;&quot;&gt;&lt;span style=&quot;font-family: inherit;&quot;&gt;&lt;b data-index-in-node=&quot;0&quot; data-path-to-node=&quot;8,0,0&quot; style=&quot;line-height: 1.15; margin-top: 0px;&quot;&gt;L1 (Inductor):&lt;/b&gt; When the MOSFET is ON, current flows through the inductor, storing energy in a magnetic field. When the MOSFET turns OFF, the magnetic field collapses, and the inductor continues to push current toward the load.&lt;/span&gt;&lt;/p&gt;&lt;/li&gt;&lt;li style=&quot;line-height: 1.15; margin-top: 0px;&quot;&gt;&lt;p data-path-to-node=&quot;8,1,0&quot; style=&quot;line-height: 1.15; margin-top: 0px;&quot;&gt;&lt;span style=&quot;font-family: inherit;&quot;&gt;&lt;b data-index-in-node=&quot;0&quot; data-path-to-node=&quot;8,1,0&quot; style=&quot;line-height: 1.15; margin-top: 0px;&quot;&gt;D1 (1N5822 Schottky Diode):&lt;/b&gt; This is the &quot;Flyback&quot; or &quot;Freewheeling&quot; diode. When the MOSFET turns off, the inductor needs a path to pull current from Ground to keep the loop complete.&lt;/span&gt;&lt;/p&gt;&lt;/li&gt;&lt;li style=&quot;line-height: 1.15; margin-top: 0px;&quot;&gt;&lt;p data-path-to-node=&quot;8,2,0&quot; style=&quot;line-height: 1.15; margin-top: 0px;&quot;&gt;&lt;span style=&quot;font-family: inherit;&quot;&gt;&lt;b data-index-in-node=&quot;0&quot; data-path-to-node=&quot;8,2,0&quot; style=&quot;line-height: 1.15; margin-top: 0px;&quot;&gt;C1 (Output Capacitor):&lt;/b&gt; This acts as a reservoir. It charges during the &quot;ON&quot; cycle and discharges during the &quot;OFF&quot; cycle, smoothing out the voltage pulses into a steady DC line.&lt;/span&gt;&lt;/p&gt;&lt;/li&gt;&lt;/ul&gt;&lt;h4 style=&quot;line-height: 1.15; margin-top: 0px; text-align: left;&quot;&gt;&lt;span style=&quot;font-family: inherit;&quot;&gt;3. The Feedback Stage (Monitoring)&lt;/span&gt;&lt;/h4&gt;&lt;p data-path-to-node=&quot;10&quot; style=&quot;line-height: 1.15; margin-top: 0px;&quot;&gt;&lt;span style=&quot;font-family: inherit;&quot;&gt;To ensure the output is correct, the Arduino needs to measure the voltage, but its pins can only handle up to 5V.&lt;/span&gt;&lt;/p&gt;&lt;ul data-path-to-node=&quot;11&quot; style=&quot;line-height: 1.15; margin-top: 0px; padding-inline-start: 32px;&quot;&gt;&lt;li style=&quot;line-height: 1.15; margin-top: 0px;&quot;&gt;&lt;p data-path-to-node=&quot;11,0,0&quot; style=&quot;line-height: 1.15; margin-top: 0px;&quot;&gt;&lt;span style=&quot;font-family: inherit;&quot;&gt;&lt;b data-index-in-node=&quot;0&quot; data-path-to-node=&quot;11,0,0&quot; style=&quot;line-height: 1.15; margin-top: 0px;&quot;&gt;R3 &amp;amp; R4 (Voltage Divider):&lt;/b&gt; These resistors (14k and 10k) scale the output voltage down. For example, if the output is 12V, the Arduino sees roughly 5V at Pin &lt;b data-index-in-node=&quot;158&quot; data-path-to-node=&quot;11,0,0&quot; style=&quot;line-height: 1.15; margin-top: 0px;&quot;&gt;A1&lt;/b&gt;.&lt;/span&gt;&lt;/p&gt;&lt;/li&gt;&lt;li style=&quot;line-height: 1.15; margin-top: 0px;&quot;&gt;&lt;p data-path-to-node=&quot;11,1,0&quot; style=&quot;line-height: 1.15; margin-top: 0px;&quot;&gt;&lt;span style=&quot;font-family: inherit;&quot;&gt;&lt;b data-index-in-node=&quot;0&quot; data-path-to-node=&quot;11,1,0&quot; style=&quot;line-height: 1.15; margin-top: 0px;&quot;&gt;C2 (Feedback Filter):&lt;/b&gt; This small capacitor filters out high-frequency switching noise from the divider, ensuring the Arduino gets a clean, &quot;rock-solid&quot; reading for its calculations.&lt;/span&gt;&lt;/p&gt;&lt;/li&gt;&lt;li style=&quot;line-height: 1.15; margin-top: 0px;&quot;&gt;&lt;p data-path-to-node=&quot;11,2,0&quot; style=&quot;line-height: 1.15; margin-top: 0px;&quot;&gt;&lt;span style=&quot;font-family: inherit;&quot;&gt;&lt;b data-index-in-node=&quot;0&quot; data-path-to-node=&quot;11,2,0&quot; style=&quot;line-height: 1.15; margin-top: 0px;&quot;&gt;RV1 (Potentiometer):&lt;/b&gt; This allows the user to manually set the target voltage. The Arduino reads this value and adjusts the PWM duty cycle accordingly to reach the desired output.&lt;/span&gt;&lt;/p&gt;&lt;/li&gt;&lt;/ul&gt;&lt;hr data-path-to-node=&quot;12&quot; style=&quot;line-height: 1.15; margin-top: 0px;&quot; /&gt;&lt;h3 data-path-to-node=&quot;13&quot; style=&quot;line-height: 1.15; margin-top: 0px;&quot;&gt;&lt;span style=&quot;font-family: inherit;&quot;&gt;Summary Table: Component Roles&lt;/span&gt;&lt;/h3&gt;&lt;table data-path-to-node=&quot;14&quot; style=&quot;line-height: 1.15; margin-bottom: 32px; margin-top: 0px;&quot;&gt;&lt;thead style=&quot;line-height: 1.15; margin-top: 0px;&quot;&gt;&lt;tr style=&quot;line-height: 1.15; margin-top: 0px;&quot;&gt;&lt;td style=&quot;border: 1px solid; line-height: 1.15; margin-top: 0px;&quot;&gt;&lt;strong style=&quot;line-height: 1.15; margin-bottom: 0px; margin-top: 0px;&quot;&gt;&lt;span style=&quot;font-family: inherit;&quot;&gt;Component&lt;/span&gt;&lt;/strong&gt;&lt;/td&gt;&lt;td style=&quot;border: 1px solid; line-height: 1.15; margin-top: 0px;&quot;&gt;&lt;strong style=&quot;line-height: 1.15; margin-bottom: 0px; margin-top: 0px;&quot;&gt;&lt;span style=&quot;font-family: inherit;&quot;&gt;Function&lt;/span&gt;&lt;/strong&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/thead&gt;&lt;tbody style=&quot;line-height: 1.15; margin-top: 0px;&quot;&gt;&lt;tr style=&quot;line-height: 1.15; margin-top: 0px;&quot;&gt;&lt;td style=&quot;border: 1px solid; line-height: 1.15; margin-top: 0px;&quot;&gt;&lt;span data-path-to-node=&quot;14,1,0,0&quot; style=&quot;font-family: inherit; line-height: 1.15; margin-top: 0px;&quot;&gt;&lt;b data-index-in-node=&quot;0&quot; data-path-to-node=&quot;14,1,0,0&quot; style=&quot;line-height: 1.15; margin-top: 0px;&quot;&gt;MOSFET (Q2)&lt;/b&gt;&lt;/span&gt;&lt;/td&gt;&lt;td style=&quot;border: 1px solid; line-height: 1.15; margin-top: 0px;&quot;&gt;&lt;span data-path-to-node=&quot;14,1,1,0&quot; style=&quot;font-family: inherit; line-height: 1.15; margin-top: 0px;&quot;&gt;The high-speed switch that &quot;chops&quot; the 12V input.&lt;/span&gt;&lt;/td&gt;&lt;/tr&gt;&lt;tr style=&quot;line-height: 1.15; margin-top: 0px;&quot;&gt;&lt;td style=&quot;border: 1px solid; line-height: 1.15; margin-top: 0px;&quot;&gt;&lt;span data-path-to-node=&quot;14,2,0,0&quot; style=&quot;font-family: inherit; line-height: 1.15; margin-top: 0px;&quot;&gt;&lt;b data-index-in-node=&quot;0&quot; data-path-to-node=&quot;14,2,0,0&quot; style=&quot;line-height: 1.15; margin-top: 0px;&quot;&gt;Inductor (L1)&lt;/b&gt;&lt;/span&gt;&lt;/td&gt;&lt;td style=&quot;border: 1px solid; line-height: 1.15; margin-top: 0px;&quot;&gt;&lt;span data-path-to-node=&quot;14,2,1,0&quot; style=&quot;font-family: inherit; line-height: 1.15; margin-top: 0px;&quot;&gt;Smooths current and stores energy during the &quot;OFF&quot; cycle.&lt;/span&gt;&lt;/td&gt;&lt;/tr&gt;&lt;tr style=&quot;line-height: 1.15; margin-top: 0px;&quot;&gt;&lt;td style=&quot;border: 1px solid; line-height: 1.15; margin-top: 0px;&quot;&gt;&lt;span data-path-to-node=&quot;14,3,0,0&quot; style=&quot;font-family: inherit; line-height: 1.15; margin-top: 0px;&quot;&gt;&lt;b data-index-in-node=&quot;0&quot; data-path-to-node=&quot;14,3,0,0&quot; style=&quot;line-height: 1.15; margin-top: 0px;&quot;&gt;Capacitor (C1)&lt;/b&gt;&lt;/span&gt;&lt;/td&gt;&lt;td style=&quot;border: 1px solid; line-height: 1.15; margin-top: 0px;&quot;&gt;&lt;span data-path-to-node=&quot;14,3,1,0&quot; style=&quot;font-family: inherit; line-height: 1.15; margin-top: 0px;&quot;&gt;Smooths voltage ripple to provide steady DC.&lt;/span&gt;&lt;/td&gt;&lt;/tr&gt;&lt;tr style=&quot;line-height: 1.15; margin-top: 0px;&quot;&gt;&lt;td style=&quot;border: 1px solid; line-height: 1.15; margin-top: 0px;&quot;&gt;&lt;span data-path-to-node=&quot;14,4,0,0&quot; style=&quot;font-family: inherit; line-height: 1.15; margin-top: 0px;&quot;&gt;&lt;b data-index-in-node=&quot;0&quot; data-path-to-node=&quot;14,4,0,0&quot; style=&quot;line-height: 1.15; margin-top: 0px;&quot;&gt;Diode (D1)&lt;/b&gt;&lt;/span&gt;&lt;/td&gt;&lt;td style=&quot;border: 1px solid; line-height: 1.15; margin-top: 0px;&quot;&gt;&lt;span data-path-to-node=&quot;14,4,1,0&quot; style=&quot;font-family: inherit; line-height: 1.15; margin-top: 0px;&quot;&gt;Provides a return path for current when the switch is open.&lt;/span&gt;&lt;/td&gt;&lt;/tr&gt;&lt;tr style=&quot;line-height: 1.15; margin-top: 0px;&quot;&gt;&lt;td style=&quot;border: 1px solid; line-height: 1.15; margin-top: 0px;&quot;&gt;&lt;span data-path-to-node=&quot;14,5,0,0&quot; style=&quot;font-family: inherit; line-height: 1.15; margin-top: 0px;&quot;&gt;&lt;b data-index-in-node=&quot;0&quot; data-path-to-node=&quot;14,5,0,0&quot; style=&quot;line-height: 1.15; margin-top: 0px;&quot;&gt;Resistors (R3/R4)&lt;/b&gt;&lt;/span&gt;&lt;/td&gt;&lt;td style=&quot;border: 1px solid; line-height: 1.15; margin-top: 0px;&quot;&gt;&lt;span data-path-to-node=&quot;14,5,1,0&quot; style=&quot;font-family: inherit; line-height: 1.15; margin-top: 0px;&quot;&gt;Protect the Arduino by scaling the voltage down for measurement.&lt;/span&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/tbody&gt;&lt;/table&gt;&lt;span style=&quot;font-family: inherit;&quot;&gt;Some additional notes on the resistors $R_1$ and $R_2$.&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;ul style=&quot;text-align: left;&quot;&gt;&lt;li&gt;&lt;span style=&quot;font-family: inherit;&quot;&gt;&lt;b data-index-in-node=&quot;0&quot; data-path-to-node=&quot;14,0,0&quot; style=&quot;line-height: 1.15; margin-top: 0px;&quot;&gt;Base Resistor (&lt;span class=&quot;math-inline&quot; data-index-in-node=&quot;15&quot; data-math=&quot;R1&quot; style=&quot;line-height: 1.15; margin-top: 0px;&quot;&gt;$R1$&lt;/span&gt;):&lt;/b&gt;&lt;span&gt; In the previous buck converter design I used base resistor of $1 k\Omega$. Here I increased to something to $2.2 k\Omega$. Increasing the base resistor&amp;nbsp;&lt;/span&gt;&lt;span&gt;reduces the strain on the Arduino pin while still providing plenty of switching speed.&lt;/span&gt;&lt;/span&gt;&lt;/li&gt;&lt;li&gt;&lt;span style=&quot;font-family: inherit;&quot;&gt;&lt;b data-index-in-node=&quot;0&quot; data-path-to-node=&quot;14,1,0&quot; style=&quot;line-height: 1.15; margin-top: 0px;&quot;&gt;Pull-Up Resistor (&lt;span class=&quot;math-inline&quot; data-index-in-node=&quot;18&quot; data-math=&quot;R2&quot; style=&quot;line-height: 1.15; margin-top: 0px;&quot;&gt;$R2$&lt;/span&gt;):&lt;/b&gt;&lt;span&gt; To achieve the high-speed &lt;/span&gt;&lt;b data-index-in-node=&quot;51&quot; data-path-to-node=&quot;14,1,0&quot; style=&quot;line-height: 1.15; margin-top: 0px;&quot;&gt;31.25 kHz&lt;/b&gt;&lt;span&gt; switching rates I&lt;/span&gt;&lt;span&gt;&amp;nbsp;lowered Gate pull-up resistor from &lt;/span&gt;&lt;b data-index-in-node=&quot;151&quot; data-path-to-node=&quot;14,1,0&quot; style=&quot;line-height: 1.15; margin-top: 0px;&quot;&gt;10k&lt;/b&gt;&lt;span&gt;&amp;nbsp;from previous buck converter design down to&amp;nbsp;&lt;/span&gt;&lt;span&gt;$1 k\Omega$. This helps the MOSFET turn OFF faster, which reduces heat&lt;/span&gt;&lt;/span&gt;&lt;/li&gt;&lt;/ul&gt;&lt;div&gt;&lt;span style=&quot;font-family: inherit;&quot;&gt;Tip: Use the &lt;a href=&quot;https://www.ee-diary.net/p/buck-converter-calculator-calculate-l-c.html&quot;&gt;online Buck Converter Calculator&lt;/a&gt; to calculate the inductor and capacitors value for given switching frequency. Also see the &lt;a href=&quot;https://www.ee-diary.net/2026/03/arduino-uno-pinout-explorer.html&quot;&gt;Arduino Interactive Pinout Web Tool&lt;/a&gt; for planning pins. Both are free web tools on my blog.&lt;/span&gt;&lt;/div&gt;&lt;h3 style=&quot;text-align: left;&quot;&gt;&lt;span style=&quot;font-family: inherit;&quot;&gt;Program Code&lt;/span&gt;&lt;/h3&gt;&lt;/div&gt;&lt;div&gt;
  &lt;pre lang=&quot;cpp&quot;&gt;&lt;code&gt;&lt;span style=&quot;font-family: inherit;&quot;&gt;/*
 * BUCK CONVERTER MANUAL CONTROL (32.25kHz)
 * Developed for: ee-diary.net
 * Schematic: P-Channel IRF4905 with NPN Driver
 */

const int pwmPin = 9;      
const int potPin = A0;     
const int feedbackPin = A1; 

// Resistor values matching your Proteus Schematic (1.png)
const float R3 = 14000.0; // 14k Top Resistor
const float R4 = 10000.0; // 10k Bottom Resistor
const float dividerRatio = (R3 + R4) / R4; 

void setup() {
  Serial.begin(115200);
  pinMode(pwmPin, OUTPUT);

  // Set Timer 1 to 31.25kHz (Prescaler 1)
  TCCR1B = (TCCR1B &amp;amp; 0b11111000) | 0x01;

  Serial.println(&quot;--- BUCK CONVERTER: ee-diary.net ---&quot;);
  Serial.println(&quot;Adjust Potentiometer to reach target voltage&quot;);
  Serial.println(&quot;-----------------------------------------&quot;);
}

void loop() {
  // Read the potentiometer (0 to 1023)
  int potValue = analogRead(potPin);

  // Map to standard 8-bit PWM range (0 to 255)
  // At 1kHz, 255 = 100% Duty Cycle (Full Battery Voltage)
  int pwmValue = map(potValue, 0, 1023, 0, 255); 

  // Output the PWM to the MOSFET driver
  analogWrite(pwmPin, pwmValue);

  // Non-blocking timer for Serial monitoring
  static unsigned long lastPrint = 0;
  if (millis() - lastPrint &amp;gt; 400) { 
    
    // Read output voltage via the voltage divider
    float vRaw = analogRead(feedbackPin) * (5.0 / 1023.0);
    float actualVolts = vRaw * dividerRatio;

    // Display data for debugging
    Serial.print(&quot;POT: &quot;);     Serial.print(potValue);
    Serial.print(&quot; | PWM: &quot;);  Serial.print(pwmValue);
    Serial.print(&quot; | OUTPUT Voltage: &quot;); Serial.print(actualVolts, 2);
    Serial.println(&quot;V&quot;);
    
    lastPrint = millis();
  }
}&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;div&gt;&lt;span style=&quot;font-family: inherit;&quot;&gt;The code is a bridge between the physical hardware and the logic needed to regulate power. It handles three main tasks: &lt;/span&gt;&lt;b data-index-in-node=&quot;135&quot; data-path-to-node=&quot;0&quot; style=&quot;font-family: inherit;&quot;&gt;High-speed switching&lt;/b&gt;&lt;span style=&quot;font-family: inherit;&quot;&gt;, &lt;/span&gt;&lt;b data-index-in-node=&quot;157&quot; data-path-to-node=&quot;0&quot; style=&quot;font-family: inherit;&quot;&gt;User Input handling&lt;/b&gt;&lt;span style=&quot;font-family: inherit;&quot;&gt;, and &lt;/span&gt;&lt;b data-index-in-node=&quot;182&quot; data-path-to-node=&quot;0&quot; style=&quot;font-family: inherit;&quot;&gt;Real-time Voltage Math&lt;/b&gt;&lt;span style=&quot;font-family: inherit;&quot;&gt;.&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;p data-path-to-node=&quot;1&quot;&gt;&lt;span style=&quot;font-family: inherit;&quot;&gt;Here is the breakdown of the code:&lt;/span&gt;&lt;/p&gt;&lt;hr data-path-to-node=&quot;2&quot; /&gt;&lt;h3 data-path-to-node=&quot;3&quot;&gt;&lt;span style=&quot;font-family: inherit;&quot;&gt;1. Configuration &amp;amp; Calibration&lt;/span&gt;&lt;/h3&gt;&lt;response-element ng-version=&quot;0.0.0-PLACEHOLDER&quot;&gt;&lt;span style=&quot;font-family: inherit;&quot;&gt;&lt;code-block _nghost-ng-c1583389803=&quot;&quot; class=&quot;ng-tns-c1583389803-683 ng-star-inserted&quot;&gt;&lt;div _ngcontent-ng-c1583389803=&quot;&quot; class=&quot;code-block ng-tns-c1583389803-683 ng-animate-disabled ng-trigger ng-trigger-codeBlockRevealAnimation&quot; data-hveid=&quot;0&quot; data-ved=&quot;0CAAQhtANahgKEwjNr8m9gN6TAxUAAAAAHQAAAAAQ7BI&quot; decode-data-ved=&quot;1&quot; jslog=&quot;223238;track:impression,attention;BardVeMetadataKey:[[&amp;quot;r_5f18bdf139170f77&amp;quot;,&amp;quot;c_ab33c6b718acc256&amp;quot;,null,&amp;quot;rc_31a7d4d5daf5c6a6&amp;quot;,null,null,&amp;quot;en&amp;quot;,null,1,null,null,1,0]]&quot;&gt;&lt;div _ngcontent-ng-c1583389803=&quot;&quot; class=&quot;code-block-decoration header-formatted gds-title-s ng-tns-c1583389803-683 ng-star-inserted&quot;&gt;&lt;div _ngcontent-ng-c1583389803=&quot;&quot; class=&quot;buttons ng-tns-c1583389803-683 ng-star-inserted&quot;&gt;&lt;!----&gt;&lt;!----&gt;&lt;/div&gt;&lt;!----&gt;&lt;!----&gt;&lt;/div&gt;&lt;!----&gt;&lt;div _ngcontent-ng-c1583389803=&quot;&quot; class=&quot;formatted-code-block-internal-container ng-tns-c1583389803-683&quot;&gt;&lt;div _ngcontent-ng-c1583389803=&quot;&quot; class=&quot;animated-opacity ng-tns-c1583389803-683&quot;&gt;&lt;pre _ngcontent-ng-c1583389803=&quot;&quot; class=&quot;ng-tns-c1583389803-683&quot;&gt;&lt;code _ngcontent-ng-c1583389803=&quot;&quot; class=&quot;code-container formatted ng-tns-c1583389803-683&quot; data-test-id=&quot;code-content&quot; role=&quot;text&quot;&gt;&lt;span class=&quot;hljs-keyword&quot;&gt;const&lt;/span&gt; &lt;span class=&quot;hljs-keyword&quot;&gt;float&lt;/span&gt; R3 = &lt;span class=&quot;hljs-number&quot;&gt;14000.0&lt;/span&gt;; 
&lt;span class=&quot;hljs-keyword&quot;&gt;const&lt;/span&gt; &lt;span class=&quot;hljs-keyword&quot;&gt;float&lt;/span&gt; R4 = &lt;span class=&quot;hljs-number&quot;&gt;10000.0&lt;/span&gt;; 
&lt;span class=&quot;hljs-keyword&quot;&gt;const&lt;/span&gt; &lt;span class=&quot;hljs-keyword&quot;&gt;float&lt;/span&gt; dividerRatio = (R3 + R4) / R4; 
&lt;/code&gt;&lt;/pre&gt;&lt;!----&gt;&lt;/div&gt;&lt;/div&gt;&lt;/div&gt;&lt;!----&gt;&lt;!----&gt;&lt;!----&gt;&lt;/code-block&gt;&lt;!----&gt;&lt;!----&gt;&lt;!----&gt;&lt;!----&gt;&lt;!----&gt;&lt;!----&gt;&lt;!----&gt;&lt;!----&gt;&lt;!----&gt;&lt;!----&gt;&lt;!----&gt;&lt;!----&gt;&lt;!----&gt;&lt;!----&gt;&lt;!----&gt;&lt;!----&gt;&lt;!----&gt;&lt;!----&gt;&lt;!----&gt;&lt;!----&gt;&lt;!----&gt;&lt;!----&gt;&lt;!----&gt;&lt;!----&gt;&lt;!----&gt;&lt;!----&gt;&lt;!----&gt;&lt;!----&gt;&lt;!----&gt;&lt;!----&gt;&lt;!----&gt;&lt;!----&gt;&lt;!----&gt;&lt;!----&gt;&lt;!----&gt;&lt;!----&gt;&lt;!----&gt;&lt;!----&gt;&lt;!----&gt;&lt;!----&gt;&lt;!----&gt;&lt;!----&gt;&lt;!----&gt;&lt;!----&gt;&lt;!----&gt;&lt;!----&gt;&lt;!----&gt;&lt;!----&gt;&lt;!----&gt;&lt;!----&gt;&lt;!----&gt;&lt;!----&gt;&lt;!----&gt;&lt;!----&gt;&lt;!----&gt;&lt;!----&gt;&lt;!----&gt;&lt;!----&gt;&lt;!----&gt;&lt;!----&gt;&lt;!----&gt;&lt;!----&gt;&lt;!----&gt;&lt;!----&gt;&lt;!----&gt;&lt;!----&gt;&lt;!----&gt;&lt;!----&gt;&lt;/span&gt;&lt;/response-element&gt;&lt;ul data-path-to-node=&quot;5&quot;&gt;&lt;li&gt;&lt;p data-path-to-node=&quot;5,0,0&quot;&gt;&lt;span style=&quot;font-family: inherit;&quot;&gt;&lt;b data-index-in-node=&quot;0&quot; data-path-to-node=&quot;5,0,0&quot;&gt;The Math:&lt;/b&gt; Since the Arduino cannot &quot;read&quot; 12V directly, your schematic uses a voltage divider. This &lt;code data-index-in-node=&quot;100&quot; data-path-to-node=&quot;5,0,0&quot;&gt;dividerRatio&lt;/code&gt; (which is &lt;b data-index-in-node=&quot;123&quot; data-path-to-node=&quot;5,0,0&quot;&gt;2.4&lt;/b&gt;) tells the code how to &quot;magnify&quot; the small 0-5V signal back up to the real 0-12V value for the Serial Monitor.&lt;/span&gt;&lt;/p&gt;&lt;/li&gt;&lt;/ul&gt;&lt;h3 data-path-to-node=&quot;6&quot;&gt;&lt;span style=&quot;font-family: inherit;&quot;&gt;2. The High-Speed Heart (Timer Setup)&lt;/span&gt;&lt;/h3&gt;&lt;response-element ng-version=&quot;0.0.0-PLACEHOLDER&quot;&gt;&lt;span style=&quot;font-family: inherit;&quot;&gt;&lt;code-block _nghost-ng-c1583389803=&quot;&quot; class=&quot;ng-tns-c1583389803-684 ng-star-inserted&quot;&gt;&lt;div _ngcontent-ng-c1583389803=&quot;&quot; class=&quot;code-block ng-tns-c1583389803-684 ng-animate-disabled ng-trigger ng-trigger-codeBlockRevealAnimation&quot; data-hveid=&quot;0&quot; data-ved=&quot;0CAAQhtANahgKEwjNr8m9gN6TAxUAAAAAHQAAAAAQ7RI&quot; decode-data-ved=&quot;1&quot; jslog=&quot;223238;track:impression,attention;BardVeMetadataKey:[[&amp;quot;r_5f18bdf139170f77&amp;quot;,&amp;quot;c_ab33c6b718acc256&amp;quot;,null,&amp;quot;rc_31a7d4d5daf5c6a6&amp;quot;,null,null,&amp;quot;en&amp;quot;,null,1,null,null,1,0]]&quot;&gt;&lt;div _ngcontent-ng-c1583389803=&quot;&quot; class=&quot;code-block-decoration header-formatted gds-title-s ng-tns-c1583389803-684 ng-star-inserted&quot;&gt;&lt;div _ngcontent-ng-c1583389803=&quot;&quot; class=&quot;buttons ng-tns-c1583389803-684 ng-star-inserted&quot;&gt;&lt;!----&gt;&lt;/div&gt;&lt;/div&gt;&lt;div _ngcontent-ng-c1583389803=&quot;&quot; class=&quot;formatted-code-block-internal-container ng-tns-c1583389803-684&quot;&gt;&lt;div _ngcontent-ng-c1583389803=&quot;&quot; class=&quot;animated-opacity ng-tns-c1583389803-684&quot;&gt;&lt;pre _ngcontent-ng-c1583389803=&quot;&quot; class=&quot;ng-tns-c1583389803-684&quot;&gt;&lt;code _ngcontent-ng-c1583389803=&quot;&quot; class=&quot;code-container formatted ng-tns-c1583389803-684&quot; data-test-id=&quot;code-content&quot; role=&quot;text&quot;&gt;TCCR1B = (TCCR1B &amp;amp; &lt;span class=&quot;hljs-number&quot;&gt;0b11111000&lt;/span&gt;) | &lt;span class=&quot;hljs-number&quot;&gt;0x01&lt;/span&gt;;
&lt;/code&gt;&lt;/pre&gt;&lt;!----&gt;&lt;/div&gt;&lt;/div&gt;&lt;/div&gt;&lt;!----&gt;&lt;!----&gt;&lt;!----&gt;&lt;/code-block&gt;&lt;!----&gt;&lt;!----&gt;&lt;!----&gt;&lt;!----&gt;&lt;!----&gt;&lt;!----&gt;&lt;!----&gt;&lt;!----&gt;&lt;!----&gt;&lt;!----&gt;&lt;!----&gt;&lt;!----&gt;&lt;!----&gt;&lt;!----&gt;&lt;!----&gt;&lt;!----&gt;&lt;!----&gt;&lt;!----&gt;&lt;!----&gt;&lt;!----&gt;&lt;!----&gt;&lt;!----&gt;&lt;!----&gt;&lt;!----&gt;&lt;!----&gt;&lt;!----&gt;&lt;!----&gt;&lt;!----&gt;&lt;!----&gt;&lt;!----&gt;&lt;!----&gt;&lt;!----&gt;&lt;!----&gt;&lt;!----&gt;&lt;!----&gt;&lt;!----&gt;&lt;!----&gt;&lt;!----&gt;&lt;!----&gt;&lt;!----&gt;&lt;!----&gt;&lt;!----&gt;&lt;!----&gt;&lt;!----&gt;&lt;!----&gt;&lt;!----&gt;&lt;!----&gt;&lt;!----&gt;&lt;!----&gt;&lt;!----&gt;&lt;!----&gt;&lt;!----&gt;&lt;!----&gt;&lt;!----&gt;&lt;!----&gt;&lt;!----&gt;&lt;!----&gt;&lt;!----&gt;&lt;!----&gt;&lt;!----&gt;&lt;!----&gt;&lt;!----&gt;&lt;!----&gt;&lt;!----&gt;&lt;!----&gt;&lt;!----&gt;&lt;!----&gt;&lt;!----&gt;&lt;/span&gt;&lt;/response-element&gt;&lt;ul data-path-to-node=&quot;8&quot;&gt;&lt;li&gt;&lt;p data-path-to-node=&quot;8,0,0&quot;&gt;&lt;span style=&quot;font-family: inherit;&quot;&gt;&lt;b data-index-in-node=&quot;0&quot; data-path-to-node=&quot;8,0,0&quot;&gt;The &quot;Overclock&quot;:&lt;/b&gt; By default, Arduino PWM is very slow (about 490Hz). This line modifies the &lt;b data-index-in-node=&quot;92&quot; data-path-to-node=&quot;8,0,0&quot;&gt;Timer 1&lt;/b&gt; hardware register.&lt;/span&gt;&lt;/p&gt;&lt;/li&gt;&lt;li&gt;&lt;p data-path-to-node=&quot;8,1,0&quot;&gt;&lt;span style=&quot;font-family: inherit;&quot;&gt;By setting the prescaler to &lt;code data-index-in-node=&quot;28&quot; data-path-to-node=&quot;8,1,0&quot;&gt;0x01&lt;/code&gt;, you are pushing the frequency to &lt;b data-index-in-node=&quot;67&quot; data-path-to-node=&quot;8,1,0&quot;&gt;31.25kHz&lt;/b&gt;. This high speed is what allows you to use that small &lt;b data-index-in-node=&quot;130&quot; data-path-to-node=&quot;8,1,0&quot;&gt;155µH inductor&lt;/b&gt; instead of a massive one.&lt;/span&gt;&lt;/p&gt;&lt;/li&gt;&lt;/ul&gt;&lt;h3 data-path-to-node=&quot;9&quot;&gt;&lt;span style=&quot;font-family: inherit;&quot;&gt;3. The Control Loop (The &quot;Brain&quot;)&lt;/span&gt;&lt;/h3&gt;&lt;response-element ng-version=&quot;0.0.0-PLACEHOLDER&quot;&gt;&lt;span style=&quot;font-family: inherit;&quot;&gt;&lt;code-block _nghost-ng-c1583389803=&quot;&quot; class=&quot;ng-tns-c1583389803-685 ng-star-inserted&quot;&gt;&lt;div _ngcontent-ng-c1583389803=&quot;&quot; class=&quot;code-block ng-tns-c1583389803-685 ng-animate-disabled ng-trigger ng-trigger-codeBlockRevealAnimation&quot; data-hveid=&quot;0&quot; data-ved=&quot;0CAAQhtANahgKEwjNr8m9gN6TAxUAAAAAHQAAAAAQ7hI&quot; decode-data-ved=&quot;1&quot; jslog=&quot;223238;track:impression,attention;BardVeMetadataKey:[[&amp;quot;r_5f18bdf139170f77&amp;quot;,&amp;quot;c_ab33c6b718acc256&amp;quot;,null,&amp;quot;rc_31a7d4d5daf5c6a6&amp;quot;,null,null,&amp;quot;en&amp;quot;,null,1,null,null,1,0]]&quot;&gt;&lt;div _ngcontent-ng-c1583389803=&quot;&quot; class=&quot;code-block-decoration header-formatted gds-title-s ng-tns-c1583389803-685 ng-star-inserted&quot;&gt;&lt;div _ngcontent-ng-c1583389803=&quot;&quot; class=&quot;buttons ng-tns-c1583389803-685 ng-star-inserted&quot;&gt;&lt;!----&gt;&lt;!----&gt;&lt;/div&gt;&lt;!----&gt;&lt;!----&gt;&lt;/div&gt;&lt;!----&gt;&lt;div _ngcontent-ng-c1583389803=&quot;&quot; class=&quot;formatted-code-block-internal-container ng-tns-c1583389803-685&quot;&gt;&lt;div _ngcontent-ng-c1583389803=&quot;&quot; class=&quot;animated-opacity ng-tns-c1583389803-685&quot;&gt;&lt;pre _ngcontent-ng-c1583389803=&quot;&quot; class=&quot;ng-tns-c1583389803-685&quot;&gt;&lt;code _ngcontent-ng-c1583389803=&quot;&quot; class=&quot;code-container formatted ng-tns-c1583389803-685&quot; data-test-id=&quot;code-content&quot; role=&quot;text&quot;&gt;&lt;span class=&quot;hljs-keyword&quot;&gt;int&lt;/span&gt; potValue = analogRead(potPin);
&lt;span class=&quot;hljs-keyword&quot;&gt;int&lt;/span&gt; pwmValue = &lt;span class=&quot;hljs-built_in&quot;&gt;map&lt;/span&gt;(potValue, &lt;span class=&quot;hljs-number&quot;&gt;0&lt;/span&gt;, &lt;span class=&quot;hljs-number&quot;&gt;1023&lt;/span&gt;, &lt;span class=&quot;hljs-number&quot;&gt;0&lt;/span&gt;, &lt;span class=&quot;hljs-number&quot;&gt;255&lt;/span&gt;); 
analogWrite(pwmPin, pwmValue);
&lt;/code&gt;&lt;/pre&gt;&lt;!----&gt;&lt;/div&gt;&lt;/div&gt;&lt;/div&gt;&lt;!----&gt;&lt;!----&gt;&lt;!----&gt;&lt;/code-block&gt;&lt;!----&gt;&lt;!----&gt;&lt;!----&gt;&lt;!----&gt;&lt;!----&gt;&lt;!----&gt;&lt;!----&gt;&lt;!----&gt;&lt;!----&gt;&lt;!----&gt;&lt;!----&gt;&lt;!----&gt;&lt;!----&gt;&lt;!----&gt;&lt;!----&gt;&lt;!----&gt;&lt;!----&gt;&lt;!----&gt;&lt;!----&gt;&lt;!----&gt;&lt;!----&gt;&lt;!----&gt;&lt;!----&gt;&lt;!----&gt;&lt;!----&gt;&lt;!----&gt;&lt;!----&gt;&lt;!----&gt;&lt;!----&gt;&lt;!----&gt;&lt;!----&gt;&lt;!----&gt;&lt;!----&gt;&lt;!----&gt;&lt;!----&gt;&lt;!----&gt;&lt;!----&gt;&lt;!----&gt;&lt;!----&gt;&lt;!----&gt;&lt;!----&gt;&lt;!----&gt;&lt;!----&gt;&lt;!----&gt;&lt;!----&gt;&lt;!----&gt;&lt;!----&gt;&lt;!----&gt;&lt;!----&gt;&lt;!----&gt;&lt;!----&gt;&lt;!----&gt;&lt;!----&gt;&lt;!----&gt;&lt;!----&gt;&lt;!----&gt;&lt;!----&gt;&lt;!----&gt;&lt;!----&gt;&lt;!----&gt;&lt;!----&gt;&lt;!----&gt;&lt;!----&gt;&lt;!----&gt;&lt;!----&gt;&lt;!----&gt;&lt;!----&gt;&lt;!----&gt;&lt;/span&gt;&lt;/response-element&gt;&lt;ul data-path-to-node=&quot;11&quot;&gt;&lt;li&gt;&lt;p data-path-to-node=&quot;11,0,0&quot;&gt;&lt;span style=&quot;font-family: inherit;&quot;&gt;&lt;b data-index-in-node=&quot;0&quot; data-path-to-node=&quot;11,0,0&quot;&gt;Input:&lt;/b&gt; It reads the 10k Potentiometer position.&lt;/span&gt;&lt;/p&gt;&lt;/li&gt;&lt;li&gt;&lt;p data-path-to-node=&quot;11,1,0&quot;&gt;&lt;span style=&quot;font-family: inherit;&quot;&gt;&lt;b data-index-in-node=&quot;0&quot; data-path-to-node=&quot;11,1,0&quot;&gt;Translation:&lt;/b&gt; It maps that position to a 0-255 &quot;Duty Cycle&quot; value.&lt;/span&gt;&lt;/p&gt;&lt;/li&gt;&lt;li&gt;&lt;p data-path-to-node=&quot;11,2,0&quot;&gt;&lt;span style=&quot;font-family: inherit;&quot;&gt;&lt;b data-index-in-node=&quot;0&quot; data-path-to-node=&quot;11,2,0&quot;&gt;Action:&lt;/b&gt; &lt;code data-index-in-node=&quot;8&quot; data-path-to-node=&quot;11,2,0&quot;&gt;analogWrite&lt;/code&gt; tells the MOSFET how long to stay open.&lt;/span&gt;&lt;/p&gt;&lt;ul data-path-to-node=&quot;11,2,1&quot;&gt;&lt;li&gt;&lt;p data-path-to-node=&quot;11,2,1,0,0&quot;&gt;&lt;span style=&quot;font-family: inherit;&quot;&gt;&lt;b data-index-in-node=&quot;0&quot; data-path-to-node=&quot;11,2,1,0,0&quot;&gt;PWM 0:&lt;/b&gt; MOSFET always OFF (0V Output).&lt;/span&gt;&lt;/p&gt;&lt;/li&gt;&lt;li&gt;&lt;p data-path-to-node=&quot;11,2,1,1,0&quot;&gt;&lt;span style=&quot;font-family: inherit;&quot;&gt;&lt;b data-index-in-node=&quot;0&quot; data-path-to-node=&quot;11,2,1,1,0&quot;&gt;PWM 255:&lt;/b&gt; MOSFET always ON (12V Output).&lt;/span&gt;&lt;/p&gt;&lt;/li&gt;&lt;li&gt;&lt;p data-path-to-node=&quot;11,2,1,2,0&quot;&gt;&lt;span style=&quot;font-family: inherit;&quot;&gt;&lt;b data-index-in-node=&quot;0&quot; data-path-to-node=&quot;11,2,1,2,0&quot;&gt;PWM 127:&lt;/b&gt; MOSFET ON 50% of the time (~6V Output).&lt;/span&gt;&lt;/p&gt;&lt;/li&gt;&lt;/ul&gt;&lt;/li&gt;&lt;/ul&gt;&lt;h3 data-path-to-node=&quot;12&quot;&gt;&lt;span style=&quot;font-family: inherit;&quot;&gt;4. Serial Monitor&lt;/span&gt;&lt;/h3&gt;&lt;response-element ng-version=&quot;0.0.0-PLACEHOLDER&quot;&gt;&lt;span style=&quot;font-family: inherit;&quot;&gt;&lt;code-block _nghost-ng-c1583389803=&quot;&quot; class=&quot;ng-tns-c1583389803-686 ng-star-inserted&quot;&gt;&lt;div _ngcontent-ng-c1583389803=&quot;&quot; class=&quot;code-block ng-tns-c1583389803-686 ng-animate-disabled ng-trigger ng-trigger-codeBlockRevealAnimation&quot; data-hveid=&quot;0&quot; data-ved=&quot;0CAAQhtANahgKEwjNr8m9gN6TAxUAAAAAHQAAAAAQ7xI&quot; decode-data-ved=&quot;1&quot; jslog=&quot;223238;track:impression,attention;BardVeMetadataKey:[[&amp;quot;r_5f18bdf139170f77&amp;quot;,&amp;quot;c_ab33c6b718acc256&amp;quot;,null,&amp;quot;rc_31a7d4d5daf5c6a6&amp;quot;,null,null,&amp;quot;en&amp;quot;,null,1,null,null,1,0]]&quot;&gt;&lt;div _ngcontent-ng-c1583389803=&quot;&quot; class=&quot;code-block-decoration header-formatted gds-title-s ng-tns-c1583389803-686 ng-star-inserted&quot;&gt;&lt;div _ngcontent-ng-c1583389803=&quot;&quot; class=&quot;buttons ng-tns-c1583389803-686 ng-star-inserted&quot;&gt;&lt;!----&gt;&lt;!----&gt;&lt;/div&gt;&lt;!----&gt;&lt;!----&gt;&lt;/div&gt;&lt;!----&gt;&lt;div _ngcontent-ng-c1583389803=&quot;&quot; class=&quot;formatted-code-block-internal-container ng-tns-c1583389803-686&quot;&gt;&lt;div _ngcontent-ng-c1583389803=&quot;&quot; class=&quot;animated-opacity ng-tns-c1583389803-686&quot;&gt;&lt;pre _ngcontent-ng-c1583389803=&quot;&quot; class=&quot;ng-tns-c1583389803-686&quot;&gt;&lt;code _ngcontent-ng-c1583389803=&quot;&quot; class=&quot;code-container formatted ng-tns-c1583389803-686&quot; data-test-id=&quot;code-content&quot; role=&quot;text&quot;&gt;&lt;span class=&quot;hljs-keyword&quot;&gt;if&lt;/span&gt; (millis() - lastPrint &amp;gt; &lt;span class=&quot;hljs-number&quot;&gt;400&lt;/span&gt;) { 
    &lt;span class=&quot;hljs-keyword&quot;&gt;float&lt;/span&gt; vRaw = analogRead(feedbackPin) * (&lt;span class=&quot;hljs-number&quot;&gt;5.0&lt;/span&gt; / &lt;span class=&quot;hljs-number&quot;&gt;1023.0&lt;/span&gt;);
    &lt;span class=&quot;hljs-keyword&quot;&gt;float&lt;/span&gt; actualVolts = vRaw * dividerRatio;
}
&lt;/code&gt;&lt;/pre&gt;&lt;!----&gt;&lt;/div&gt;&lt;/div&gt;&lt;/div&gt;&lt;!----&gt;&lt;!----&gt;&lt;!----&gt;&lt;/code-block&gt;&lt;!----&gt;&lt;!----&gt;&lt;!----&gt;&lt;!----&gt;&lt;!----&gt;&lt;!----&gt;&lt;!----&gt;&lt;!----&gt;&lt;!----&gt;&lt;!----&gt;&lt;!----&gt;&lt;!----&gt;&lt;!----&gt;&lt;!----&gt;&lt;!----&gt;&lt;!----&gt;&lt;!----&gt;&lt;!----&gt;&lt;!----&gt;&lt;!----&gt;&lt;!----&gt;&lt;!----&gt;&lt;!----&gt;&lt;!----&gt;&lt;!----&gt;&lt;!----&gt;&lt;!----&gt;&lt;!----&gt;&lt;!----&gt;&lt;!----&gt;&lt;!----&gt;&lt;!----&gt;&lt;!----&gt;&lt;!----&gt;&lt;!----&gt;&lt;!----&gt;&lt;!----&gt;&lt;!----&gt;&lt;!----&gt;&lt;!----&gt;&lt;!----&gt;&lt;!----&gt;&lt;!----&gt;&lt;!----&gt;&lt;!----&gt;&lt;!----&gt;&lt;!----&gt;&lt;!----&gt;&lt;!----&gt;&lt;!----&gt;&lt;!----&gt;&lt;!----&gt;&lt;!----&gt;&lt;!----&gt;&lt;!----&gt;&lt;!----&gt;&lt;!----&gt;&lt;!----&gt;&lt;!----&gt;&lt;!----&gt;&lt;!----&gt;&lt;!----&gt;&lt;!----&gt;&lt;!----&gt;&lt;!----&gt;&lt;!----&gt;&lt;!----&gt;&lt;!----&gt;&lt;/span&gt;&lt;/response-element&gt;&lt;ul data-path-to-node=&quot;14&quot;&gt;&lt;li&gt;&lt;p data-path-to-node=&quot;14,0,0&quot;&gt;&lt;span style=&quot;font-family: inherit;&quot;&gt;&lt;b data-index-in-node=&quot;0&quot; data-path-to-node=&quot;14,0,0&quot;&gt;Non-Blocking Delay:&lt;/b&gt; Using &lt;code data-index-in-node=&quot;26&quot; data-path-to-node=&quot;14,0,0&quot;&gt;millis()&lt;/code&gt; instead of &lt;code data-index-in-node=&quot;46&quot; data-path-to-node=&quot;14,0,0&quot;&gt;delay()&lt;/code&gt; is crucial. It allows the Arduino to keep switching the MOSFET perfectly while only pausing to print text to your screen every 400 milliseconds.&lt;/span&gt;&lt;/p&gt;&lt;/li&gt;&lt;li&gt;&lt;p data-path-to-node=&quot;14,1,0&quot;&gt;&lt;span style=&quot;font-family: inherit;&quot;&gt;&lt;b data-index-in-node=&quot;0&quot; data-path-to-node=&quot;14,1,0&quot;&gt;Precision Math:&lt;/b&gt; It converts the raw binary data (0-1023) back into Volts, then applies the &lt;code data-index-in-node=&quot;91&quot; data-path-to-node=&quot;14,1,0&quot;&gt;dividerRatio&lt;/code&gt; so you see the &lt;b data-index-in-node=&quot;119&quot; data-path-to-node=&quot;14,1,0&quot;&gt;actual&lt;/b&gt; output voltage on your Serial Monitor.&lt;/span&gt;&lt;/p&gt;&lt;/li&gt;&lt;/ul&gt;&lt;h3 style=&quot;text-align: left;&quot;&gt;Video&lt;/h3&gt;&lt;/div&gt;&lt;div&gt;The following &lt;b&gt;video&lt;/b&gt; shows how the Arduino buck converter woks, explains the circuit and circuit components in details.&lt;/div&gt;&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;&lt;iframe allowfullscreen=&quot;&quot; class=&quot;BLOG_video_class&quot; height=&quot;424&quot; src=&quot;https://www.youtube.com/embed/4rz0l5JkG3M&quot; width=&quot;510&quot; youtube-src-id=&quot;4rz0l5JkG3M&quot;&gt;&lt;/iframe&gt;&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;&lt;b&gt;Related&lt;/b&gt;&lt;/div&gt;&lt;div&gt;&lt;ul style=&quot;text-align: left;&quot;&gt;&lt;li&gt;&lt;a href=&quot;https://www.ee-diary.net/2024/12/how-to-design-arduino-buck-converter.html&quot;&gt;How to design Arduino buck converter with feedback&lt;/a&gt;&lt;/li&gt;&lt;li&gt;&lt;a href=&quot;https://www.ee-diary.net/2024/12/555-timer-buck-converter-design-and.html&quot;&gt;555 Timer Buck Converter Design and Analysis&lt;/a&gt;&lt;/li&gt;&lt;li&gt;&lt;a href=&quot;https://www.ee-diary.net/2024/12/calculate-l-c-values-for-buck-converter.html&quot;&gt;Calculate L C values For Buck Converter How to?&lt;/a&gt;&lt;/li&gt;&lt;/ul&gt;&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://www.ee-diary.net/feeds/474513906926763637/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.ee-diary.net/2026/04/redesigned-arduino-based-buck-converter.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7437986969318338216/posts/default/474513906926763637'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7437986969318338216/posts/default/474513906926763637'/><link rel='alternate' type='text/html' href='http://www.ee-diary.net/2026/04/redesigned-arduino-based-buck-converter.html' title='Redesigned Arduino Based Buck Converter : N-Channel vs. P-Channel Buck Converter: '/><author><name>Unknown</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjH-P4Fo6nQLuBz0TUGzKXu-MihO4pWan3CrWVouaOgqNcNn7sDsQNKjmui93voKcHHc44eYuqIk4jTIQr9J09fUKq5gGU_mVXBiGQ0-LoZSLhQW85Tr_LmqY4QHjwm8bfZ4I3uhugM05UIYEhS_ZuHAxbi3Kuj3HhIcE1jjoJBSvhslcQ_VtvnL1xRI8xF/s72-c/Gemini_Generated_Image_vnscvqvnscvqvnsc.png" height="72" width="72"/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-7437986969318338216.post-7731135003536810834</id><published>2026-04-08T02:19:00.001+05:45</published><updated>2026-04-08T02:19:04.782+05:45</updated><category scheme="http://www.blogger.com/atom/ns#" term="arduino"/><category scheme="http://www.blogger.com/atom/ns#" term="buck converter"/><category scheme="http://www.blogger.com/atom/ns#" term="Voltage Regulator"/><title type='text'>Why High-Side N-Channel Buck Converters Fail</title><content type='html'>&lt;p&gt;&lt;span style=&quot;font-family: inherit;&quot;&gt;&amp;nbsp;I posted about an open loop, non-synchronous, high side N-MOSFET &lt;a href=&quot;https://www.ee-diary.net/2024/11/how-to-design-buck-converter-and-drive.html&quot;&gt;diy Arduino based buck converter design&lt;/a&gt; earlier. But after researching, I came to know that it will not work. I need to rewrite that blog post. But before doing that I wanted to write a new one and record what was wrong in that buck converter circuit.&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style=&quot;font-family: inherit;&quot;&gt;Here is the circuit design of the buck converter that was failing.&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhCfCoO-HgzmhcT8ktV4gDcJceN7S9LcLYcz4vIi3UKiz7HFmGtYEQiXZEsYsCGrjmUCRnW0tT-PibD07gO7TH5cgIZ9ei0A1UJm-GxwvAplmI3cCMBNqKYIIoDDsKjtFfcD-O00WQflW5iJna60qjScUMUoim8_tWhBLGK63ld-nc3KmVsuXu6lmOLHxPh/s1170/buck%20converter.png&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;span style=&quot;font-family: inherit;&quot;&gt;&lt;img alt=&quot;buck converter&quot; border=&quot;0&quot; data-original-height=&quot;425&quot; data-original-width=&quot;1170&quot; height=&quot;232&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhCfCoO-HgzmhcT8ktV4gDcJceN7S9LcLYcz4vIi3UKiz7HFmGtYEQiXZEsYsCGrjmUCRnW0tT-PibD07gO7TH5cgIZ9ei0A1UJm-GxwvAplmI3cCMBNqKYIIoDDsKjtFfcD-O00WQflW5iJna60qjScUMUoim8_tWhBLGK63ld-nc3KmVsuXu6lmOLHxPh/w640-h232/buck%20converter.png&quot; title=&quot;buck converter&quot; width=&quot;640&quot; /&gt;&lt;/span&gt;&lt;/a&gt;&lt;/p&gt;&lt;p&gt;&lt;span style=&quot;font-family: inherit;&quot;&gt;There are several design errors in this circuit. The main problem with this buck converter circuit design is that I used &lt;b&gt;N-channel MOSFET IRFZ44N&lt;/b&gt; on the high side (between the power supply and the load). The reason this will fail or will generate heat is that, when the output PWM signal coming from Arduino is high, the transistor BD139 will turn ON, and the Gate of the N-channel MOSFET is pulled low to ground turning off the N-channel MOSFET. Now as soon as the n-channel MOSFET turns on, the source terminal of the MOSFET rises to 12V. But to keep the MOSFET ON the gate voltage requires gate to source voltage of 10V(for IRFZ44N the&amp;nbsp;$V_{GS}$&amp;nbsp;&amp;gt;10V) which means the gate voltage must be 15V&lt;span class=&quot;math-inline&quot; data-index-in-node=&quot;114&quot; data-math=&quot;V_{GS}&quot; style=&quot;line-height: 1.15 !important; margin-top: 0px !important;&quot;&gt;$V_{GS}$&lt;/span&gt;) if we want 5V supplied to the load since&amp;nbsp;$V_{GS} = V_{Gate} - V_{Source}$, that is,$V_{Gate} = V_{Source} + V_{GS}$=$V_{Gate} = 5\text{V} + 10\text{V} = \mathbf{15\text{V}}$.&amp;nbsp;But the circuit only has &lt;span data-index-in-node=&quot;35&quot; data-path-to-node=&quot;8,3,0&quot; style=&quot;line-height: 1.15 !important; margin-top: 0px !important;&quot;&gt;12V&lt;/span&gt; available from the battery. When the Gate reaches 12V, and the Source tries to reach 5V, the &lt;span class=&quot;math-inline&quot; data-index-in-node=&quot;132&quot; data-math=&quot;V_{GS}&quot; style=&quot;line-height: 1.15 !important; margin-top: 0px !important;&quot;&gt;$V_{GS}$&lt;/span&gt; is only 7V. This is enough to turn the MOSFET &lt;i data-index-in-node=&quot;185&quot; data-path-to-node=&quot;8,3,0&quot; style=&quot;line-height: 1.15 !important; margin-top: 0px !important;&quot;&gt;partially&lt;/i&gt; on, but not &lt;i data-index-in-node=&quot;207&quot; data-path-to-node=&quot;8,3,0&quot; style=&quot;line-height: 1.15 !important; margin-top: 0px !important;&quot;&gt;fully&lt;/i&gt;.Because the MOSFET isn&#39;t fully &quot;ON,&quot; it acts like a resistor. It will &quot;eat&quot; the missing voltage and turn it into heat. Similarly, and this is the second reasons why this circuit will fail is that when the PWM signal is low(0V) then the transistor BD139 is turned off. In this case, the 10kohm resistor pulls up the gate voltage to the +12V power supply and&amp;nbsp;&lt;span class=&quot;math-inline&quot; data-index-in-node=&quot;82&quot; data-math=&quot;V_{GS}&quot; style=&quot;line-height: 1.15 !important; margin-top: 0px !important;&quot;&gt;$V_{GS}$&lt;/span&gt; becomes &lt;span data-index-in-node=&quot;97&quot; data-path-to-node=&quot;4,1,0&quot; style=&quot;line-height: 1.15 !important; margin-top: 0px !important;&quot;&gt;0V&lt;/span&gt;&lt;b data-index-in-node=&quot;97&quot; data-path-to-node=&quot;4,1,0&quot; style=&quot;line-height: 1.15 !important; margin-top: 0px !important;&quot;&gt;&amp;nbsp;&lt;/b&gt;because the source voltage is same as gate voltage. This implies that the N-channel MOSFET is turned off cutting off the path between the 12V power supply and the rest of the circuit. Though the power supply is completely cut off, current does not stop immediately. The current stored in the inductor L1 tries to flow in the same direction and to do this it reverses its polarity. So, the junction where the diode, inductor and the MOSFET meet becomes now negative. This in turn forward biases the &lt;b&gt;Schottky diode 1N4148&lt;/b&gt;. Now the current flows in a loop, from inductor to capacitor/bulb to ground, to diode and back to the inductor. In this case the diode is stressed. The 1N4148 diode is now doing 100% of the work to keep the bulb lit using the energy stored in the inductor. And here is another mistake in the circuit. The 1N4148 diode is 200mA rated and so if the bulb wants, say 1A, the diode cannot keep up and will most likely burn out during this situation.&amp;nbsp;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style=&quot;font-family: inherit;&quot;&gt;So, the fixes to this wrongly designed Arduino based buck converter design is not to use N-Channel MOSFET on the high side but use P-channel MOSFET&amp;nbsp;like an &lt;span data-index-in-node=&quot;86&quot; data-path-to-node=&quot;3,2,0&quot;&gt;&lt;b&gt;IRF9540 MOSFET&lt;/b&gt;. Using p-channel MOSFET at the high side the current driver BD139 Q2 will correctly pull the gate to ground to turn it on.&amp;nbsp;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style=&quot;font-family: inherit;&quot;&gt;&lt;span data-index-in-node=&quot;86&quot; data-path-to-node=&quot;3,2,0&quot;&gt;Another fix is about the diode. The 1N4148 is small signal switching diode rated only 200mA. The buck converter inductor &quot;kicks back&quot; significant current through this diode every time the MOSFET switches off and therefore burn out. The solution to this is to use schotty diode that is at&amp;nbsp;&lt;/span&gt;least &lt;span class=&quot;math-inline&quot; data-index-in-node=&quot;61&quot; data-math=&quot;3\text{A}&quot; style=&quot;line-height: 1.15 !important; margin-top: 0px !important;&quot;&gt;$3\text{A}$&lt;/span&gt; to &lt;span class=&quot;math-inline&quot; data-index-in-node=&quot;74&quot; data-math=&quot;5\text{A}&quot; style=&quot;line-height: 1.15 !important; margin-top: 0px !important;&quot;&gt;$5\text{A}$&lt;/span&gt;, such as a &lt;b data-index-in-node=&quot;95&quot; data-path-to-node=&quot;6,2,0&quot; style=&quot;line-height: 1.15 !important; margin-top: 0px !important;&quot;&gt;1N5822&lt;/b&gt;&amp;nbsp;or &lt;b data-index-in-node=&quot;105&quot; data-path-to-node=&quot;6,2,0&quot; style=&quot;line-height: 1.15 !important; margin-top: 0px !important;&quot;&gt;SR540&lt;/b&gt;. Schottky diodes are necessary because they switch fast enough for PWM.&amp;nbsp;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style=&quot;font-family: inherit;&quot;&gt;Another modification in the circuit that should be done is about the high-frequency noise on the 12V input line. Switching circuit like buck converter circuit produces massive high-frequency noise. The remedy for this is to use a large electrolytic capacitor (e.g., &lt;span class=&quot;math-inline&quot; data-index-in-node=&quot;51&quot; data-math=&quot;470\mu\text{F}&quot; style=&quot;line-height: 1.15 !important; margin-top: 0px !important;&quot;&gt;$470\mu\text{F}$&lt;/span&gt;) in parallel with the battery, as close to the MOSFET as possible, to stabilize the input voltage.&lt;/span&gt;&lt;/p&gt;&lt;p&gt;The corrected circuit schematic along with result is in the next article,&amp;nbsp;&lt;span style=&quot;font-family: inherit;&quot;&gt;Arduino Buck Converter Design - Open-Loop, Non-Synchronous, High-Side P-MOSFET.&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;b&gt;Related&lt;/b&gt;&lt;/p&gt;&lt;p&gt;&lt;/p&gt;&lt;ul style=&quot;text-align: left;&quot;&gt;&lt;li&gt;&lt;a href=&quot;https://www.ee-diary.net/2026/04/how-to-build-pure-sine-wave-inverter.html&quot;&gt;How to Build a Pure Sine Wave Inverter using Arduino SPWM&lt;/a&gt;&lt;/li&gt;&lt;li&gt;&lt;a href=&quot;https://www.ee-diary.net/2025/07/arduino-based-pure-sine-wave-inverter.html&quot;&gt;Arduino-Based Pure Sine Wave Inverter (SPWM, Push-Pull Topology)&lt;/a&gt;&lt;/li&gt;&lt;li&gt;&lt;a href=&quot;https://www.ee-diary.net/2025/07/boost-converter-design-with-mc34063-ic.html&quot;&gt;Boost Converter Design with MC34063 IC&lt;/a&gt;&lt;/li&gt;&lt;li&gt;&lt;a href=&quot;https://www.ee-diary.net/2024/12/how-to-design-arduino-buck-converter.html&quot;&gt;How to design Arduino buck converter with feedback&lt;/a&gt;&lt;/li&gt;&lt;li&gt;&lt;a href=&quot;https://www.ee-diary.net/2024/12/output-filterlc-calculator-switching.html&quot;&gt;Output Filter(L,C) Calculator Switching Power Supply&lt;/a&gt;&lt;/li&gt;&lt;/ul&gt;&lt;p&gt;&lt;/p&gt;</content><link rel='replies' type='application/atom+xml' href='http://www.ee-diary.net/feeds/7731135003536810834/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.ee-diary.net/2026/04/why-high-side-n-channel-buck-converters.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7437986969318338216/posts/default/7731135003536810834'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7437986969318338216/posts/default/7731135003536810834'/><link rel='alternate' type='text/html' href='http://www.ee-diary.net/2026/04/why-high-side-n-channel-buck-converters.html' title='Why High-Side N-Channel Buck Converters Fail'/><author><name>Unknown</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhCfCoO-HgzmhcT8ktV4gDcJceN7S9LcLYcz4vIi3UKiz7HFmGtYEQiXZEsYsCGrjmUCRnW0tT-PibD07gO7TH5cgIZ9ei0A1UJm-GxwvAplmI3cCMBNqKYIIoDDsKjtFfcD-O00WQflW5iJna60qjScUMUoim8_tWhBLGK63ld-nc3KmVsuXu6lmOLHxPh/s72-w640-h232-c/buck%20converter.png" height="72" width="72"/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-7437986969318338216.post-5384466559808430256</id><published>2026-04-07T20:18:00.002+05:45</published><updated>2026-04-07T20:18:16.689+05:45</updated><category scheme="http://www.blogger.com/atom/ns#" term="ATtiny45"/><title type='text'>Testing Attiny45 ADC functionality in Proteus</title><content type='html'>&lt;span style=&quot;font-family: inherit;&quot;&gt;Here I want to share simple Attiny45 ADC circuit. The Attiny has is 10-bit ADC hardware internally. To test this ADC functionality, I have connected a $10 k \Omega$ potentiometer to the pin PB4 and connected a LED to pin PB0. The Attiny45 microcontroller has 4 ADC pins which are PB2,PB3,PB4 and PB5.&lt;/span&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;&lt;h3 data-path-to-node=&quot;2&quot; style=&quot;line-height: 1.15; margin-top: 0px;&quot;&gt;&lt;span style=&quot;font-family: inherit;&quot;&gt;ATtiny45 ADC Pin Mapping&lt;/span&gt;&lt;/h3&gt;&lt;table data-path-to-node=&quot;3&quot; style=&quot;line-height: 1.15; margin-bottom: 32px; margin-top: 0px;&quot;&gt;&lt;thead style=&quot;line-height: 1.15; margin-top: 0px;&quot;&gt;&lt;tr style=&quot;line-height: 1.15; margin-top: 0px;&quot;&gt;&lt;td style=&quot;border: 1px solid; line-height: 1.15; margin-top: 0px;&quot;&gt;&lt;strong style=&quot;line-height: 1.15; margin-bottom: 0px; margin-top: 0px;&quot;&gt;&lt;span style=&quot;font-family: inherit;&quot;&gt;ADC Channel&lt;/span&gt;&lt;/strong&gt;&lt;/td&gt;&lt;td style=&quot;border: 1px solid; line-height: 1.15; margin-top: 0px;&quot;&gt;&lt;strong style=&quot;line-height: 1.15; margin-bottom: 0px; margin-top: 0px;&quot;&gt;&lt;span style=&quot;font-family: inherit;&quot;&gt;Physical Pin&lt;/span&gt;&lt;/strong&gt;&lt;/td&gt;&lt;td style=&quot;border: 1px solid; line-height: 1.15; margin-top: 0px;&quot;&gt;&lt;strong style=&quot;line-height: 1.15; margin-bottom: 0px; margin-top: 0px;&quot;&gt;&lt;span style=&quot;font-family: inherit;&quot;&gt;Port Pin&lt;/span&gt;&lt;/strong&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/thead&gt;&lt;tbody style=&quot;line-height: 1.15; margin-top: 0px;&quot;&gt;&lt;tr style=&quot;line-height: 1.15; margin-top: 0px;&quot;&gt;&lt;td style=&quot;border: 1px solid; line-height: 1.15; margin-top: 0px;&quot;&gt;&lt;span data-path-to-node=&quot;3,1,0,0&quot; style=&quot;line-height: 1.15; margin-top: 0px;&quot;&gt;&lt;b data-index-in-node=&quot;0&quot; data-path-to-node=&quot;3,1,0,0&quot; style=&quot;line-height: 1.15; margin-top: 0px;&quot;&gt;&lt;span style=&quot;font-family: inherit;&quot;&gt;ADC0&lt;/span&gt;&lt;/b&gt;&lt;/span&gt;&lt;/td&gt;&lt;td style=&quot;border: 1px solid; line-height: 1.15; margin-top: 0px;&quot;&gt;&lt;span data-path-to-node=&quot;3,1,1,0&quot; style=&quot;line-height: 1.15; margin-top: 0px;&quot;&gt;&lt;span style=&quot;font-family: inherit;&quot;&gt;Pin 1&lt;/span&gt;&lt;/span&gt;&lt;/td&gt;&lt;td style=&quot;border: 1px solid; line-height: 1.15; margin-top: 0px;&quot;&gt;&lt;span data-path-to-node=&quot;3,1,2,0&quot; style=&quot;line-height: 1.15; margin-top: 0px;&quot;&gt;&lt;span style=&quot;font-family: inherit;&quot;&gt;&lt;b data-index-in-node=&quot;0&quot; data-path-to-node=&quot;3,1,2,0&quot; style=&quot;line-height: 1.15; margin-top: 0px;&quot;&gt;PB5&lt;/b&gt; (Also the Reset Pin*)&lt;/span&gt;&lt;/span&gt;&lt;/td&gt;&lt;/tr&gt;&lt;tr style=&quot;line-height: 1.15; margin-top: 0px;&quot;&gt;&lt;td style=&quot;border: 1px solid; line-height: 1.15; margin-top: 0px;&quot;&gt;&lt;span data-path-to-node=&quot;3,2,0,0&quot; style=&quot;line-height: 1.15; margin-top: 0px;&quot;&gt;&lt;b data-index-in-node=&quot;0&quot; data-path-to-node=&quot;3,2,0,0&quot; style=&quot;line-height: 1.15; margin-top: 0px;&quot;&gt;&lt;span style=&quot;font-family: inherit;&quot;&gt;ADC1&lt;/span&gt;&lt;/b&gt;&lt;/span&gt;&lt;/td&gt;&lt;td style=&quot;border: 1px solid; line-height: 1.15; margin-top: 0px;&quot;&gt;&lt;span data-path-to-node=&quot;3,2,1,0&quot; style=&quot;line-height: 1.15; margin-top: 0px;&quot;&gt;&lt;span style=&quot;font-family: inherit;&quot;&gt;Pin 7&lt;/span&gt;&lt;/span&gt;&lt;/td&gt;&lt;td style=&quot;border: 1px solid; line-height: 1.15; margin-top: 0px;&quot;&gt;&lt;span data-path-to-node=&quot;3,2,2,0&quot; style=&quot;line-height: 1.15; margin-top: 0px;&quot;&gt;&lt;b data-index-in-node=&quot;0&quot; data-path-to-node=&quot;3,2,2,0&quot; style=&quot;line-height: 1.15; margin-top: 0px;&quot;&gt;&lt;span style=&quot;font-family: inherit;&quot;&gt;PB2&lt;/span&gt;&lt;/b&gt;&lt;/span&gt;&lt;/td&gt;&lt;/tr&gt;&lt;tr style=&quot;line-height: 1.15; margin-top: 0px;&quot;&gt;&lt;td style=&quot;border: 1px solid; line-height: 1.15; margin-top: 0px;&quot;&gt;&lt;span data-path-to-node=&quot;3,3,0,0&quot; style=&quot;line-height: 1.15; margin-top: 0px;&quot;&gt;&lt;b data-index-in-node=&quot;0&quot; data-path-to-node=&quot;3,3,0,0&quot; style=&quot;line-height: 1.15; margin-top: 0px;&quot;&gt;&lt;span style=&quot;font-family: inherit;&quot;&gt;ADC2&lt;/span&gt;&lt;/b&gt;&lt;/span&gt;&lt;/td&gt;&lt;td style=&quot;border: 1px solid; line-height: 1.15; margin-top: 0px;&quot;&gt;&lt;span data-path-to-node=&quot;3,3,1,0&quot; style=&quot;line-height: 1.15; margin-top: 0px;&quot;&gt;&lt;span style=&quot;font-family: inherit;&quot;&gt;Pin 3&lt;/span&gt;&lt;/span&gt;&lt;/td&gt;&lt;td style=&quot;border: 1px solid; line-height: 1.15; margin-top: 0px;&quot;&gt;&lt;span data-path-to-node=&quot;3,3,2,0&quot; style=&quot;line-height: 1.15; margin-top: 0px;&quot;&gt;&lt;b data-index-in-node=&quot;0&quot; data-path-to-node=&quot;3,3,2,0&quot; style=&quot;line-height: 1.15; margin-top: 0px;&quot;&gt;&lt;span style=&quot;font-family: inherit;&quot;&gt;PB4&lt;/span&gt;&lt;/b&gt;&lt;/span&gt;&lt;/td&gt;&lt;/tr&gt;&lt;tr style=&quot;line-height: 1.15; margin-top: 0px;&quot;&gt;&lt;td style=&quot;border: 1px solid; line-height: 1.15; margin-top: 0px;&quot;&gt;&lt;span data-path-to-node=&quot;3,4,0,0&quot; style=&quot;line-height: 1.15; margin-top: 0px;&quot;&gt;&lt;b data-index-in-node=&quot;0&quot; data-path-to-node=&quot;3,4,0,0&quot; style=&quot;line-height: 1.15; margin-top: 0px;&quot;&gt;&lt;span style=&quot;font-family: inherit;&quot;&gt;ADC3&lt;/span&gt;&lt;/b&gt;&lt;/span&gt;&lt;/td&gt;&lt;td style=&quot;border: 1px solid; line-height: 1.15; margin-top: 0px;&quot;&gt;&lt;span data-path-to-node=&quot;3,4,1,0&quot; style=&quot;line-height: 1.15; margin-top: 0px;&quot;&gt;&lt;span style=&quot;font-family: inherit;&quot;&gt;Pin 2&lt;/span&gt;&lt;/span&gt;&lt;/td&gt;&lt;td style=&quot;border: 1px solid; line-height: 1.15; margin-top: 0px;&quot;&gt;&lt;span data-path-to-node=&quot;3,4,2,0&quot; style=&quot;line-height: 1.15; margin-top: 0px;&quot;&gt;&lt;b data-index-in-node=&quot;0&quot; data-path-to-node=&quot;3,4,2,0&quot; style=&quot;line-height: 1.15; margin-top: 0px;&quot;&gt;&lt;span style=&quot;font-family: inherit;&quot;&gt;PB3&lt;/span&gt;&lt;/b&gt;&lt;/span&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/tbody&gt;&lt;/table&gt;This can be visualized using the &lt;a href=&quot;https://www.ee-diary.net/2026/03/attiny45-dip-8-explorer-free.html&quot;&gt;ATtiny45 IC pinout explorer&lt;/a&gt;.&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhXj2G8j4cSaQ_rt74-u_iCTABnrbmNSssB9kvxLJl7wxGeRZlgmLMDwH6VtA1_yUEPAtyabDRqMMARGayFJfl2atdLGIaEkW4wokQsFPPaYgIRHiLPiTsNNI7m9CcXo2g_TakiCz9TnhWroe5wknTGXQBcINkFBeofQjYRGRF9smK85JkiAzFSm7JfNN7g/s939/Attiny45%20ADC%20pins.png&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;span style=&quot;font-family: inherit;&quot;&gt;&lt;img alt=&quot;Attiny45 ADC pins&quot; border=&quot;0&quot; data-original-height=&quot;613&quot; data-original-width=&quot;939&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhXj2G8j4cSaQ_rt74-u_iCTABnrbmNSssB9kvxLJl7wxGeRZlgmLMDwH6VtA1_yUEPAtyabDRqMMARGayFJfl2atdLGIaEkW4wokQsFPPaYgIRHiLPiTsNNI7m9CcXo2g_TakiCz9TnhWroe5wknTGXQBcINkFBeofQjYRGRF9smK85JkiAzFSm7JfNN7g/s16000/Attiny45%20ADC%20pins.png&quot; title=&quot;Attiny45 ADC pins&quot; /&gt;&lt;/span&gt;&lt;/a&gt;&lt;/div&gt;&lt;span style=&quot;font-family: inherit;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;div&gt;Remember that PB5 is also the Reset pin so usually it is not used.&amp;nbsp;&lt;/div&gt;&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;So the test is to use the potentiometer to input analog signal to the Attiny45 via PB4 and if the voltage is above 2.5V then the LED connected to pin PB0 is turned on.&amp;nbsp;&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;The following is the &lt;b&gt;circuit diagram&lt;/b&gt; for testing the ADC functionality of ADC of Attiny45.&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgGt5yCLAq_1-spEaXtG9idQABQ5zyVcKO5hcoadNaO-YT-fJO_ZEWxHjDi2hzIi4fAz_PbIyg6EeWblLfOjmX1y_WH2_YHdgvgDujZT_df3KdE4-qpiGEYo6GtpSDzO-_ABx9c4nGc3I669jAxrqPWSVmjg2mXSNX2P92JlFYXjWA41g9JSn4z_UCIIHi-/s649/Attiny45%20ADC%20pins.png&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img alt=&quot;Testing Attiny45 ADC functionality in Proteus&quot; border=&quot;0&quot; data-original-height=&quot;513&quot; data-original-width=&quot;649&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgGt5yCLAq_1-spEaXtG9idQABQ5zyVcKO5hcoadNaO-YT-fJO_ZEWxHjDi2hzIi4fAz_PbIyg6EeWblLfOjmX1y_WH2_YHdgvgDujZT_df3KdE4-qpiGEYo6GtpSDzO-_ABx9c4nGc3I669jAxrqPWSVmjg2mXSNX2P92JlFYXjWA41g9JSn4z_UCIIHi-/s16000/Attiny45%20ADC%20pins.png&quot; title=&quot;Testing Attiny45 ADC functionality in Proteus&quot; /&gt;&lt;/a&gt;&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;The following is &lt;b&gt;program code&lt;/b&gt; to test the functionality of Attiny45 ADC.&lt;div&gt;
  &lt;pre lang=&quot;cpp&quot;&gt;&lt;code&gt;
#include &amp;lt;avr/io.h&amp;gt;
#include &amp;lt;util/delay.h&amp;gt;

void adc_setup() {
    // 1. Set Voltage Reference to VCC (leave REFS0 at 0)
    // 2. Select Input Channel ADC2 (PB4) by setting MUX1 bit
    ADMUX |= (1 &amp;lt;&amp;lt; MUX1);

    // 3. Set ADC Prescaler to 128 (ADPS0, ADPS1, ADPS2 = 1)
    // This scales the 9.6MHz or 1.2MHz clock down to a usable range (50-200kHz)
    ADCSRA |= (1 &amp;lt;&amp;lt; ADPS2) | (1 &amp;lt;&amp;lt; ADPS1) | (1 &amp;lt;&amp;lt; ADPS0);

    // 4. Enable the ADC
    ADCSRA |= (1 &amp;lt;&amp;lt; ADEN);
}

uint16_t adc_read() {
    // Start the conversion
    ADCSRA |= (1 &amp;lt;&amp;lt; ADSC);

    // Wait for conversion to finish (ADSC bit returns to 0)
    while (ADCSRA &amp;amp; (1 &amp;lt;&amp;lt; ADSC));

    // Return the 10-bit result (ADCL + ADCH)
    return ADC;
}

int main(void) {
    // Set PB0 as an output (for an LED)
    DDRB |= (1 &amp;lt;&amp;lt; DDB0);
    
    adc_setup();

    while (1) {
        uint16_t val = adc_read();

        // If input &amp;gt; ~2.5V (assuming 5V VCC, 512 is half of 1024)
        if (val &amp;gt; 512) {
            PORTB |= (1 &amp;lt;&amp;lt; PB0);  // LED ON
        } else {
            PORTB &amp;amp;= ~(1 &amp;lt;&amp;lt; PB0); // LED OFF
        }
        
        _delay_ms(50);
    }
}
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;&lt;div&gt;&lt;p data-path-to-node=&quot;0&quot;&gt;This code is a classic &quot;Threshold Switch.&quot; It translates an analog voltage into a digital action (turning an LED on or off). Because the ATtiny45 and ATtiny13 share very similar register structures for the ADC, this specific code works almost identically on both.&lt;/p&gt;&lt;p data-path-to-node=&quot;1&quot;&gt;Here is the breakdown of what each section is doing:&lt;/p&gt;&lt;h3 data-path-to-node=&quot;2&quot;&gt;1. The Configuration (&lt;code data-index-in-node=&quot;22&quot; data-path-to-node=&quot;2&quot;&gt;adc_setup&lt;/code&gt;)&lt;/h3&gt;&lt;p data-path-to-node=&quot;3&quot;&gt;This function wakes up the ADC and tells it how to behave.&lt;/p&gt;&lt;ul data-path-to-node=&quot;4&quot;&gt;&lt;li&gt;&lt;p data-path-to-node=&quot;4,0,0&quot;&gt;&lt;b data-index-in-node=&quot;0&quot; data-path-to-node=&quot;4,0,0&quot;&gt;&lt;code data-index-in-node=&quot;0&quot; data-path-to-node=&quot;4,0,0&quot;&gt;ADMUX |= (1 &amp;lt;&amp;lt; MUX1);&lt;/code&gt;&lt;/b&gt;
The &lt;b data-index-in-node=&quot;26&quot; data-path-to-node=&quot;4,0,0&quot;&gt;ADMUX&lt;/b&gt; register (ADC Multiplexer Selection) acts like a rotary switch. Setting &lt;code data-index-in-node=&quot;104&quot; data-path-to-node=&quot;4,0,0&quot;&gt;MUX1&lt;/code&gt; to &lt;code data-index-in-node=&quot;112&quot; data-path-to-node=&quot;4,0,0&quot;&gt;1&lt;/code&gt; connects the ADC hardware to &lt;b data-index-in-node=&quot;143&quot; data-path-to-node=&quot;4,0,0&quot;&gt;PB4 (Pin 3)&lt;/b&gt;.
&lt;i data-index-in-node=&quot;156&quot; data-path-to-node=&quot;4,0,0&quot;&gt;Note: By leaving the &lt;code data-index-in-node=&quot;177&quot; data-path-to-node=&quot;4,0,0&quot;&gt;REFS&lt;/code&gt; bits at &lt;code data-index-in-node=&quot;190&quot; data-path-to-node=&quot;4,0,0&quot;&gt;0&lt;/code&gt;, you are telling the chip to use &lt;b data-index-in-node=&quot;225&quot; data-path-to-node=&quot;4,0,0&quot;&gt;VCC&lt;/b&gt; as the &quot;yardstick&quot; for measurement.&lt;/i&gt;&lt;/p&gt;&lt;/li&gt;&lt;li&gt;&lt;p data-path-to-node=&quot;4,1,0&quot;&gt;&lt;b data-index-in-node=&quot;0&quot; data-path-to-node=&quot;4,1,0&quot;&gt;&lt;code data-index-in-node=&quot;0&quot; data-path-to-node=&quot;4,1,0&quot;&gt;ADCSRA |= (1 &amp;lt;&amp;lt; ADPS2) | (1 &amp;lt;&amp;lt; ADPS1) | (1 &amp;lt;&amp;lt; ADPS0);&lt;/code&gt;&lt;/b&gt;
The ADC needs a clock speed between &lt;b data-index-in-node=&quot;90&quot; data-path-to-node=&quot;4,1,0&quot;&gt;50kHz and 200kHz&lt;/b&gt; to be accurate.&lt;/p&gt;&lt;ul data-path-to-node=&quot;4,1,1&quot;&gt;&lt;li&gt;&lt;p data-path-to-node=&quot;4,1,1,0,0&quot;&gt;&lt;b data-index-in-node=&quot;0&quot; data-path-to-node=&quot;4,1,1,0,0&quot;&gt;ADPS (Prescaler bits):&lt;/b&gt; Setting all three to &lt;code data-index-in-node=&quot;44&quot; data-path-to-node=&quot;4,1,1,0,0&quot;&gt;1&lt;/code&gt; creates a division factor of &lt;b data-index-in-node=&quot;75&quot; data-path-to-node=&quot;4,1,1,0,0&quot;&gt;128&lt;/b&gt;.&lt;/p&gt;&lt;/li&gt;&lt;li&gt;&lt;p data-path-to-node=&quot;4,1,1,1,0&quot;&gt;If your chip is at 9.6MHz, the ADC runs at &lt;b data-index-in-node=&quot;43&quot; data-path-to-node=&quot;4,1,1,1,0&quot;&gt;75kHz&lt;/b&gt;.&lt;/p&gt;&lt;/li&gt;&lt;li&gt;&lt;p data-path-to-node=&quot;4,1,1,2,0&quot;&gt;If your chip is at 1.2MHz, the ADC runs at &lt;b data-index-in-node=&quot;43&quot; data-path-to-node=&quot;4,1,1,2,0&quot;&gt;9.3kHz&lt;/b&gt; (which is actually a bit slow for the ATtiny45, but it will still function).&lt;/p&gt;&lt;/li&gt;&lt;/ul&gt;&lt;/li&gt;&lt;li&gt;&lt;p data-path-to-node=&quot;4,2,0&quot;&gt;&lt;b data-index-in-node=&quot;0&quot; data-path-to-node=&quot;4,2,0&quot;&gt;&lt;code data-index-in-node=&quot;0&quot; data-path-to-node=&quot;4,2,0&quot;&gt;ADCSRA |= (1 &amp;lt;&amp;lt; ADEN);&lt;/code&gt;&lt;/b&gt;
This is the &quot;Power Button&quot; for the ADC. Without setting the &lt;b data-index-in-node=&quot;83&quot; data-path-to-node=&quot;4,2,0&quot;&gt;ADC Enable&lt;/b&gt; bit, the converter stays off to save power.&lt;/p&gt;&lt;/li&gt;&lt;/ul&gt;&lt;hr data-path-to-node=&quot;5&quot; /&gt;&lt;h3 data-path-to-node=&quot;6&quot;&gt;2. The Measurement (&lt;code data-index-in-node=&quot;20&quot; data-path-to-node=&quot;6&quot;&gt;adc_read&lt;/code&gt;)&lt;/h3&gt;&lt;p data-path-to-node=&quot;7&quot;&gt;This function handles the &quot;Sample and Hold&quot; process.&lt;/p&gt;&lt;ul data-path-to-node=&quot;8&quot;&gt;&lt;li&gt;&lt;p data-path-to-node=&quot;8,0,0&quot;&gt;&lt;b data-index-in-node=&quot;0&quot; data-path-to-node=&quot;8,0,0&quot;&gt;&lt;code data-index-in-node=&quot;0&quot; data-path-to-node=&quot;8,0,0&quot;&gt;ADCSRA |= (1 &amp;lt;&amp;lt; ADSC);&lt;/code&gt;&lt;/b&gt;
The &lt;b data-index-in-node=&quot;27&quot; data-path-to-node=&quot;8,0,0&quot;&gt;Start Conversion&lt;/b&gt; bit tells the ADC to take a &quot;snapshot&quot; of the voltage on the pin right now.&lt;/p&gt;&lt;/li&gt;&lt;li&gt;&lt;p data-path-to-node=&quot;8,1,0&quot;&gt;&lt;b data-index-in-node=&quot;0&quot; data-path-to-node=&quot;8,1,0&quot;&gt;&lt;code data-index-in-node=&quot;0&quot; data-path-to-node=&quot;8,1,0&quot;&gt;while (ADCSRA &amp;amp; (1 &amp;lt;&amp;lt; ADSC));&lt;/code&gt;&lt;/b&gt;
This is a &quot;blocking&quot; loop. The &lt;code data-index-in-node=&quot;61&quot; data-path-to-node=&quot;8,1,0&quot;&gt;ADSC&lt;/code&gt; bit stays &lt;code data-index-in-node=&quot;76&quot; data-path-to-node=&quot;8,1,0&quot;&gt;1&lt;/code&gt; as long as the chip is busy calculating. As soon as it finishes, the hardware flips the bit back to &lt;code data-index-in-node=&quot;178&quot; data-path-to-node=&quot;8,1,0&quot;&gt;0&lt;/code&gt; and the code moves on.&lt;/p&gt;&lt;/li&gt;&lt;li&gt;&lt;p data-path-to-node=&quot;8,2,0&quot;&gt;&lt;b data-index-in-node=&quot;0&quot; data-path-to-node=&quot;8,2,0&quot;&gt;&lt;code data-index-in-node=&quot;0&quot; data-path-to-node=&quot;8,2,0&quot;&gt;return ADC;&lt;/code&gt;&lt;/b&gt;
This returns a 10-bit number (&lt;b data-index-in-node=&quot;42&quot; data-path-to-node=&quot;8,2,0&quot;&gt;0 to 1023&lt;/b&gt;). Even though the result is split into two 8-bit registers (&lt;code data-index-in-node=&quot;112&quot; data-path-to-node=&quot;8,2,0&quot;&gt;ADCL&lt;/code&gt; and &lt;code data-index-in-node=&quot;121&quot; data-path-to-node=&quot;8,2,0&quot;&gt;ADCH&lt;/code&gt;), the compiler allows you to just read &lt;code data-index-in-node=&quot;165&quot; data-path-to-node=&quot;8,2,0&quot;&gt;ADC&lt;/code&gt; to get the full 10-bit value at once.&lt;/p&gt;&lt;/li&gt;&lt;/ul&gt;&lt;hr data-path-to-node=&quot;9&quot; /&gt;&lt;h3 data-path-to-node=&quot;10&quot;&gt;3. The Logic (&lt;code data-index-in-node=&quot;14&quot; data-path-to-node=&quot;10&quot;&gt;main&lt;/code&gt;)&lt;/h3&gt;&lt;ul data-path-to-node=&quot;11&quot;&gt;&lt;li&gt;&lt;p data-path-to-node=&quot;11,0,0&quot;&gt;&lt;b data-index-in-node=&quot;0&quot; data-path-to-node=&quot;11,0,0&quot;&gt;&lt;code data-index-in-node=&quot;0&quot; data-path-to-node=&quot;11,0,0&quot;&gt;DDRB |= (1 &amp;lt;&amp;lt; DDB0);&lt;/code&gt;&lt;/b&gt;
Configures &lt;b data-index-in-node=&quot;32&quot; data-path-to-node=&quot;11,0,0&quot;&gt;PB0 (Pin 5)&lt;/b&gt; as an &lt;b data-index-in-node=&quot;50&quot; data-path-to-node=&quot;11,0,0&quot;&gt;Output&lt;/b&gt; so it can drive the LED.&lt;/p&gt;&lt;/li&gt;&lt;li&gt;&lt;p data-path-to-node=&quot;11,1,0&quot;&gt;&lt;b data-index-in-node=&quot;0&quot; data-path-to-node=&quot;11,1,0&quot;&gt;&lt;code data-index-in-node=&quot;0&quot; data-path-to-node=&quot;11,1,0&quot;&gt;if (val &amp;gt; 512)&lt;/code&gt;&lt;/b&gt;
Since the maximum value is 1023, &lt;b data-index-in-node=&quot;48&quot; data-path-to-node=&quot;11,1,0&quot;&gt;512&lt;/b&gt; is the halfway point.&lt;/p&gt;&lt;ul data-path-to-node=&quot;11,1,1&quot;&gt;&lt;li&gt;&lt;p data-path-to-node=&quot;11,1,1,0,0&quot;&gt;If the pin sees more than half of the supply voltage (&lt;b data-index-in-node=&quot;54&quot; data-path-to-node=&quot;11,1,1,0,0&quot;&gt;&amp;gt; 2.5V&lt;/b&gt; on a 5V system), the LED turns on.&lt;/p&gt;&lt;/li&gt;&lt;li&gt;&lt;p data-path-to-node=&quot;11,1,1,1,0&quot;&gt;If it sees less, the LED turns off.&lt;/p&gt;&lt;/li&gt;&lt;/ul&gt;&lt;/li&gt;&lt;li&gt;&lt;p data-path-to-node=&quot;11,2,0&quot;&gt;&lt;b data-index-in-node=&quot;0&quot; data-path-to-node=&quot;11,2,0&quot;&gt;&lt;code data-index-in-node=&quot;0&quot; data-path-to-node=&quot;11,2,0&quot;&gt;_delay_ms(50);&lt;/code&gt;&lt;/b&gt;
This prevents the chip from running at full speed, which saves power and reduces &quot;jitter&quot; if the voltage is hovering right at 2.5V.&lt;/p&gt;&lt;/li&gt;&lt;/ul&gt;I like to add that while this code works, the &lt;b data-index-in-node=&quot;27&quot; data-path-to-node=&quot;13&quot;&gt;ATtiny45&lt;/b&gt; has a feature the ATtiny13 lacks: &lt;b data-index-in-node=&quot;70&quot; data-path-to-node=&quot;13&quot;&gt;Internal Voltage References.&lt;/b&gt; If your battery voltage drops, your &quot;2.5V threshold&quot; will actually shift because the reference (VCC) is changing. On the ATtiny45, you could change &lt;code data-index-in-node=&quot;247&quot; data-path-to-node=&quot;13&quot;&gt;ADMUX&lt;/code&gt; to use the &lt;b data-index-in-node=&quot;264&quot; data-path-to-node=&quot;13&quot;&gt;Internal 1.1V or 2.56V reference&lt;/b&gt;, which stays steady even if your power supply fluctuates.&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;The following is how to create and simulate the circuit.&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;&lt;iframe allowfullscreen=&quot;&quot; class=&quot;BLOG_video_class&quot; height=&quot;395&quot; src=&quot;https://www.youtube.com/embed/vgUfMEN9MQ0&quot; width=&quot;476&quot; youtube-src-id=&quot;vgUfMEN9MQ0&quot;&gt;&lt;/iframe&gt;&lt;/div&gt;&lt;br /&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;&lt;b&gt;Related&lt;/b&gt;&lt;/div&gt;&lt;div&gt;&lt;ul style=&quot;text-align: left;&quot;&gt;&lt;li&gt;&lt;a href=&quot;https://www.ee-diary.net/2026/04/how-to-expand-attiny13-outputs-with.html&quot;&gt;How to Expand ATtiny13 Outputs with 74HC595 Shift Register&lt;/a&gt;&lt;/li&gt;&lt;li&gt;&lt;a href=&quot;https://www.ee-diary.net/2026/04/attiny13-led-blink-simulation-in-proteus.html&quot;&gt;ATtiny13 LED Blink Simulation in Proteus&lt;/a&gt;&lt;/li&gt;&lt;/ul&gt;&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;/div&gt;





</content><link rel='replies' type='application/atom+xml' href='http://www.ee-diary.net/feeds/5384466559808430256/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.ee-diary.net/2026/04/testing-attiny45-adc-functionality-in.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7437986969318338216/posts/default/5384466559808430256'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7437986969318338216/posts/default/5384466559808430256'/><link rel='alternate' type='text/html' href='http://www.ee-diary.net/2026/04/testing-attiny45-adc-functionality-in.html' title='Testing Attiny45 ADC functionality in Proteus'/><author><name>Unknown</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhXj2G8j4cSaQ_rt74-u_iCTABnrbmNSssB9kvxLJl7wxGeRZlgmLMDwH6VtA1_yUEPAtyabDRqMMARGayFJfl2atdLGIaEkW4wokQsFPPaYgIRHiLPiTsNNI7m9CcXo2g_TakiCz9TnhWroe5wknTGXQBcINkFBeofQjYRGRF9smK85JkiAzFSm7JfNN7g/s72-c/Attiny45%20ADC%20pins.png" height="72" width="72"/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-7437986969318338216.post-8974758038590866286</id><published>2026-04-06T21:04:00.005+05:45</published><updated>2026-04-07T19:19:54.290+05:45</updated><category scheme="http://www.blogger.com/atom/ns#" term="buck converter"/><category scheme="http://www.blogger.com/atom/ns#" term="troubleshooting"/><category scheme="http://www.blogger.com/atom/ns#" term="ubiquiti"/><category scheme="http://www.blogger.com/atom/ns#" term="Voltage Regulator"/><category scheme="http://www.blogger.com/atom/ns#" term="WISP"/><title type='text'>Ubiquiti Radio Hardware Repair: A Comprehensive Service Guide</title><content type='html'>&lt;div class=&quot;separator&quot; style=&quot;display: none;&quot;&gt;&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiH9FlD-nj5UwcewnWsnQgJHdx5Aa9RAkaAaYNCFZEmKSIqaV1oVhhyphenhyphenoJzzlnhwKBwI0XmXELchdcHNv88D-sJy3rZfs1jJUy8M5afMtm_wjTi9Rr42vGFu4FH9W7HZRt-nFh1pupCqE-17ubEQGPbG48T_fU72_q6wEKZ4B7p_lfKsRIY2Z-0P2YiVe-hT/s1600/Gemini_Generated_Image_an982aan982aan98%20%281%29.png&quot; style=&quot;display: block; padding: 1em 0px; text-align: center;&quot;&gt;&lt;img alt=&quot;Ubiquiti Radio Hardware Repair&quot; border=&quot;0&quot; data-original-height=&quot;768&quot; data-original-width=&quot;1376&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiH9FlD-nj5UwcewnWsnQgJHdx5Aa9RAkaAaYNCFZEmKSIqaV1oVhhyphenhyphenoJzzlnhwKBwI0XmXELchdcHNv88D-sJy3rZfs1jJUy8M5afMtm_wjTi9Rr42vGFu4FH9W7HZRt-nFh1pupCqE-17ubEQGPbG48T_fU72_q6wEKZ4B7p_lfKsRIY2Z-0P2YiVe-hT/s1600/Gemini_Generated_Image_an982aan982aan98%20%281%29.png&quot; /&gt;&lt;/a&gt;&lt;/div&gt;
&lt;p&gt;&amp;nbsp;In my earlier Ubiquiti radio antenna repair note &lt;a href=&quot;https://www.ee-diary.net/2025/06/repairing-ubiquiti-lite-ap-120.html&quot;&gt;repairing Ubiquiti Lite AP 120&lt;/a&gt; I said that I checked the various components on the PCB board. I checked the voltage regulator IC, the capacitors and inductors for any short circuit. I also posted &lt;a href=&quot;https://youtu.be/Pgh58A96pL8&quot;&gt;Ubiquiti Lite AP 120 repair video&lt;/a&gt; on YouTube, but that video only showed how I checked the various components on the PCB board. There was comment asking where the actual repair was. I did not have time to upload and write about it but today I wanted to share how I repaired it.&lt;/p&gt;&lt;p&gt;After I checked, I found that one of the capacitors was short circuit. So, I knew it is something there.&lt;/p&gt;&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhr0mcT5lXbwqYuFJtcbJSEki8QT_Z28zwYGFHQT90Hm6UxN9-UXbsHc1g-vqeMEdGstZIcjw9etI11Se2VkQutMIYldSYDov5ag8Y4V-AeWa8bD7P_LWCk829PXfDGGNrQQ3IA8QlxjNYE669h4PUV5B5xg9OHNMqCrytViBWmZsDNIp-LgpqmcXSbLzyj/s817/short%20circuited%20capacitor.png&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img alt=&quot;LAP120 repair- short circuited capacitor &amp;amp; buck converter IC&quot; border=&quot;0&quot; data-original-height=&quot;618&quot; data-original-width=&quot;817&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhr0mcT5lXbwqYuFJtcbJSEki8QT_Z28zwYGFHQT90Hm6UxN9-UXbsHc1g-vqeMEdGstZIcjw9etI11Se2VkQutMIYldSYDov5ag8Y4V-AeWa8bD7P_LWCk829PXfDGGNrQQ3IA8QlxjNYE669h4PUV5B5xg9OHNMqCrytViBWmZsDNIp-LgpqmcXSbLzyj/s16000/short%20circuited%20capacitor.png&quot; title=&quot;LAP120 repair- short circuited capacitor &amp;amp; buck converter IC&quot; /&gt;&lt;/a&gt;&lt;/div&gt;&lt;p&gt;But closer check of the capacitor alone it was reading fine. Then I realized that one of the IC connected to that short-circuited capacitor might be actual fault component. At first, I did not know what kind of IC that was or what the function of that IC was. I also did not know the name of the IC otherwise I would have checked online. One thing I learned is that checking the capacitor for short-circuit tells that the IC to which it is connected to or rather is part of the IC supporting component&lt;/p&gt;&lt;p&gt;However, I managed to find out what that IC was. It was a voltage regulator, more specifically a buck converter. Once I was sure it was a buck converter IC I searched for suitable replacement. After researching for a while I concluded that I could use the MP1548 buck converter IC.&lt;/p&gt;&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgkNZ9PuvSYdzb-Zn385W_O3qsLNoN-tDNKeP4uyihjhzRyVCtllsqY05bGADBXXYYP-GpY9nlIN5oGgPwgYi0E2mbfnAuORgTaQjrcHpmFBDIruNh_JlKRipYtMKxgIdFJScd6CgkUYqUiq85yybz1r045xU3zwKDBT5BDBZiIACfKd2FZc0tgn0vSO-m2/s179/MP1584%20IC.png&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img alt=&quot;MP1584 IC&quot; border=&quot;0&quot; data-original-height=&quot;179&quot; data-original-width=&quot;165&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgkNZ9PuvSYdzb-Zn385W_O3qsLNoN-tDNKeP4uyihjhzRyVCtllsqY05bGADBXXYYP-GpY9nlIN5oGgPwgYi0E2mbfnAuORgTaQjrcHpmFBDIruNh_JlKRipYtMKxgIdFJScd6CgkUYqUiq85yybz1r045xU3zwKDBT5BDBZiIACfKd2FZc0tgn0vSO-m2/s16000/MP1584%20IC.png&quot; title=&quot;MP1584 IC&quot; /&gt;&lt;/a&gt;&lt;/div&gt;&lt;p&gt;Although I found it, it was difficult to find the IC to buy where I live. So, thinking for a while, I searched for the IC that comes in module. The solution was to use the MP1584 DC to DC Buck Converter module.&lt;/p&gt;&lt;p&gt;&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjlF0ab28Q8vlTmTKUqMBJqDwAJgMtE1A8iJTaVCWEAtJB8JmFf_WdEMoM1Ay9fMRyztSieiL0j0858pY2Of2NECEp1SlZdFKXK6t1ymdcyHkm-n6msSSmEfpreKwPJt0IfQsV1ijuPtwtSt1MWbyQIumXdvLyrucaLB6sxEpMHVZT6i0npDpn4ynDZ1IRr/s300/MP1584%20buck%20converter%202.png&quot; style=&quot;margin-left: 1em; margin-right: 1em; text-align: center;&quot;&gt;&lt;img alt=&quot;MP1584 buck converter IC&quot; border=&quot;0&quot; data-original-height=&quot;263&quot; data-original-width=&quot;300&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjlF0ab28Q8vlTmTKUqMBJqDwAJgMtE1A8iJTaVCWEAtJB8JmFf_WdEMoM1Ay9fMRyztSieiL0j0858pY2Of2NECEp1SlZdFKXK6t1ymdcyHkm-n6msSSmEfpreKwPJt0IfQsV1ijuPtwtSt1MWbyQIumXdvLyrucaLB6sxEpMHVZT6i0npDpn4ynDZ1IRr/s16000/MP1584%20buck%20converter%202.png&quot; title=&quot;MP1584 buck converter IC&quot; /&gt;&lt;/a&gt;&lt;/p&gt;&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjtBLEcHu0aV9PwHZZ86v8-5LltA6Xgnzl5M7yTGdQYp95nHLz9KQPC4F6oWs2I-yYr2oR8NWUz3GsteNtXZid-BQ925-rYnPuz4E7iS9iKqln2OhYbhKWk3HlG_yoZCCIdipDF-2q7VglqenqDdPaQ1hC4QygvXZQ11Ke0BpwKowOi_C62r9GKapqTpEC-/s812/MP1584%20buck%20converter%20module%20-%20LAP120%20repair.png&quot; style=&quot;margin-left: 1em; margin-right: 1em; text-align: center;&quot;&gt;&lt;img alt=&quot;MP1584 buck converter module&quot; border=&quot;0&quot; data-original-height=&quot;618&quot; data-original-width=&quot;812&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjtBLEcHu0aV9PwHZZ86v8-5LltA6Xgnzl5M7yTGdQYp95nHLz9KQPC4F6oWs2I-yYr2oR8NWUz3GsteNtXZid-BQ925-rYnPuz4E7iS9iKqln2OhYbhKWk3HlG_yoZCCIdipDF-2q7VglqenqDdPaQ1hC4QygvXZQ11Ke0BpwKowOi_C62r9GKapqTpEC-/s16000/MP1584%20buck%20converter%20module%20-%20LAP120%20repair.png&quot; title=&quot;MP1584 buck converter module&quot; /&gt;&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;Then I had to figure out how to connect and what is the input and output which was easy because of the internet. I used the &lt;a href=&quot;https://www.icexplorer.online/2026/04/mp1584.html&quot;&gt;&lt;b&gt;MP1584 IC pinout explorer&lt;/b&gt;&lt;/a&gt; to get to know the IC. This free interactive IC explorer makes easy to learn about any IC rather than reading large complex datasheet. There were only the input and output which I had to consider.&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjuganO5CNa1ZPiv3ACx9FbwVp4bSNhx-6DZjpPvL9B582j6k0QKjvlks7-KDoFXLCdIe4s7yvkCNmmjXc2sKDZSE_1y9Y82c3FNqjHCLfjEjEDGiNG8511VEoK1aSKwf2-nY2XQ5dE2KaUMVnxJsxQyvutsTd8TXdcN81agkLaBejLmbSRCGHo2JdNRiGB/s621/MP1584%20buck%20converter.png&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img border=&quot;0&quot; data-original-height=&quot;422&quot; data-original-width=&quot;621&quot; height=&quot;217&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjuganO5CNa1ZPiv3ACx9FbwVp4bSNhx-6DZjpPvL9B582j6k0QKjvlks7-KDoFXLCdIe4s7yvkCNmmjXc2sKDZSE_1y9Y82c3FNqjHCLfjEjEDGiNG8511VEoK1aSKwf2-nY2XQ5dE2KaUMVnxJsxQyvutsTd8TXdcN81agkLaBejLmbSRCGHo2JdNRiGB/s320/MP1584%20buck%20converter.png&quot; width=&quot;320&quot; /&gt;&lt;/a&gt;&lt;/div&gt;&lt;div&gt;Here are some useful details about it.&lt;/div&gt;&lt;div&gt;&lt;p&gt;&lt;b&gt;🔧 MP1584EN DC-DC Buck Converter Module Overview&lt;/b&gt;&lt;/p&gt;&lt;ul&gt;&lt;li&gt;&lt;p&gt;&lt;span style=&quot;white-space-collapse: preserve;&quot;&gt;&lt;strong&gt;Input Voltage Range&lt;/strong&gt;: 4.5V to 28V DC&lt;/span&gt;&lt;/p&gt;&lt;/li&gt;&lt;li&gt;&lt;p&gt;&lt;span style=&quot;white-space-collapse: preserve;&quot;&gt;&lt;strong&gt;Output Voltage Range&lt;/strong&gt;: Adjustable from 0.8V to 20V DC&lt;/span&gt;&lt;/p&gt;&lt;/li&gt;&lt;li&gt;&lt;p&gt;&lt;span style=&quot;white-space-collapse: preserve;&quot;&gt;&lt;strong&gt;Key Components&lt;/strong&gt;:&lt;/span&gt;&lt;/p&gt;&lt;ul&gt;&lt;li&gt;&lt;p&gt;&lt;span style=&quot;white-space-collapse: preserve;&quot;&gt;&lt;strong&gt;MP1584EN Buck IC&lt;/strong&gt;: Core switching regulator for voltage step-down&lt;/span&gt;&lt;/p&gt;&lt;/li&gt;&lt;li&gt;&lt;p&gt;&lt;span style=&quot;white-space-collapse: preserve;&quot;&gt;&lt;strong&gt;SS34 Diode&lt;/strong&gt;: Provides overload current protection&lt;/span&gt;&lt;/p&gt;&lt;/li&gt;&lt;li&gt;&lt;p&gt;&lt;span style=&quot;white-space-collapse: preserve;&quot;&gt;&lt;strong&gt;Potentiometer&lt;/strong&gt;: Allows manual adjustment of output voltage&lt;/span&gt;&lt;/p&gt;&lt;/li&gt;&lt;/ul&gt;&lt;/li&gt;&lt;/ul&gt;&lt;div&gt;&lt;b&gt;⚡ Pin Co&lt;/b&gt;&lt;b&gt;nfiguration&lt;/b&gt;&lt;/div&gt;&lt;div&gt;&lt;div&gt;&lt;div aria-label=&quot;Scrollable table&quot; role=&quot;region&quot; tabindex=&quot;0&quot;&gt;&lt;table&gt;&lt;thead&gt;&lt;tr&gt;&lt;th&gt;Pin Label&lt;/th&gt;&lt;th&gt;Function&lt;/th&gt;&lt;/tr&gt;&lt;/thead&gt;&lt;tbody&gt;&lt;tr&gt;&lt;td&gt;INPUT +&lt;/td&gt;&lt;td&gt;Positive DC input (4.5V–28V)&lt;/td&gt;&lt;/tr&gt;&lt;tr&gt;&lt;td&gt;INPUT –&lt;/td&gt;&lt;td&gt;Negative DC input (ground)&lt;/td&gt;&lt;/tr&gt;&lt;tr&gt;&lt;td&gt;OUTPUT +&lt;/td&gt;&lt;td&gt;Positive DC output (0.8V–20V)&lt;/td&gt;&lt;/tr&gt;&lt;tr&gt;&lt;td&gt;OUTPUT –&lt;/td&gt;&lt;td&gt;Negative DC output (ground)&lt;/td&gt;&lt;/tr&gt;&lt;/tbody&gt;&lt;/table&gt;&lt;/div&gt;&lt;/div&gt;&lt;div&gt;&lt;/div&gt;&lt;/div&gt;&lt;p&gt;&lt;span style=&quot;white-space-collapse: preserve;&quot;&gt;This module is ideal for powering lower-voltage devices from a higher-voltage source, commonly used in DIY electronics and embedded systems. &lt;/span&gt;&lt;/p&gt;&lt;/div&gt;After figuring these out, I desoldered the damaged voltage regulator IC from the Ubiquiti radio PCB board and soldered the MP1584 voltage regulator. After a bit of researching, I found out that the input terminal of the MP1548 buck converter should be connected to Vin (input pin) or the 7th pin of the desoldered IC. The output terminal of the MP1584 should be connected to the SMD capacitor terminal. This is as shown in the picture below.&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiimuN1KPyFgteTWFEtGfgsxc4Iuykq09SMSgd6sS4aCVLLM-7W3J9sT1garkg2CVhejCy-8g9NrT1K1cP-tUxV7kKSjxjvdRALG6Vru1WuuZUqtKh9EOsw1Bc44e5GJE9VGDbQPzHnL95h-SJmxZJi1_MafVo5-FMYpj6Zhm9Wxvjq6kvQOgK9mU8enEx3/s1366/IC%20repaired.png&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img alt=&quot;repairing ubiquiti radio&quot; border=&quot;0&quot; data-original-height=&quot;618&quot; data-original-width=&quot;1366&quot; height=&quot;290&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiimuN1KPyFgteTWFEtGfgsxc4Iuykq09SMSgd6sS4aCVLLM-7W3J9sT1garkg2CVhejCy-8g9NrT1K1cP-tUxV7kKSjxjvdRALG6Vru1WuuZUqtKh9EOsw1Bc44e5GJE9VGDbQPzHnL95h-SJmxZJi1_MafVo5-FMYpj6Zhm9Wxvjq6kvQOgK9mU8enEx3/w640-h290/IC%20repaired.png&quot; title=&quot;repairing ubiquiti radio&quot; width=&quot;640&quot; /&gt;&lt;/a&gt;&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;The -ve terminals of the input and output of the MP1584, the black wires should be connected to the common ground as shown below.&lt;/div&gt;&lt;br /&gt;&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhSKLZY24kHfRDFv_YmJsH2EjLbygCKmkmq2vfLgheeumkepSRMhm7hovCXnLrwL0MkYKcDiDGydUAK0-Uz-JlIWsMiWbPm1vjnczBJimC3Om6ogyAT3M1e2eC6CciRtTB8ycxazgN_92UB-Gk3VSxyhIcg57UegnXxk2B57NKP35ix9nitECPVtnzSrshu/s817/LAP120%20buck%20converter%20module.png&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img alt=&quot;repairing ubiquiti radio&quot; border=&quot;0&quot; data-original-height=&quot;618&quot; data-original-width=&quot;817&quot; height=&quot;484&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhSKLZY24kHfRDFv_YmJsH2EjLbygCKmkmq2vfLgheeumkepSRMhm7hovCXnLrwL0MkYKcDiDGydUAK0-Uz-JlIWsMiWbPm1vjnczBJimC3Om6ogyAT3M1e2eC6CciRtTB8ycxazgN_92UB-Gk3VSxyhIcg57UegnXxk2B57NKP35ix9nitECPVtnzSrshu/w640-h484/LAP120%20buck%20converter%20module.png&quot; title=&quot;repairing ubiquiti radio&quot; width=&quot;640&quot; /&gt;&lt;/a&gt;&lt;/div&gt;&lt;br /&gt;&lt;div&gt;For comparison purpose, I am showing below both the repaired and working condition Ubiquiti LAP120 radio PCB board.&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEi3-2E0qKBr6STnAYEMraxCl5u3LPLTVdEvWOL2Q4WSULoAyEiG_R3U2hrykxOW8KrphY52MNW0KZl1bkk7ynRE9VLn5d8YuZ3_Ymfk9RUB_MROU9Y6yaRykJjjx-ASFfcNlAeuNNRBSAYrlEnakufRcBQDspAsecGRE7Q8EHYppH-zqiB8X9sgDfBbTwBs/s816/LAP120%20reparied%20with%20buck%20converter%20module.png&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img alt=&quot;LAP120 reparied with buck converter module&quot; border=&quot;0&quot; data-original-height=&quot;618&quot; data-original-width=&quot;816&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEi3-2E0qKBr6STnAYEMraxCl5u3LPLTVdEvWOL2Q4WSULoAyEiG_R3U2hrykxOW8KrphY52MNW0KZl1bkk7ynRE9VLn5d8YuZ3_Ymfk9RUB_MROU9Y6yaRykJjjx-ASFfcNlAeuNNRBSAYrlEnakufRcBQDspAsecGRE7Q8EHYppH-zqiB8X9sgDfBbTwBs/s16000/LAP120%20reparied%20with%20buck%20converter%20module.png&quot; title=&quot;LAP120 reparied with buck converter module&quot; /&gt;&lt;/a&gt;&lt;/div&gt;&lt;br /&gt;&lt;div&gt;After that I checked it and it was working.&amp;nbsp;&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;So, in this way I checked for the Ubiquiti radio faulty component and replaced the voltage regulator/buck converter and successfully repaired it. This guide is not only applicable to Ubiquiti LAP 120 radio hardware but should be applicable to any Ubiquiti radio and most likely other radio and equipment.&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;Watch the complete &lt;b&gt;Ubiquiti radio hardware repair video&lt;/b&gt;.&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;&lt;iframe allowfullscreen=&quot;&quot; class=&quot;BLOG_video_class&quot; height=&quot;372&quot; src=&quot;https://www.youtube.com/embed/E2vnHbZHrpw&quot; width=&quot;448&quot; youtube-src-id=&quot;E2vnHbZHrpw&quot;&gt;&lt;/iframe&gt;&lt;/div&gt;&lt;br /&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;I hope this repair guide will help you and if you have any problem, please leave your comment or contact me via the contact page.&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://www.ee-diary.net/feeds/8974758038590866286/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.ee-diary.net/2026/04/ubiquiti-radio-hardware-repair.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7437986969318338216/posts/default/8974758038590866286'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7437986969318338216/posts/default/8974758038590866286'/><link rel='alternate' type='text/html' href='http://www.ee-diary.net/2026/04/ubiquiti-radio-hardware-repair.html' title='Ubiquiti Radio Hardware Repair: A Comprehensive Service Guide'/><author><name>Unknown</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiH9FlD-nj5UwcewnWsnQgJHdx5Aa9RAkaAaYNCFZEmKSIqaV1oVhhyphenhyphenoJzzlnhwKBwI0XmXELchdcHNv88D-sJy3rZfs1jJUy8M5afMtm_wjTi9Rr42vGFu4FH9W7HZRt-nFh1pupCqE-17ubEQGPbG48T_fU72_q6wEKZ4B7p_lfKsRIY2Z-0P2YiVe-hT/s72-c/Gemini_Generated_Image_an982aan982aan98%20%281%29.png" height="72" width="72"/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-7437986969318338216.post-1223204663406070487</id><published>2026-04-06T00:04:00.004+05:45</published><updated>2026-04-06T00:04:44.612+05:45</updated><category scheme="http://www.blogger.com/atom/ns#" term="ATmega328p"/><category scheme="http://www.blogger.com/atom/ns#" term="LM393"/><title type='text'>Automated Sound-Triggered Alarm with ATmega328P External Interrupts</title><content type='html'>&lt;div class=&quot;separator&quot; style=&quot;display: none;&quot;&gt;&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiv4ZEBMVGixhIbjA2KXPVkWXmEpD68PY7vOlAWqRp2arZ_TOYHWe7t6EmRlhHM342MEdgpeZJzqC5dJHeS1Wlp0iKtg412eqvFB03pDx3CBhn-TpstuMoGrMrDzg6DJGyXyw4RQEjgcvH0GKy_7Rm8yKeebYzCV7fziA5nC_P-S1CkMbBU5wBWfuybCfo-/s1600/Gemini_Generated_Image_9lmvn29lmvn29lmv.png&quot; style=&quot;display: block; padding: 1em 0px; text-align: center;&quot;&gt;&lt;img alt=&quot;Automated Sound-Triggered Alarm with ATmega328P External Interrupts&quot; border=&quot;0&quot; data-original-height=&quot;768&quot; data-original-width=&quot;1377&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiv4ZEBMVGixhIbjA2KXPVkWXmEpD68PY7vOlAWqRp2arZ_TOYHWe7t6EmRlhHM342MEdgpeZJzqC5dJHeS1Wlp0iKtg412eqvFB03pDx3CBhn-TpstuMoGrMrDzg6DJGyXyw4RQEjgcvH0GKy_7Rm8yKeebYzCV7fziA5nC_P-S1CkMbBU5wBWfuybCfo-/s1600/Gemini_Generated_Image_9lmvn29lmvn29lmv.png&quot; /&gt;&lt;/a&gt;&lt;/div&gt;
&lt;p&gt;&lt;span style=&quot;font-family: inherit;&quot;&gt;&amp;nbsp;I built a circuit that detects sound and sound a buzzer using ATmega328P external interrupt. It can be used in application like automated library noise alert system for school or college. Silence is critical in libraries, and this circuit monitors ambient sound levels in real time. So, when students begin talking too loudly and noise exceed a pre-set threshold then ATmega328P interrupt is triggered instantly which actives a buzzer to provide an immediate reminder to maintain silence. This is only one of many applications that can be built around it. It can be used to monitor baby is crying or detect thief. Other applications include automated clap switch, which turns on/off a light with clap sound, in industrial factories to detect thud or bang sound indicating machinery failure or jamming conveyor belt, voice activated automated system for home, automated photo camera trigger when some sound is produced etc.&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style=&quot;font-family: inherit;&quot;&gt;The automated sound detector and triggering is enabled using ATmega328P external interrupt feature. I had written about how the &lt;a href=&quot;https://www.ee-diary.net/2023/04/programming-atmega328p-external.html&quot;&gt;external interrupt of ATmega328P&lt;/a&gt; works where I showed what external interrupt is and how to use it and how to write external interrupt program with code example. This time a real-world application example is provided with explanation of how the automated sound based triggering system using ATmega328P external interrupt works.&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style=&quot;font-family: inherit;&quot;&gt;Below is the circuit diagram.&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;/p&gt;&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjZ73zK_RcjUKQHO_mA0V_YTcyA-nXZ5CumWYXr_I9aeA1wjDxCN8hsVjNlmj8GVmSuDaaejf_rZYVWpqaCykMMasXl0eJiJUa_jsN-Evg0bZQaaGG8xhxya08gzWNfiSonoQ8BKnfH4LLH2nWfb5ejzNgnXvfixLcyo0vjdQw0c6WppRaQ3VhsF6YEubJ6/s1102/automated%20sound%20detection%20and%20triggering.png&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img alt=&quot;ATmega328P external interrupt automated sound detection and triggering&quot; border=&quot;0&quot; data-original-height=&quot;538&quot; data-original-width=&quot;1102&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjZ73zK_RcjUKQHO_mA0V_YTcyA-nXZ5CumWYXr_I9aeA1wjDxCN8hsVjNlmj8GVmSuDaaejf_rZYVWpqaCykMMasXl0eJiJUa_jsN-Evg0bZQaaGG8xhxya08gzWNfiSonoQ8BKnfH4LLH2nWfb5ejzNgnXvfixLcyo0vjdQw0c6WppRaQ3VhsF6YEubJ6/s16000/automated%20sound%20detection%20and%20triggering.png&quot; title=&quot;ATmega328P external interrupt automated sound detection and triggering&quot; /&gt;&lt;/a&gt;&lt;/div&gt;&lt;h3 style=&quot;text-align: left;&quot;&gt;&lt;b data-index-in-node=&quot;0&quot; data-path-to-node=&quot;5&quot;&gt;How the Circuit Works&lt;/b&gt;&lt;/h3&gt;&lt;p&gt;&lt;/p&gt;&lt;p data-path-to-node=&quot;6&quot;&gt;The circuit operates in three distinct stages:&lt;/p&gt;&lt;ul data-path-to-node=&quot;7&quot;&gt;&lt;li&gt;&lt;p data-path-to-node=&quot;7,0,0&quot;&gt;&lt;b data-index-in-node=&quot;0&quot; data-path-to-node=&quot;7,0,0&quot;&gt;Stage 1: Detection (The Mic &amp;amp; Comparator):&lt;/b&gt; The electret microphone converts sound waves into a tiny AC voltage. The &lt;b data-index-in-node=&quot;116&quot; data-path-to-node=&quot;7,0,0&quot;&gt;&lt;a href=&quot;https://www.ee-diary.net/2022/06/light-and-darkness-sensor-circuit-with.html&quot;&gt;LM393 comparator&lt;/a&gt;&lt;/b&gt; compares this &quot;wiggling&quot; voltage against a reference voltage set by your &lt;b data-index-in-node=&quot;206&quot; data-path-to-node=&quot;7,0,0&quot;&gt;10kΩ potentiometer&lt;/b&gt;.&lt;/p&gt;&lt;/li&gt;&lt;li&gt;&lt;p data-path-to-node=&quot;7,1,0&quot;&gt;&lt;b data-index-in-node=&quot;0&quot; data-path-to-node=&quot;7,1,0&quot;&gt;Stage 2: Logic (The ATmega328P):&lt;/b&gt; When the sound voltage crosses the threshold, the LM393 output drops &lt;b data-index-in-node=&quot;102&quot; data-path-to-node=&quot;7,1,0&quot;&gt;Low&lt;/b&gt;. This &quot;Falling Edge&quot; triggers the &lt;b data-index-in-node=&quot;140&quot; data-path-to-node=&quot;7,1,0&quot;&gt;INT1 (PD3)&lt;/b&gt; interrupt on the ATmega328P. The CPU pauses its current task and jumps to the &lt;b data-index-in-node=&quot;229&quot; data-path-to-node=&quot;7,1,0&quot;&gt;Interrupt Service Routine (ISR)&lt;/b&gt;.&lt;/p&gt;&lt;/li&gt;&lt;li&gt;&lt;p data-path-to-node=&quot;7,2,0&quot;&gt;&lt;b data-index-in-node=&quot;0&quot; data-path-to-node=&quot;7,2,0&quot;&gt;Stage 3: Output (The Transistor &amp;amp; Buzzer):&lt;/b&gt; The ISR sets &lt;b data-index-in-node=&quot;56&quot; data-path-to-node=&quot;7,2,0&quot;&gt;PC5 High&lt;/b&gt;. This sends current through the &lt;b data-index-in-node=&quot;97&quot; data-path-to-node=&quot;7,2,0&quot;&gt;1kΩ resistor&lt;/b&gt; into the base of the &lt;b data-index-in-node=&quot;131&quot; data-path-to-node=&quot;7,2,0&quot;&gt;2N3904 transistor&lt;/b&gt;. The transistor acts as a high-speed switch, connecting the buzzer to Ground and completing the circuit to make it sound.&lt;/p&gt;&lt;/li&gt;&lt;/ul&gt;&lt;p&gt;The transistor 2N3904 is critical in the circuit, because it decouples the electrical noise from the buzzer to the ground and saves the microcontroller from being damaged. Similarly, the 1k resistor connected between PC5 pin and base of the transistor is important. Without it the ATmega328p will try to push as much as it can through the base to emitter which is forward biased and this can damage the ATmega328P IC internal circuitry. Also, the output of the LM393 op-amp is open collector and therefore a 10k pullup resistor is used.&amp;nbsp;&lt;/p&gt;&lt;h3 style=&quot;text-align: left;&quot;&gt;Programming and Code&lt;/h3&gt;&lt;p&gt;The following is the program code for the automated sound detection and triggering using the ATmega328P external interrupt feature.&lt;/p&gt;
&lt;pre lang=&quot;cpp&quot;&gt;&lt;code&gt;
#ifndef F_CPU
#define F_CPU 16000000UL // Set to 1000000UL if using internal 1MHz clock
#endif

#include &amp;lt;avr/io.h&amp;gt;
#include &amp;lt;avr/interrupt.h&amp;gt;
#include &amp;lt;util/delay.h&amp;gt;

#define BUZZER PC0
#define MIC_INPUT PD3

void init_system() {
    // Set PC5 as Output for Transistor Base
    DDRC |= (1 &amp;lt;&amp;lt; BUZZER);
    
    // Set PD3 as Input (LM393 with physical 10k pull-up)
    DDRD &amp;amp;= ~(1 &amp;lt;&amp;lt; MIC_INPUT);
    
    // Configure INT1 for Falling Edge (LM393 output goes Low on sound)
    EICRA |= (1 &amp;lt;&amp;lt; ISC11);
    EICRA &amp;amp;= ~(1 &amp;lt;&amp;lt; ISC10);

    // Enable INT1
    EIMSK |= (1 &amp;lt;&amp;lt; INT1);

    sei(); // Global Interrupts Enabled
}

ISR(INT1_vect) {
    // Sound detected! 
    PORTC |= (1 &amp;lt;&amp;lt; BUZZER);  // PC5 High -&amp;gt; Transistor ON -&amp;gt; Buzzer Beeps
    _delay_ms(300);          // Duration of beep
    PORTC &amp;amp;= ~(1 &amp;lt;&amp;lt; BUZZER); // PC5 Low -&amp;gt; Transistor OFF -&amp;gt; Buzzer Quiet
}

int main(void) {
    init_system();
    while (1) {
        // Idle
    }
}
&lt;/code&gt;&lt;/pre&gt;&lt;p data-path-to-node=&quot;0&quot;&gt;This code makes use of external interrupt and is thus a&amp;nbsp;&lt;b data-index-in-node=&quot;32&quot; data-path-to-node=&quot;0&quot;&gt;event-driven program&lt;/b&gt;. What it means is that instead of the CPU constantly checking the sensor, polling, it &quot;sleeps&quot; until the hardware tells it to act.&lt;/p&gt;&lt;p data-path-to-node=&quot;1&quot;&gt;Here is what the code does:&lt;/p&gt;&lt;h4 style=&quot;text-align: left;&quot;&gt;&lt;b data-index-in-node=&quot;0&quot; data-path-to-node=&quot;2&quot;&gt;1. Configuration &amp;amp; Setup (&lt;code data-index-in-node=&quot;26&quot; data-path-to-node=&quot;2&quot;&gt;init_system&lt;/code&gt;)&lt;/b&gt;&lt;/h4&gt;&lt;ul data-path-to-node=&quot;3&quot;&gt;&lt;li&gt;&lt;p data-path-to-node=&quot;3,0,0&quot;&gt;&lt;b data-index-in-node=&quot;0&quot; data-path-to-node=&quot;3,0,0&quot;&gt;&lt;code data-index-in-node=&quot;0&quot; data-path-to-node=&quot;3,0,0&quot;&gt;F_CPU&lt;/code&gt;&lt;/b&gt;: Tells the compiler your clock speed (16MHz) so the &lt;code data-index-in-node=&quot;58&quot; data-path-to-node=&quot;3,0,0&quot;&gt;_delay_ms&lt;/code&gt; functions are accurate.&lt;/p&gt;&lt;/li&gt;&lt;li&gt;&lt;p data-path-to-node=&quot;3,1,0&quot;&gt;&lt;b data-index-in-node=&quot;0&quot; data-path-to-node=&quot;3,1,0&quot;&gt;&lt;code data-index-in-node=&quot;0&quot; data-path-to-node=&quot;3,1,0&quot;&gt;DDRC&lt;/code&gt; &amp;amp; &lt;code data-index-in-node=&quot;7&quot; data-path-to-node=&quot;3,1,0&quot;&gt;DDRD&lt;/code&gt;&lt;/b&gt;: Sets the &lt;b data-index-in-node=&quot;22&quot; data-path-to-node=&quot;3,1,0&quot;&gt;Data Direction&lt;/b&gt;. &lt;b data-index-in-node=&quot;38&quot; data-path-to-node=&quot;3,1,0&quot;&gt;PC0&lt;/b&gt; (Buzzer) is set as an &lt;b data-index-in-node=&quot;64&quot; data-path-to-node=&quot;3,1,0&quot;&gt;Output&lt;/b&gt;, and &lt;b data-index-in-node=&quot;76&quot; data-path-to-node=&quot;3,1,0&quot;&gt;PD3&lt;/b&gt; (Mic) is set as an &lt;b data-index-in-node=&quot;99&quot; data-path-to-node=&quot;3,1,0&quot;&gt;Input&lt;/b&gt;.&lt;/p&gt;&lt;/li&gt;&lt;li&gt;&lt;p data-path-to-node=&quot;3,2,0&quot;&gt;&lt;b data-index-in-node=&quot;0&quot; data-path-to-node=&quot;3,2,0&quot;&gt;&lt;code data-index-in-node=&quot;0&quot; data-path-to-node=&quot;3,2,0&quot;&gt;EICRA&lt;/code&gt; (External Interrupt Control Register A)&lt;/b&gt;: This is the &quot;trigger&quot; setting. By setting &lt;code data-index-in-node=&quot;89&quot; data-path-to-node=&quot;3,2,0&quot;&gt;ISC11&lt;/code&gt;, you configure &lt;b data-index-in-node=&quot;110&quot; data-path-to-node=&quot;3,2,0&quot;&gt;INT1&lt;/b&gt; to trigger on a &lt;b data-index-in-node=&quot;131&quot; data-path-to-node=&quot;3,2,0&quot;&gt;Falling Edge&lt;/b&gt; (when the LM393 output drops from 5V to 0V).&lt;/p&gt;&lt;/li&gt;&lt;li&gt;&lt;p data-path-to-node=&quot;3,3,0&quot;&gt;&lt;b data-index-in-node=&quot;0&quot; data-path-to-node=&quot;3,3,0&quot;&gt;&lt;code data-index-in-node=&quot;0&quot; data-path-to-node=&quot;3,3,0&quot;&gt;EIMSK&lt;/code&gt; &amp;amp; &lt;code data-index-in-node=&quot;8&quot; data-path-to-node=&quot;3,3,0&quot;&gt;sei()&lt;/code&gt;&lt;/b&gt;: These &quot;turn on the lights.&quot; &lt;code data-index-in-node=&quot;43&quot; data-path-to-node=&quot;3,3,0&quot;&gt;EIMSK&lt;/code&gt; enables the specific INT1 interrupt, and &lt;code data-index-in-node=&quot;90&quot; data-path-to-node=&quot;3,3,0&quot;&gt;sei()&lt;/code&gt; enables interrupts globally across the chip.&lt;/p&gt;&lt;/li&gt;&lt;/ul&gt;&lt;h4 style=&quot;text-align: left;&quot;&gt;&lt;b data-index-in-node=&quot;0&quot; data-path-to-node=&quot;5&quot;&gt;2. The Interrupt Service Routine (&lt;code data-index-in-node=&quot;34&quot; data-path-to-node=&quot;5&quot;&gt;ISR&lt;/code&gt;)&lt;/b&gt;&lt;/h4&gt;&lt;p data-path-to-node=&quot;6&quot;&gt;ISR function a special function used for external interrupt that causes ATmega328P CPU to execute&amp;nbsp;&lt;b data-index-in-node=&quot;56&quot; data-path-to-node=&quot;6&quot;&gt;immediately&lt;/b&gt; when sound is detected, pausing whatever else it was doing.&lt;/p&gt;&lt;ul data-path-to-node=&quot;7&quot;&gt;&lt;li&gt;&lt;p data-path-to-node=&quot;7,0,0&quot;&gt;&lt;b data-index-in-node=&quot;0&quot; data-path-to-node=&quot;7,0,0&quot;&gt;&lt;code data-index-in-node=&quot;0&quot; data-path-to-node=&quot;7,0,0&quot;&gt;PORTC |= (1 &amp;lt;&amp;lt; BUZZER)&lt;/code&gt;&lt;/b&gt;: Sends 5V to the transistor base to start the beep.&lt;/p&gt;&lt;/li&gt;&lt;li&gt;&lt;p data-path-to-node=&quot;7,1,0&quot;&gt;&lt;b data-index-in-node=&quot;0&quot; data-path-to-node=&quot;7,1,0&quot;&gt;&lt;code data-index-in-node=&quot;0&quot; data-path-to-node=&quot;7,1,0&quot;&gt;_delay_ms(300)&lt;/code&gt;&lt;/b&gt;: Keeps the buzzer active for a short burst so it is audible to the human ear.&lt;/p&gt;&lt;/li&gt;&lt;li&gt;&lt;p data-path-to-node=&quot;7,2,0&quot;&gt;&lt;b data-index-in-node=&quot;0&quot; data-path-to-node=&quot;7,2,0&quot;&gt;&lt;code data-index-in-node=&quot;0&quot; data-path-to-node=&quot;7,2,0&quot;&gt;PORTC &amp;amp;= ~(1 &amp;lt;&amp;lt; BUZZER)&lt;/code&gt;&lt;/b&gt;: Turns the signal off, resetting the circuit for the next sound.&lt;/p&gt;&lt;/li&gt;&lt;/ul&gt;&lt;h4 style=&quot;text-align: left;&quot;&gt;&lt;b data-index-in-node=&quot;0&quot; data-path-to-node=&quot;9&quot;&gt;3. The Main Loop (&lt;code data-index-in-node=&quot;18&quot; data-path-to-node=&quot;9&quot;&gt;main&lt;/code&gt;)&lt;/b&gt;&lt;/h4&gt;&lt;ul data-path-to-node=&quot;10&quot;&gt;&lt;li&gt;&lt;p data-path-to-node=&quot;10,0,0&quot;&gt;&lt;b data-index-in-node=&quot;0&quot; data-path-to-node=&quot;10,0,0&quot;&gt;&lt;code data-index-in-node=&quot;0&quot; data-path-to-node=&quot;10,0,0&quot;&gt;while(1)&lt;/code&gt;&lt;/b&gt;: This loop is empty! Because the hardware handles the detection via interrupts, the main CPU doesn&#39;t have to do any work. This makes the code extremely &lt;b&gt;power efficient&lt;/b&gt;.&lt;/p&gt;&lt;/li&gt;&lt;/ul&gt;&lt;h3 style=&quot;text-align: left;&quot;&gt;Video Demonstration&lt;/h3&gt;&lt;p&gt;The following video demonstrates how the above circuit works.&lt;/p&gt;&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;&lt;iframe allowfullscreen=&quot;&quot; class=&quot;BLOG_video_class&quot; height=&quot;493&quot; src=&quot;https://www.youtube.com/embed/w0qxkz_WPI4&quot; width=&quot;593&quot; youtube-src-id=&quot;w0qxkz_WPI4&quot;&gt;&lt;/iframe&gt;&lt;/div&gt;&lt;br /&gt;&lt;p&gt;&lt;br /&gt;&lt;/p&gt;&lt;p&gt;&lt;b&gt;Related&lt;/b&gt;&lt;/p&gt;&lt;p&gt;&lt;/p&gt;&lt;ul style=&quot;text-align: left;&quot;&gt;&lt;li&gt;&lt;a href=&quot;https://www.ee-diary.net/2022/06/programming-atmega328p-input-capture-interrupt.html&quot;&gt;Programming ATmega328P Input Capture with Interrupt&lt;/a&gt;&lt;/li&gt;&lt;li&gt;&lt;a href=&quot;https://www.ee-diary.net/2022/06/inductance-meter-with-arduino-and-lm393.html&quot;&gt;Inductance meter with Arduino and LM393&lt;/a&gt;&lt;/li&gt;&lt;li&gt;&lt;a href=&quot;https://www.ee-diary.net/2022/06/diy-lcr-meter-using-pc.html&quot;&gt;DIY LCR meter using PC&lt;br /&gt;&lt;/a&gt;&lt;/li&gt;&lt;/ul&gt;&lt;span style=&quot;font-family: inherit;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;p&gt;&lt;/p&gt;</content><link rel='replies' type='application/atom+xml' href='http://www.ee-diary.net/feeds/1223204663406070487/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.ee-diary.net/2026/04/202604automated-sound-triggered-alarm-with-ATmega328P-External-Interrupt.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7437986969318338216/posts/default/1223204663406070487'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7437986969318338216/posts/default/1223204663406070487'/><link rel='alternate' type='text/html' href='http://www.ee-diary.net/2026/04/202604automated-sound-triggered-alarm-with-ATmega328P-External-Interrupt.html' title='Automated Sound-Triggered Alarm with ATmega328P External Interrupts'/><author><name>Unknown</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiv4ZEBMVGixhIbjA2KXPVkWXmEpD68PY7vOlAWqRp2arZ_TOYHWe7t6EmRlhHM342MEdgpeZJzqC5dJHeS1Wlp0iKtg412eqvFB03pDx3CBhn-TpstuMoGrMrDzg6DJGyXyw4RQEjgcvH0GKy_7Rm8yKeebYzCV7fziA5nC_P-S1CkMbBU5wBWfuybCfo-/s72-c/Gemini_Generated_Image_9lmvn29lmvn29lmv.png" height="72" width="72"/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-7437986969318338216.post-221477628986179322</id><published>2026-04-05T15:37:00.014+05:45</published><updated>2026-04-05T15:53:49.806+05:45</updated><category scheme="http://www.blogger.com/atom/ns#" term="arduino"/><category scheme="http://www.blogger.com/atom/ns#" term="inverter"/><title type='text'>How to Build a Pure Sine Wave Inverter using Arduino SPWM</title><content type='html'>&lt;div class=&quot;separator&quot; style=&quot;display: none;&quot;&gt;&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEj13tl1MrRqjvoF7EvwJx9oFPHR8US9cEkFCFJElTaAIwCb1_SY1WczJppJABW0BUSElSSmIfFsCe0qB-x5LLw6Cm4e5LFM1yGBRRt-TMfhlf-vLyRExx91XODvLt4wdJgqNUalLTMVpDSzUaza-R8Q2Xm_iTQOfrkmmOI20K77v3sdP7-4vZldXLj5ByQG/s1600/arduino%20spwm%20inverter.png&quot; style=&quot;display: block; padding: 1em 0px; text-align: center;&quot;&gt;&lt;img alt=&quot;arduino spwm inverter&quot; border=&quot;0&quot; data-original-height=&quot;735&quot; data-original-width=&quot;1456&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEj13tl1MrRqjvoF7EvwJx9oFPHR8US9cEkFCFJElTaAIwCb1_SY1WczJppJABW0BUSElSSmIfFsCe0qB-x5LLw6Cm4e5LFM1yGBRRt-TMfhlf-vLyRExx91XODvLt4wdJgqNUalLTMVpDSzUaza-R8Q2Xm_iTQOfrkmmOI20K77v3sdP7-4vZldXLj5ByQG/s1600/arduino%20spwm%20inverter.png&quot; /&gt;&lt;/a&gt;&lt;/div&gt;
&lt;p&gt;&amp;nbsp;It&#39;s early morning, 4:30 AM, and I just completed Arduino based pure sine wave inverter design. This inverter design is actually an improvement over the previous &lt;a href=&quot;https://www.ee-diary.net/2025/07/arduino-based-pure-sine-wave-inverter.html&quot;&gt;Arduino SPWM inverter design&lt;/a&gt;. The previous build Arduino inverter used simple transistor that has direct connection between the MOSFETs and Arduino PWM controller. It worked but the problem is the slow switching of the push pull MOSFETs. Slower switching of MOSFETs leads to heat generation because the energy gets trapped in the gate capacitance of the MOSFET. That is the reason why most diy inverter fails.&lt;/p&gt;&lt;p&gt;This version includes symmetrical totem pole driver using BC547/BC557 for the MOSFETs. By adding totem pole driver to drive the MOSFETs, the MOSFET gate capacitance gets discharged quicker resulting in faster operating, less heat generation and the MOSFETs operates in linear region. Most DIY inverters fail because of this. Furthermore, improvement has also been made in the software that generates the SPWM signal. The previous Arduino inverter code used &lt;a href=&quot;https://www.ee-diary.net/2021/07/phase-correct-pwm-with-atmega328p.html&quot;&gt;Fast PWM&lt;/a&gt; whereas this improved version use &lt;a href=&quot;https://www.ee-diary.net/2021/07/phase-correct-pwm-with-atmega328p.html&quot;&gt;Phase Correct PWM&lt;/a&gt;. Thus, the improvements are in both hardware and software.&amp;nbsp;&lt;/p&gt;&lt;h3 style=&quot;text-align: left;&quot;&gt;Circuit Diagram&lt;/h3&gt;&lt;p&gt;Below is the circuit diagram of the improved SPWM Arduino sine wave inverter.&lt;/p&gt;&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhccFSk_AbImSFn0VvRtCddqUqU1b3dn88doOzQ0ADC-_s9JtvqNJiMezOtDHZYfdcA1Set7uaSQQ_35Nu0PlpGJC5oVDcnXmnjOkEPLVtzkO2dq65wNoXlsNscJPM7VLdmyL2NM1gM-01FMdVDtotRWdVG-SM1qs2JFM1u35474RMwf3dTc0qauIC5DvMR/s1180/Arduino%20SPWM%20Inverter%20Circuit%20Diagram%20animation.gif&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img alt=&quot;arduino spwm inverter circuit diagram&quot; border=&quot;0&quot; data-original-height=&quot;598&quot; data-original-width=&quot;1180&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhccFSk_AbImSFn0VvRtCddqUqU1b3dn88doOzQ0ADC-_s9JtvqNJiMezOtDHZYfdcA1Set7uaSQQ_35Nu0PlpGJC5oVDcnXmnjOkEPLVtzkO2dq65wNoXlsNscJPM7VLdmyL2NM1gM-01FMdVDtotRWdVG-SM1qs2JFM1u35474RMwf3dTc0qauIC5DvMR/s16000/Arduino%20SPWM%20Inverter%20Circuit%20Diagram%20animation.gif&quot; title=&quot;arduino spwm inverter circuit diagram&quot; /&gt;&lt;/a&gt;&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;p data-path-to-node=&quot;0&quot; style=&quot;font-family: &amp;quot;Google Sans Text&amp;quot;, sans-serif; line-height: 1.15; margin-top: 0px;&quot;&gt;This circuit diagam shows the revised&amp;nbsp;&lt;b data-index-in-node=&quot;18&quot; data-path-to-node=&quot;0&quot; style=&quot;line-height: 1.15; margin-top: 0px;&quot;&gt;Pure Sine Wave Inverter&lt;/b&gt; that uses &lt;b data-index-in-node=&quot;52&quot; data-path-to-node=&quot;0&quot; style=&quot;line-height: 1.15; margin-top: 0px;&quot;&gt;SPWM (Sinusoidal Pulse Width Modulation)&lt;/b&gt; to convert &lt;span class=&quot;math-inline&quot; data-index-in-node=&quot;104&quot; data-math=&quot;12\text{V}&quot; style=&quot;line-height: 1.15; margin-top: 0px;&quot;&gt;12V&lt;/span&gt;&amp;nbsp;DC into AC power. It operates on a &lt;b data-index-in-node=&quot;150&quot; data-path-to-node=&quot;0&quot; style=&quot;line-height: 1.15; margin-top: 0px;&quot;&gt;Push-Pull&lt;/b&gt; topology.&lt;/p&gt;&lt;p data-path-to-node=&quot;1&quot; style=&quot;font-family: &amp;quot;Google Sans Text&amp;quot;, sans-serif; line-height: 1.15; margin-top: 0px;&quot;&gt;Here is the step-by-step breakdown of how it works:&lt;/p&gt;&lt;h4 style=&quot;font-family: &amp;quot;Google Sans&amp;quot;, sans-serif; line-height: 1.15; margin-top: 0px; text-align: left;&quot;&gt;&lt;b data-index-in-node=&quot;0&quot; data-path-to-node=&quot;2&quot; style=&quot;font-family: &amp;quot;Google Sans Text&amp;quot;, sans-serif; line-height: 1.15; margin-top: 0px;&quot;&gt;1. The Control Brain (Arduino Nano)&lt;/b&gt;&lt;/h4&gt;&lt;p data-path-to-node=&quot;3&quot; style=&quot;font-family: &amp;quot;Google Sans Text&amp;quot;, sans-serif; line-height: 1.15; margin-top: 0px;&quot;&gt;The Arduino generates high frequency&amp;nbsp;&lt;span class=&quot;math-inline&quot; data-index-in-node=&quot;42&quot; data-math=&quot;10\text{kHz}&quot; style=&quot;line-height: 1.15; margin-top: 0px;&quot;&gt;20kHz&lt;/span&gt;&amp;nbsp;SPWM signals from pins &lt;b data-index-in-node=&quot;95&quot; data-path-to-node=&quot;3&quot; style=&quot;line-height: 1.15; margin-top: 0px;&quot;&gt;D9&lt;/b&gt; and &lt;b data-index-in-node=&quot;102&quot; data-path-to-node=&quot;3&quot; style=&quot;line-height: 1.15; margin-top: 0px;&quot;&gt;D10&lt;/b&gt;.&lt;/p&gt;&lt;ul data-path-to-node=&quot;4&quot; style=&quot;font-family: &amp;quot;Google Sans Text&amp;quot;, sans-serif; line-height: 1.15; margin-top: 0px; padding-inline-start: 32px;&quot;&gt;&lt;li style=&quot;line-height: 1.15; margin-top: 0px;&quot;&gt;&lt;p data-path-to-node=&quot;4,0,0&quot; style=&quot;line-height: 1.15; margin-top: 0px;&quot;&gt;Instead of a simple square wave, the width of these pulses varies according to a &lt;b data-index-in-node=&quot;81&quot; data-path-to-node=&quot;4,0,0&quot; style=&quot;line-height: 1.15; margin-top: 0px;&quot;&gt;sine lookup table&lt;/b&gt;.&lt;/p&gt;&lt;/li&gt;&lt;li style=&quot;line-height: 1.15; margin-top: 0px;&quot;&gt;&lt;p data-path-to-node=&quot;4,1,0&quot; style=&quot;line-height: 1.15; margin-top: 0px;&quot;&gt;&lt;b data-index-in-node=&quot;0&quot; data-path-to-node=&quot;4,1,0&quot; style=&quot;line-height: 1.15; margin-top: 0px;&quot;&gt;D9&lt;/b&gt; handles the positive half-cycle of the AC wave.&lt;/p&gt;&lt;/li&gt;&lt;li style=&quot;line-height: 1.15; margin-top: 0px;&quot;&gt;&lt;p data-path-to-node=&quot;4,2,0&quot; style=&quot;line-height: 1.15; margin-top: 0px;&quot;&gt;&lt;b data-index-in-node=&quot;0&quot; data-path-to-node=&quot;4,2,0&quot; style=&quot;line-height: 1.15; margin-top: 0px;&quot;&gt;D10&lt;/b&gt; handles the negative half-cycle.&lt;/p&gt;&lt;/li&gt;&lt;/ul&gt;&lt;h4 style=&quot;font-family: &amp;quot;Google Sans&amp;quot;, sans-serif; line-height: 1.15; margin-top: 0px; text-align: left;&quot;&gt;&lt;b data-index-in-node=&quot;0&quot; data-path-to-node=&quot;5&quot; style=&quot;font-family: &amp;quot;Google Sans Text&amp;quot;, sans-serif; line-height: 1.15; margin-top: 0px;&quot;&gt;2. The Gate Driver (Totem-Pole)&lt;/b&gt;&lt;/h4&gt;&lt;p data-path-to-node=&quot;6&quot; style=&quot;font-family: &amp;quot;Google Sans Text&amp;quot;, sans-serif; line-height: 1.15; margin-top: 0px;&quot;&gt;Arduino pins cannot provide enough current to rapidly charge and discharge the large internal capacitance of power MOSFETs.&lt;/p&gt;&lt;ul data-path-to-node=&quot;7&quot; style=&quot;font-family: &amp;quot;Google Sans Text&amp;quot;, sans-serif; line-height: 1.15; margin-top: 0px; padding-inline-start: 32px;&quot;&gt;&lt;li style=&quot;line-height: 1.15; margin-top: 0px;&quot;&gt;&lt;p data-path-to-node=&quot;7,0,0&quot; style=&quot;line-height: 1.15; margin-top: 0px;&quot;&gt;&lt;b data-index-in-node=&quot;0&quot; data-path-to-node=&quot;7,0,0&quot; style=&quot;line-height: 1.15; margin-top: 0px;&quot;&gt;Q1/Q5&lt;/b&gt; and &lt;b data-index-in-node=&quot;10&quot; data-path-to-node=&quot;7,0,0&quot; style=&quot;line-height: 1.15; margin-top: 0px;&quot;&gt;Q3/Q4&lt;/b&gt; form &lt;b data-index-in-node=&quot;21&quot; data-path-to-node=&quot;7,0,0&quot; style=&quot;line-height: 1.15; margin-top: 0px;&quot;&gt;Totem-Pole drivers&lt;/b&gt;.&lt;/p&gt;&lt;/li&gt;&lt;li style=&quot;line-height: 1.15; margin-top: 0px;&quot;&gt;&lt;p data-path-to-node=&quot;7,1,0&quot; style=&quot;line-height: 1.15; margin-top: 0px;&quot;&gt;The &lt;b data-index-in-node=&quot;4&quot; data-path-to-node=&quot;7,1,0&quot; style=&quot;line-height: 1.15; margin-top: 0px;&quot;&gt;NPN&lt;/b&gt; transistor (top) quickly &quot;pushes&quot; current into the MOSFET gate to turn it ON.&lt;/p&gt;&lt;/li&gt;&lt;li style=&quot;line-height: 1.15; margin-top: 0px;&quot;&gt;&lt;p data-path-to-node=&quot;7,2,0&quot; style=&quot;line-height: 1.15; margin-top: 0px;&quot;&gt;The &lt;b data-index-in-node=&quot;4&quot; data-path-to-node=&quot;7,2,0&quot; style=&quot;line-height: 1.15; margin-top: 0px;&quot;&gt;PNP&lt;/b&gt; transistor (bottom) quickly &quot;pulls&quot; current out to ground to turn it OFF.&lt;/p&gt;&lt;/li&gt;&lt;li style=&quot;line-height: 1.15; margin-top: 0px;&quot;&gt;&lt;p data-path-to-node=&quot;7,3,0&quot; style=&quot;line-height: 1.15; margin-top: 0px;&quot;&gt;The &lt;b data-index-in-node=&quot;4&quot; data-path-to-node=&quot;7,3,0&quot; style=&quot;line-height: 1.15; margin-top: 0px;&quot;&gt;&lt;span class=&quot;math-inline&quot; data-index-in-node=&quot;4&quot; data-math=&quot;10\text{k}\Omega&quot; style=&quot;line-height: 1.15; margin-top: 0px;&quot;&gt;10kOhm&lt;/span&gt;&amp;nbsp;resistors (R5/R6)&lt;/b&gt; ensure the gates stay at &lt;span class=&quot;math-inline&quot; data-index-in-node=&quot;64&quot; data-math=&quot;0\text{V}&quot; style=&quot;line-height: 1.15; margin-top: 0px;&quot;&gt;0V&lt;/span&gt;&amp;nbsp;during startup to prevent accidental shorts.&lt;/p&gt;&lt;/li&gt;&lt;/ul&gt;&lt;h4 style=&quot;font-family: &amp;quot;Google Sans&amp;quot;, sans-serif; line-height: 1.15; margin-top: 0px; text-align: left;&quot;&gt;&lt;b data-index-in-node=&quot;0&quot; data-path-to-node=&quot;8&quot; style=&quot;font-family: &amp;quot;Google Sans Text&amp;quot;, sans-serif; line-height: 1.15; margin-top: 0px;&quot;&gt;3. The Switching Stage (MOSFETs)&lt;/b&gt;&lt;/h4&gt;&lt;p data-path-to-node=&quot;9&quot; style=&quot;font-family: &amp;quot;Google Sans Text&amp;quot;, sans-serif; line-height: 1.15; margin-top: 0px;&quot;&gt;The MOSFETs (&lt;b data-index-in-node=&quot;13&quot; data-path-to-node=&quot;9&quot; style=&quot;line-height: 1.15; margin-top: 0px;&quot;&gt;Q2&lt;/b&gt; and &lt;b data-index-in-node=&quot;20&quot; data-path-to-node=&quot;9&quot; style=&quot;line-height: 1.15; margin-top: 0px;&quot;&gt;Q6&lt;/b&gt;) act as high-speed electronic switches. They alternate at &lt;span class=&quot;math-inline&quot; data-index-in-node=&quot;81&quot; data-math=&quot;50\text{Hz}&quot; style=&quot;line-height: 1.15; margin-top: 0px;&quot;&gt;50Hz&lt;/span&gt;, but while they are &quot;ON,&quot; they are actually pulsing at the high carrier frequency &lt;span class=&quot;math-inline&quot; data-index-in-node=&quot;176&quot; data-math=&quot;10\text{kHz}&quot; style=&quot;line-height: 1.15; margin-top: 0px;&quot;&gt;10kHz&lt;/span&gt;. This &quot;chops&quot; the &lt;span class=&quot;math-inline&quot; data-index-in-node=&quot;209&quot; data-math=&quot;12\text{V}&quot; style=&quot;line-height: 1.15; margin-top: 0px;&quot;&gt;12V&lt;/span&gt;&amp;nbsp;DC into a high-frequency SPWM signal.&lt;/p&gt;&lt;h4 style=&quot;font-family: &amp;quot;Google Sans&amp;quot;, sans-serif; line-height: 1.15; margin-top: 0px; text-align: left;&quot;&gt;&lt;b data-index-in-node=&quot;0&quot; data-path-to-node=&quot;10&quot; style=&quot;font-family: &amp;quot;Google Sans Text&amp;quot;, sans-serif; line-height: 1.15; margin-top: 0px;&quot;&gt;4. The Transformer (Push-Pull)&lt;/b&gt;&lt;/h4&gt;&lt;p data-path-to-node=&quot;11&quot; style=&quot;font-family: &amp;quot;Google Sans Text&amp;quot;, sans-serif; line-height: 1.15; margin-top: 0px;&quot;&gt;The transformer has a &lt;b data-index-in-node=&quot;22&quot; data-path-to-node=&quot;11&quot; style=&quot;line-height: 1.15; margin-top: 0px;&quot;&gt;Center-Tapped Primary&lt;/b&gt;.&lt;/p&gt;&lt;ul data-path-to-node=&quot;12&quot; style=&quot;font-family: &amp;quot;Google Sans Text&amp;quot;, sans-serif; line-height: 1.15; margin-top: 0px; padding-inline-start: 32px;&quot;&gt;&lt;li style=&quot;line-height: 1.15; margin-top: 0px;&quot;&gt;&lt;p data-path-to-node=&quot;12,0,0&quot; style=&quot;line-height: 1.15; margin-top: 0px;&quot;&gt;When &lt;b data-index-in-node=&quot;5&quot; data-path-to-node=&quot;12,0,0&quot; style=&quot;line-height: 1.15; margin-top: 0px;&quot;&gt;Q2&lt;/b&gt; is active, current flows through the top half of the primary.&lt;/p&gt;&lt;/li&gt;&lt;li style=&quot;line-height: 1.15; margin-top: 0px;&quot;&gt;&lt;p data-path-to-node=&quot;12,1,0&quot; style=&quot;line-height: 1.15; margin-top: 0px;&quot;&gt;When &lt;b data-index-in-node=&quot;5&quot; data-path-to-node=&quot;12,1,0&quot; style=&quot;line-height: 1.15; margin-top: 0px;&quot;&gt;Q6&lt;/b&gt; is active, current flows through the bottom half in the &lt;b data-index-in-node=&quot;64&quot; data-path-to-node=&quot;12,1,0&quot; style=&quot;line-height: 1.15; margin-top: 0px;&quot;&gt;opposite direction&lt;/b&gt;.&lt;/p&gt;&lt;/li&gt;&lt;li style=&quot;line-height: 1.15; margin-top: 0px;&quot;&gt;&lt;p data-path-to-node=&quot;12,2,0&quot; style=&quot;line-height: 1.15; margin-top: 0px;&quot;&gt;This alternating current (AC) in the primary induces a high-voltage AC signal in the secondary (e.g.&amp;nbsp;&lt;span class=&quot;math-inline&quot; data-index-in-node=&quot;102&quot; data-math=&quot;220\text{V}&quot; style=&quot;line-height: 1.15; margin-top: 0px;&quot;&gt;220V&lt;/span&gt;).&lt;/p&gt;&lt;/li&gt;&lt;/ul&gt;&lt;h4 style=&quot;font-family: &amp;quot;Google Sans&amp;quot;, sans-serif; line-height: 1.15; margin-top: 0px; text-align: left;&quot;&gt;&lt;b data-index-in-node=&quot;0&quot; data-path-to-node=&quot;13&quot; style=&quot;font-family: &amp;quot;Google Sans Text&amp;quot;, sans-serif; line-height: 1.15; margin-top: 0px;&quot;&gt;5. The Output Filter (LC Filter)&lt;/b&gt;&lt;/h4&gt;&lt;p data-path-to-node=&quot;14&quot; style=&quot;font-family: &amp;quot;Google Sans Text&amp;quot;, sans-serif; line-height: 1.15; margin-top: 0px;&quot;&gt;The output from the transformer is still a &quot;chopped&quot; high-frequency signal.&lt;/p&gt;&lt;ul data-path-to-node=&quot;15&quot; style=&quot;font-family: &amp;quot;Google Sans Text&amp;quot;, sans-serif; line-height: 1.15; margin-top: 0px; padding-inline-start: 32px;&quot;&gt;&lt;li style=&quot;line-height: 1.15; margin-top: 0px;&quot;&gt;&lt;p data-path-to-node=&quot;15,0,0&quot; style=&quot;line-height: 1.15; margin-top: 0px;&quot;&gt;The &lt;b data-index-in-node=&quot;4&quot; data-path-to-node=&quot;15,0,0&quot; style=&quot;line-height: 1.15; margin-top: 0px;&quot;&gt;Inductor (L1)&lt;/b&gt;&amp;nbsp;\(2mH\) and &lt;b data-index-in-node=&quot;22&quot; data-path-to-node=&quot;15,0,0&quot; style=&quot;line-height: 1.15; margin-top: 0px;&quot;&gt;Capacitor (C1)&lt;/b&gt;&amp;nbsp;$2.2 \mu H$&lt;/p&gt;&lt;/li&gt;&lt;li style=&quot;line-height: 1.15; margin-top: 0px;&quot;&gt;&lt;p data-path-to-node=&quot;15,0,0&quot; style=&quot;line-height: 1.15; margin-top: 0px;&quot;&gt;form a low-pass filter.&lt;/p&gt;&lt;/li&gt;&lt;li style=&quot;line-height: 1.15; margin-top: 0px;&quot;&gt;&lt;p data-path-to-node=&quot;15,1,0&quot; style=&quot;line-height: 1.15; margin-top: 0px;&quot;&gt;They block the high-frequency switching noise and smooth out the pulses.&lt;/p&gt;&lt;/li&gt;&lt;li style=&quot;line-height: 1.15; margin-top: 0px;&quot;&gt;&lt;p data-path-to-node=&quot;15,2,0&quot; style=&quot;line-height: 1.15; margin-top: 0px;&quot;&gt;The result is a clean &lt;b data-index-in-node=&quot;22&quot; data-path-to-node=&quot;15,2,0&quot; style=&quot;line-height: 1.15; margin-top: 0px;&quot;&gt;&lt;span class=&quot;math-inline&quot; data-index-in-node=&quot;22&quot; data-math=&quot;50\text{Hz}&quot; style=&quot;line-height: 1.15; margin-top: 0px;&quot;&gt;50Hz&lt;/span&gt;&amp;nbsp;Pure Sine Wave&lt;/b&gt; that powers the bulb (B1) just like a standard wall outlet.&lt;/p&gt;&lt;/li&gt;&lt;/ul&gt;&lt;h3 style=&quot;text-align: left;&quot;&gt;Program Code&lt;/h3&gt;&lt;p&gt;The Arduino program code for the above SPWM inverter is below.&lt;/p&gt;
&lt;pre lang=&quot;cpp&quot;&gt;&lt;code&gt;
/*
 * Pure Sine Wave SPWM Generator
 * Carrier Frequency: 20kHz (Silent Operation)
 * Output Frequency: 50Hz
 * Board: Arduino Nano / Uno (ATmega328P)
 */

#include &amp;lt;avr/pgmspace.h&amp;gt;

// 200-sample Sine Look-Up Table (Half-wave)
// Values scaled to 400 to match the ICR1 TOP value
const uint16_t sineTable[] PROGMEM = {
  0, 6, 12, 18, 25, 31, 37, 43, 50, 56, 62, 68, 74, 80, 86, 92, 98, 104, 110, 116, 
  122, 128, 134, 140, 146, 151, 157, 163, 168, 174, 179, 185, 190, 195, 200, 205, 210, 215, 220, 225, 
  229, 234, 238, 243, 247, 251, 255, 259, 263, 267, 271, 275, 278, 282, 285, 288, 292, 295, 298, 301, 
  304, 307, 309, 312, 315, 317, 320, 322, 324, 327, 329, 331, 333, 335, 337, 338, 340, 342, 343, 345, 
  346, 347, 349, 350, 351, 352, 353, 354, 354, 355, 356, 356, 357, 357, 358, 358, 358, 359, 359, 359, 
  359, 359, 359, 359, 358, 358, 358, 357, 357, 356, 356, 355, 354, 354, 353, 352, 351, 350, 349, 347, 
  346, 345, 343, 342, 340, 338, 337, 335, 333, 331, 329, 327, 324, 322, 320, 317, 315, 312, 309, 307, 
  304, 301, 298, 295, 292, 288, 285, 282, 278, 275, 271, 267, 263, 259, 255, 251, 247, 243, 238, 234, 
  229, 225, 220, 215, 210, 205, 200, 195, 190, 185, 179, 174, 168, 163, 157, 151, 146, 140, 134, 128, 
  122, 116, 110, 104, 98, 92, 86, 80, 74, 68, 62, 56, 50, 43, 37, 31, 25, 18, 12, 6
};

volatile uint16_t sampleIndex = 0;
volatile bool phase = 0; // 0 = Positive Half, 1 = Negative Half

void setup() {
  pinMode(9, OUTPUT);  // High Side MOSFET Drive
  pinMode(10, OUTPUT); // Low Side MOSFET Drive
  noInterrupts();

  // Mode 10: Phase Correct PWM, TOP = ICR1
  TCCR1A = _BV(WGM11);
  TCCR1B = _BV(WGM13) | _BV(CS10); // Prescaler = 1
  
  // ICR1 = 400 sets carrier frequency to 20kHz
  // Formula: 16MHz / (2 * 1 * 400) = 20,000 Hz
  ICR1 = 400; 

  TIMSK1 = _BV(TOIE1); // Enable Overflow Interrupt
  interrupts();
}

ISR(TIMER1_OVF_vect) {
  uint16_t dutyCycle = pgm_read_word(&amp;amp;sineTable[sampleIndex]);

  if (phase == 0) {
    // Positive half-cycle: D9 pulses, D10 stays OFF
    OCR1A = dutyCycle; 
    OCR1B = 0;
    TCCR1A |= _BV(COM1A1);  // Enable PWM on D9
    TCCR1A &amp;amp;= ~_BV(COM1B1); // Disable PWM on D10
  } else {
    // Negative half-cycle: D10 pulses, D9 stays OFF
    OCR1A = 0; 
    OCR1B = dutyCycle;
    TCCR1A &amp;amp;= ~_BV(COM1A1); // Disable PWM on D9
    TCCR1A |= _BV(COM1B1);  // Enable PWM on D10
  }

  sampleIndex++;

  // 200 samples at 20kHz = 10ms (one half-cycle)
  if (sampleIndex &amp;gt;= 200) { 
    sampleIndex = 0;
    phase = !phase; // Swap sides to create AC direction change
  }
}

void loop() {
  // Main loop remains empty; all timing is handled by Timer 1
}
&lt;/code&gt;&lt;/pre&gt;&lt;p data-path-to-node=&quot;0&quot; style=&quot;font-family: &amp;quot;Google Sans Text&amp;quot;, sans-serif; line-height: 1.15; margin-top: 0px;&quot;&gt;This code is a &lt;b data-index-in-node=&quot;15&quot; data-path-to-node=&quot;0&quot; style=&quot;line-height: 1.15; margin-top: 0px;&quot;&gt;high-speed SPWM generator&lt;/b&gt; that uses the Arduino&#39;s internal hardware timer to create a precise &lt;span class=&quot;math-inline&quot; data-index-in-node=&quot;109&quot; data-math=&quot;50\text{Hz}&quot; style=&quot;line-height: 1.15; margin-top: 0px;&quot;&gt;50Hz&lt;/span&gt;&amp;nbsp;sine wave.&lt;/p&gt;&lt;p data-path-to-node=&quot;1&quot; style=&quot;font-family: &amp;quot;Google Sans Text&amp;quot;, sans-serif; line-height: 1.15; margin-top: 0px;&quot;&gt;Here is the breakdown of the logic:&lt;/p&gt;&lt;h4 style=&quot;font-family: &amp;quot;Google Sans&amp;quot;, sans-serif; line-height: 1.15; margin-top: 0px; text-align: left;&quot;&gt;&lt;b data-index-in-node=&quot;0&quot; data-path-to-node=&quot;2&quot; style=&quot;font-family: &amp;quot;Google Sans Text&amp;quot;, sans-serif; line-height: 1.15; margin-top: 0px;&quot;&gt;1. The Sine Look-Up Table (The Map)&lt;/b&gt;&lt;/h4&gt;&lt;ul data-path-to-node=&quot;3&quot; style=&quot;font-family: &amp;quot;Google Sans Text&amp;quot;, sans-serif; line-height: 1.15; margin-top: 0px; padding-inline-start: 32px;&quot;&gt;&lt;li style=&quot;line-height: 1.15; margin-top: 0px;&quot;&gt;&lt;p data-path-to-node=&quot;3,0,0&quot; style=&quot;line-height: 1.15; margin-top: 0px;&quot;&gt;The&amp;nbsp;sineTable contains &lt;b data-index-in-node=&quot;25&quot; data-path-to-node=&quot;3,0,0&quot; style=&quot;line-height: 1.15; margin-top: 0px;&quot;&gt;200 pre-calculated values&lt;/b&gt; representing a half-circle (sine wave).&lt;/p&gt;&lt;/li&gt;&lt;li style=&quot;line-height: 1.15; margin-top: 0px;&quot;&gt;&lt;p data-path-to-node=&quot;3,1,0&quot; style=&quot;line-height: 1.15; margin-top: 0px;&quot;&gt;The values range from &lt;b data-index-in-node=&quot;22&quot; data-path-to-node=&quot;3,1,0&quot; style=&quot;line-height: 1.15; margin-top: 0px;&quot;&gt;0 to 359&lt;/b&gt;. These tell the Arduino how long to keep the MOSFET &quot;ON&quot; at any given microsecond to mimic a sine wave&#39;s shape.&lt;/p&gt;&lt;/li&gt;&lt;/ul&gt;&lt;h4 style=&quot;font-family: &amp;quot;Google Sans&amp;quot;, sans-serif; line-height: 1.15; margin-top: 0px; text-align: left;&quot;&gt;&lt;b data-index-in-node=&quot;0&quot; data-path-to-node=&quot;4&quot; style=&quot;font-family: &amp;quot;Google Sans Text&amp;quot;, sans-serif; line-height: 1.15; margin-top: 0px;&quot;&gt;2. Timer 1 Configuration (The Engine)&lt;/b&gt;&lt;/h4&gt;&lt;ul data-path-to-node=&quot;5&quot; style=&quot;font-family: &amp;quot;Google Sans Text&amp;quot;, sans-serif; line-height: 1.15; margin-top: 0px; padding-inline-start: 32px;&quot;&gt;&lt;li style=&quot;line-height: 1.15; margin-top: 0px;&quot;&gt;&lt;p data-path-to-node=&quot;5,0,0&quot; style=&quot;line-height: 1.15; margin-top: 0px;&quot;&gt;&lt;b data-index-in-node=&quot;0&quot; data-path-to-node=&quot;5,0,0&quot; style=&quot;line-height: 1.15; margin-top: 0px;&quot;&gt;Mode 10 (Phase Correct PWM):&lt;/b&gt; This is the most stable mode for power electronics. The timer counts up to a &quot;TOP&quot; value and then back down to zero.&lt;/p&gt;&lt;/li&gt;&lt;li style=&quot;line-height: 1.15; margin-top: 0px;&quot;&gt;&lt;p data-path-to-node=&quot;5,1,0&quot; style=&quot;line-height: 1.15; margin-top: 0px;&quot;&gt;&lt;b data-index-in-node=&quot;0&quot; data-path-to-node=&quot;5,1,0&quot; style=&quot;line-height: 1.15; margin-top: 0px;&quot;&gt;ICR1 = 400:&lt;/b&gt; This sets the &quot;TOP&quot; limit. At a &lt;span class=&quot;math-inline&quot; data-index-in-node=&quot;44&quot; data-math=&quot;16\text{MHz}&quot; style=&quot;line-height: 1.15; margin-top: 0px;&quot;&gt;16MHz&lt;/span&gt;&amp;nbsp;clock speed, counting up and down to 400 creates exactly a &lt;b data-index-in-node=&quot;116&quot; data-path-to-node=&quot;5,1,0&quot; style=&quot;line-height: 1.15; margin-top: 0px;&quot;&gt;&lt;span class=&quot;math-inline&quot; data-index-in-node=&quot;116&quot; data-math=&quot;20\text{kHz}&quot; style=&quot;line-height: 1.15; margin-top: 0px;&quot;&gt;20kHz&lt;/span&gt;&amp;nbsp;carrier frequency&lt;/b&gt;.&lt;/p&gt;&lt;/li&gt;&lt;li style=&quot;line-height: 1.15; margin-top: 0px;&quot;&gt;&lt;p data-path-to-node=&quot;5,2,0&quot; style=&quot;line-height: 1.15; margin-top: 0px;&quot;&gt;&lt;b data-index-in-node=&quot;0&quot; data-path-to-node=&quot;5,2,0&quot; style=&quot;line-height: 1.15; margin-top: 0px;&quot;&gt;No Prescaler:&lt;/b&gt; This runs the timer at the full speed of the Arduino &lt;span class=&quot;math-inline&quot; data-index-in-node=&quot;75&quot; data-math=&quot;16\text{MHz}&quot; style=&quot;line-height: 1.15; margin-top: 0px;&quot;&gt;16MHz&lt;/span&gt;&amp;nbsp;for maximum precision.&lt;/p&gt;&lt;/li&gt;&lt;/ul&gt;&lt;div&gt;&lt;span face=&quot;Google Sans Text, sans-serif&quot;&gt;Note: use the &lt;a href=&quot;https://www.ee-diary.net/p/arduino-timer-calculator.html&quot;&gt;Arduino PWM online calculator&lt;/a&gt;.&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span face=&quot;Google Sans Text, sans-serif&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;&lt;h4 style=&quot;font-family: &amp;quot;Google Sans&amp;quot;, sans-serif; line-height: 1.15; margin-top: 0px; text-align: left;&quot;&gt;&lt;b data-index-in-node=&quot;0&quot; data-path-to-node=&quot;6&quot; style=&quot;font-family: &amp;quot;Google Sans Text&amp;quot;, sans-serif; line-height: 1.15; margin-top: 0px;&quot;&gt;3. The Interrupt Service Routine (The Brain)&lt;/b&gt;&lt;/h4&gt;&lt;p data-path-to-node=&quot;7&quot; style=&quot;font-family: &amp;quot;Google Sans Text&amp;quot;, sans-serif; line-height: 1.15; margin-top: 0px;&quot;&gt;The ISR(TIMER1_OVF_vect) is&amp;nbsp;a special function that runs &lt;b data-index-in-node=&quot;57&quot; data-path-to-node=&quot;7&quot; style=&quot;line-height: 1.15; margin-top: 0px;&quot;&gt;20,000 times per second&lt;/b&gt;. Each time it runs, it performs three tasks:&lt;/p&gt;&lt;ul data-path-to-node=&quot;8&quot; style=&quot;font-family: &amp;quot;Google Sans Text&amp;quot;, sans-serif; line-height: 1.15; margin-top: 0px; padding-inline-start: 32px;&quot;&gt;&lt;li style=&quot;line-height: 1.15; margin-top: 0px;&quot;&gt;&lt;p data-path-to-node=&quot;8,0,0&quot; style=&quot;line-height: 1.15; margin-top: 0px;&quot;&gt;&lt;b data-index-in-node=&quot;0&quot; data-path-to-node=&quot;8,0,0&quot; style=&quot;line-height: 1.15; margin-top: 0px;&quot;&gt;Duty Cycle Update:&lt;/b&gt; It grabs the next value from the sine Table&amp;nbsp;and loads it into the Pulse Width registers (OCR1A or OCR1B).&lt;/p&gt;&lt;/li&gt;&lt;li style=&quot;line-height: 1.15; margin-top: 0px;&quot;&gt;&lt;p data-path-to-node=&quot;8,1,0&quot; style=&quot;line-height: 1.15; margin-top: 0px;&quot;&gt;&lt;b data-index-in-node=&quot;0&quot; data-path-to-node=&quot;8,1,0&quot; style=&quot;line-height: 1.15; margin-top: 0px;&quot;&gt;Phase Switching:&lt;/b&gt; It manages the &lt;b data-index-in-node=&quot;32&quot; data-path-to-node=&quot;8,1,0&quot; style=&quot;line-height: 1.15; margin-top: 0px;&quot;&gt;Push-Pull&lt;/b&gt; logic.&lt;/p&gt;&lt;ul data-path-to-node=&quot;8,1,1&quot; style=&quot;line-height: 1.15; margin-top: 0px; padding-inline-start: 32px;&quot;&gt;&lt;li style=&quot;line-height: 1.15; margin-top: 0px;&quot;&gt;&lt;p data-path-to-node=&quot;8,1,1,0,0&quot; style=&quot;line-height: 1.15; margin-top: 0px;&quot;&gt;&lt;b data-index-in-node=&quot;0&quot; data-path-to-node=&quot;8,1,1,0,0&quot; style=&quot;line-height: 1.15; margin-top: 0px;&quot;&gt;Phase 0:&lt;/b&gt; It sends the pulses to &lt;b data-index-in-node=&quot;32&quot; data-path-to-node=&quot;8,1,1,0,0&quot; style=&quot;line-height: 1.15; margin-top: 0px;&quot;&gt;Pin 9&lt;/b&gt; and keeps Pin 10 at &lt;span class=&quot;math-inline&quot; data-index-in-node=&quot;58&quot; data-math=&quot;0\text{V}&quot; style=&quot;line-height: 1.15; margin-top: 0px;&quot;&gt;0V&lt;/span&gt;.&lt;/p&gt;&lt;/li&gt;&lt;li style=&quot;line-height: 1.15; margin-top: 0px;&quot;&gt;&lt;p data-path-to-node=&quot;8,1,1,1,0&quot; style=&quot;line-height: 1.15; margin-top: 0px;&quot;&gt;&lt;b data-index-in-node=&quot;0&quot; data-path-to-node=&quot;8,1,1,1,0&quot; style=&quot;line-height: 1.15; margin-top: 0px;&quot;&gt;Phase 1:&lt;/b&gt; It sends the pulses to &lt;b data-index-in-node=&quot;32&quot; data-path-to-node=&quot;8,1,1,1,0&quot; style=&quot;line-height: 1.15; margin-top: 0px;&quot;&gt;Pin 10&lt;/b&gt; and keeps Pin 9 at &lt;span class=&quot;math-inline&quot; data-index-in-node=&quot;58&quot; data-math=&quot;0\text{V}&quot; style=&quot;line-height: 1.15; margin-top: 0px;&quot;&gt;0V&lt;/span&gt;.&lt;/p&gt;&lt;/li&gt;&lt;/ul&gt;&lt;/li&gt;&lt;li style=&quot;line-height: 1.15; margin-top: 0px;&quot;&gt;&lt;p data-path-to-node=&quot;8,2,0&quot; style=&quot;line-height: 1.15; margin-top: 0px;&quot;&gt;&lt;b data-index-in-node=&quot;0&quot; data-path-to-node=&quot;8,2,0&quot; style=&quot;line-height: 1.15; margin-top: 0px;&quot;&gt;Timing Control:&lt;/b&gt; It counts the samples. After &lt;b data-index-in-node=&quot;45&quot; data-path-to-node=&quot;8,2,0&quot; style=&quot;line-height: 1.15; margin-top: 0px;&quot;&gt;200 samples&lt;/b&gt;, it knows that &lt;span class=&quot;math-inline&quot; data-index-in-node=&quot;72&quot; data-math=&quot;10\text{ms}&quot; style=&quot;line-height: 1.15; margin-top: 0px;&quot;&gt;10ms&lt;/span&gt;&amp;nbsp;has passed (half of a &lt;span class=&quot;math-inline&quot; data-index-in-node=&quot;106&quot; data-math=&quot;50\text{Hz}&quot; style=&quot;line-height: 1.15; margin-top: 0px;&quot;&gt;50Hz&lt;/span&gt;, so it flips the phase to the other MOSFET.&lt;/p&gt;&lt;/li&gt;&lt;/ul&gt;&lt;h4 style=&quot;font-family: &amp;quot;Google Sans&amp;quot;, sans-serif; line-height: 1.15; margin-top: 0px; text-align: left;&quot;&gt;&lt;b data-index-in-node=&quot;0&quot; data-path-to-node=&quot;9&quot; style=&quot;font-family: &amp;quot;Google Sans Text&amp;quot;, sans-serif; line-height: 1.15; margin-top: 0px;&quot;&gt;4. Why This Works for an Inverter&lt;/b&gt;&lt;/h4&gt;&lt;p data-path-to-node=&quot;10&quot; style=&quot;font-family: &amp;quot;Google Sans Text&amp;quot;, sans-serif; line-height: 1.15; margin-top: 0px;&quot;&gt;By rapidly switching the MOSFETs on and off at &lt;span class=&quot;math-inline&quot; data-index-in-node=&quot;47&quot; data-math=&quot;20\text{kHz}&quot; style=&quot;line-height: 1.15; margin-top: 0px;&quot;&gt;20kHz&lt;/span&gt;&amp;nbsp;with varying &quot;ON&quot; times (the SPWM), the transformer &quot;sees&quot; an average voltage that looks like a sine wave.&lt;/p&gt;&lt;h3 style=&quot;text-align: left;&quot;&gt;Video Demonstraion&lt;/h3&gt;&lt;p&gt;The following video demonstrates how this &lt;a href=&quot;https://www.ee-diary.net/2025/07/arduino-spwm-inverter-circuit-diagram.html&quot;&gt;Arduino based SPWM Inverter circuit&lt;/a&gt; works. It shows charging and discharging of the MOSFET gate capacitance that reduces loss due to high frequency operation of the MOSFET by the totem pole driver.&lt;/p&gt;&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;&lt;iframe allowfullscreen=&quot;&quot; class=&quot;BLOG_video_class&quot; height=&quot;527&quot; src=&quot;https://www.youtube.com/embed/O6qKiChCzRM&quot; width=&quot;634&quot; youtube-src-id=&quot;O6qKiChCzRM&quot;&gt;&lt;/iframe&gt;&lt;/div&gt;&lt;br /&gt;&lt;p&gt;&lt;br /&gt;&lt;/p&gt;&lt;p&gt;&lt;b&gt;Related&lt;/b&gt;&lt;/p&gt;&lt;p&gt;&lt;/p&gt;&lt;ul style=&quot;text-align: left;&quot;&gt;&lt;li&gt;&lt;a href=&quot;https://www.ee-diary.net/2026/03/arduino-nano-pinout-explorer.html&quot;&gt;Arduino Nano Board Pinout Interactive Explorer&lt;/a&gt;&lt;/li&gt;&lt;li&gt;&lt;a href=&quot;https://www.ee-diary.net/2025/07/simple-inverter-with-arduino.html&quot;&gt;Simple Inverter with Arduino&lt;/a&gt;&lt;/li&gt;&lt;li&gt;&lt;a href=&quot;https://www.ee-diary.net/2024/12/how-to-build-inverter-with-arduino.html&quot;&gt;How to Build an Inverter with Arduino&lt;/a&gt;&lt;/li&gt;&lt;li&gt;&lt;a href=&quot;https://www.ee-diary.net/2021/11/test-Arduino-Fast-PWM-Signal-with-Matlab-Simulink.html&quot;&gt;How to test Arduino Fast PWM Signal with Matlab/Simulink&lt;/a&gt;&lt;/li&gt;&lt;/ul&gt;&lt;p&gt;&lt;/p&gt;</content><link rel='replies' type='application/atom+xml' href='http://www.ee-diary.net/feeds/221477628986179322/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.ee-diary.net/2026/04/how-to-build-pure-sine-wave-inverter.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7437986969318338216/posts/default/221477628986179322'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7437986969318338216/posts/default/221477628986179322'/><link rel='alternate' type='text/html' href='http://www.ee-diary.net/2026/04/how-to-build-pure-sine-wave-inverter.html' title='How to Build a Pure Sine Wave Inverter using Arduino SPWM'/><author><name>Unknown</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEj13tl1MrRqjvoF7EvwJx9oFPHR8US9cEkFCFJElTaAIwCb1_SY1WczJppJABW0BUSElSSmIfFsCe0qB-x5LLw6Cm4e5LFM1yGBRRt-TMfhlf-vLyRExx91XODvLt4wdJgqNUalLTMVpDSzUaza-R8Q2Xm_iTQOfrkmmOI20K77v3sdP7-4vZldXLj5ByQG/s72-c/arduino%20spwm%20inverter.png" height="72" width="72"/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-7437986969318338216.post-1897025549378342910</id><published>2026-04-03T20:06:00.003+05:45</published><updated>2026-04-03T20:06:42.111+05:45</updated><category scheme="http://www.blogger.com/atom/ns#" term="audio amplifier"/><title type='text'>What is Bootstrapped Emitter Follower: Real-World Audio Example</title><content type='html'>&lt;div class=&quot;separator&quot; style=&quot;display:none;&quot;&gt;&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhZ1oOcT0RTiEAECnq2KXQi3k3ziIp0atAici6OVhOFoLWwUY4vfX5vq9HNOde-8p8_bPYSf-UKwpiBrtq5D3WHWfA_YKdHq6HvlEKJXc4j1GH7VmhoHFViVI-GZvlWVGP8za9YuNeN4AWcTCRauZSQ0nPuJ49ZgISKMBeGTosF3xaelwdOYf36x7AmJnTq/s1600/Gemini_Generated_Image_uyl7dguyl7dguyl7.png&quot; style=&quot;display: block; padding: 1em 0; text-align: center; &quot;&gt;&lt;img alt=&quot;Bootstrapped Emitter Follower: Real-World Audio Example&quot; border=&quot;0&quot; data-original-height=&quot;768&quot; data-original-width=&quot;1376&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhZ1oOcT0RTiEAECnq2KXQi3k3ziIp0atAici6OVhOFoLWwUY4vfX5vq9HNOde-8p8_bPYSf-UKwpiBrtq5D3WHWfA_YKdHq6HvlEKJXc4j1GH7VmhoHFViVI-GZvlWVGP8za9YuNeN4AWcTCRauZSQ0nPuJ49ZgISKMBeGTosF3xaelwdOYf36x7AmJnTq/s1600/Gemini_Generated_Image_uyl7dguyl7dguyl7.png&quot;/&gt;&lt;/a&gt;&lt;/div&gt;
&lt;p&gt;&lt;span style=&quot;font-family: inherit;&quot;&gt;Here I redesigned the &lt;a href=&quot;https://www.ee-diary.net/2022/05/class-b-audio-power-amplifier.html&quot;&gt;class AB audio amplifier&lt;/a&gt; that I had posted many years ago.&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;font-family: inherit;&quot;&gt;In the original design, the microphone signal had to fight against the relatively low resistance of the biasing network. This often resulted in a muffled sound, lost treble, and a signal that was weak before it even reached the amplification stage. By adding the &lt;/span&gt;&lt;b data-index-in-node=&quot;262&quot; data-path-to-node=&quot;4&quot; style=&quot;font-family: inherit; line-height: 1.15 !important; margin-top: 0px !important;&quot;&gt;bootstrapped emitter follower &lt;span class=&quot;math-inline&quot; data-index-in-node=&quot;293&quot; data-math=&quot;Q_1&quot; style=&quot;line-height: 1.15 !important; margin-top: 0px !important;&quot;&gt;Q1&lt;/span&gt;&lt;/b&gt;&lt;span style=&quot;font-family: inherit;&quot;&gt;, we create an &#39;invisible&#39; bridge for the audio. Let&#39;s first look at the circuit diagram.&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;/p&gt;&lt;h3 style=&quot;text-align: left;&quot;&gt;&lt;span style=&quot;font-family: inherit;&quot;&gt;Circuit Diagram&lt;/span&gt;&lt;/h3&gt;&lt;p&gt;&lt;span style=&quot;font-family: inherit;&quot;&gt;Below is the circuit diagram.&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;/p&gt;&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiMDDOEkZ6F429NysS7d-u0kXyzeCh5vmqZx1E11jDgtVvxfo2W0UpRwl5Qo9rDqcE7bx5hRXFQ_JiFb2bY5yXitB2u7fmBiVGuZs6LFwamr7hyqbPH2EQe15CGKNCPPb1waalThWajwDVQyDdZE2ISui5APJNM9IYPRWnrlcC0u_fEgyvj_qmzkU60nkwZ/s1086/bootstrapped%20audio%20circuit%20with%20classAB%20amplifier.png&quot; imageanchor=&quot;1&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img alt=&quot;bootstrapped audio circuit with classAB amplifier&quot; border=&quot;0&quot; data-original-height=&quot;565&quot; data-original-width=&quot;1086&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiMDDOEkZ6F429NysS7d-u0kXyzeCh5vmqZx1E11jDgtVvxfo2W0UpRwl5Qo9rDqcE7bx5hRXFQ_JiFb2bY5yXitB2u7fmBiVGuZs6LFwamr7hyqbPH2EQe15CGKNCPPb1waalThWajwDVQyDdZE2ISui5APJNM9IYPRWnrlcC0u_fEgyvj_qmzkU60nkwZ/s16000/bootstrapped%20audio%20circuit%20with%20classAB%20amplifier.png&quot; title=&quot;bootstrapped audio circuit with classAB amplifier&quot; /&gt;&lt;/a&gt;&lt;/div&gt;&lt;span style=&quot;font-family: inherit;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;p&gt;&lt;/p&gt;&lt;p&gt;&lt;span style=&quot;font-family: inherit;&quot;&gt;&lt;b&gt;Bootstrap Circuit&lt;/b&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style=&quot;white-space-collapse: preserve;&quot;&gt;In the above schematic, the &lt;strong&gt;bootstrap circuit&lt;/strong&gt; is formed by the &lt;strong&gt;Q1 (the emitter follower transistor)&lt;/strong&gt; together with the &lt;strong&gt;bootstrap capacitor (C2)&lt;/strong&gt; and the biasing resistors &lt;strong&gt;R1 and R2&lt;/strong&gt;. The R1 and R2 provides the DC bis to the Q1 base. The BJT transistor Q2 buffers the audio signal from the microphone and the capacitor C2 connects emitter signal back the R1 and R2 junction. &lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;/p&gt;&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEi5MzorgReli3asIUlisnMbkBBP2QQZ4gHHI9kl2CXl5-cHheFpyIPURU5n21bythLG0UZT60B-58hq0p3cC1F2k__b_eZQFKDlPCCF1t8CuKU3jvMFQI7agLSmAtym0WJWuZGhQHpW6FhaXrPRHp5tfD92fr3j8JQtTAzJJkHGfmfT1wEE9ykYamURVPJW/s1086/bootstrap%20circuit.png&quot; imageanchor=&quot;1&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img alt=&quot;bootstrap circuit&quot; border=&quot;0&quot; data-original-height=&quot;565&quot; data-original-width=&quot;1086&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEi5MzorgReli3asIUlisnMbkBBP2QQZ4gHHI9kl2CXl5-cHheFpyIPURU5n21bythLG0UZT60B-58hq0p3cC1F2k__b_eZQFKDlPCCF1t8CuKU3jvMFQI7agLSmAtym0WJWuZGhQHpW6FhaXrPRHp5tfD92fr3j8JQtTAzJJkHGfmfT1wEE9ykYamURVPJW/s16000/bootstrap%20circuit.png&quot; title=&quot;bootstrap circuit&quot; /&gt;&lt;/a&gt;&lt;/div&gt;&lt;span style=&quot;white-space-collapse: preserve;&quot;&gt;&lt;p&gt;When the audio signal swings, C2 feeds part of the emitter voltage back into the bias divider. This makes the voltage across R1–R2 “follow” the signal, so from the microphone’s perspective those resistors appear to have a much higher impedance.&lt;/p&gt;&lt;/span&gt;&lt;p&gt;&lt;/p&gt;&lt;p&gt;&lt;span style=&quot;font-family: inherit;&quot;&gt;To clarify, the microphone is a high impedance source. It produces voltage signal but little current. Without the bootstrap circuit, the microphone or the source sees the 100KOhm load formed by the biasing resistors R1 and R2. The microphone or source tries to drive that load but fails and the result is drop of signal volume and loss of high frequency details of the audio signal coming from the microphone. So, this is impedance mismatch problem.&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style=&quot;font-family: inherit;&quot;&gt;The solution to impedance mismatch is to use the bootstrap circuit. The bootstrap capacitor C2 feeds back the signal back to the junction of the biasing resistors R1 and R2. T&lt;/span&gt;he voltage on both sides of the resistor moves together. Since there is almost no voltage &lt;i data-index-in-node=&quot;182&quot; data-path-to-node=&quot;11,1,0&quot;&gt;difference&lt;/i&gt; across the resistor, almost no current flows. The result is the audio source, microphone, sees and input impedance of 1Mohm or more. The result is no or less loss of signal energy and no loss of frequency content of the audio signal and audio without muffled sound; lost treble is produced.&amp;nbsp;&lt;/p&gt;&lt;p&gt;&lt;span style=&quot;font-family: inherit;&quot;&gt;The following video shows via simulation how the bootstrapping circuit works.&lt;/span&gt;&lt;/p&gt;&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;&lt;iframe allowfullscreen=&quot;&quot; class=&quot;BLOG_video_class&quot; height=&quot;444&quot; src=&quot;https://www.youtube.com/embed/2HCHhTqdOQA&quot; width=&quot;534&quot; youtube-src-id=&quot;2HCHhTqdOQA&quot;&gt;&lt;/iframe&gt;&lt;/div&gt;&lt;p&gt;In the video, we revisit a classic Class AB audio amplifier design and show how adding a &lt;strong&gt;bootstrapped emitter follower&lt;/strong&gt; dramatically improves sound quality.&lt;/p&gt;&lt;p&gt;&lt;b&gt;Related articles&lt;/b&gt;:&lt;/p&gt;&lt;ul style=&quot;text-align: left;&quot;&gt;&lt;li&gt;&lt;a href=&quot;https://www.ee-diary.net/2021/11/how-to-make-electret-microphone.html&quot;&gt;How to make electret microphone amplifier using LM358&lt;/a&gt;&lt;/li&gt;&lt;li&gt;&lt;a href=&quot;https://www.ee-diary.net/2021/12/3w-audio-amplifier-with-lm741-op-amp.html&quot;&gt;3W Audio Amplifier with lm741 op amp&lt;/a&gt;&lt;/li&gt;&lt;li&gt;&lt;a href=&quot;https://www.ee-diary.net/2023/01/Efficient-Powerful-Audio-Amplifier-LM741-LM386.html&quot;&gt;Efficient and Powerful Audio Amplifier with LM741 and LM386&lt;/a&gt;&lt;/li&gt;&lt;li&gt;&lt;a href=&quot;https://www.ee-diary.net/2022/06/diy-class-ab-power-amplifier-with-ce.html&quot;&gt;DIY Class AB Power Amplifier with CE Driver&lt;/a&gt;&lt;/li&gt;&lt;li&gt;&lt;a href=&quot;https://www.ee-diary.net/2026/03/designing-high-performance-diy-class-ab.html&quot;&gt;Designing a High-Performance DIY Class AB Audio Amplifier&lt;/a&gt;&lt;/li&gt;&lt;li&gt;&lt;a href=&quot;https://www.ee-diary.net/2021/11/audio-amplifier-design-with-ua741-op-amp.html&quot;&gt;Audio Amplifier design with uA741 op-amp&lt;/a&gt;&lt;/li&gt;&lt;/ul&gt;&lt;p&gt;&lt;/p&gt;&lt;p&gt;&lt;span style=&quot;font-family: inherit;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;</content><link rel='replies' type='application/atom+xml' href='http://www.ee-diary.net/feeds/1897025549378342910/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.ee-diary.net/2026/04/what-is-bootstrapped-emitter-follower.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7437986969318338216/posts/default/1897025549378342910'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7437986969318338216/posts/default/1897025549378342910'/><link rel='alternate' type='text/html' href='http://www.ee-diary.net/2026/04/what-is-bootstrapped-emitter-follower.html' title='What is Bootstrapped Emitter Follower: Real-World Audio Example'/><author><name>Unknown</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhZ1oOcT0RTiEAECnq2KXQi3k3ziIp0atAici6OVhOFoLWwUY4vfX5vq9HNOde-8p8_bPYSf-UKwpiBrtq5D3WHWfA_YKdHq6HvlEKJXc4j1GH7VmhoHFViVI-GZvlWVGP8za9YuNeN4AWcTCRauZSQ0nPuJ49ZgISKMBeGTosF3xaelwdOYf36x7AmJnTq/s72-c/Gemini_Generated_Image_uyl7dguyl7dguyl7.png" height="72" width="72"/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-7437986969318338216.post-2190719370906195009</id><published>2026-04-03T09:58:00.002+05:45</published><updated>2026-04-03T10:18:33.655+05:45</updated><category scheme="http://www.blogger.com/atom/ns#" term="74HC595"/><category scheme="http://www.blogger.com/atom/ns#" term="ATtiny13"/><category scheme="http://www.blogger.com/atom/ns#" term="AVR"/><title type='text'>How to Expand ATtiny13 Outputs with 74HC595 Shift Register</title><content type='html'>&lt;div class=&quot;separator&quot; style=&quot;display: none;&quot;&gt;&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjPshv_pdrFX440Ce_97vNs4H15s5t_EhGiH8nJdyYE4qnrq-jnU4qy9lk0FQt-NM3JeJU7zDyzJwHRo-nbX42JlIIlDtGKLwlY4KxYPp3Ys1VK5hZRWW-BV9qIexO0tOnENQ4Z4yIT1F3pLEI7xa2vbCF19x4vRZNjwEgahomtFCN5V2UP0lnB7vVPcLeL/s1600/Gemini_Generated_Image_pbet92pbet92pbet.png&quot; style=&quot;display: block; padding: 1em 0px; text-align: center;&quot;&gt;&lt;img alt=&quot;&quot; border=&quot;0&quot; data-original-height=&quot;768&quot; data-original-width=&quot;1376&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjPshv_pdrFX440Ce_97vNs4H15s5t_EhGiH8nJdyYE4qnrq-jnU4qy9lk0FQt-NM3JeJU7zDyzJwHRo-nbX42JlIIlDtGKLwlY4KxYPp3Ys1VK5hZRWW-BV9qIexO0tOnENQ4Z4yIT1F3pLEI7xa2vbCF19x4vRZNjwEgahomtFCN5V2UP0lnB7vVPcLeL/s1600/Gemini_Generated_Image_pbet92pbet92pbet.png&quot; /&gt;&lt;/a&gt;&lt;/div&gt;
&lt;p&gt;&amp;nbsp;Attiny13 microcontroller have many unique advantage- low price, small size, versatile functionalities. Although it has small memory size or flash memory, it can be used in sensor and automation circuits. Some of the functionalities it has includes timers, external and interrupt support, PWM, SPI, ADC etc. but it lacks USART/UART hardware support. I used the&amp;nbsp;&lt;a href=&quot;https://www.ee-diary.net/2026/03/attiny13-dip-8-explorer-free.html&quot;&gt;Atiny13 IC pinout explorer&lt;/a&gt;&amp;nbsp;and &lt;a href=&quot;https://www.ee-diary.net/2026/03/74hc595-interactive-chip-explorer_01403954561.html&quot;&gt;74HC595 IC pinout explorer&lt;/a&gt;, datasheet alternative free web tool,&amp;nbsp;to know pins functions and capabilities instantly. But as soon as one begins working with it problems start to emerge. The main limitations of Attiny13 MCU is the flash memory size and the I/O pins. Limited flash memory means, many of the Arduino libraries cannot be used. Many of the short coming can be handled such as for USART, we can implement serial communication via software. Other short coming like the flash memory size and limited I/O pins can be addressed too. For memory one can use &lt;a href=&quot;https://www.ee-diary.net/2022/11/how-to-read-write-external-eeprom-with.html&quot;&gt;external EEPROM IC&lt;/a&gt;.&amp;nbsp;&lt;/p&gt;&lt;p&gt;Here I wanted to show my experiment with the ATtiny13 and the 74HC595 shift register to expand its output capability and increase the number of controllable pins. Since the ATtiny13 provides only six I/O pins, it quickly reaches its limit when driving multiple devices. The 74HC595, a serial‑to‑parallel converter, can be controlled using just three signals: data, clock, and latch. By dedicating three of the ATtiny13’s pins to these signals, the microcontroller can drive eight outputs through the shift register. In other words, although we sacrifice three pins to control the 74HC595, we gain eight additional outputs — a net expansion that makes the tiny ATtiny13 far more versatile in practical applications.&lt;/p&gt;&lt;h3&gt;Circuit Diagram&lt;/h3&gt;&lt;p&gt;Shown below is the circuit diagram to connect 74HC595 with Attiny13 to increase output capability.&lt;/p&gt;&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgx3d_V31zpQvOA5x09-JnXYTPss_oJ60XSvxSl2MxqtNgek8F164cJ-HgRkQORvGGtv8yptIUg1mxnFXVVq0WteKXKHLj3A2d1EqI0pORztDdxDhZ8ro9xWm4sCglW72Xi7xaEbUtdM9U1nyCc2zEVM_FYxNMFwapyzo9EC5guKZGr__dJ62CTwgIg98JV/s737/attiny13%20with%2074hc595%20circuit%20diagram.png&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img alt=&quot;attiny13 with 74hc595 circuit diagram&quot; border=&quot;0&quot; data-original-height=&quot;469&quot; data-original-width=&quot;737&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgx3d_V31zpQvOA5x09-JnXYTPss_oJ60XSvxSl2MxqtNgek8F164cJ-HgRkQORvGGtv8yptIUg1mxnFXVVq0WteKXKHLj3A2d1EqI0pORztDdxDhZ8ro9xWm4sCglW72Xi7xaEbUtdM9U1nyCc2zEVM_FYxNMFwapyzo9EC5guKZGr__dJ62CTwgIg98JV/s16000/attiny13%20with%2074hc595%20circuit%20diagram.png&quot; title=&quot;attiny13 with 74hc595 circuit diagram&quot; /&gt;&lt;/a&gt;&lt;/div&gt;&lt;p&gt;&lt;span face=&quot;&amp;quot;Google Sans Text&amp;quot;, sans-serif&quot;&gt;The circuit is a&amp;nbsp;&lt;/span&gt;&lt;b data-index-in-node=&quot;17&quot; data-path-to-node=&quot;0&quot; style=&quot;font-family: &amp;quot;Google Sans Text&amp;quot;, sans-serif; line-height: 1.15; margin-top: 0px;&quot;&gt;Serial-to-Parallel Output Expansion&lt;/b&gt;&lt;span face=&quot;&amp;quot;Google Sans Text&amp;quot;, sans-serif&quot;&gt;&amp;nbsp;system. It allows the ATtiny13 (which has very few pins) to control 8 separate outputs (though only 4 are used here) using only 3 digital lines.&lt;/span&gt;&lt;/p&gt;&lt;hr data-path-to-node=&quot;1&quot; style=&quot;font-family: &amp;quot;Google Sans Text&amp;quot;, sans-serif; line-height: 1.15; margin-top: 0px;&quot; /&gt;&lt;h4 style=&quot;font-family: &amp;quot;Google Sans&amp;quot;, sans-serif; line-height: 1.15; margin-top: 0px;&quot;&gt;1. The Controller: ATtiny13 (U1)&lt;/h4&gt;&lt;p data-path-to-node=&quot;3&quot; style=&quot;font-family: &amp;quot;Google Sans Text&amp;quot;, sans-serif; line-height: 1.15; margin-top: 0px;&quot;&gt;The ATtiny13 acts as the &quot;brain.&quot; It manages two distinct tasks:&lt;/p&gt;&lt;ul data-path-to-node=&quot;4&quot; style=&quot;font-family: &amp;quot;Google Sans Text&amp;quot;, sans-serif; line-height: 1.15; margin-top: 0px; padding-inline-start: 32px;&quot;&gt;&lt;li style=&quot;line-height: 1.15; margin-top: 0px;&quot;&gt;&lt;p data-path-to-node=&quot;4,0,0&quot; style=&quot;line-height: 1.15; margin-top: 0px;&quot;&gt;&lt;b data-index-in-node=&quot;0&quot; data-path-to-node=&quot;4,0,0&quot; style=&quot;line-height: 1.15; margin-top: 0px;&quot;&gt;Input Sensing:&lt;/b&gt;&amp;nbsp;Pins&amp;nbsp;&lt;b data-index-in-node=&quot;20&quot; data-path-to-node=&quot;4,0,0&quot; style=&quot;line-height: 1.15; margin-top: 0px;&quot;&gt;PB3 (3)&lt;/b&gt;&amp;nbsp;and&amp;nbsp;&lt;b data-index-in-node=&quot;32&quot; data-path-to-node=&quot;4,0,0&quot; style=&quot;line-height: 1.15; margin-top: 0px;&quot;&gt;PB4 (4)&lt;/b&gt;&amp;nbsp;are connected to tactile buttons. These buttons are wired to&amp;nbsp;&lt;b data-index-in-node=&quot;101&quot; data-path-to-node=&quot;4,0,0&quot; style=&quot;line-height: 1.15; margin-top: 0px;&quot;&gt;Ground (GND)&lt;/b&gt;. When a button is pressed, it completes the circuit, pulling the voltage on that pin to 0V.&lt;/p&gt;&lt;/li&gt;&lt;li style=&quot;line-height: 1.15; margin-top: 0px;&quot;&gt;&lt;p data-path-to-node=&quot;4,1,0&quot; style=&quot;line-height: 1.15; margin-top: 0px;&quot;&gt;&lt;b data-index-in-node=&quot;0&quot; data-path-to-node=&quot;4,1,0&quot; style=&quot;line-height: 1.15; margin-top: 0px;&quot;&gt;Serial Communication:&lt;/b&gt;&amp;nbsp;Pins&amp;nbsp;&lt;b data-index-in-node=&quot;27&quot; data-path-to-node=&quot;4,1,0&quot; style=&quot;line-height: 1.15; margin-top: 0px;&quot;&gt;PB0 (5)&lt;/b&gt;,&amp;nbsp;&lt;b data-index-in-node=&quot;36&quot; data-path-to-node=&quot;4,1,0&quot; style=&quot;line-height: 1.15; margin-top: 0px;&quot;&gt;PB1 (6)&lt;/b&gt;, and&amp;nbsp;&lt;b data-index-in-node=&quot;49&quot; data-path-to-node=&quot;4,1,0&quot; style=&quot;line-height: 1.15; margin-top: 0px;&quot;&gt;PB2 (7)&lt;/b&gt;&amp;nbsp;are used as the control bus for the shift register.&lt;/p&gt;&lt;/li&gt;&lt;/ul&gt;&lt;h4 style=&quot;font-family: &amp;quot;Google Sans&amp;quot;, sans-serif; line-height: 1.15; margin-top: 0px;&quot;&gt;2. The Expander: 74HC595 (U2)&lt;/h4&gt;&lt;p data-path-to-node=&quot;6&quot; style=&quot;font-family: &amp;quot;Google Sans Text&amp;quot;, sans-serif; line-height: 1.15; margin-top: 0px;&quot;&gt;This IC is an 8-bit shift register. It takes data in &quot;serial&quot; (one bit at a time) and outputs it in &quot;parallel&quot; (all 8 bits at once).&lt;/p&gt;&lt;p style=&quot;font-family: &amp;quot;Google Sans&amp;quot;, sans-serif; line-height: 1.15; margin-top: 0px;&quot;&gt;&lt;b data-index-in-node=&quot;0&quot; data-path-to-node=&quot;7&quot; style=&quot;font-family: &amp;quot;Google Sans Text&amp;quot;, sans-serif; line-height: 1.15; margin-top: 0px;&quot;&gt;Control Interface (The Input Side)&lt;/b&gt;&lt;/p&gt;&lt;ul data-path-to-node=&quot;8&quot; style=&quot;font-family: &amp;quot;Google Sans Text&amp;quot;, sans-serif; line-height: 1.15; margin-top: 0px; padding-inline-start: 32px;&quot;&gt;&lt;li style=&quot;line-height: 1.15; margin-top: 0px;&quot;&gt;&lt;p data-path-to-node=&quot;8,0,0&quot; style=&quot;line-height: 1.15; margin-top: 0px;&quot;&gt;&lt;b data-index-in-node=&quot;0&quot; data-path-to-node=&quot;8,0,0&quot; style=&quot;line-height: 1.15; margin-top: 0px;&quot;&gt;DS (Pin 14 - Data):&lt;/b&gt;&amp;nbsp;This receives the 1s and 0s from the ATtiny13.&lt;/p&gt;&lt;/li&gt;&lt;li style=&quot;line-height: 1.15; margin-top: 0px;&quot;&gt;&lt;p data-path-to-node=&quot;8,1,0&quot; style=&quot;line-height: 1.15; margin-top: 0px;&quot;&gt;&lt;b data-index-in-node=&quot;0&quot; data-path-to-node=&quot;8,1,0&quot; style=&quot;line-height: 1.15; margin-top: 0px;&quot;&gt;SH_CP (Pin 11 - Shift Clock):&lt;/b&gt;&amp;nbsp;Every time this pin pulses, the 74HC595 &quot;shifts&quot; the bit currently on the Data pin into its internal memory.&lt;/p&gt;&lt;/li&gt;&lt;li style=&quot;line-height: 1.15; margin-top: 0px;&quot;&gt;&lt;p data-path-to-node=&quot;8,2,0&quot; style=&quot;line-height: 1.15; margin-top: 0px;&quot;&gt;&lt;b data-index-in-node=&quot;0&quot; data-path-to-node=&quot;8,2,0&quot; style=&quot;line-height: 1.15; margin-top: 0px;&quot;&gt;ST_CP (Pin 12 - Latch/Storage Clock):&lt;/b&gt;&amp;nbsp;Once all bits are shifted in, a pulse on this pin &quot;latches&quot; the data, making it appear on the output pins (Q0–Q7) simultaneously.&lt;/p&gt;&lt;/li&gt;&lt;/ul&gt;&lt;h4 style=&quot;font-family: &amp;quot;Google Sans&amp;quot;, sans-serif; line-height: 1.15; margin-top: 0px;&quot;&gt;&lt;b data-index-in-node=&quot;0&quot; data-path-to-node=&quot;9&quot; style=&quot;font-family: &amp;quot;Google Sans Text&amp;quot;, sans-serif; line-height: 1.15; margin-top: 0px;&quot;&gt;Configuration Pins&lt;/b&gt;&lt;/h4&gt;&lt;ul data-path-to-node=&quot;10&quot; style=&quot;font-family: &amp;quot;Google Sans Text&amp;quot;, sans-serif; line-height: 1.15; margin-top: 0px; padding-inline-start: 32px;&quot;&gt;&lt;li style=&quot;line-height: 1.15; margin-top: 0px;&quot;&gt;&lt;p data-path-to-node=&quot;10,0,0&quot; style=&quot;line-height: 1.15; margin-top: 0px;&quot;&gt;&lt;b data-index-in-node=&quot;0&quot; data-path-to-node=&quot;10,0,0&quot; style=&quot;line-height: 1.15; margin-top: 0px;&quot;&gt;VCC (16) &amp;amp; GND (8):&lt;/b&gt;&amp;nbsp;Power supply (typically 5V).&lt;/p&gt;&lt;/li&gt;&lt;li style=&quot;line-height: 1.15; margin-top: 0px;&quot;&gt;&lt;p data-path-to-node=&quot;10,1,0&quot; style=&quot;line-height: 1.15; margin-top: 0px;&quot;&gt;&lt;b data-index-in-node=&quot;0&quot; data-path-to-node=&quot;10,1,0&quot; style=&quot;line-height: 1.15; margin-top: 0px;&quot;&gt;OE (Pin 13 - Output Enable):&lt;/b&gt;&amp;nbsp;Tied to&amp;nbsp;&lt;b data-index-in-node=&quot;37&quot; data-path-to-node=&quot;10,1,0&quot; style=&quot;line-height: 1.15; margin-top: 0px;&quot;&gt;GND&lt;/b&gt;. This ensures the outputs are always active.&lt;/p&gt;&lt;/li&gt;&lt;li style=&quot;line-height: 1.15; margin-top: 0px;&quot;&gt;&lt;p data-path-to-node=&quot;10,2,0&quot; style=&quot;line-height: 1.15; margin-top: 0px;&quot;&gt;&lt;b data-index-in-node=&quot;0&quot; data-path-to-node=&quot;10,2,0&quot; style=&quot;line-height: 1.15; margin-top: 0px;&quot;&gt;MR (Pin 10 - Master Reset):&lt;/b&gt;&amp;nbsp;Tied to&amp;nbsp;&lt;b data-index-in-node=&quot;36&quot; data-path-to-node=&quot;10,2,0&quot; style=&quot;line-height: 1.15; margin-top: 0px;&quot;&gt;VCC&lt;/b&gt;. This prevents the chip from clearing its memory unexpectedly.&lt;/p&gt;&lt;/li&gt;&lt;/ul&gt;&lt;hr data-path-to-node=&quot;11&quot; style=&quot;font-family: &amp;quot;Google Sans Text&amp;quot;, sans-serif; line-height: 1.15; margin-top: 0px;&quot; /&gt;&lt;h4 style=&quot;font-family: &amp;quot;Google Sans&amp;quot;, sans-serif; line-height: 1.15; margin-top: 0px;&quot;&gt;3. The Load: LEDs (D1–D4)&lt;/h4&gt;&lt;p data-path-to-node=&quot;13&quot; style=&quot;font-family: &amp;quot;Google Sans Text&amp;quot;, sans-serif; line-height: 1.15; margin-top: 0px;&quot;&gt;The LEDs represent the devices being controlled.&lt;/p&gt;&lt;ul data-path-to-node=&quot;14&quot; style=&quot;font-family: &amp;quot;Google Sans Text&amp;quot;, sans-serif; line-height: 1.15; margin-top: 0px; padding-inline-start: 32px;&quot;&gt;&lt;li style=&quot;line-height: 1.15; margin-top: 0px;&quot;&gt;&lt;p data-path-to-node=&quot;14,0,0&quot; style=&quot;line-height: 1.15; margin-top: 0px;&quot;&gt;&lt;b data-index-in-node=&quot;0&quot; data-path-to-node=&quot;14,0,0&quot; style=&quot;line-height: 1.15; margin-top: 0px;&quot;&gt;Connection:&lt;/b&gt;&amp;nbsp;They are connected to outputs&amp;nbsp;&lt;b data-index-in-node=&quot;42&quot; data-path-to-node=&quot;14,0,0&quot; style=&quot;line-height: 1.15; margin-top: 0px;&quot;&gt;Q1, Q2, Q3, and Q4&lt;/b&gt;&amp;nbsp;(Pins 1, 2, 3, and 4).&lt;/p&gt;&lt;/li&gt;&lt;li style=&quot;line-height: 1.15; margin-top: 0px;&quot;&gt;&lt;p data-path-to-node=&quot;14,1,0&quot; style=&quot;line-height: 1.15; margin-top: 0px;&quot;&gt;&lt;b data-index-in-node=&quot;0&quot; data-path-to-node=&quot;14,1,0&quot; style=&quot;line-height: 1.15; margin-top: 0px;&quot;&gt;Current Limiting:&lt;/b&gt;&amp;nbsp;Each LED has a&amp;nbsp;&lt;b data-index-in-node=&quot;33&quot; data-path-to-node=&quot;14,1,0&quot; style=&quot;line-height: 1.15; margin-top: 0px;&quot;&gt;270Ω resistor (R1–R4)&lt;/b&gt;&amp;nbsp;in series. This is critical to prevent the LEDs and the 74HC595 from drawing too much current and burning out.&lt;/p&gt;&lt;/li&gt;&lt;li style=&quot;line-height: 1.15; margin-top: 0px;&quot;&gt;&lt;p data-path-to-node=&quot;14,2,0&quot; style=&quot;line-height: 1.15; margin-top: 0px;&quot;&gt;&lt;b data-index-in-node=&quot;0&quot; data-path-to-node=&quot;14,2,0&quot; style=&quot;line-height: 1.15; margin-top: 0px;&quot;&gt;Common Ground:&lt;/b&gt;&amp;nbsp;The cathodes (short legs) of all LEDs are tied to the common Ground rail.&lt;/p&gt;&lt;/li&gt;&lt;/ul&gt;&lt;hr data-path-to-node=&quot;15&quot; style=&quot;font-family: &amp;quot;Google Sans Text&amp;quot;, sans-serif; line-height: 1.15; margin-top: 0px;&quot; /&gt;&lt;h4 style=&quot;font-family: &amp;quot;Google Sans&amp;quot;, sans-serif; line-height: 1.15; margin-top: 0px;&quot;&gt;4. Signal Flow Summary&lt;/h4&gt;&lt;ol data-path-to-node=&quot;17&quot; start=&quot;1&quot; style=&quot;font-family: &amp;quot;Google Sans Text&amp;quot;, sans-serif; line-height: 1.15; margin-top: 0px; padding-inline-start: 32px; text-align: left;&quot;&gt;&lt;li&gt;&lt;b data-index-in-node=&quot;0&quot; data-path-to-node=&quot;17,0,0&quot; style=&quot;font-family: &amp;quot;Google Sans Text&amp;quot;, sans-serif; line-height: 1.15; margin-top: 0px;&quot;&gt;Input:&lt;/b&gt;&lt;span face=&quot;&amp;quot;Google Sans Text&amp;quot;, sans-serif&quot;&gt;&amp;nbsp;You press a button connected to&amp;nbsp;&lt;/span&gt;&lt;b data-index-in-node=&quot;39&quot; data-path-to-node=&quot;17,0,0&quot; style=&quot;font-family: &amp;quot;Google Sans Text&amp;quot;, sans-serif; line-height: 1.15; margin-top: 0px;&quot;&gt;PB3&lt;/b&gt;&lt;span face=&quot;&amp;quot;Google Sans Text&amp;quot;, sans-serif&quot;&gt;&amp;nbsp;or&amp;nbsp;&lt;/span&gt;&lt;b data-index-in-node=&quot;46&quot; data-path-to-node=&quot;17,0,0&quot; style=&quot;font-family: &amp;quot;Google Sans Text&amp;quot;, sans-serif; line-height: 1.15; margin-top: 0px;&quot;&gt;PB4&lt;/b&gt;&lt;span face=&quot;&amp;quot;Google Sans Text&amp;quot;, sans-serif&quot;&gt;.&lt;/span&gt;&lt;/li&gt;&lt;li&gt;&lt;b data-index-in-node=&quot;0&quot; data-path-to-node=&quot;17,1,0&quot; style=&quot;line-height: 1.15; margin-top: 0px;&quot;&gt;Processing:&lt;/b&gt;&amp;nbsp;The ATtiny13 detects the Ground signal and decides which LED should be on.&lt;/li&gt;&lt;li&gt;&lt;b data-index-in-node=&quot;0&quot; data-path-to-node=&quot;17,2,0&quot; style=&quot;line-height: 1.15; margin-top: 0px;&quot;&gt;Transmission:&lt;/b&gt;&amp;nbsp;The ATtiny13 sends a sequence of pulses (Data and Clock) to the 74HC595.&lt;/li&gt;&lt;li&gt;&lt;b data-index-in-node=&quot;0&quot; data-path-to-node=&quot;17,3,0&quot; style=&quot;line-height: 1.15; margin-top: 0px;&quot;&gt;Output:&lt;/b&gt;&amp;nbsp;The 74HC595 &quot;latches&quot; that data, and the corresponding pin (&lt;span class=&quot;math-inline&quot; data-index-in-node=&quot;68&quot; data-math=&quot;Q_1&quot; style=&quot;line-height: 1.15; margin-top: 0px;&quot;&gt;$Q_1$&lt;/span&gt;–&lt;span class=&quot;math-inline&quot; data-index-in-node=&quot;72&quot; data-math=&quot;Q_4&quot; style=&quot;line-height: 1.15; margin-top: 0px;&quot;&gt;$Q_4$&lt;/span&gt;) goes High (5V), pushing current through the resistor and lighting the LED.&lt;/li&gt;&lt;/ol&gt;&lt;p&gt;&lt;span face=&quot;&amp;quot;Google Sans Text&amp;quot;, sans-serif&quot;&gt;You can see that the Q0&lt;/span&gt;&lt;span face=&quot;&amp;quot;Google Sans Text&amp;quot;, sans-serif&quot;&gt;&amp;nbsp;(Pin 15) and&amp;nbsp;&lt;/span&gt;&lt;span class=&quot;math-inline&quot; data-index-in-node=&quot;23&quot; data-math=&quot;Q_5&quot; face=&quot;&amp;quot;Google Sans Text&amp;quot;, sans-serif&quot; style=&quot;line-height: 1.15; margin-top: 0px;&quot;&gt;Q5&lt;/span&gt;&lt;span face=&quot;&amp;quot;Google Sans Text&amp;quot;, sans-serif&quot;&gt;–&lt;/span&gt;&lt;span class=&quot;math-inline&quot; data-index-in-node=&quot;27&quot; data-math=&quot;Q_7&quot; face=&quot;&amp;quot;Google Sans Text&amp;quot;, sans-serif&quot; style=&quot;line-height: 1.15; margin-top: 0px;&quot;&gt;Q7&lt;/span&gt;&lt;span face=&quot;&amp;quot;Google Sans Text&amp;quot;, sans-serif&quot;&gt;&amp;nbsp;are currently unused in this diagram, so one could use them to control 4 additional LEDs or components without needing any extra pins from the ATtiny13.&lt;/span&gt;&lt;/p&gt;&lt;div&gt;&lt;h3&gt;&lt;span face=&quot;Google Sans Text, sans-serif&quot;&gt;Program Code&lt;/span&gt;&lt;/h3&gt;&lt;div&gt;The program code to achieve this is below.&lt;/div&gt;&lt;div&gt;&lt;span face=&quot;Google Sans Text, sans-serif&quot;&gt;&lt;pre lang=&quot;cpp&quot;&gt;&lt;code&gt;#include &amp;lt;avr/io.h&amp;gt;
#include &amp;lt;util/delay.h&amp;gt;

// Pin definitions
#define DS   PB0   // Data (Pin 14 on 595)
#define STCP PB1   // Latch (Pin 12 on 595)
#define SHCP PB2   // Clock (Pin 11 on 595)

// Helper to pulse the clock
void pulseClock() {
    PORTB |= (1 &amp;lt;&amp;lt; SHCP);
    _delay_us(5);
    PORTB &amp;amp;= ~(1 &amp;lt;&amp;lt; SHCP);
}

// Helper to pulse the latch
void pulseLatch() {
    PORTB |= (1 &amp;lt;&amp;lt; STCP);
    _delay_us(5);
    PORTB &amp;amp;= ~(1 &amp;lt;&amp;lt; STCP);
}

// Shift out 8-bit data (C90 compatible)
void shiftOut(unsigned char data) {
    signed char i;
    for (i = 7; i &amp;gt;= 0; i--) {
        if (data &amp;amp; (1 &amp;lt;&amp;lt; i))
            PORTB |= (1 &amp;lt;&amp;lt; DS);
        else
            PORTB &amp;amp;= ~(1 &amp;lt;&amp;lt; DS);

        pulseClock();
    }
}

void sendData(unsigned char data) {
    shiftOut(data);
    pulseLatch();
}

int main(void) {
    // Set PB0, PB1, PB2 as outputs
    DDRB |= (1 &amp;lt;&amp;lt; DS) | (1 &amp;lt;&amp;lt; STCP) | (1 &amp;lt;&amp;lt; SHCP);

    // Set PB3, PB4 as inputs
    DDRB &amp;amp;= ~((1 &amp;lt;&amp;lt; PB3) | (1 &amp;lt;&amp;lt; PB4));

    // Enable internal pull-ups for the buttons
    PORTB |= (1 &amp;lt;&amp;lt; PB3) | (1 &amp;lt;&amp;lt; PB4);

    unsigned char input;
    unsigned char ledData;

    while (1) {
        input = 0;

        // Read buttons (Inverted logic: 0 when pressed)
        if (!(PINB &amp;amp; (1 &amp;lt;&amp;lt; PB3))) input |= (1 &amp;lt;&amp;lt; 0);
        if (!(PINB &amp;amp; (1 &amp;lt;&amp;lt; PB4))) input |= (1 &amp;lt;&amp;lt; 1);

        // Logic adjusted for LEDs on Q1, Q2, Q3, Q4
        switch (input) {
            case 0: // No buttons pressed
                ledData = 0b00000010; // Q1 (D1)
                break;

            case 1: // PB3 pressed
                ledData = 0b00000100; // Q2 (D2)
                break;

            case 2: // PB4 pressed
                ledData = 0b00001000; // Q3 (D3)
                break;

            case 3: // Both pressed
                ledData = 0b00010000; // Q4 (D4)
                break;

            default:
                ledData = 0x00;
                break;
        }

        sendData(ledData);
        _delay_ms(50); // Debounce delay
    }

    return 0;
}
&lt;/code&gt;&lt;/pre&gt;&lt;div&gt;&lt;span face=&quot;Google Sans Text, sans-serif&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;The program works are follows: The program manages&amp;nbsp;&lt;b data-index-in-node=&quot;20&quot; data-path-to-node=&quot;0&quot; style=&quot;font-family: &amp;quot;Google Sans Text&amp;quot;, sans-serif; line-height: 1.15; margin-top: 0px;&quot;&gt;I/O expansion&lt;/b&gt;&amp;nbsp;by using a &quot;bit-banging&quot; serial protocol to communicate with the 74HC595 shift register. After initializing the control pins as outputs and the button pins as inputs with&amp;nbsp;&lt;b data-index-in-node=&quot;205&quot; data-path-to-node=&quot;0&quot; style=&quot;font-family: &amp;quot;Google Sans Text&amp;quot;, sans-serif; line-height: 1.15; margin-top: 0px;&quot;&gt;internal pull-up resistors&lt;/b&gt;, the main loop constantly monitors the state of PB3 and PB4; because these pins are pulled high by default, the code uses&amp;nbsp;&lt;b data-index-in-node=&quot;354&quot; data-path-to-node=&quot;0&quot; style=&quot;font-family: &amp;quot;Google Sans Text&amp;quot;, sans-serif; line-height: 1.15; margin-top: 0px;&quot;&gt;inverted logic&lt;/b&gt;&amp;nbsp;to detect a button press when a pin is grounded. Based on the combination of buttons pressed, a&amp;nbsp;&lt;code data-index-in-node=&quot;465&quot; data-path-to-node=&quot;0&quot; style=&quot;font-family: &amp;quot;Google Sans Text&amp;quot;, sans-serif; line-height: 1.15; margin-top: 0px;&quot;&gt;switch&lt;/code&gt;&amp;nbsp;statement assigns a specific bit pattern to the&amp;nbsp;&lt;code data-index-in-node=&quot;520&quot; data-path-to-node=&quot;0&quot; style=&quot;font-family: &amp;quot;Google Sans Text&amp;quot;, sans-serif; line-height: 1.15; margin-top: 0px;&quot;&gt;ledData&lt;/code&gt;&amp;nbsp;variable, which is then passed to the&amp;nbsp;&lt;code data-index-in-node=&quot;566&quot; data-path-to-node=&quot;0&quot; style=&quot;font-family: &amp;quot;Google Sans Text&amp;quot;, sans-serif; line-height: 1.15; margin-top: 0px;&quot;&gt;shiftOut&lt;/code&gt;&amp;nbsp;function. This function iterates through each bit of the byte, setting the Data Serial (DS) pin accordingly and pulsing the Shift Clock (SHCP) to move the bit into the register. Finally, a pulse to the Storage Clock (STCP)&amp;nbsp;&lt;b data-index-in-node=&quot;798&quot; data-path-to-node=&quot;0&quot; style=&quot;font-family: &amp;quot;Google Sans Text&amp;quot;, sans-serif; line-height: 1.15; margin-top: 0px;&quot;&gt;latches&lt;/b&gt;&amp;nbsp;the completed byte to the 74HC595&#39;s output pins (&lt;span class=&quot;math-inline&quot; data-index-in-node=&quot;855&quot; data-math=&quot;Q_0&quot; face=&quot;&amp;quot;Google Sans Text&amp;quot;, sans-serif !important&quot; style=&quot;line-height: 1.15; margin-top: 0px;&quot;&gt;$Q_0$&lt;/span&gt;–&lt;span class=&quot;math-inline&quot; data-index-in-node=&quot;859&quot; data-math=&quot;Q_7&quot; face=&quot;&amp;quot;Google Sans Text&amp;quot;, sans-serif !important&quot; style=&quot;line-height: 1.15; margin-top: 0px;&quot;&gt;$Q_7$&lt;/span&gt;), updating the LEDs to reflect the current button state while a small delay provides basic&amp;nbsp;&lt;b data-index-in-node=&quot;954&quot; data-path-to-node=&quot;0&quot; style=&quot;font-family: &amp;quot;Google Sans Text&amp;quot;, sans-serif; line-height: 1.15; margin-top: 0px;&quot;&gt;software debouncing&lt;/b&gt;.&lt;span face=&quot;Google Sans Text, sans-serif&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;div&gt;&lt;span face=&quot;Google Sans Text, sans-serif&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span face=&quot;Google Sans Text, sans-serif&quot;&gt;The&amp;nbsp;&lt;b&gt;video&lt;/b&gt;&amp;nbsp;below demonstrates how this circuit works.&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span face=&quot;Google Sans Text, sans-serif&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;&lt;iframe allowfullscreen=&quot;&quot; class=&quot;BLOG_video_class&quot; height=&quot;469&quot; src=&quot;https://www.youtube.com/embed/bhRU2bOPaiA&quot; width=&quot;564&quot; youtube-src-id=&quot;bhRU2bOPaiA&quot;&gt;&lt;/iframe&gt;&lt;/div&gt;&lt;br /&gt;&lt;span face=&quot;Google Sans Text, sans-serif&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;So, in this way you can easily expand the I/O capabilities of Attiny13 if you are short of pins. If you are not familiar with Attiny13 and&amp;nbsp;&lt;span face=&quot;Roboto, Noto, sans-serif&quot; style=&quot;background-color: white; color: #0d0d0d; font-size: 15px; white-space-collapse: preserve;&quot;&gt;WinAVR/AVR-GCC &lt;/span&gt;compiler, I suggest starting with&amp;nbsp;&lt;a href=&quot;https://www.ee-diary.net/2026/04/attiny13-led-blink-simulation-in-proteus.html&quot;&gt;Attiny13 LED blink tutorial&lt;/a&gt;. Let me know if any help is needed.&amp;nbsp;&lt;/div&gt;&lt;div&gt;&lt;p&gt;&lt;br /&gt;&lt;/p&gt;&lt;/div&gt;&lt;/div&gt;&lt;/span&gt;&lt;/div&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://www.ee-diary.net/feeds/2190719370906195009/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.ee-diary.net/2026/04/how-to-expand-attiny13-outputs-with.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7437986969318338216/posts/default/2190719370906195009'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7437986969318338216/posts/default/2190719370906195009'/><link rel='alternate' type='text/html' href='http://www.ee-diary.net/2026/04/how-to-expand-attiny13-outputs-with.html' title='How to Expand ATtiny13 Outputs with 74HC595 Shift Register'/><author><name>Unknown</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjPshv_pdrFX440Ce_97vNs4H15s5t_EhGiH8nJdyYE4qnrq-jnU4qy9lk0FQt-NM3JeJU7zDyzJwHRo-nbX42JlIIlDtGKLwlY4KxYPp3Ys1VK5hZRWW-BV9qIexO0tOnENQ4Z4yIT1F3pLEI7xa2vbCF19x4vRZNjwEgahomtFCN5V2UP0lnB7vVPcLeL/s72-c/Gemini_Generated_Image_pbet92pbet92pbet.png" height="72" width="72"/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-7437986969318338216.post-6619837741541817488</id><published>2026-04-01T22:19:00.005+05:45</published><updated>2026-04-01T22:44:25.814+05:45</updated><category scheme="http://www.blogger.com/atom/ns#" term="ATtiny13"/><category scheme="http://www.blogger.com/atom/ns#" term="tutorial"/><title type='text'>ATtiny13 LED Blink Simulation in Proteus</title><content type='html'>&lt;div class=&quot;separator&quot; style=&quot;display: none;&quot;&gt;&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjm0ry6MbD8fMf4Dw1kN_8uHk6G0xkHERbFujvFiohufvm03da1NiJ3FaSyA3s5ZjVh9BVXHI3zTK4ycyEpycVEPSynSbXsXNn-ygr787Z_wB98K82AdC8bjcA8OITJKtqulwtOOaG21t-2yTWvfMdmPDERi3B_qmtjo2f0HsMbt1zYC1J-fOn1jLFhkJAp/s1600/attiny13%20proteus%20tutorial.png&quot; style=&quot;display: block; padding: 1em 0px; text-align: center;&quot;&gt;&lt;img alt=&quot;&quot; border=&quot;0&quot; data-original-height=&quot;768&quot; data-original-width=&quot;1376&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjm0ry6MbD8fMf4Dw1kN_8uHk6G0xkHERbFujvFiohufvm03da1NiJ3FaSyA3s5ZjVh9BVXHI3zTK4ycyEpycVEPSynSbXsXNn-ygr787Z_wB98K82AdC8bjcA8OITJKtqulwtOOaG21t-2yTWvfMdmPDERi3B_qmtjo2f0HsMbt1zYC1J-fOn1jLFhkJAp/s1600/attiny13%20proteus%20tutorial.png&quot; /&gt;&lt;/a&gt;&lt;/div&gt;
&lt;p&gt;&amp;nbsp;I have heard of ATtiny13 micrcontroller for a while now and today I simulated a hello world program with ATtiny13 microcontroller in Proteus. As you might know Hello world program in micrcontroller programming means to blink a LED. So, this is a AVR Microcontroller Programming for Beginners&amp;nbsp; guide. I used winavr compiler which can be downloaded for free. The advantages of using ATtiny microcontrollers are that they are small, cheap, energy-efficient, and easy to program via ISP, making them ideal for simple embedded projects, battery-powered devices, and space-constrained designs. They’re often chosen as a lightweight alternative to larger Arduino boards when only a few pins or basic functionality are needed.&amp;nbsp;&lt;/p&gt;&lt;p&gt;However, many beginners start programming the &lt;strong&gt;ATtiny13&lt;/strong&gt; using the Arduino language because it feels familiar and easy. While there are many advantages of using ATtiny13 microcontroller, there is also downside of using Arduino with Attiny. Most beginners might now know that you cannot use most of the Arduino libraries because they are too large for Attiny13 1KB flash memory.&amp;nbsp;&lt;/p&gt;&lt;p&gt;Compared to Arduino, it’s equally straightforward to use the &lt;strong&gt;WinAVR toolchain&lt;/strong&gt;, which gives you direct control over registers and efficient C code compilation,&amp;nbsp;write pure C code, compiled directly for AVR,&amp;nbsp;Full control over registers, fuses, and optimization.&lt;/p&gt;&lt;p&gt;Step by step guide to install WinAVR is as follows.&lt;/p&gt;&lt;h3&gt;📥 How to Download and Install WinAVR&lt;/h3&gt;&lt;p style=&quot;display: inline; text-align: left;&quot;&gt;&lt;span style=&quot;white-space-collapse: preserve;&quot;&gt;&lt;strong&gt;1. Download WinAVR&lt;/strong&gt;&lt;/span&gt;&lt;/p&gt;&lt;ul&gt;&lt;li&gt;&lt;p&gt;&lt;span style=&quot;white-space-collapse: preserve;&quot;&gt;Visit the official SourceForge page: &lt;span aria-label=&quot;WinAVR on SourceForge, this will take you to sourceforge.net&quot; data-url=&quot;https://sourceforge.net/projects/winavr/&quot; role=&quot;button&quot; tabindex=&quot;0&quot;&gt;WinAVR on SourceForge&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;/li&gt;&lt;li&gt;&lt;p&gt;&lt;span style=&quot;white-space-collapse: preserve;&quot;&gt;Download the latest stable release (WinAVR-20100110 is commonly used).&lt;/span&gt;&lt;/p&gt;&lt;/li&gt;&lt;/ul&gt;&lt;p style=&quot;display: inline; text-align: left;&quot;&gt;&lt;span style=&quot;white-space-collapse: preserve;&quot;&gt;&lt;strong&gt;2. Install WinAVR&lt;/strong&gt;&lt;/span&gt;&lt;/p&gt;&lt;ul&gt;&lt;li&gt;&lt;p&gt;&lt;span style=&quot;white-space-collapse: preserve;&quot;&gt;Run the installer and follow the prompts.&lt;/span&gt;&lt;/p&gt;&lt;/li&gt;&lt;li&gt;&lt;p&gt;&lt;span style=&quot;white-space-collapse: preserve;&quot;&gt;By default, it installs to &lt;code&gt;C:\WinAVR-20100110&lt;/code&gt;.&lt;/span&gt;&lt;/p&gt;&lt;/li&gt;&lt;li&gt;&lt;p&gt;&lt;span style=&quot;white-space-collapse: preserve;&quot;&gt;It sets up environment variables so you can use &lt;code&gt;avr-gcc&lt;/code&gt;, &lt;code&gt;avr-libc&lt;/code&gt;, and &lt;code&gt;avrdude&lt;/code&gt; from the command line.&lt;/span&gt;&lt;/p&gt;&lt;/li&gt;&lt;/ul&gt;&lt;strong style=&quot;white-space-collapse: preserve;&quot;&gt;3. Verify Installation&lt;/strong&gt;&lt;br /&gt;&lt;ol start=&quot;1&quot;&gt;&lt;ul&gt;&lt;li&gt;&lt;p&gt;&lt;span style=&quot;white-space-collapse: preserve;&quot;&gt;Open &lt;strong&gt;Command Prompt&lt;/strong&gt;.&lt;/span&gt;&lt;/p&gt;&lt;/li&gt;&lt;li&gt;&lt;p&gt;&lt;span style=&quot;white-space-collapse: preserve;&quot;&gt;Type:&lt;/span&gt;&lt;/p&gt;&lt;div&gt;&lt;div&gt;&lt;div&gt;&lt;/div&gt;&lt;/div&gt;&lt;div class=&quot;rounded-b-xl bg-background-static-850 px-4 pb-1.5 dark:bg-background-static-900&quot;&gt;&lt;div style=&quot;white-space: pre;&quot;&gt;&lt;pre&gt;&lt;code&gt;avr-gcc --version
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;&lt;/div&gt;&lt;/li&gt;&lt;li&gt;&lt;p&gt;&lt;span style=&quot;white-space-collapse: preserve;&quot;&gt;If it shows the compiler version, installation is successful.&lt;/span&gt;&lt;/p&gt;&lt;/li&gt;&lt;/ul&gt;&lt;/ol&gt;&lt;div&gt;&lt;span style=&quot;white-space-collapse: preserve;&quot;&gt;After installation of WinAVR compiler, you also most likely want to use IDE for writing and uploading the code into the ATtiny13 chip. So here are some free IDE(Integrated Development Environment) for Attiny microcontroller.&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span style=&quot;white-space-collapse: preserve;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;h3&gt;🖥️ IDEs You Can Use with WinAVR&lt;/h3&gt;&lt;ul&gt;&lt;li&gt;&lt;p&gt;&lt;span style=&quot;white-space-collapse: preserve;&quot;&gt;&lt;strong&gt;Programmer’s Notepad&lt;/strong&gt; (bundled with WinAVR) – lightweight editor with build integration.&lt;/span&gt;&lt;/p&gt;&lt;/li&gt;&lt;li&gt;&lt;p&gt;&lt;span style=&quot;white-space-collapse: preserve;&quot;&gt;&lt;strong&gt;Eclipse CDT&lt;/strong&gt; with AVR plugin – more advanced, supports projects and debugging.&lt;/span&gt;&lt;/p&gt;&lt;/li&gt;&lt;li&gt;&lt;p&gt;&lt;span style=&quot;white-space-collapse: preserve;&quot;&gt;&lt;strong&gt;Atmel Studio (Microchip Studio)&lt;/strong&gt; – official IDE, integrates with AVR-GCC toolchain.&lt;/span&gt;&lt;/p&gt;&lt;/li&gt;&lt;li&gt;&lt;p&gt;&lt;span style=&quot;white-space-collapse: preserve;&quot;&gt;&lt;strong&gt;VS Code&lt;/strong&gt; – with AVR extensions, modern and customizable.&lt;/span&gt;&lt;/p&gt;&lt;/li&gt;&lt;/ul&gt;&lt;div&gt;After you have downloaded WinAVR compiler and IDE, you need to write program and upload it. Here is the workflow for this step.&lt;/div&gt;&lt;div&gt;&lt;h3&gt;&amp;nbsp;Workflow&lt;/h3&gt;&lt;span style=&quot;white-space-collapse: preserve;&quot;&gt;1. Write your C code (e.g., LED blink).&lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;white-space-collapse: preserve;&quot;&gt;2. Compile with &lt;/span&gt;&lt;code style=&quot;white-space-collapse: preserve;&quot;&gt;avr-gcc&lt;/code&gt;&lt;span style=&quot;white-space-collapse: preserve;&quot;&gt;.&lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;white-space-collapse: preserve;&quot;&gt;3. Generate &lt;/span&gt;&lt;code style=&quot;white-space-collapse: preserve;&quot;&gt;.hex&lt;/code&gt;&lt;span style=&quot;white-space-collapse: preserve;&quot;&gt; file.&lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;white-space-collapse: preserve;&quot;&gt;4. Upload to ATtiny13 using &lt;/span&gt;&lt;code style=&quot;white-space-collapse: preserve;&quot;&gt;avrdude&lt;/code&gt;&lt;span style=&quot;white-space-collapse: preserve;&quot;&gt; and an ISP programmer (many use Arduino Uno as ISP).&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;p&gt;&lt;span style=&quot;white-space-collapse: preserve;&quot;&gt;&lt;strong&gt;ISP stands for &lt;/strong&gt;&lt;em&gt;&lt;strong&gt;In-System Programming&lt;/strong&gt;&lt;/em&gt;&lt;strong&gt;.&lt;/strong&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style=&quot;white-space-collapse: preserve;&quot;&gt;It’s a method used to program microcontrollers (like the ATtiny13) directly while they are mounted in the circuit, without needing to remove the chip. Instead of using a separate programmer socket, you connect to the chip’s programming pins (MISO, MOSI, SCK, RESET, VCC, GND) and upload code via an external programmer such as an Arduino Uno running the ArduinoISP sketch.&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style=&quot;white-space-collapse: preserve;&quot;&gt;So, if you are using the Arduino as ISP programmer then you have to interconnet Arduino and Attiny13 mcu in the following way.&lt;/span&gt;&lt;/p&gt;&lt;table&gt;&lt;thead&gt;&lt;tr&gt;&lt;th&gt;ATtiny13 Pin&lt;/th&gt;&lt;th&gt;Function&lt;/th&gt;&lt;th&gt;Arduino Uno ISP Pin&lt;/th&gt;&lt;/tr&gt;&lt;/thead&gt;&lt;tbody&gt;&lt;tr&gt;&lt;td&gt;Pin 1 (RESET)&lt;/td&gt;&lt;td&gt;RESET&lt;/td&gt;&lt;td&gt;D10&lt;/td&gt;&lt;/tr&gt;&lt;tr&gt;&lt;td&gt;Pin 4 (GND)&lt;/td&gt;&lt;td&gt;Ground&lt;/td&gt;&lt;td&gt;GND&lt;/td&gt;&lt;/tr&gt;&lt;tr&gt;&lt;td&gt;Pin 5 (PB0)&lt;/td&gt;&lt;td&gt;MOSI&lt;/td&gt;&lt;td&gt;D11&lt;/td&gt;&lt;/tr&gt;&lt;tr&gt;&lt;td&gt;Pin 6 (PB1)&lt;/td&gt;&lt;td&gt;MISO&lt;/td&gt;&lt;td&gt;D12&lt;/td&gt;&lt;/tr&gt;&lt;tr&gt;&lt;td&gt;Pin 7 (PB2)&lt;/td&gt;&lt;td&gt;SCK&lt;/td&gt;&lt;td&gt;D13&lt;/td&gt;&lt;/tr&gt;&lt;tr&gt;&lt;td&gt;Pin 8 (VCC)&lt;/td&gt;&lt;td&gt;+5V&lt;/td&gt;&lt;td&gt;5V&lt;/td&gt;&lt;/tr&gt;&lt;/tbody&gt;&lt;/table&gt;&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;The &lt;b&gt;circuit diagram&lt;/b&gt; shows how to interface Arduino and ATtiny13.&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgm2n1suwSoIdHUkdw7z2gB6ROrr4UKxjtMVjLX96kBoNfjzwpK7DswDc6bOUgIExiuJirzl1Wxa0rFd7org7fRfkdqkHJMiQnTg6pG6gdkfiVHo1mm_9AwN44Pbewbg_LvOMObAr3PK0rXpIvyfZ6qtee7daVvqzUIh14QX3deJ0NBvdgJSYaTbsQ0iRr1/s723/Arduino%20and%20ATtiny13%20ISP%20interfacing.png&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img alt=&quot;Arduino and ATtiny13 ISP interfacing&quot; border=&quot;0&quot; data-original-height=&quot;526&quot; data-original-width=&quot;723&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgm2n1suwSoIdHUkdw7z2gB6ROrr4UKxjtMVjLX96kBoNfjzwpK7DswDc6bOUgIExiuJirzl1Wxa0rFd7org7fRfkdqkHJMiQnTg6pG6gdkfiVHo1mm_9AwN44Pbewbg_LvOMObAr3PK0rXpIvyfZ6qtee7daVvqzUIh14QX3deJ0NBvdgJSYaTbsQ0iRr1/s16000/Arduino%20and%20ATtiny13%20ISP%20interfacing.png&quot; title=&quot;Arduino and ATtiny13 ISP interfacing&quot; /&gt;&lt;/a&gt;&lt;/div&gt;&lt;br /&gt;&lt;div&gt;&lt;h3&gt;🛠️ Notes&lt;/h3&gt;&lt;ul&gt;&lt;li&gt;&lt;p&gt;&lt;span style=&quot;white-space-collapse: preserve;&quot;&gt;&lt;strong&gt;RESET&lt;/strong&gt; must be pulled low by the programmer to enter programming mode.&lt;/span&gt;&lt;/p&gt;&lt;/li&gt;&lt;li&gt;&lt;p&gt;&lt;span style=&quot;white-space-collapse: preserve;&quot;&gt;&lt;strong&gt;MOSI/MISO/SCK&lt;/strong&gt; are the SPI lines used for communication.&lt;/span&gt;&lt;/p&gt;&lt;/li&gt;&lt;li&gt;&lt;p&gt;&lt;span style=&quot;white-space-collapse: preserve;&quot;&gt;&lt;strong&gt;VCC/GND&lt;/strong&gt; provide power.&lt;/span&gt;&lt;/p&gt;&lt;/li&gt;&lt;li&gt;&lt;p&gt;&lt;span style=&quot;white-space-collapse: preserve;&quot;&gt;Add a &lt;strong&gt;10 µF capacitor between RESET and GND on the Arduino Uno&lt;/strong&gt; (when using it as ISP) to prevent auto-reset during programming.&lt;/span&gt;&lt;/p&gt;&lt;/li&gt;&lt;/ul&gt;&lt;/div&gt;&lt;div&gt;In this work, try the&amp;nbsp;&lt;a href=&quot;https://www.ee-diary.net/2026/03/attiny13-dip-8-explorer-free.html&quot;&gt;ATtiny13 chip interactive pinout explorer&lt;/a&gt;&amp;nbsp;which is free web tool that&amp;nbsp;help you in pin planning such as the SPI pins.&lt;/div&gt;&lt;h4 style=&quot;text-align: left;&quot;&gt;Circuit Diagram&lt;/h4&gt;&lt;div&gt;For this tutorial, the circuit for led blink is pretty simple. A LED with 270Ohm resistor is connected to the pin 5 of ATtiny13 microcontroller.&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjZZm7r-jXqoP3u8_xDTyL2Abl9sePCErCzkEGjcFj2C58inc4dxuRNQ3OeKA3lYwfJphEFxU32NZ1mBlt5fv303kVsHH4V30Ht0vcf2KDeyY8S3W0SxaAk-oVDpwlcpg_fpFkdmU9C_uJT_44B4-YVlRJTS4IFx3JgCOYJKOkmyTeNhiREMkzXgLSOqJBy/s776/attiny13%20video.png&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img alt=&quot;Attiny13 led blink circuit diagram&quot; border=&quot;0&quot; data-original-height=&quot;468&quot; data-original-width=&quot;776&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjZZm7r-jXqoP3u8_xDTyL2Abl9sePCErCzkEGjcFj2C58inc4dxuRNQ3OeKA3lYwfJphEFxU32NZ1mBlt5fv303kVsHH4V30Ht0vcf2KDeyY8S3W0SxaAk-oVDpwlcpg_fpFkdmU9C_uJT_44B4-YVlRJTS4IFx3JgCOYJKOkmyTeNhiREMkzXgLSOqJBy/s16000/attiny13%20video.png&quot; title=&quot;Attiny13 led blink circuit diagram&quot; /&gt;&lt;/a&gt;&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;As you can see the Attiny is powered with 3.3V ans so this is a low power LED flasher with ATtiny13 micrcontroller.&lt;/div&gt;&lt;h4 style=&quot;text-align: left;&quot;&gt;ATtiny13 LED Blink Code,&lt;/h4&gt;&lt;div&gt;The ATtiny13 LED Blink Code using winavr compiler is below.&lt;/div&gt;&lt;div&gt;&lt;pre&gt;&lt;code&gt;#include &amp;lt;inttypes.h&amp;gt;
#include &amp;lt;avr/io.h&amp;gt;
#include &amp;lt;util/delay.h&amp;gt;

int main(void)
{
    // Set PB0 (pin 5 on ATtiny13 DIP) as output
    DDRB |= (1 &amp;lt;&amp;lt; PB0);

    while (1)
    {
        // Turn LED on
        PORTB |= (1 &amp;lt;&amp;lt; PB0);
        _delay_ms(500);

        // Turn LED off
        PORTB &amp;amp;= ~(1 &amp;lt;&amp;lt; PB0);
        _delay_ms(500);
    }

    return 0;
}

  &lt;/code&gt;&lt;/pre&gt;
  &lt;/div&gt;&lt;div&gt;Below is video demo on simulation of ATtiny in Proteus:&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;&lt;iframe allowfullscreen=&quot;&quot; class=&quot;BLOG_video_class&quot; height=&quot;417&quot; src=&quot;https://www.youtube.com/embed/uWwP_18jALo&quot; width=&quot;502&quot; youtube-src-id=&quot;uWwP_18jALo&quot;&gt;&lt;/iframe&gt;&lt;/div&gt;&lt;br /&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;In short, while Arduino IDE makes ATtiny programming beginner-friendly, &lt;strong&gt;WinAVR is equally easy and often more efficient&lt;/strong&gt; for small chips like ATtiny13. It gives you direct control and avoids the overhead of Arduino libraries.&lt;/div&gt;&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;h4 style=&quot;text-align: left;&quot;&gt;Related Tutorials&lt;/h4&gt;&lt;div&gt;-&amp;nbsp;&lt;a href=&quot;https://www.ee-diary.net/2025/03/stm32-nucleo-led-blink-tutorial-with.html&quot;&gt;STM32 Nucleo Led Blink Tutorial with Proteus Simulation&lt;/a&gt;&lt;/div&gt;&lt;div&gt;- &lt;a href=&quot;https://www.ee-diary.net/2024/11/esp-wroom-32-led-blink-tutorial.html&quot;&gt;ESP-WROOM-32 LED Blink Tutorial&lt;/a&gt;&lt;/div&gt;&lt;div&gt;-&amp;nbsp;&lt;a href=&quot;https://www.ee-diary.net/2025/04/scilab-arduino-led-blink-tutorial.html&quot;&gt;Scilab Arduino LED Blink Tutorial&lt;/a&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://www.ee-diary.net/feeds/6619837741541817488/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.ee-diary.net/2026/04/attiny13-led-blink-simulation-in-proteus.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7437986969318338216/posts/default/6619837741541817488'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7437986969318338216/posts/default/6619837741541817488'/><link rel='alternate' type='text/html' href='http://www.ee-diary.net/2026/04/attiny13-led-blink-simulation-in-proteus.html' title='ATtiny13 LED Blink Simulation in Proteus'/><author><name>Unknown</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjm0ry6MbD8fMf4Dw1kN_8uHk6G0xkHERbFujvFiohufvm03da1NiJ3FaSyA3s5ZjVh9BVXHI3zTK4ycyEpycVEPSynSbXsXNn-ygr787Z_wB98K82AdC8bjcA8OITJKtqulwtOOaG21t-2yTWvfMdmPDERi3B_qmtjo2f0HsMbt1zYC1J-fOn1jLFhkJAp/s72-c/attiny13%20proteus%20tutorial.png" height="72" width="72"/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-7437986969318338216.post-2662841389703899599</id><published>2026-03-31T21:31:00.000+05:45</published><updated>2026-03-31T21:31:05.140+05:45</updated><category scheme="http://www.blogger.com/atom/ns#" term="troubleshooting"/><title type='text'>How to fix high frequency simulation error in Proteus</title><content type='html'>&lt;div class=&quot;separator&quot; style=&quot;display:none;&quot;&gt;&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiDQqX4aL5qZYgkTFEdGT6gj_0R9qbLIYGCX4i1yHJWNyZg4IKeEvHknAedZ-lkxMWJxuH-b3DpAD6EObog0zU5VXakemBgtpmwTLl8U7zh_b1T1OKIUeIji1Qei3uhWMuh82qYSTIBPf3tcjqwOTLbL-gsuiiflxaLHftiD_I3WF-D0bYmtQ_tvjeAW1wl/s1600/proteus%20simulation%20setting.png&quot; style=&quot;display: block; padding: 1em 0; text-align: center; &quot;&gt;&lt;img alt=&quot;proteus simulation setting&quot; border=&quot;0&quot; data-original-height=&quot;728&quot; data-original-width=&quot;1366&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiDQqX4aL5qZYgkTFEdGT6gj_0R9qbLIYGCX4i1yHJWNyZg4IKeEvHknAedZ-lkxMWJxuH-b3DpAD6EObog0zU5VXakemBgtpmwTLl8U7zh_b1T1OKIUeIji1Qei3uhWMuh82qYSTIBPf3tcjqwOTLbL-gsuiiflxaLHftiD_I3WF-D0bYmtQ_tvjeAW1wl/s1600/proteus%20simulation%20setting.png&quot;/&gt;&lt;/a&gt;&lt;/div&gt;
&lt;p&gt;&lt;span style=&quot;font-family: inherit;&quot;&gt;I do many circuits design and simulations in Proteus and it is a great software but with complex circuits such as RF circuits, power electronics circuit and other high-speed switching circuits at configured at high frequency, it just crashes. Actually, I think proteus was not targeted for high frequency circuit simulation such as AM or FM circuits. For example, when I tried to simulate the&amp;nbsp;&lt;/span&gt;&lt;a href=&quot;https://www.ee-diary.net/2023/08/building-am-transmitter-with-arduino.html&quot;&gt;AM Transmitter with Arduino and MC1496 RF Mixer&lt;/a&gt; circuit or the &lt;a href=&quot;https://www.ee-diary.net/2024/11/how-to-design-buck-converter-and-drive.html&quot;&gt;Buck Converter design with Arduino&lt;/a&gt;&amp;nbsp;circuit, the proteus software simply crashed.&amp;nbsp;&lt;span style=&quot;font-family: inherit;&quot;&gt;The error or warning is mostly the&amp;nbsp;&lt;/span&gt;&lt;b data-index-in-node=&quot;11&quot; data-path-to-node=&quot;1&quot; style=&quot;font-family: inherit;&quot;&gt;&quot;Timestep too small&quot;&lt;/b&gt;&lt;span style=&quot;font-family: inherit;&quot;&gt;&amp;nbsp;and&amp;nbsp;&lt;/span&gt;&lt;b data-index-in-node=&quot;36&quot; data-path-to-node=&quot;1&quot; style=&quot;font-family: inherit;&quot;&gt;&quot;GMIN stepping&quot;&lt;/b&gt;&lt;span style=&quot;font-family: inherit;&quot;&gt;&amp;nbsp;errors. I tried by changing simulation setting many times but could not find optimized settings that works all the time. Now I think I have found the solutions, the right setting for high-speed switching circuit, high frequency complex circuit simulation in Proteus. So, I am writing this note as a record so that I can always come back and look at the setting it worked for me.&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style=&quot;font-family: inherit;&quot;&gt;There are two simulation configuration setting windows, the Animation and Simulation (SPICE) shown below.&lt;/span&gt;&lt;/p&gt;&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEg_VhwJc2yUqewIBUD4FsSB66y1JvrWcSEVsin4TyU4A-GhnTHQAKEP-n8odYGhakBSU8avnzH-qgFmMYRaU4IBvSQFHtq6yqsyO8PKMsx13C9BKxTtE1rqRqEOyZWH8MJqTo89eBof9aQduKGPuv21BnP4tAJna7929WMhG8i_Xb2oluWDBsKFQMncOkP8/s688/proteus%20simulation%20setting.png&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;span style=&quot;font-family: inherit;&quot;&gt;&lt;img alt=&quot;proteus simulation settings&quot; border=&quot;0&quot; data-original-height=&quot;314&quot; data-original-width=&quot;688&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEg_VhwJc2yUqewIBUD4FsSB66y1JvrWcSEVsin4TyU4A-GhnTHQAKEP-n8odYGhakBSU8avnzH-qgFmMYRaU4IBvSQFHtq6yqsyO8PKMsx13C9BKxTtE1rqRqEOyZWH8MJqTo89eBof9aQduKGPuv21BnP4tAJna7929WMhG8i_Xb2oluWDBsKFQMncOkP8/s16000/proteus%20simulation%20setting.png&quot; title=&quot;proteus simulation settings&quot; /&gt;&lt;/span&gt;&lt;/a&gt;&lt;/div&gt;&lt;span style=&quot;font-family: inherit;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;p data-path-to-node=&quot;1&quot;&gt;&lt;span style=&quot;font-family: inherit;&quot;&gt;The &lt;b data-index-in-node=&quot;26&quot; data-path-to-node=&quot;1&quot;&gt;Simulation Settings&lt;/b&gt; (SPICE) are the &quot;brain&quot; calculating the physics, but the &lt;b data-index-in-node=&quot;103&quot; data-path-to-node=&quot;1&quot;&gt;Animation Settings&lt;/b&gt; are the &quot;lens&quot; through which you are watching. If the lens is blurry or too slow, you won&#39;t see the real behavior of circuit behavior, for example a PID loop. So, we have to adjust both the settings.&lt;/span&gt;&lt;/p&gt;&lt;h3 style=&quot;text-align: left;&quot;&gt;&lt;span style=&quot;font-family: inherit;&quot;&gt;Animation Setting&lt;/span&gt;&lt;/h3&gt;&lt;p data-path-to-node=&quot;1&quot;&gt;&lt;span style=&quot;font-family: inherit;&quot;&gt;On the Animation setting, look for the followings.&lt;/span&gt;&lt;/p&gt;&lt;p data-path-to-node=&quot;1&quot;&gt;&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiOnYeU7nx7Z1iJP8PqQDp7HHmMZfWx5ZJb-78rvBR5SVopCvF5_38iBnJ-lq_IpdnmCA1jQyoK1qhw8oZ_IvHx_2fQ-b8wFxayTOK0vb1I7lLKDE8oATJdr9_m9RJd62jJvKieUeOdszG49X3XS_54CxCdq1ZgrIyLNIZ0GnxefltNOzxt4mv9lCJuayBS/s446/proteus.png&quot; style=&quot;margin-left: 1em; margin-right: 1em; text-align: center;&quot;&gt;&lt;span style=&quot;font-family: inherit;&quot;&gt;&lt;img alt=&quot;Proteus simulation setting window&quot; border=&quot;0&quot; data-original-height=&quot;281&quot; data-original-width=&quot;446&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiOnYeU7nx7Z1iJP8PqQDp7HHmMZfWx5ZJb-78rvBR5SVopCvF5_38iBnJ-lq_IpdnmCA1jQyoK1qhw8oZ_IvHx_2fQ-b8wFxayTOK0vb1I7lLKDE8oATJdr9_m9RJd62jJvKieUeOdszG49X3XS_54CxCdq1ZgrIyLNIZ0GnxefltNOzxt4mv9lCJuayBS/s16000/proteus.png&quot; title=&quot;Proteus simulation setting window&quot; /&gt;&lt;/span&gt;&lt;/a&gt;&lt;/p&gt;&lt;h4 data-path-to-node=&quot;3&quot;&gt;&lt;span style=&quot;font-family: inherit;&quot;&gt;1. Preventing &quot;Visual Lag&quot;&lt;/span&gt;&lt;/h4&gt;&lt;p data-path-to-node=&quot;4&quot;&gt;&lt;span style=&quot;font-family: inherit;&quot;&gt;If your &lt;b data-index-in-node=&quot;8&quot; data-path-to-node=&quot;4&quot;&gt;Frames per Second (FPS)&lt;/b&gt; is set too low (e.g., 10 or 15), but your Arduino code is updating the Serial Monitor every 500ms, the numbers might appear to jump or stutter.&lt;/span&gt;&lt;/p&gt;&lt;ul data-path-to-node=&quot;5&quot;&gt;&lt;li&gt;&lt;p data-path-to-node=&quot;5,0,0&quot;&gt;&lt;span style=&quot;font-family: inherit;&quot;&gt;&lt;b data-index-in-node=&quot;0&quot; data-path-to-node=&quot;5,0,0&quot;&gt;Recommended:&lt;/b&gt; Keep &lt;b data-index-in-node=&quot;18&quot; data-path-to-node=&quot;5,0,0&quot;&gt;FPS at 20 or 25&lt;/b&gt;. This makes the voltage meter and Serial Monitor feel &quot;real-time.&quot;&lt;/span&gt;&lt;/p&gt;&lt;/li&gt;&lt;/ul&gt;&lt;h4 data-path-to-node=&quot;6&quot;&gt;&lt;span style=&quot;font-family: inherit;&quot;&gt;2. The &quot;Timestep per Frame&quot; vs. Real Time&lt;/span&gt;&lt;/h4&gt;&lt;p data-path-to-node=&quot;7&quot;&gt;&lt;span style=&quot;font-family: inherit;&quot;&gt;If your &lt;b data-index-in-node=&quot;8&quot; data-path-to-node=&quot;7&quot;&gt;Timestep per Frame&lt;/b&gt; is too large (like&amp;nbsp;&lt;b data-index-in-node=&quot;50&quot; data-path-to-node=&quot;7&quot;&gt;50ms&lt;/b&gt;&amp;nbsp;in certain circuit simulation), Proteus tries to &quot;skip ahead&quot; to keep up with real-world time. In a high-speed switching circuit:&lt;/span&gt;&lt;/p&gt;&lt;ul data-path-to-node=&quot;8&quot;&gt;&lt;li&gt;&lt;p data-path-to-node=&quot;8,0,0&quot;&gt;&lt;span style=&quot;font-family: inherit;&quot;&gt;If the &quot;skipped&quot; time contains a massive PWM change, the simulation might suddenly &quot;teleport&quot; the voltage from 4V to 8V.&lt;/span&gt;&lt;/p&gt;&lt;/li&gt;&lt;li&gt;&lt;p data-path-to-node=&quot;8,1,0&quot;&gt;&lt;span style=&quot;font-family: inherit;&quot;&gt;&lt;b data-index-in-node=&quot;0&quot; data-path-to-node=&quot;8,1,0&quot;&gt;The Fix:&lt;/b&gt; If the simulation feels &quot;choppy,&quot; try reducing &lt;b data-index-in-node=&quot;56&quot; data-path-to-node=&quot;8,1,0&quot;&gt;Timestep per Frame&lt;/b&gt; to &lt;b data-index-in-node=&quot;78&quot; data-path-to-node=&quot;8,1,0&quot;&gt;10m&lt;/b&gt; or &lt;b data-index-in-node=&quot;85&quot; data-path-to-node=&quot;8,1,0&quot;&gt;20m&lt;/b&gt;. This forces the animation to be smoother, though it might make the simulation run slower than real life (e.g., 1 second of simulation takes 2 seconds of real time).&lt;/span&gt;&lt;/p&gt;&lt;/li&gt;&lt;/ul&gt;&lt;h4 style=&quot;text-align: left;&quot;&gt;&lt;span style=&quot;font-family: inherit;&quot;&gt;3. Optimize the Timestep (The Most Important Part)&lt;/span&gt;&lt;/h4&gt;&lt;p data-path-to-node=&quot;3&quot;&gt;&lt;span style=&quot;font-family: inherit;&quot;&gt;The &quot;Max. SPICE Timestep&quot; is currently at &lt;b data-index-in-node=&quot;42&quot; data-path-to-node=&quot;3&quot;&gt;25ms&lt;/b&gt;. This is way too slow for a circuit switching, for example, simulation of &lt;a href=&quot;https://www.ee-diary.net/2024/12/how-to-design-arduino-buck-converter.html&quot;&gt;Arduino buck converter at ~31kHz&lt;/a&gt;. The simulation is likely skipping thousands of PWM cycles between calculations.&lt;/span&gt;&lt;/p&gt;&lt;ul data-path-to-node=&quot;4&quot;&gt;&lt;li&gt;&lt;p data-path-to-node=&quot;4,0,0&quot;&gt;&lt;span style=&quot;font-family: inherit;&quot;&gt;&lt;b data-index-in-node=&quot;0&quot; data-path-to-node=&quot;4,0,0&quot;&gt;Change &quot;Max. SPICE Timestep&quot; to:&lt;/b&gt; &lt;code data-index-in-node=&quot;33&quot; data-path-to-node=&quot;4,0,0&quot;&gt;10u&lt;/code&gt; (10 microseconds) or at least 100u.&lt;/span&gt;&lt;/p&gt;&lt;/li&gt;&lt;li&gt;&lt;p data-path-to-node=&quot;4,1,0&quot;&gt;&lt;span style=&quot;font-family: inherit;&quot;&gt;&lt;b data-index-in-node=&quot;0&quot; data-path-to-node=&quot;4,1,0&quot;&gt;Why:&lt;/b&gt; A high frequency signal like 31kHz PWM cycle happens every &lt;b data-index-in-node=&quot;37&quot; data-path-to-node=&quot;4,1,0&quot;&gt;32 microseconds&lt;/b&gt;. If your timestep is 25ms, the simulator is &quot;blind&quot; to what the MOSFET is doing most of the time.&lt;/span&gt;&lt;/p&gt;&lt;/li&gt;&lt;/ul&gt;&lt;p&gt;&lt;span style=&quot;font-family: inherit;&quot;&gt;Simulation (SPICE) setting&lt;/span&gt;&lt;/p&gt;&lt;p&gt;The simulation setting w&lt;span style=&quot;font-family: inherit;&quot;&gt;indow is the &quot;Engine Room&quot; of the simulator. Changing these values can make the simulation much more &quot;forgiving&quot; so it doesn&#39;t crash when your MOSFET switches.&lt;/span&gt;&lt;/p&gt;&lt;h4 style=&quot;text-align: left;&quot;&gt;&lt;span style=&quot;font-family: inherit;&quot;&gt;1. Relax the Tolerances&lt;/span&gt;&lt;/h4&gt;&lt;ul data-path-to-node=&quot;3&quot;&gt;&lt;li&gt;&lt;p data-path-to-node=&quot;3,0,0&quot;&gt;&lt;span style=&quot;font-family: inherit;&quot;&gt;&lt;b data-index-in-node=&quot;0&quot; data-path-to-node=&quot;3,0,0&quot;&gt;[RELTOL] (Relative error tolerance):&lt;/b&gt; Change from &lt;code data-index-in-node=&quot;49&quot; data-path-to-node=&quot;3,0,0&quot;&gt;0.001&lt;/code&gt; to &lt;b data-index-in-node=&quot;58&quot; data-path-to-node=&quot;3,0,0&quot;&gt;&lt;code data-index-in-node=&quot;58&quot; data-path-to-node=&quot;3,0,0&quot;&gt;0.01&lt;/code&gt;&lt;/b&gt;.&lt;/span&gt;&lt;/p&gt;&lt;ul data-path-to-node=&quot;3,0,1&quot;&gt;&lt;li&gt;&lt;p data-path-to-node=&quot;3,0,1,0,0&quot;&gt;&lt;span style=&quot;font-family: inherit;&quot;&gt;&lt;i data-index-in-node=&quot;0&quot; data-path-to-node=&quot;3,0,1,0,0&quot;&gt;Why:&lt;/i&gt; This allows for a 1% margin of error in calculations instead of 0.1%, which stops the simulator from panicking over tiny spikes.&lt;/span&gt;&lt;/p&gt;&lt;/li&gt;&lt;/ul&gt;&lt;/li&gt;&lt;li&gt;&lt;p data-path-to-node=&quot;3,1,0&quot;&gt;&lt;span style=&quot;font-family: inherit;&quot;&gt;&lt;b data-index-in-node=&quot;0&quot; data-path-to-node=&quot;3,1,0&quot;&gt;[ABSTOL] (Absolute current error):&lt;/b&gt; Change from &lt;code data-index-in-node=&quot;47&quot; data-path-to-node=&quot;3,1,0&quot;&gt;1e-012&lt;/code&gt; to &lt;b data-index-in-node=&quot;57&quot; data-path-to-node=&quot;3,1,0&quot;&gt;&lt;code data-index-in-node=&quot;57&quot; data-path-to-node=&quot;3,1,0&quot;&gt;1e-006&lt;/code&gt;&lt;/b&gt;.&lt;/span&gt;&lt;/p&gt;&lt;/li&gt;&lt;li&gt;&lt;p data-path-to-node=&quot;3,2,0&quot;&gt;&lt;span style=&quot;font-family: inherit;&quot;&gt;&lt;b data-index-in-node=&quot;0&quot; data-path-to-node=&quot;3,2,0&quot;&gt;[VNTOL] (Absolute voltage error):&lt;/b&gt; Change from &lt;code data-index-in-node=&quot;46&quot; data-path-to-node=&quot;3,2,0&quot;&gt;1e-006&lt;/code&gt; to &lt;b data-index-in-node=&quot;56&quot; data-path-to-node=&quot;3,2,0&quot;&gt;&lt;code data-index-in-node=&quot;56&quot; data-path-to-node=&quot;3,2,0&quot;&gt;1e-003&lt;/code&gt;&lt;/b&gt;.&lt;/span&gt;&lt;/p&gt;&lt;/li&gt;&lt;/ul&gt;&lt;h4 style=&quot;text-align: left;&quot;&gt;&lt;span style=&quot;font-family: inherit;&quot;&gt;2. Stability Boosters&lt;/span&gt;&lt;/h4&gt;&lt;ul data-path-to-node=&quot;5&quot;&gt;&lt;li&gt;&lt;p data-path-to-node=&quot;5,0,0&quot;&gt;&lt;span style=&quot;font-family: inherit;&quot;&gt;&lt;b data-index-in-node=&quot;0&quot; data-path-to-node=&quot;5,0,0&quot;&gt;[GMIN] (Minimum conductance):&lt;/b&gt; Change from &lt;code data-index-in-node=&quot;42&quot; data-path-to-node=&quot;5,0,0&quot;&gt;1e-012&lt;/code&gt; to &lt;b data-index-in-node=&quot;52&quot; data-path-to-node=&quot;5,0,0&quot;&gt;&lt;code data-index-in-node=&quot;52&quot; data-path-to-node=&quot;5,0,0&quot;&gt;1e-009&lt;/code&gt;&lt;/b&gt;.&lt;/span&gt;&lt;/p&gt;&lt;ul data-path-to-node=&quot;5,0,1&quot;&gt;&lt;li&gt;&lt;p data-path-to-node=&quot;5,0,1,0,0&quot;&gt;&lt;span style=&quot;font-family: inherit;&quot;&gt;&lt;i data-index-in-node=&quot;0&quot; data-path-to-node=&quot;5,0,1,0,0&quot;&gt;Why:&lt;/i&gt; This places a very high-value &quot;invisible resistor&quot; across every node to prevent the math from reaching &quot;infinity&quot; when a switch opens.&lt;/span&gt;&lt;/p&gt;&lt;/li&gt;&lt;/ul&gt;&lt;/li&gt;&lt;li&gt;&lt;p data-path-to-node=&quot;5,1,0&quot;&gt;&lt;span style=&quot;font-family: inherit;&quot;&gt;&lt;b data-index-in-node=&quot;0&quot; data-path-to-node=&quot;5,1,0&quot;&gt;[TRANGMIN] (Minimum transient conductance):&lt;/b&gt; Change from &lt;code data-index-in-node=&quot;56&quot; data-path-to-node=&quot;5,1,0&quot;&gt;1e-009&lt;/code&gt; to &lt;b data-index-in-node=&quot;66&quot; data-path-to-node=&quot;5,1,0&quot;&gt;&lt;code data-index-in-node=&quot;66&quot; data-path-to-node=&quot;5,1,0&quot;&gt;1e-007&lt;/code&gt;&lt;/b&gt;.&lt;/span&gt;&lt;/p&gt;&lt;/li&gt;&lt;/ul&gt;&lt;h4 style=&quot;text-align: left;&quot;&gt;&lt;span style=&quot;font-family: inherit;&quot;&gt;3. The &quot;Transient&quot; Tab&lt;/span&gt;&lt;/h4&gt;&lt;p data-path-to-node=&quot;1&quot; style=&quot;line-height: 1.15; margin-top: 0px;&quot;&gt;&lt;span style=&quot;font-family: inherit;&quot;&gt;However, we can fix your &quot;Timestep too small&quot; error right here on the screen you just shared.&lt;/span&gt;&lt;/p&gt;&lt;p data-path-to-node=&quot;3&quot; style=&quot;line-height: 1.15; margin-top: 0px;&quot;&gt;&lt;span style=&quot;font-family: inherit;&quot;&gt;Change these two values to stop the &quot;Panic&quot; crashes:&lt;/span&gt;&lt;/p&gt;&lt;ul data-path-to-node=&quot;4&quot; style=&quot;line-height: 1.15; margin-top: 0px; padding-inline-start: 32px;&quot;&gt;&lt;li style=&quot;line-height: 1.15; margin-top: 0px;&quot;&gt;&lt;p data-path-to-node=&quot;4,0,0&quot; style=&quot;line-height: 1.15; margin-top: 0px;&quot;&gt;&lt;span style=&quot;font-family: inherit;&quot;&gt;&lt;b data-index-in-node=&quot;0&quot; data-path-to-node=&quot;4,0,0&quot; style=&quot;line-height: 1.15; margin-top: 0px;&quot;&gt;[TRTOL] (Truncation error over-estimation):&lt;/b&gt;&amp;nbsp;Change from&amp;nbsp;&lt;b data-index-in-node=&quot;56&quot; data-path-to-node=&quot;4,0,0&quot; style=&quot;line-height: 1.15; margin-top: 0px;&quot;&gt;7&lt;/b&gt;&amp;nbsp;to&amp;nbsp;&lt;b data-index-in-node=&quot;61&quot; data-path-to-node=&quot;4,0,0&quot; style=&quot;line-height: 1.15; margin-top: 0px;&quot;&gt;15&lt;/b&gt;.&lt;/span&gt;&lt;/p&gt;&lt;ul data-path-to-node=&quot;4,0,1&quot; style=&quot;line-height: 1.15; margin-top: 0px; padding-inline-start: 32px;&quot;&gt;&lt;li style=&quot;line-height: 1.15; margin-top: 0px;&quot;&gt;&lt;p data-path-to-node=&quot;4,0,1,0,0&quot; style=&quot;line-height: 1.15; margin-top: 0px;&quot;&gt;&lt;span style=&quot;font-family: inherit;&quot;&gt;&lt;i data-index-in-node=&quot;0&quot; data-path-to-node=&quot;4,0,1,0,0&quot; style=&quot;line-height: 1.15; margin-top: 0px;&quot;&gt;Why:&lt;/i&gt;&amp;nbsp;This tells the simulator to be less &quot;strict&quot; when it sees a sudden voltage spike from your MOSFET.&lt;/span&gt;&lt;/p&gt;&lt;/li&gt;&lt;/ul&gt;&lt;/li&gt;&lt;li style=&quot;line-height: 1.15; margin-top: 0px;&quot;&gt;&lt;p data-path-to-node=&quot;4,1,0&quot; style=&quot;line-height: 1.15; margin-top: 0px;&quot;&gt;&lt;span style=&quot;font-family: inherit;&quot;&gt;&lt;b data-index-in-node=&quot;0&quot; data-path-to-node=&quot;4,1,0&quot; style=&quot;line-height: 1.15; margin-top: 0px;&quot;&gt;[TMIN] (Minimum Analogue Timestep):&lt;/b&gt;&amp;nbsp;Change from&amp;nbsp;&lt;b data-index-in-node=&quot;48&quot; data-path-to-node=&quot;4,1,0&quot; style=&quot;line-height: 1.15; margin-top: 0px;&quot;&gt;1e-018&lt;/b&gt;&amp;nbsp;to&amp;nbsp;&lt;b data-index-in-node=&quot;58&quot; data-path-to-node=&quot;4,1,0&quot; style=&quot;line-height: 1.15; margin-top: 0px;&quot;&gt;1e-012&lt;/b&gt;.&lt;/span&gt;&lt;/p&gt;&lt;ul data-path-to-node=&quot;4,1,1&quot; style=&quot;line-height: 1.15; margin-top: 0px; padding-inline-start: 32px;&quot;&gt;&lt;li style=&quot;line-height: 1.15; margin-top: 0px;&quot;&gt;&lt;p data-path-to-node=&quot;4,1,1,0,0&quot; style=&quot;line-height: 1.15; margin-top: 0px;&quot;&gt;&lt;span style=&quot;font-family: inherit;&quot;&gt;&lt;i data-index-in-node=&quot;0&quot; data-path-to-node=&quot;4,1,1,0,0&quot; style=&quot;line-height: 1.15; margin-top: 0px;&quot;&gt;Why:&lt;/i&gt;&amp;nbsp;This is the most important fix. Your error message said the timestep was getting too small. By setting a &quot;floor&quot; at&amp;nbsp;&lt;span class=&quot;math-inline&quot; data-index-in-node=&quot;121&quot; data-math=&quot;10^{-12}&quot; style=&quot;line-height: 1.15; margin-top: 0px;&quot;&gt;$10^{-12}$&lt;/span&gt;, you stop the simulator from trying to calculate &quot;impossible&quot; numbers.&lt;/span&gt;&lt;/p&gt;&lt;/li&gt;&lt;/ul&gt;&lt;/li&gt;&lt;/ul&gt;&lt;h3 data-path-to-node=&quot;2&quot;&gt;&lt;span style=&quot;font-family: inherit;&quot;&gt;4. Boost the Iteration Limits&lt;/span&gt;&lt;/h3&gt;&lt;div&gt;&lt;p data-path-to-node=&quot;8,0,0&quot;&gt;&lt;span style=&quot;font-family: inherit;&quot;&gt;Go to Iteration tab and make sure GEAR method is selected as integration method. GEAR method is much better for power electronics like your Buck converter because it suppresses the &quot;ringing&quot; (oscillation) that usually crashes the simulator.&lt;/span&gt;&lt;/p&gt;&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjTNbY1jkz6tXALHE6-WFNYEKJEbn7tx9XL4yPpr8bFEzgx3kyhIVlUZ1UQrvPgsyMTeiDHTj3aTBPxjeX9pFVLP5aLyb6MN7IwclPL-KeORtBSMoCM5VxQ-1NIEmmhG9YfpVRj6bZbAlaHs33F_Zxt_ioL2UKjk3RHy10xHYPwtmkRYqmM5bMg41qEw5yY/s420/iteration%20tab.png&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;span style=&quot;font-family: inherit;&quot;&gt;&lt;img border=&quot;0&quot; data-original-height=&quot;420&quot; data-original-width=&quot;402&quot; height=&quot;320&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjTNbY1jkz6tXALHE6-WFNYEKJEbn7tx9XL4yPpr8bFEzgx3kyhIVlUZ1UQrvPgsyMTeiDHTj3aTBPxjeX9pFVLP5aLyb6MN7IwclPL-KeORtBSMoCM5VxQ-1NIEmmhG9YfpVRj6bZbAlaHs33F_Zxt_ioL2UKjk3RHy10xHYPwtmkRYqmM5bMg41qEw5yY/s320/iteration%20tab.png&quot; width=&quot;306&quot; /&gt;&lt;/span&gt;&lt;/a&gt;&lt;/div&gt;&lt;p data-path-to-node=&quot;8,0,0&quot;&gt;&lt;span style=&quot;font-family: inherit;&quot;&gt;That is change&lt;/span&gt;&lt;/p&gt;&lt;ul data-path-to-node=&quot;8,0,1&quot;&gt;&lt;li&gt;&lt;p data-path-to-node=&quot;8,0,1,0,0&quot;&gt;&lt;span style=&quot;font-family: inherit;&quot;&gt;&lt;b data-index-in-node=&quot;0&quot; data-path-to-node=&quot;3,0,0&quot;&gt;[ITL4] (Upper transient iteration limit):&lt;/b&gt; Change from &lt;b data-index-in-node=&quot;54&quot; data-path-to-node=&quot;3,0,0&quot;&gt;10&lt;/b&gt; to &lt;b data-index-in-node=&quot;60&quot; data-path-to-node=&quot;3,0,0&quot;&gt;40&lt;/b&gt;.&lt;/span&gt;&lt;/p&gt;&lt;/li&gt;&lt;/ul&gt;&lt;/div&gt;&lt;div&gt;&lt;h3 data-path-to-node=&quot;5&quot;&gt;&lt;span style=&quot;font-family: inherit;&quot;&gt;Summary of the &quot;Stable Proteus&quot; Setup&lt;/span&gt;&lt;/h3&gt;&lt;p data-path-to-node=&quot;1&quot; style=&quot;font-family: &amp;quot;Google Sans Text&amp;quot;, sans-serif !important; line-height: 1.15 !important; margin-top: 0px !important;&quot;&gt;Here is the &quot;Golden Ratio&quot; of settings for your project:&lt;/p&gt;&lt;h3 data-path-to-node=&quot;2&quot; style=&quot;font-family: &amp;quot;Google Sans&amp;quot;, sans-serif !important; line-height: 1.15 !important; margin-top: 0px !important;&quot;&gt;1. Simulation (SPICE) Settings&lt;/h3&gt;&lt;p data-path-to-node=&quot;3&quot; style=&quot;font-family: &amp;quot;Google Sans Text&amp;quot;, sans-serif !important; line-height: 1.15 !important; margin-top: 0px !important;&quot;&gt;Access these via &lt;b data-index-in-node=&quot;17&quot; data-path-to-node=&quot;3&quot; style=&quot;line-height: 1.15 !important; margin-top: 0px !important;&quot;&gt;System -&amp;gt; Set Simulator Options&lt;/b&gt;.&lt;/p&gt;&lt;table data-path-to-node=&quot;4&quot; style=&quot;font-family: &amp;quot;Google Sans Text&amp;quot;, sans-serif !important; line-height: 1.15 !important; margin-bottom: 32px; margin-top: 0px !important;&quot;&gt;&lt;thead style=&quot;line-height: 1.15 !important; margin-top: 0px !important;&quot;&gt;&lt;tr style=&quot;line-height: 1.15 !important; margin-top: 0px !important;&quot;&gt;&lt;td style=&quot;border: 1px solid; line-height: 1.15 !important; margin-top: 0px !important;&quot;&gt;&lt;strong style=&quot;line-height: 1.15 !important; margin-bottom: 0px !important; margin-top: 0px !important;&quot;&gt;Category&lt;/strong&gt;&lt;/td&gt;&lt;td style=&quot;border: 1px solid; line-height: 1.15 !important; margin-top: 0px !important;&quot;&gt;&lt;strong style=&quot;line-height: 1.15 !important; margin-bottom: 0px !important; margin-top: 0px !important;&quot;&gt;Parameter&lt;/strong&gt;&lt;/td&gt;&lt;td style=&quot;border: 1px solid; line-height: 1.15 !important; margin-top: 0px !important;&quot;&gt;&lt;strong style=&quot;line-height: 1.15 !important; margin-bottom: 0px !important; margin-top: 0px !important;&quot;&gt;Recommended Value&lt;/strong&gt;&lt;/td&gt;&lt;td style=&quot;border: 1px solid; line-height: 1.15 !important; margin-top: 0px !important;&quot;&gt;&lt;strong style=&quot;line-height: 1.15 !important; margin-bottom: 0px !important; margin-top: 0px !important;&quot;&gt;Why?&lt;/strong&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/thead&gt;&lt;tbody style=&quot;line-height: 1.15 !important; margin-top: 0px !important;&quot;&gt;&lt;tr style=&quot;line-height: 1.15 !important; margin-top: 0px !important;&quot;&gt;&lt;td style=&quot;border: 1px solid; line-height: 1.15 !important; margin-top: 0px !important;&quot;&gt;&lt;span data-path-to-node=&quot;4,1,0,0&quot; style=&quot;line-height: 1.15 !important; margin-top: 0px !important;&quot;&gt;&lt;b data-index-in-node=&quot;0&quot; data-path-to-node=&quot;4,1,0,0&quot; style=&quot;line-height: 1.15 !important; margin-top: 0px !important;&quot;&gt;Tolerances&lt;/b&gt;&lt;/span&gt;&lt;/td&gt;&lt;td style=&quot;border: 1px solid; line-height: 1.15 !important; margin-top: 0px !important;&quot;&gt;&lt;span data-path-to-node=&quot;4,1,1,0&quot; style=&quot;line-height: 1.15 !important; margin-top: 0px !important;&quot;&gt;&lt;b data-index-in-node=&quot;0&quot; data-path-to-node=&quot;4,1,1,0&quot; style=&quot;line-height: 1.15 !important; margin-top: 0px !important;&quot;&gt;RELTOL&lt;/b&gt;&lt;/span&gt;&lt;/td&gt;&lt;td style=&quot;border: 1px solid; line-height: 1.15 !important; margin-top: 0px !important;&quot;&gt;&lt;span data-path-to-node=&quot;4,1,2,0&quot; style=&quot;line-height: 1.15 !important; margin-top: 0px !important;&quot;&gt;0.01&lt;/span&gt;&lt;/td&gt;&lt;td style=&quot;border: 1px solid; line-height: 1.15 !important; margin-top: 0px !important;&quot;&gt;&lt;span data-path-to-node=&quot;4,1,3,0&quot; style=&quot;line-height: 1.15 !important; margin-top: 0px !important;&quot;&gt;Allows 1% error; prevents crashing on tiny spikes.&lt;/span&gt;&lt;/td&gt;&lt;/tr&gt;&lt;tr style=&quot;line-height: 1.15 !important; margin-top: 0px !important;&quot;&gt;&lt;td style=&quot;border: 1px solid; line-height: 1.15 !important; margin-top: 0px !important;&quot;&gt;&lt;span data-path-to-node=&quot;4,2,0,0&quot; style=&quot;line-height: 1.15 !important; margin-top: 0px !important;&quot;&gt;&lt;b data-index-in-node=&quot;0&quot; data-path-to-node=&quot;4,2,0,0&quot; style=&quot;line-height: 1.15 !important; margin-top: 0px !important;&quot;&gt;Tolerances&lt;/b&gt;&lt;/span&gt;&lt;/td&gt;&lt;td style=&quot;border: 1px solid; line-height: 1.15 !important; margin-top: 0px !important;&quot;&gt;&lt;span data-path-to-node=&quot;4,2,1,0&quot; style=&quot;line-height: 1.15 !important; margin-top: 0px !important;&quot;&gt;&lt;b data-index-in-node=&quot;0&quot; data-path-to-node=&quot;4,2,1,0&quot; style=&quot;line-height: 1.15 !important; margin-top: 0px !important;&quot;&gt;VNTOL&lt;/b&gt;&lt;/span&gt;&lt;/td&gt;&lt;td style=&quot;border: 1px solid; line-height: 1.15 !important; margin-top: 0px !important;&quot;&gt;&lt;span data-path-to-node=&quot;4,2,2,0&quot; style=&quot;line-height: 1.15 !important; margin-top: 0px !important;&quot;&gt;1m&lt;/span&gt;&lt;/td&gt;&lt;td style=&quot;border: 1px solid; line-height: 1.15 !important; margin-top: 0px !important;&quot;&gt;&lt;span data-path-to-node=&quot;4,2,3,0&quot; style=&quot;line-height: 1.15 !important; margin-top: 0px !important;&quot;&gt;1mV precision is plenty for a 12V system.&lt;/span&gt;&lt;/td&gt;&lt;/tr&gt;&lt;tr style=&quot;line-height: 1.15 !important; margin-top: 0px !important;&quot;&gt;&lt;td style=&quot;border: 1px solid; line-height: 1.15 !important; margin-top: 0px !important;&quot;&gt;&lt;span data-path-to-node=&quot;4,3,0,0&quot; style=&quot;line-height: 1.15 !important; margin-top: 0px !important;&quot;&gt;&lt;b data-index-in-node=&quot;0&quot; data-path-to-node=&quot;4,3,0,0&quot; style=&quot;line-height: 1.15 !important; margin-top: 0px !important;&quot;&gt;Tolerances&lt;/b&gt;&lt;/span&gt;&lt;/td&gt;&lt;td style=&quot;border: 1px solid; line-height: 1.15 !important; margin-top: 0px !important;&quot;&gt;&lt;span data-path-to-node=&quot;4,3,1,0&quot; style=&quot;line-height: 1.15 !important; margin-top: 0px !important;&quot;&gt;&lt;b data-index-in-node=&quot;0&quot; data-path-to-node=&quot;4,3,1,0&quot; style=&quot;line-height: 1.15 !important; margin-top: 0px !important;&quot;&gt;GMIN&lt;/b&gt;&lt;/span&gt;&lt;/td&gt;&lt;td style=&quot;border: 1px solid; line-height: 1.15 !important; margin-top: 0px !important;&quot;&gt;&lt;span data-path-to-node=&quot;4,3,2,0&quot; style=&quot;line-height: 1.15 !important; margin-top: 0px !important;&quot;&gt;1e-9&lt;/span&gt;&lt;/td&gt;&lt;td style=&quot;border: 1px solid; line-height: 1.15 !important; margin-top: 0px !important;&quot;&gt;&lt;span data-path-to-node=&quot;4,3,3,0&quot; style=&quot;line-height: 1.15 !important; margin-top: 0px !important;&quot;&gt;Prevents &quot;infinite resistance&quot; math errors.&lt;/span&gt;&lt;/td&gt;&lt;/tr&gt;&lt;tr style=&quot;line-height: 1.15 !important; margin-top: 0px !important;&quot;&gt;&lt;td style=&quot;border: 1px solid; line-height: 1.15 !important; margin-top: 0px !important;&quot;&gt;&lt;span data-path-to-node=&quot;4,4,0,0&quot; style=&quot;line-height: 1.15 !important; margin-top: 0px !important;&quot;&gt;&lt;b data-index-in-node=&quot;0&quot; data-path-to-node=&quot;4,4,0,0&quot; style=&quot;line-height: 1.15 !important; margin-top: 0px !important;&quot;&gt;Iteration&lt;/b&gt;&lt;/span&gt;&lt;/td&gt;&lt;td style=&quot;border: 1px solid; line-height: 1.15 !important; margin-top: 0px !important;&quot;&gt;&lt;span data-path-to-node=&quot;4,4,1,0&quot; style=&quot;line-height: 1.15 !important; margin-top: 0px !important;&quot;&gt;&lt;b data-index-in-node=&quot;0&quot; data-path-to-node=&quot;4,4,1,0&quot; style=&quot;line-height: 1.15 !important; margin-top: 0px !important;&quot;&gt;METHOD&lt;/b&gt;&lt;/span&gt;&lt;/td&gt;&lt;td style=&quot;border: 1px solid; line-height: 1.15 !important; margin-top: 0px !important;&quot;&gt;&lt;span data-path-to-node=&quot;4,4,2,0&quot; style=&quot;line-height: 1.15 !important; margin-top: 0px !important;&quot;&gt;&lt;b data-index-in-node=&quot;0&quot; data-path-to-node=&quot;4,4,2,0&quot; style=&quot;line-height: 1.15 !important; margin-top: 0px !important;&quot;&gt;GEAR&lt;/b&gt;&lt;/span&gt;&lt;/td&gt;&lt;td style=&quot;border: 1px solid; line-height: 1.15 !important; margin-top: 0px !important;&quot;&gt;&lt;span data-path-to-node=&quot;4,4,3,0&quot; style=&quot;line-height: 1.15 !important; margin-top: 0px !important;&quot;&gt;&lt;b data-index-in-node=&quot;0&quot; data-path-to-node=&quot;4,4,3,0&quot; style=&quot;line-height: 1.15 !important; margin-top: 0px !important;&quot;&gt;Critical.&lt;/b&gt; Handles switching circuits better than TRAPEZ.&lt;/span&gt;&lt;/td&gt;&lt;/tr&gt;&lt;tr style=&quot;line-height: 1.15 !important; margin-top: 0px !important;&quot;&gt;&lt;td style=&quot;border: 1px solid; line-height: 1.15 !important; margin-top: 0px !important;&quot;&gt;&lt;span data-path-to-node=&quot;4,5,0,0&quot; style=&quot;line-height: 1.15 !important; margin-top: 0px !important;&quot;&gt;&lt;b data-index-in-node=&quot;0&quot; data-path-to-node=&quot;4,5,0,0&quot; style=&quot;line-height: 1.15 !important; margin-top: 0px !important;&quot;&gt;Iteration&lt;/b&gt;&lt;/span&gt;&lt;/td&gt;&lt;td style=&quot;border: 1px solid; line-height: 1.15 !important; margin-top: 0px !important;&quot;&gt;&lt;span data-path-to-node=&quot;4,5,1,0&quot; style=&quot;line-height: 1.15 !important; margin-top: 0px !important;&quot;&gt;&lt;b data-index-in-node=&quot;0&quot; data-path-to-node=&quot;4,5,1,0&quot; style=&quot;line-height: 1.15 !important; margin-top: 0px !important;&quot;&gt;ITL4&lt;/b&gt;&lt;/span&gt;&lt;/td&gt;&lt;td style=&quot;border: 1px solid; line-height: 1.15 !important; margin-top: 0px !important;&quot;&gt;&lt;span data-path-to-node=&quot;4,5,2,0&quot; style=&quot;line-height: 1.15 !important; margin-top: 0px !important;&quot;&gt;40&lt;/span&gt;&lt;/td&gt;&lt;td style=&quot;border: 1px solid; line-height: 1.15 !important; margin-top: 0px !important;&quot;&gt;&lt;span data-path-to-node=&quot;4,5,3,0&quot; style=&quot;line-height: 1.15 !important; margin-top: 0px !important;&quot;&gt;Gives the solver more &quot;tries&quot; to fix a complex step.&lt;/span&gt;&lt;/td&gt;&lt;/tr&gt;&lt;tr style=&quot;line-height: 1.15 !important; margin-top: 0px !important;&quot;&gt;&lt;td style=&quot;border: 1px solid; line-height: 1.15 !important; margin-top: 0px !important;&quot;&gt;&lt;span data-path-to-node=&quot;4,6,0,0&quot; style=&quot;line-height: 1.15 !important; margin-top: 0px !important;&quot;&gt;&lt;b data-index-in-node=&quot;0&quot; data-path-to-node=&quot;4,6,0,0&quot; style=&quot;line-height: 1.15 !important; margin-top: 0px !important;&quot;&gt;Transient&lt;/b&gt;&lt;/span&gt;&lt;/td&gt;&lt;td style=&quot;border: 1px solid; line-height: 1.15 !important; margin-top: 0px !important;&quot;&gt;&lt;span data-path-to-node=&quot;4,6,1,0&quot; style=&quot;line-height: 1.15 !important; margin-top: 0px !important;&quot;&gt;&lt;b data-index-in-node=&quot;0&quot; data-path-to-node=&quot;4,6,1,0&quot; style=&quot;line-height: 1.15 !important; margin-top: 0px !important;&quot;&gt;TRTOL&lt;/b&gt;&lt;/span&gt;&lt;/td&gt;&lt;td style=&quot;border: 1px solid; line-height: 1.15 !important; margin-top: 0px !important;&quot;&gt;&lt;span data-path-to-node=&quot;4,6,2,0&quot; style=&quot;line-height: 1.15 !important; margin-top: 0px !important;&quot;&gt;15&lt;/span&gt;&lt;/td&gt;&lt;td style=&quot;border: 1px solid; line-height: 1.15 !important; margin-top: 0px !important;&quot;&gt;&lt;span data-path-to-node=&quot;4,6,3,0&quot; style=&quot;line-height: 1.15 !important; margin-top: 0px !important;&quot;&gt;Reduces sensitivity to rapid voltage changes.&lt;/span&gt;&lt;/td&gt;&lt;/tr&gt;&lt;tr style=&quot;line-height: 1.15 !important; margin-top: 0px !important;&quot;&gt;&lt;td style=&quot;border: 1px solid; line-height: 1.15 !important; margin-top: 0px !important;&quot;&gt;&lt;span data-path-to-node=&quot;4,7,0,0&quot; style=&quot;line-height: 1.15 !important; margin-top: 0px !important;&quot;&gt;&lt;b data-index-in-node=&quot;0&quot; data-path-to-node=&quot;4,7,0,0&quot; style=&quot;line-height: 1.15 !important; margin-top: 0px !important;&quot;&gt;Transient&lt;/b&gt;&lt;/span&gt;&lt;/td&gt;&lt;td style=&quot;border: 1px solid; line-height: 1.15 !important; margin-top: 0px !important;&quot;&gt;&lt;span data-path-to-node=&quot;4,7,1,0&quot; style=&quot;line-height: 1.15 !important; margin-top: 0px !important;&quot;&gt;&lt;b data-index-in-node=&quot;0&quot; data-path-to-node=&quot;4,7,1,0&quot; style=&quot;line-height: 1.15 !important; margin-top: 0px !important;&quot;&gt;TMIN&lt;/b&gt;&lt;/span&gt;&lt;/td&gt;&lt;td style=&quot;border: 1px solid; line-height: 1.15 !important; margin-top: 0px !important;&quot;&gt;&lt;span data-path-to-node=&quot;4,7,2,0&quot; style=&quot;line-height: 1.15 !important; margin-top: 0px !important;&quot;&gt;1e-12&lt;/span&gt;&lt;/td&gt;&lt;td style=&quot;border: 1px solid; line-height: 1.15 !important; margin-top: 0px !important;&quot;&gt;&lt;span data-path-to-node=&quot;4,7,3,0&quot; style=&quot;line-height: 1.15 !important; margin-top: 0px !important;&quot;&gt;Prevents the &quot;Timestep too small&quot; panic error.&lt;/span&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/tbody&gt;&lt;/table&gt;&lt;hr data-path-to-node=&quot;5&quot; style=&quot;font-family: &amp;quot;Google Sans Text&amp;quot;, sans-serif !important; line-height: 1.15 !important; margin-top: 0px !important;&quot; /&gt;&lt;h3 data-path-to-node=&quot;6&quot; style=&quot;font-family: &amp;quot;Google Sans&amp;quot;, sans-serif !important; line-height: 1.15 !important; margin-top: 0px !important;&quot;&gt;2. Animation Settings&lt;/h3&gt;&lt;p data-path-to-node=&quot;7&quot; style=&quot;font-family: &amp;quot;Google Sans Text&amp;quot;, sans-serif !important; line-height: 1.15 !important; margin-top: 0px !important;&quot;&gt;Access these via &lt;b data-index-in-node=&quot;17&quot; data-path-to-node=&quot;7&quot; style=&quot;line-height: 1.15 !important; margin-top: 0px !important;&quot;&gt;System -&amp;gt; Set Animation Options&lt;/b&gt;.&lt;/p&gt;&lt;table data-path-to-node=&quot;8&quot; style=&quot;font-family: &amp;quot;Google Sans Text&amp;quot;, sans-serif !important; line-height: 1.15 !important; margin-bottom: 32px; margin-top: 0px !important;&quot;&gt;&lt;thead style=&quot;line-height: 1.15 !important; margin-top: 0px !important;&quot;&gt;&lt;tr style=&quot;line-height: 1.15 !important; margin-top: 0px !important;&quot;&gt;&lt;td style=&quot;border: 1px solid; line-height: 1.15 !important; margin-top: 0px !important;&quot;&gt;&lt;strong style=&quot;line-height: 1.15 !important; margin-bottom: 0px !important; margin-top: 0px !important;&quot;&gt;Parameter&lt;/strong&gt;&lt;/td&gt;&lt;td style=&quot;border: 1px solid; line-height: 1.15 !important; margin-top: 0px !important;&quot;&gt;&lt;strong style=&quot;line-height: 1.15 !important; margin-bottom: 0px !important; margin-top: 0px !important;&quot;&gt;Recommended Value&lt;/strong&gt;&lt;/td&gt;&lt;td style=&quot;border: 1px solid; line-height: 1.15 !important; margin-top: 0px !important;&quot;&gt;&lt;strong style=&quot;line-height: 1.15 !important; margin-bottom: 0px !important; margin-top: 0px !important;&quot;&gt;Effect&lt;/strong&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/thead&gt;&lt;tbody style=&quot;line-height: 1.15 !important; margin-top: 0px !important;&quot;&gt;&lt;tr style=&quot;line-height: 1.15 !important; margin-top: 0px !important;&quot;&gt;&lt;td style=&quot;border: 1px solid; line-height: 1.15 !important; margin-top: 0px !important;&quot;&gt;&lt;span data-path-to-node=&quot;8,1,0,0&quot; style=&quot;line-height: 1.15 !important; margin-top: 0px !important;&quot;&gt;&lt;b data-index-in-node=&quot;0&quot; data-path-to-node=&quot;8,1,0,0&quot; style=&quot;line-height: 1.15 !important; margin-top: 0px !important;&quot;&gt;Frames per Second&lt;/b&gt;&lt;/span&gt;&lt;/td&gt;&lt;td style=&quot;border: 1px solid; line-height: 1.15 !important; margin-top: 0px !important;&quot;&gt;&lt;span data-path-to-node=&quot;8,1,1,0&quot; style=&quot;line-height: 1.15 !important; margin-top: 0px !important;&quot;&gt;&lt;b data-index-in-node=&quot;0&quot; data-path-to-node=&quot;8,1,1,0&quot; style=&quot;line-height: 1.15 !important; margin-top: 0px !important;&quot;&gt;20&lt;/b&gt;&lt;/span&gt;&lt;/td&gt;&lt;td style=&quot;border: 1px solid; line-height: 1.15 !important; margin-top: 0px !important;&quot;&gt;&lt;span data-path-to-node=&quot;8,1,2,0&quot; style=&quot;line-height: 1.15 !important; margin-top: 0px !important;&quot;&gt;Standard &quot;smooth&quot; video speed for meters/Serial.&lt;/span&gt;&lt;/td&gt;&lt;/tr&gt;&lt;tr style=&quot;line-height: 1.15 !important; margin-top: 0px !important;&quot;&gt;&lt;td style=&quot;border: 1px solid; line-height: 1.15 !important; margin-top: 0px !important;&quot;&gt;&lt;span data-path-to-node=&quot;8,2,0,0&quot; style=&quot;line-height: 1.15 !important; margin-top: 0px !important;&quot;&gt;&lt;b data-index-in-node=&quot;0&quot; data-path-to-node=&quot;8,2,0,0&quot; style=&quot;line-height: 1.15 !important; margin-top: 0px !important;&quot;&gt;Timestep per Frame&lt;/b&gt;&lt;/span&gt;&lt;/td&gt;&lt;td style=&quot;border: 1px solid; line-height: 1.15 !important; margin-top: 0px !important;&quot;&gt;&lt;span data-path-to-node=&quot;8,2,1,0&quot; style=&quot;line-height: 1.15 !important; margin-top: 0px !important;&quot;&gt;&lt;b data-index-in-node=&quot;0&quot; data-path-to-node=&quot;8,2,1,0&quot; style=&quot;line-height: 1.15 !important; margin-top: 0px !important;&quot;&gt;10m to 20m&lt;/b&gt;&lt;/span&gt;&lt;/td&gt;&lt;td style=&quot;border: 1px solid; line-height: 1.15 !important; margin-top: 0px !important;&quot;&gt;&lt;span data-path-to-node=&quot;8,2,2,0&quot; style=&quot;line-height: 1.15 !important; margin-top: 0px !important;&quot;&gt;Forces the solver to calculate more steps per visual frame.&lt;/span&gt;&lt;/td&gt;&lt;/tr&gt;&lt;tr style=&quot;line-height: 1.15 !important; margin-top: 0px !important;&quot;&gt;&lt;td style=&quot;border: 1px solid; line-height: 1.15 !important; margin-top: 0px !important;&quot;&gt;&lt;span data-path-to-node=&quot;8,3,0,0&quot; style=&quot;line-height: 1.15 !important; margin-top: 0px !important;&quot;&gt;&lt;b data-index-in-node=&quot;0&quot; data-path-to-node=&quot;8,3,0,0&quot; style=&quot;line-height: 1.15 !important; margin-top: 0px !important;&quot;&gt;Single Step Time&lt;/b&gt;&lt;/span&gt;&lt;/td&gt;&lt;td style=&quot;border: 1px solid; line-height: 1.15 !important; margin-top: 0px !important;&quot;&gt;&lt;span data-path-to-node=&quot;8,3,1,0&quot; style=&quot;line-height: 1.15 !important; margin-top: 0px !important;&quot;&gt;&lt;b data-index-in-node=&quot;0&quot; data-path-to-node=&quot;8,3,1,0&quot; style=&quot;line-height: 1.15 !important; margin-top: 0px !important;&quot;&gt;1m&lt;/b&gt;&lt;/span&gt;&lt;/td&gt;&lt;td style=&quot;border: 1px solid; line-height: 1.15 !important; margin-top: 0px !important;&quot;&gt;&lt;span data-path-to-node=&quot;8,3,2,0&quot; style=&quot;line-height: 1.15 !important; margin-top: 0px !important;&quot;&gt;Allows you to &quot;advance&quot; time in 1ms increments.&lt;/span&gt;&lt;/td&gt;&lt;/tr&gt;&lt;tr style=&quot;line-height: 1.15 !important; margin-top: 0px !important;&quot;&gt;&lt;td style=&quot;border: 1px solid; line-height: 1.15 !important; margin-top: 0px !important;&quot;&gt;&lt;span data-path-to-node=&quot;8,4,0,0&quot; style=&quot;line-height: 1.15 !important; margin-top: 0px !important;&quot;&gt;&lt;b data-index-in-node=&quot;0&quot; data-path-to-node=&quot;8,4,0,0&quot; style=&quot;line-height: 1.15 !important; margin-top: 0px !important;&quot;&gt;Max. SPICE Timestep&lt;/b&gt;&lt;/span&gt;&lt;/td&gt;&lt;td style=&quot;border: 1px solid; line-height: 1.15 !important; margin-top: 0px !important;&quot;&gt;&lt;span data-path-to-node=&quot;8,4,1,0&quot; style=&quot;line-height: 1.15 !important; margin-top: 0px !important;&quot;&gt;&lt;b data-index-in-node=&quot;0&quot; data-path-to-node=&quot;8,4,1,0&quot; style=&quot;line-height: 1.15 !important; margin-top: 0px !important;&quot;&gt;10u&lt;/b&gt;&lt;/span&gt;&lt;/td&gt;&lt;td style=&quot;border: 1px solid; line-height: 1.15 !important; margin-top: 0px !important;&quot;&gt;&lt;span data-path-to-node=&quot;8,4,2,0&quot; style=&quot;line-height: 1.15 !important; margin-top: 0px !important;&quot;&gt;&lt;b data-index-in-node=&quot;0&quot; data-path-to-node=&quot;8,4,2,0&quot; style=&quot;line-height: 1.15 !important; margin-top: 0px !important;&quot;&gt;Crucial.&lt;/b&gt; Must be smaller than your PWM period (32us).&lt;/span&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/tbody&gt;&lt;/table&gt;&lt;/div&gt;&lt;p data-path-to-node=&quot;1&quot; style=&quot;line-height: 1.15; margin-top: 0px;&quot;&gt;I hope this will be useful to others who want to do simulation of high speed, high frequency circuit.&lt;/p&gt;</content><link rel='replies' type='application/atom+xml' href='http://www.ee-diary.net/feeds/2662841389703899599/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.ee-diary.net/2026/03/how-to-fix-high-frequency-simulation.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7437986969318338216/posts/default/2662841389703899599'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7437986969318338216/posts/default/2662841389703899599'/><link rel='alternate' type='text/html' href='http://www.ee-diary.net/2026/03/how-to-fix-high-frequency-simulation.html' title='How to fix high frequency simulation error in Proteus'/><author><name>Unknown</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiDQqX4aL5qZYgkTFEdGT6gj_0R9qbLIYGCX4i1yHJWNyZg4IKeEvHknAedZ-lkxMWJxuH-b3DpAD6EObog0zU5VXakemBgtpmwTLl8U7zh_b1T1OKIUeIji1Qei3uhWMuh82qYSTIBPf3tcjqwOTLbL-gsuiiflxaLHftiD_I3WF-D0bYmtQ_tvjeAW1wl/s72-c/proteus%20simulation%20setting.png" height="72" width="72"/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-7437986969318338216.post-6898851396149214168</id><published>2026-03-30T21:21:00.003+05:45</published><updated>2026-03-30T21:21:18.145+05:45</updated><category scheme="http://www.blogger.com/atom/ns#" term="FM"/><category scheme="http://www.blogger.com/atom/ns#" term="tutorial"/><title type='text'>How FM Transmitter work – Electret Mic, Pre-Amp &amp; Colpitts Oscillator Explained</title><content type='html'>&lt;div class=&quot;separator&quot; style=&quot;display: none;&quot;&gt;&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjaZFcG4utiiJ2xTSYo10PpPFztnswI1U27_BA4Cg3ZnASUbaB_Z449OLfPLDBKSATSeu17n2OJattQQdsx83IYkKMzT0lJaBbEq2bIBcRp5eckdw2A_kO9MBsTfHaPwr9juk4cZGOWJ6eDj9dneW_l1sdx4YNbxkMap7aZlMe-Vde1_XQ2ApG7gttSzcM7/s1600/FM%20transmitter%20design%20and%20tutorial.png&quot; style=&quot;display: block; padding: 1em 0px; text-align: center;&quot;&gt;&lt;img alt=&quot;&quot; border=&quot;0&quot; data-original-height=&quot;1024&quot; data-original-width=&quot;1536&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjaZFcG4utiiJ2xTSYo10PpPFztnswI1U27_BA4Cg3ZnASUbaB_Z449OLfPLDBKSATSeu17n2OJattQQdsx83IYkKMzT0lJaBbEq2bIBcRp5eckdw2A_kO9MBsTfHaPwr9juk4cZGOWJ6eDj9dneW_l1sdx4YNbxkMap7aZlMe-Vde1_XQ2ApG7gttSzcM7/s1600/FM%20transmitter%20design%20and%20tutorial.png&quot; /&gt;&lt;/a&gt;&lt;/div&gt;
&lt;p&gt;It&#39;s been long time I haven&#39;t done any radio communication circuits. I spent lots of time in building AM transmitter and &lt;a href=&quot;https://www.ee-diary.net/2022/05/single-transistor-fm-transmitter.html&quot;&gt;FM transmitter circuit&lt;/a&gt;. When I was engineering student, we didn&#39;t had enough time to do the practical implementation of the radio. During the college time, I spent lot of time reading communication related theories but not how to actually build one. I remember Simon Hykin books which was our textbook but really the book was too much theoretical. No practical example circuits, just block diagram representing modulators, mixers, VCO, PLL etc. For example in the analog modulation chapters, like amplitude modulation, frequency modulation, there was no actual schematic of modulation and mixing and the RF filters etc. The book explained with block diagram like a square law modulator was drawn in boxes. No inside of how actually the circuit works. After my engineering degree, I searched internet and studied the communication circuits like modulator, mixers and I have built few of them.&lt;/p&gt;&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhDRoul6IZ5SWBsdD1nSola_Bzps3omLuaEncAR6-FhRL2UKZjvB4Q9FjLLRcWyKulu7r7d2fZk2Su6TZ9WuiSyWDyrQIUdZsGxtBQpl-xstkhBzm4zGB742ifbYmw5510pEgjQ9BlDlQdUbZ2JTITog_n1fhEar-BVvbrQN6VFcg66TlQDJBQYiRsYmkGf/s2308/FM%20transmitter%20with%20antenna.jpg&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img alt=&quot;FM transmitter with antenna&quot; border=&quot;0&quot; data-original-height=&quot;1668&quot; data-original-width=&quot;2308&quot; height=&quot;463&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhDRoul6IZ5SWBsdD1nSola_Bzps3omLuaEncAR6-FhRL2UKZjvB4Q9FjLLRcWyKulu7r7d2fZk2Su6TZ9WuiSyWDyrQIUdZsGxtBQpl-xstkhBzm4zGB742ifbYmw5510pEgjQ9BlDlQdUbZ2JTITog_n1fhEar-BVvbrQN6VFcg66TlQDJBQYiRsYmkGf/w640-h463/FM%20transmitter%20with%20antenna.jpg&quot; title=&quot;FM transmitter with antenna&quot; width=&quot;640&quot; /&gt;&lt;/a&gt;&lt;/div&gt;&lt;br /&gt;&lt;p&gt;Here I wanted to write a new diary note on a &lt;a href=&quot;https://www.ee-diary.net/2021/03/two-transistor-fm-transmitter.html&quot;&gt;FM transmitter that uses two BJT transistors&lt;/a&gt;. The circuit schematic diagram of the FM transmitter is shown below.&lt;/p&gt;&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgN5772vfgj7_N29Y2MqHwZS3UDb0lmsZEa4uRay9Bzb0M1400qtwjIhvSEp1u4QvvVrqpAqZ4FhyWw028ayVbdJDjZN_k_gq_5bgt_Xr-1pfPlQtqTA4Hg_tQ6m1q2XgE344NRHWeZ8wQILda-0YJNoS2TfU-owI3_20KXEwfqLdLG8rWWBPchXEIev_CB/s912/FM%20transmitter%20circuit%20diagram.png&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img alt=&quot;FM transmitter circuit diagram&quot; border=&quot;0&quot; data-original-height=&quot;557&quot; data-original-width=&quot;912&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgN5772vfgj7_N29Y2MqHwZS3UDb0lmsZEa4uRay9Bzb0M1400qtwjIhvSEp1u4QvvVrqpAqZ4FhyWw028ayVbdJDjZN_k_gq_5bgt_Xr-1pfPlQtqTA4Hg_tQ6m1q2XgE344NRHWeZ8wQILda-0YJNoS2TfU-owI3_20KXEwfqLdLG8rWWBPchXEIev_CB/s16000/FM%20transmitter%20circuit%20diagram.png&quot; title=&quot;FM transmitter circuit diagram&quot; /&gt;&lt;/a&gt;&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;Here the input is the audio signal using the electret microphone as shown in the FM transmitter schematic diagram above. The resistor R1 is for turning on the electret mic, without voltage applied to it via the resistor R1, the mic won&#39;t function. The audio from the mic enters into the self biased pre-amplifier circuit made up of the BC547 Q1 transistor, R2 and R3. The resistors R2 and R3 are biasing resistors and the biasing method used for the pre-amplifier is called &lt;a href=&quot;https://www.ee-diary.net/2021/10/how-to-design-self-biased-bjt-amplifier.html&quot;&gt;self biasing&lt;/a&gt;. The collector output is fed back into the base of the Q1 transistor in order to put the Q1 transistor in active region. The capacitors C1 and C2 are just coupling capacitors, which blocks dc signal and allows low frequency audio signal to pass through it. R3 resistor is the load of the pre-amplifier circuit and we can call it audio load. After amplification of the microphone audio signal, the amplified signal is passed into the actual oscillator with frequency modulator which is made up of the another BC547 BJT transistor Q2. The RF oscillator circuit comprises of Q1, R4, R5, C4,C5,C6 and the LC tank circuit made up of variable capacitor VC1(wrong symbol in the schematic, i forgot to put the variable capacitor symbol) and inductor L1. Their LC values depends upon the frequency of the carrier signal it will generate. The formula for LC circuit is,&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;\(f = \frac{1}{2 \pi \sqrt(L,C)}\)&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;The oscillator circuit is a &lt;a href=&quot;https://www.ee-diary.net/2022/06/Colpitts-oscillator-with-LM358-and-TL072-Op-Amps.html&quot;&gt;Colpitt oscillator&lt;/a&gt; variant, where C5 and C6 forms the feedback network structure like in standard Colpitts oscillator which are required for sustained oscillation. As you can see, part of the signal at the collector of Q2 goes back to its emitter via the C5 and C6 feedback circuit. This feedback signal is required for continuous oscillation to occur. The capacitor C4 is important to provide stability to the &lt;a href=&quot;https://www.ee-diary.net/2021/06/Practical-Colpitts-Oscillator-Breadboard.html&quot;&gt;RF colpitts oscillator circuit&lt;/a&gt;. C2 capacitor is just coupling capacitor that couples the amplified audio signal from the pre-amplifier circuit to the base of the oscillator circuit so that the DC operating point is not disturbed.&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;The RFC(Radio Frequency Choke) inductor is used to prevent loss of ac signal in the oscillator while providing the DC voltage to the RF oscillator.&amp;nbsp;&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;This video below explains in much greater details how the two transistors FM transmitter works.&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;&lt;iframe allowfullscreen=&quot;&quot; class=&quot;BLOG_video_class&quot; height=&quot;400&quot; src=&quot;https://www.youtube.com/embed/O2rJnu8jBM8&quot; width=&quot;481&quot; youtube-src-id=&quot;O2rJnu8jBM8&quot;&gt;&lt;/iframe&gt;&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;&lt;strong&gt;&lt;h3&gt;Related Articles&lt;/h3&gt;&lt;ul&gt;&lt;li&gt;&lt;a href=&quot;https://www.ee-diary.net/2023/04/ssb-demodulation-using-coherent.html&quot; rel=&quot;noopener noreferrer&quot; target=&quot;_blank&quot;&gt;ssb demodulation&lt;/a&gt;&lt;/li&gt;&lt;li&gt;&lt;a href=&quot;https://www.ee-diary.net/2023/03/bipolar-transistor-based-pierce-crystal.html&quot; rel=&quot;noopener noreferrer&quot; target=&quot;_blank&quot;&gt;bipolar transistor based pierce crystal&lt;/a&gt;&lt;/li&gt;&lt;li&gt;&lt;a href=&quot;https://www.ee-diary.net/2022/06/am-transmitter-with-crystal-oscillator.html&quot; rel=&quot;noopener noreferrer&quot; target=&quot;_blank&quot;&gt;AM transmitter with crystal oscillator&lt;/a&gt;&lt;/li&gt;&lt;li&gt;&lt;a href=&quot;https://www.ee-diary.net/2026/03/frequency-modulation-with-varactor.html&quot; rel=&quot;noopener noreferrer&quot; target=&quot;_blank&quot;&gt;FM Transmitter Circuit&lt;/a&gt;&lt;/li&gt;&lt;li&gt;&lt;a href=&quot;https://www.ee-diary.net/2026/03/proteus-fm-transmitter-simulation.html&quot; rel=&quot;noopener noreferrer&quot; target=&quot;_blank&quot;&gt;FM Transmitter Simulation&lt;/a&gt;&lt;/li&gt;&lt;li&gt;&lt;a href=&quot;https://www.ee-diary.net/2026/03/how-to-design-active-band-pass-filter.html&quot; rel=&quot;noopener noreferrer&quot; target=&quot;_blank&quot;&gt;Band Pass Filter Desig&lt;/a&gt;n&lt;/li&gt;&lt;/ul&gt;&lt;/strong&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://www.ee-diary.net/feeds/6898851396149214168/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.ee-diary.net/2026/03/how-fm-transmitter-work-electret-mic.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7437986969318338216/posts/default/6898851396149214168'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7437986969318338216/posts/default/6898851396149214168'/><link rel='alternate' type='text/html' href='http://www.ee-diary.net/2026/03/how-fm-transmitter-work-electret-mic.html' title='How FM Transmitter work – Electret Mic, Pre-Amp &amp; Colpitts Oscillator Explained'/><author><name>Unknown</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjaZFcG4utiiJ2xTSYo10PpPFztnswI1U27_BA4Cg3ZnASUbaB_Z449OLfPLDBKSATSeu17n2OJattQQdsx83IYkKMzT0lJaBbEq2bIBcRp5eckdw2A_kO9MBsTfHaPwr9juk4cZGOWJ6eDj9dneW_l1sdx4YNbxkMap7aZlMe-Vde1_XQ2ApG7gttSzcM7/s72-c/FM%20transmitter%20design%20and%20tutorial.png" height="72" width="72"/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-7437986969318338216.post-1031113152549522909</id><published>2026-03-30T05:59:00.002+05:45</published><updated>2026-03-30T06:00:54.771+05:45</updated><category scheme="http://www.blogger.com/atom/ns#" term="arduino"/><category scheme="http://www.blogger.com/atom/ns#" term="photodiode"/><title type='text'>Photodiode with Arduino Mega 2560: Light Detection Circuit + Proteus Simulation</title><content type='html'>&lt;div class=&quot;separator&quot; style=&quot;display: none;&quot;&gt;&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEh6vZItaY-69XYXDb1Rm4XHFWuw40K-4O0nZTZ-QSLreguUwGZiu1AU3H4UCMo9lahyXNi89fHamuucy7nQuizQzGz_vEsO-ZGEVdDF6LV0DMc7UmoZjxXvY1KtUNpO6EMHUyOUSDBjhOfDPvmStV_rkxei6Z6vlqgtLaIQfYDnfbr2cTTy7Dth_hXaOYtX/s1600/Arduino%20and%20photodiode%20setup%20guide.png&quot; style=&quot;display: block; padding: 1em 0px; text-align: center;&quot;&gt;&lt;img alt=&quot;&quot; border=&quot;0&quot; data-original-height=&quot;1024&quot; data-original-width=&quot;1536&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEh6vZItaY-69XYXDb1Rm4XHFWuw40K-4O0nZTZ-QSLreguUwGZiu1AU3H4UCMo9lahyXNi89fHamuucy7nQuizQzGz_vEsO-ZGEVdDF6LV0DMc7UmoZjxXvY1KtUNpO6EMHUyOUSDBjhOfDPvmStV_rkxei6Z6vlqgtLaIQfYDnfbr2cTTy7Dth_hXaOYtX/s1600/Arduino%20and%20photodiode%20setup%20guide.png&quot; /&gt;&lt;/a&gt;&lt;/div&gt;
I had bought this black photodiodes years ago I think but still haven&#39;t used it. So while I was surfing my old blog posts, I came across my old &lt;a href=&quot;https://www.ee-diary.net/2021/08/photodiode-light-detector-with-arduino.html&quot;&gt;Photodiode Light Detector with Arduino&lt;/a&gt; blog post. So I wanted to test the photodiode before I can use it in actual implementation. In the previous test when I wrote the blog post on photodiode with arduino, I use another kind of photodiode. And the black photodiode are the ones that are used in &lt;a href=&quot;https://www.ee-diary.net/2020/09/IR-sensor-Arduino-LCD-Buzzer-LED.html&quot;&gt;IR sensor&lt;/a&gt; modules and in the blog post &lt;a href=&quot;https://www.ee-diary.net/2026/02/how-to-build-simple-ir-sensor-based.html&quot;&gt;build simple IR sensor based alarm circuit&lt;/a&gt;. But these were IR sensor module which has the black light sensor photodiode and the IR emitting photodiode. To test the black light sensing photodiode, I used Arduino mega board this time. Previously I used Arduino Nano and right now my two Arduino Nanos are defective. I don&#39;t know why. I could be power surges damaging the voltage regulator something like that. So I am Arduino Mega 2560 with a black photodiode to sense whether the room is dark is not and if it is then turn a LED on.&amp;nbsp;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;Another thing I liked to do is to simulate the circuit in Proteus. What I did was create the Arduino, photodiode, LED functional circuit and wrote a program to test the circuit. Here I have first created a sensor circuit with the black photodiode, resistor, led with the Arduino. So the objective was to turn on the led connected to pin 9 of Arduino Mega, if there is darkness in the room. This circuit is not that hard and so I don&#39;t needed to use the &lt;a href=&quot;https://www.ee-diary.net/2026/03/arduino-mega-board-explorer-free-web-app.html&quot;&gt;Arduino Mega board explorer&lt;/a&gt;&amp;nbsp;that I had recently built.&amp;nbsp;&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;The &lt;b&gt;circuit diagram&lt;/b&gt; of photodiode with Arduino is below.&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgQYtrA_IIQ37vcQPQffkA5sTqcqPA8NPs3MAKyydVken9ltJIEnWl_sjolNa2kt8cib0EQJd9SCedMN9eeWhHDbIRCgKFWHe5SydAFt2XUCmhBwnMWZjvQ3ARkSVHPgsod-VZjaVI0XS1eKXz2k0zTL0_EWo_S-Ks_JC77kHShVqN4QKja4zWKluvs0-wU/s1180/arduino%20photodiode%20light%20detection%20circuit%20diagram.png&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img alt=&quot;arduino photodiode light detection circuit diagram&quot; border=&quot;0&quot; data-original-height=&quot;598&quot; data-original-width=&quot;1180&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgQYtrA_IIQ37vcQPQffkA5sTqcqPA8NPs3MAKyydVken9ltJIEnWl_sjolNa2kt8cib0EQJd9SCedMN9eeWhHDbIRCgKFWHe5SydAFt2XUCmhBwnMWZjvQ3ARkSVHPgsod-VZjaVI0XS1eKXz2k0zTL0_EWo_S-Ks_JC77kHShVqN4QKja4zWKluvs0-wU/s16000/arduino%20photodiode%20light%20detection%20circuit%20diagram.png&quot; title=&quot;arduino photodiode light detection circuit diagram&quot; /&gt;&lt;/a&gt;&lt;/div&gt;&lt;br /&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;I simulated it and it was working meaning that the code is ok.&amp;nbsp;&lt;/div&gt;&lt;div&gt;&lt;h4 style=&quot;text-align: left;&quot;&gt;Photodiode with Arduino Code&amp;nbsp;&lt;/h4&gt;&lt;div&gt;&lt;pre&gt;&lt;code&gt;
// Define pins
int photodiodePin = A1;
int ledPin = 9;

void setup() {
  Serial.begin(9600); // Set Serial output baud rate
  
  pinMode(ledPin, OUTPUT); // Set LED pin as output

  // For output format
  Serial.println(&quot;Outputs:&quot;);
  Serial.println(&quot;Voltage(V):&quot;);
  Serial.println(&quot;-------------------------------------------------------------\n&quot;);
}

void loop() {
  float anaValue = analogRead(photodiodePin); // Read analog value

  float voltage = (anaValue / 1024.0) * 5.0; // Convert to voltage
  
  Serial.println(String(voltage, 2) + &quot;V&quot;);

  // Check if voltage is less than 1V
  if (voltage &amp;lt; 1) {
    digitalWrite(ledPin, HIGH); // Turn LED ON
  } else {
    digitalWrite(ledPin, LOW);  // Turn LED OFF
  }

  delay(200); // Small delay
}
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;Then I uploaded the firmware into Arduino Mega 2560 using the Proteus firmware uploading program. I had program Arduino Uno using this Proteus firmware uploading tool but not the Arduino Mega. So I tried to achieve, test and accomplish not just one but multiple testing. First I was testing the photodiode with Arduino, then I also wanted the photodiode with arduino circuit simulation, another testing task was to test the Arduino Mega 2560 board in Proteus. Then I also tested serial data transfer from arduino into Proteus using the DP9 COM port connector. The incoming data was then connected to the virtual terminal to see the data. The data is light intensity captured by the ADC pin A1 of Arduino Mega and then converted to voltage and then sampled voltages value was sent from Arduino into Proteus virtual terminal for data display. So in short the virtual terminal is the serial monitor in Arduino IDE. So instead of opening and viewing data in serial monitor, I used the virtual terminal in proteus.&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;I have video recorded this work which I have shared on youtube. Watch the video below.&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;&lt;iframe allowfullscreen=&quot;&quot; class=&quot;BLOG_video_class&quot; height=&quot;498&quot; src=&quot;https://www.youtube.com/embed/6958ydiSq28&quot; width=&quot;599&quot; youtube-src-id=&quot;6958ydiSq28&quot;&gt;&lt;/iframe&gt;&lt;/div&gt;&lt;br /&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://www.ee-diary.net/feeds/1031113152549522909/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.ee-diary.net/2026/03/photodiode-with-arduino-mega-2560-light.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7437986969318338216/posts/default/1031113152549522909'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7437986969318338216/posts/default/1031113152549522909'/><link rel='alternate' type='text/html' href='http://www.ee-diary.net/2026/03/photodiode-with-arduino-mega-2560-light.html' title='Photodiode with Arduino Mega 2560: Light Detection Circuit + Proteus Simulation'/><author><name>Unknown</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEh6vZItaY-69XYXDb1Rm4XHFWuw40K-4O0nZTZ-QSLreguUwGZiu1AU3H4UCMo9lahyXNi89fHamuucy7nQuizQzGz_vEsO-ZGEVdDF6LV0DMc7UmoZjxXvY1KtUNpO6EMHUyOUSDBjhOfDPvmStV_rkxei6Z6vlqgtLaIQfYDnfbr2cTTy7Dth_hXaOYtX/s72-c/Arduino%20and%20photodiode%20setup%20guide.png" height="72" width="72"/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-7437986969318338216.post-599632756713711574</id><published>2026-03-29T18:33:00.003+05:45</published><updated>2026-03-29T18:34:10.395+05:45</updated><category scheme="http://www.blogger.com/atom/ns#" term="arduino"/><category scheme="http://www.blogger.com/atom/ns#" term="photodiode"/><title type='text'>Photodiode with Arduino: Faster, More Precise Light Sensing</title><content type='html'>&lt;figure style=&quot;display: none;&quot;&gt;&lt;img alt=&quot;Arduino Photodiode Tutorial: Build a Light Intensity Sensor &amp;amp; Circuit Diagram&quot; loading=&quot;lazy&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhzxUm8IIBBW26twJzfw-5faRFpUIxpE_z5zSlj5BaHvhIIPl1T70l5ZGgwH-cuk9TjH2fy29FGtB8PnuLmWSXAwPD7R_mUyu4fRFrtsPtZ1U8cY7WqisgnFiJDj0rYdrbMyq_1qIJALRWqra8sfCiTHo4S-FBiGoYUC1vCWDqi9ZNNJRDFrRWrrbXV1u_h/s1600/arduino%20photodiode%20tutorial.png&quot; /&gt;&lt;/figure&gt;
&lt;p&gt;&lt;em&gt;📖 7 min read&lt;/em&gt;&lt;/p&gt;&lt;p&gt;I wrote long ago about building&amp;nbsp;&lt;a href=&quot;https://www.ee-diary.net/2021/08/photodiode-light-detector-with-arduino.html&quot;&gt;photodiode light detector with arduino&lt;/a&gt;&amp;nbsp;and today I am revisiting this circuit. When I first experimented with photodiode sensor I used lamp to shine onto the photodiode to turn on a LED. This is the simplest circuit experiment you can do to learn photodiode and how to interface and interact with microcontroller board like Arduino.&amp;nbsp;&lt;/p&gt;&lt;p&gt;Here in this&amp;nbsp;&lt;strong&gt;Arduino Photodiode Tutorial&lt;/strong&gt;&amp;nbsp;we will guide you step-by-step through setting up a circuit, understanding the code, and getting accurate light intensity readings. We&#39;ll explore how to transform a simple photodiode into a powerful &lt;strong&gt;Light Intensity Sensor Arduino&lt;/strong&gt;, discuss the crucial differences in the &lt;strong&gt;Photodiode vs LDR Arduino&lt;/strong&gt; debate, and provide a clear &lt;strong&gt;Arduino Photodiode Circuit Diagram.&lt;/strong&gt;&lt;/p&gt;
&lt;img alt=&quot;Arduino Photodiode Tutorial: Build a Light Intensity Sensor &amp;amp; Circuit Diagram - 3&quot; loading=&quot;lazy&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjikfSGElKA6br5kqPpil1ktypwtAAeQsRy0ZpZz0pxFYN_o-_V0RXGB1jpEmh38k1NWBXTMzAQhDvs04aGH1c2NfzXNouhPXAnIaMhdrtCBQ-W-qmfmI1uptycvYvsYXUhY2dqxAh_8dFcZrXe2gEKUpxKNGwbk7JTnvkYTFSZc2VlnjdFwWGNCMAVX_5I/s643/Arduino%20Photodiode%20&amp;amp;%20Interfacing%20Circuit.jpg&quot; /&gt;&lt;br /&gt;&lt;p&gt;I remember when I first started experimenting with light sensors. It felt like magic to see a circuit react to ambient light! This guide aims to demystify that magic, making it accessible for everyone from beginners to intermediate hobbyists. We&#39;ll get hands-on and build a practical light sensing project together.&lt;/p&gt;

&lt;h3&gt;What is a Photodiode, and How Does It Work?&lt;/h3&gt;

&lt;p&gt;At its core, a photodiode is a semiconductor device that converts light into an electrical current. Think of it as a specialized diode designed to detect light. When photons (light particles) strike the photodiode&#39;s depletion region, they create electron-hole pairs. These charge carriers are then swept across the junction by an electric field, generating a current proportional to the intensity of the incident light. The brighter the light, the more photons hit the diode, and the larger the current produced. This makes it an excellent choice for a precise light detector.&lt;/p&gt;

&lt;p&gt;Unlike a regular LED, which emits light when current flows, a photodiode produces current when exposed to light. It&#39;s often operated in &quot;reverse bias,&quot; meaning a voltage is applied across it in the non-conducting direction. This increases the width of the depletion region, making it more sensitive to light and allowing for a faster response. For our Arduino project, we&#39;ll use a simple setup that converts this current change into a measurable voltage.&lt;/p&gt;&lt;img alt=&quot;photodiode&quot; border=&quot;0&quot; data-original-height=&quot;878&quot; data-original-width=&quot;400&quot; height=&quot;320&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjbJNrHvjkIP_ID5HCtXTgWQOVPT6McTXDoeFyV0X-RQk9AizSxIeJqcx6ZZiYhGmOn8BX2oB45IzAtdWaImJt9qDJV9ZA3eK0OLmB5MfZwl9ayvNiOrZdDEaYeoevHGXB1a1Lu97b_lva_/w146-h320/20210822_170709.jpg&quot; title=&quot;photodiode&quot; width=&quot;146&quot; /&gt;


&lt;h3&gt;Photodiode vs. LDR: Which Light Sensor is Right for Your Arduino Project?&lt;/h3&gt;

&lt;p&gt;This is a common question, and it&#39;s essential to understand the distinctions. You&#39;ve probably encountered the &lt;a href=&quot;https://www.ee-diary.net/2021/08/light-dependent-resistor-ldr-light.html&quot;&gt;light dependent resistor ldr light&lt;/a&gt; sensor, also known as a photoresistor. While both photodiodes and LDRs detect light, they do so in fundamentally different ways and offer distinct advantages.&lt;/p&gt;

&lt;ul&gt;
    &lt;li&gt;&lt;strong&gt;Speed:&lt;/strong&gt; Photodiodes are significantly faster. Their response time is in nanoseconds, making them ideal for applications requiring rapid light detection, like optical communication or bar code scanners. LDRs, on the other hand, have response times in milliseconds, which can be too slow for certain projects.&lt;/li&gt;
    &lt;li&gt;&lt;strong&gt;Linearity:&lt;/strong&gt; Photodiodes offer a much more linear response to light intensity. This means the output current is directly proportional to the light hitting it, making calibration and accurate measurements easier. LDRs have a highly non-linear response, which can be tricky to work with for precise measurements.&lt;/li&gt;
    &lt;li&gt;&lt;strong&gt;Sensitivity &amp;amp; Spectral Response:&lt;/strong&gt; Photodiodes can be designed to be sensitive to specific wavelengths (e.g., UV, visible, IR). LDRs typically have a broad spectral response, similar to the human eye. For a precise &lt;strong&gt;Light Intensity Sensor Arduino&lt;/strong&gt; that needs to differentiate light sources or operate in specific spectra, photodiodes are superior.&lt;/li&gt;
    &lt;li&gt;&lt;strong&gt;Cost &amp;amp; Complexity:&lt;/strong&gt; LDRs are generally cheaper and simpler to integrate into basic circuits. Photodiodes, especially high-performance ones, can be more expensive and sometimes require more complex circuitry (like a transimpedance amplifier) for optimal performance, though we&#39;ll use a simpler setup for our tutorial.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;For simple ambient light detection where speed and precision aren&#39;t critical, an LDR might suffice. But if you need accurate, fast, or spectrally specific light measurement, a photodiode is the clear winner. In my experience, when building anything that needs to react quickly or provide truly quantitative light data, I always reach for a photodiode.&lt;/p&gt;

&lt;h3&gt;Building Your Arduino Photodiode Circuit: Step-by-Step&lt;/h3&gt;

&lt;p&gt;Let&#39;s get our hands dirty and build the circuit. This section will walk you through the &lt;strong&gt;Arduino Photodiode Circuit Diagram&lt;/strong&gt; and connections. We&#39;ll use a simple reverse-biased configuration that&#39;s easy to implement and provides good results for general light intensity sensing.&lt;/p&gt;

&lt;h4&gt;Hardware List:&lt;/h4&gt;
&lt;ul&gt;
    &lt;li&gt;Arduino Uno (or compatible board)&lt;/li&gt;
    &lt;li&gt;Photodiode (e.g., BPW34 or similar general-purpose photodiode)&lt;/li&gt;
    &lt;li&gt;10k Ohm Resistor&lt;/li&gt;
    &lt;li&gt;Breadboard&lt;/li&gt;
    &lt;li&gt;Jumper Wires&lt;/li&gt;
    &lt;li&gt;USB Cable for Arduino&lt;/li&gt;
&lt;/ul&gt;

&lt;h4&gt;Circuit Diagram Explanation &amp;amp; Connections:&lt;/h4&gt;

&lt;p&gt;Below is circuit diagram for connecting photodiode sensor with the Arduino analog pin.&lt;/p&gt;&lt;p&gt;&lt;img alt=&quot;arduino photodiode light detection circuit diagram animation&quot; border=&quot;0&quot; data-original-height=&quot;598&quot; data-original-width=&quot;1180&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEh0AMGL65qUv9ygXDV1FG0tBMwWp_Io4UYFQJZR2Hucq3faV7U_GZWp51tuiCCZkxtbg84AESYV_Pjb41ld9dOvTGGwn8eH_ksuaqNBUhu4k2mxSWwX20GsFwgU8A_Ox82L356QrhdeSJ2XA37NCO6XkOk2XmfhrwsOpA72tDEhxa7GF7o2EGFQ95TYsDUW/s16000/arduino%20photodiode%20light%20detection%20circuit%20diagram%20animation.gif&quot; title=&quot;arduino photodiode light detection circuit diagram animation&quot; /&gt;&lt;/p&gt;&lt;p&gt;Here&#39;s how to connect your photodiode to the Arduino. Remember, photodiodes are typically polarized, so pay attention to the anode (positive) and cathode (negative) leads. Often, the shorter lead is the cathode, or there might be a flat edge on the body indicating the cathode side.&lt;/p&gt;

&lt;ol&gt;
    &lt;li&gt;&lt;strong&gt;Connect the Photodiode:&lt;/strong&gt; Insert your photodiode into the breadboard.&lt;/li&gt;
    &lt;li&gt;&lt;strong&gt;Reverse Bias Connection:&lt;/strong&gt;
        &lt;ul&gt;
            &lt;li&gt;Connect the &lt;strong&gt;anode&lt;/strong&gt; (positive lead) of the photodiode to the &lt;strong&gt;5V pin&lt;/strong&gt; on your Arduino.&lt;/li&gt;
            &lt;li&gt;Connect the &lt;strong&gt;cathode&lt;/strong&gt; (negative lead) of the photodiode to one end of the &lt;strong&gt;10k Ohm resistor&lt;/strong&gt;.&lt;/li&gt;
        &lt;/ul&gt;
    &lt;/li&gt;
    &lt;li&gt;&lt;strong&gt;Ground Connection:&lt;/strong&gt; Connect the other end of the &lt;strong&gt;10k Ohm resistor&lt;/strong&gt; to the &lt;strong&gt;GND pin&lt;/strong&gt; on your Arduino.&lt;/li&gt;
    &lt;li&gt;&lt;strong&gt;Analog Input Connection:&lt;/strong&gt; This is where we read the voltage. Connect a jumper wire from the point where the photodiode&#39;s &lt;strong&gt;cathode&lt;/strong&gt; meets the &lt;strong&gt;10k Ohm resistor&lt;/strong&gt; to an &lt;strong&gt;analog input pin&lt;/strong&gt; on your Arduino (e.g., &lt;code&gt;A0&lt;/code&gt;).&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;What we&#39;ve created is a voltage divider. When light hits the photodiode, its internal resistance changes, causing the voltage at pin &lt;code&gt;A0&lt;/code&gt; to fluctuate. The Arduino then reads this voltage.&lt;/p&gt;

&lt;h3&gt;Arduino Code for Light Intensity Measurement&lt;/h3&gt;

&lt;p&gt;Now that our hardware is ready, let&#39;s upload the code to make our Arduino understand and display the light intensity. This sketch will read the analog voltage from the photodiode and print it to the Serial Monitor.&lt;/p&gt;&lt;pre&gt;&lt;code class=&quot;language-arduino&quot;&gt;
// Define pins
int photodiodePin = A1;
int ledPin = 9;

void setup() {
  Serial.begin(9600); // Set Serial output baud rate
  
  pinMode(ledPin, OUTPUT); // Set LED pin as output

  // For output format
  Serial.println(&quot;Outputs:&quot;);
  Serial.println(&quot;Voltage(V):&quot;);
  Serial.println(&quot;-------------------------------------------------------------\n&quot;);
}

void loop() {
  float anaValue = analogRead(photodiodePin); // Read analog value

  float voltage = (anaValue / 1024.0) * 5.0; // Convert to voltage
  
  Serial.println(String(voltage, 2) + &quot;V&quot;);

  // Check if voltage exceeds 1V
  if (voltage &amp;gt; 0.05) {
    digitalWrite(ledPin, HIGH); // Turn LED ON
  } else {
    digitalWrite(ledPin, LOW);  // Turn LED OFF
  }

  delay(200); // Small delay
}
&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;&lt;strong&gt;Code Explanation:&lt;/strong&gt;&lt;/p&gt;
&lt;ul&gt;
    &lt;li&gt;&lt;code&gt;const int photodiodePin = A0;&lt;/code&gt;: We define which analog pin is connected to our photodiode circuit.&lt;/li&gt;
    &lt;li&gt;&lt;code&gt;Serial.begin(9600);&lt;/code&gt;: This line initializes serial communication, allowing your Arduino to send data to your computer&#39;s Serial Monitor.&lt;/li&gt;
    &lt;li&gt;&lt;code&gt;int lightValue = analogRead(photodiodePin);&lt;/code&gt;: This is the core of our light sensing. The &lt;code&gt;analogRead()&lt;/code&gt; function reads the voltage on the specified analog pin. It returns an integer value from 0 to 1023, where 0 typically corresponds to 0V and 1023 to 5V (for a 5V Arduino).&lt;/li&gt;
    &lt;li&gt;&lt;code&gt;map(lightValue, 0, 1023, 0, 100);&lt;/code&gt;: This optional line provides a simple way to convert the raw 0-1023 reading into a more human-readable percentage. Remember, actual light intensity measurement often requires calibration with a known light source.&lt;/li&gt;
    &lt;li&gt;&lt;code&gt;delay(100);&lt;/code&gt;: A short delay ensures we don&#39;t flood the Serial Monitor with too many readings, making it easier to observe changes.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Upload this code to your Arduino. Open the Serial Monitor (Tools -&amp;gt; Serial Monitor) in the Arduino
&lt;/p&gt;&lt;h3&gt;Related Articles&lt;/h3&gt;
&lt;ul&gt;
&lt;li&gt;&lt;a href=&quot;https://www.ee-diary.net/2020/09/IR-sensor-Arduino-LCD-Buzzer-LED.html&quot; rel=&quot;noopener noreferrer&quot; target=&quot;_blank&quot;&gt;IR sensor Arduino LCD Buzzer LED&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;https://www.ee-diary.net/2026/03/build-your-own-arduino-rc-car-bluetooth.html&quot; rel=&quot;noopener noreferrer&quot; target=&quot;_blank&quot;&gt;Arduino Projects&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;https://www.ee-diary.net/2026/03/arduino-matlab-real-time-plotting.html&quot; rel=&quot;noopener noreferrer&quot; target=&quot;_blank&quot;&gt;Arduino MATLAB&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;https://www.ee-diary.net/2026/03/build-pc-laptop-motherboard-pid.html&quot; rel=&quot;noopener noreferrer&quot; target=&quot;_blank&quot;&gt;Arduino PID Controller&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;https://www.ee-diary.net/2026/03/lm35-temperature-sensor-with-arduino.html&quot; rel=&quot;noopener noreferrer&quot; target=&quot;_blank&quot;&gt;Arduino Sensor Projects&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;https://www.ee-diary.net/2026/03/arduino-pid-controller-for-temperature.html&quot; rel=&quot;noopener noreferrer&quot; target=&quot;_blank&quot;&gt;Arduino PID Tutorial&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;script type=&quot;application/ld+json&quot;&gt;{
  &quot;@context&quot;: &quot;https://schema.org&quot;,
  &quot;@type&quot;: &quot;TechArticle&quot;,
  &quot;headline&quot;: &quot;Arduino Photodiode Tutorial: Build a Light Intensity Sensor &amp; Circuit Diagram&quot;,
  &quot;description&quot;: &quot;Welcome, fellow makers and students, to another exciting deep dive into the world of electronics! Today, we&#39;re tackling a fundamental yet incredibly versat&quot;,
  &quot;keywords&quot;: &quot;Arduino Photodiode Tutorial&quot;,
  &quot;timeRequired&quot;: &quot;7 min read&quot;,
  &quot;datePublished&quot;: &quot;2026-03-29T12:31:57.464Z&quot;,
  &quot;dateModified&quot;: &quot;2026-03-29T12:31:57.464Z&quot;,
  &quot;publisher&quot;: {
    &quot;@type&quot;: &quot;Organization&quot;,
    &quot;name&quot;: &quot;ee-diary&quot;,
    &quot;url&quot;: &quot;https://ee-diary.net&quot;
  }
}&lt;/script&gt;

&lt;script type=&quot;application/ld+json&quot;&gt;
{
  &quot;@context&quot;: &quot;https://schema.org&quot;,
  &quot;@type&quot;: &quot;FAQPage&quot;,
  &quot;mainEntity&quot;: [
    {
      &quot;@type&quot;: &quot;Question&quot;,
      &quot;name&quot;: &quot;What will this Arduino Photodiode Tutorial cover?&quot;,
      &quot;acceptedAnswer&quot;: {
        &quot;@type&quot;: &quot;Answer&quot;,
        &quot;text&quot;: &quot;This tutorial will guide you step-by-step through setting up a photodiode circuit with Arduino, understanding the necessary code, and obtaining accurate light intensity readings.&quot;
      }
    },
    {
      &quot;@type&quot;: &quot;Question&quot;,
      &quot;name&quot;: &quot;Can I build a light intensity sensor using an Arduino and a photodiode with this guide?&quot;,
      &quot;acceptedAnswer&quot;: {
        &quot;@type&quot;: &quot;Answer&quot;,
        &quot;text&quot;: &quot;Yes, the tutorial will show you how to transform a simple photodiode into a powerful light intensity sensor for Arduino applications.&quot;
      }
    },
    {
      &quot;@type&quot;: &quot;Question&quot;,
      &quot;name&quot;: &quot;What are the main differences between a photodiode and an LDR for Arduino projects?&quot;,
      &quot;acceptedAnswer&quot;: {
        &quot;@type&quot;: &quot;Answer&quot;,
        &quot;text&quot;: &quot;The tutorial will explore the crucial differences in the &#39;Photodiode vs LDR Arduino&#39; debate, helping you understand their distinct characteristics and best uses.&quot;
      }
    },
    {
      &quot;@type&quot;: &quot;Question&quot;,
      &quot;name&quot;: &quot;Will an Arduino Photodiode Circuit Diagram be provided?&quot;,
      &quot;acceptedAnswer&quot;: {
        &quot;@type&quot;: &quot;Answer&quot;,
        &quot;text&quot;: &quot;Yes, a clear Arduino Photodiode Circuit Diagram will be provided to assist you with the setup and connection of the components.&quot;
      }
    }
  ]
}
&lt;/script&gt;&lt;p&gt;&lt;/p&gt;</content><link rel='replies' type='application/atom+xml' href='http://www.ee-diary.net/feeds/599632756713711574/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.ee-diary.net/2026/03/photodiode-with-arduino-faster-more.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7437986969318338216/posts/default/599632756713711574'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7437986969318338216/posts/default/599632756713711574'/><link rel='alternate' type='text/html' href='http://www.ee-diary.net/2026/03/photodiode-with-arduino-faster-more.html' title='Photodiode with Arduino: Faster, More Precise Light Sensing'/><author><name>Unknown</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhzxUm8IIBBW26twJzfw-5faRFpUIxpE_z5zSlj5BaHvhIIPl1T70l5ZGgwH-cuk9TjH2fy29FGtB8PnuLmWSXAwPD7R_mUyu4fRFrtsPtZ1U8cY7WqisgnFiJDj0rYdrbMyq_1qIJALRWqra8sfCiTHo4S-FBiGoYUC1vCWDqi9ZNNJRDFrRWrrbXV1u_h/s72-c/arduino%20photodiode%20tutorial.png" height="72" width="72"/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-7437986969318338216.post-7622208290101089862</id><published>2026-03-29T03:54:00.002+05:45</published><updated>2026-03-29T03:54:19.023+05:45</updated><title type='text'>I Need to Memorize Github Pages and git commands </title><content type='html'>&lt;p&gt;It&#39;s 3:30AM and I am doing this chip explorer and IC explorer project and because the various coding AI model won&#39;t run, and they won&#39;t solve my coding task I gave them, it took me so long time to finally have the files for testing(testing only). Had a tea and fried rice before I came to know that my files were finally made ready by one of my favorite free AI model for coding. Tea is getting cold while I am writing this. So next I had to upload the files to Github. So I remember that large files cannot be uploaded with the provided default uploading process and so back then, a week ago, I had used git for the first time to upload the files. I wanted to learn Github and git commands because they are so normal for coders and professionals and I think learning it now would be smartest step. By getting comfortable with Git and GitHub early, I can avoid confusion later and build habits that professionals rely on every day.&lt;/p&gt;&lt;div class=&quot;z-0 flex min-h-[46px] justify-start&quot;&gt;&lt;/div&gt;&lt;div class=&quot;mt-3 w-full empty:hidden&quot;&gt;&lt;div class=&quot;text-center&quot;&gt;&lt;div class=&quot;inline-flex border border-gray-100 dark:border-gray-700 rounded-xl&quot;&gt;&lt;div class=&quot;bg-token-main-surface-tertiary w-px flex-1 self-stretch&quot;&gt;&lt;/div&gt;&lt;/div&gt;&lt;/div&gt;&lt;/div&gt;&lt;p&gt;And so, this time I wanted to record the git command to upload files so that I don&#39;t forget the commands to create a git repository and then upload the file using git command:&lt;/p&gt;&lt;pre&gt;&lt;code&gt;git clone https://github.com/YOUR_USERNAME/ic-explorer-assets.git
cd ic-explorer-assets
# Copy your files here
git add ic-explorer-core.css ic-explorer-engine.js
git commit -m &quot;Initial upload&quot;
git push origin main
&lt;/code&gt;&lt;/pre&gt;After that I had to create Github Page and the way to do it I have taken a screen shot which is below. Basically we have to turn on the main branch, that is turn on so that main branch is enabled because the files that were uploaded previously resides in that main branch under the newly created repository. This is how I am understanding, correct me if I am wrong, if anybody is reading this.&amp;nbsp;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhmWVMTXmVKNnMERQROGBauSpug2abXA3-oEiNhJ8Z_R0Mveltv0bfzEqsgB-tc__VDdbCvkt3ncYMqC2CwaTFLqPkH1e2g0y6P9us8idbvGU_blYD006lamZKsqvpO3W5zIZn49SCST1XQzJzBd0Ma0g0bRwIQjO_-WtrnG-C6prd9UhZv7V9YjJntE85x/s1126/github%20pages.png&quot; imageanchor=&quot;1&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img alt=&quot;github pages&quot; border=&quot;0&quot; data-original-height=&quot;687&quot; data-original-width=&quot;1126&quot; height=&quot;195&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhmWVMTXmVKNnMERQROGBauSpug2abXA3-oEiNhJ8Z_R0Mveltv0bfzEqsgB-tc__VDdbCvkt3ncYMqC2CwaTFLqPkH1e2g0y6P9us8idbvGU_blYD006lamZKsqvpO3W5zIZn49SCST1XQzJzBd0Ma0g0bRwIQjO_-WtrnG-C6prd9UhZv7V9YjJntE85x/w320-h195/github%20pages.png&quot; title=&quot;github pages&quot; width=&quot;320&quot; /&gt;&lt;/a&gt;&lt;/div&gt;&lt;br /&gt;&lt;div&gt;This is actually I think my 2nd time I am doing this but I forget, I have habit not to think too much when I am following tutorial or when I am trying to reach my aim fast. So that is why I am recording this note in this diary.&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://www.ee-diary.net/feeds/7622208290101089862/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.ee-diary.net/2026/03/i-need-to-memorize-github-pages-and-git.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7437986969318338216/posts/default/7622208290101089862'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7437986969318338216/posts/default/7622208290101089862'/><link rel='alternate' type='text/html' href='http://www.ee-diary.net/2026/03/i-need-to-memorize-github-pages-and-git.html' title='I Need to Memorize Github Pages and git commands '/><author><name>Unknown</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhmWVMTXmVKNnMERQROGBauSpug2abXA3-oEiNhJ8Z_R0Mveltv0bfzEqsgB-tc__VDdbCvkt3ncYMqC2CwaTFLqPkH1e2g0y6P9us8idbvGU_blYD006lamZKsqvpO3W5zIZn49SCST1XQzJzBd0Ma0g0bRwIQjO_-WtrnG-C6prd9UhZv7V9YjJntE85x/s72-w320-h195-c/github%20pages.png" height="72" width="72"/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-7437986969318338216.post-2487238738130822595</id><published>2026-03-28T23:15:44.466+05:45</published><updated>2026-03-28T23:23:45.664+05:45</updated><category scheme="http://www.blogger.com/atom/ns#" term="Oscillator"/><category scheme="http://www.blogger.com/atom/ns#" term="RF circuit"/><category scheme="http://www.blogger.com/atom/ns#" term="tutorial"/><title type='text'>DIY Ham Radio Oscillator Circuits: Build Stable VXO, Colpitts &amp; SSB Local Oscillators</title><content type='html'> &lt;p&gt;The 2N3904 transistor is humble, yet incredibly versatile bipolar transistor that can be used in RF projects like building oscillator for SSB AM transmitter. Often overlooked in favor of more specialized (and expensive) components, the 2N3904 truly earns its title as the &quot;Swiss Army Knife&quot; of RF, especially when it comes to building stable &lt;strong&gt;DIY Ham Radio Oscillator Circuits&lt;/strong&gt;. Here we look at the useful application of the 2N3904 transistor is in SSB AM transmitter.&lt;/p&gt;

&lt;figure&gt;&lt;img alt=&quot;DIY Ham Radio Oscillator Circuits: Build Stable VXO, Pierce &amp;amp; SSB Local Oscillators&quot; loading=&quot;lazy&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEg6G3WqOipLBi4ckKCeXkU3QD6nHh_9TbkQOnn90ssUG841gdq3s1VPY3EuPF1tCszAx-jN2kjVwzVIOBg1zAQFGONoLMyflahsb1BVCmXrjmR9KE5eDH452lrLWDyqJxWEPkK9ppXJuivhcSrOf61P5Pycxi9OM51_qX3is2hX9RTulioIRnOO44WqKAhk/s1600/2n3904%20oscillator%20for%20SSB%20Transmitter.png&quot; /&gt;&lt;/figure&gt;
&lt;p&gt;If you&#39;re looking for a reliable, cost-effective circuit you can build tonight for your QRP rig, SSB receiver, or even a simple test bench signal source, you&#39;ve come to the right place.&lt;/p&gt;

&lt;p&gt;Many ask if a low-cost transistor like the 2N3904 is &quot;good enough&quot; for a critical application like an SSB Local Oscillator (LO) compared to a fancy crystal oscillator module. The answer is a resounding yes, with proper design and component selection. We&#39;ll show you how to achieve excellent stability and performance, making the 2N3904 an indispensable part of your workbench.&lt;/p&gt;

&lt;p&gt;Here&#39;s the circuit diagram we&#39;ll be building and discussing:&lt;/p&gt;

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

&lt;h3&gt;Why the 2N3904 is Your Go-To Transistor for RF Oscillators&lt;/h3&gt;

&lt;p&gt;You might wonder why we&#39;d pick a general-purpose NPN transistor like the 2N3904 over a 2N2222 or even a JFET for an RF oscillator. The reasons are compelling: availability, cost, and surprisingly good performance. The 2N3904 boasts a typical &lt;code&gt;fT&lt;/code&gt;(transition frequency) of 300 MHz or more, making it perfectly capable of oscillating well into the VHF range, let alone the HF bands common for ham radio. It&#39;s inexpensive, widely available, and its TO-92 package is easy to work with on both breadboards and PCBs.&lt;/p&gt;

&lt;p&gt;While a 2N2222 is also an excellent choice, the 2N3904 often exhibits slightly better noise figures and higher &lt;code&gt;fT&lt;/code&gt; characteristics for similar cost, making it marginally superior for high-frequency low-power applications. JFETs like the 2N3819 are fantastic for oscillators due to their high input impedance, but they can be harder to source consistently and sometimes require more careful biasing. MOSFETs, while versatile, can introduce gate capacitance issues that complicate frequency stability in high-Q oscillator designs. For a straightforward, reliable &lt;b&gt;Bipolar Transistor RF Oscillator&lt;/b&gt; that&#39;s easy to implement, the 2N3904 truly shines.&lt;/p&gt;

&lt;h3&gt;The Pierce Oscillator: Theory of Operation&lt;/h3&gt;

&lt;p&gt;The Pierce oscillator is a classic crystal oscillator configuration, renowned for its simplicity and stability. At its heart, it uses a crystal operating in its series resonant mode, coupled with a transistor that provides the necessary gain and 180-degree phase shift. The crystal itself, along with the feedback capacitors (C1 and C2 in our schematic), provides the additional 180-degree phase shift required for sustained oscillation.&lt;/p&gt;

&lt;p&gt;In essence, the crystal acts as a highly selective filter, allowing only its resonant frequency to pass through with minimal loss. The transistor amplifies this signal, and the phase shift network (C1, C2, and the crystal) feeds it back to the input in phase, thus reinforcing the oscillation. For a deeper dive into &lt;a href=&quot;https://www.ee-diary.net/2023/03/how-pierce-crystal-oscillator-works.html&quot;&gt;how pierce crystal oscillator works&lt;/a&gt;, you can explore our detailed article. This robust and straightforward &lt;b&gt;Crystal Oscillator Design&lt;/b&gt; is why it&#39;s a popular choice for everything from microcontrollers to ham radio transceivers. If you&#39;re new to the concept, our &lt;a href=&quot;https://www.ee-diary.net/2024/11/introduction-to-crystal-oscillators.html&quot;&gt;introduction to crystal oscillators&lt;/a&gt; provides an excellent foundation.&lt;/p&gt;

&lt;h3&gt;Component Selection for High Stability VXO Design&lt;/h3&gt;

&lt;p&gt;Achieving a stable frequency output, especially for an SSB Local Oscillator Circuit, is paramount. The circuit diagram of an oscillator that can be used in SSB AM transmitter is shown below.&lt;/p&gt;&lt;p&gt;&lt;img alt=&quot;DIY Ham Radio Oscillator Circuits: Build Stable VXO, Pierce &amp;amp; SSB Local Oscillators - 2&quot; loading=&quot;lazy&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEj-dL8eOiqv1HLunTNQawqANaYTsKCuZxw29GkR9K7CSNAPHAawxd8NhhFY3wSAga3U0sXdf7aYC825Jeau1c-hkDAHN42m-No_JqTJ1z8SFjRxRM3u5sAFIXWLhyxMcQeWMX4FCM88Wdaa36SZ_qSKXrzokKdDtlWuJdSqvenbYTpUBf4KGgQzNKGz6gUq/s764/2n3904%20oscillator%20for%20SSB%20Transmitter.png&quot; /&gt;&lt;/p&gt;&lt;p&gt;Here&#39;s a breakdown of critical component choices:&lt;/p&gt;

&lt;ul&gt;
    &lt;li&gt;&lt;strong&gt;Crystal (XTAL1):&lt;/strong&gt; Select a fundamental mode crystal for your desired frequency. For QRP SSB applications, common frequencies might be 3.579 MHz (colorburst crystal, easy to find) or crystals around 7 MHz, 10 MHz, or 14 MHz. The VXO (Variable Crystal Oscillator) concept allows you to &quot;pull&quot; the crystal&#39;s frequency slightly (typically a few kHz) by adding a small inductor or variable capacitor in series or parallel with it.&lt;/li&gt;
    &lt;li&gt;&lt;strong&gt;Feedback Capacitors (C1, C2):&lt;/strong&gt; These are perhaps the most critical components for frequency stability. You absolutely must use (Negative-Positive-Zero) or ceramic capacitors. Why? Their capacitance value is extremely stable across temperature changes. Standard ceramic capacitors (X7R, Z5U) drift significantly with temperature, causing your oscillator frequency to wander – a nightmare for SSB reception or transmission. Typical values range from 47pF to 100pF, depending on your crystal&#39;s characteristics and desired pulling range. For VXO operation, you might replace C1 or C2 with a small variable capacitor (trimmer or polyvaricon) in series with a fixed NPO cap.&lt;/li&gt;
    &lt;li&gt;&lt;strong&gt;Biasing Resistors (R1, R2, R3, R4):&lt;/strong&gt;
        &lt;ul&gt;
            &lt;li&gt;R1 (100kΩ) and R2 (10kΩ): Form a voltage divider to bias the base of the 2N3904. These values set the operating point.&lt;/li&gt;
            &lt;li&gt;R3 (1kΩ): Emitter resistor, provides stability and current feedback.&lt;/li&gt;
            &lt;li&gt;R4 (10kΩ): Collector resistor, sets the collector current and provides the output impedance.&lt;/li&gt;
        &lt;/ul&gt;
    &lt;/li&gt;
    &lt;li&gt;&lt;strong&gt;Output Capacitor (C3, 0.1µF):&lt;/strong&gt; A DC blocking capacitor to isolate the oscillator from subsequent stages. Use a ceramic or Mylar capacitor.&lt;/li&gt;
    &lt;li&gt;&lt;strong&gt;Power Supply (9V-12
&lt;h3&gt;Related Articles&lt;/h3&gt;
&lt;ul&gt;
&lt;li&gt;&lt;a href=&quot;https://www.ee-diary.net/2023/04/ssb-demodulation-using-coherent.html&quot; rel=&quot;noopener noreferrer&quot; target=&quot;_blank&quot;&gt;ssb demodulation&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;https://www.ee-diary.net/2023/03/bipolar-transistor-based-pierce-crystal.html&quot; rel=&quot;noopener noreferrer&quot; target=&quot;_blank&quot;&gt;bipolar transistor based pierce crystal&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;https://www.ee-diary.net/2022/06/am-transmitter-with-crystal-oscillator.html&quot; rel=&quot;noopener noreferrer&quot; target=&quot;_blank&quot;&gt;AM transmitter with crystal oscillator&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;https://www.ee-diary.net/2026/03/frequency-modulation-with-varactor.html&quot; rel=&quot;noopener noreferrer&quot; target=&quot;_blank&quot;&gt;FM Transmitter Circuit&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;https://www.ee-diary.net/2026/03/proteus-fm-transmitter-simulation.html&quot; rel=&quot;noopener noreferrer&quot; target=&quot;_blank&quot;&gt;FM Transmitter Simulation&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;https://www.ee-diary.net/2026/03/how-to-design-active-band-pass-filter.html&quot; rel=&quot;noopener noreferrer&quot; target=&quot;_blank&quot;&gt;Band Pass Filter Design&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;https://www.ee-diary.net/2026/03/how-to-calculate-rc-snubber-circuit.html&quot; rel=&quot;noopener noreferrer&quot; target=&quot;_blank&quot;&gt;RC Snubber Circuit&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;script type=&quot;application/ld+json&quot;&gt;{
  &quot;@context&quot;: &quot;https://schema.org&quot;,
  &quot;@type&quot;: &quot;TechArticle&quot;,
  &quot;headline&quot;: &quot;DIY Ham Radio Oscillator Circuits: Build Stable VXO, Pierce &amp; SSB Local Oscillators&quot;,
  &quot;description&quot;: &quot;Welcome, fellow radio enthusiasts and electronics explorers! Today, we&#39;re diving into the heart of many RF projects: the humble, yet incredibly versatile, &quot;,
  &quot;keywords&quot;: &quot;DIY Ham Radio Oscillator Circuits&quot;,
  &quot;timeRequired&quot;: &quot;5 min read&quot;,
  &quot;datePublished&quot;: &quot;2026-03-28T17:20:10.208Z&quot;,
  &quot;dateModified&quot;: &quot;2026-03-28T17:20:10.208Z&quot;,
  &quot;publisher&quot;: {
    &quot;@type&quot;: &quot;Organization&quot;,
    &quot;name&quot;: &quot;ee-diary&quot;,
    &quot;url&quot;: &quot;https://ee-diary.net&quot;
  }
}&lt;/script&gt;

&lt;script type=&quot;application/ld+json&quot;&gt;
{
  &quot;@context&quot;: &quot;https://schema.org&quot;,
  &quot;@type&quot;: &quot;FAQPage&quot;,
  &quot;mainEntity&quot;: [
    {
      &quot;@type&quot;: &quot;Question&quot;,
      &quot;name&quot;: &quot;Is the 2N3904 transistor suitable for high-stability RF oscillator circuits, such as an SSB Local Oscillator?&quot;,
      &quot;acceptedAnswer&quot;: {
        &quot;@type&quot;: &quot;Answer&quot;,
        &quot;text&quot;: &quot;Yes, despite being a low-cost component, the 2N3904 can achieve excellent stability and performance in critical applications like SSB Local Oscillators when designed with proper component selection.&quot;
      }
    },
    {
      &quot;@type&quot;: &quot;Question&quot;,
      &quot;name&quot;: &quot;What types of Ham Radio projects can utilize a 2N3904-based oscillator?&quot;,
      &quot;acceptedAnswer&quot;: {
        &quot;@type&quot;: &quot;Answer&quot;,
        &quot;text&quot;: &quot;The 2N3904 is highly versatile for DIY Ham Radio oscillator circuits, including QRP rigs, SSB receivers, and even general test bench signal sources.&quot;
      }
    },
    {
      &quot;@type&quot;: &quot;Question&quot;,
      &quot;name&quot;: &quot;Why is the 2N3904 considered a good choice for DIY RF oscillator projects?&quot;,
      &quot;acceptedAnswer&quot;: {
        &quot;@type&quot;: &quot;Answer&quot;,
        &quot;text&quot;: &quot;The 2N3904 is valued for its versatility, reliability, and cost-effectiveness, earning it the title &#39;Swiss Army Knife&#39; of RF components, making it ideal for accessible DIY builds.&quot;
      }
    }
  ]
}
&lt;/script&gt;&lt;/strong&gt;&lt;/li&gt;&lt;/ul&gt;</content><link rel='replies' type='application/atom+xml' href='http://www.ee-diary.net/feeds/2487238738130822595/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.ee-diary.net/2026/03/diy-ham-radio-oscillator-circuits-build.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7437986969318338216/posts/default/2487238738130822595'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7437986969318338216/posts/default/2487238738130822595'/><link rel='alternate' type='text/html' href='http://www.ee-diary.net/2026/03/diy-ham-radio-oscillator-circuits-build.html' title='DIY Ham Radio Oscillator Circuits: Build Stable VXO, Colpitts &amp; SSB Local Oscillators'/><author><name>Unknown</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEg6G3WqOipLBi4ckKCeXkU3QD6nHh_9TbkQOnn90ssUG841gdq3s1VPY3EuPF1tCszAx-jN2kjVwzVIOBg1zAQFGONoLMyflahsb1BVCmXrjmR9KE5eDH452lrLWDyqJxWEPkK9ppXJuivhcSrOf61P5Pycxi9OM51_qX3is2hX9RTulioIRnOO44WqKAhk/s72-c/2n3904%20oscillator%20for%20SSB%20Transmitter.png" height="72" width="72"/><thr:total>0</thr:total></entry></feed>