A minimalist prototype to produce a low-voltage PWM signal and enable users to control its pulse width, based on Arduino Nano (Atmel ATMega328p).
G1. Nominal topology shall operate with mains 127VAC @ 60Hz.
F1. UI-enabled PWM, based on Arduino Nano (Atmel ATMega328p).
F2. Leverages Timer/Counter1 register to offer best hardware MCU resolution of 16bit.
F3. Generates a fast-pwm signal on pin D9 with variable duty cycle, at nominal 120Hz, as provided hereby.
F4. Leverages direct MCU register manipulation to efficiently adjust PWM waveform in frequency and duty-cycle.
F5. Provides a UI consisting of a 10kΩ potentiometer to regulate duty-cycle.
F6. Potentiometer wiper to be sampled at pin A0.
F7. ADC registeres catch analog input A0 to adjust duty cycle register OCR1A.
F8. PWM frequency to be adjusted with register ICR1.
F9. Pulse width updates take place in ISR TIMER1_COMPA vector.
F10. Schematic and BOM: 20250502 - SCH - UI_PWM.pdf
By: Javier.
Glad to advise your project:
Portfolio: https://sites.google.com/view/b-eng-jarl/home
Arduino Forums: j4v13r_987
GitHub: J4v1987
H1. Loaded to Arduino Nano V3 using Arduino IDE 2.3.6. Deemed operational as per read-me media.
FR1. Atmel (2015). ATmega328P 8-bit AVR Microcontroller with 32K Bytes In-System Programmable Flash DATASHEET. [online] Available at: https://ww1.microchip.com/downloads/en/DeviceDoc/Atmel-7810-Automotive-Microcontrollers-ATmega328P_Datasheet.pdf.
FR2. Monk, S. (2017). Electronics Cookbook: Using PWM Outputs to Control Power Output. [online] https://learning.oreilly.com. Available at: https://learning.oreilly.com/videos/electronics-cookbook/ [Accessed 25 Apr. 2025].
FR3. Scherz, Paul, and Simon Monk. “Practical Electronics for Inventors.” Https://Learning.oreilly.com, O’Reilly Media, Inc., Apr. 2016, learning.oreilly.com/library/view/practical-electronics-for. Accessed Apr. 2025. ISBN 978-1-25-958754-2, e-ISBN 978-1-25-958755-9.
ACK1. Harvard-style references: MyBib Contributors (2019). Harvard Referencing Generator – FREE – (updated for 2019). [online] MyBib. Available at: https://www.mybib.com/tools/harvard-referencing-generator.
ACK2. Peer-checking and internet data scraping: Pi.ai. (2025). AVR PWM [thread]. Pi, your personal AI. [online] Available at: https://pi.ai.
ACK3. Video editing: Kdenlive project. https://kdenlive.org/.
ACK4. Operating system: Ubuntu. https://ubuntu.com/.
DS1. Arduino Forum. (2025). Is the Timer/Counter 0 limited to prescaler of 64? [online] Available at: https://forum.arduino.cc/t/is-the-timer-counter-0-limited-to-prescaler-of-64/1376889?u=j4v13r_987 [Accessed 29 Apr. 2025].
DS2. Dylan144GT (2018). Setting up Arduino Uno (ATMEGA328P) PWM with Timer1. [online] Stack Overflow. Available at: https://stackoverflow.com/questions/48873501/setting-up-arduino-uno-atmega328p-pwm-with-timer1.

