Parallel to USB

Hi All, Just discovered the Arduino! I have an electronics project that I currently drive through the PC's parallel port using software written in VB6. It is a general purpose interface circuit with 11 x 12-bit ADC inputs and 8 x 8-bit DAC outputs. I would like to convert the project to USB for greater flexibility and to also enhance my circuit to include digital input and output functionality. What I was hoping for was to use the Arduino as the USB connection between my software and circuit. At the very least I need to be able to perform writes/reads, to/from my software and the ADC/DAC chips in a time frame of no more than 0.01 seconds. My questions are:

1) Is it possible to communicate data to/from the Arduino to perform this task using nothing but native VB? 2) Will the USB connection to the Arduino support the transfer rates?


Using VB is not a problem. Arduinos USB port i really a serial port in dusguise, so from your VB app you just use the right COM port.

There is a FTDI (USB to serial) Ic on the Arduino board, and you onstall a driver for that that presents itself as a virtual serial port to your VB app.

As for the bandwith quiestion, i guess you have to do the math.

How many bytes how often ?

Arduino supports up to 115.000 Baud on the serial connection. And i actually think that some people have made it talk even faster.

The next question is of course if Arduino can read / write the ADC / DAC s in the required time, but i think that should be possible.

So, the Arduino has the ability to use the USB connection as a general data communication line between itself and the host PC using built-in function calls and not just for uploading programs? Ok, step 1 the most critical issue sorted…! ;D Now, the DAC requires a 12-bit instruction to write a single output and the ADC produces a 12-bit result from a single input. As far as I can see, the easiest read/write cycle from a VB program standpoint and to minimise communication overheads, would be to write all the DAC outputs and read all ADC inputs in one hit using a single VB function call. The DAC will require 12x8=96bits to be sent and ADC will require 11x12 = 132bits to be returned So, 132+96=228bits(29bytes of data=232bits). So, in theory, 115,000/232=496 VB function calls per second. But of course there are overheads: communications setup time both ways and the time it will take the Arduino to write all DAC outputs and read all ADC inputs over SPI interfaces. On the blind assumption that the overheads can be completed in at most, the same time it takes to actually transmit the data then we are looking at around 240 VB function calls per second. At most I would like to be able to sample a single ADC input at no more than 100 times per second. So in theory this should be possible. What do you think?


The DAC will require 12x8=96bits to be sent and ADC will require 11x12 = 132bits to be returned

No you are confusing bits and bytes, for a 12 bit value you only need two bytes.

Gives you a lot more time doesn't it. ;)

My apologies, I should have been consistant/clearer in my specs: DAC=8x12 bits ( 8 for the number of outputs x 12bit instruction length per output) = 96bits to be sent. The ADC=11x12 bits ( 11 for the number of inputs x 12bit data from each input) = 132bits to be received. So, the length of data transfer stands at 228bits, rounding up =29 bytes.. ;) Just been looking at the USB/serial functionality of the Arduino, and yes, 115,000 baud, info transmitted bytewise with simple read() and print() functions. The VB end will have to do the same with the virtual COM port. Should be a goer..! ;D Also, I am amazed at the add-ons and useful parts you can get for the Arduino not least of which are the Protoshield kits that will allow you to add on a simple circuit such as the DAC/ADC chips I am using to effectively extend the Arduino's functionality in a very neat and tidy package! Exciting times..! ;D