it takes in audio on ADC0 and uses a dual pwm to create 16b audio out. you can process the audio in-between and make a low-fi effects pedal. it can be used for just analog out as well, and is much higher quality than using analogwrite (although more complicated too).
there is a much more in-depth tutorial on pwm in general up here:
Hi
I have tried your code on my Arduino Mega2560, it doesn't work.
Are the code for Atmega328 and Atmega2560 different?
Any hint to convert the code to Arduino Mega2560?
it can output .wav, but there isnt an SD card reader setup for it yet. so if you have something that can read SD cards, you can use the PWM to output it. this is what the simpleSD does.
yes, its primarily for doing guitar/voice effects on the cheap. but, the pwm side is just a generic setup routine to configure the pwm for various data rates and bit depths, so that can be used for any audio application.
I need to address the Resistor Values and also the reference ground voltage and also one of the capacitor values in this circuit.
I am encouraged with progress to date the next stage of the project is interfacing the guitar signal with Pure Data and adding additional controls as set out in the first video
so some more reading on Pduino.
These are really just bench notes again on progress to date still unresolved are the 5 way selector switch hack for the Pickup replacer selection so very much a work in progress.
donny18:
hi g_u_e_s_t,
is there any option to increase the output frequency further? I require PWM signals with 384kHz.
Guest means that the original poster has deleted his account. So he will not give an answer. This post is from 2013 and you should not have resurrected it.
The PWM frequency can be increased by altering registers in the processor, but that will not help you much because the limit is on the input side.
And be sure to use 1% resistors for 14bits and higher PWMs.
This is total rubbish. One percent is one part in 100 and is more like the sort of accuracy you need for 7 bits. For every extra bit you need to double the accuracy of these resistors so for 14 bits your potential divider has to be made from 0.0000001% something that is impossible to get in fixed resistors.
0.01% will get you 13 bits, and that's perfectly possible to find (in a very limited range of values), but very
expensive!
However the stray resistances in the circuit and output drivers for pins will tend to eat away at the
accuracy anyway if expecting such accuracy
When using two resistors for the divider shown, the only accuracy requirement is relative between the
two resistors, and that corresponds to 8 bits, not the full 16 of the signal. One resistor is subdividing
the steps of the other one, not providing full-range accuracy.
What has to be 16 bit accurate is the PWM wave timing, so a quartz crystal is required for the system
clock, not a ceramic resonator.