Python Forum
Potentiostat/Galvanostat potential issue
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Potentiostat/Galvanostat potential issue
#1
Good Morning,

I made a potentiostat based on article from https://www.sciencedirect.com/science/ar...0317#t0015. Unfortunately, it does not set the desired potential during calibration. I checked the whole system and everything seems fine from the hardware side. I run the software in PyCharm, which basically works but throws some bugs (for instance: Accessing pyqtgraph.QtWidgets through QtGui is deprecated and will be removed sometime after May 2022. Use QtWidgets.QWidget instead.)

Error:
C:\Users\Admin\AppData\Local\Programs\Python\Python310\python.exe "C:/Users/Admin/Desktop/Prace naukowe/Bateryjki/Potencjostat niezmieniony/Archive of OSF Storage/python/python/tdstatv3.py" C:\Users\Admin\Desktop\Prace naukowe\Bateryjki\Potencjostat niezmieniony\Archive of OSF Storage\python\python\tdstatv3.py:1039: DeprecationWarning: Accessing pyqtgraph.QtWidgets through QtGui is deprecated and will be removed sometime after May 2022. Use QtWidgets.QApplication instead. app = QtGui.QApplication([]) C:\Users\Admin\Desktop\Prace naukowe\Bateryjki\Potencjostat niezmieniony\Archive of OSF Storage\python\python\tdstatv3.py:1040: DeprecationWarning: Accessing pyqtgraph.QtWidgets through QtGui is deprecated and will be removed sometime after May 2022. Use QtWidgets.QMainWindow instead. win = QtGui.QMainWindow() C:\Users\Admin\Desktop\Prace naukowe\Bateryjki\Potencjostat niezmieniony\Archive of OSF Storage\python\python\tdstatv3.py:192: DeprecationWarning: Accessing pyqtgraph.QtWidgets through QtGui is deprecated and will be removed sometime after May 2022. Use QtWidgets.QLabel instead. label = QtGui.QLabel(text=default_text, alignment=QtCore.Qt.AlignCenter) C:\Users\Admin\Desktop\Prace naukowe\Bateryjki\Potencjostat niezmieniony\Archive of OSF Storage\python\python\tdstatv3.py:193: DeprecationWarning: Accessing pyqtgraph.QtWidgets through QtGui is deprecated and will be removed sometime after May 2022. Use QtWidgets.QGroupBox instead. box = QtGui.QGroupBox(title=title_name, flat=False) C:\Users\Admin\Desktop\Prace naukowe\Bateryjki\Potencjostat niezmieniony\Archive of OSF Storage\python\python\tdstatv3.py:195: DeprecationWarning: Accessing pyqtgraph.QtWidgets through QtGui is deprecated and will be removed sometime after May 2022. Use QtWidgets.QVBoxLayout instead. layout = QtGui.QVBoxLayout() C:\Users\Admin\Desktop\Prace naukowe\Bateryjki\Potencjostat niezmieniony\Archive of OSF Storage\python\python\tdstatv3.py:1049: DeprecationWarning: Accessing pyqtgraph.QtWidgets through QtGui is deprecated and will be removed sometime after May 2022. Use QtWidgets.QHBoxLayout instead. potential_current_display_frame = QtGui.QHBoxLayout() C:\Users\Admin\Desktop\Prace naukowe\Bateryjki\Potencjostat niezmieniony\Archive of OSF Storage\python\python\tdstatv3.py:1082: DeprecationWarning: Accessing pyqtgraph.QtWidgets through QtGui is deprecated and will be removed sometime after May 2022. Use QtWidgets.QPushButton instead. preview_cancel_button = QtGui.QPushButton("Back to live graph") C:\Users\Admin\Desktop\Prace naukowe\Bateryjki\Potencjostat niezmieniony\Archive of OSF Storage\python\python\tdstatv3.py:1087: DeprecationWarning: Accessing pyqtgraph.QtWidgets through QtGui is deprecated and will be removed sometime after May 2022. Use QtWidgets.QTabWidget instead. tab_frame = QtGui.QTabWidget() C:\Users\Admin\Desktop\Prace naukowe\Bateryjki\Potencjostat niezmieniony\Archive of OSF Storage\python\python\tdstatv3.py:204: DeprecationWarning: Accessing pyqtgraph.QtWidgets through QtGui is deprecated and will be removed sometime after May 2022. Use QtWidgets.QWidget instead. widget = QtGui.QWidget() C:\Users\Admin\Desktop\Prace naukowe\Bateryjki\Potencjostat niezmieniony\Archive of OSF Storage\python\python\tdstatv3.py:224: DeprecationWarning: Accessing pyqtgraph.QtWidgets through QtGui is deprecated and will be removed sometime after May 2022. Use QtWidgets.QLineEdit instead. entry = QtGui.QLineEdit() C:\Users\Admin\Desktop\Prace naukowe\Bateryjki\Potencjostat niezmieniony\Archive of OSF Storage\python\python\tdstatv3.py:1201: DeprecationWarning: Accessing pyqtgraph.QtWidgets through QtGui is deprecated and will be removed sometime after May 2022. Use QtWidgets.QComboBox instead. hardware_manual_control_range_dropdown = QtGui.QComboBox() C:\Users\Admin\Desktop\Prace naukowe\Bateryjki\Potencjostat niezmieniony\Archive of OSF Storage\python\python\tdstatv3.py:1230: DeprecationWarning: Accessing pyqtgraph.QtWidgets through QtGui is deprecated and will be removed sometime after May 2022. Use QtWidgets.QCheckBox instead. hardware_log_checkbox = QtGui.QCheckBox("Log") C:\Users\Admin\Desktop\Prace naukowe\Bateryjki\Potencjostat niezmieniony\Archive of OSF Storage\python\python\tdstatv3.py:1454: DeprecationWarning: Accessing pyqtgraph.QtWidgets through QtGui is deprecated and will be removed sometime after May 2022. Use QtWidgets.QPlainTextEdit instead. statustext = QtGui.QPlainTextEdit()
I wonder if this could be the cause of the potentiostat malfunction. I'm not a programmer, so any help is appreciated.

Potentiostat files repository: https://osf.io/mk45u/
Reply
#2
I don't think the depreciated Qt library is the problem. If you like, it is easy to update the code to use PySide6.

Change this:
from pyqtgraph.Qt import QtCore, QtGui 
to this:
from PySide6 import QtCore, QtGui, QtWidgets
Do a replace all QtGui with QtWidgets.
On lines 210 and 216 replace QtWidgets.QPalette.Background with QtGui.QPalette.Window.
On lines 1045, 1047 replace QtWidgets.QFont with QtGui.QFont.

What do you mean by "Unfortunately, it does not set the desired potential during calibration"? What exactly are you doing when this error occurs?
Reply
#3
(Oct-31-2022, 05:50 AM)deanhystad Wrote: What do you mean by "Unfortunately, it does not set the desired potential during calibration"? What exactly are you doing when this error occurs?

Quote:– Connect SE to WE, and RE to CE. Press the ‘‘Auto Calibrate” button. Under ‘‘Manual Control”, switch the cell on, and set a
few different potentials. The measured potential should exactly match the set potential; if it does not, you can further
fine-tune the calibration by making small adjustments to the DAC offset and DAC gain. Press ‘‘Save to device” to apply
the values.

When I have the potentiostat connected to the computer and try to calibrate it, the measured potential doesn't change. Everything else (controls buttons) works good. I have also tried to do standard experiment using three electrodes but the ongoing experiment was giving wrong results. I have checked the wires and all hardware elements step by step. I contacted with the engineer, who designed this potentiostat, but unfortunately he is not working in the university anymore and send me to his colleague, who unfortunately has poor knowledge about this project.

I will modificate the code according to Your hints and we will see.
Reply
#4
When you press the "Connect" button does the "Device Information" display? Does the "Connect" button label change to "Disconnect"? Do you see a log message that says "USB Interface connected;"?
Reply
#5
(Nov-02-2022, 03:42 AM)deanhystad Wrote: When you press the "Connect" button does the "Device Information" display? Does the "Connect" button label change to "Disconnect"? Do you see a log message that says "USB Interface connected;"?

[Image: 52J0PRb] (See attachment)

After pressing "Connect" button "Device Information" is displayed. "Connect" label change to "Disconnect". When I press "Cell connection ON" under "Manual Control" the diode on the potentiostat starts to glow (indication of works). Only "Set potential" under "Manual Control" seems to not work.

I have a couple more printed circuit boards and I will try to build other Potentiostat using electronic parts from different source. But for now I want to make sure that this is not a problem with the software. I checked also this potentiostat on the different PC computer but still I encounter the same thing.

At this point I have some issues with the PyCharm. It is giving me error: " AttributeError: module 'PySide6.QtGui' has no attribute 'QLabel' ".

What is more, when I start the Original (not modified code with "pyqtgraph") and trying to set different potential, PyCharm gives me some additional errors (see on the picture below). What do You think?

[Image: p2t5FBd] (See attachment)

Attached Files

Thumbnail(s)
       
Reply
#6
I am so sorry. There were two errors in the conversion instruction. I fixed those in the post and verified.

As for your error, did you connect first? The error message says dev is None. dev is the USB device (potentiostat/galvanostat). dev is initialized to None when you start the program. When you connect this is assigned to some usb device. When you disconnect it is set to None. The error message is saying that you were not connected.
Reply
#7
(Nov-03-2022, 03:18 AM)deanhystad Wrote: I am so sorry. There were two errors in the conversion instruction. I fixed those in the post and verified.

As for your error, did you connect first? The error message says dev is None. dev is the USB device (potentiostat/galvanostat). dev is initialized to None when you start the program. When you connect this is assigned to some usb device. When you disconnect it is set to None. The error message is saying that you were not connected.

When the device is not connected and I am trying to set something in the program, it's giving me the message "device not connected".

I modified all code according to Your instructions but still getting some errors Cry

Attached Files

Thumbnail(s)
   

.py   proba.py (Size: 75.19 KB / Downloads: 66)
Reply
#8
It is interesting that I don't get that error. Which version of pyqtgraph are you using?.

I don't think there's much you can do much in the program without being connected to the device. What are you trying to set when you get the "NoneType" errors?
Reply
#9
(Nov-04-2022, 09:55 AM)deanhystad Wrote: It is interesting that I don't get that error. Which version of pyqtgraph are you using?.

I don't think there's much you can do much in the program without being connected to the device. What are you trying to set when you get the "NoneType" errors?

I am using pyqtgraph 0.12.4. The "NoneType" error dissapeared completely. I am not getting it anymore.

Is there any possibility that PyQt5 interferes with PySide6 ? I have noticed accidentaly that I have installed module PyQt5. When I deleted it the basic version of code (not modified) stoped working giving error with PyQt5 (see attachment). It is weird because code should use PySide6.

Attached Files

Thumbnail(s)
   
Reply
#10
It is possible. Some packages, like pyqtgraph, are set up to work with many versions of Qt. They look at your installed packages to find which version of Qt is installed.

I think you can circumvent this by changing the import order in your file. Import PySide6 before import pyqtgraph. Change this:
import pyqtgraph
from PySide6 import QtCore, QtGui, QtWidgets
to this:
from PySide6 import QtCore, QtGui, QtWidgets
import pyqtgraph
Reply


Possibly Related Threads…
Thread Author Replies Views Last Post
  Is it possible to use the full potential of scalene in Pycharm? arnoldpredator 4 718 Nov-18-2023, 01:46 PM
Last Post: arnoldpredator
  Potential Permission error on Mac OSX Catalina OWOLLC 1 780 Nov-02-2023, 07:52 AM
Last Post: unjnsacih
  Potential confusion combining != with or Mark17 11 4,855 Nov-04-2019, 07:29 PM
Last Post: buran

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020