1
\$\begingroup\$

This is for a DSP project. I am trying to prepare my guitar signal for as best as possible ADC response in order to detect harmonics to the 5th of the highest note of the guitar (1175 Hz for 22 frets), which is about 5875 Hz. This means that I need to be sampling at about 58.75 kHz, which is possible with the microcontroller and it's DSP functions.

I am using an STM32F407 Discovery board.

So far, I have not come across any solutions that I am happy with.

Considerations that are important:

  • Guitar output impedance: about 1M ohm.
  • Anti-aliasing for the ADC
  • Guitar signal of 500mV Vp-p max
  • ADC input range 0-3.3V
  • 5V single supply
  • Frequency range from 82Hz and 5875 Hz

Does anyone have any suggestions of a circuit that I can use? I have TL082, LM358 and LM741 opamps available, but I am open to other suggestions.

The goal of this element of the projects is to be able to use the first 5 harmonics and a sampled period of the guitar signal for further DSP.

This is what I have come up with so far - although I believe it's far from ideal. First attempt schematic

This is a closed loop bode plot of the system. Couple of things that worry me are the massive phase differences at the corner frequencies, and the slope of the low pass filter and it's stop frequency. The cutoffs are at 10Hz and 10kHz

Frequency graph

Any tips would be greatly appreciated.

\$\endgroup\$
  • 4
    \$\begingroup\$ None of your opamps are useful here, the TL082 would be good as an input buffer but requires a lot of voltage headroom. The 741 is not an opamp, it's a piece of plastic with metal legs. \$\endgroup\$ – pipe Sep 17 '16 at 22:04
  • 1
    \$\begingroup\$ @ThreePhaseEel , Yes, I can get better opamps. I am in South Africa and have access to quite a lot. RS Components is one of my favourite suppliers. Any suggestions? \$\endgroup\$ – makepeace Sep 17 '16 at 22:25
  • 1
    \$\begingroup\$ @EJP - Regarding the "note", yes you're partially right. The note is the frequency of the first harmonic. There are loads of harmonics above this with high energy content. I'm interested in those up to the 5th, as mentioned. Regarding the voltage - you're just wrong. I just measured this, plucked really hard(er than normal) on my oscilloscope and measured about 300mVp-p. Neck pickup, Squire Strat single coil. \$\endgroup\$ – makepeace Sep 18 '16 at 10:00
  • 1
    \$\begingroup\$ @BruceAbbott - I'm not worried about the 25th. I'm worried about the 5th, and recording a well characterised waveform of the note - which has the 5th. As far as I understand 10 x that frequency is a good bet... \$\endgroup\$ – makepeace Sep 18 '16 at 22:57
  • 1
    \$\begingroup\$ @pipe, not fair. The 741 is a precision signal degradation device which is designed to take a wide range of high quality input signals and ruin them. \$\endgroup\$ – Ian Bland Nov 18 '16 at 9:48
1
\$\begingroup\$

I have TL082, LM358 and LM741 opamps available

The TL082 and LM741 require high voltage power supplies, but the LM358 works fine on 5V so it should be OK.

Rather than trying to limit the ADC input voltage with diodes I would simply use a voltage divider to bring it down. The op amp's bias voltage is then set to the value that produces maximum undistorted output (which is not 2.5V, because the LM358 can only pull up to ~1.5V below Vcc).

Here is my modified version of your circuit:-

enter image description here

R1 and R2 set the op amp bias to 1.79V. Maximum output voltage of U2 is 3.5V. R3 and R9 divide this down to 3.3V.

The only other change I made was reducing the value of the inter-stage coupling capacitor (C3 in my circuit) from 22uF to 2.2uF. This provides a stepper low frequency roll off, but my main reason for changing it was to avoid having to use an electrolytic capacitor.

Here is the ac analysis:-

enter image description here

If you are only interested in the frequency components of the signal (not the actual wave shape) then phase differences shouldn't worry you.

The slopes of the filter in the simulation are a bit misleading because the simulated input is a low impedance AC generator. Guitar pickups have high inductance with a relatively low self-resonant frequency, typically between 8-12kHz. Above self-resonance the pickup's frequency response drops away sharply, so higher harmonics are attenuated much more than you might think.

Without simulating the pickup you won't find out what the true response is until you test the circuit with a real guitar. The good news is that it will probably do a better job than what the simulator is telling you.

\$\endgroup\$
  • \$\begingroup\$ Thanks for the tips. Looks much better! I've added model of the guitar pickup (more or less) and it's looking better. Regarding the phase differences - I am interested in the wave shape. The sampled wave is going to be used to modulate an output. As much of the signal character as possible is required to be retained. How can I reduce the phase differences? Probably can't right? I've simulated the time response with your modifications, and without the diodes - if the input is 1Vp-p - my ADC gets slammed with about 4V. Probably not a good idea to take those diodes out? \$\endgroup\$ – makepeace Sep 19 '16 at 10:21
  • \$\begingroup\$ If the output voltage is too high you can reduce it by changing the voltage divider ratio (increase R3 and/or reduce R9). But I bet you are not using the correct LM358 model. Since it drops at least 1.1V (more when loaded) it is not possible to get 4V out when Vcc is 5V. \$\endgroup\$ – Bruce Abbott Sep 19 '16 at 17:20
  • 1
    \$\begingroup\$ "I am interested in the wave shape... to modulate an output" - Pity you didn't mention this earlier, but I'm not sure it's relevant anyway. In a normal listening environment dramatic phase changes occur (especially at the high end) and nobody notices because the human ear detects frequencies, not waveforms. But if the wave shape is so important to you then just make the amp as flat as possible - and don't be concerned about aliasing because it will only occur above the 25th harmonic (of 1175Hz) which is very weak and won't noticeably affect the shape of the digitized waveform. \$\endgroup\$ – Bruce Abbott Sep 19 '16 at 17:43
  • \$\begingroup\$ "The goal of this element of the projects is to be able to use the first 5 harmonics and a sampled period of the guitar signal for further DSP." In any case, thanks for your tips. I managed to develop a circuit that works pretty well in the application with the answers on this page. \$\endgroup\$ – makepeace Oct 5 '16 at 9:23

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.