Jump to content
  • 0

CANNOT COMMUNICATE USING MCCDAQ


deltauser

Question

Hello, i am trying to develop an application in C# that fetchs the data from a distance sensor SICK DT50-P1123 200mm to 10m 4-20mA distance sensor and a temperature sensor LM35DZ analog temperature sensor. I inherited a proyect which had already a DAQami configuration made for such matters, however i cannot seem to figure out how to do the same from c# (that is picking up the values).

The board connection is USB-231 i have tried VIN, AIN, daqInScan and basically every option that the documentation says but so far everything is either zeros, a 32xxxxx number which idk where it comes from and what i suspect is a voltage value for the next reason:

As i continued my research in this API it appears that the board configuration it loads for the board is the same as the one created by Instacal programm. I don't understand the relation between this two programs, moreover how could it be possible then for DAQami to work correctly then if the device number that appears in both programs (the same device then) is the same USB-231 board?

I am deeply confused and i cannot seem to figure out how to pick up the data. I attached the configuration file of the DAQami to this topic too. The board has other stuff connected to it too, but i mainly want to know the temperature and the distance sensor value.

 

Thanks in advance

DAQAMI_CONFIG.amicfg

Link to comment
Share on other sites

7 answers to this question

Recommended Posts

  • 0

I've attached a C# example program, a 32-bit Console Application. To run the code, you must create a Console Application and copy the code over the default CS file. Enable the MccDaq support by right-clicking References under the project and selecting Add Reference. On the dialog that appears, select Extensions and add MccDaq. Build and Run. The example reads channels 0 - 3 and returns voltage. For more information about the interface, see the UL Help file. There should be a shortcut to it under the Measurement Computing programs folder if you had used the MCC DAQ CD to install InstaCal. 

  image.png

USB-231.cs

Link to comment
Share on other sites

  • 0
18 hours ago, JRys said:

I've attached a C# example program, a 32-bit Console Application. To run the code, you must create a Console Application and copy the code over the default CS file. Enable the MccDaq support by right-clicking References under the project and selecting Add Reference. On the dialog that appears, select Extensions and add MccDaq. Build and Run. The example reads channels 0 - 3 and returns voltage. For more information about the interface, see the UL Help file. There should be a shortcut to it under the Measurement Computing programs folder if you had used the MCC DAQ CD to install InstaCal. 

  image.png

USB-231.cs 8.14 kB · 0 downloads

The programm works thank you, however is not prompting the expected results, idk what is it  reading to be honest, i think it might be the voltage but i want the temperature value and the distance and by the results of this programm it says there is only 4 channels?. Could it be that i have to change the configuration of the Instacall.cfg file ? if so is there a manual or something? in the end i want to be able to extract the same information as the image i attach to this answer (in red the info i really need, the config file for daqami is on the original question of this thread).

imagen.thumb.png.cfe9d947a14b11f0a56aaec900ac5357.png

Link to comment
Share on other sites

  • 0

It is up to you to modify the program to convert the voltage readings to something more meaningful, like temperature or distance. For example, a sensor rated at 100 with a 4-20mA (1 to 5 volt) output can be scaled by multiplying the voltage by 25 and subtracting 25, assuming you're using a 250 ohm shunt resistor.

 

Link to comment
Share on other sites

  • 0
14 hours ago, JRys said:

It is up to you to modify the program to convert the voltage readings to something more meaningful, like temperature or distance. For example, a sensor rated at 100 with a 4-20mA (1 to 5 volt) output can be scaled by multiplying the voltage by 25 and subtracting 25, assuming you're using a 250 ohm shunt resistor.

 

 

Maybe this exceeds the topics of this forum but Could you explain where do you get that correlation? i am an IT engineer, 0 idea about voltage, amps or anything of the like.

They dead drop this project to me and i have no clue on such matters.

 

Thank you in advance.

Link to comment
Share on other sites

  • 0

You are going to be successful if you know what your sensors output. The USB231 measures voltage. Your sensors may output voltage or current. You mentioned at the beginning that you have a distance sensor that outputs 4-20 milliamps (mA). Because we measure voltage, not current, we use a resistor to convert the current to a voltage. Many customers use a 250 ohm resistor because that results in a voltage between 1 & 5 volts. The USB-231 must be in differential mode to measure the voltage drop across the resistor.

Your sensor measures 0 - 200mm; at 200mm, the measurement is 5 volts (20mA * 250). At zero distance, the measurement is 1 volt. The scale factor is 200 / (5 - 1) or 25. The offset is 0 = 1 * (200 / (5-1)) + b, where b is the offset. Rearrange the equation, and you get b  = -25. So the scale equation to get distance is f(x) = 25x - 25, where x is the measured voltage.

Here's a quick read on 4-20mA sensors https://digilent.com/reference/daq-and-datalogging/documents/current-sensors

Link to comment
Share on other sites

  • 0

Hello again, your help has been of great value. I am trying to apply this concept to the temperature sensor which is this model:

https://es.rs-online.com/web/p/circuitos-integrados-de-sensores-de-temperatura-y-humedad/8115595P?cm_mmc=ES-PPC-DS3A-_-google-_-DSA_ES_ES_Semiconductores_Index-_-Circuitos+Integrados+de+Sensores+de+Temperatura+y+Humedad|+Products-_-DYNAMIC+SEARCH+ADS&matchtype=&dsa-1672824838924&gclid=EAIaIQobChMIyuSBxcizgQMVkYZoCR09Jg8_EAAYAiAAEgKDxfD_BwE&gclsrc=aw.ds

However nothing sensible seems to come out of it. This is the data extracted with the programm (voltage units)

imagen.png.e42a24e5c5b81df965f5d31cf01d3b7f.png ---->applying formulae----->imagen.png.aaefb5e836944f9e0b3187658512beae.png

 

I don't know which channels is which sensor, but taking your last comment and applying the formulae the fourth value should represent the distance sensor, the rest is unknown. My guess is that due to the temperature not changing so much it must be the second value. Is it possible to get information of the sensor throught the channel?

Thanks in advance.

On 9/13/2023 at 2:49 PM, JRys said:

You are going to be successful if you know what your sensors output. The USB231 measures voltage. Your sensors may output voltage or current. You mentioned at the beginning that you have a distance sensor that outputs 4-20 milliamps (mA). Because we measure voltage, not current, we use a resistor to convert the current to a voltage. Many customers use a 250 ohm resistor because that results in a voltage between 1 & 5 volts. The USB-231 must be in differential mode to measure the voltage drop across the resistor.

Your sensor measures 0 - 200mm; at 200mm, the measurement is 5 volts (20mA * 250). At zero distance, the measurement is 1 volt. The scale factor is 200 / (5 - 1) or 25. The offset is 0 = 1 * (200 / (5-1)) + b, where b is the offset. Rearrange the equation, and you get b  = -25. So the scale equation to get distance is f(x) = 25x - 25, where x is the measured voltage.

Here's a quick read on 4-20mA sensors https://digilent.com/reference/daq-and-datalogging/documents/current-sensors

 

imagen.png

Link to comment
Share on other sites

  • 0
On 9/13/2023 at 2:49 PM, JRys said:

You are going to be successful if you know what your sensors output. The USB231 measures voltage. Your sensors may output voltage or current. You mentioned at the beginning that you have a distance sensor that outputs 4-20 milliamps (mA). Because we measure voltage, not current, we use a resistor to convert the current to a voltage. Many customers use a 250 ohm resistor because that results in a voltage between 1 & 5 volts. The USB-231 must be in differential mode to measure the voltage drop across the resistor.

Your sensor measures 0 - 200mm; at 200mm, the measurement is 5 volts (20mA * 250). At zero distance, the measurement is 1 volt. The scale factor is 200 / (5 - 1) or 25. The offset is 0 = 1 * (200 / (5-1)) + b, where b is the offset. Rearrange the equation, and you get b  = -25. So the scale equation to get distance is f(x) = 25x - 25, where x is the measured voltage.

Here's a quick read on 4-20mA sensors https://digilent.com/reference/daq-and-datalogging/documents/current-sensors

Another thing i ve noticed is that when i run the programm you sendt the laser sensor turns off, idk why

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...