-
2022-09-23 10:22:29
Rotating LED screen display controller design
Among all kinds of equipment, display equipment occupies an important position. Without display equipment, it is like people without eyes, and many inner things cannot be seen. Display devices are very important and common, but their appearance is always so monotonous, like a model. The rotating LED screen has attracted the attention of electronic enthusiasts with its novel, 360 ° viewing angle. This project combines touch technology with rotating LED screen through the main control chip STM32F103 , which can realize clock transformation, and can also use touch technology to play some small games on the rotating LED [1], so that the rotating LED is no longer just a single Ornamental technology.
Rotary LED display is a new type of display that realizes graphic display by synchronously controlling the position and lighting state of light-emitting diodes (LEDs). It has developed rapidly because of its novel structure, low cost and 360° viewing angle. . At present, common LED displays are displayed in scanning mode. The realization principle is to control different batches of LEDs to light up in turn in different time periods. According to the visual persistence characteristics of the human eye, when the scanning frame frequency reaches 24Hz At the above time, the human eye does not feel the scanning process, but a stable image. The rotating display screen realizes the display of graphics by controlling a row or a column of LEDs to quickly move the position and change the lighting state. If the LEDs are cyclically changed fast enough in each position, a stable image can also be displayed. The POV principle (that is, the principle of visual retention) is used in the display screen, and the advantage is that a display screen that can only be realized by a large number of LEDs in the traditional way can be realized with a small amount of LEDs. The LED is controlled by the microcontroller, and the touch button provides user interaction with the system. The landscape of the rotating LED floating in mid-air brings visual enjoyment.
Based on this situation and principle, this paper proposes the design of a rotating LED screen display controller based on TI's TLC5947 driver chip and STM32F103. The rotating LED screen adopts the principle of human visual frequency retention. Under the precise control of the microcontroller, the rotating LED virtual screen produced can fully realize a new type of display technology that can only be achieved by a large number of LEDs in the traditional way by using a small number of LEDs. The rotating three-color full-color LED is based on the RGB principle. By changing the hue, saturation, and intensity of the three colors, it can achieve up to 36-color true-color picture display, making the display more dazzling. Compared with flat-panel LED display and other display technologies (such as CRT, LCD, PDP), the rotating LED screen has several obvious advantages such as low cost, high resolution and low power consumption.
1 System hardware design
The STM32F103 is connected to the LED through TLC5947 to control the display of the LED light on the rotating board. For example, the single-chip STM32F103 can control the LED light to rotate to display the clock or various graphics. If conditions permit, it can display some simple games. The LED is connected to the ARM processor, and the touch signal processing by the ARM processor is used to realize the change of the display style of the LED light. Calibration operation. The TLC5947 drives the rotating LED screen display control circuit as shown in Figure 1.
Rotating LED screen display controller design
Fig. 1 TLC5947 drives rotating LED screen display control circuit
1.1 Introduction to STM32F103
Selected STM32F103 controller, STM32F103 is an enhanced series, the highest operating clock frequency can reach 72 MHz, with ARM CortexM3 core, 128 ~ 256 KB Flash, 20 ~ 48 KB RAM, 8 MHz CPU crystal oscillator, 32. 768 kHz RTC crystal oscillator and Rich peripherals (64 fast I/O ports) and 4 GB of linear address space. Emulators used by ARM are expensive, while debugging tools for microcontrollers are very cheap. In contrast, the CortexM3 reference microcontroller uses one pin for debugging, which saves a lot of manpower and material resources. CortexM3 integrates most of the memory controllers, so that the Flash can be directly connected outside the MCU, which reduces the design difficulty and application barriers. The CortexM3 processor combines a variety of breakthrough technologies, making it possible to achieve a combination of low power consumption, low cost, and high performance (or both). Programming supports ISP download function, can be powered by USB port and JLINK emulator, it is very convenient to use.
1.2 Introduction to TLC5947
TLC5947 is a 24-channel, 12-bit PWM pulse width modulation LED driver chip introduced by TI (Texas Instruments). The TLC5947 is available in an ultra-small 32-pin QFN advanced package. It provides precise constant current value for LED, and the difference between channel and chip is only ±2%; high-speed transmission rate (30 MHz for single chip, 15 MHz for cascade); interleaved time lag between output channels , to avoid transmission errors; the chip has a temperature detection system inside, in order to protect the chip when the temperature of the chip is too high, it will automatically disconnect all output channels, when the temperature returns to normal, the chip works normally; the chip supports cascading, Multiple chips can work together to drive larger-scale LED display screens. The current current value of the 24 channels is set by the resistance between the external IREF and the ground, and the resistance in the driving circuit is determined by the current of the driven LED lamp. The chip has a wide operating voltage of 30~55 V and contains a 4 MHz internal crystal oscillator. The TLC5947 is suitable for driving full-color LEDs and displays.
1.3 LED Display
Tri-color (RGB) LED lights are used to realize multiple color light sources and colorful output. At the same time, the LED itself also has the functions of considerable stability, high efficiency, high single-color purity, and adjustable light intensity. The LED is connected with the ARM processor, and the touch signal processing by the ARM processor is used to realize the change of the display style of the LED light, from the basic state of the pointer clock to the digital display type, and to change the background of the display, and also to change the time. calibration operation.
2 System software design
2.1 Design of point-bright-point line circle and its algorithm and formula
The point design mainly applies the rectangular coordinate to the circular coordinate transformation to light the lamp at any position through the coordinate transformation. The line design is derived from the point design. On the basis of the point design, the Bresenham straight line algorithm is used to draw the required straight lines, oblique lines and curves. On the basis of online design, functions such as rectangle drawing, drawing and filling are derived.
After the program is initialized, it is defined to convert from Cartesian coordinates to polar coordinates, and convert radians to angles in the program. Considering the input of negative data during conversion, adding 360+0.5 is to optimize the program and prevent errors. In the program, the distance r=x2+y2, the angle a=180×arctanxyπ+360+0.5.
The conversion algorithm from Cartesian coordinates to circular coordinates is as follows:
void ConCoor(int x, int y, int *rad, int *angle) { double r, a; r = sqrt(x*x+y*y);
a=(180*atan2(x,y))/PI+360+0.5;
if(a>=360)
a=a-360;
(*rad)=r;
(*angle)=a;}
After the rectangular coordinates are converted, you can set the on and off of the point, and then use the Bresenham straight line algorithm to draw a straight line.
The overall flow of the program is shown in Figure 2. After the system is powered on, first read the initial state of the system, set the working state of ARM and TLC5947, and turn on wireless communication; then wait for the rotating screen to stabilize, initialize the menu, and wait for the input command; use the Qtouch control to transmit the command to the STM32F103, and execute the command (user interactive process); execute user command operations.
2.2 TLC5947 chip timing
The timing sequence of TLC5947 is shown in Figure 3. There are 4 main control pins of the chip: data input terminal SIN, external clock input terminal SCLK, grayscale register control terminal XLAT and output control terminal BLANK. The degree data is sent to the SIN terminal, and then the data is written into the grayscale data shift register inside the chip through the control clock signal SCLK, and then the internal grayscale of the chip TLC5947 is realized by controlling the high and low level conversion of the control terminal XLAT of the grayscale register. data update. When the level of the XLAT pin changes to produce a rising edge, the internal grayscale data of the TLC5947 will be updated once, that is, the data will be rewritten in Grayscale LatchData in Figure 3. The data output of the chip is divided into two parts, one is serial data output and constant current source data output. The serial data output is connected after the grayscale data shift register. When the data of the register is full of 256 bits, the data can be output from the serial data port SOUT through a DQ flip-flop according to the change of the SCLK clock. It is the data input of the next-level chip when the chips are cascaded; and the constant current source data output OUT0~OUT23 is jointly controlled by the output control port BLANK and the internal clock Oscillator Clock of the chip. The output current can be controlled by the chip's internal clock. The VREF pin is externally connected to the ground resistance to control, according to the current limiting parameters of the external LED, to ensure the normal operation of the LED. The 3.2 kΩ resistor is used in this system, so the control of the chip is mainly the control of 4 pin ports, which is relatively simple and convenient to operate.
Rotating LED screen display controller design
Figure 2 The overall flow of the program
3 Conclusion
In the experiment, two cascaded TLC5947 chips were tested by the main controller STM32F103. The peripheral circuit was connected to a three-color LED lamp, and the external power supply voltage was 5 V stabilized source. After the conversion, the power supply voltage of the system was 3.3 V stable. pressure source. When the corresponding program control word is written, the three-color LED light can be displayed correctly, and the two working modes of single color and mixed color are successfully realized. Moreover, the change time between LED lights can be controlled by the program. As long as the clock frequency of the main controller is appropriate, the change time is beyond the ability of human eyes to recognize. In this way, a full-color LED screen can be realized by changing different program control words. the design of.
Rotating LED screen display controller design
Figure 3 TLC5947 timing diagram