![封面.jpg](//image.lceda.cn/oshwhub/a0953a29bb414e2b8e73496f0ff0c9d1.jpg)
### **This project participated in the 2024 color silk screen printing event**
Product display video backlink:[https://www.bilibili.com/video/BV1hrBtYAE5e/?spm_id_from=333.1007.0.0&vd_source=c99f4cc51a936036bca99830e36262da](https://www.bilibili.com/video/BV1hrBtYAE5e/?spm_id_from=333.1007.0.0&vd_source=c99f4cc51a936036bca99830e36262da)
### **Preface**
At present, inheriting traditional culture and creating national tide works has become the main theme of the times. The continuous innovation of Guochao literary and creative works reflects our increasing cultural self-confidence. As a dazzling treasure in traditional Chinese culture, the lion dance carries a profound and beautiful auspicious meaning. Every festive celebration, the lively lion dance is jubilant, and everywhere you go is filled with a festive atmosphere of auspiciousness, driving away evil spirits and avoiding harm, vividly showing people's ardent expectations for a better life, and also making this traditional folk custom deeply rooted in the hearts of the public.
![image.png](//image.lceda.cn/oshwhub/0f96398160f242d2bb919c29a3df6f63.png)
---
## **1. Introduction of the work**
Combining traditional culture and modern technology, the lion dance is a rare home goodness with multiple functions and beautiful meanings. It carries the weight of history, and brings a convenient modern life empowered by science and technology, which is the best choice for decorating the home, conveying blessings and enriching life.
#### **1. Cultural inheritance, ingenuity and ingenuity to shape the lion [Past Life]**
The lion dancing elephant ornaments not only carry the unique charm of the lion dancing culture, but also can appreciate its different charm at close range. It is full of ingenuity and ingenuity in the production process, with the intention of perpetuating this precious culture.
In terms of production techniques, the multi-layer board superposition technique is used to cleverly break through the limitations of the plane image, give the lion dance a lifelike three-dimensional form, and complete a wonderful leap through the space dimension.
In terms of artistic image, the three-dimensional posture highlights the agility and momentum of the lion dance. The bright eyes of the dancing lion are scattered by the light, and the three-dimensional lion's mouth and mane are relaxed, showing majesty and domineering. No matter from which angle you admire, you will show its auspicious image vividly.
![微信图片_20241124185811.jpg](//image.lceda.cn/oshwhub/2e6cfa2281274ea3b6cdbb5ef990efcb.jpg)
#### **2. Fusion of science and technology, rejuvenation of traditional elements [This life]**
This work deeply integrates the traditional culture of lion dancing with contemporary technology, and successfully injects new vitality into traditional elements, thus becoming a good household object with both cultural charm and practical value. In particular, this handicraft with artistic aesthetic interest can no longer only be "shelved" and "can be viewed from a distance but not blasphemed" like other works, thus giving people a high sense of distance; Rather, it makes it into the life of ordinary homes, turning traditional culture into a physical entity and becoming a companion between gestures.
With the help of JLC's color Silkscreen technology, this work has completed the cross-border of the field of PCB circuit board and art drawing board, giving traditional culture and artwork practical and convenient attributes, whether it is to create a warm and comfortable home atmosphere, or to assist in completing some daily activities, the lion dance elephant can be seamlessly integrated into people's rhythm of life, and truly become an accessible, convenient and easy-to-use life companion, which perfectly fits the dual demands of people's pursuit of high-quality life and love of inheritance culture. It highlights the unique charm and value of the new national tide literary and creative works.
![微信图片_20241124185815.jpg](//image.lceda.cn/oshwhub/0bb1055b62524ce99a8b3df7a1c6e136.jpg)
From the perspective of practicality, the integration of science and technology has made the lion dance elephant no longer just an ornament for viewing, but transformed into a practical and good thing that can effectively meet the diverse needs of people's lives. It takes into account the functions of night light, breathing light, MP3 player, and at the same time is a strong artistic craft.
From the perspective of convenience, it is not just a lamp and a music player, but a smart home product that can be truly realized with the help of the Internet of Things. Through the external extension module, it will completely get rid of the shackles of traditional interaction methods, you can laze on the sofa, just with the help of electronic devices or a simple conversation, the lion can immediately respond to your needs.
#### **3. Multi-functional, warm heart to accompany every moment**
##### 3.1 **Night lights adjust to your mood**
When night falls, touch the switch on the lion and the soft light will slowly emanate from it, like moonlight. You can adjust the brightness of the light to suit your needs, and the light can change freely between light and dark. It is like a bright but soft intimate light, which accurately illuminates your every need and silently accompanies you through every beautiful night.
##### 3.2 **Music enjoyed to the fullest**
The Lion Awakening has a built-in MP3 playback module, which is like a music magic box with endless treasures. You can save your favorite songs in advance, or add other expansion modules to give them unlimited communication and play music with just a tap. The audio interaction function equipped with the first generation of Dancing Lion Rayxiang products is only a prototype of function expansion, which reserves an adjustable expansion of the female row to provide subsequent developers with a playable space for further optimization of music sound quality, lighting interaction, etc.
##### 3.3 **Remote and convenient control [future]**
This product expands a set of UART serial communication interfaces, which can be connected to the Internet of Things with the help of host computer modules, wired and wireless communications. At the end of the product project, the case of using the AI8051U development board as the host computer was open-sourced, which can realize simple control of lighting and music functions. Geeks can use this set of interfaces to achieve a series of functions such as intelligent voice control, wireless control, and access to smart home systems.
#### **4. Interesting interaction, auspicious is often accompanied by happiness**
If you don't want the cumbersome functions mentioned above, and only need it as a companion to the night light, then the lion awakening elephant also has a unique easter egg design, which is to control the light by touching the lion's nose to get the auspicious and full of constant companions.
`In the deep context of Chinese traditional culture, the lion has always been regarded as a symbol of auspicence, and the nose is considered to be the key to the gathering of reiki. Touching the lion's nose means "money to money, road to road", and also represents the awakening of the aura contained in auspicious, so that you can feel the sincere wishes of the producer in every interesting interaction, hope that good luck and fortune will come to you on the initiative, and expect you to have good luck, everything goes well, happiness and well-being.`
![微信图片_20241124185807.jpg](//image.lceda.cn/oshwhub/8c82e522fc58459c9c6e3839f57cdf9e.jpg)
(This article is based on the creation of artificial intelligence bean bags, and the works are further sorted out, and finally this article is made.) It seems to have been written as an argumentative essay.)
---
## **2. Hardware implementation**
There are two schemes designed for this work, the first scheme uses a three-color LED and a single board puzzle scheme, which can realize the stepless dimming function and reduce the production cost at the same time (but it may not pass the production review); The second solution is a variety of board solutions, the finished product is more atmospheric, and at the same time expands the functions of the Internet of Things, simplifies circuits and components, and reduces the difficulty of soldering.
#### **1. Schematic description**
##### **1.1 Touch Control Circuitry**
![20241125-135635.jpg](//image.easyeda.com/pullimage/MljDSzG5pgjZwsg6gq9yArHBZVLB9LEXXkGxsLeE.jpeg)
It uses a SGL8022 module (the favorite brainless chip of color silk and lighting boss), with its own multi-mode stepless dimming function, and the peripheral circuit is simple.
- Key points explained
> 1. The VC pin is connected to different capacitance capacitors to achieve different media touch;
> 2. OPT1/OPT2 is the mode selection pin, and the mode is switched through different high and low level feeding;
> 3. T1 is the touch pin, if the circuit board is in the touch range, it can connect the copper area;
> 4. SO is the lighting control circuit, and the external transistor realizes high-power lighting control.
- **Realize touch control in different media**
![1.png](//image.easyeda.com/pullimage/6nJh7fordHrZJr5OfQIuHgbsqADIak5M84qN2ntO.png)
- **Implement different control modes**
![2.png](//image.easyeda.com/pullimage/xZYH2P0BwXgceua8WG84UWII4W1PUyqyxzwkbOqW.png)
- **Select the contact position**
![3.jpg](//image.easyeda.com/pullimage/eUOyD6lZLy7dNKs5bjW4pXMFGhACIdJom5go474Z.jpeg)
Since the product is a multi-layer board (multi-PCB stackup in the true sense of the word), three sets of touch areas are designed:
> 1. In-situ touch of the bottom plate: at the back of the lion's head, the default connection line;
> 2. Nose touch: Connect to the bottom plate through two sets of SMD 2pin headers, and connect to the 0Ω resistor of R4 (single-board solution) or R8 (multi-board solution) when using this function;
> 3. Bottom text touch: Connect to the baseboard through a set of SMD 2pin headers, and connect to the 0Ω resistor of R3 (single-board solution) or R7 (multi-board solution) when using this function;
> 4. It is recommended to choose at most 1 set of wiring for 2 and 3 to avoid accidentally touching the switch light.
##### **1.2 LED circuits**
###### **1.2.1 Scheme 1: three-color stepless dimming circuit**
![image.png](//image.lceda.cn/oshwhub/c1f61cf3a8eb4c6487120aa0bb5d4858.png)
- Key points explained
> 1. Two different schemes were tried, one resistor in series and one resistor per lamp in series, and it was concluded that the limited current resistor 0603 package had a small power effect, the former lamp was very dim, and the latter had a certain illumination;
> 2. Current limiting resistance calculation: According to the manual, the Vf of the tri-color lamp is different, according to the nominal current of 25mA, the 5V input time limit current resistance should be (5-Vf)/25mA. If you want to unify the maximum lumen of the tri-color lamp (to avoid the color shift of the tri-color lamp due to the large lumens of a certain color lamp when it is fully on), you need to find the manual to determine the current at the relative lumens, and then determine the resistance value.
- **Optional three-color light control circuit**
![image.png](//image.lceda.cn/oshwhub/5daaac9adb3647c3934662ac4b26b954.png)
It can be connected to an external PWM pin, or H2 can be replaced with three adjustable resistors to achieve stepless dimming.
###### **1.2.1 Scheme 2: Ceramic filament circuit**
![4.jpg](//image.easyeda.com/pullimage/Ek82Kk2bEM9EtYFztDnsFeWWBgIvb1nq05G3l16a.jpeg)
- Key points explained
> 1. Using 26mm long ceramic filament, 2700K warm yellow light, the measured illuminance is relatively bright;
> 2. According to the experience of other open source bigwigs, the current limiting resistor is determined to be 22Ω (who will tell me why);
> 3. Although the first solution does not have the stepless dimming function, the number of components is greatly simplified, and the difficulty of welding plummets.
##### **1.3 MP3 circuit**
![5.jpg](//image.easyeda.com/pullimage/YPQL6lhedMzYiPTVJSS9Bdd4WYPXx9H0VCFYZdpq.jpeg)
![6.jpg](//image.easyeda.com/pullimage/UyX4POhDEQM12rMPte2jnQQXSQP78XUjhSoVJstp.jpeg)
- Key points explained
> 1. Choose mini MP3 module DF Player (may also be other products of the same circuit), support up to 32G memory card, support mainstream sampling rate, support MP3, WMA, WAV format music, the module comes with a power amplifier within 3W, and you can make sound by connecting an independent small speaker;
> 3. It supports three control modes: one is to cut songs and adjust the volume through IO1 and IO2 high and low levels, the other is to use the serial port to connect to RX/TX to realize the communication control of the host computer, and the third is to use the matrix keyboard ADKEY to achieve control;
> 4. It supports two kinds of audio output: one is SPK1 and SPK2 are directly output by connecting to the small speaker, and the other is connected to the headphone or power amplifier output through DAC_L/R.
#### 2. Welding instructions
- **Single Plate Solution:**:
> 1. The reverse components can be soldered using reflow soldering; The reserved short contact is larger in size, and it is recommended to wire it through a 0Ω resistor;
> 2. The 5 three-color LEDs on the front of the bottom plate are the most difficult points in this soldering, it is not recommended to use a heat gun (one blow and run), pay attention to the packaging characteristics when using an electric soldering iron, and do not weld it backwards; After the soldering is completed, test more and don't even tin (I have been soldering for more than half an hour with these five lamp hands, which is really tiring);
> 3. Two copywriters can choose one to weld;
> 4. If there is no external battery, CN1 can not be welded; When using an external MCU control lamp, the entire 8022 and its peripheral circuits can be soldered, on the contrary, the relevant circuits do not need to be soldered when the MCU is not used, and the U13 jumper cap is connected or changed to an adjustable resistor to achieve the purpose of independent dimming;
> 5. Do not place an order in strict accordance with the BOOM table.
- **Multi-plate solution:**:
> This scheme greatly simplifies the number of components and the difficulty of soldering, which is not to be emphasized, and the ceramic filament can be welded with a soldering iron after the conventional reflow soldering bottom layer.
- **Precautions (must read before welding):**:
> 1. The outer outline of this work is a special-shaped plate, and there are sharp burrs after the production is completed, so be careful not to be stabbed when welding.
> 2. When connecting the two schemes, please be careful not to place an order in strict accordance with the pin header of the BOOM meter, and use the SMD 2p pin header with low left and high right to connect. In order to ensure the accuracy and firmness of the soldering, it is recommended to use a soldering iron to fix it first and then strengthen the soldering, otherwise the soldering pad will be easily damaged if the fixation is not firm, resulting in the scrapping of the board.
---
## ** 3.Software implementation**
The entry threshold of this project is low, and the basic functions can be made and used with 0 code. The following content is aimed at those who want to expand other functions, and here is just an idea.
#### **Using AI8051 microcontroller to drive control case**
Coincidentally, I recently participated in the related activities of 8051 single-chip microcomputer, and made the upper computer control according to the learning results, and the main functions are stepless dimming and MP3 music control. The main functional modules used are as follows for the reference of other MCUs (Ardiuno is too simple):
![image.png](//image.lceda.cn/oshwhub/91eaa3c4ccf8423b8a1d4cf7a758abdb.png)
1. **Stepless dimming**:use ADC and timer to drive the joystick, write the driving code to capture the shaking command; A 10ms PWM signal is achieved using a timer interrupt, and the DUTY duty cycle is controlled by a joystick for dimming. The main codes are as follows::
```
#define Lions_LED P33
P3M0 = 0x08; //Configure the PLED pin as a push-pull output
P3M1 = 0x00;
void Timer0_Init(void) //100 microseconds @24.000MHz
{
AUXR |= 0x80; //Timer clock 1T mode
TMOD &= 0xF0; //Set timer mode
TL0 = 0xA0; //Set the timing initial value
TH0 = 0xF6; //Set the timing initial value
TF0 = 0; //Clear the TF0 flag
TR0 = 1; //Timer 0 starts the timer
ET0 = 1; //Description The interruption of timer 0 was enabled
}
void Timer1_Init(void) //1 ms @24.000MHz
{
AUXR |= 0x40; //Timer clock 1T mode
TMOD &= 0x0F; //Set timer mode
TL1 = 0x40; //Set the timing initial value
TH1 = 0xA2; //Set the timing initial value
TF1 = 0; //Clear the TF1 flag
TR1 = 1; //Timer 1 starts the timer
ET1 = 1; //Disable timer 1
}
void ADC_Init(void)
{
ADCTIM = 0x3f; //0011 1111 ADC timing control register
//CSSETUP=0 Channel selection time Tsetup=1
//CSHOLD=01 The retention time of channel selection Thold=2
//SMPDUTY=11111 Sampling time Tduty=32, cannot be less than 01010
//Total ADC conversion time =Tsetup+Tduty+Thold+Tconvert (12 bits is 12 clocks) =1+32+2+12=47 cycles
ADCCFG = 0X2f; //0010 1111 ADC configuration register
//RESFMT=1 Convert result format control bits, 0 justified left, 1 justified right
//SPEED=1111 The ADC clock is: sysclock/2/16=750kHz
//At this point, an ADC conversion time is 47/750 KHZ =62.67us
ADC_POWER = 1; //Enabling ADC
UART1_printf("Open ADC: Pin in driver configuration \n");
}
u16 Read_ADC(u8 chs)
{
u16 val;
ADC_RES = 0;
ADC_RESL = 0;
ADC_CONTR &= 0xf0; //Clearing the channel is the lower four digits
ADC_CONTR |= chs; //Select ADC channel, and the expansion board design matrix keyboard is P0.6
ADC_START = 1; //Start ADC conversion
_nop_();
_nop_();
_nop_();
_nop_();
while(!ADC_FLAG); //Query the ADC conversion completion flag. The conversion completion ADC_FLAG=1 is interrupted, and the software needs to clear it
ADC_FLAG = 0;
val =((u16)ADC_RES 4000 && PWM_duty= 10 )
{
Breath_Cnt=0;
if(breath_increasing)
{
PWM_duty=PWM_duty+1;
if(PWM_duty==100) breath_increasing=!breath_increasing;
}
else
{
PWM_duty=PWM_duty-1;
if(PWM_duty==0) breath_increasing=!breath_increasing;
}
}
}
}
```
2. **MP3 control**:use serial port + timer 2 to initialize serial port communication, write serial port to send and receive data; Write the corresponding commands according to the MP3 module user manual, and use the matrix keyboard and ADC to capture the corresponding voltage value and output the corresponding commands. Pay attention to the MP3 module manual for serial communication formats. Some of the codes are as follows:
```
void Uart3_Init(void) //9600bps@24.000MHz
{
S3CON = 0x10; //8-bit data, variable baud rate
S3CON &= 0xBF; //Serial port 3 Select timer 2 as the baud rate generator
AUXR |= 0x04; //Timer clock 1T mode
T2L = 0x8F; //Set the timing initial value
T2H = 0xFD; //Set the timing initial value
AUXR |= 0x10; //Timer 2 starts the timer
}
void UART3_sendBytes(u8 *dataToSend, int length)
{
u8 i;
for (i = 0; i 4000) UART3_sendBytes(LAST, len); //Previous Song
if(KEY_val>1900 && KEY_val3400 && KEY_val1400 && KEY_val2900 && KEY_val900 && KEY_val