Personal tools
User menu

Difference between revisions of "Simple USB Oscilloscope"

From Francois Louw

Jump to: navigation, search
 
Line 7: Line 7:
 
__TOC__
 
__TOC__
 
----
 
----
==A Simple USB Oscilloscope==
+
=A Simple/DIY 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.
+
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 a DIY USB Oscilloscope.
  
 
'''Note: This is not a high speed high precision replacement for a professional oscilloscope. This is meant for hobbyists who don't want to spend $50+ on something that is worth only $5. If you need professional quality readings, then get a proper oscilloscope.'''
 
'''Note: This is not a high speed high precision replacement for a professional oscilloscope. This is meant for hobbyists who don't want to spend $50+ on something that is worth only $5. If you need professional quality readings, then get a proper oscilloscope.'''
Line 17: Line 17:
 
It's not pretty but it works!
 
It's not pretty but it works!
  
==Specifications==
+
=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.
 
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.
  
Line 33: Line 33:
 
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%!
 
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==
+
=Hardware and Schematic=
 
The following is a bill of materials of what I used:
 
The following is a bill of materials of what I used:
 
*Microchip PIC32MX220F032B
 
*Microchip PIC32MX220F032B
Line 57: Line 57:
  
 
[[File:USBScopeSchematic.jpg|left|700px]]
 
[[File:USBScopeSchematic.jpg|left|700px]]
 +
<br clear=all>
  
 
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.
 
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.
Line 64: Line 65:
 
The voltage regulator is a simple linear low drop off regulator from ST Microelectronics. Any other regulator can also be used to drop the voltage to 3.3V.
 
The voltage regulator is a simple linear low drop off regulator from ST Microelectronics. Any other regulator can also be used to drop the voltage to 3.3V.
  
==Firmware==
+
=Firmware=
  
 
To create the firmware I used MPLabX 1.60 with Microchip 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.
 
To create the firmware I used MPLabX 1.60 with Microchip 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.
Line 70: Line 71:
 
'''NOTE: The USB VID and PID that I use are Microchip 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.'''
 
'''NOTE: The USB VID and PID that I use are Microchip 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. There arae two 3kB circular buffers, each for one channel. The PIC samples the A2D every 4000 cpu ticks. The PIC is running at 50MHz, meaning every tick is 0.02uS and 4000 ticks are 80uS. This gives a sampling rate of 12500 samples per second, or 12.5KHz. Every read gives a value for both channels.  
+
The firmware is very simple. There are two 3kB circular buffers, each for one channel. The PIC samples the A2D every 4000 cpu ticks. The PIC is running at 50MHz, meaning every tick is 0.02uS and 4000 ticks are 80uS. This gives a sampling rate of 12500 samples per second, or 12.5KHz. Every read gives a value for both channels.  
  
 
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 LED is used as an indicator of when the buffers are full. (Used to show if your computer is reading it too slow)
Line 78: Line 79:
 
USB Packet structure is done first by writing the endpoint 0x81, then the packetsize, then the channel number followed by samples. This results in a max of 61 bytes of data (61 samples) per packet to be sent to the computer.
 
USB Packet structure is done first by writing the endpoint 0x81, then the packetsize, then the channel number followed by samples. This results in a max of 61 bytes of data (61 samples) per packet to be sent to the computer.
  
==Windows Software==
+
=Windows Software=
 
This part is a bit more difficult. I have used Qt 4.7, with MinGW, and QWT 6.1.0rc3. Qt can be found [http://qt-project.org/downloads here] with MinGW. QWT for Qt can be found [http://qwt.sourceforge.net/ here]. '''Follow the QWT Installation instructions to the letter!''' Please don't contact me if you cant get QWT to work, search on the internet and on forums.
 
This part is a bit more difficult. I have used Qt 4.7, with MinGW, and QWT 6.1.0rc3. Qt can be found [http://qt-project.org/downloads here] with MinGW. QWT for Qt can be found [http://qwt.sourceforge.net/ here]. '''Follow the QWT Installation instructions to the letter!''' Please don't contact me if you cant get QWT to work, search on the internet and on forums.
  
Line 98: Line 99:
  
 
[[File:Simple_USB_Scope_Screenshot.jpeg|center|700px]]
 
[[File:Simple_USB_Scope_Screenshot.jpeg|center|700px]]
 +
<br clear=all>
  
==Everything Together==
+
=Everything Together=
 
When you add everything together, you have a simple but effective USB oscilloscope that is good enough for everyday projects. As a Checklist remember to do the following (preferably in order)
 
When you add everything together, you have a simple but effective USB oscilloscope that is good enough for everyday projects. As a Checklist remember to do the following (preferably in order)
  
Line 120: Line 122:
 
As stated before, the software has major room for improvement, and maybe someday I will get round to do it. But in the meantime, feel free to use this and improve! Remember to link to this site and share your design!
 
As stated before, the software has major room for improvement, and maybe someday I will get round to do it. But in the meantime, feel free to use this and improve! Remember to link to this site and share your design!
  
==Download==
+
=Download=
'''Everything here is provided under the [Gplv3] licence. Do not claim this as your own, do not make money from this, release your version also as open source. Give back to the community.'''
+
'''Everything here is provided under the [[Gplv3]] licence. Do not claim this as your own, do not make money from this, release your version also as open source. Give back to the community.'''
  
 
[http://aeif.info/files/usbscope/binaries.zip Precompiled Firmware, drivers and Windows software.] This is the complete binary package, you don't have to install Qt, QWT, MinGW or compile anything.
 
[http://aeif.info/files/usbscope/binaries.zip Precompiled Firmware, drivers and Windows software.] This is the complete binary package, you don't have to install Qt, QWT, MinGW or compile anything.

Latest revision as of 12:03, 24 July 2014