Home‎ > ‎Articles‎ > ‎USB to Serial Converter Samples‎ > ‎

10 Bit A/D Sample Program

    Here is a sample program using VB.net to read values from a 10 bit A/D converter. I have used the TLC1549 A/D converter from Texas Instruments. It is a low cost A/D converter with a sample rate of 38Khz. Below is the sample schematic.
    Download the VB.Net Source code here.

    Only 3 wires are required to interface from the Universal USB to Serial Converter to the A/D chip. Since the USB to Serial has 9 GPIO per channel, it is possible to directly connect 9 A/D converters to the interface. However, using an 8 to 256 multiplexer, it is conceivable to have 256 different A/D converters on one channel! Since the Universal USB to Serial Converter has 2 channels, a maximum of 512 unique signals can be watched.
    Below is an image of the test circuit and also a screen shot of the captured voltage.

    As you can see from the images above, the measured voltage is almost exactly the same. Note that the accuracy is dependent on the positive reference voltage. This example uses the 3.3v coming from the USB to Serial Converter, which I measured and set in the software code. This is marked near the beginning of the code and should be set to your REF+ voltage. To make this a useful voltmeter, a precision reference would be needed. A 1.024V reference would be ideal and give you a 1mV resolution. Also, a way to limit over voltage by using 2 diodes in series would clamp the input voltage to about 1.4V and a current limiting resistor should be placed in series with the input. This would give you a basic voltmeter but would need further work on the input side in order to control multiple ranges. i.e. 0-1V, 0-10V,0-100V.
    One major drawback of this design is that it can only measure positive voltages, if negative voltages are to be measured, utilizing a Precision Absolute Value Circuit will be needed. As well as a way to determine the polarity.

    Below is a close up of the test circuit.

    You can download the full VB.Net source code below.

Serial AD Example_VB.zip

Copyright © 2011 by 100RandomTasks. All rights reserved.