Introduction: Analog Front End for Oscilloscope
At home I have some cheap USB sound cards, which can be bought in Banggood, Aliexpress, Ebay or other global online shops for some bucks. I was wondering what interesting I can use them for and decided to try to make an low frequency PC scope with one of them. In Internet I have found a nice software, which can be used as USB oscilloscope and signal generator. I did some reverse design of the card (described in the first step) and decided that if I want to have fully functioning scope - I need also to design an Analog front-end, which is required for the proper voltage scaling and shifting of the input signal applied at the microphone input of the audio card, because the microphone inputs expects maximal input voltages in the order of few decades of millivolts. I also wanted to make the analog frontend universal - to be able to be used with Arduinos, STM32 or other microcontrollers - having input signal band much wider than the input band of an audio card. Step by step instructions how to design such Analog scope front-end is presented in this work.
Step 1: USB Audio Card Revers Design and Nodifications
The USB card is very easy to open - the case is not glued, only inserted part in part. The PCB is double sided. The audio jacks and the control buttons are on the top side, the C-media decoder chip, covered by compound is on the bottom side. The microphone is connected in mono mode - the two channels are shorted together on the PCB. An AC coupling capacitor (C7) is used at the microphone input. Additional to that a resistor of 3K (R2) is used for the biasing of the external microphone. i have removed this resistor leaving its place open. The audio output is also AC coupled for both channels.
Having an AC coupling at the signal path prevents the observation of DC and low frequency signals. For that reason I decides to remove (short) it. This decision has also disadvantages. After the capacitor there is defined some DC operating point for the audio ADC and if the analog front-end has different output DC OP, because of the small input signal range, the ADC can saturate. That means - the DC OP of the front-end circuitry must be aligned with that of the ADC input stage. The DC output voltage level must be adjustable to be able to be equal to that of the ADC input stage. How this adjustment is implemented shall be discussed in the next steps. I have measured about 1.9V DC voltage at the input of the ADC.
Another requirement, which I defined for the analog front-end was not to require additional power source. I decided to use the available in the sound card 5V USB voltage to supply also the front-end circuitry. For that purpose I cut the common connection between the audio jack tip and ring contacts. The ring I decided to use for the signal (the white wire on the last picture - bridges also the AC capacitor), and the tip of the jack I decided to use as power supply terminal - for that purpose I connected it with the USB 5V line (the red wire). With that the modification of the audio card was completed. I closed it again.
Step 2: Frontend Design
My decision was to have 3 modes of work for the oscilloscope:
Having AC mode requires that the input / common mode voltage of the input amplifier extends under the supply rail. That means - the amplifier must have dual supply - positive and negative.
I wanted to have at least 3 input voltage ranges (attenuation ratios)
All commutations between modes and ranges are preformed bu mechanical slide 2P3T switches.
To create the negative supply voltage for the amplifier I used 7660 charge pump chip. To stabilize the supply voltages for the amplifier I used the TI dual linear regulator TPS7A39. The chip has small package, but is not very difficult to solder it on the PCB. As amplifier I used AD822 opamp. Its advantage - CMOS input (very small input currents) and relatively high gainbandwidth product. If you want to have even wider bandwidth, you can use another opamp with CMOS input. Nice to have feature Rail to Rail Input/Output; low noise, high slew rate. The opamp used I decided to supply with two +3.8V / -3.8V supplies. The feedback resistors calculated according the datasheet of TPS7A39, which give these voltages are:
If you want to use this frontend with Arduino, you may want to reach 5V output voltage. In this case you have to apply input supply voltage >6V and to set the output voltages of the dual regulator to be +5/-5V.
The AD822 is dual amplifier - first of them was used as buffer to define the common mode voltage of the second amplifier used in summing non inverting configuration.
For the adjustment of the common mode voltage and the gain of the input amplifier I used such potentiometers.
Here you cam download a LTSPICE simulation setup, in which you can try to set up your own amplifier configuration.
It can be seen that the PCB has second BNC connector. This is the output of the sound card - both channels are shorted together through two resistors - their value can be in the range 30 Ohm - 10 K. In this way this connector can be used as signal generator. In my design I did not used BNC connector as output - I simply soldered a wire there and used two banana connectors instead. The red one - active output, the black one - signal ground.
Step 3: PCB and Soldering
Step 4: Boxing
I decided to put all this in a small plastic box. I had one available from local shop. To make the device more immune to the external radio signals, I used a copper tape, which I attached to the internal case walls. As interface to the Audio card I used two audio jacks. I fixed them strong with epoxy glue. The PCB was mounted at some distance from the bottom case by the use of spacers. To be sure that the device is proper supplied, I added a LED in series with 1K resistor connected to the front-end supply jack (the tip of the microphone side jack)
Step 5: The Device Is Ready
Here are some pictures of the assembled device.
Step 6: Testing
I have tested the oscilloscope using this signal generator You can see some screenshots done during the tests.
The main challenge using this scope is to adjust the frontend common mode output voltage to be identical to that of the audio card. After that the device works very smooth. If using this front-end with Arduino, the problem with the common mode voltage aligning should not exist - it can be placed freely in the range 0-5V and precisely adjusted after that to value, which is optimal for your measurement. When using with Arduino I would suggest also another small change - the two anti-parallel protection diodes at the input of the amplifier can be raplaced with two 4.7V Zenner diodes connected in series, but in opposite directions. In this way the input voltage will be clamped at ~5.3V protecting the opamp inputs of overvoltages.