jeudi 2 octobre 2008

The cheapest dual trace scope in the galaxy


This submini USB scope is based on a Atmel Tiny45 cpu and cost less than 5€ with a homemade pcb

It has 2 analog inputs and can supply 5V ont the 4 pins header on the right. One of the inputs can be scaled down with the trim pot.
The firmware in the Tiny45 is written in C and compiled with Winavr and usb source code from obdev. As you can see, there is no crystal , the software sync the internal 16.5Mhz pll clock with the USB clock.

The cost with a home made pcb is around 5€.
Of course, do not expect 1Gs/s HID does not alow that data rate !
But it is using a 10bits AD.

It has been designed to plug into a project breadboard so there is no need for a power supply.
On this picture it is used to test a high precision light sensor.

It does connect to a PC with usb in HID mode, without the need to install any specific driver. Data are diplayed on the PC with .NET C# software. This is an exemple of my display programOf course you can write your own code to capture or display the datas

Here is the schematic, so simple !

 Thank you to[Milka2009] who made a nice video

Bill of material

1 Led (any)
1 R for led, from 220 to 470 ohm, smaller is brighter
2 R 68 ohm on USB D+ & D-lines
1 Pull up R 1.5K for USB device detection
2 Zener 3.6V for right USB signal levels
2 Bypass caps 100nf & 47uf
2 filter caps on analog inputs ( from 10nf to 470nf or nothing, up to you)
1 or 2 trimpots on analog inputs to scale your voltage to AD range (1.2V or 2.5V by software )
1 USB socket (A,B, mini, you chose)
1 Atmel Tiny45-20.

eagle files: usbscope-tiny.zip

Here is the C source for the firmware including usb lib and HID descriptors
and for those who do not want to mess with compilers, the .HEX file ready to flash main.hex.
Do not forget to set the fuses for internal PLL clock

And last for today, the Windows display software UsbADC.zip. There is no setup with it, so copy in a folder with the dll and try. It is .NET so you need the framework.

UPDATE: for all who requested the C# code for this app, here is the link usb-scope.zip done with Visual Studio 2005
UPDATE: broken links to source files have been fixed.

Thanks for reading.

61 commentaires:

  1. really good idea!
    Tnx to share your project (and congrats to be on the hack a day blog!)

  2. I saw your project on Hackaday. Awesome!
    How many samples per second are you able to get out of the ATTiny ADC?

  3. Bonne idée!
    Les sources du programme .NET C# sont elles disponibles aussi? Ou tout du moins un exemple de récupération des données du gamepad en C#.
    Merci et bonne continuation.

  4. Do not expect more than 100's of sample/S, the bottleneck is in the HID interface.
    I will post the C# code soon on codeproject.com, come back to check for the link.

  5. Here is one ZIP containing all of the files: http://rapidshare.com/files/150844756/usb-scope.zip.html

  6. I can't get this working, despite following the instructions... The problem seems to be with the data lines, if the device is connected to 5V, the LED stays on, but if it is connected to 5V and the data lines, the LED turns on for half a second or so, then goes off. My computer sees nothing... I replaced the pot with a 47ohm resistor, is that bad? That;s the only difference....

  7. Dare I ask for sources for Windows program? I would like to adapt it to Delphi...

  8. magician,
    The led should stay on. The pot act as a divider so you have to replace it by 2 resistors. it depends on how you put your res, but 47 is low and it can draw to much current, try without it.
    If you did not make a pcb, try to have very shorts wire between the USB conn. and the cpu there is 12Mhz around there. Also do not exchange D+ and D-!
    Do not use the divide by 8 fuse for the clock, only PLL internal.
    The device should be in your control panel in game ctrls. and identified as Easylogger.

  9. I made the PCB exactly from your files, would having the 47ohm resistor there cause it to not even be recognized? And can you tell me exactly what to type into AVRDude for the fuses? I copied it from the Makefile, but I don't know if that's right...

  10. Here are a few more things, I'm using the '1N4729A' diode, 3.6V. Here are some pictures:

    There are NO shorts. I've checked everything with a continuity tester...

  11. magician, i did look your picture,as you made a pcb and you say there are no shorts (check near the big cap and the under the usb socket).The problem is not in hardware.i cannot help with avrdude i use avrstudio.
    Double check your CPU, check the flashing, the usb cable, are you with XP ? i did not test for vista.
    Except the first time, ther is no message in windows when you connect and it never request a driver.Try different ports.
    >> if you put NO CPU on the board,
    and you connect, windows should detect something then say "not recognized" if not so there is a problem with the cable or pc usb.
    give your email.

  12. Thanks alot for your help, I replaced the 3.6V diodes with 3.3V and got it working!!

    Have you uploaded the C# code yet? I'd like to take a look at that...

  13. A great idea and implementation. THANK YOU VERY MUCH! I bread-boarded mine last night and got it working this morning. Some info for other building one that may be useful:
    1. I did not have the 3.6V zeners avaialble. I just put two regular diodes in series on the 5V line to drop the supply voltage to the ATTINY45 to 4V. This seems to work OK.
    2. I did not have the USB receptacle either, so just used an old USB cable with one end clipped off. The +5V line was red, the ground line was black (remember to connect shield to black), the D- line was white, the D+ line was green.
    3. The fuse settings for the ATTINY45 were as follows (for AVR STUDIO):
    EESAVE not preserved
    WDTON disabled
    SPIEN enabled
    DWEN enabled
    RSTDISBL enabled
    -> which equals 0xdd
    CKSEL hf pll (0001)
    SUT 1..0 bod enabled fast rise
    CKOUT disabled
    CKDIV8 disabled
    -> which equals 0xe1
    (this was taken from the EasyLogger data files)

    Hope this helps. I am hoping the C source for the PC program will be available soon.

  14. Very cool project.
    Just my 2cents:
    In order to download the program to the avr AND set the fuses appropriately using avrdude use this:
    avrdude.exe -p t45 -c YourProgrammer (mine is the serial programmer ponyser) -P YourPort (for serial programmers it's usually com1 in Windows and /dev/ttyS0 in Linux) -e -U flash:w:main.hex -U lfuse:w:0xf1:m -U hfuse:w:0xdf:m -U efuse:w:0xff:m

  15. Very good work Jacques!

    I have been trying to get .NET to talk to my AVR-USB (now V-USB) project without success.

    Can you provide some references or hints of how you succeeded? My strengths are more in the embedded rather than the Microsoft domain.

    Thank you,


  16. Have you a link to the C# source code?


  17. I can't seem to get it working, i get a message saying the device can't be recognized by windows (XP SP2).
    The pcb looks fine.
    Should I try using 3,3V zeners?

    Could someone please post a screenshot of the fuse settings or some detailed instructions for them?
    I am suspecting I've done something wrong there.

  18. UPDATE: for all who requested the C# code for this app, here is the link usb-scope.zip done with Visual Studio 2005

  19. hi
    how can i save some data in to EEPROM by your C# Application

  20. Hi
    It´s a wonderful project, I want ask you if this project is portable to attiny15?, it is the only 8-pin avr microcontroller i can get where i live.


  21. how to program Atmel Tiny45 ?

  22. Hi,
    It appears someone is selling your scope on eBay!
    The software appears unmodified also. Bill

  23. Really interesting project indeed! The chinese "Xscope" sold on the Internet seems derived from yours, Jacques. The commercial "USBscope50" looks similar too. Still, those 2 versions have improved capacities, as it seems: Xscope would reach up to 2x60 Mhz, and USBscope50 reaches 1x75Mhz. 1/Do you know how they achieved it? 2/is there a faster alternative than the ATtiny45-20? (I can't find any). 3/I guess the ATtiny85-20PU is fully compatible and can be used instead: am I right? Thanks/Merci for sharing! Sinus

  24. how i can increase the maximum input voltage from 5V to 30V? it's possible to use a 2 resistor divider to do that? if is, please tell me the value of the resistor and the schematic of connection

  25. is it possible to use ATMEGA8 instead ? I have bunch of them on my desk


  26. Hallo,
    i have build your project an it runs under XP, now i have windows 7 and it do not work. Please, what can i do now.

  27. what programmer do you recomend to send code to attiny?

  28. Your project is looking very nice. I 'll try to get the same one. Thanks a lot for sharing such a nice project.

  29. Hi magician13134,

    I have the same problem, the yC gets the power from the USB and when I plugged in the USB plug into my notebook, the LED is lighting for about 1 Second, then it goes out. How did you solve this problem? Regards, atc

  30. hi i found your project on Hackaday, its awesome i've just been playing around with attinys, i was wondering what is the value of the trimpot. i've got some 1k's and maybe a few 10k's

  31. what value trim pots do you use?

  32. Hi, I'm having a problem with the project, when I plug the USB the led turns on for one second and then it turns off, I can't find the problem, I'm using the 3.6V zener diode and Windows 7 64bits, I'm also suspecting about the fuse configuration.
    I'm not enabling the RSTDISBL and the DWEN because when I tried to enable them "Studio4" displays two warning messages where it says:

    "Disabling external reset will make the ISP interface inaccessible"

    "Enabling DEBUGWIRE will make the ISP interface inaccessible"

    just in case my e-mail address is (brackets are for avoid spam)

    Thank you in advance for any help you can provide me.

  33. how to make ATmega8 to do it?
    what do i need to change?

    mail me to azzura1024@gmail.com please,..

  34. Hi,
    Is it possible to put the needed files on another server (like 'www.uploadarchief.net' , its free and no banners/'server overload'/...)
    I cant download the hex or the eagle files because it says 'no available server slots', and this is already for a few days so... :(

    If you can/want to send it trough email to me, add a [DOT] before the nummer and add @hotmail.com at the end
    (i don't like spam...)

    It seems like a nice project.

  35. Can you explain the 4 input pins? For what currency is it build?

  36. here a few replies to some questions

    -no for tiny15, not enough memory.

    -It is ok for Atmega8,48,88... but should need a 12MHz or 16Mhz crystal and some minor modification in the code and the makefile, tiny45 has a high speed PLL wich make it run over 12Mhz, and so, the firmware can locks itself to the usb clock.

    -the bottleneck is that all the usb processing is done by software,
    look at the ASM part in the usblib from ObDev, it is amazing.

    -Yes, C# code IS available.

    -the pot can be anything between 470ohm and 470k.

    -if you want a 30v input, divide by 20, Rtop=60k,Rbot=3k.

    -it is true tat this file server is a mess. But somebody has reposted on rapidshare.

    -For me it is ok with W7, but not 64bits.

    -The 4 pins are Vcc,IN1,IN2 and ground.

    Thank you for all your comments

  37. This would be a wonderful device to use with oScope on the iPad.
    ... Do you know if it would adapt?

  38. Hi,
    primarily thank’s to share your project ;-)
    I've many problems with USB interface. Only my notebook (old Acer travelMate 290, WinXP HomEd. SP3) with USB hub recognised your hardware. In the 'game control panel' I found "Easylogger" and your application UsbADC recognise the device. With the same USB hub and cable my 2 PC's (P4 3GHz, WinXP Pro. SP3; AMD Athlon64 2,4 GHz WinXP Pro. SP3) will not recognised it. In the notebook run well only when power cord is connected!
    During run, in the 'game control panel' "Easylogger" disappears and, many time, UsbADC notifies "my device was removed". Sometimes continues to run fine but the USB interface will stop in 5-10 minutes. Many time I must change USB port or restart O.S. What do you think about?
    I've tryed to calibrate it with 1650mV DC but at minimum POT state (Rout=0; 1,2ohm misured), UsbADC show 1633mV, in both channels.
    My USBscope configurations is:
    3,3V Zener; 2x47kPot; lfuse=0xE1, hfuse=0xDD

    Thanks a lot,

  39. Hello,
    I have a question, would you please answer it to my mail? it would be very nice if you do me this favor!
    I want to know that if it is possible to have a scope with sample rate of at least 250 sample/sec ?
    i mean making a scope like what you have made, using V-USB. i just want to know your opinion if it is possible or not.
    Thanks A Lot ;)

  40. hi

    can the pot be removed and connect that input by the same way that the other, like in the image:


    best regards

  41. Hey Jacques,

    the only drawback for your scope is that the software is not cross platform.

    You should write it either in Java or an interpreted language using a toolkit (gtk, qt, etc.) and libusb.

    Great project nonetheless. Thanks alot!

  42. Would be nice of you to include the eagle schematic as well. That would save me some work trying to modify the design.

    Also a few words on the exact working of the hid-interface are appreceated.

    Thaks a lot

  43. -I don't think it is possible to go to 250 samples/s.
    -Yes the pot can be removed.
    -I am sorry for the soft in .Net, but it is the only way i know how to write code to acces a hid device!.
    -For those who have trouble with the hardware, i must say that in some case with some PC USB host chips, it does not work. We have built a lot with my students as school projects and there is a failure rate of about 5%. Using a USB Hub generally solve the problem.

  44. can u add multipler to the software, maybe default multiplier is 1 and we can adjust that so if we use voltage divider the software can show the real voltage. Thx

  45. Thank you very much for such nice sharing!

    But, here is not available ATTINY45-20, except some ATMEGA8, 88..., but also is available ATTINY44-20PU in DIP14 package.

    - Please do you can tell me whether and how I can use that ATTINY44-20PU in this your application, and how to connect him.

    Now I very need such oscilloscope solution like your, but I have not experience with microcontrolers and with programing.

    So, please do you can send me over my e-mail paragatidas@gmail.com or here, at least your basic directions how to make that.

    Best regards!


  46. Could you build one for me? Can I order one from you?
    Reply-to at m.ederveen@btinternet.com

  47. does anyone know if it will work with attiny2313?

  48. Hi,
    thanks a lot for this wonderful project!!!
    i´d like to build it into every wasted mice and hub i can find :)
    I hooked two 1N4007 between VUSB and the circuit -- now it gets recognized and works great. WINXP; USB1.1; no hub (at first i had the "led turns on for a second and turns of" problem; i have 3,6V zeners and i have not removed them after adding the 1n4007 s)

    ps: i used a homemade si-prog programmer to flash the tiny (1 transistor and some passiv if you don´t need the supply ... needs a rs232 and would not work with (many) usb-rs232 adapters

  49. any possibility of getting a macosx host software for this piece of genius?
    anyone familiar with xcode, please?!

  50. Hi
    Really nice.

    I tried to change it to Mega8 but without good results.
    Is posible to give some details on what to change in software ?

    Did somebody did it rum with mega8 ?


  51. Hello!
    Whay is the actual bandwith of this oscilloscope? I can't find it anywhere on the specs...
    Also, hundreds of samples per second isn't a bit low?
    How does it compare to using a soundcard as an oscilloscope? Is this better or worst?
    Thank you!!

  52. I made one yesterday and its working very much fine.
    Actually i need to find the frequency of my output waveform but am unable to find it here.Also the software is in french which i dont know, but am able to use the software upto some extent.
    Please put up an english version of the software along with multiplier as we use a voltage divider.Also make changes to software so that it can read the frequency..
    Thanks for the project.:)

  53. I need to find the frequency of my wave, how can i do it using this one.The oscilloscope is working fine and thanks to you for sharing it with us.

    Please update the windows software by making it to read the frequency of the wave and also add a multiplies as many of them use a voltage divider.:)
    Thanks in adavance

  54. Great prject, I assembly it, but when I conect to the PC, led turns on for one second and then it turns off. I Tried on XP and Windows 7 32bit.

  55. Great prject. I assembly it, but when I conect to the PC, led turns on for one second and then it turns off. I Tried on XP and Windows 7 32bit.

  56. I never hear about this part, it is amazing.

  57. Really you have done great job,There are may person searching about that now they will find enough resources by your post.I like this blog.
    Logo Design Services

  58. https://www.youtube.com/watch?v=_aGmsRJ2tG4

  59. Some links not Working..

    The USB Driver, Firmware Source Code etc... please HELP..

    THANKS for a good project.