{"id":314,"date":"2025-05-24T11:09:46","date_gmt":"2025-05-24T11:09:46","guid":{"rendered":"https:\/\/m1fly.duckdns.org\/?page_id=314"},"modified":"2025-05-24T12:39:16","modified_gmt":"2025-05-24T12:39:16","slug":"lcr-meter","status":"publish","type":"page","link":"https:\/\/m1fly.duckdns.org\/index.php\/lcr-meter\/","title":{"rendered":"LCR Meter"},"content":{"rendered":"\n<p class=\"wp-block-paragraph\">My trusty U1732B meter is old with no ESR button, follow me down this rabbit hole.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">lets try and leverage AI to make a remote display,<\/p>\n\n\n\n<blockquote class=\"wp-block-quote alignwide is-layout-flow wp-block-quote-is-layout-flow\">\n<p class=\"wp-block-paragraph\">(me)<br>Question: I am writing a program to calculate the esr of a capacitor<br>using a U1732B lcr meter.<br>I believe the sum is 1 over the reactance * Dissipation factor, but<br>don&#8217;t quote me on that!. Here is my code so far.<\/p>\n<\/blockquote>\n\n\n\n<p class=\"wp-block-paragraph\"><\/p>\n\n\n<pre class=\"wp-block-code alignwide plover-prism prism-github-dark-theme language-python\" style=\"border-width:1px\"><code>from PyQt5 import QtCore, QtGui, QtWidgets\n\n\nclass Ui_Dialog(object):\n    def setupUi(self, Dialog):\n        Dialog.setObjectName(\"Dialog\")\n        Dialog.resize(400, 300)\n        self.buttonBox = QtWidgets.QDialogButtonBox(Dialog)\n        self.buttonBox.setGeometry(QtCore.QRect(30, 240, 341, 32))\n        self.buttonBox.setOrientation(QtCore.Qt.Horizontal)\n        self.buttonBox.setStandardButtons(QtWidgets.QDialogButtonBox.Cancel|QtWidgets.QDialogButtonBox.Ok)\n        self.buttonBox.setObjectName(\"buttonBox\")\n        self.lineEdit = QtWidgets.QLineEdit(Dialog)\n        self.lineEdit.setGeometry(QtCore.QRect(120, 40, 113, 24))\n        self.lineEdit.setObjectName(\"lineEdit\")\n        self.label = QtWidgets.QLabel(Dialog)\n        self.label.setGeometry(QtCore.QRect(50, 10, 271, 21))\n        font = QtGui.QFont()\n        font.setPointSize(20)\n        font.setBold(True)\n        font.setWeight(75)\n        self.label.setFont(font)\n        self.label.setObjectName(\"label\")\n        self.label_2 = QtWidgets.QLabel(Dialog)\n        self.label_2.setGeometry(QtCore.QRect(16, 40, 91, 20))\n        self.label_2.setObjectName(\"label_2\")\n        self.comboBox = QtWidgets.QComboBox(Dialog)\n        self.comboBox.setGeometry(QtCore.QRect(240, 40, 72, 24))\n        self.comboBox.setObjectName(\"comboBox\")\n        self.comboBox.addItem(\"\")\n        self.comboBox.addItem(\"\")\n        self.comboBox.addItem(\"\")\n        self.label_3 = QtWidgets.QLabel(Dialog)\n        self.label_3.setGeometry(QtCore.QRect(20, 70, 71, 16))\n        self.label_3.setObjectName(\"label_3\")\n        self.lineEdit_2 = QtWidgets.QLineEdit(Dialog)\n        self.lineEdit_2.setGeometry(QtCore.QRect(120, 70, 113, 24))\n        self.lineEdit_2.setObjectName(\"lineEdit_2\")\n        self.pushButton = QtWidgets.QPushButton(Dialog)\n        self.pushButton.setGeometry(QtCore.QRect(140, 180, 80, 24))\n        self.pushButton.setObjectName(\"pushButton\")\n        self.pushButton.toggle()\n        self.pushButton.clicked.connect(lambda: self.whichbtn(self.pushButton))\n        self.pushButton.clicked.connect(self.btnstate)\n\n        self.retranslateUi(Dialog)\n        self.buttonBox.accepted.connect(Dialog.accept) # type: ignore\n        self.buttonBox.rejected.connect(Dialog.reject) # type: ignore\n        QtCore.QMetaObject.connectSlotsByName(Dialog)\n\n    def btnstate(self):\n        if self.pushButton.isChecked():\n            print(\"button pressed\")\n            self.lineEdit_2.setText(\"Button Pressed\")\n        else:\n            print(\"button released\")\n            mytemp = self.lineEdit.text()\n            myresult = int(mytemp) \/ 1000000\n            self.lineEdit_2.setText(str(myresult))\n    def whichbtn(self, b):\n        print(\"clicked button is \" + b.text())\n\n    def retranslateUi(self, Dialog):\n        _translate = QtCore.QCoreApplication.translate\n        Dialog.setWindowTitle(_translate(\"Dialog\", \"Dialog\"))\n        self.label.setText(_translate(\"Dialog\", \"Rich\\'s ESR Calculator\"))\n        self.label_2.setText(_translate(\"Dialog\", \"Capacitor Value\"))\n        self.comboBox.setCurrentText(_translate(\"Dialog\", \"Micro\"))\n        self.comboBox.setItemText(0, _translate(\"Dialog\", \"Micro\"))\n        self.comboBox.setItemText(1, _translate(\"Dialog\", \"Pico\"))\n        self.comboBox.setItemText(2, _translate(\"Dialog\", \"Nano\"))\n        self.label_3.setText(_translate(\"Dialog\", \"Converted\"))\n        self.pushButton.setText(_translate(\"Dialog\", \"Calculate\"))\n\n    def accept(self):\n        print(\"Hello\")\n\nif __name__ == \"__main__\":\n    import sys\n    app = QtWidgets.QApplication(sys.argv)\n    Dialog = QtWidgets.QDialog()\n    ui = Ui_Dialog()\n    ui.setupUi(Dialog)\n    Dialog.show()\n    sys.exit(app.exec_())<\/code><\/pre>\n\n\n\n<blockquote class=\"wp-block-quote is-layout-flow wp-block-quote-is-layout-flow\">\n<p class=\"wp-block-paragraph\">Can you finish it for me please?<\/p>\n<\/blockquote>\n\n\n\n<blockquote class=\"wp-block-quote alignwide has-primary-active-background-color has-background is-layout-flow wp-block-quote-is-layout-flow\">\n<p class=\"wp-block-paragraph\">You&#8217;re off to a good start with the GUI. To complete your ESR calculator, you&#8217;ll want to:<\/p>\n\n\n<pre class=\"wp-block-code plover-prism prism-github-dark-theme language-clike\"><code>Accept inputs for capacitance (C), frequency (f), and dissipation factor (D).\n\nCalculate reactance (Xc) using the formula:\nXc=12&pi;fC\nXc&#8203;=2&pi;fC1&#8203;\n\nCalculate ESR using:\nESR=Xc&times;D\nESR=Xc&#8203;&times;D<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">Here\u2019s a modified version of your code that does this:<\/p>\n<\/blockquote>\n","protected":false},"excerpt":{"rendered":"<p>My trusty U1732B meter is old with no ESR button, follow me down this rabbit hole. lets try and leverage AI to make a remote display, (me)Question: I am writing a program to calculate the esr of a capacitorusing a U1732B lcr meter.I believe the sum is 1 over the reactance * Dissipation factor, butdon&#8217;t [&hellip;]<\/p>\n","protected":false},"author":2,"featured_media":0,"parent":0,"menu_order":0,"comment_status":"closed","ping_status":"closed","template":"","meta":{"footnotes":""},"class_list":["post-314","page","type-page","status-publish","hentry"],"_links":{"self":[{"href":"https:\/\/m1fly.duckdns.org\/index.php\/wp-json\/wp\/v2\/pages\/314","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/m1fly.duckdns.org\/index.php\/wp-json\/wp\/v2\/pages"}],"about":[{"href":"https:\/\/m1fly.duckdns.org\/index.php\/wp-json\/wp\/v2\/types\/page"}],"author":[{"embeddable":true,"href":"https:\/\/m1fly.duckdns.org\/index.php\/wp-json\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/m1fly.duckdns.org\/index.php\/wp-json\/wp\/v2\/comments?post=314"}],"version-history":[{"count":11,"href":"https:\/\/m1fly.duckdns.org\/index.php\/wp-json\/wp\/v2\/pages\/314\/revisions"}],"predecessor-version":[{"id":335,"href":"https:\/\/m1fly.duckdns.org\/index.php\/wp-json\/wp\/v2\/pages\/314\/revisions\/335"}],"wp:attachment":[{"href":"https:\/\/m1fly.duckdns.org\/index.php\/wp-json\/wp\/v2\/media?parent=314"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}