Introduction: Arduino Guitar Effector
This is an Arduino based guitar preamp+effector. This instructable contains basic information about how to build a circuit on a breadboard and an Arduino code to drive the system. The guitar effects are not implemented here, but some examples can be found from another project of mine: https://www.instructables.com/id/ATTiny44-Guitar-E...
This instructable will illustrate how to get the guitar signal properly through a biased input, and how to use weighted pins for output in order to get signal resolution higher than 10-bits.
Step 1: What You Need for the Circuit
This is everything you need for the breadboard circuit. The list of material will include:
- any Op-amp (I used what I had at the moment)
- 2 x 10k resistors
- 1 x 10 ohm resistor
- 1 x 1k resistor
- 1 x 1.2k resistor
- 1 x 1.5k resistor
- 1 x 30k resistor
- 1 x 390k resistor
- 1 x 10k potentiometer
- 1 x 0.05 uF capacitor
- 1 x 0.1 uF capacitor
- 1 x 2.2 uF capacitor
- 1 x 47 uF capacitor
- 1 x 250 uF capacitor
The detailed resistor and capacitor values in the output stage is up to what headphone is going to be used. Also I heavily low-pass filtered the output sound, and different filter design can be experimented for better sound quality.
Step 2: Build the Circuit
Let's make the circuit on a breadboard. You will also need jumpers between the circuit and an Arduino.
- Two output pins in the diagram goes to D5, D6
- The input pin goes to A0
- Vcc and GND from Arduino also connected to the circuit.
- Guitar input pin is connected to a 1/4" jack.
- The ground pin on the jack goes to ground in the circuit.
- Output pin can simply be connected to a headphone with banana clips (or a regular headphone jack can be used)
Step 3: Code
And upload the code below to your Arduino.
TCCR0B = TCCR0B & 0b11111000 | 1; TCCR0A &= ~B11; TCCR0A |= B011;
pinMode( 5, OUTPUT ); pinMode( 6, OUTPUT );
analogWrite( 5, 0 );
analogWrite( 6, 0 );
analogReference( DEFAULT );
_SFR_BYTE( ADCSRA ) &= ~_BV( ADPS2 );
_SFR_BYTE( ADCSRA ) |= _BV( ADPS1 );
_SFR_BYTE( ADCSRA ) |= _BV( ADPS0 );
int input = ( (analogRead( 0 ) ) * 64 ) - 32768;
if(input>=65536) input = 65535;
if(input<0) input = 0;
unsigned short output = input + 32768;
analogWrite( 5, output >> 8 );
analogWrite( 6, output & 255 );
Note: this code is made based on http://pastebin.com/9zphwpvA
Step 4: Play the Guitar
Here is a sample of the preamp. More effects can be implemented by modifying the code in the loop(). For a few other examples please visit my other instructable: https://www.instructables.com/id/ATTiny44-Guitar-E...