Continue to Site

Welcome to our site!

Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.

  • Welcome to our site! Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.

Arduino Guitar Effects Pedal Project

Status
Not open for further replies.
Hello again,

Oh ok if the problem is in the op amp circuit then you just have to isolate that circuit then.
The simple solution is with a resistor, then filter caps, but the better way is with resistor, inductor, and filter caps. This is the same way RF circuits are handled on the output stage and some intermediate stages.
 
I think I'm going to give up on this project. This setup is just too noisy to be usable. I was able to reduce the noise by half by adding a 0.1uF capacitor to the 2.5V supply from the voltage divider but there is still too much noise and it's very irritating on the ears. I suspect the main issue is some sort of a ground loop issue, I can see the spikes the digital I/O pins produce on pretty much every test point I look at. I even tried using a separate power supply for the analog section but this didn't help since the analog and digital sections still shared a common ground.

Since everything is soldered in place reworking the ground routing isn't really an option. I guess I'm just going to consider this project a good learning experience. I did a lot of research on ground loops and RC and RLC filters so I did learn a lot from this project; how not to build a digital effects processor ;-)

The ElectroSmash PedalShield schematic I started with seems reasonable but I wonder how much noise these have if you use their PCB. Unfortunately they don't release their PCB routing files so I can't really look at how they've dealt with the digital interference noise issues. If anyone has one of these kits I'm very interested in knowing just how noisy they are in practice.

My effects pedal will probably work okay if I code up a Fuzz or Distortion type effect which would likely drown out the noise by adding a bunch more noise. For clean reverb and echo effects the noise is just too much to deal with.
 
One last note. I discovered that the entirety of the noise is being caused by the digital output PWM's. If I disable the PWM output and leave everything else running as normal the noise drops to zero.
 
One last note. I discovered that the entirety of the noise is being caused by the digital output PWM's. If I disable the PWM output and leave everything else running as normal the noise drops to zero.

Hi,

If you are using the PWM outputs to generate the sound, then you have a problem to being with because the PWM does not go high enough for general purpose audio work. The signal itself would need heavy filtering which may mean some tones are lost.
 
If you are using the PWM outputs to generate the sound, then you have a problem to being with because the PWM does not go high enough for general purpose audio work. The signal itself would need heavy filtering which may mean some tones are lost.

The Arduino can produce frequencies up to 62.5 KHz using two PWM to have 16-bit resolution. This is more than enough to generate the frequencies a guitar will produce which is typically between 82 Hz and 1.2 KHz. I put an RC filter on the output to attenuate frequencies above 4 KHz.

There is an interesting article at: http://www.openmusiclabs.com/learning/digital/pwm-dac/dual-pwm-circuits/index.html which explains the PWM method used in this circuit.
 
The Arduino can produce frequencies up to 62.5 KHz using two PWM to have 16-bit resolution. This is more than enough to generate the frequencies a guitar will produce which is typically between 82 Hz and 1.2 KHz. I put an RC filter on the output to attenuate frequencies above 4 KHz.

There is an interesting article at: http://www.openmusiclabs.com/learning/digital/pwm-dac/dual-pwm-circuits/index.html which explains the PWM method used in this circuit.

Hello again,

Ok good, thanks for the extra info.

As you know, all PWM generates ripple. That is what i am suspecting it could be now. You could do tests to confirm or deny this.

Are you using a first order RC filter or second order or higher?
If you are using first order you could try a second order and see if it helps.
 
As you know, all PWM generates ripple. That is what i am suspecting it could be now.
The PWM is generating a slight amount of ripple at the sampling frequency of 31KHz but at this frequency it wouldn't be coming through the speaker.
I've managed to get the noise from very irritating to almost tolerable. I would upload the audio but this forum doesn't accept .WAV files.
Here is the latest scope capture of the input and output signals. The trace is being triggered by the PWM transition.

f3.png


As you can see from the scope capture of a 1 KHz sine wave, the input spikes from the PWM are greatly attenuated but they still produce too much noise.
The output waveform has a slight 31KHz ripple but it's insignificant compared to the ~30mV spikes.
 
I don't know if genuine Arduino Mega boards produce as much Vcc supply noise as the cheap Chinese clone I'm using. On the Chinese clone board, whenever a digital I/O pin changes state there is a 150~300mV spike created on the 5V supply. This spike becomes very significant to an audio amp circuit. It seems to be very hard to filter such a spike.

Here is a close-up of the effect the PWM spike has on the input and output signals. In this case the input signal is NULL.

f1.png
 
Last edited:
I don't know if genuine Arduino Mega boards produce as much Vcc supply noise as the cheap Chinese clone I'm using. On the Chinese clone board, whenever a digital I/O pin changes state there is a 150~300mV spike created on the 5V supply. This spike becomes very significant to an audio amp circuit. It seems to be very hard to filter such a spike.

Here is a close-up of the effect the PWM spike has on the input and output signals. In this case the input signal is NULL.

View attachment 113908

Hello again,

Well then try the single transistor with extra RC filter as suggested earlier.
The single transistor will mean that you have plenty of options for isolating the transistor collector from the power supply. It means you can filter the heck out of the power supply so the transistor has a clean Vcc to work with. It's very simple and easy to try.
You also did not specify what kind of RC filter you are using. It will be hard to help if you dont answer the questions asked of you and dont ever try any of the solutions suggested.
 
I would upload the audio but this forum doesn't accept .WAV files.
Providing the file size isn't too big you can upload it after right-clicking and changing the file extension to ".txt". We can then edit the extension to get back to .wav.
 
Providing the file size isn't too big you can upload it after right-clicking and changing the file extension to ".txt". We can then edit the extension to get back to .wav.

Okay, thanks for the tip. Here is the wave file (change the extension to .wav):
 

Attachments

  • Pedal_Noise.txt
    1.1 MB · Views: 314
I decided to order a commercial guitar digital effects pedal. The ElectroSmash PedalSHIELD Mega (which this project is based on) doesn't stack up very well against the commercial product.
Considering they both cost a little under $60 (assuming you buy the kit from ElectroSmash https://www.electrosmash.com/store/index.php?route=product/category&path=63 )
The commercial pedal I'm getting is the Zoom G1ON. https://www.zoom.co.jp/products/guitar/zoom-g1on-guitar-multi-effects-processor

Here is a table of a hardware spec comparison:

tab1.png


Just by highlighting the main specs it's pretty obvious just how pathetic the Arduino Mega + Audio OpAmp shield is compared to a commercial product like the Zoom G1ON.
The main processor used by the Zoom is a TI TMS320 DSP and is likely 1000's of times faster than the Arduino's CPU.

Now the point of the project was to play with writing my own digital audio effects as well as using the several that are available open source. So with the Zoom pedal I won't be able to code up my own audio effects. The Arduino Mega is just not well suited for such an endeavor. It was a fun learning experience and I had the parts on hand so I didn't really waist any money, just lots of time. o_O

Even the Arduino Due with it's faster processing speed 84MHz, more RAM 96KB, 12-bit ADC, and 12-bit DAC is still pretty weak although it is better suited for this type of project than the Arduino Mega (assuming you can get noise under control).
 
Last edited:
Played the wav. The noise is certainly a tad too noticeable.
 
Hi,

Yeah that's nasty.
Sounds like it could be just noise getting into the system and then being sampled as part of the signal.
Even though the sample frequency might be high, it could also be sub harmonics.
 
Seems to be mainly low frequency noise. This is what Audacity thinks the spectrum looks like :-
Spectrum.PNG
 
When the Noise comes over the supply voltage You can put in an L/C Filter in the Supply to the OP-AMP's Stage.
I would cut the Supply to the analouge Board and measure the output Signal from the PWM without amplification, behind the first Filter stage.
When there the noise appear too it's really a problem at the Arduino, or an internal issue of the AVR Controller.
 
Seems to be mainly low frequency noise. This is what Audacity thinks the spectrum looks like
What you're seeing in the graph is the effect of the RC filter on the output signal, I've designed the output filter to attenuate signals above 4KHz.

The dominate source of noise can be characterized as a high voltage spike at high frequency. Here is a capture of the 5V Vcc input. In the scope capture in this case, the yellow IN trace is 5V (AC coupled) not the input signal (as was the case in previous captures). This spike gets superimposed onto all of the circuit signals by differing amounts. Notice that the spike is at very high frequency (86.2 MHz) and is a result of the voltage regulator responding to the voltage drop caused by the PWM signal going high. The voltage regulator takes a bit of time ~200 nS to stabilize after the PWM state change.

At audio frequencies this spike just looks like a sudden jump (the frequency component can pretty much be ignored) and causes an audible "pop".

Vcc_Spike_01_c.png
 
This second scope capture is a good illustration of just how much the Vcc spike is influencing the signals. In this scope capture the Yellow is the audio input signal and the Blue is the audio output signal. You can see that I've greatly attenuated the PWM spikes in the output but they are still there and audible. The ripple in the output is the 31KHz sampling rate. The input is showing ~220 mV peak to peak spikes and the output has about a 90% amplitude reduction of these spikes.

f5.png
 
Hi,

That looks like wideband noise which is very hard to get rid of.
Probable cause is the code segment variability itself.
You probably would need a very very low frequency low pass filter which would kill the audio too.
Probably the only way to get rid of that if you cant find something really wrong that you can fix is to use DSP and techniques to eliminate noise that way.
You could try super low pass filtering the supply voltages of course.
 
That looks like wideband noise which is very hard to get rid of.
Can you elaborate on wideband noise?

Probable cause is the code segment variability itself.

I don't think so. The code in this case is very predictable. There is no "effect" in play here. The code is just reading the input and outputting the same value. The code is running from a 31KHz interrupt which is triggered from the ADC complete interrupt. The interrupt first reads the ADC and then configures the PWM outputs. Because of this order it is unlikely the ADC is picking up the spike created by the PWM since it is read before the PWM is triggered.

I am beginning to doubt that any type of typical RC or RLC filter can block this noise (voltage spike). The reason being the speed at which the spike happens (and trying many different filter combinations). Given that I have a 4KHz low-pass filter on the output, how could a 86Mhz signal make it through? I think the answer is that a filter can only attenuate (not eliminate) a signal and given the magnitude of the signal spike I'm dealing with, a typical filter isn't going to work. Well, a 90% reduction would indicate that the filter is working but I'm not sure the additional 10% is achievable.
 
Status
Not open for further replies.

Latest threads

New Articles From Microcontroller Tips

Back
Top