Also talk about POV rotating LED production, experience and technical points.

      Recently, I played with single-chip microcomputers and saw the rotating LEDs made by the experts on the Internet. I was itchy and decided to make one myself. Because I need to go to work during the day, I am very busy, so I can only tinker at night, so after nearly a month of tossing, I finally succeeded. I wrote down the process and experience. One is to make a record for myself in the future, and the other is to share. I hope that friends who are destined to see it can help you.

      First, the last finished picture:

    

    Support scrolling display of up to 15 Chinese characters. . . Support clock display, two states take turns.

    It supports one-click modification of text and time on the host computer, and a small software is specially written in VC:

    

     Well, the following is the design idea and production process:

    Using STC15FK60S2, 24M internal oscillation, peripheral chip a DS1302 clock chip, a MBI5026 LED driver, DS1302 chip is not much to say, there are a lot of information on the Internet, MBI5026 is good, supports 16 LED cross-current output, communication and Enable/Disable A total of only 4 IO ports are needed, which is suitable for the production of rotating LEDs. The hard disk motor removed from the old hard disk used for rotation, this thing has a fluid dynamic bearing, brushless DC, high enough speed, and the key is silence.

    The difficulties of the whole project are as follows:

    1. Hard disk motor drive. I use DRV11873, this chip is also a good stuff, a few simple peripheral components, can drive BLDC (three non-Hall DC brushless motors), support PWM input speed regulation, if no PWM signal is given, the default Rotate at the highest speed, I originally drove at the highest speed, but found that if the speed is too high, it is difficult to control the interruption of the microcontroller, because the time spent in one revolution is too short, and each revolution must be divided into hundreds of points Used to drive the LED, so the interrupt processing must be shorter and harder. We had to add another NE555 to do PWM signal output, and adjust the duty cycle with the potentiometer to reduce the motor speed.

    2. Wireless power supply. Because the circuit board is always turning, it is more troublesome to supply power. I searched a lot of information on the Internet, but they were not satisfactory. Later, I changed the search keyword from "wireless power supply" to "wireless charging". Damn, there is a ready-made chip available-XKT-510! Looking at the Chinese materials, there are actually more than 10 sets of typical application circuits in it, haha, that's it. It is more troublesome to wind the coil by itself. Later, a certain treasure customized 2, and it cost 20 oceans plus shipping.

    3. Adaptive speed. Let me talk about the detection of the speed first. I use a pair of split-type infrared through-radiation switches. After adding a pull-up resistor, it is directly connected to the external interrupt 0 port of the single-chip microcomputer to judge whether it has rotated a circle. It mainly plays the role of positioning. . After the hardware is built, the first version of the software written is not self-adaptive to the speed, and it depends entirely on the delay, which is very bad, ha ha. When the rotation speed changes, the width of the characters will change, and it may become chaotic, and the clock display will be even worse, and it is impossible to accurately draw 60 scales. After searching the Internet for a long time, I only saw a rotating LED made of a bicycle by a master. He made the timer smaller, and then judged how many times a circle was interrupted, and then divided it by the number of positions to be displayed to locate. I wanted to learn from his method, but it didn’t work, because although I reduced the speed of the hard disk, it was still n times higher than his bicycle speed, too small a timer would increase the CPU load, and the CPU took more time Dealing with interruptions leaves less time to do business, which reduces efficiency. Later, I had a flash of inspiration, and I used my own method: use two timers (I use timer 0 and timer 3, because the serial port is used for timer 1, and timer 2 is also used, and I will talk about it later), and the timing Timer 3 is only used for timing, not to generate interrupts. Set the initial value of timer 3 to 0, 12T mode, so that it will be interrupted for about 32 milliseconds under 24M. The key is that when the infrared switch detects that it has turned a circle In the interrupt processing of the timer, set it to 0 again. In fact, it does not take as long as 32 milliseconds to make a circle. That is to say, the interrupt of this timer will never be triggered in principle. Why do you do this? ? Hehe, in fact, a clever method is used here. If you don’t understand it, you need to review the calculation of the initial value of the timer: in the processing of INT0 (infrared switch), first pause timer 3, and then look at its TH and What is the value of TL, that is, the count of running a full circle. Subtract this number with 0xffff, which is the time count required to run a circle, and then divide it by the number of columns you want to display, and then subtract it with 0xffff. It is the initial value that you should set for timer 0. In this way, after one revolution, timer 0 will be interrupted exactly n times, and n is the number of times you want.

     4. Clock display. In fact, this display is not difficult. Using the above method, let the timer 0 rotate for exactly 60 times, and then draw the scale, hour hand, second hand, and minute hand. The difficulty is that the DS1302 is very slow, and it reads the time every time it is interrupted. If so, it will be too late. This method is adopted. Since the text display and clock display are carried out alternately, the current time is only read once at the time of the alternation, and then the timing 2 is used to interrupt every 20 milliseconds. After 50 interruptions, the second hand is counted and the second is judged. If it is greater than 59, then increase the minute hand and hour hand timing according to the situation, which not only ensures the accuracy of the time (each state switching will read from the DS1302 again, which is equivalent to correcting the time), but also ensures the display of the clock at high speed.

     5. Changing characters and saving characters on the upper computer. The upper computer software is written in VC, and the HZK16 Chinese character library is linked to the program as a resource. When parsing the text, the text is first converted to ANSI code (the program is compiled with UNICODE), and then the font is calculated according to the area and bit code in the Chinese character library. Offset (16*16 dot matrix for each Chinese character, which is 32 bytes), lock the HZK16 resource, pointer + offset, it is the font. Since the LED is selected to be displayed in columns, a little processing is required, that is, to scan by columns, and finally form the font data and send it to the single-chip microcomputer (for the calculation method of HZK16 fonts, please use Baidu). On the microcontroller, use the built-in EEPROM of STC, which has two sectors, and one sector is 512 bytes. Since sectors must be erased before writing, but erasing can only be done by sector, so simply use only one sector. Among them, the first two bytes are fixedly used to store the length of the text, which is actually the number of columns of the font, which is convenient for calculation when displaying, and then the font data. In this way, a total of (512-2)/32=15 Chinese characters can be supported.

     Six, dynamic balance. It is to ensure that the entire circuit board is balanced after turning it up. If one side is heavy and the other is light, the vibration will be severe. In fact, I think this is the most difficult, because unlike software difficulties, it can be solved through some technical skills, which is very troublesome to solve. I adopted the following method: hang the circuit board with a thin rope. After two times, I can roughly determine the center of gravity, and then increase the counterweight by myself. It is not very accurate, but there is no other good way. In the end, the entire circuit board still vibrated a little when it turned, and I was too troublesome to fine-tune it. If anyone has a skill or a good way to do this, please let me know. Thanks.


    Next, let's talk about the principle and production process:

   Schematic:

    This is the schematic diagram of the rotating part:

    Schematic of the base:

  

   All component packages are made by ourselves. PCB diagram:

  

Need to explain:

   In the original design, the wireless power supply receiving part used 7805 to stabilize the voltage, but it turned out that the effect was not very good. When all 16 LEDs were fully lit together, the voltage was not enough. Later, referring to the information of XKT510, the receiving circuit recommended by him was used, but the PCB At that time, the proofer had already done it, and there was no modification, and the finished circuit board was directly glued with 502. .

   Finished circuit board drawing:

  

Assembled picture:

Guess you like

Origin blog.csdn.net/sdhexu/article/details/68942503