mccdaq / mcculw

MCC Universal Library Python API for Windows
MIT License
78 stars 30 forks source link

How to read the CJC sensor temperature? #23

Closed willyd closed 2 years ago

willyd commented 4 years ago

EDIT: This question was initialy about the functions to use to obtain voltage and temperature measurements from the 2404-UI. But the only remaining question is about the CJC temperature. Hence, the issue name change.

I am trying to read the voltage value of a USB 2404-UI board connected to a thermocouple.

from mcculw import ul
from mcculw.enums import ULRange, TempScale, BoardInfo, AiChanType, InfoType,TcType

ul.set_config(InfoType.BOARDINFO, 0, 0, BoardInfo.ADCHANTYPE, AiChanType.TC)
ul.set_config(InfoType.BOARDINFO, 0, 0, BoardInfo.CHANTCTYPE, TcType.S)
t = ul.t_in(0, 0, TempScale.CELSIUS, 0)
print(t)
t = ul.t_in(0, 0, TempScale.NOSCALE, 0)
print(t)
ul.set_config(InfoType.BOARDINFO, 0, 0, BoardInfo.ADCHANTYPE, AiChanType.VOLTAGE)
t = ul.a_in(0, 0, ULRange.BIPPT05VOLTS)
print(t)

The two first calls to ul.t_in work but the call to ul.a_in generates the following error

This function can not be used with this board.

How can I read the voltage generated by the thermocouple? I also tried using:

t = ul.t_in(0, 0, TempScale.VOLTS, 0)

But I get:

Error 74: Invalid temperature scale specified.

Side question: Is it possible to read the value of the CJC sensor on this board?

willyd commented 4 years ago

All right. I found that I can't use the a_in function but a_in_32 works. Still can't figure out how to access the CJC temperature or voltage.

jeffreyg3 commented 4 years ago

no promises, but try channel 128 for CJC channel.

willyd commented 4 years ago

@jeffreyg3 Thanks for trying. I get Error 16: Invalid A/D channel number. for any channel number in [4, 1023].

Anything else I could try?

jeffreyg3 commented 4 years ago

I have conferred with the software developers, Unfortunately it is not possible to read the CJC sensor from the Universal Library for the USB-2404-UI

willyd commented 4 years ago

Thanks for the prompt response @jeffreyg3 . Is there any documentation about the list of devices that allow reading the CJC sensor? Many thanks.

jeffreyg3 commented 4 years ago

Sadly no, there is no documentation listing devices allowing you to read the CJC sensor(s). In general, most MCC temperature measurement devices can have their CJC sensor(s) read, you start at channel 128.
The is true for:
USB-TC, USB-TEMP, USB-2408 series, USB-2416 series, E-TC.