Uploaded August 2024 | Updated November 2026, 1 day ago
In this video I go through TWO of the THREE steps needed to get a good 16bit "analog" output from an Arduino. It is a very theory dense video about registers and binary math. If you are interested in just how to set the registers to get faster PWM check the chapters, and the Cheat sheet.
This is the second video about how DualPWM works, where the first video I showed how it works, and in this video we dive deeper into how to configure the Arduino to get a better analog signal out. We do this by speeding up the PWM frequency outside of the hearable range with register manipulation, and by tuning the resistors for the two pwm outputs so there is a good ratio between the two. In the next video I will show how to filter the signal to get the final actual analog output.
Cheat Sheet for setting the TCCRnA/B registers: docs.google.com/spreadsheets/d/1C0q_IB5QaT36SNPkw4a2zEetK-U1r_IYP37szSlvJeU/edit?usp=sharing
The simple code with a lot of comments:
github.com/SourceryOne/PWM-register-manipulation/blob/main/dual_pwm_register_manipulation.ino
Secrets of Arduino PWM: docs.arduino.cc/tutorials/generic/secrets-of-arduino-pwm
AtMega328P Datasheet: ww1.microchip.com/downloads/en/DeviceDoc/Atmel-7810-Automotive-Microcontrollers-ATmega328P_Datasheet.pdf
Modular in a Week playlist:
youtube.com/playlist?list=PLyE56WXw0_5Q5QGMEXWmskuhojKyRdA3T
My Tindie store:
tindie.com/stores/Sourcery
Support my work by becoming a Patreon:
patreon.com/SourceryOne
Join the discussion on the Discord server: discord.gg/pZtVheVCTW
In this video I go through TWO of the THREE steps needed to get a good 16bit "analog" output from an Arduino. It is a very theory dense video about registers and binary math. If you are interested in just how to set the registers to get faster PWM check the chapters, and the Cheat sheet.
This is the second video about how DualPWM works, where the first video I showed how it works, and in this video we dive deeper into how to configure the Arduino to get a better analog signal out. We do this by speeding up the PWM frequency outside of the hearable range with register manipulation, and by tuning the resistors for the two pwm outputs so there is a good ratio between the two. In the next video I will show how to filter the signal to get the final actual analog output.
Cheat Sheet for setting the TCCRnA/B registers: docs.google.com/spreadsheets/d/1C0q_IB5QaT36SNPkw4a2zEetK-U1r_IYP37szSlvJeU/edit?usp=sharing
The simple code with a lot of comments:
github.com/SourceryOne/PWM-register-manipulation/blob/main/dual_pwm_register_manipulation.ino
Secrets of Arduino PWM: docs.arduino.cc/tutorials/generic/secrets-of-arduino-pwm
AtMega328P Datasheet: ww1.microchip.com/downloads/en/DeviceDoc/Atmel-7810-Automotive-Microcontrollers-ATmega328P_Datasheet.pdf
Modular in a Week playlist:
youtube.com/playlist?list=PLyE56WXw0_5Q5QGMEXWmskuhojKyRdA3T
My Tindie store:
tindie.com/stores/Sourcery
Support my work by becoming a Patreon:
patreon.com/SourceryOne
Join the discussion on the Discord server: discord.gg/pZtVheVCTW










