Step 7: USB Connection
The PIC18F14K50 microcontroller has a full USB interface already built in (actually that is one of the main reasons to use this particular microcontroller), so implementing the USB data connection becomes almost trivial on the hardware side – the connector and two 47 pF capacitors (C1, C7) is all that is needed! The device is set up as a HID (human interface device), which is one of the two most common choices for simple USB enabled devices (the other being CDC = virtual serial port). HID can transfer data at up to 64000 bytes/sec (almost 64 KB/sec), or – more precisely – up to 1000 data packets per second where one data packet can contain up to 64 bytes of data. This is absolutely sufficient for our purposes: One full data record on the DPScope SE has around 420 bytes (210 bytes for each of the two analog channels), i.e. needs just 7 maximum-length packets. Then there is some overhead to set up acquisition parameters, start the acquisition and query the scope status, but still one full acquisition uses less than 20 data packets, so the USB data bandwidth is not a limiting factor for the capture rate.
The power supply was kept as simple as possible as well. It relies on the fact that the USB supply voltage is at least roughly regulated (nominally 5V but it can vary between ~4.3V and ~5.3V) and matches the voltage requirements of our circuit (5V), so there is no voltage regulator. (More advanced USB supplied circuits typically run at 3.3V so they can use a simple low-dropout regulator to provide regulated 3.3V from the raw USB supply voltage. But to get regulated 5V from the 4.3…5.3V input – i.e. sometimes lower and sometimes higher than the output voltage – we would need a buck-boost switching regulator which would roughly double the scope’s complexity).
There is some minimum power supply decoupling – the bulk electrolytic capacitor C8 in combination with chock L2 and ceramic capacitor C10 filter the USB supply: C8 acts as a buffer (reservoir) to take care of surges in the circuits power consumption. C10 and L2 block high frequency noise coming from the PC to the scope or disturbances coming from the scope.