[SOLVED] TL082 preamp: help please!

You suggested to avoid bigger resistors as it would make the circuit more susceptible to noise...

Yes it will but all engineering is about striking the best compromise, there is no one best answer otherwise it would all be a lot simpler than it is.

I understand that, but can't I directly couple on the Arduino side?

You can but you need to put the correct bias on the output, that is not easy.

Grumpy_Mike:

You suggested to avoid bigger resistors as it would make the circuit more susceptible to noise...

Yes it will but all engineering is about striking the best compromise, there is no one best answer otherwise it would all be a lot simpler than it is.

I understand that, but can't I directly couple on the Arduino side?

You can but you need to put the correct bias on the output, that is not easy.

Ok, it seems clear you believe it will be easier to find a compromise with RC values. I'll do some calcs, tuna couple of simulations and post here the values I believe are going to be necessary and seek your advice in a few hours.

As usual, thanks a million!

Grumpy_Mike: Yes it will but all engineering is about striking the best compromise, there is no one best answer otherwise it would all be a lot simpler than it is.

After a few calculations and some simulations I believe I've reached the following values representing an acceptable compromise, on paper at least:

  • R3, R5 and R6 raised to 2.2k?
  • C1 and C4 raised to 47?F (6,8? at 50Hz)

The high pass filter cut off frequency will be around 1Hz, low enough to have practically no impact on my frequency range.

Can I replace C1 or C4 (or both) with electrolytic capacitors? Non polarized capacitors of such capacitance are not commonly available...

Another possible solution that just comes to my mind is to use a corresponding low pass filter to lower the higher frequency boundary, but that could be tricky: what do you think?

Can I replace C1 or C4 (or both) with electrolytic capacitors?

You can if the voltages / currents are small. Strictly speaking the AC will break down the dielectric when the capacitor becomes reverse biased but I have seen it used in these situations.

Another possible solution that just comes to my mind is to use a corresponding low pass filter to lower the higher frequency boundary,

Not sure I understand that.

Grumpy_Mike:

Can I replace C1 or C4 (or both) with electrolytic capacitors?

You can if the voltages / currents are small. Strictly speaking the AC will break down the dielectric when the capacitor becomes reverse biased but I have seen it used in these situations.

I believe I should find a compromise here: either I go for those RC values by using polarized capacitors or I use the following:

  • C1 1?F (non polarized)
  • R3 10k? (with the pot going into the 100k range)
  • R5 and R6 1k? (unchanged from initial suggestion)
  • C4 100?F (polarized, positive plate on the Arduino side: this should be safe enough as the Arduino side voltage divider should be always positive compared to the opamp output)

This, in conjuction with a slight shift of the frequency range to 100Hz - 200Hz should give me (again on paper) a decent constant amplitude: the simulator reports a 22mV difference in peak voltage (44mV difference in amplitude is an 0,8% error)

Another possible solution that just comes to my mind is to use a corresponding low pass filter to lower the higher frequency boundary,

Not sure I understand that.

another of my sick ideas: because the RC is configured as an high pass filter I was suggesting to level the situation by adding a low pass filter to balance the loss: the outcome would be a much more attenuated output but with a more constant amplitude.

As I said, a sick idea. :roll_eyes:

because the RC is configured as an high pass filter I was suggesting to level the situation by adding a low pass filter to balance the loss: the outcome would be a much more attenuated output but with a more constant amplitude.

I get it. You end up with a band pass filter and depending on the frequencies you will get more or less of a variation in the pass band.

Filter designing is a complex matter and is best done by applying the appropriate theory rather than an add-hock guess. It involves using the complex frequency plane and poles and zeros, to name but a few of the maths you have to do.

Ok, I managed to have a decent stable amplitude output so I pushed some code onto my Arduino and used Processing to plot the readings (oscilloscope like), which look quite strange.

The attached pics represent Arduino analog readings for a pure sine wave input of 50Hz, 165Hz and 320Hz respectively.

I used the different frequencies to exclude strange wave was a consequence of serial port use to dump data: the same weird wave form is maintained which, at my ayes, would tend to exclude that.

Any idea what is going on?

I've attached a picture of my breadboard reporting the circuit diagrammed by GrumpyMike using the component values contained in my last post. The op amp is the TL082 and it's powered by a wall plug transformer, not one of the most stable power source I've ever seen, I must admit. If that might be the cause of the wave oscillation I will jump straightforward into using the LM386 op amp, otherwise I would like to move this post into SOLVED state before moving along.

50Hz.png|1000x201

103Hz.png|1000x201

320Hz.png|1000x201

IMG_5527.JPG|1200x552

Looks like mains pickup to me. Could be caused by the physical layout which is not good or high impedance inputs.

Grumpy_Mike: Looks like mains pickup to me. Could be caused by the physical layout which is not good or high impedance inputs.

Just to be sure I understood you, you think there is a second wave superimposed to the pure sine wave and that second wave is caused by the mains AC line, probably caused by the cheap voltage supply I'm using.

I believe there are two ways to verify that: either I check the wave output using the exact same frequency of my mains which should produce an (almost) pure sine wave (two sine waves superimposed) or I can try a different, more stable, voltage supply (I've a stabilized 12V led transformer around).

I believe method 2 is going to be more reliable due to the micro oscillations in mains frequency to follow power requirements: do you agree/is my reasoning correct?

UPDATE: I just noticed I've already applied method 1 because I'm European and one of the frequencies I've diagrammed matches our mains at 230V 50Hz. :(

You are additionally mentioning a bad layout on the breadboard: can you explain what am I doing wrong so I can try to understand/learn/fix?

Thanks a million Mike, I'm learning a lot!

just to be sure I understood you, you think there is a second wave superimposed to the pure sine wave and that second wave is caused by the mains AC line,

Yes

probably caused by the cheap voltage supply I’m using.

No.

UPDATE: I just noticed I’ve already applied method 1 because I’m European and one of the frequencies I’ve diagrammed matches our mains at 230V 50Hz.

While you can match the nominal frequency you can’t match the exact frequency and phase. One way to test it would be to turn down the amplitude on the signal generator, this will make the interfering signal dominate.
Have you used a scope before, this sort of thing is very common and is normally caused by not grounding the scope to the circuit you are trying to measure.
You have to first determine if this pickup is on the input of the amplifier or the input of your measuring system.
Try putting a load across your signal source, like a 1K resistor from output to ground.

I'm going to try what you suggest in a hour or so (at work now), but I can tell you that wave is not present with no input signal. Better, it is not present with a floating (not connected) input line either.

I believe I've to correct myself: I've added a new reading right at the input (in green) on top of the reading I was getting before at the voltage divider (in blue) and here are my plots and my surprise:

  • noSupply-meAsInput is collected with me holding in my hand the wire going into the reading pin (not connected to the circuit). By holding the wire from the tip or just leaving it laying on the table I actually control the amplitude, but the frequency seems stable. Is that my mains freq coming in from USB?
  • noSupply-30Hz the line is up there because I believe the capacitors are slowly discharging, but what surprises me is the flattening of the line (it's hard to see, but it's there), like if the two waves are attenuating each other below the reading limits.
  • noSupply-160Hz as per the above one the line is up but both frequencies are there, slightly visible

I took all of them with no supply to the opamp and the last two with a 1k load between line input and ground (the resistor is right between the two connections coming from the input.

Anything I can do to remove that disturbance?

UPDATE: someone might find some interest into the little Processing program I wrote to plot those graphs https://gist.github.com/rlogiacco/7699213. If anyone has a better place where it should be mentioned I'll be happy to share it with a broader audience: I was unable to use other tools like SimPlot.

noSupply-meAsInput.png|1000x200

noSupply-30Hz.png|1000x200

noSupply-160Hz.png|1000x200

By holding the wire from the tip or just leaving it laying on the table I actually control the amplitude, but the frequency seems stable. Is that my mains freq coming in from USB?

It is mains but it is coming from you. You are basically a bag of salty water (as are we all) and are acting as an antenna for electromagnetic waves and you are injecting them into the system. The strongest radio waves are the mains that surrounds you. This is perfectly normal and will happen all the time.

Taking measurements without a power supply tells you little. You are just seeing a passive feed through of the components. Most active components (the op amp) looks like a bunch of diodes when it is not powered so you will get the half volt or so forward bias voltage through your op amp plus any attenuation given by the passive components.

So it looks like you are finding it is the input on the amplifier that is picking up mains.

Grumpy_Mike: So it looks like you are finding it is the input on the amplifier that is picking up mains.

In other words either I just accept such disturbance or I find a wave to reduce it.

I can think that reducing the total input wiring lenght could be an option and another one can be the use of shielded wires. In both cases moving my circuit out of a breadboard would be helpful (the breadboard itself is an antenna, right?).

Anything wrong or better suggestions?

UPDATE: what if I add a lowpass filter, say a LTC1063 (5th order butterworth lowpass filter)? Would that help and be steep enough to reduce the noise without affecting the 100Hz -200Hz range of interest? http://cds.linear.com/docs/en/datasheet/1063fa.pdf

In other words either I just accept such disturbance

No you find out if it is real or if it is a measurement artifact.

In both cases moving my circuit out of a breadboard would be helpful

Yes

what if I add a lowpass filter

If it is real pickup then a notch filter is what you want. That is a band stop filter.

Grumpy_Mike: No you find out if it is real or if it is a measurement artifact.

Any indication how can I do that? Please don't tell me "buy an oscilloscope"... :cold_sweat:

Ok, I got a little forward step here, I believe.

First of all I managed to identify the mains pick up source by observing changes in the input wave reported in my software oscilloscope (I'm proud of that little piece of software 8)). I've replaced my voltage supply to fix this, I believe my transformer cables where acting as antenna (about 1m/3' wire lenght)

Now I have an almost flat input with no signal, but I still have some sort of reasonance/disturbance: my best guess this is caused by signal interferences due to the breadboard/wiring.

Does it sound?

Note: green wave is picked before amplification, blue wave after amplification.

UPDATE: I've added another attchment referring to a 33Hz sine wave: it seems clearer the interference going on

20Hz.png|1000x400

33Hz.png|1000x400

I believe my transformer cables where acting as antenna (about 1m/3' wire lenght)

Sounds plausible.

Well done on the progress. :)

Well, I found the cause of the interference, including the previous one: it was the other channel as my audio connector and cable is delivering two stereo channels and I had another frequency on that one.

Is it normal for the two channels frequencies to interfere each other? Is it a consequence of bad wiring? If that is normal behavior then my entire project might get blown away...

Anyway I want to thank all those that helped me with this: you guys are amazing!

I will add the final circuit diagram and an example output trace for the records ASAP.

I'll switch to a different opamp in a couple of days: get ready for another flow of issues and questions :D

Is it normal for the two channels frequencies to interfere each other?

Yes it is called cross talk, you can minimise it but you can never get rid of it all. Two circuits running so close to each other are bound to give you problems. One way to minimise it is to have good supply decoupling, using inductors in a Pi filter like I show for a motor on this page. http://www.thebox.myzen.co.uk/Tutorial/De-coupling.html