I am using two channels of the Pt-104 Data logger and RPi/Python in order to obtain the temperatures for the PID temperature control:
I am using the following code:
The problem arised when I noticed that sometimes, after a few hours of working, Pt-104 Data logger stops sending the data. (It cannot be because of Ethernet connection since I am also using the other device on the same network for reading some voltages simultaneously and it is working fine). I taught that the problem can be solved then by closing the pico device and then closing the driver as:
I do not get any temperature readings. The problem is solved only when the python script is restarted. However since i have to have the continuous temperature readings that are related to the the controls of the other devices in the same script the restarting of script is not the solution.
Is there any way to reset/restart the driver properly or some other solution to fix the problem?
Thank you very much in advance!
For the UsbPt104GetValue() function, the value parameter should be a 32-bit signed integer as opposed to a 64-bit integer.
You do not need to specify the serial number when connecting via Ethernet as you can use just the IP address and port number.
When the connection is lost, are you able to send a ping command to the IP address successfully? Rather than using port 1, which perhaps is a reserved port, I would suggest using a larger number e.g. 6500.
First of all, thank you for your suggestions. I have set port to 6500, however the probem remained unsolved. Concerning ping, I run it in the background while the script was running, and I noticed that every time that Datalogger stopped working, the ping time went from about 1ms to 200-300 ms. Afterwards, the ping time was fine, however I was not able to obtain the temperatures again until I have restarted the script. Also I noticed something strange. I am able to open the unit just using both serial number and IP address:
How is the USB PT-104 connected to the ethernet port on the Raspberry Pi? Is it via a Power over Ethernet Switch, through just a normal switch/hub or directly?
If you are opening the device without using the serial number, you still need to pass a value for the serial parameter but set it to the Python equivalent for NULL.
Thanks a lot, None for serial number works.
DataLogger is connected to a normal Ethernet switch (which is then connected to the Ethernet network and not to RPi) and is powered via USB cable which is connected to a computer.
Unfortunately I have to use the etharnet port of RPi for etharnet connection (I have to have remote access to RPi). However I have connected both Rpi and Pt-104 to the same network switch and I am still seeing the same problem. Is there any way to close and restart Pt-104 without killing the process?
You could try calling the UsbPt104CloseUnit() function if the UsbPt104GetValue() function returns a status code that is not PICO_OK or not a repeat value, then try opening the connection to the device again.
Have you tried using a Windows PC with the PicoLog Recorder software to see if that works with the Ethernet connection?