Personal tools
Log in
User menu
Main page
All Projects
Recommended Tools
Research
Resume/CV
Links
View source for Simple USB Oscilloscope
From Francois Louw
Jump to:
navigation
,
search
<metadesc>Simple USB Oscilloscope</metadesc> <metakeywords>USB, Oscilloscope, PIC32, microchip, pic, pic32mx220, libusb, qt, windows, firmware, c, qwt, hobby</metakeywords> [[Projects|Back To All Projects Page]] [[Main Page|Back To Main Page]] ---- __NOTOC__ ==A Simple USB Oscilloscope== I have at many times wished that I had an oscilloscope. Given the prices, and shipping costs they are a bit too expensive for just hobbyist jobs. I have looked at USB oscilloscopes that are currently available, but starting at around $50 for one, that has a bit too high claims of sensing speed and accuracy, I realised that it will be a good weekend project to create one myself. '''Note: This is not a high speed high precision replacement for a professional oscilloscope. This is meant for hobbyists who doesn't want to spend $50+ on something that is worth only $5. If you need professional quality readings, then get a proper oscilloscope.''' ==Specifications== The goal was to create an Oscilloscope that is good enough for my ECU prototyping. Here are a list of the specifications for what I wanted. *USB Interface (NOT a USB-Serial interface, but proper libusb/winusb interface) *10KHZ+ Sampling rate *8bit Accuarcy *2 Channels *USB Powered *Cheap *-15V to +15V input *Qt Based Windows interface (Can be ported to Linux/Android) *Portable *Weekend Project Ok, well, all of that is good, except, as most projects go, the timeframe of just weekend didn't work, so in the end it took me 5 days to get it sorted. There are still a few minor bugs in the Windows code, and inefficient coding. But it works 100%! ==Hardware and Schematic== The following is a bill of materials of what I used: *Microchip PIC32MX220F032B *20MHz Crystal *USB Cable *100nF Capacitor *2x 10nF Capacitor *4.7K Resistor *Some other resistor values *Crocodile Clamp Cables *Prototyping board (strip board) '''Note: Do not use the prototyping bread boards, where you can plug in and out the wires. They are horrible and especially with USB should not be used. They are basically and array of tiny antennas in there that pics up noise the whole time! If you use them and this doesn't work, then don't blame me! When using Strip Board, make sure to cut the tracks as short as possible on the underside to prevent noise.''' ===Schematic=== [[File:placeholder.png|left|300px]] There are no PCB layout or gerber files, this is simple enough so that anyone can implement their own PCB. Or just use strip board. ==Firmware== To create the firmware I used MPLabX 1.60 with Microchip's XC32 V1.20 Compiler. This was programmed with the ICD3 programmer/debugger. I also used Microchip's Application Library 2013-02-15 USB Stack. The USB mode used is the LibUSB Generic Driver. '''NOTE: The USB VID and PID that I use are Microchip's VID and an arbitrary chosen PID to differentiate between my other projects. I am not licensed to use that PID. Do not use that PID! I have requested a PID from Microchip, but have not yet received a response.''' The firmware is very simple. I have two 3kB circular buffers, each for one channel. The PIC samples the A2D at 20000 times per second. Every read gives a value for both channels. This results in a sampling rate of 20KHz per channel. The LED is used as an indicator of when the buffers are full. (Used to show if your computer is reading it too slow) The main loop is used to send the channel data alternating between channel 1 and 2, emptying the buffers. Timer1 is used to interrupt the main loop, sample the data and add data to the buffer. USB Packet structure is done first by writing the endpoint 0x81, then the packetsize, then the channel number. This results in a max of 61 bytes of data (61 samples) per packet to be sent to the computer.
Return to
Simple USB Oscilloscope
.