Taking reading from ADC-11 USB with VB.net

Post your .Net discussions here
Post Reply
Posts: 1
Joined: Thu Jan 10, 2008 12:39 pm

Taking reading from ADC-11 USB with VB.net

Post by geraldh » Thu Jan 10, 2008 2:21 pm

I am trying to read AC voltage levels from three channles of the ADC-11 with some current clamps in order to monitor a 3 phase electrical supply.

1mV of AC voltage equates to 1Amp of current usage on the probe.

I am using the blow code and it always read 0

Code: Select all

Sub take_reading()
        Dim handle As Integer
        Dim opened As String
        'Dim S As String * 255
        handle = UsbAdc11OpenUnit()

        opened = handle <> 0

        If opened = True Then

            Dim reading As Double
            UsbAdc11GetValue(handle, 1, reading)
            main_form.CurrentPhase1Reading = adc_to_mv(reading)
            'MessageBox.Show("Took a reading on channel 1 and got" & reading)
            UsbAdc11GetValue(handle, 2, reading)
            main_form.CurrentPhase2Reading = adc_to_mv(reading)
            UsbAdc11GetValue(handle, 3, reading)
            main_form.CurrentPhase3Reading = adc_to_mv(reading)


            main_form.numreadings = main_form.numreadings + 1
            MessageBox.Show("Can't open the Data Logger Device")
        End If
    End Sub

any ideas or pointers as to why I am only getting 0 would be much apprecieted.



Advanced User
Advanced User
Posts: 1705
Joined: Fri Dec 01, 2006 10:03 am
Location: St Neots

Post by ziko » Wed Jan 23, 2008 11:04 am

Hi Gerald,

I am not a programming expert however what I can say is that the ADC11 is not suitable for use with a current clamp which has a negative output as the ADC11 only measures 0-2.5V.

Kind regards

Technical Specialist

Advanced User
Advanced User
Posts: 109
Joined: Thu Sep 28, 2006 3:50 pm

Post by gruntman » Fri Jan 25, 2008 5:11 pm


With the code that you attached you are opening the unit and then immediately calling for the values. You need to setup the unit first and make it run before calling for values.

The normal calling sequence to collect a block of data is as follows:
1 Check that the driver version is correct (optional)
2 Open the unit
3 Set trigger mode (optional)
4 Set sampling mode (channels and time per sample)
6.Wait until ready
7.Get values
8.Close the unit

As you can see you are skipping steps 3-6. You will need to add these functions in in order to have your program function. I would recommend looking at the macros in the usbadc11.xls example as this will be close to what you are needing.


Richard Boyd
Technical Specialist

Post Reply