DIY
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
firmwarev3.zip,
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.
really good idea!
RépondreSupprimerTnx to share your project (and congrats to be on the hack a day blog!)
I saw your project on Hackaday. Awesome!
RépondreSupprimerHow many samples per second are you able to get out of the ATTiny ADC?
Bonne idée!
RépondreSupprimerLes 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.
Do not expect more than 100's of sample/S, the bottleneck is in the HID interface.
RépondreSupprimerI will post the C# code soon on codeproject.com, come back to check for the link.
Here is one ZIP containing all of the files: http://rapidshare.com/files/150844756/usb-scope.zip.html
RépondreSupprimerI 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....
RépondreSupprimerDare I ask for sources for Windows program? I would like to adapt it to Delphi...
RépondreSupprimermagician,
RépondreSupprimerThe 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.
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...
RépondreSupprimerHere are a few more things, I'm using the '1N4729A' diode, 3.6V. Here are some pictures:
RépondreSupprimerhttp://img377.imageshack.us/my.php?image=1008523bw1.jpg
http://img129.imageshack.us/my.php?image=1008524xc1.jpg
http://img377.imageshack.us/my.php?image=1008525ih4.jpg
http://img377.imageshack.us/my.php?image=1008528ga7.jpg
There are NO shorts. I've checked everything with a continuity tester...
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.
RépondreSupprimerDouble 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.
Thanks alot for your help, I replaced the 3.6V diodes with 3.3V and got it working!!
RépondreSupprimerHave you uploaded the C# code yet? I'd like to take a look at that...
i'd buy one
RépondreSupprimerBravo, very interesting!
RépondreSupprimerA 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:
RépondreSupprimer1. 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):
BODLEVEL 2.7V
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.
Very cool project.
RépondreSupprimerJust 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
Very good work Jacques!
RépondreSupprimerI 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,
Mark
Have you a link to the C# source code?
RépondreSupprimerJohn@TheLongs.us
I can't seem to get it working, i get a message saying the device can't be recognized by windows (XP SP2).
RépondreSupprimerThe 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.
UPDATE: for all who requested the C# code for this app, here is the link usb-scope.zip done with Visual Studio 2005
RépondreSupprimerhi
RépondreSupprimerhow can i save some data in to EEPROM by your C# Application
Hi
RépondreSupprimerIt´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.
Thanks.
how to program Atmel Tiny45 ?
RépondreSupprimerHi,
RépondreSupprimerIt appears someone is selling your scope on eBay!
http://cgi.ebay.com/Xscope-USB-Scopemeter-2-Channel-Digital-Oscilloscope_W0QQitemZ350226688621QQcmdZViewItemQQptZBI_Oscilloscopes?hash=item518b232a6d&_trksid=p3286.c0.m14
The software appears unmodified also. Bill
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
RépondreSupprimerhow 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
RépondreSupprimeris it possible to use ATMEGA8 instead ? I have bunch of them on my desk
RépondreSupprimerDan
Hallo,
RépondreSupprimeri 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.
what programmer do you recomend to send code to attiny?
RépondreSupprimerYour project is looking very nice. I 'll try to get the same one. Thanks a lot for sharing such a nice project.
RépondreSupprimerHi magician13134,
RépondreSupprimerI 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
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
RépondreSupprimerwhat value trim pots do you use?
RépondreSupprimerHi, 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.
RépondreSupprimerI'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.
how to make ATmega8 to do it?
RépondreSupprimerwhat do i need to change?
mail me to azzura1024@gmail.com please,..
Hi,
RépondreSupprimerIs 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.
Can you explain the 4 input pins? For what currency is it build?
RépondreSupprimerhere a few replies to some questions
RépondreSupprimer-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
This would be a wonderful device to use with oScope on the iPad.
RépondreSupprimer... Do you know if it would adapt?
Thanks
MichaelG.
Hi,
RépondreSupprimerprimarily 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,
Roberto
Hello,
RépondreSupprimerI 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 ;)
moji.micheal2003@gmail.com
hi
RépondreSupprimercan the pot be removed and connect that input by the same way that the other, like in the image:
http://img825.imageshack.us/img825/5158/scopeinput.png
best regards
Hey Jacques,
RépondreSupprimerthe 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!
Would be nice of you to include the eagle schematic as well. That would save me some work trying to modify the design.
RépondreSupprimerAlso a few words on the exact working of the hid-interface are appreceated.
Thaks a lot
-I don't think it is possible to go to 250 samples/s.
RépondreSupprimer-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.
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
RépondreSupprimerThank you very much for such nice sharing!
RépondreSupprimerBut, 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!
Peter
Could you build one for me? Can I order one from you?
RépondreSupprimerReply-to at m.ederveen@btinternet.com
does anyone know if it will work with attiny2313?
RépondreSupprimerHi,
RépondreSupprimerthanks 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)
THANKS!!!
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
any possibility of getting a macosx host software for this piece of genius?
RépondreSupprimeranyone familiar with xcode, please?!
Hi
RépondreSupprimerReally 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 ?
Thanks
Hello!
RépondreSupprimerWhay 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!!
I made one yesterday and its working very much fine.
RépondreSupprimerActually 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.:)
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.
RépondreSupprimerPlease 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
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.
RépondreSupprimerGreat 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.
RépondreSupprimerI never hear about this part, it is amazing.
RépondreSupprimerReally 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.
RépondreSupprimerLogo Design Services
https://www.youtube.com/watch?v=_aGmsRJ2tG4
RépondreSupprimerSome links not Working..
RépondreSupprimerThe USB Driver, Firmware Source Code etc... please HELP..
THANKS for a good project.