On Sep 11, 2008, at 3:59 PM, Martin Peach wrote:
From: Derek Holzer derek@umatic.nl To: pd-list@iem.at Subject: [PD] OT: PWM frequency of Arduino Date: Thu, 11 Sep 2008 21:09:33 +0200
Hi all,
using Pduino as a CV generator for my modular. First problem is to
make a low pass filter circuit to remove the PWM noise and get smooth
DC out. Might be helpful to know the default PWM frequency. I know it's
set in the firmware, but I've read everything from 450 Hz to 32 Khz, and several other numbers in between out there in Googleland. I'm using Arduino 0011 and the Arduino NG board (ATMega8 controller). Anyone
have the definitive answer?The atmega168 data sheet gives the frequency for Timer1 in phase- correct pwm mode as fclk_I/O/(2*N*TOP) where N is prescaler (set to 64 in init() in wiring.c), TOP is set
to 255 in init() in wiring.c, and fclk_I/O is equal to the crystal frequency (16000000), so it should be about 490.2Hz. (I have a motor
connected to it now and it sounds about that pitch at low duty cycles.)On the atmega168, Timer0 is used in fast pwm mode and runs at twice
that frequency.
I have 30kHz burned in my brain, but I don't have a reference.
You could try setting the PWM at 50% duty cycle, hooking it up via
big capacitor (to filter the DC) to a speaker. Then compare the
sound to a square wave generated by Pd.
.hc
Martin
Pd-list@iem.at mailing list UNSUBSCRIBE and account-management -> http://lists.puredata.info/ listinfo/pd-list
¡El pueblo unido jamás será vencido!