Difference: VirtualInstruments (1 vs. 3)

Revision 32021-05-16 - UliRaich

Line: 1 to 1
 
META TOPICPARENT name="WebHome"

Virtual Instruments

Introduction

Changed:
<
<
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).
>
>
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.
Line: 34 to 34
 
  • triangular
  • sawtooth
  • sine wave
Changed:
<
<
It works on the same principles as the voltmeter: The pulseGenServer.py 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:
>
>
It works on the same principles as the voltmeter: The pulseGenServer.py 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.
Added:
>
>
pulseGenRectsmall.png pulseGenTriagsmall.png
pulseGenSawsmall.png pulseGenSinsmall.png
As we can see, there is an additional knob to control the pulse height and there are 2 menus, the first of which controls the sample frequency of the generator, while the other one controls the simulated sampling frequency of an oscilloscope. In the above examples the generator works at 5 kHz while the simulated oscilloscope takes samples at 2 KHz which means that 2.5 complete signal pulses are seen.

A pulse consists of 500 samples and is constantly repeated. The generator sample frequency is the frequency at which samples are emitted. These frequencies are pretty low, but they are adapted to the analogue bandwidth of the ESP32 ADC channels which will be used for the virtual oscilloscope application. The maximum sample frequency is 5 kHz, which corresponds to 200 us between samples, and a pulse length of 500 * 0.2 ms = 100 ms and therefore a pulse frequency of 10 Hz.

The generator pulse frequency is entirely controlled by software delays, which have been calibrated with a physical oscilloscope:

rect.png

The image shows the oscilloscope trace for a square pulse at 5 kHz. A pulse length of 100 ms is expected, and we can see that the time between the markers, corresponding to 2 pulses, reads 201 ms.

  -- Uli Raich - 2021-05-15
Line: 49 to 60
 
META FILEATTACHMENT attachment="voltmeter.png" attr="" comment="" date="1621153801" name="voltmeter.png" path="voltmeter.png" size="26508" user="UliRaich" version="1"
META FILEATTACHMENT attachment="voltmeter_server.png" attr="" comment="" date="1621153895" name="voltmeter_server.png" path="voltmeter_server.png" size="27183" user="UliRaich" version="1"
Added:
>
>
META FILEATTACHMENT attachment="pulseGenRectsmall.png" attr="" comment="" date="1621166077" name="pulseGenRectsmall.png" path="pulseGenRectsmall.png" size="31441" user="UliRaich" version="1"
META FILEATTACHMENT attachment="pulseGenSawsmall.png" attr="" comment="" date="1621166077" name="pulseGenSawsmall.png" path="pulseGenSawsmall.png" size="34849" user="UliRaich" version="1"
META FILEATTACHMENT attachment="pulseGenSinsmall.png" attr="" comment="" date="1621166077" name="pulseGenSinsmall.png" path="pulseGenSinsmall.png" size="36445" user="UliRaich" version="1"
META FILEATTACHMENT attachment="pulseGenTriagsmall.png" attr="" comment="" date="1621166077" name="pulseGenTriagsmall.png" path="pulseGenTriagsmall.png" size="36558" user="UliRaich" version="1"
META FILEATTACHMENT attachment="rect.png" attr="" comment="" date="1621166933" name="rect.png" path="rect.png" size="81926" user="UliRaich" version="1"

Revision 22021-05-16 - UliRaich

Line: 1 to 1
 
META TOPICPARENT name="WebHome"

Virtual Instruments

Introduction

Line: 18 to 18
 An application with a Graphical User Interface (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

Changed:
<
<
The simplest of the virtual instruments is certainly the 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 voltmeterServer.py must be started on the ESP32:

voltmeter_server.png

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.

voltmeter.png

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 pulseGenServer.py 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.
  -- Uli Raich - 2021-05-15

Comments

<--/commentPlugin-->
Added:
>
>
META FILEATTACHMENT attachment="voltmeter.png" attr="" comment="" date="1621153801" name="voltmeter.png" path="voltmeter.png" size="26508" user="UliRaich" version="1"
META FILEATTACHMENT attachment="voltmeter_server.png" attr="" comment="" date="1621153895" name="voltmeter_server.png" path="voltmeter_server.png" size="27183" user="UliRaich" version="1"

Revision 12021-05-15 - UliRaich

Line: 1 to 1
Added:
>
>
META TOPICPARENT name="WebHome"

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 Graphical User Interface (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.

-- Uli Raich - 2021-05-15

Comments

<--/commentPlugin-->
 
This site is powered by the TWiki collaboration platform Powered by PerlCopyright © 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