Maybe from a motor encoder or whatever and measure the frequency then convert it to analog voltage signal at the output. First of which, is the maximum measurable motor speed in RPM. After deciding on the maximum speed range, we can figure out the frequency of the input signal to be measured.
By having all this information together, we can determine the maximum frequency of the input signal that our microcontroller can expect to read from the encoder sensor. What is the minimum motor speed change that induces a change to the output voltage?
For achieving the analog output functionality, we can use an external DAC chip or even use a microcontroller with a builtin internal DAC module. At this point, we want to find out what is the required PWM resolution in order to achieve the previously determined conversion resolution. It turns out to be 10Bits as you can see from the figure below.
Then convert the reading to an analog voltage at the output. Very early, unfortunately! The minor issue in using an op-amp as a buffer is the null offset.
Could you notice in the figure above the very tiny voltage offset for the output? Good mitigation for this issue can be adding a null-offset resistor according to the op-amp datasheet. We can pump up the op-amp positive rail up to maybe 8v which is enough to eliminate the early saturation issue without the need to get an expensive op-amp.
The simulation files will be included in the project downloadable attachments folder at the end of this article. Note that the output capacitor can be anywhere in the range 10uF to maybe uF or more. The larger this output capacitor the lower frequency needed to be feed into the charge-pump. Which is quite good to keep this section of the system in balance.
And the output voltage is roughly 8. Now, the question is how can we generate the oscillating clock signal required for the charge-pump? Can we use a timer interrupt to toggle a GPIO pin in order to achieve this required clock output? The solution for this challenge that I wanted to show you is that you can use the internal comparator module inside the microcontroller as an oscillator. After being done with the top-level design and planning for the project, we can now proceed to the firmware design step.
In which, we decide on the required software components and the layers in the whole project. As you can see in the figure below, there are only two layers in this simple architecture. And the MCAL layer Microcontroller Abstraction Layer which includes all the hardware peripherals drivers libraries which directly interacts with the low-level hardware registers of the machine.
Let me read out aloud what we can see in this diagram. And therefore, the frequency is captured. And first of all, getting the hardware drivers ready. And keep in mind that only fundamental functionalities are implemented in code just to run the target application at the end with the least effort possible.
I have to disclaim again that all drivers and libraries not generic enough to support any further work beyond the scope of this project. The application layer has only 1 file which is the main.
And the MCAL layer directory has the following sub-directories for the hardware basic drivers. That initializes the different hardware peripherals and run some basic functionalities required by the application layer. For the application code main.
The first thing to note, that this system is an interrupt-driven one. Which means the main super loop is empty. And the RC networks are used to remove the frequency dependent ripples. The diagram below shows the basic circuit of frequency to voltage converter using op-amp and RC networks:. The input frequency given to this converter can be in the range of kHz.
And the output can be between 0 to V. The above block diagram shows a frequency to voltage converter. The circuit charges the capacitor to a certain level. An integrator is connected in it and the capacitor discharges into this integrator or a low pass circuit. This happens for all the cycles of the input waveform. The precision switch and the monostable multivibrator generate a pulse of a specific amplitude and period which is fed into the averaging network.
Hence we get a DC voltage at the output. This is the circuit diagram of frequency to voltage converter using LM This IC is basically a voltage to frequency converter but it can be used as a frequency to voltage converter.
Its applications also include A to D conversion and long term integration. In this circuit, lm is used to convert frequency into voltage. The voltage on the output is proportional to the frequency at the input. It is an 8 pins IC.
The source is connected to pin 8 and supplies 15V DC. Pins 3 and 4 are connected to ground. The input frequency is given at pin 6 and the output voltage is taken from pin 1. The input frequency is differentiated by using the resistor R7 and capacitor C3 and then the resultant pulse train goes to pin 6.
The timer circuit gets triggered by the built-in comparator circuit in the IC when the negative edge of the pulse train appears at pin 6. The current flowing out of pin 6 is proportional to the values of capacitor C1 and resistor R1 which are also known as the timing components and the input frequency. Therefore we get the output voltage across the resistor R4 which is proportional to the frequency of the input.
The value of the resistor R3 is dependent upon the supply voltage. These converters are used in wide range of applications such as communication, power control, measurement and instrumentation systems etc. A digital tachometer is an electronic device which measures the rate of rotation of a wheel. They display the rate of rotation in the form of voltage which is why a frequency to voltage converter is required in them.
The diagram below shows a digital tachometer. The rate of occurrence of some events can be measured by a rate meter. It counts the events for a certain time period and then divides the number of events by the total time and hence we get a rate.
This is the theory of operation of a simple tachometer. We are using an IC LM for this tachometer circuit. The capacitors C1 and C2 and the resistor R1 have specific values according to the circuit requirements.
0コメント