Jump to content

As of July 17, 2015, the LabJack forums here at forums.labjack.com are shut down. New registrations, topics, and replies are disabled. All forums are in a read-only state for archive purposes.

Please visit our current forums at labjack.com/forums to view and make new posts. To post on the current forums, use your labjack.com login account. Your old LabJack forums login credentials have been retired. There are no longer separate logins for labjack.com and LabJack forums.


Photo

Help !


  • Please log in to reply
37 replies to this topic

#1 Gusss

Gusss
  • Members
  • 35 posts

Posted 23 July 2013 - 02:45 PM

Hello once again. Firstly thanks for your support so far - it has been excellent. So I have bought a u3 and it works perfectly. I am doing something a bit strange - reading tiny electrical signals in plants. I want to read 8 channels simoulteneously and when the signal on any of these channels goes over say, 100 mv I want a sound to be triggered.  I am currently reading 8 channels simoultaneously (analogue SE ins) without a problem using your examples. However I have tried getting labview to communicate with my audio program max MSP - but to no avail - I have had had several labview "experts" try and send each channel over udp or tcp on the same computer into max - but so far nothing. In two weeks I have a sound installation where action potentials (electrical signals in plants) have to trigger sounds . Its such a simple thing - threshold triggers sound - any of you guys have any ideas how I can do this - perhaps not with labview but another program - matlab ? - or getting direct into max.....

any help much appreciated,

Gus



#2 LabJack Support

LabJack Support
  • Admin
  • 8677 posts

Posted 23 July 2013 - 03:33 PM

If you are comfortable with LabVIEW programming, how about just using that for everything.  Have it play the sound.  I see that LV has a few sound VIs built-in, and a long time ago I did something like you describe and would have LV play different wav files when something happened.



#3 Gusss

Gusss
  • Members
  • 35 posts

Posted 24 July 2013 - 03:15 AM

Well Im not massively comfortable with labview - its quite new to me - I think the audio processing I want to do is just a wee bit to complicated for labview (timestretching etc),



#4 Gusss

Gusss
  • Members
  • 35 posts

Posted 24 July 2013 - 03:35 AM

I dont suppose theres any chance of any of you guys writing an "example " for the U3 in MAx msp or Pure data ?



#5 LabJack Support

LabJack Support
  • Admin
  • 8677 posts

Posted 24 July 2013 - 11:41 AM

If you still want to try using LabView and Max/MSP with UDP take a look at these forum topics if you haven't already:

 

http://cycling74.com...e-from-labview/

http://cycling74.com...via-udptcp-etc/

 

It seems like udpreceive will not work but the topics provide an alternative library with UDP support that may.

 

To use a U3 directly in MAX MSP you will need to write an external that accesses the UD driver. You will need the Max/MSP/Jitter SDK for this:

 

http://cycling74.com/downloads/sdk/

 

Take a look at the examples in the examples\advanced\dllexample directory of the SDK download as they demonstrate making externals that access a dll/driver. Note that you will need to program in C++ and the examples look like they require Visual Studios 2010 C++ or newer (express versions will work). On using the U3 and UD driver in C/C++ refer to our examples here:

 

http://labjack.com/s...ud/examples/vc6

 

Let me know if you would like a Max/MSP external example that demonstrates simple U3 usage. It will demonstrate making an external like the examples in the SDK.



#6 Gusss

Gusss
  • Members
  • 35 posts

Posted 25 July 2013 - 05:47 AM

If you still want to try using LabView and Max/MSP with UDP take a look at these forum topics if you haven't already:

 

http://cycling74.com...e-from-labview/

http://cycling74.com...via-udptcp-etc/

 

It seems like udpreceive will not work but the topics provide an alternative library with UDP support that may.

 

To use a U3 directly in MAX MSP you will need to write an external that accesses the UD driver. You will need the Max/MSP/Jitter SDK for this:

 

http://cycling74.com/downloads/sdk/

 

Take a look at the examples in the examples\advanced\dllexample directory of the SDK download as they demonstrate making externals that access a dll/driver. Note that you will need to program in C++ and the examples look like they require Visual Studios 2010 C++ or newer (express versions will work). On using the U3 and UD driver in C/C++ refer to our examples here:

 

http://labjack.com/s...ud/examples/vc6

 

Let me know if you would like a Max/MSP external example that demonstrates simple U3 usage. It will demonstrate making an external like the examples in the SDK.

 

Unfortunately I have only two weeks to get this working - this is not enough time to learn c++

What I will probably do is just send sounds analogue out of labview and analogue into max via a soundcard - not an ideal solution but it will work. Unless fo course one of you wonderful people who already know how to make these thing might like to make the thing work in max - I promise to send all the publicity I can your way and big up labjack in all of the many labs I am currently visiting (;



#7 Gusss

Gusss
  • Members
  • 35 posts

Posted 25 July 2013 - 09:22 AM

by the way - the second one is me - interesting to see someone else is having similar issues there



#8 Gusss

Gusss
  • Members
  • 35 posts

Posted 25 July 2013 - 09:23 AM

Let me know if you would like a Max/MSP external example that demonstrates simple U3 usage. It will demonstrate making an external like the examples in the SDK.

 

 

Yes ! Yes ! Yes ! all I need is to read 8 channels at arounf 500 - 1000 kb/s !!!!!



#9 LabJack Support

LabJack Support
  • Admin
  • 8677 posts

Posted 25 July 2013 - 01:07 PM

Right now I am working on a Max/MSP external example that will use command/response mode to read 8 AINs on a U3. Note that C is required to modify the external, and I assume you can control the looping in Max/MSP (I am new to Max/MSP). Command/response mode is the easiest to implement and speeds are documented here (Note using Max/MSP and the external will likely add some overhead):

 

http://labjack.com/s...users-guide/3.1

 

Anything faster would require stream mode which supports 50000 samples per second, or with 8 channels in one scan 6250 scans/second. Doing this in directly in Max/MSP would be more complicated.

 

You mentions 8 channels at 500 - 1000 kb/s, but am not sure what you mean by the "kb" (kilobyte) in regards to readings.



#10 Gusss

Gusss
  • Members
  • 35 posts

Posted 25 July 2013 - 01:16 PM

Right now I am working on a Max/MSP external example that will use command/response mode to read 8 AINs on a U3. Note that C is required to modify the external, and I assume you can control the looping in Max/MSP (I am new to Max/MSP). Command/response mode is the easiest to implement and speeds are documented here (Note using Max/MSP and the external will likely add some overhead):

 

http://labjack.com/s...users-guide/3.1

 

Anything faster would require stream mode which supports 50000 samples per second, or with 8 channels in one scan 6250 scans/second. Doing this in directly in Max/MSP would be more complicated.

 

You mentions 8 channels at 500 - 1000 kb/s, but am not sure what you mean by the "kb" (kilobyte) in regards to readings.

 

Its an audio term -  equivelant to 1000 ks/s ie it takes a sample of data 1000 times in one second. That would be ideal. Im not sure what you mean by "control the looping" but if you mean how often max asks for data or to repeat a sequence then yes that can be done very easily. If this works I am going to write an ode to labjack (;



#11 Gusss

Gusss
  • Members
  • 35 posts

Posted 25 July 2013 - 02:45 PM

to clarify - what I am doing needs each of the 8 channels to be able to take samples 1000 times a second - thus a total of 8000 kb/s for all eight chennels.

Max repeats a sequence by putting out a "bang" a kind of signal - this bang which signifies a process has finished can also be used to restart the signal - thus the loop. I am not sure how C would need to be implemented from max - hopefully it will not need modifying by me as I do not speak "C"  !



#12 LabJack Support

LabJack Support
  • Admin
  • 8677 posts

Posted 25 July 2013 - 03:18 PM

You will want to check the last link I provided to see if the command/response speeds are acceptable. A group of 8 channels in one call will take about 2.1 ms at the fastest setting and with the proper USB connection (explained in the link). Also, I am not accounting possible Max delays.



#13 LabJack Support

LabJack Support
  • Admin
  • 8677 posts

Posted 25 July 2013 - 08:54 PM

Here's the command/response U3 example for Windows. Refer to the readme in the attachment for details. This is for 32-bit Max/MSP, so let me know if you need a 64-bit version.

Attached Files



#14 Gusss

Gusss
  • Members
  • 35 posts

Posted 26 July 2013 - 04:25 AM

Hail ! An ode is under composition.

Easy indeed when you know how.  A couple of questions - I now have a metro object which triggers your u3 object to read. So if I bang it at say 20 ms intervals it will sample the data on each channel every 20 ms correct ?

 

I have seperated each channel out (using the unpack object) and included this metro/timer object here . Click the little box attached to the metro to start the patch and you can change how fast the procesess runs by changing the number box attached to the metro by clicking and sliding up down (default 20 ms) You can download the patch here :  http://we.tl/66LPWbdTo6

 

Or If you copy the following code into a new blank max patch  it should pop up  :

 

{
    "boxes" : [         {
            "box" :             {
                "maxclass" : "flonum",
                "id" : "obj-23",
                "presentation_rect" : [ 865.0, 577.0, 0.0, 0.0 ],
                "outlettype" : [ "float", "bang" ],
                "fontsize" : 12.0,
                "numinlets" : 1,
                "patching_rect" : [ 1051.0, 586.0, 93.0, 20.0 ],
                "numoutlets" : 2,
                "parameter_enable" : 0,
                "fontname" : "Arial"
            }

        }
,         {
            "box" :             {
                "maxclass" : "flonum",
                "id" : "obj-24",
                "presentation_rect" : [ 815.0, 577.0, 0.0, 0.0 ],
                "outlettype" : [ "float", "bang" ],
                "fontsize" : 12.0,
                "numinlets" : 1,
                "patching_rect" : [ 945.0, 586.0, 93.0, 20.0 ],
                "numoutlets" : 2,
                "parameter_enable" : 0,
                "fontname" : "Arial"
            }

        }
,         {
            "box" :             {
                "maxclass" : "flonum",
                "id" : "obj-25",
                "presentation_rect" : [ 765.0, 577.0, 0.0, 0.0 ],
                "outlettype" : [ "float", "bang" ],
                "fontsize" : 12.0,
                "numinlets" : 1,
                "patching_rect" : [ 850.0, 586.0, 93.0, 20.0 ],
                "numoutlets" : 2,
                "parameter_enable" : 0,
                "fontname" : "Arial"
            }

        }
,         {
            "box" :             {
                "maxclass" : "flonum",
                "id" : "obj-26",
                "presentation_rect" : [ 715.0, 577.0, 0.0, 0.0 ],
                "outlettype" : [ "float", "bang" ],
                "fontsize" : 12.0,
                "numinlets" : 1,
                "patching_rect" : [ 761.0, 586.0, 93.0, 20.0 ],
                "numoutlets" : 2,
                "parameter_enable" : 0,
                "fontname" : "Arial"
            }

        }
,         {
            "box" :             {
                "maxclass" : "flonum",
                "id" : "obj-22",
                "presentation_rect" : [ 659.0, 576.0, 0.0, 0.0 ],
                "outlettype" : [ "float", "bang" ],
                "fontsize" : 12.0,
                "numinlets" : 1,
                "patching_rect" : [ 658.0, 586.0, 93.0, 20.0 ],
                "numoutlets" : 2,
                "parameter_enable" : 0,
                "fontname" : "Arial"
            }

        }
,         {
            "box" :             {
                "maxclass" : "flonum",
                "id" : "obj-21",
                "presentation_rect" : [ 615.0, 581.0, 0.0, 0.0 ],
                "outlettype" : [ "float", "bang" ],
                "fontsize" : 12.0,
                "numinlets" : 1,
                "patching_rect" : [ 564.0, 586.0, 93.0, 20.0 ],
                "numoutlets" : 2,
                "parameter_enable" : 0,
                "fontname" : "Arial"
            }

        }
,         {
            "box" :             {
                "maxclass" : "flonum",
                "id" : "obj-20",
                "presentation_rect" : [ 563.0, 578.0, 0.0, 0.0 ],
                "outlettype" : [ "float", "bang" ],
                "fontsize" : 12.0,
                "numinlets" : 1,
                "patching_rect" : [ 466.0, 586.0, 93.0, 20.0 ],
                "numoutlets" : 2,
                "parameter_enable" : 0,
                "fontname" : "Arial"
            }

        }
,         {
            "box" :             {
                "maxclass" : "flonum",
                "id" : "obj-19",
                "outlettype" : [ "float", "bang" ],
                "fontsize" : 12.0,
                "numinlets" : 1,
                "patching_rect" : [ 351.0, 586.0, 93.0, 20.0 ],
                "numoutlets" : 2,
                "parameter_enable" : 0,
                "fontname" : "Arial"
            }

        }
,         {
            "box" :             {
                "maxclass" : "newobj",
                "text" : "unpack 0. 1. 2. 3. 4. 5. 6. 7.",
                "id" : "obj-5",
                "outlettype" : [ "float", "float", "float", "float", "float", "float", "float", "float" ],
                "fontsize" : 13.0,
                "numinlets" : 1,
                "patching_rect" : [ 576.0, 480.0, 168.0, 21.0 ],
                "numoutlets" : 8,
                "fontname" : "Arial"
            }

        }
,         {
            "box" :             {
                "maxclass" : "flonum",
                "id" : "obj-8",
                "outlettype" : [ "float", "bang" ],
                "fontsize" : 12.0,
                "numinlets" : 1,
                "patching_rect" : [ 456.0, 70.0, 50.0, 20.0 ],
                "numoutlets" : 2,
                "parameter_enable" : 0,
                "fontname" : "Arial"
            }

        }
,         {
            "box" :             {
                "maxclass" : "toggle",
                "id" : "obj-6",
                "outlettype" : [ "int" ],
                "numinlets" : 1,
                "patching_rect" : [ 319.0, 70.0, 20.0, 20.0 ],
                "numoutlets" : 1,
                "parameter_enable" : 0
            }

        }
,         {
            "box" :             {
                "maxclass" : "newobj",
                "text" : "metro",
                "id" : "obj-3",
                "outlettype" : [ "bang" ],
                "fontsize" : 12.0,
                "numinlets" : 2,
                "patching_rect" : [ 360.0, 93.0, 41.0, 20.0 ],
                "numoutlets" : 1,
                "fontname" : "Arial"
            }

        }
,         {
            "box" :             {
                "maxclass" : "button",
                "id" : "obj-16",
                "outlettype" : [ "bang" ],
                "numinlets" : 1,
                "patching_rect" : [ 304.0, 170.0, 20.0, 20.0 ],
                "numoutlets" : 1
            }

        }
,         {
            "box" :             {
                "maxclass" : "newobj",
                "text" : "-",
                "id" : "obj-15",
                "outlettype" : [ "int" ],
                "fontsize" : 12.0,
                "numinlets" : 2,
                "patching_rect" : [ 360.0, 257.0, 32.5, 20.0 ],
                "numoutlets" : 1,
                "fontname" : "Arial"
            }

        }
,         {
            "box" :             {
                "maxclass" : "number",
                "id" : "obj-14",
                "outlettype" : [ "int", "bang" ],
                "fontsize" : 12.0,
                "numinlets" : 1,
                "patching_rect" : [ 360.0, 299.0, 93.0, 20.0 ],
                "numoutlets" : 2,
                "parameter_enable" : 0,
                "fontname" : "Arial"
            }

        }
,         {
            "box" :             {
                "maxclass" : "newobj",
                "text" : "cpuclock",
                "id" : "obj-12",
                "outlettype" : [ "float" ],
                "fontsize" : 12.0,
                "numinlets" : 1,
                "patching_rect" : [ 304.0, 211.0, 57.0, 20.0 ],
                "numoutlets" : 1,
                "fontname" : "Arial"
            }

        }
,         {
            "box" :             {
                "maxclass" : "newobj",
                "text" : "cpuclock",
                "id" : "obj-10",
                "outlettype" : [ "float" ],
                "fontsize" : 12.0,
                "numinlets" : 1,
                "patching_rect" : [ 442.5, 128.0, 57.0, 20.0 ],
                "numoutlets" : 1,
                "fontname" : "Arial"
            }

        }
,         {
            "box" :             {
                "maxclass" : "button",
                "id" : "obj-2",
                "outlettype" : [ "bang" ],
                "numinlets" : 1,
                "patching_rect" : [ 155.0, 113.0, 20.0, 20.0 ],
                "numoutlets" : 1
            }

        }
,         {
            "box" :             {
                "maxclass" : "newobj",
                "text" : "u3ReadAINs 8",
                "id" : "obj-1",
                "outlettype" : [ "" ],
                "fontsize" : 12.0,
                "numinlets" : 1,
                "patching_rect" : [ 120.5, 152.0, 89.0, 20.0 ],
                "numoutlets" : 1,
                "fontname" : "Arial"
            }

        }
 ],
    "lines" : [         {
            "patchline" :             {
                "source" : [ "obj-1", 0 ],
                "destination" : [ "obj-5", 0 ],
                "hidden" : 0,
                "disabled" : 0
            }

        }
,         {
            "patchline" :             {
                "source" : [ "obj-2", 0 ],
                "destination" : [ "obj-1", 0 ],
                "hidden" : 0,
                "disabled" : 0
            }

        }
,         {
            "patchline" :             {
                "source" : [ "obj-1", 0 ],
                "destination" : [ "obj-16", 0 ],
                "hidden" : 0,
                "disabled" : 0
            }

        }
,         {
            "patchline" :             {
                "source" : [ "obj-5", 7 ],
                "destination" : [ "obj-23", 0 ],
                "hidden" : 0,
                "disabled" : 0
            }

        }
,         {
            "patchline" :             {
                "source" : [ "obj-5", 6 ],
                "destination" : [ "obj-24", 0 ],
                "hidden" : 0,
                "disabled" : 0
            }

        }
,         {
            "patchline" :             {
                "source" : [ "obj-5", 5 ],
                "destination" : [ "obj-25", 0 ],
                "hidden" : 0,
                "disabled" : 0
            }

        }
,         {
            "patchline" :             {
                "source" : [ "obj-5", 4 ],
                "destination" : [ "obj-26", 0 ],
                "hidden" : 0,
                "disabled" : 0
            }

        }
,         {
            "patchline" :             {
                "source" : [ "obj-5", 3 ],
                "destination" : [ "obj-22", 0 ],
                "hidden" : 0,
                "disabled" : 0
            }

        }
,         {
            "patchline" :             {
                "source" : [ "obj-5", 2 ],
                "destination" : [ "obj-21", 0 ],
                "hidden" : 0,
                "disabled" : 0
            }

        }
,         {
            "patchline" :             {
                "source" : [ "obj-5", 1 ],
                "destination" : [ "obj-20", 0 ],
                "hidden" : 0,
                "disabled" : 0
            }

        }
,         {
            "patchline" :             {
                "source" : [ "obj-5", 0 ],
                "destination" : [ "obj-19", 0 ],
                "hidden" : 0,
                "disabled" : 0
            }

        }
,         {
            "patchline" :             {
                "source" : [ "obj-3", 0 ],
                "destination" : [ "obj-2", 0 ],
                "hidden" : 0,
                "disabled" : 0
            }

        }
,         {
            "patchline" :             {
                "source" : [ "obj-8", 0 ],
                "destination" : [ "obj-3", 1 ],
                "hidden" : 0,
                "disabled" : 0
            }

        }
,         {
            "patchline" :             {
                "source" : [ "obj-6", 0 ],
                "destination" : [ "obj-3", 0 ],
                "hidden" : 0,
                "disabled" : 0
            }

        }
,         {
            "patchline" :             {
                "source" : [ "obj-2", 0 ],
                "destination" : [ "obj-10", 0 ],
                "hidden" : 0,
                "disabled" : 0
            }

        }
,         {
            "patchline" :             {
                "source" : [ "obj-16", 0 ],
                "destination" : [ "obj-12", 0 ],
                "hidden" : 0,
                "disabled" : 0
            }

        }
,         {
            "patchline" :             {
                "source" : [ "obj-15", 0 ],
                "destination" : [ "obj-14", 0 ],
                "hidden" : 0,
                "disabled" : 0
            }

        }
,         {
            "patchline" :             {
                "source" : [ "obj-12", 0 ],
                "destination" : [ "obj-15", 0 ],
                "hidden" : 0,
                "disabled" : 0
            }

        }
,         {
            "patchline" :             {
                "source" : [ "obj-10", 0 ],
                "destination" : [ "obj-15", 1 ],
                "hidden" : 0,
                "disabled" : 0
            }

        }
 ],
    "appversion" :     {
        "major" : 6,
        "minor" : 1,
        "revision" : 2,
        "architecture" : "x86"
    }

}
 



#15 LabJack Support

LabJack Support
  • Admin
  • 8677 posts

Posted 26 July 2013 - 11:31 AM

Yes, if you bang u3ReadAINs at 20 ms intervals you will get your channel readings every 20 ms. Note that the cpuclock part of our example times the u3ReadAINs call, and intervals should be slower than that time. 20 ms intervals will be no problem though with 8 channels reads. 



#16 Gusss

Gusss
  • Members
  • 35 posts

Posted 26 July 2013 - 02:48 PM

Yes, if you bang u3ReadAINs at 20 ms intervals you will get your channel readings every 20 ms. Note that the cpuclock part of our example times the u3ReadAINs call, and intervals should be slower than that time. 20 ms intervals will be no problem though with 8 channels reads. 

 

Ok , so basically you and the whole labjack crew are awesome. I WILL be writing you that ode and sending as much good publicity your way as I can - thankyou very much for your help.

Ironically I had just got lbview more or lessworking with max but it was a clunky solution - this is much better - thanks again !



#17 Gusss

Gusss
  • Members
  • 35 posts

Posted 02 August 2013 - 02:26 PM

Juuuussstt one more thing.... I need to add a filter to the signal to filter out unwanted mains noise interference etc - could I do do that in max ? Or does that need to be built into the external - it would need a high or low pass filter with changeable threshold......



#18 LabJack Support

LabJack Support
  • Admin
  • 8677 posts

Posted 02 August 2013 - 03:39 PM

The external we posted can be used to get the raw data (voltage) signal, and you can do the signal processing in Max. You can do it in the external too, but Max would be easiest since you are familiar with it and it provides signal processing filters such as lores or a simple maximum/minimum on a value . Here's a post and video on their website about using lores for a high and low pass filter:

 

http://cycling74.com...1/04/12/week-5/

 

Take a look at Max's MSP filters to see if any other filers will work for you. If you have a Max functionality question you will want to ask the Max/Cycling '74 forum.



#19 Gusss

Gusss
  • Members
  • 35 posts

Posted 02 August 2013 - 05:22 PM

Thanks again - if I know what I need to do I can program pretty much anything in max. However these filters (and in fact all the filters I know about in Max) are for audio - if there is a ~ symbol in an object it will only process audio signals.

I understand the principle of an audio signal being samples say, 22,000 times a second and in each sample various different frequencies are present (in the fft window) . I dont quite understand how this principle is applied to voltages but I assume like an audio signal different frequencies if electricity are present.

So in this case I am sampling say, 200 times a second (or 200hz you could say) or once every 5 ms - every time I sample this data I assume I am sampling voltages of different frequencies and this is represented by a number - a single number is present every time a sample is taken (correct ?) - what is the equation or process numerically of filtering this data stream - what exactly do I need to do in max ?

As I say I can do the programing as long as I know what needs to be down to the data.



#20 LabJack Support

LabJack Support
  • Admin
  • 8677 posts

Posted 05 August 2013 - 09:25 AM

I am afraid we don't have any expertise with audio, so I think you will need to try the forums at cycling74.com for further help.

 

Your description of signal and sample rate sounds generally correct.  A signal can be made up of a bunch of different frequencies that are all combined into one signal.  Go about 1/4 of the way down the following page and see figures showing how the waveform changes as multiple frequencies are combined.  In this case, it is showing that a square wave is made by combining harmonics of the proper magnitude:

 

http://www.ibiblio.o...ts/AC/AC_7.html

 

Whether you sample at 200Hz or 20kHz, each sample will simple return the voltage of the combined signal at the time the sample was acquired.  One detail is that some sort of averaging can occur depending on the sampling time.  For example, command/response samples on the U3 with the default settings take about 500us each, so each sample is likely to be the average over a 500us window.

 

Your 200Hz sample rate is probably close to the limit of what you can do in command/response mode, if that is what you are using.  If you switch to stream mode you can scan 1 channel at up to 50 kscans/second:

 

http://labjack.com/s...3/users-guide/3

 

http://labjack.com/s...users-guide/3.2



#21 Gusss

Gusss
  • Members
  • 35 posts

Posted 21 May 2014 - 08:18 PM

Hello once more. Getting on reasonably well with the u3 but another question. I need to be able to read negative voltages as well. When I go on the "test" page of the LJcontrol panel if I select AIN for AIN0 , AIN1 etc and then under "negative channel" I select AIN0, AIN1 etc it gives me a negative voltage (sometimes) but the nubers coming out of the "u3ReadAINs" external you made for me are always positive - how do I make it so I can get the negative voltages out of the "u3ReadAINs" as well ?

Also to masure the tiny voltages in plants it is necessary to have an op amp with very high input impedance before te Dac - otherwise the current will follow the path of least resistance into the measuring equipment - so I have an op amp with an input impedance of ten gigaohms (ie electrode > opamp > u3) I notice that on te appendix for the labjack U3 it says that the maximum input impedance is 40 MΩ and max source impedance is 200 kΩ does this mean my op amp cannot be used with the U3 ?



#22 LabJack Support

LabJack Support
  • Admin
  • 8677 posts

Posted 22 May 2014 - 12:24 PM

You will need to modify and rebuild u3ReadAINs for differential readings as it is currently performing single ended readings.

 

So in the external_src\u3ReadAINs.cpp source code change the:

    lngErrorcode = AddRequest (lngHandle, LJ_ioGET_AIN, j, 0, 0, 0);

AIN calls to:

    lngErrorcode = AddRequest (lngHandle, LJ_ioGET_AIN_DIFF, j, 0, negativeChannel, 0);

where j is the positive channel and negativeChannel is the negative channel you want. Then rebuild u3ReadAINs.mxe. For analog input pseudocode using the UD driver, look here:

 

http://labjack.com/s...ers-guide/4.3.3

 

We'll followup with a response to your other question soon.



#23 LabJack Support

LabJack Support
  • Admin
  • 8677 posts

Posted 22 May 2014 - 12:37 PM

Also, change:

        if(lngIOType == LJ_ioGET_AIN)
            ValueAIN[lngChannel]=dblValue;

to:

        if(lngIOType == LJ_ioGET_AIN_DIFF)
            ValueAIN[lngChannel]=dblValue;

in the source code to detect the differential AIN reading result.



#24 LabJack Support

LabJack Support
  • Admin
  • 8677 posts

Posted 22 May 2014 - 01:42 PM

Do you have a U3-HV or U3-LV?  On the HV, normal single-ended readings of AIN0-AIN3 work from -10 to +10 volts.  On the LV, all analog inputs are low voltage analog inputs.  Low voltage analog inputs cannot go more negative than -0.3 volts, and to read such a voltage you do need to use a differential input.

 

The input impedance of your op-amp has nothing to do with the U3.  The output of the op-amp connects to the U3, so the question is whether the output impedance of your op-amp exceeds the 200k spec, and you can safely assume it does not as op-amps typically have a output impedance of less than 1 ohm.  So your op-amp should be fine.



#25 Gusss

Gusss
  • Members
  • 35 posts

Posted 22 May 2014 - 07:52 PM

what program do I need to rebuild tis - where can I get the source code ?




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users