Introduction: Adding USB to Circuits With Open Source
Adding USB to control/monitor/interact with circuits from a PC via USB is easy.
Just follow these steps - it uses open hardware (just a single chip - a microcontroller), or alternatively you can use a pre-built StartUSB board from MikroElektronika.
Both methods are outlined, and full source code is available for the microcontroller and the PC app. No USB driver needed, it uses 'USB HID'. For schematics, check out the startUSB documentation if you exactly want to replicate the board.
There is not a lot to it (just the microcontroller, USB connector, crystal and a few other typical bits).
Step 1: Overview
Step 2: Obtain a Board (or a Bare PIC18F2550 Microcontroller + Programmer)
Step 3: Get Software From MikroElektronika Site
Get it from here: http://www.mikroe.com/startusb/pic/
(About half-way down the page)
Step 4: Download and Install Development Software
Step 5: Get Source Code for the Microcontroller
Go to Element14 and download the usbtest source code attached to this blog post.
Step 6: Unzip Source Code and Open It in MPLAB X
Step 7: Only Do This If You're Using a Bare PIC18F2550 Microcontroller
This step is only if you're using a blank PIC microcontroller and a PIC programer. In this case, you're not using a bootloader and so this setting needs to be removed (the setting is needed to be present for the StartUSB board which has a bootloader).
If you're using StartUSB then skip this step.
Step 8: Compile the Source Code
Step 9: Program the Microcontroller (skip This Step If You're Using a StartUSB Board)
Step 10: Drag-and-Drop Programming of StartUSB Board (skip This Step If You're Using a Bare Microcontroller)
Step 11: Download MLA File Which Contains Source and Executable for the PC Application
Step 12: Run the PC Application, See the Control Capability in Action
Step 13: Optionally Modify the Source Code and Recompile to Add More Control Pins
Step 14: Thank You
We have a be nice policy.
Please be positive and constructive.