The regular low-cost instruments (DMMs, scopes, generators, power supply, etc.) are currently used for laboratory education. Nevertheless, two problems can arise:
• In the case of many students taught simultaneously it is difficult to guarantee such a set for each of them individually (especially scopes and generators).
• The use is restricted to equipped laboratories, so students cannot execute experiments elsewhere (e.g. solving homework).
The basic instrument – simple low-cost handheld digital multimeter is mostly at an affordable price accessible for everybody. It makes possible to realize static measurements only . The problem arises in the case of generating and recording time-variable signals when scope must be used. The virtual USB scopes, which are suitable for this purpose, are available at the market , nevertheless their obtaining has some restrictions, especially for individual work at home or in the case when many students solve the similar task parallelly.
This situation had to be solved at the CTU-FEE, Dept. of Measurement, both in the subject “Industrial electronics laboratory”, where 20–30 students solve a similar task parallelly, and in the intensive preparatory course “Practical Electronics”, which is determined especially for school-leavers of secondary schools and a similar number of students (2 x 20–30) take part in.
In both cases, it is for a lot of students the first practical meeting with electronic circuits and corresponding experiments. Therefore, for some of them, the time spent in laboratories is not enough to finish the tasks. These need to have a possibility to work at home without any fuss, too. Besides, considering a high number of participants, the capacity of special laboratories for electronic education equipped with scopes and generators is not enough and computer laboratories have to be used. The facts mentioned above led to the demand to design and develop a suitable tool for laboratory teaching based on PC and USB connection, which should serve not only for generating and recording time-variable signals but also for supplying of experimental circuits. F0-Lab can be used as a simple DC voltmeter, a digitizing oscilloscope, a waveform recorder (3-channels in all cases) and a PWM signal generator.
DESIGN OF THE LOW-COST TOOL – VIRTUAL INSTRUMENT – FOR LABORATORY TEACHING
During the design of the low-cost tool for laboratory teaching, it was necessary to take into consideration besides the functions mentioned above also a possibility to acquaint students with fundamentals of microcontroller technology, interfacing, and programming. It was demanded, to be possible to realize the tool also by students without special knowledge and without using special paid software. The main instruments, which should be realized, were a virtual scope and a generator. To use a low-cost powerful microcontroller with embedded fast ADC and USB interface and develop the necessary firmware for the microcontroller and corresponding PC application was chosen as an optimal solution.
Selection of microcontroller
The microcontroller STM32 with the ARM Cortex-M core was selected from many other powerful ones. The support of the company STMicroelectronics was a significant factor for it. The low-cost kit NUCLEO F303RE (approx. 10 Euro) with the microcontroller STM32F303RE was applied in the first version of LEO – Little Embedded Oscilloscope. No additional circuits were used in this case. Although in comparison with similar solutions , where additional components are applied, the input voltage is limited in the range 0 – 3.3 V. Nevertheless, it was (despite this limitation) successfully tested in laboratory education several years ago (especially considering only 5 V supply from USB port was available in this case, thus this limitation was not significant).
Based on these experiences a simpler and low-cost solution for mass education was searched. The final goal was to realize a more universal virtual instrument using one microcontroller only and with minimum cost directly on the solderless breadboard. The low-cost (approx. 2 Euro) microcontroller STM32F042  with ARM Cortex – M0 core was finally selected for this application. Its basic parameters are:
• 32 kByte FLASH
• 6 kB SRAM
• 12 bit ADC (up to 1 MS/s)
• Crystal-less USB interface
• Package TSSOP20
• Supply: 2 – 3.6 V
The internal loader enables to download the firmware in internal flash not only using USART interface but also using USB DFU (USB Device Firmware Upgrade standard). It makes it possible to use the microcontroller without any next special components. The microcontroller is soldered on the adaptor TSSOP20/DIL20, which enables to use it directly on the solderless breadboard. A possibility to create own programme in C/C++ using online IDE Mbed is the next advantage of this solution.
The basic connection of the virtual instrument for laboratory teaching is very simple (see figure 1). Thanks to it each student can connect it on the solderless breadboard himself without a problem. The 5 V supply from the USB port is at disposal in the board and the microcontroller is supplied using the stabilizer 3.3 V. This voltage is also distributed in the board and both voltages can also be used for experiments realization.
REALIZATION OF VIRTUAL INSTRUMENT FUNCTIONS
The approach Software Defined Instruments (SDI), where all virtual instrument functions were realized by software using circuits on the chip of the microcontroller only, was applied. The possibilities and properties of the realization are depended on the software used. The function realized in the last version of the presented virtual instrument is described below.
The realization of the oscilloscope function was the main demand. The internal ADC, SRAM memory and DMA controller are applied for it. The circular buffer, which serves for the continual store of data from ADC, is realized using RAM. The microcontroller processes the data contemporary and finds the fulfillment of the trigger condition. The trigger level and the rising or the falling edge can be set for the selected channel. The pretrigger can also be set. At the moment, when the trigger condition was fulfilled, the next data according to the pretrigger setting are recorded yet, and the sampling is finished. After that, the recorded data are transferred offline using the USB port in the PC, which enables the following data processing and visualization.
Since only one ADC is implemented in the used microcontroller, the input must be multiplexed using the 2 or 3 channel mode. Therefore, while the sampling rate is 600 kS/s and the record length 1024 samples, for 2-channels mode it is 300 kS/s and for 3-channels mode it is 200 kS/s only, and the record length is one-half or one-third in comparison with the single channel mode.
The 3-channels voltmeter is also realized applying the internal ADC, but using 100 Sa/s. The resolution is 0.8 mV, for suppression of noise and disturbances the averaging can be applied (usually average from 40 samples is used). Considering the supply voltage of ADC (VDDA) is contemporarily used as its reference voltage, and the supply voltage is not precisely defined, the uncertainty of measurement thanks to this fact increased. To improve the accuracy, the used firmware includes the correcting subroutine, which corrects the measured value based on the measured value of internal reference that is embedded in the microcontroller. Considering the ADC input is single-ended, only the voltage in relation to GND can be measured. Nevertheless, a differential input can be realized using 2 multiplexed inputs and the implemented function, which realized difference V1 – V2.
Further, the voltmeter function enables also the record of measured voltages. The mode “recording” makes it possible to display the time course of the measured voltage. This record can be also exported in the file in the CSV format for the following processing using Excel. The data are transferred online using the USB port in the PC in this case and the record length is not limited by internal SRAM.
Considering the microcontroller STM32F042 does not include DAC, the function generator cannot be implemented. Nevertheless, the pulse signal can be generated. It enables to realize the PWM generator with an adjustable period and pulse width. Its maximum frequency is 12 MHz, the setting of the period and pulse-width is possible with the step of 20.83 ns (the system clock 48 MHz).
Further variants for the realization of virtual instrument functions
The virtual instrument functions mentioned above were realized using firmware for microcontroller STM32F042, which cooperates with the corresponding graphical PC application created using Qt . However, independently were also developed the simpler variants SDI, which used the PC with the terminal software package PuTTy. It concerns single-purpose functions e.g. a voltmeter, a logical probe, a pulse generator, etc. The development runs continuously and further information of application in the other university labs can be found in .
THE PROGRAMME MLI - MULTIFUNCTIONAL LABORATORY INSTRUMENT
• 4 channel voltmeter with averaging + 4 channel voltage recorder;
• 4 channel oscilloscope (sampling rate max. 750 kS/s, record length max. 1 kS);
• 4 channel logic analyzer (sampling rate max. 8 MS/s, record length max. 1 kS);
• counter for frequency and pulse-width measurement.
• 2 channel PWM generator;
The 4 channels voltmeter with averaging and the 4 channels voltage recorder was also implemented (see figure 3). This record can be also exported in the file with the CSV format for the following processing using Excel. For simple experiments, the graph in the PNG format can be exported.
The scope uses the 8-bit or the 12-bit resolution of ADC; the sampling rate is adjustable up to 750 kS/s in the single channel mode. The record length is again limited with the internal RAM and it is 1 kS for 8-bit resolution. The virtual control panel of the scope is presented in figure 4.
Considering a need for observation of the digital data flow the 4 channels logic analyzer was implemented -figure 5. The sampling rate is up to 8 MS/s and the record length 1 kS for 4 channels. The trigger is derived from the edge (rise/fall) in the selected channel. The primary application concerns the digital data flow analysis in the case of microcontroller interfaces as IIC, SPI, etc., which are applied in many microcontrollers and intelligent sensors e.g. Raspberry Pi, Arduino, etc. The channel UART can also be easily monitored.
The counter for frequency and pulse-width measurement was also implemented as a fully new function - figure 6. Its resolution is 20.83 ns (the system clock 48 MHz) for a period and pulse-width measurement. The averaging is also possible according to “period count” setting.
The PWM generator mentioned in paragraph 3.3 was realized in this case in 2 channel version (its virtual panel see figure 7).
The simple tool for laboratory experiments in electronics mentioned in the paper was primarily developed for education in electronics. However, it can also be used for the teaching of embedded programming in C/C++. The microcontroller STM32F042F6P6 used here is supported by online IDE Mbed . There is only one difference contrary to the kit Nucleo STM32F042K6, which is supported with Mbed directly, the smaller number of pins. Therefore, it is possible to use only these pins, which are at disposal also in the TSSOP20 case. Other parameters (the flash memory, RAM, peripheries, etc.) are the same. Thanks to this fact, the kit Nucleo STM32F042K6 can be virtually selected in Mbed and only these pins, which are at disposal in the TSSOP20 case, are used by programming.
Considering the microcontroller STM32F042F6P6 contains USB interface including programming support of the boot loader, the software developed by means of Mbed can be loaded from the corresponding Mbed web site and using STM Cube programmer is uploaded directly into the microcontroller using USB. There are not necessary any special software and components, thus it is possible to realize the similar tasks like those ones, which are presented in .
The equipment mentioned above was realized already in several hundreds of pieces. It was used as in the intensive preparatory course “Practical Electronics” designed for school-leavers of secondary schools, so in two subjects in regular laboratory teaching. Thanks to the support of the company STMicroelectronics we can lend the describing kits not only to bachelor students but also students of secondary school, who attend our Embedded Technology Club. The number of laboratory tasks in the electronics branch was created, where the described equipment is successfully used for more than 3 years. It helps both to understand theoretical knowledge gained in lectures and to obtain practical experience by design and development of simple electronics circuits in the framework of individual projects.