Increasing PWM frequency on Arduino Uno for sumo bot — anyone done direct register manipulation?
Posted: Tue May 05, 2026 10:56 am
Bumubuo ng 1kg sumo bot for inter-college comp soon. Default Arduino runs PWM at around 490Hz on most pins, kaya may audible whine yung motors namin. More importantly, hindi maganda ang ramp-up ng speed.
Alam ko kayang i-manipulate yung AVR timer registers directly —, , — change yung prescaler, bump PWM up to 31kHz. Catch is each timer also drives and , so pag tinangal mo Timer 0, sira na yung timing functions mo.
Plan ko ngayon: gamitin yung Timer 1 (pins 9 + 10) for motor PWM, leave Timer 0 alone. Pero mawawala na yung sa pins 9/10, kelangan i-write directly yung OCR values.
May nakapag-try na ba nito sa sumo or line-follower? Mainly:
Code: Select all
analogWrite()Alam ko kayang i-manipulate yung AVR timer registers directly —
Code: Select all
TCCR0BCode: Select all
TCCR1BCode: Select all
TCCR2BCode: Select all
delay()Code: Select all
millis()Plan ko ngayon: gamitin yung Timer 1 (pins 9 + 10) for motor PWM, leave Timer 0 alone. Pero mawawala na yung
Code: Select all
analogWrite()May nakapag-try na ba nito sa sumo or line-follower? Mainly:
- Did the higher PWM frequency actually improve motor smoothness, or placebo lang?
- Any L298N gotchas? Baka nga hindi ito tumatanggap ng PWM above 10kHz nang maayos.
- Mas okay ba mag-Mega na lang for the dedicated timer pins?