Digitális multiméter vezérlése mérésleírás

A Fizipedia wikiből


See the English version at the bottom of the page.

Tartalomjegyzék

Bevezetés


A mérési gyakorlat célja a Goodwill GDM-8246 típusú általános felhasználású digitális multiméter (DMM) megismerése és automatizált vezérlése.


A mérőeszköz kezelése

Goodwill DMM.PNG

A műszer rajza az ábrán található. Az előlapi elsődleges kijelző által mutatott értéket dolgozzuk fel a számítógéppel. A gombok szerepét teljes egészében a mérőprogram grafikus felülete veszi át. A hátlapon található az RS232, valamint a hálózati csatlakozó. A multimétert a soros porton szövegként kiküldött utasításokkal vezérelhetjük. Ezek közül több utasításra (például mérési adat lekérdezése) az eszköz választ ad, amit a soros porton keresztül tudunk beolvasni.

Soros kommunikáció adatai

A számítógépen a soros portot a következő beállításokkal kell használni:

  • Port name="COM1" (laptopon lehet, hogy másikat kell használni, érdemes ellenőrizni az Eszközkezelőben, a Portok alatt)
  • Baud rate=9600
  • Data bits=8
  • Stop bits=1
  • Paritás nincs.

Parancskészlet

Az alábbi táblázatban felsoroljuk a feladatok megoldásához használható parancskészletet. Az első oszlopban található a végrehajtott művelet. A második oszlopban a kiküldött utasítást találjuk.

Operation Command syntax Return value
Műszerazonosító lekérdezése *idn? "GW.Inc.GDM-8246,FW1.00"
Alaphelyzetbe állítás *cls
Elsődleges kijelző lekérdezése  :VAL? "+1.2345"
Automatikus méréshatárváltás bekapcsolása  :CONF:AUT 1
kikapcsolása  :CONF:AUT 0
Automatikus méréshatár lekérdezése  :CONF:AUT ? "0" vagy "1"
DC Voltmérés Auto méréshatár  :CONF:VOLT:DC 0
0.5V méréshatár  :CONF:VOLT:DC 0.5
5V méréshatár  :CONF:VOLT:DC 5
Ωmérés Auto méréshatár  :CONF:RES 0
500Ω méréshatár  :CONF:RES 0.5
5kΩ méréshatár  :CONF:RES 5

A mért eredményt a multiméter Volt, illetve kΩ egységekben szolgáltatja. Az utasításokat újsor karakterrel kell lezárni, ezért célszerű a Serial.WriteLine(string) metódus használata. A műszer által visszaküldött értéket a Serial.ReadLine() függvénnyel olvashatjuk be.

Feladatok

A cél egy olyan grafikus felület, amely lehetővé teszi a multiméter két funkciójának, az egyenfeszültség- (DCV), valamint az ellenállásmérésnek kezelését. A kész program kijelzi, az idő függvényében ábrázolja, valamint elmenti a műszertől kapott adatokat.

A mérőprogramot a következőek szerint építsük fel:

  1. Hozzuk létre azt a programrészletet, mely a kommunikáciért felelős, és teszteljük azzal, hogy egy gombnyomásra kiírjuk a műszer által beolvasott értéket! A mérőműszer és a soros port inicializálását a program betöltődésekor végezzük el: az alapértelmezett üzemmód legyen a feszültségmérés automatikus méréshatárral;
  2. Tegyük a kiolvasást automatizálttá, azaz a kommunikációt és a kiírást végezzük egy Timer által meghatározott -változtatható- időközönként;
  3. Adjunk lehetőséget a két szükséges üzemmód közötti változtatásra például két nyomógomb segítségével! Ügyeljünk arra, hogy a Timer event által futtatott kommunikáció összeakadhat más event portkezelésével, ezért az üzemmódváltást csak a következő Timer event végezze el! Erre egy módszer két globális logikai változó használata, melyeket a gombok lenyomása állít be és állapotuk meghatározza, hogy szeretnénk-e megváltoztatni az üzemmódot és ha igen, melyik üzemmód legyen aktív. Ekkor a változókat a Timer eventben megvizsgálva eldönthetjük, hogy szükséges-e a műszert átállítani;
  4. Hozzuk létre a lemezre mentéshez szükséges struktúrákat: az állomány tartalmazza a mérés kezdete óta eltelt időt, valamint a mért mennyiség értékét és mértékegységét! A program felületén legyen lehetőség a mentést felfüggeszteni, majd újraindítani (ezt megtehetjük CheckBox, vagy két nyomógomb segítségével);
  5. Ábrázoljuk a mért értékeket! Ügyeljünk arra, hogy üzemmódváltásnál ürítsük ki a régi tartalmat a grafikonról!
  6. Tegyünk fel három gombot, amellyel lehetőség van a méréshatár váltására: DCV üzemmódban ezek legyenek rendre: 0.5V, 5V, Auto. Ellenállásmérés módban: 500Ω, 5kΩ, Auto. A méréshatár váltásánál is ügyeljünk az üzemmódváltásnál leírtakra!
  7. Tegyük szebbé a kiírást és ábrázolást: Jelenítsük meg az aktuális mértékegységet a mért érték mögött és a grafikon tengelyén!
  8. Demonstráljuk a program működését különböző üzemmódokban! Például, különböző ellenállásértékek (ellenállás alkatrészek, emberi test) és feszültségforrás mérésével (pl. LED, mint fényérzékelő).

A mérésről készített jegyzőkönyv lényegében egy használati utasítás az elkészült felülethez. Ismertessük a megvalósított funkciókat, a grafikus felület kezelését, valamint részletesen térjünk ki az olyan megoldásokra, amelyek nem a fentiekben megfogalmazott felépítést követik! A jegyzőkönyvhöz csatoljuk a mérőprogram forráskódját!

Syllabus in English

Introduction

The aim of this exercise is to learn how to program and automatically control measurements on a Goodwill GDM-8246 digital multimeter (DMM).

Description of the instrument

Goodwill DMM.PNG

A picture of the instrument and its connectors is visible to the right. In the exercise, the values shown by the primary display of the front panel will be read and processed. The roles of the buttons on the front panel are taken over by the graphical user interface of our measurement program. On the back panel, an RS232 and GPIB connector can be seen. The RS232 interface will be used to control the device by sending character string (text) messages. For certain messages, the device produces a response, also in character strings, which must be read by the measurement program.

Serial communication setup

The measurement program must establish a serial port communication with the device using the following settings:

  • Port name="COM1" (it is possible that another port number is required if you use your own laptop, one fast possibility is to check Ports (COM & LPD) in Device Manager)
  • Baud rate=9600
  • Data bits=8
  • Stop bits=1
  • No Parity.

Commands

The following table describes some of the more common commands to be used in this exercise. The first column is a description of the operation, the second is the actual character string that must be sent.

Operation Command syntax Return value
Device ID query *idn? "GW.Inc.GDM-8246,FW1.00"
Reset device to default state *cls
Read primary display value  :VAL? "+1.2345"
Automatic measurement range On  :CONF:AUT 1
Off  :CONF:AUT 0
Query auto measurement range state  :CONF:AUT ? "0" or "1"
DC Volt measurement Auto range  :CONF:VOLT:DC 0
0.5V range  :CONF:VOLT:DC 0.5
5V range  :CONF:VOLT:DC 5
Ω measurement Auto range  :CONF:RES 0
500Ω range  :CONF:RES 0.5
5kΩ range  :CONF:RES 5

The measured value will be returned in Volt or k&Omega units as a number string. The sent string commands must end with a newline character, for this the Serial.WriteLine(string) method can be used, which automatically appends a newline to the end of string. To read the instrument's responses, it is easiest to use the Serial.ReadLine() method. Only call this method when you know that the instrument was given a command it sends a response to, otherwise your measurement program will get stuck here, forever waiting for a string on the serial port that is never sent by the instrument.

Tasks

The end goal is creating a GUI that controls two functions of the DMM, namely DC voltage and resistance measurements. The user must be able to switch between the two functions using the program, set the measurement ranges. The program should always display the current measurement value, as well as display a graph of past values over time. There should be an option to save the graphed measurement values to a file of the user's choosing.

Build the measurement program using the following criteria:

  1. Create a program section that is responsible for serial communication, and test it with a simple function of reading and displaying the current value on a button click! The initialization of the device and the serial port should be done on program initialization automatically. Use DC voltage measurement in automatic measurement range as the default setting.
  2. Automatize the serial port reading functionality, by using a Timer method that reads the current value with a -user selectable- time interval;
  3. Create the possibility of switching between the instrument functions using two buttons. Take care that the actual switch between operating modes of the instrument only happens in a synchronized manner on a Timer tick, otherwise the attempt to communicate with the instrument might clash with the Timer's own communication methods and result in an error state. One possibility to solve this is to use global logical variables that you set when the user presses the switch modes button, and the Timer method checks their state before continuing with value read.
  4. Create data structures necessary for file saving: saved data should contain the time elapsed since start of measurement, and the value and unit of measurement. The user interface should have an option to suspend and resume file saving, while continuing the value reading process itself. Use buttons or a CheckBox control for this.
  5. Display the measured values on a graph. Take care to clear the graph when switching measurement mode!
  6. Use three buttons for selecting measurement range. In voltage mode the ranges should be 0.5V, 5V, Auto. In resistance mode 500Ω, 5kΩ, Auto. Use the same three buttons for this function. Also take care to clear the graph when switching ranges.
  7. Improve the visual aspect by displaying the measurement units along with the read value, and correctly labeling the graph axis.
  8. Demonstrate the operation of the program in different modes. For example, by measuring different resistances (through-hole resistors, human body) and voltage sources (e.g. LED, as a photodetector).

The final report should be written as a user guide for using the program to control the instrument. Explain the implemented instrument functions, how to use the GUI, and write down in detail any programming solutions that differ from the simple steps described above. Attach the source code of your program to the report!