Friday, February 12, 2010

Homemade USB interface board using a PIC

Hello folks,

Here's what I've been working on for the last couple of weeks:





This is a USB interface board I've built around a PIC 18f4550 microcontroller from Microchip. As many of you probably know, I've used my computer's parallel port to connect many things to my computer. However, most laptops don't have parallel ports these days, so I needed a way to connect things without a parallel port. This board does exactly that (and actually much, much more). I found a really nice tutorial on building this board here - http://eegeek.net/content/view/13/32/






You can make your C#, VB, C++ programs communicate with the chip using the open-source MCHPFSUSB Framework from Microchip, or the Window's HID drivers. The framework comes with lots of samples to get you started.


I've put a bootloader on the chip for the sake of convenience. With a bootloader, you don't have to take the chip off the board and put it in a separate programmer for programming. I have to sometimes re-program the chip every 10-15 minutes during development (especially when there's a hard to find bug), and the bootloader really makes it easy.

No project is compete until you record a video! So here's one:




Please excuse the background noise in the video. There was some construction work going on while I was recording this. Anyway, I'm using the board to control some LEDs, a servo, and reading the value of a potentiometer. Controlling the servo was the trickiest part because servo's are sensitive to timing. They expect to receive a pulse every 20 ms, and the duration of the pulse determines how much they will turn. The length of the pulse usually varies between 1-2 ms. Setting up the timers on the chip to work properly was a bit challenging, but I finally got it working. This sound card based oscilloscope really helped! - http://www.zeitnitz.de/Christian/scope_en.

Hope you enjoyed this post. I will be using this board in future projects. Keep checking!

28 comments:

  1. probably one of your best projects .... other than the laser mouse

    ReplyDelete
  2. ashish strikes again :-)

    ReplyDelete
  3. Nice work:) What are you studying/studied?

    ReplyDelete
  4. Hi dude which software did u use to control potentiometer from ur PC?

    ReplyDelete
  5. Hey its a great invention keep it up. All the time you are coming up with great discoveries. Keep updating with more new technologies.

    ReplyDelete
  6. hi
    i really liked your project...
    can you please send me the compiled project?

    Obstacle detector using webcam and laser pointer http://ashishrd.blogspot.com/2006/11/obstacle-detector-using-webcam-and.html

    ReplyDelete
  7. well done !! i was wondering if this was possible. looks like i have to start reading about chips again!!

    ReplyDelete
  8. we are having project on data aqusition syatem using usb port n we r intrsted to use PIC18F4550 microcontroller to fed digital inputs to usb port...

    so, plz inform us the cost of microcontroller

    refer :-
    bansal.arpit23gmail.com
    bansal.arpit23rediffmail.com

    ReplyDelete
  9. hope some new addition is there soon

    ReplyDelete
  10. I dint quite the grasp the full potential of this project...so plz can u walk me thru it?
    i hav a few questions...
    1. does this pic PCB act like a parallel port?
    2. ive also tried ur stepper motor project using d actual parallel port on WinXp on my PC..nw my question here is...whether i can interface the stepper motor with my laptop using this project? i mean can i interface a 5/6 wire stepper motor to my laptop and control it lik i cud on my PC?
    3. Any furthur application which might help m understand d true potential of this project will be appreciated.

    Thankin in anticipation!
    P.S : i am a comp student so i am a tyro wen it comes to electrical components and their properties!

    ReplyDelete
  11. very simply explained. It is indeed an art to read & stop new visitors with your attractive writing style. I am really impress from your posted information. Thanks for sharing.

    ReplyDelete
  12. yes...this post has been quite impressive so far

    ReplyDelete
  13. help


    please provide some more detials abut the pcb.

    is it possible to provide a more detail.circuit diagram.

    i want to know how many more motors can be controlled and how, to be precise..which pins?

    ReplyDelete
  14. Which pins are used for input and output from PIC ?

    ReplyDelete
  15. thats the spirit for new inventions, "USB is much more important then rockets"


    - John Devis
    Magento Themes

    ReplyDelete
  16. I have been visiting various blogs for my research work. I have found your blog to be quite useful. Keep updating your blog with valuable information... Regards

    ReplyDelete
  17. im following your blog..

    where u get ur refence?

    ReplyDelete
  18. is the boot loader with usb works as a parallel port or it act as parallel port?

    ReplyDelete
  19. REALLY GOOD.THIS IS REALLY A NICE PROJECT WORK USING PIC . I AM MAKING A SIMILAR PROJECT USING A FLOPPY DRIVE (HYBRID)STEPPER MOTOR, AND SOME SERVOS. THE CONTROL IS GOOD. HERE IS SOMETHING I AM WORKING ON.
    TAKE CARE

    http://www.electro-tech-online.com/attachments/avr/26672d1235812340-circuit-control-step-motor-using-avr-controller-stepper_motor_control_paper.pdf

    ReplyDelete
  20. Great work. Saw this link on your blog http://eegeek.net/content/view/13/32/
    There is slightly different with yours.Lack of component SV1,IC1 and MA02-1.what is the use of the component anyway?

    ReplyDelete
  21. how much did all your components cost for the board? can you give hints on how to write programs to interact with different devices on the board, such as motors, servos, etc and how to get readings from instruments?

    ReplyDelete
  22. I see that you are not very eager to publish the actual programming involved in your projects; is it secret, or you just thing it wouldn't be appreciated? ;)

    ReplyDelete
  23. Wow, a great effort for sure, really enjoyed watching the as how an interface for a USB board can be made.....

    Maggeentoi

    ReplyDelete
  24. hi man! may you can help me :) i'm starting to learn the pic18f4550 and the usb, i can use it as a normal pic, sice 3 month i try to connect this pic to my laptop by usb... but i fail everytime! i made your schematic and loaded the microchip's bootloader picdemfsusb.hex... when i load the hex on the pic, i plug the circuit in the usb, so i press the boot button between the reset button but NOTHING happens! the pc should show a popup that says that a new device were found... but it don't happen :( do you know where i fall?

    ReplyDelete
  25. There is slightly different with yours.Lack of component SV1,IC1 and MA02-1 from the eagle document.what is the use of the component anyway?

    ReplyDelete
  26. Rodrigo Ortega3/29/2011 5:15 PM

    hey dude, love your work, i´m trying to do something similar, would you mind giving me a hint on the potenciometer readint?? r.ortegadominguez@gmail.com

    tks.

    ReplyDelete
  27. i viewed your pan tilt controller on you tube. how much it costs,the total cost of pan tilt controller. instead of mouse can we have joystick ?

    ReplyDelete
  28. how can i contact you?? i wanna ask you about something if you don't mind, by the way i watched your project on youtube and i admired your way of thinking ;).
    please contact me as soon as possible.
    or reply this comment.

    ReplyDelete