Tags:
view all tags
---+ Virtual Instruments ---++ Introduction Measurement instruments like multi-meters, pulse generators or oscilloscopes can be rather costly and the requirements for the IoT course are rather modest with respect to signal height (we have either digital signals of 0 or 3.3V or analogue signals in the same range) or with respect to frequency (a few kHz max). The ESP32 has a Digital to Analogue Converter (DAC), which can be uses to generate signals of any shape, and it has an ADC which can be used to sample analogue signals. Three types of instruments have been implemented: * a signal generator * a voltmeter * an oscilloscope Of course all of these instruments are extremely basic, but they fulfil the requirements of this course. Each of the instruments consists of a TCP server running of the ESP. This server generates the analogue signal for the pulse generator using the 8-bit DAC provided by the ESP32 or samples the analogue signal to be measured using its ADC in case of the voltmeter and the oscilloscope. An application with a <b>G</b>raphical <b>U</b>ser <b>I</b>nterface (GUI), created with the Qt5 library implements a TCP client that connects to the server, gets the measured data from it and displays them in a user-friendly manner. Measurement parameters, like the pulse shape and frequency in case of the pulse generator can also be set using GUI elements. ---++ A Virtual Voltmeter The simplest of the virtual instruments is certainly the Voltmeter. The analogue signal level must be connected to GPIO 36 (first ADC channel). Then the <i>voltmeterServer.py </i>must be started on the ESP32: <img alt="voltmeter_server.png" height="216" src="%ATTACHURL%/voltmeter_server.png" title="voltmeter_server.png" width="704" /> As you can see, the server has IP: 192.168.1.98 (this will very probably be different on your machine) and it waits for connections requests on port 5000. Once the server is running you can start the GUI application on the PC and connect to the server (in the example above the PC has IP 192.168.1.36). Once the connection is established the signal level is shown in analogue form (the gauge) as well as in digital form. The values are in volts. <img alt="voltmeter.png" height="352" src="%ATTACHURL%/voltmeter.png" title="voltmeter.png" width="448" /> ---++ The pulse generator The pulse generator provides 4 different pulse shapes: * rectangular * triangular * sawtooth * sine wave It works on the same principles as the voltmeter: The <i>pulseGenServer.py</i> is a TCP server which allows connection from a GUI application _pulseGenGUI.py_ serving as TCP client. This application controls the settings of the pulse generator sending commands to the _pulseGenServer_: * select pulse shape * select frequency * select pulse height * start pulse generation It has a display that shows how the signal will look like if measured on an oscilloscope. -- %USERSIG{UliRaich - 2021-05-15}% ---++ Comments %COMMENT%
Attachments
Attachments
Topic attachments
I
Attachment
History
Action
Size
Date
Who
Comment
png
voltmeter.png
r1
manage
25.9 K
2021-05-16 - 08:30
UliRaich
png
voltmeter_server.png
r1
manage
26.5 K
2021-05-16 - 08:31
UliRaich
Edit
|
Attach
|
Watch
|
P
rint version
|
H
istory
:
r3
<
r2
<
r1
|
B
acklinks
|
V
iew topic
|
Raw edit
|
More topic actions...
Topic revision: r2 - 2021-05-16
-
UliRaich
Home
Site map
AFNOG web
Embedded_Systems web
IoT_Course_English web
IoT_Course_French web
Main web
Sandbox web
TWiki web
IoT_Course_English Web
Create New Topic
Index
Search
Changes
Notifications
RSS Feed
Statistics
Preferences
View
Raw View
Print version
Find backlinks
History
More topic actions
Edit
Raw edit
Attach file or image
Edit topic preference settings
Set new parent
More topic actions
Account
Log In
Register User
Edit
Attach
Copyright © 2008-2024 by the contributing authors. All material on this collaboration platform is the property of the contributing authors.
Ideas, requests, problems regarding TWiki?
Send feedback