
In NSTU, where I study at the Faculty of Energy, the bulk of laboratory work takes place at very old stands. Invalid readings of measuring devices, constant failures and breakdowns, and simply inconvenient control causes a lot of inconvenience and hinders the study of physical processes under study. In this regard, I and my teacher had the idea of improving such stands with the help of microcontrollers.
The idea arose after laboratory work, in which it was necessary to measure the rotational speed of an asynchronous machine. These measurements were made using an optical tachometer, which was available in one copy on three stands. Waiting for their turn spoiled the impression from the experiments, in connection with which one of the teachers offered to create an analogue of the used device.
It was based on the Atmega32 microcontroller. A reflective ZX-03 sensor was found with which it was possible to track the frequency of the appearance of a white mark on the rotor shaft, and a small LCD display to display information. The microcontroller was programmed using an improvised programmer working through MAX-232 and AVRprog. The program was written in C using AVRStudio.
')
The algorithm of the device is quite simple. The sensor generates a specific signal depending on the reflectivity of the surface to which it is directed. The microcontroller conditionally divides the received signals according to the level of radiation into dark and light ones. The white mark applied to the rotor shaft is perceived as a light band, while the rest of its surface is perceived as dark. Measuring with the internal timer, the time of passing the black and white stripes, the microcontroller gets the time of one turn of the rotor of the machine, and then calculates the frequency and displays the result on the display. To improve the accuracy of measurements, the turnover time is first summed several times, in order to use its average value when calculating the frequency. The following is the code directly measuring:
TIM16_WriteTCNT1(0); // while (1) // { adc = Read_ADC(); // if(adc>0x280) // , break; } while (1) // { adc = Read_ADC(); // if(adc<0x280) // , break; } // , , counter=TIM16_ReadTCNT1();
TIM16_WriteTCNT1(0); // while (1) // { adc = Read_ADC(); // if(adc>0x280) // , break; } while (1) // { adc = Read_ADC(); // if(adc<0x280) // , break; } // , , counter=TIM16_ReadTCNT1();
The scheme of the device turned out to be quite simple and was assembled on a breadboard, and then placed inside the box from the shoe brush.
After assembling the device and writing the program, it became clear that we do not use most of the capabilities of our microcontroller, for example, EEPROM, interrupts, etc. In this regard, it was decided to expand the capabilities of the device, adding to it the function of memorizing the maximum measured value and the ability to control the short circuit time of the asynchronous machine that was needed for the laboratory work.
Using the EEPROM to memorize the measurements made was easy. The standard library AVRStudio includes simple and intuitive functions to manage this type of memory.
Implementing a short circuit control was a little more difficult. For this, we had to create a cascade of two relays of different power, one of which is inside the tachometer and controls the other more powerful relay, which directly switches the short circuit. In addition, interrupts were applied to make closures, which allowed switching to occur without interfering with the operation of the tachometer itself.
It is also worth adding that the automation of short circuits was caused by practical necessity, as before the closure was carried out by pressing and holding the button by the student. Since the duration of this mode was not limited, the equipment used was at serious risk. Automation of this process using a microcontroller has significantly increased the reliability of the laboratory setup.

ZX-03 Reflector Sensor

Tachometer assembled on breadboard

Working tachometer

Device placed in the shoe brush box
The result was a device comparable in measurement accuracy with the factory tachometer that was available, but overtaking it in functionality and relatively cheaper to manufacture. It greatly facilitated the work with the laboratory installation, as well as increased its level of reliability and, in general, breathed new life into the stand.