Technical Tips


Using PIC18F2550 for connecting analogue and digital signals to USB port . Included Visual Basic 6 code, VS2005 C++ and C# codes are based on Microchip code, PIC ASM code, PIC C code and a circuit diagram. The PIC microcontroller has 10 bit analogue to digital converter. The circuit is powered by the USB. The interface to the PC is HID class.
The inputs and outputs are updated every 10ms.
HID class (human interface device) is a class of devices like the mouse and the keyboard, the data transfer rate is limited to 64KB/S. The PC already has a driver for HID USB.
VB6 code includes guidance to setting up the PC. The PC register the PID and VID (product 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: ,
You are free to use the circuit diagram and the VB software with no limitations.


Using PC to connect to Arduino Uno. Included Visual Basic 6 code and arduino code. The VB6 may need an ActiveX file downloaded from Microsoft.
The VB app connects to the Arduino via the COM PORT that the USB drive created and connects the Arduino IDE, when the VB app is running you cannot program the Arduino. You need to enter to the VB app the port number in the way it is done with the IDE.
The app displays 4 analogue inputs A0-A3, 6 digital inputs D2-D7 and 6 digital outputs D8-D13
You are free to use the Arduino code and the VB software with no limitations.

PC application

Circuit Description
See also Technical Tips

Pins 2-5 are the analogue inputs, voltage range 0 to 5V. Max input voltage is 5.5V . 1K resistors are to protect the PIC.
Pins 25-28 are the digital inputs, TTL voltage levels.
Pins 21-24 are the digital outputs, they can sink or source 16mA.
Pin 14 is 3.3V internal supply for the USB transceiver. 0.22uF is required for regulation.
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: