HOME Technical Tips  


USB low frequency oscilloscope, bandwidth is DC to 1KHz. Max sampling rate is 12680 samples per second. The trigger circuit uses the integrated comparator and CCP. An oscilloscope with these specifications has limited use, but it has an advantage on analogue oscilloscope for low frequencies.
Included Visual Basic 6 software and a circuit diagram. The circuit is powered by the USB. The interface to the PC is HID class.
The screen is constructed from 64 sampling. The ADC reads the input at resolution of 8 bits and in intervals determent by the Time Base. The 64 bytes are transmitted in one stream every 100ms or longer for lower frequencies.
The trigger input starts the sampling of the input at the trigger voltage rise. This gives the ability to measure phase shift between the trigger and the input. The trigger input isn't needed when looking at waveform only.
HID class (human interface device) is a USB class of devices like the mouse and the keyboard, the data transfer rate is limited to 64KB/S.
PIC18F2550 code is assembler code and C code (under GNU General Public License) for Microchip C18 compiler.
VB6 code includes guidance to setting up the PC. The PC register the PID (Product ID) and VID (Vendor ID) of the USB device when it's plugged, the VB code uses these ID's to communicate with the device. For commercial VID it is needed to buy it from USB-IF, but in your lab you can use any number.
The source code is derived from freeware from these sources: http://janaxelson.com/usb.htm , http://openprog.altervista.org/USB_firm_eng.html
Code was written on MPLAB 8x and compiled with C18 ver 3.30. PIC18F2550 was programmed using Velleman K8076.
Software includes PIC code and VB6 code. You are free to use the circuit diagram and the VB software with no limitations.

The VB6 application.

Circuit Description
See also Technical Tips

Pin 3 is the analogue input. Input voltage range is 0 to 5V absolute max, voltage outside this range can latch the input or even permanently damage the IC.
Pin 4 is the comparator input used to generate the trigger.
Pin 14 is 3.3V internal supply for the USB transceiver.
Pins 15,16 are the data lines to the USB connector on the PC.
Pin 20 is the PC 5V powering the PIC. It is limited to 100mA by the PC. 0.47uF is for decoupling.
For USB wiring info: http://www.interfacebus.com/Design_Connector_USB.html


Comments and questions

Copy the number from the picture It stops net-robots from adding comments.

19.11.2019 - 04:44
Name: Mike C
Comment: Thanks for an very useful project!

19.11.2019 - 00:43
Name: Moty
Comment: Hi Mike, I've added a few words above that describe the use of the trigger input.

18.11.2019 - 00:47
Name: Mike C
Comment: When I need to capture a picture on scope, What do I use to trigger 18F2550 pin 4? Regards, Mike C from California, USA

11.06.2019 - 05:12
Name: Moty
Comment: Hi Lobo, The max conversion speed of the ADC is about 50 KHz even at 48 MHz clock, I take 64 sampling per frame or total of 64 KHz which is over the max.

11.06.2019 - 05:04
Name: Lobo
Comment: just build the USB-Scope on a testing board and it works well. Maybe it would be a good idea to build a protection for the input (pin 3) so there cannot be a overload. The PIC 18F2550 can be clocked with a maximum of 48MHz. Is it possible to measure a clock of more than 1KHz when the prozessor is clocked higher than the 4MHz in this circuit? If yes, can you amend the software for a 48MHz clock? Kind regards from Germany Lobo (CT8ACA)

15.08.2017 - 14:59
Name: Moty
Comment: Hallo Gunter, du bist immer willkommen

15.08.2017 - 09:22
Name: G√ľnter
Comment: Super Seite, ich schaue immer wieder nach Neuheiten auf dieser Seite!

22.10.2015 - 12:03
Name: Mr. Valdir Bispo
Comment: Since I do not intend to work in a real Lab, I sometimes need a simple scope only to check waveforms. So I will assembly this project to hava at hand when I need, THANKS !

24.07.2015 - 10:44
Name: mysu
Comment: This project works fine for me. It can be made to work on a Android tablet? A tablet is more portable in comparison to laptop and battery last longer.

24.07.2015 - 10:44
Name: mysu
Comment: This project works fine for me. It can be made to work on a Android tablet? A tablet is more portable in comparison to laptop and battery last longer.

28.06.2015 - 16:23
Name: Moty
Comment: Hi Memo, The input voltage shouldn't be more positive than the Vdd and not lower than ground. Look at Technical Tips page how you can protect the input of the PIC.

28.06.2015 - 06:40
Name: Memo
Comment: Hi Moty...I'm going to do this project, but I ask you: What is the maximum voltage amplitude that I can measure to the input? (3V, 5V ...)

19.09.2014 - 08:41
Name: gedstron
Comment: please, can you please upgrade it to graphic lcd 128x64 oscilloscope.thanks

05.06.2014 - 23:04
Name: Moty
Comment: Hi Moondeck. When the trigger is not connected the waveform runs free. If the trigger is connected to the signal input and TRIGGER selected on the PC app it is like an auto-trigger, the waveform will be stable. Are you related to Frank Zappa? he named his daughter Moonunit.

05.06.2014 - 22:06
Name: Moondeck
Comment: Hi. Where should i wire the Trigger? Or can i just leave it N.C.d ?

20.05.2014 - 12:16
Name: mirob
Comment: Thanks! :-)

20.05.2014 - 11:59
Name: mirob
Comment: Thanks! :-)

20.05.2014 - 11:59
Name: mirob
Comment: Thanks! :-)

20.05.2014 - 10:18
Name: Moty
Comment: Hi Mirob. The cap is 0.22uF.

20.05.2014 - 08:33
Name: mirob
Comment: capacitor for pine microprocessor 14 has a value of 0.22 ..... what? uF, nF, pF ...?

23.10.2013 - 20:08
Name: Ahmed

14.09.2013 - 22:33
Name: Moty
Comment: Hi Chandana. It is difficult to remotely find the problem. Some people needed to add USB HID driver to their WIN XP. In most cases it was a free PIC programmer that didn't work well with PIC18F2550.

14.09.2013 - 09:06
Name: chandana
Comment: I built this project, VB screen is open but the device is not recognized. I appreciate your advice. Thanks

22.08.2013 - 22:18
Name: Moty
Comment: Hi Edson. The problem is likely to be in the programming of the PIC. Are you using a programmer which you know works well for pic18f2550 ?

21.08.2013 - 23:10
Name: Edson Stedile
Comment: I built this project, however the the VB screen points out that the device is not recognized. I appreciate your advice. Thanks

27.05.2013 - 11:39
Name: Moty
Comment: Hi Momgoose. Make sure "usb_defs.inc" and "ENGR2210.inc" are included in the project. Make sure the project Set Tool Location is directed to the correct folder in your computer where you keep the inc and lib files.

26.05.2013 - 01:35
Name: Mongoose
Comment: Hi, i'm trying to compile your asm file in MPASMWIN and I have many errors. Can you help me? Thank you.

19.03.2013 - 19:53
Name: Moty
Comment: Hi, I assume that the problem is that the device isn't detected by the VB application. All USB devices communicate with the PC the same way. The PC identifies each device by 2 numbers called VID and PID. The scope and the input output projects use deferent VID and PID, it means that the scope VB application detects only the scope firmware, the same for the input output firmware. The VID and PID are programmed in the firmware and in the VB code. You can change the numbers but you have to have the same number in the firmware and in the VB code. After you programme the PIC unplug the device and plug it again, it lets the PC to check the device. If the PC doesn't recognize the device then it could be an error with writing the firmware to the PIC. I hope I've answered your question, don't hesitate to ask more. And one more thing, I adore France.

19.03.2013 - 17:22
Comment: When using USB Input-Output hex file the device is recognized by the computer, while when I write USB Oscilloscope hex file it is not. The hardware uses in both cases 4 MHz osc. Why is it rejected? Thanks in advance

06.03.2013 - 06:42
Name: DVS
Comment: It's good but please give more details about trigger pin.........

05.03.2013 - 16:43
Name: Moty
Comment: I'm glad to hear that. Have fun.

05.03.2013 - 07:33
Comment: It's very usefull for me......

05.03.2013 - 07:33
Comment: It's very usefull for me......

16.02.2013 - 08:50
Name: Satya Ranjan Sarkar

02.09.2012 - 13:06
Name: ffgh

18.06.2012 - 13:11
Comment: what is the max input power and max amplitude the adc can digitise

17.06.2012 - 10:06
Comment: can you describe the A/D conversion process in some detail, also what does the time base do in your project.

10.06.2012 - 15:03
Name: Moty
Comment: The comparator of the pic detects when the signal crosses 0V and starts the input sampling.

10.06.2012 - 08:35
Name: can you please give me more detail about the trigger.

12.09.2010 - 06:43
Name: Faiz Alam
Comment: Very good

iconFlag Countermoty22.co.uk  2008-2022