EEVblog Electronics Community Forum

Electronics => Microcontrollers => Topic started by: nigelwright7557 on July 26, 2019, 06:51:11 pm

Title: 10 meg sample home made scope project.
Post by: nigelwright7557 on July 26, 2019, 06:51:11 pm
Got my prototype pcb through today for my 10 mega sample USB PC scope.
Had a few problems getting it going.
Crystal not close enough to PIC so was struggling to start.
Insufficient decoupling on USB power supply stopped USB running.
I changed my mind about the clock for the A2D and clocked it from the PIC microcontroller instead.
(https://i.ibb.co/hmv6CfX/usb17.jpg)
Title: Re: 10 meg sample home made scope project.
Post by: TheHolyHorse on July 28, 2019, 02:36:15 am
What exactly is your question?
Title: Re: 10 meg sample home made scope project.
Post by: SiliconWizard on July 28, 2019, 02:04:12 pm
Funky layout job. ;D
Title: Re: 10 meg sample home made scope project.
Post by: thinkfat on July 28, 2019, 08:00:20 pm
Funky layout job. ;D
Funky soldering job, too..

Gesendet von meinem Nokia 6.1 mit Tapatalk

Title: Re: 10 meg sample home made scope project.
Post by: nigelwright7557 on July 28, 2019, 09:19:48 pm
No question, just sharing my latest project.
Its just a prototype pcb so has been hacked around a bit.
Strange mix if SMD and through hole.
I got the SMD soldered on by my pcb manufacturer.
Its a pain to do by hand. Not cheap though.

The fun part has been the software which was basically taken form a previous similar much slower 2MHZ sampling project.
I managed to get 10MHZ sampling with an external A2D.
With a bit of help from the Microchip forum I managed to get the speed up to 14MHZ sampling rate.
To clock data out of the A2D I used the PIC PWM generator. That made my code much simpler and much faster.
Next step is to speed up the analogue front end. The op amps are a bit slow so buying in some faster ones about 12MHZ bandwidth.
Title: Re: 10 meg sample home made scope project.
Post by: thinkfat on July 28, 2019, 09:39:01 pm
For a 10 Ms/s sampling rate, your analog bandwidth needs to be limited to 5 MHz anyway.

Gesendet von meinem Nokia 6.1 mit Tapatalk

Title: Re: 10 meg sample home made scope project.
Post by: nigelwright7557 on July 28, 2019, 09:48:39 pm
For a 10 Ms/s sampling rate, your analog bandwidth needs to be limited to 5 MHz anyway.

Gesendet von meinem Nokia 6.1 mit Tapatalk

The problem with digital scopes is while the sampling rate can be high you need many samples to make a waveform.
So something like 100 megs sampling would only be good for 1MHz sine or square wave.
A good analogue scope will blow the digital storage scopes out of the water.
However, you can pick up low sampling rate USB scopes for peanuts.
Title: Re: 10 meg sample home made scope project.
Post by: thinkfat on July 28, 2019, 09:56:58 pm
I was more referring to the sampling theorem.

Gesendet von meinem Nokia 6.1 mit Tapatalk

Title: Re: 10 meg sample home made scope project.
Post by: james_s on July 28, 2019, 10:34:37 pm
Funky layout job. ;D

Traces running around at weird angles is a classic rookie mistake. Set up the PCB program to only let you use 45 and 90 degree angles and the result ends up much cleaner.
Title: Re: 10 meg sample home made scope project.
Post by: Mechatrommer on July 28, 2019, 11:11:30 pm
do not underestimate the bug free software, its the least to moderately neat path algorithm...
Title: Re: 10 meg sample home made scope project.
Post by: nigelwright7557 on July 28, 2019, 11:42:43 pm
Pro's usually suggest 90 degree bends is not good.
The shortest distance between two points is a straight line.
However, that makes layouts messy.
I tend to use 90 and prefer 45 degrees.
Going around components often forces 90 degree bends.

I should have added that pcb was pre new track functions in my software.
I now have two control keys.
1/ Snaps back to previous pin in a straight line with pin
2/ Snaps forward to next  pin in a straight line with pin.
See picture of new better pcb.
(https://i.ibb.co/BsSjf2b/snap.png)
Title: Re: 10 meg sample home made scope project.
Post by: james_s on July 28, 2019, 11:58:04 pm
When I need a 90 degree bend I always use two 45 degree bends unless circumstances absolutely mandate a single 90 degree. Regardless of bends, you want to keep the trace angles to multiples of 45 degrees.
Title: Re: 10 meg sample home made scope project.
Post by: NorthGuy on July 29, 2019, 12:48:11 pm
Crystal not close enough to PIC so was struggling to start.

You should have capacitors to the ground from both legs of the crystal. I cannot see them on your PCB. Also, 1M or so resistor might be needed parallel to the crystal.

Modern designs usually use MEMS oscillators instead of crystals.
Title: Re: 10 meg sample home made scope project.
Post by: nigelwright7557 on July 29, 2019, 03:58:42 pm
Crystal not close enough to PIC so was struggling to start.

You should have capacitors to the ground from both legs of the crystal. I cannot see them on your PCB. Also, 1M or so resistor might be needed parallel to the crystal.

Modern designs usually use MEMS oscillators instead of crystals.

My picture got clipped a bit, the crystal capacitors are directly above it.
The crystal circuit is directly from Microchip datasheet.
Title: Re: 10 meg sample home made scope project.
Post by: SiliconWizard on July 29, 2019, 04:23:55 pm
Yeah nothing wrong with using a crystal... especially for this kind of designs. You're not using an external oscillator anyway, just the one integrated in the MCU.

Getting back to the PCB: I hadn't figured you had used your own software, which was a work in progress. So yes that explains things.
Free-angle traces look weird (or "funky") but are not necessarily bad signal-wise. That's mainly a cosmetic issue (and would just raise questions about how you proceed, especially when no visible density issue would justify them ;D )

Now just a note: you still seem to be using a lot of 90° bends. Even if the corners are rounded on the outside, those are still 90° bends with a sharp angle inside the bend. That's not very good (for both manufacturability and EMC reasons...)

When you need a trace to bend 90°, insert a corner - a small piece of trace - so you have two successive 45° bends instead. That's what you will see on most (I'd say all) modern PCB layouts.
Title: Re: 10 meg sample home made scope project.
Post by: nigelwright7557 on July 30, 2019, 12:08:16 am
When you need a trace to bend 90°, insert a corner - a small piece of trace - so you have two successive 45° bends instead. That's what you will see on most (I'd say all) modern PCB layouts.

My software has a corner function where you can replace 90 degree bends with rounded off corners to any radius you like.
I don't use it until the pcb is finished or it gets messy to edit.


Title: Re: 10 meg sample home made scope project.
Post by: Mechatrommer on July 30, 2019, 02:37:02 am
...until the pcb is finished or it gets messy to edit.
exactly! imagine you are designing 100 components and you have to redo when prototype confirmed working.
Title: Re: 10 meg sample home made scope project.
Post by: nigelwright7557 on July 30, 2019, 03:29:14 am
...until the pcb is finished or it gets messy to edit.
exactly! imagine you are designing 100 components and you have to redo when prototype confirmed working.

One simple command does the whole pcb. Its not difficult.
Title: Re: 10 meg sample home made scope project.
Post by: Mechatrommer on July 30, 2019, 04:24:03 am
demo on a densed board will be helpfull. Nobody bother to read on youtube age now esp if they already have a tool to do the job. An entertaining demo video will give courage to learn more.
Title: Re: 10 meg sample home made scope project.
Post by: nigelwright7557 on July 30, 2019, 05:57:14 am
demo on a densed board will be helpfull. Nobody bother to read on youtube age now esp if they already have a tool to do the job. An entertaining demo video will give courage to learn more.

I did have a demo video on my website.
There is a demo video in the demo version and the retail version of the software to get people started.

I keep a track of website hits over a period and hits dropped off dramatically when I had the video up.
So  I removed it. If you want to have a look its here:  https://www.youtube.com/watch?v=yGFkLSToBjw (https://www.youtube.com/watch?v=yGFkLSToBjw)
Title: Re: 10 meg sample home made scope project.
Post by: Mechatrommer on July 30, 2019, 06:40:59 am
I keep a track of website hits over a period and hits dropped off dramatically when I had the video up.
your statements doesnt make sense to me (pray i will not speculate). why every time you put advertisement materials such as manual/guide, videos, screenshots/examples the hit dropped is a 8th wonder of the world to me. and time spent to keep track hit counter better spent on improving the SW further. just publish the materials and forget about it, let the audiences decide to hit buy now button or not. or are you saying those introductory materials will jeopardize your sale? by removing them you will increase hit and sale? ::) anyway kudos for your effort in making the video but 2 resistors circuit is hardly practical.

talking about competitors... few years back, i've attempted to make an eda designer, i called it Chromeera Project. took half a year to code just few data structures/gui etc, that was really heavy and difficult task, and i may say, wasteful as it occupied and took me away from other ee hobby /part time stuffs. thinking i only moved very little in half a year, and my VB6 IDE is rotting so not worth the effort, i decided to stop until i have better modern IDE proficiency (Qt was choosen) and time allocation for it. attached is what have completed so far (still on half breed GUI development, zero functionality) if only i can clone myself into 2 or 5 other persons, i'll command one of them to spend entire life on this task. but joke aside, no i dont want to compete with you, i only hope some day some people will come up with better and modern EDA yet affordable, this EDA will include EM solver, RF, integrated SPICE simulator, differential/length match/impedance control interactive bus routing, MCU/FPGA embedded C/C++/VHDL built in and simulator/debugger everything that a modern electronics design will require, fwiw...
Title: Re: 10 meg sample home made scope project.
Post by: nigelwright7557 on July 30, 2019, 06:49:47 am
The problem with PCBCAD software now is the number of free packages and also the number of paid for packages.
Its pretty much given away on ebay.
So now for me its now just a hobby.
Before December 2017 I was doing ok selling it on ebay for about £20 a go, sold thousands of copies.
Then suddenly from nowhere came about 100 listings on ebay selling for peanuts.
It killed the job really.
For me its just a waste of time now but I continue to sell cheaper than the rest just to spite them and a sale I get is one they don't get.

There really are much better ways of making money than scraping around on ebay for pennies.
Title: Re: 10 meg sample home made scope project.
Post by: JPortici on July 30, 2019, 07:18:21 am
Pro's usually suggest 90 degree bends is not good.

very old farts maybe  :-DD
so this is the famous project i see mentioning over the microchip forums :)?
Title: Re: 10 meg sample home made scope project.
Post by: hans on July 30, 2019, 07:39:27 am
For a 10 Ms/s sampling rate, your analog bandwidth needs to be limited to 5 MHz anyway.

Gesendet von meinem Nokia 6.1 mit Tapatalk

The problem with digital scopes is while the sampling rate can be high you need many samples to make a waveform.
So something like 100 megs sampling would only be good for 1MHz sine or square wave.
A good analogue scope will blow the digital storage scopes out of the water.
However, you can pick up low sampling rate USB scopes for peanuts.

Not really, with sin(x)/x interpolation you only need a factor of 5-10 times to properly reconstruct sine waves from digital samples. For square waves, you obviously need more because of the harmonics.

If you want the analog design part to be reasonable, you also need a reasonable oversampling ratio between analog bandwidth and digital sample rate. This introduces a much lower order anti-aliasing filter. The Nyquist theorem is in that purely theoretical, almost nobody is crazy enough to build a 10+ order filter (with preferably a constant phase) so you can save a factor of 2x sampling rate of the digital domain. With a little bit of oversampling, you can get 2nd to 4th order anti-alias filters requirement.

Although an analog scope doesn't suffer from this sampling drama, they also have cons. For example, being able to single-shot waveforms, which depending on your work is the single most used feature of a digital oscilloscope considering today's bursty nature of communication systems. This is a big hurdle with older digital scopes, which in fairness were horrid to use. I recommended that if you want to build an usable scope, to take care your sample buffer is as large as possible.
Title: Re: 10 meg sample home made scope project.
Post by: thinkfat on July 30, 2019, 10:01:44 am
For a 10 Ms/s sampling rate, your analog bandwidth needs to be limited to 5 MHz anyway.

Gesendet von meinem Nokia 6.1 mit Tapatalk

The problem with digital scopes is while the sampling rate can be high you need many samples to make a waveform.
So something like 100 megs sampling would only be good for 1MHz sine or square wave.
A good analogue scope will blow the digital storage scopes out of the water.
However, you can pick up low sampling rate USB scopes for peanuts.

Not really, with sin(x)/x interpolation you only need a factor of 5-10 times to properly reconstruct sine waves from digital samples. For square waves, you obviously need more because of the harmonics.

If you want the analog design part to be reasonable, you also need a reasonable oversampling ratio between analog bandwidth and digital sample rate. This introduces a much lower order anti-aliasing filter. The Nyquist theorem is in that purely theoretical, almost nobody is crazy enough to build a 10+ order filter (with preferably a constant phase) so you can save a factor of 2x sampling rate of the digital domain. With a little bit of oversampling, you can get 2nd to 4th order anti-alias filters requirement.


I think 5 times oversampling is somewhat the minimum for sin(x)/x for a somewhat reasonable waveform reconstruction. In the case of the OP, at 10 Ms/s it doesn't really make sense to have an analog frontend with a crazy-high (in relative terms) bandwidth. We're looking at 1-2 MHz analog bandwidth maybe.

Of course the sampling theorem states that "perfect reconstruction" of the signal is only possible if the total power (energy?) of all signal components beyond fs/2 is zero, but in practice this is hardly achievable and you only need to keep it below the noise introduced by quantization anyway. That reduces your requirements quite a bit.

Nevertheless, the sampling theorem does not impose just some theoretical limit. The effect is quite real and if you goof up enough, it will be clearly visible on the screen of your scope.
Title: Re: 10 meg sample home made scope project.
Post by: nigelwright7557 on August 06, 2019, 09:55:27 am
I did a bit more work on the scope and with some software changes I managed to get 18.5MHZ sampling.
I just used more inline code and cached the scope buffer.

I have moved on to a cheaper design now that uses same A2D but just a cheap through hole PIC.
This one runs at 15MHz sampling. It works very well.
I put the A2D on an SMD to through hole adaptor pcb.
It was fun to solder on the small pcb as everything kept moving around when I tried to solder it.
So I put some flux paste beneath the A2D and that helped hold it in place while I soldered it.
Title: Re: 10 meg sample home made scope project.
Post by: BravoV on August 06, 2019, 10:12:40 am
Pro's usually suggest 90 degree bends is not good.

very old farts maybe  :-DD
so this is the famous project i see mentioning over the microchip forums :)?

Nope, even a relic, still a 90 degree bend is a hype.

Look how this high power TV RF transmission line used it too, in Dave's tour at EEVBLog Video #569, see that multiple 90 degree bends ?  >:D

Please don't tell us those RF engineers knew nothing about doing the right thing.

(https://www.eevblog.com/forum/blog/eevblog-569-tour-of-an-analog-tv-transmission-facility/?action=dlattach;attach=77062;image)
Title: Re: 10 meg sample home made scope project.
Post by: Mechatrommer on August 06, 2019, 12:32:07 pm
bluetooth pcb/rf (antenna) designer, i guess the OP is one of them, may say differently. pun intended :P
Title: Re: 10 meg sample home made scope project.
Post by: nigelwright7557 on August 09, 2019, 05:15:25 am
I managed to overclock the PIC32MX a bit and got up to 16.5 mega samples/second.
Built up a couple more pcb's and they all behave well.