Multifunction DAQ

cancel
Showing results for 
Search instead for 
Did you mean: 

how do I read a voltage and turn off a relay

First, I am new to DAQexpress

 

My goal is simple:  Plot a discharge curve for a battery with a load across it, then disconnect the load when the voltage drops below a threshold to prevent damaging the battery.

 

I can chart a battery voltage using NI USB 6008.  I can turn the relay on and off with a digital output.  But I can't figure out how to compare the voltage data stream (1D waveform?) to a constant to turn off the relay.  There is a data type mismatch that I don't understand.

 

Should be simple, but I am stumped!

Please help if you can.

 

Thanks,

Matt

0 Kudos
Message 1 of 6
(735 Views)

Not sure how much you can program in DAQ express. Can you show us your code.

0 Kudos
Message 2 of 6
(718 Views)

MHerron_0-1677812008323.png

 

 

not sure how to upload code...  My problems seem to be related to mismatched data types.  Can't compare a 1D waveform from the DAQ to a constant.  not sure how to trigger the DAQ digital out from a boolean comparison

0 Kudos
Message 3 of 6
(701 Views)

You should be able to get the y component of the waveform and index out the last element.

 

(Sorry, I don't have DAQexpress, but it looks similar to NXT.)

0 Kudos
Message 4 of 6
(684 Views)

was not able to figure out how to get the y component and index to the last element. got it sort of working by changing the DAQmx data format from waveform to "floating Point".  but now, after 1000 while loops, I get this error:

MHerron_0-1678749729121.png

 here is what the code looks like:

 

MHerron_1-1678749761611.png

 

0 Kudos
Message 5 of 6
(633 Views)

Can I suggest you bypass all the data aquisition and programming and just use a trip amplifier?

E.G https://www.pepperl-fuchs.com/global/en/32554.htm

or https://uk.rs-online.com/web/p/signal-conditioners/7966913

 

This will mean that your battery protection is independant of your computer & software.

0 Kudos
Message 6 of 6
(573 Views)