PC USB scope project.

PC USB scope projects.

after a previously successful PC USB scope project I decided to try something a littler faster.
So I got into PIC32's which run at upto 50MHz instead of the previous project which only ran at 20MHz.

I used Microchip's Harmony system to create a basic project with A2D and USB interface. The top application layer of USB was missing so I borrowed that from a different harmony project which gave me app.h and app.c files.

I set up the pic32 pins in harmony for a2d input, select pins for a 74hc4051 to select gain of scope front end.
Another task was to set up the system clock. I set cpu speed to 48MHz.
I set USB clock to 48MHz but couldn't get it to register with the pc, the pc said it couldn't connect with the usb pcb.
In the end it was down to getting the clock selectors right, despite harmony telling me it was right in fact one of the settings was wrong giving wrong usb clock.
I used my old pc software but with a bigger data buffer (2048 bytes) instead of the previous 640 bytes. I just had to calibrate the pc software to the new pic faster speed. This includes rehashing the FFT display.

For some reason all the front end worked ok except for the 1:1 voltage mode which had noise on it. In the end I traced it down to a track passing close to a negative voltage generator.
 
Last edited:
Apparently the 7660 oscillates at 10KHz so interfered nicely with my signal.
The new pcb is dead quiet.
I am not getting as good a frequency response as I had hoped at the top end.
So reduced front end gain by 10 and changed inverter into PIC into times ten gain.
This has improved top end a lot.
I was previously getting about 20KHz top end now its way above that.
 
there are many working scope project out there. why not just refine them?
and i don't see any of your app.h and app.c here

There are many scope projects but I wanted the scope to be as fast as possible with a microcontroller while still be cheap. I found the PIC32 series to have 1.1 mega-samples per second a2d so decided to use that.
Trying to write assembler for PIC32 is very tedious work so I decided to use C and Microchip Harmony. There were a few problems along the way but I got it working. app.c and app.h come from the Microchip Harmony library for the USB_HID project.
 
USB scope, in need of bandwidth.

I designed a 460,000 samples per second usb scope.
It worked well with up to 20KHz sine waves.

I then designed a 1,000,000 samples per second scope.
For some reason I couldn't get past the 20KHZ sine wave, it just rolled off after 20KHz.
I looked into it and it looked like my 1 meg input resistor in conjunction with the large feedback resistors to get gain was limiting my bandwidth to about 20KHz.
So I then attenuated the input by a factor of ten to bring down the op amp feedback resistors by a factor of ten. This gave me a bandwidth of about 40KHz.

My next step is to use a passive front end using a 74HC4051 to select different resistors in the potential divider chain. After that stage I buffer the signal with a none invertin gstage and then amplify signal by a factor of 4 so that gives a range of 250mV per division up to 80 volts per division.

PCB is with jlcpcb being manufactured so will see how it goes.

Op amps are great tools but do suffer at the higher limits of impedance.
 
Sadly the 10pf only works with the 250mV mode.
It overboosts the other voltage modes. This is because input impedance is so high with 250mV mode.

I tried to find lower input capacitance op amps but cant find any much less than 8pf.

I gave up in the end and reluctantly reduced input impedance of the scope to 200K.
This gives bandwidth of about 40KHz.
I found I can boost this a bit with some post front end stage filtering.
 
I built up a new version with 200k input impedance expecting that to be better.
It was slightly better.
As the frequency drops off above 20KHz I added a capacitor across one of the inverting amp input resistors. This boosts 20KHZ+ frequencies a little.
This brought the 250mV range into line without affecting other ranges much.

I had a look on the internet for USB scope front ends and most people get around the problem by not having input resistors in series with the input signal.
They rely on the scope probe to divide by 10 or 100.
So I came up with a new similar circuit. After buffering the input I then have my attenuator/multiplier but use much lower resistor values so as not to be affected by a few pf capacitance.
 
I designed a new version which uses a simple buffer front end with a 1 meg input resistor.
The bandwidth is now well over 100KHz so that's fixed a few problems.
It does however mean that the input voltage cant go above 3v3 or below -5 volts.
This means using a *10 probe for high voltages.
This seems to work ok down to the 100mV range where 50Hz hum starts to take over a bit.
Latest version:
100_0053 | KODAK Digital Still Camera | harrabylad | Flickr
 
Last edited:
I decided to add x10 and x100 modes to the scope pcb.
Sadly the layout had so much capacitance that even the x10 didn't work right.
The capacitance getting across the input circuit was adding 50% to the signal amplitude at 100KHz. Below 1KHz it was ok.
I modelled the circuit on paper and I am getting 15pf capacitance between the input to the scope and the first op amp. This lifts the top end of the input spectrum.
The scope works fine in x1 mode as the capacitance is shorted out in that mode.
x100 was a disaster, it output same as x10 mode !!

So revisiting the pcb layout to clearly separate the input from the op amp input stage.
The mode switch is 0.2 inch spacing on the pads to keep capacitance down but I also put a ground track between the pads so capacitance should be pretty much zero.

I will wait until I have another pcb to be made and will get both done at once, that way I only pay $2 for scope pcb's. JLCPCB have a special on at the moment of $2 for first pcb's if the yare less than 100mm by 100mm.
 
Last edited:
Started on a new dual channel USB PC oscilloscope.
Its based on my old single channel design but has another input channel.
Channel 0 is as before with lots of functions like shifting waveform, frequency and voltage measurements using pointers and a FFT function.
Channel 1 is very basic with just a simple display of the waveform.ScreenHunter 10 | harrabylad | Flickr
 
x10 and x100 cheap (ie. ebay) scope probes typically come with a variable cap plus a fixed cap across the 1Meg BNC end.

I've sometimes had to replace the fixed cap with a different value to match the input stage capacitance of the soundcard to then allow probe compensation across the frequency range. Using x10 and x100 probes certainly makes bench work a lot easier for amps.