Arduino Guitar Effects Pedal Project

Status
Not open for further replies.

Jeff Wahaus

Member
I became interested in using the Arduino as a platform for creating a custom guitar effects pedal. I came across a website that has done just that. Some of you may be familiar with ElectroSmash and their guitar pedal shields for Arduino. https://www.electrosmash.com/pedalshield-mega
They sell kits with their custom made pcb's and provide the schematics for turning an Arduino into an effects pedal. They use the Arduino's built-in 10-bit ADC to sample the guitar signal and then pump the processed signal out a couple of digital PWM's.
I decided to give the circuit a go an build my own version. (didn't want to wait for the PCB to ship from England and saved about $20).

I followed the ElectroSmash schematic for the input and output stages:
 
I've got the input and output stages built and the effects processor "works". Here what my PCB currently looks like:
 
The reason I put the word "works" in quotes is because the quality of the sound coming out of this device is a bit less than optimal. I didn't expect it to sound perfect but I did expect it to sound better than it does. Looking at the input vs output on an oscilloscope highlighted a few problems with the circuit. In the following capture the "delay-echo" effect is running so the output signals are phase shifted from the input signal.


The input signal is the Yellow trace. The Blue trace is the output signal of the original circuit. Notice that not only does the Blue trace have significant triangle wave noise at 31KHz but it is also DC offset by about 200mV. The Pink trace is the output signal after running the output through a low pass RC filter (to get rid of the 31KHz noise) and a 0.1uF capacitor in series (to get rid of the DC offset).

With the output signal looking much better after the additional filters I still wasn't too happy with the sound of this thing although it did sound much better than before the additional filters were added.
 
One of the reasons I am not happy with the sound is because there is a significant amount of noise being generated by the circuit.
Looking at the signals with no input waveform and zoomed in on the vertical scale I saw something that was causing some of the noise:



Again in this trace Yellow is the input signal and Pink is the filtered output signal. The frequency of the noise spikes in this case were about 900Hz.
After much head scratching I decided to disable the software loop that was flashing an LED during the effect processing and this turned out to be the cause of these spikes pictured above. The current draw from the LED switching on and off was effecting the voltage levels of the Input stage of the OpAmp apparently.
 
Last edited:
Even with the above spikes gone this circuit is still generating a significant amount of noise that is audible in the guitar amplifier at moderate volume. It sounds like noise being introduced by the Adruino's components. I don't have any RF shielding so this may be part of the issue. In the trace above the width of the input signal is around 10mV and this gets amplified a bit in the output. I don't know if this 10mV width is the cause of the noise I'm hearing though. I would think the frequency causing this signal "width" would be much too high to hear.
 
Here is my latest oscilloscope trace showing some output spikes which are likely the source of the noise I'm hearing. It sounds kind of like white noise but different. Now it appears I've gotten rid of noise on the input stage, this noise is only showing up on the output:



NOTE: The Yellow trace is the Input signal and the Blue trace is the Output signal.
 

Attachments

  • out_noise3.png
    47.2 KB · Views: 334
Last edited:
Here is another look at this noise with a different time base. In this case there are no effects in use, the code is simply reading the ADC and then putting the same value to the output. At this time scale you can see the spikes are occurring at a rate of 44.6KHz and only on the output. (hard to see but there are spikes under the vertical cursors).

 
Here is a close up of what an individual noise spike looks like:



Any ideas on what could be causing this problem?
 
It could partly be screening but also likely some ground noise.

All the sections of the audio circuits should have a "star point" or short common ground & that have only a single connection to the MCU analog ground.
Just having more than one ground pin connected back to the MCU board could add noise.

This shows the idea:
https://i.stack.imgur.com/JRky1.png

Also use an R-C filter on the supply in to the analog board, a low value resistor and both a ceramic or poly and electrolytic cap from that to the analog board ground.
 
I just found the source of the noise spikes I'm getting in my audio signal output. The PWM's used to produce the output signal introduce a ~50mV ringing spike whenever they transition from either LOW to HIGH or HIGH to LOW. In the scope captures below I'm looking at the PWM signals coming out of the MCU (before any filtering) and it's pretty obvious that this is what's causing the ringing spikes in the output. The PWM signals switch between 0 and 5v and share the same ground as everything else in the circuit. There is only 1 power source in use (the Arduino's regulated 5V output).

 
I just looked at the 5V coming from the Arduino's regulator and it's showing a ~200mV spike whenever the PWM's transition as well. I'm going to try adding a capacitor from 5V to ground and see if I can clean up the 5V going into the circuit. In a digital circuit a ~200mV variance of the 5V supply is typically nothing to worry about but in this audio circuit it seems to be very significant.

Any suggestions as to the size and type of capacitor needed? I'm guessing an electrolytic would be best?
 

The ground routing isn't ideal but it sort of has a "star point" type layout. Changing it isn't really an option at this point since it would require too much rework.
I can add a Cap or two to the 5V supply. If you'll notice on the schematic there is already a 100nF ceramic on Vcc of the OpAmp. Also, the 2.5v power source (from a voltage divider) has a 4.7uF electrolytic. The OpAmp is currently the only device being powered by the 5V source.

 
Last edited:
Try a ceramic directly on the MCU power pins & see if that reduces the spike.

I'd try something like a 100 ohm resistor from the main board +5V to the analog board +5, so the decoupling caps on the analog board are not directly subjected to the same current or voltage spikes; that's the R-C filter idea.
 
I guess there ist a Problem when changing the Values of the PWM Generator so called glitches.
I mean that are the Spikes at value changing.
When using fast PWM You should change the Values in the Timer Overflow Interrupt.
For the other PWM modes take a look into the Datasheet, when to change the values.

Another Problem is the resolution of the A/D Converter.
At 10 Bit resolution the measured Values doesn't fit exactly to the input voltage.
Additional the A/D Converter makes some converting errors, about 1 or 2 Bit.
In sum that generates some Noise, when make D/A converting again.
Additional You should insert a better filter into the input stage to avoid alias frequencies.

I guess the better solution is an faster external 14 or 16 Bit A/D Converter and a faster Controller with more RAM memory - for longer delays.
Try to use an Arduino with an X-MEGA type.
 
In this case I'm using the PWM in Phase Mode with an ADC sample rate of 31KHz. The voltage spikes are occurring on every transition of the PWM's output not when the PWM registers are being updated.

I guess the better solution is an faster external 14 or 16 Bit A/D Converter and a faster Controller with more RAM memory - for longer delays.

Perhaps, but the point of this project is to use the Arduino Mega with it's built-in capabilities. My total build cost for this project is less than $15 which includes the price of the Arduino.

I feel that any microcontroller based audio effects processor is going to have noise issues since the audio circuit is so sensitive. Keeping the audio circuit away from the digital circuit, using a separate power supply, and perhaps even using optoisolators to decouple the analog from the digital side of things would likely greatly improve noise issues.
 
Last edited:
Is there any way to calculate the best capacitor to use given the measured spike characteristics? I would just try various values of capacitors across the 5v supply and Ground and see where the sweet spot is but since this is going to involve soldering them in place I want to make the best guess possible before I heat up my soldering iron.

The 5V supply already has a 47uF (on the Arduino) and a 100nF next to the OpAmp. What would be the best value to add?
 
Apart from the PWM spikes above, the 5V supply looks pretty noisy when it's not spiking. The 16MHz clock is causing the 5V supply to swing by 53mV. At this frequency however, I'm not sure how significant this is to my Audio circuit.

 
Hello there,

The Arduino is capable of putting out a variety of frequencies that would be considered noise, not just the 16MHz or whatever.
That is because as the different code is executed there will be sub harmonics based on how long those codes take to execute and what they are actually doing. As they draw differing power levels from the power source, the harmonics present on the 5v line will be varied.

It may be hard to filter them by filtering the supply itself, although you could try. Obviously a ceramic and electrolytic would be something to try.
A trick from RF though would be to isolate the noise source so that it alone can be filtered. This would work if there is only one source of noise. Unfortunately there may also be RF noise getting to the audio front end which could get demodulated into audio frequency noise.

Assuming the former alone, you might try using the logic output from the port to drive an NPN transistor. The pullup resistor can come from a highly filtered voltage source. To get that filtered source, a small inductor in series with a resistor and two filter caps (one ceramic and one electro) and that should be able to clean up the power supply noise.
The RF noise, if present, would be harder to deal with as you may have to shield the Arduino board.

Try the transistor trick first and see what happens. You need a base resistor, collector pullup, and inductor and resistor in series with the 5v line and two caps for filtering. If you dont have an inductor try the resistor in series alone first, and if that does not work good enough try winding your own air core inductor with inductance say 10uH or better.

Interesting idea BTW. A Due board may have been a better choice, but yes that is more expensive.
 

Yes, I agree. The first source of noise I noticed was from an LED flashing driven by the main loop. That one was easy to fix, just don't flash the LED. Right now I'm currently doing nothing in the main loop. I'm running a "clean" effect, the ADC interrupt is simply sampling the ADC and putting the value out the PWM's. So in this case the MCU noise is very predictable.

The main issue I'm having with noise is the spike that occurs when the PWM's change state. This causes a spike in the audio output that is several times the magnitude of the output waveform. If I can get this PWM transition spike taken care of I think I'll be pretty happy with the Audio from this Low-Fi effects processor. (i.e. I'm not expecting exceptional sound quality)


I don't think the issue is with the PWM output itself, these signals are 0 to 5v and look pretty clean. The issue is that when the MCU changes the output of a digital PIN it causes a voltage surge (or dip) in the Vcc Voltage which then biases the OpAmp inputs and supply voltage. This bias gets amplified and sent to the ADC.

The RF noise, if present, would be harder to deal with as you may have to shield the Arduino board.

I'm planning to use foil on the underside of the shield once the circuit is complete to help block any RF noise.

The next thing I'm going to try is adding a RLC filter to the Vcc 5v input of the Circuit. I've tried using several values of capacitors from 5V to Ground and none had any effect but they were 10cm away on a breadboard which I'm sure the distance involved has an effect.

I'm beginning to suspect that this voltage spike is a Ground loop issue. If I connect a scope probe to ground only and leave the tip disconnected I can see the spike and it has a pretty large magnitude. Although, I'm not so sure, if I measure the resistance between all ground points I get the same value.
 
Last edited:
Status
Not open for further replies.
Cookies are required to use this site. You must accept them to continue using the site. Learn more…