Somehow I got into the hands of the old dial gauges from the old tape recorder, and I decided to breathe new life into them, making of them “hardware widgets” for displaying the processor load and computer RAM.
I will say right away that I do not pretend to originality, for sure I have already done this before, I just want to talk about my experience.
First of all, I replaced the original scales with decibels on my own, for this I had to break the case. ')
Then I quickly raised the fee:
In the center of the ATMEGA8 microcontroller, it is he who controls the arrows using hardware PWM. In order for the indicator to go off scale, quite a small current is enough, so we turn them on through a resistor in a couple of kilo. The indicators have no built-in illumination, so that they look beautiful and can be seen in the dark, on the board I placed three orange LEDs on the spot over which I planned to glue them. At the same time, the LEDs can be turned on programmatically, in theory it is even possible to change their brightness using already softwired PWM.
It was decided to connect the device to the computer via USB; for this, the FT232 chip is used. Yes, you can do without it, using software USB, but I do not trust it - it works very unstable on some controllers. Through the FT232, the device is seen as a virtual COM port, into which we will write data.
First of all, the bootloader was sewn into the microcontroller, after which the programmer was removed into the box - it became easy to update the firmware directly via USB. This sweet moment has come when the device is ready, and it remains only to write software.
After that, we simply write to the OCR1A and OCR1B registers the values that need to be shown, namely, what we get by USART. It was experimentally established that the arrow is at the maximum value, when the number of registers is more than 90. Then it was a matter of simple mathematics. The application for the PC is also not very complex - you just need to get the percentage of CPU usage with memory and send this data to the virtual COM port.
At first I wanted to embed these indicators directly into the five-inch bay on the system unit, but it stands under the table, so the device was rendered separately.
The arrows are very nice twitching. It turned out very convenient.