Summary This application note describes the PWM software driver technology for capacitive touch wheels and multiple independent LEDs using the MSP430 microcontroller. The solution realizes capacitive touch wheel control through 4 I/O ports, and the I/O port cooperates with the triode to drive the LED to realize the effects of LED breathing and track lights. This solution provides an effective low-cost solution for products that require capacitive touch wheel control and LED tracking display. Introduction As a practical and fashionable human-computer interaction method, capacitive touch technology has been widely applied to various electronic products, ranging from light switches to tablet computers and touch tables. What follows is a test of how the product designer can use his wisdom to make the user interface of the product convenient and concise, while at the same time presenting the product's beautiful appearance, thus bringing a good user experience. LED display is widely used in capacitive touch product design because of its friendly interface and real-time reflection of touch location information. This design uses a large number of LEDs to achieve the special effects of breathing lights and track lights, and can provide design reference for products with adjustment functions such as lighting, volume, temperature and so on. Texas Instruments' MSP430 series of microcontrollers are known for their low power consumption and the richness of peripheral modules. For capacitive touch applications, the PIN RO capacitive touch detection method of MSP430 supports IO port directly connected to the detection electrode, without any external components. The circuit design is simplified, and the MSP430G2XX5 used in this design document supports up to 32 IO ports and can drive more than 24 LED lights to achieve the desired display effect. 1. Capacitive touch wheel implementation The MSP430 capacitive touch wheel solution completes the capacitance detection of 4 channels through 4 IO ports, and the special electrode pattern can realize the design of the runner. 1.1 Capacitive Touch Implementation Principle MSP430 supports a variety of capacitive touch detection methods according to different models. There are RC oscillation, comparator, PIN RO. This design uses the PIN RelaxaTIon Oscillator method. The principle is shown in Figure 1. The chip pin internal detection circuit is controlled by Schmitt trigger. The inverter, the inverter, and a resistor are formed. The oscillating signal is converted into a pulse signal by the Schmitt trigger, and then fed back to the RC circuit through the inverter, and the output of the Schmitt trigger is counted by the TImer_A, and then set. The measurement window Gate gets the result of the count. When the finger touches the electrode, the C on the electrode changes, causing the oscillation frequency to change, so that different counting results can be obtained in the fixed length measurement window. Once the difference exceeds the threshold, a touch event can be triggered by a certain filtering algorithm. . Figure 1 PIN RO schematic 1.2 Runner algorithm The four button electrodes are crossed in a zigzag manner according to FIG. 2 to form an electrode of a runner. The size of the runner can be appropriately scaled according to the needs of the product design. The graphic design of FIG. 2 is suitable for a runner having a diameter of about 30 mm. Figure 2 Runner electrode design When the user operates on the wheel, the electrode at the corresponding position of the finger will obtain the highest signal value, the channel adjacent to the finger will have a relatively high signal value, and the signal farthest from the finger will have the smallest signal value, as shown in the figure. 3 shows: Figure 3 Signal values ​​measured on different electrodes when touched by a finger At this time, the position of the finger on the runner or the slider can be calculated by using the difference of the signal values ​​on different channels. The location calculation steps are as follows: a. Find the electrode with the largest signal among the 4 electrodes by sorting method Index = Dominant_Element(groupOfElements, &measCnt[0]); b. Add the signal of this electrode to the signal of the adjacent electrode posiTIon = measCnt[index] + measCnt[index+1] + measCnt[index-1]; If the result of the addition is greater than the threshold, it is considered that a touch event is generated, and the subsequent position calculation is continued. The reason for adding the front and rear signals is that the finger may be in the middle of the two electrodes during the operation, so that the signals obtained on the two electrodes are not very high, and the signals need to be added to be compared with the threshold. c. When calculating the position coordinates, first obtain an approximate position according to the index value, and then correct according to the adjacent electrode signal strength of the index to obtain the final coordinate value. posiTIon = index*(groupOfElements-"points/groupOfElements-"numElements); Position += (groupOfElements-"points/groupOfElements-"numElements)/2; Position += (measCnt[index+1]*(groupOfElements-"points/groupOfElements-"numElements))/100; Position -= (measCnt[index-1]*(groupOfElements-"points/groupOfElements-"numElements))/100; d. For the case where the index is 0 or 3, the code needs to be processed separately, but the calculation method is consistent with the above. Here, the resolution of the runner, that is, the number of segments divided by the runner is set according to points. Assuming that the user only needs to distinguish 24 positions, the points can be set to 24, and of course, can be set to 64, 128, or even Higher, depending on the size of the runner, the design of the electrode pattern and the number of electrodes, for example, a high precision like 1024 is required, and the number of electrodes needs to be increased from 4 to 8 or more. Cable Sleeve,Harness Pattern Braided Tube,High Flame Retardant Woven Network Pipe,New Woven Mesh Pipe Shenzhen Huiyunhai Tech.Co., Ltd. , https://www.cablesleevefactory.com