Step 2: Microcontroller

The microcontroller (a Microchip PIC18F14K50) is the heart of the whole instrument. Above you see a high-level block diagram of its internal structure. As said before, almost all functions are integrated into this single chip, Microchip really managed to pack a ton of features into this little marvel costing just around $3.

Even though there seem to be several ADC input pins the truth is that there really is just a single ADC whose input gets multiplexed onto these pins. That means one can only take one sample on one channel at a time; for two channels the acquisition is done interleaved, i.e. one sample from CH1, then one from CH2, again one from CH1, and so on. The maximum achievable sample rate is just above 50 kSa/sec. (For finer resolutions the scope uses equivalent time sampling, up to 2 MSa/sec equivalent sample rate). The ADC’s analog bandwidth is a few hundred kHz (the data sheet does not specify bandwidth, this number is from my own measurements).

As with the ADC, the comparator inputs can get multiplexed on several different pins – here, CH1 low (1x) and high (10x) gain path and external trigger. The other side gets the trigger threshold, produced by the PWM (pulse width modulation) module. The microcontroller can set up an interrupt that reacts whenever the comparator output changes state (i.e. the input signal crosses the threshold) which allows for very fast, low-latency reaction to trigger events.

The sample logic (actually a piece of code) controls the acquisition process – processing interrupts from the comparator, timer interrupts to sample at regular intervals, transfer of the sampled signal data into the microcontroller’s internal memory (RAM). It can either capture data from the two analog scope channels or from the four digital logic analyzer inputs.

The microcontroller also has a complete USB interface built in which provides data connection to the PC. A program on the PC lets the user control the acquisition settings and displays the data, so it looks and feels like a regular oscilloscope.
The main program running on the microcontroller takes care of communicating with the PC (receiving commands and sending the captured data) and sets up the sample logic, comparator, ADC with the acquisition parameters.
<p>Looks well designed, Good reasoning, proper care on the oscilloscope input to be compatible with scopes.</p><p>But that doesn't change that this is more of a Assembly instruction manual of a kit then a instructable. without the source code and a &quot;how to program&quot; it is pretty much useless to the people that come to this site to be able to build their own. You can showcase you kit, but people would need to able to build their own without having to buy it.</p>
<p>Does the Microchip PIC18F14K50 have to be programmed............?</p><p>It seems you haven't talked anything about it...............</p><p>Please do reply immediately..............</p>
<p>Hi Friend</p><p>A very well written instructable.<br>I have one question regarding the compensated circuit in the input stage. Should'nt the capacitive divider (cap. C11) be also connected to the reference terminal of 2.5V instead of ground just like the resistive divider ?</p><p>Only then it will correctly finction as a frequency compensated voltage divider.</p><p>Please comment</p>
<p>good day sir, im trying to make an oscilloscope for my final project in electronics, you gave your schematic but the code for the pic18F14k50 was not their how can i make it running then? i am hoping for the codes is their any way to get it?</p>
<p>I am trying to write firmware for my own PIC18 - USB oscilloscope and I was wondering if you had knowledge of any good resources that might help me get started? I have never written firmware/drivers before. My idea is to do something similar to what you have done here, meaning eventually writing a Windows app that controls the operation of the device. Also, if your firmware is available somewhere, if would appreciate if you could point me to it.</p><p>Thank you!</p>
<p>I would*</p>
<p>can i get the source code for this windows application??</p>
<p>You can download the application from my webpage (http://www.dpscope.com); the source code is not included though.</p>
<p>I've just assembled one! Took me roughly one hour of work, and after installing the software, plugging it and calibrating as described in the doc, the damn thing just started working no questions asked :) </p><p>Cool little piece of hardware that WORKS as advertised.</p>
<p>what is the supply voltage for the op amps?</p>
<p>Vcc=5V like for the rest of the circuitry. The op-amps are rail-to-rail input as well as output (meaning they accept input voltages from 0 to Vcc) and their output can swing to within a few mV of 0V and Vcc. This makes them very simple to use. </p>
HELLO SIR <br>i'm doing my BE final in TAMILNADU,INDIA i need DPSCOPE SE self assembling kit, in how many days can I receive your kit.......... <br>please reply me sir........
Postal delivery times vary quite a bit, but in my experience the package typically takes between 2 and 5 weeks to arrive in India.
Thank you for your kind reply sir........., <br>
Is there a way to make either DPScope or DPScope SE work on Mac or Linux machines? What is different when using the SE in logic analyzer mode? Can you get all of the same functionality with the DPScope with its faster reading?
WINE seems to be the way to go, although I don't own a Linux machine to try it yourself. There are some users who reported that it works: <br> <br>http://dpscope.freeforums.org/dpscope-software-under-linux-using-wine-t62.html <br> <br>The DPScope SE has significantly lower specs regarding bandwidth and sample rate compared to the DPScope. The latter lacks the logic analyzer functionality though. A more detailed discussion of the differences is here: <br> <br>http://dpscope.freeforums.org/what-is-the-difference-between-dpscope-and-dpscope-se-t97.html <br>
Hi , <br> I am doing my first experiments with electronics and am in the middle of buliding onetesla.com project ... they say to test you are better of with an oscilloscope ... Will this cope have the speed and voltage range required to test my project? Sorry but I ma so new I dont really know how to check this out for myself
I must admit I only did a cursory check of the project, but it being a tesla coil means it works with high voltages. I would NOT recommend a USB based scope to be used with such high voltages as any mistake will risk frying your PC...
Hello! nice work! I want to make it at home! How I programme the PIC ?
The PIC in the kit comes already pre-programmed, so no need to do this yourself: <br> <br>http://www.pdamusician.com/dpscope/buy_it_se.html <br> <br>
very well thought out design which saved me endless hours doing it myself half as well <br> <br>many thanks Rick
Really Nice Project !!!! <br>Thanks For Sharing !!!! <br>.... I'll Be Buying Your Kit Soon !!!!
Womai, can you provide more info on the logic analyzer portion of the project. I'd like to know about the triggering aspect in particular. It would be nice to be able to trigger on a particular hex code, for instance. (I2C or SPI)
Triggering is fairly basic. I use the &quot;interrupt on change&quot; feature of the PIC. I.e. you get an interrupt whenever the state of a particular pin changes and then have to check whether the state is now &quot;low&quot; or &quot;high&quot;. That way the scope can trigger in either a rising or a falling edge. The advantage is very fast, stable reaction time since the interrupt gets generated by dedicated logic, not in a software polling loop. <br> <br>I have not implemented triggering on a full pattern. You'd probably want to allow trigger masks that comprise two subsequent samples, and mask them accordingly. E.g. masks X01X and X11X (where X means &quot;don't care&quot;) would tell the scope to trigger on &quot;rising edge on channel 2 and logic high on channel 3&quot;. Or masks XXXX and 0011 would mean to trigger on the vector &quot;channels 1 and 2 are low, channels 3 and 4 are high&quot;. I had been playing with such a scheme, but even with clever logic operations I got nowhere close to 1 MSa/sec, that's why I abandoned the scheme. This is a place where I'd go for an implementation in hardwired logic (e.g. 74xx gates or a CPLD/FPGA) instead.
If you want to trigger on the start bit of an I2C transmission, here is a simple circuit you can use: <br> <br>http://www.i2cchip.com/monitoring_i2c_bus.html <br> <br>The output then acts as the trigger for the scope.
Is the software to run the scope made with LabVIEW?
No, it's written in Visual Basic (VB) 6 Professional.
Very nice. A couple of typos (I think) in the Input Stage description:<br> <br> (C11 + C_par) / C1<strong>9</strong> = R1 / R3 should read (C11 + C_par) / C1<strong>2</strong> = R1 / R3<br> <br> <strong>R</strong>1 is rated to a static load of at least 100V or 200V (depending on specific model), so this gives good headroom compared to the specified input signal range (25V peak). I think that should say <strong>D</strong>1.
Thanks for pointing out the mistake in the formula. <br> <br>As for the second one, it is indeed the resistor R1 that is the limiting factor, since it gets 90% of the applied input voltage, while D1 and D2 only see 1/10th, so their voltage rating (also &gt; 100V) is largely irrelevant.
Excellent Piece of Work &amp; a very clear Instructable , My Compliments !<br> <br> I am currently using a Sound Card oscilloscope with a custom interface:<br> <br> https://www.instructables.com/id/PC-SOUND-CARD-SCOPE-INTERFACE-FACILITATES-DC-RESTO/<br> <br> The Sound card samples at 49KSa/sec and the PC displays wave-forms up to 4Khz .<br> <br> I have a fundamental question:<br> <br> You state that &quot;The maximum achievable sample rate is just above 50 kSa/sec. (For finer resolutions the scope uses equivalent time sampling, up to 2 MSa/sec equivalent sample rate).&quot;<br> <br> Can you explain how you are able to display 20Khz and 39Khz wave-forms ?<br> <br> Would Love to hear from you and possibly go in for your &nbsp;DPScope SE kit<br> <br> Best &nbsp;Wishes,<br> <br> Ajoy Raman
As long as the signal you want to display is repetitive with respect to some trigger (can be the signal itself, i.e. a periodic wave), you can get an &quot;equivalent time&quot; picture put together from several (or many) partial acquisitions. E.g. just taking one sample per trigger, each time with a slightly larger delay after the trigger. I describe this in more detail in the DPScope SE technical description on my webpage (http://www.dpscope.com --&gt; DPScope SE --&gt; Downloads), or read about it in the Tektronix app note &quot;XYZs of Oscilloscopes&quot; on the same page. The increment can be much smaller than the fastest real-time (single-shot) sample rate. For the DPScope SE the smallest such increment is 0.5us, for an equivalent time sample rate of 2 MSa/sec. Thus the ability to show a &gt;20 kHz signal. Without interpolation you need about 8-10x oversampling for useful display, so 2 MSa/sec means ~250 kHz usable analog bandwidth.
Thank You for the Lucid Reply and the Tek application brief !<br><br>Best Wishes,<br><br>Ajoy Raman<br>
Very nice and very cool. I was floored when I saw it was a kit. May get one just for fun.
This is a great project. I've been considering the purchase of a PC scope for some time but the prices always seemto high to justify for hobby use. This is a winner so I placed my order for the kit just now!
Two challenges that I propose: <br> <br>Make a quad-scan device with higher bandwidth (100MHz) <br>Seeing as the whole thing is powered from one USB port, I'm waiting for an entire laptop that can be powered on 5V 0.5A. <br> <br>:)
What's your budget? :-) 100 MHz / 4 channels is certainly doable from a technical point of view (although it may need a bit more than 500mA), but the cost would exceed the prize of a good off-the-shelf instruments like e.g. a Rigol 1052E which you can find for under $400 nowadays... This is why I concentrate on building scopes for the super-low budget minded, where there is not a whole lot of choice.
I was being facetious. When I look through the other &quot;Oscilloscope&quot; 'ibles, yours is by far one of the easiest, safest, and fairly quickly built as well.
I took it that way but probably came across too serious! And one day I'll build a 10 GHz version with all through-hole part :-)
This is brilliant, Wolfgang! <br>I don't know if you remember, but I bought one of the previous versions from you just over two years ago now, and it continues to serve me VERY well! <br>It's up there with my multimeter and my component analyser as one of THE most used tools on my work bench. <br>I wonder how small you could make this with SMT parts? Now THERE'S a challenge :D Matchbox DSO anybody? :P
Sure, SMD components would allow for a VERY compact design (go for 0201 components if you want :-) But I guess many hobbyists would be scared away by that... this is why I deliberately kept everything large-pitch through-hole. <br> <br>You could place components on both sides of the board to make it even smaller. The limiting factor would likely be the BNC and USB connectors.
Indeed, it would be crazy difficult with SMTs, tried that myself before! These people who use skillets and hotplates for reflow work make it look so easy :( (I'm pointing at you, Ladyada! :P)<br>I was just looking at the support forums, too. There's some intriguing threads there, like isolating the scope from the computer using opto isolators. may have to try that one.
Don't let SMD parts scare you away. It's the way the world is going, and many parts are only available in those packages, so if the DIY'er wants to stay in business, we need to learn to adapt. <br>I taught a class to our ham radio club last year demonstrating that it isn't that hard to work with SMD. You don't need all that reflow apparatus unless you are doing production quantities. I used to design VERY large and complex PCB's and my prototypes were built by hand using nothing more than a soldering iron. <br>Here are the essential items to do SMD by hand: <br>A good temperature controlled soldering station with a TINY tip. I prefer the Metcal, but they're pricey, unless you can find a used one, which I did for $80. <br>Some form of magnification. You can get by with a head mounted visor, or work your way up to a bench mounted stereo microscope. <br>small tools including a couple of different shapes of tweezers for parts placement. <br>VERY small solder. If you look, you can find small quantities on eBay and elsewhere. You need something smaller than 0.015&quot;. <br>Solder wick - for fixing the boo-boos. Sometimes it is easier to lay down too much solder and then take some back. Solder wick and good visibility allow you to do that. <br>And the final item that is ESSENTIAL is a flux pen. Apply flux liberally to the pads immediately before placing the part with tweezers. The flux is a bit sticky and keeps the parts from sliding away, but it is amazing what a difference it makes to solder flow. You can tin the soldering iron tip and touch it to the component lead and pad, and it flows instantly. <br>I've used parts down to 0201, but for home hobby use, I mostly use 0603. Small enough to keep things compact, but large enough to see what I'm doing! <br>These techniques will allow you to hand solder ANY SMD device except BGA's.
One day I'll pick up the SMT reigns and have another go. One day :P<br>The last time I tried I completely ruined an FTDI chip before I learned of the solder wick trick. That bit looks SO easy. Also drag soldering!<br>Once I sort my workspace out and maybe upgrade some of my tools, perhaps I'll have another go. Maybe start with some SMT kits from Sparkfun or something.<br><br>It's definitely something I want to get into :) particularly as you mention the industry is heading that way anyway, and all the nicest flavoured chips, like that pesky FTDI part, are only available in SMT.
Yeah, I'm resonably skilled with SMD myself so I know it is doable (although reworking multi-pin ICs does need a hot-air soldering station and a selection of different size adapters), but from experience I can tell you almost any beginner or intermediate electronics hobbyist shies away from it. Just look at the list of equipment you mention yourself and imagine pushing this to someone who is loath to spend more than $20 on components...
Indeed, very true! The cost of different tools can mount up, particularly if you already have things like a solder iron, but it's not temperature controlled. Luckily I have things like solder wick and a flux pen. I'd love to get a hot air gun, but haven't been able to find an affordable one.<br>Oh and to the hobbyists who can work with BGA and QFN chips, my hat goes off to you all!
Nicely done. But despite your arguments about it being educational hardware-wise, I'd have to agree with farldarm that without source code it is more of an advertisement than an instructable.
Excellent instructable!! now only if someone could make an instructable for an arbitrary waveform generator I'd be golden!
Just saw that instructable yesterday. Very nice design and very clear explanation. Would be a good addition for anyone with a DPScope.

About This Instructable




More by womai:Electronic Heart (Flashing LEDs) - Mother's Day Project DPScope SE - the simplest real oscilloscope/logic analyzer on the planet DPScope - Build Your Own USB/PC-Based Oscilloscope 
Add instructable to: