Liangxi smart fan LX02 based on Qiyingtailun offline voice module CI-C22GS02S can transform the old fan at home without moving your hands.
" It's called Little Orange , and it's a new-age elf living in an old fan. It can make the old fan understand the "new" voice, an instruction, a sentence, and it's true. It's also equipped with the software that I heard when I was a childThe little ringtone allows you to relive your childhood while relaxing in the cool air. There are also several humorous little functions, waiting for your discovery~ "
Basic parameters:
Type: 4 keys, 3 gears; 0 1 2 3
Installation size: key space 18mm
Power supply: AC220V
The project was made public for the first time. It's original. The project has not won any other competitions. The project did not participate in the defense at the school.
Note: Please indicate whether the project has been made public for the first time; whether the project is original; whether the project has won awards in other competitions; if so, describe the details of the award; whether the project has participated in a defense in school.
GPL3.0
4.1, 3 relay IOs
The PWM3PWM4PWM5 of the module is used as the relay control terminal (RLY_C1, 2, 3). Remember to lead out the MCLK pin here in the main control. This is necessary for the burning program.
4.2, 4 button IO
The module CI-C22GS02S ( C2759836 ) originally does not have many IO ports and only has two serial ports. This project does not use the serial port when it is actually running. Therefore, I want to use it as a button IO. I found it feasible by querying its manual: module CI-C22GS02S.
Pin number | Pin name | I/O type | IO drive capability | IO power-on default state | Function definition |
… | |||||
6 | RX0 | IO,T+U | 4mA | IN,T+U | 1.UART0_RX 2.GPIO1_7 |
7 | TX0 | IO,T+U | 4mA | IN,T+U | 1.UART0_TX 2.GPIO2_0 |
… | |||||
10 | TX1 | IO,T+U | 4mA | IN,T+U | 1.UART1_TX 2.I2C0_SCL 3.GPIO3_0 |
11 | RX1 | IO,T+U | 4mA | IN,T+U | 1.UART1_RX 2.I2C0_SDA 3.GPIO3_1 |
The pins of serial port 0 and serial port 1 both support the functions of ordinary IO ports, so they can be used to detect key input. Use TX1 as the 0th gear switch button on the pin, RX1 as the 1st gear switch, TX0 as the 2nd gear switch, and RX as the 3rd gear switch.
4.3. Relay drive
NUD3105 ( C14894 ) is used as the relay driver. This driver chip comes with MOS, current limiting resistor, reverse diode, etc., which can drive the relay well without affecting the MCU, greatly saving multiple components. It is very suitable for our DIY players who make handmade boards.
4.4. PCB partition
Since the fan casing is very small, if the buttons and relays are on top of each other, the casing will not fit, so we have to divide the board into two parts. After getting the board, cut the two pieces and connect them with flying wires. This will better fit the fan casing.
Cut along the dotted line |
|
basically completed |
![]() |
Attached is the modified SDK of this case, which can be directly downloaded and burned to perfectly copy and own your " little orange ". Friends who want to make personalized modifications continue to read below. I hope it can help you.
5.1 Relay part:
5.1.1. Initialize relay io
void relay_init(void)//PWM3-relay1-GPIO1_4 ,PWM4-relay2-GPIO1_5,PWM5-relay3-GPIO1_6
{
//以下代码控制GPIO输出模式
Scu_SetDeviceGate((unsigned int)GPIO1,ENABLE);
Scu_SetIOReuse(PWM3_PAD,FIRST_FUNCTION);
Scu_SetIOPull(PWM3_PAD,DISABLE);
Scu_SetIOReuse(PWM4_PAD,FIRST_FUNCTION);
Scu_SetIOPull(PWM4_PAD,DISABLE);
Scu_SetIOReuse(PWM5_PAD,FIRST_FUNCTION);
Scu_SetIOPull(PWM5_PAD,DISABLE);
gpio_set_output_mode(GPIO1,gpio_pin_4|gpio_pin_5|gpio_pin_6);
}
5.1.2. Relay electrical control function, GPIO high and low output
void Relay1_OFF(void){gpio_set_output_level_single(GPIO1,gpio_pin_4,0);} //输出低电平
void Relay2_OFF(void){gpio_set_output_level_single(GPIO1,gpio_pin_5,0);} //输出低电平
void Relay3_OFF(void){gpio_set_output_level_single(GPIO1,gpio_pin_6,0);} //输出低电平
void Relay1_ON(void){gpio_set_output_level_single(GPIO1,gpio_pin_4,1);} //输出高电平
void Relay2_ON(void){gpio_set_output_level_single(GPIO1,gpio_pin_5,1);} //输出高电平
void Relay3_ON(void){gpio_set_output_level_single(GPIO1,gpio_pin_6,1);} //输出高电平
5.1.3. Gear control function, call such as: Gear(0);//0 gear, closed
void Gear(unsigned char GearNum)
{
if(GearNum==0){Relay1_OFF();Relay2_OFF();Relay3_OFF();}//注意要先关后开
if(GearNum==1){Relay2_OFF();Relay3_OFF();Relay1_ON();}
if(GearNum==2){Relay1_OFF();Relay3_OFF();Relay2_ON();}
if(GearNum==3){Relay1_OFF();Relay2_OFF();Relay3_ON();}
}
5.2 Button part:
5.2.1. Modify the key list list gpio_key_list[] in gpio_key.c
static gpio_key_info gpio_key_list[]=
{
//按键一 OFF
{4,I2C0_SCL_PAD,GPIO3,gpio_pin_0},
//按键二 1档relay1
{1,I2C0_SDA_PAD,GPIO3,gpio_pin_1},
//按键三 2档relay2
{2,UART0_TX_PAD,GPIO2,gpio_pin_0},
//按键四 3档relay3
{3,UART0_RX_PAD,GPIO1,gpio_pin_7},
};
5.2.2. Add interrupt handler,
Since the four buttons belong to different GPIOX groups, the following functions need to be added to the three interrupt processing functions in the ci112x_gpio.c file:void GPIO1_IRQHandler(void) 、void GPIO2_IRQHandler(void) 、void GPIO3_IRQHandler(void)
ci_key_gpio_isr_handle();//GPIO按键处理函数
like:
/**
* @brief GPIO1中断处理函数
*
*/
void GPIO1_IRQHandler(void)
{
ci_key_gpio_isr_handle();//GPIO按键处理函数
}
PS: The unfinished key DEMO part of the SDK I downloaded, " ci112x_gpio.c " is not referenced in the file " ci_key.h ", which will cause " ci_key_gpio_isr_handle();//GPIO key processing function " to report a warning, at the beginning Just add the header file" #include "ci_key.h" "
5.2. 3. Processing key messages
Find the following key processing function in " user_msg_deal.c "
void userapp_deal_key_msg(sys_msg_key_data_t *key_msg)
{
if(key_msg->key_index != KEY_NULL)
{
ci_loginfo(LOG_USER,"key_value is 0x%x ",key_msg->key_index);
//按键被按下
if(MSG_KEY_STATUS_PRESS == key_msg->key_status)
{
ci_loginfo(LOG_USER,"status : press down
");
if(key_msg->key_index ==4){Gear(0);}
if(key_msg->key_index ==1){Gear(1);}
if(key_msg->key_index ==2){Gear(2);}
if(key_msg->key_index ==3){Gear(3);}
}
}
}
5.3 Method of burning program:
(1) Download the attached code compression package "CI1122.ZIP"
(2) Extract to a folder with a pure English path or directly to the desktop
(3) Open the folder "your desktop CI112X_SDK_V1.2.5CI112X_SDK_V1.2.5sampleinternalsample_1122firmware" in sequence
(4) Use the TTL serial port download tool to connect to the board’s DEBUG debugging port.
(5) Use a short-circuit cap to short-circuit the BOOT terminal on the board
(6) Check the line sequence. If it is correct, insert the TTL serial port download tool into the computer.
(7) Open " package upgrade.bat " in the "firmware" folder and select firmware upgrade
(8). You can see that the COM port has been automatically recognized, and then click on each option as shown below. (If only the code part has been changed, just check "Erase NV")
(9) Unplug the GND DuPont line directly between the board and the download tool, and then quickly plug it back in (manually restart and power on) to enter the burning mode. It will automatically restart after the burning is completed in about 1-2 minutes. Enter normal operation
![]() |
![]() |
(10) The author's project of normal restoration ends at this step.
(11) If you have your own ideas, personalize the code. You need to compile it in eclipse and observe that the bin file has been generated. As shown below:
Finished building: sample_1122.bin
Finished building: sample_1122.siz
Finished building: sample_1122.lst
18:16:48 Build Finished. 0 errors, 0 warnings. (took 15s.27ms)
(12) Open the "Package Upgrade.bat" in the "firmware" folder and select "Firmware Packaging". In the pop-up interface, continue to select "Package Firmware" below, and it will prompt "Firmware has been generated"
(13). Select firmware upgrade and repeat 8 and 9 burning procedures.
*If you encounter unknown problems, you can read the manufacturer's guide in detail: Portal -> Firmware Synthesis and Burning
See the BOM list button on the right for details
(1). The first choice guide for avoiding pits is the manufacturer’s beginner’s guide - Beginner’s Guide (chipintelli.com)
(2) Getting started with the software code is also the manufacturer's SDK guide SDK overview - Chipintelli Documentation Center (chipintelli.com) . Note that the main control chip of the CI-C22GS02S module is CI1122, see the CI1122 section.
(3) The version of SDK V1.2.5 I downloaded is the DEMO part of the unfinished key. " ci_key.h " is not referenced in the "ci112x_gpio.c" file, which will result in a warning. Add the header file at the beginning. Can" #include "ci_key.h" "ci_key_gpio_isr_handle();//GPIO按键处理函数
(4) After adding the button code, an error of insufficient RAM and ROM will be reported. The error reported is similar to: (This error has troubled me for a long time -_-)
ample_1122.elf section `.ro_data' will not fit in region `ROM'
section .data LMA [000000001ff21000,000000001ff2150f] overlaps section .ro_data LMA [000000001ff1d518,000000001ff210bf]
region `ROM' overflowed by 192 bytes
As shown below:
After posting on the manufacturer's BBS, I got a reply from the manufacturer's boss qinglin.li@chip :
Reason: After adding new code, the amount of added code will exceed the user code address size allocated by flash, which will cause this type of error.
Solution : Use an editor to open the file sampleinternalsample_1122srcci112x.lds in the SDK directory, increase the size of ROM_SIZE according to the actual situation, and correspondingly reduce the size of ASR_USED_SIZE.
ROM_SIZE = 1024*(130+1+1+1);//上面+1
FHEAP_SIZE = 1024*(81);
ASR_USED_SIZE = 1024*(283-1-1-1);//下面就-1,直到不报错
RAM_SIZE = 1024*(18);
STACK_SIZE = 0xC00;/*inclued in RW*/
Video requirements: Please shoot horizontally, with a resolution of no less than 1280×720, in Mp4/Mov format, and the size of a single video is limited to 100M;
Video title: Lichuang Electric Competition: {Project Name}-{Video Module Name}; such as Lichuang Electric Competition: "Autonomous Driving" - Team Introduction.
Published, see attachment.
1. Once completed, just install it in the old fan, but be sure to pay attention to the dangers of 220V! Danger! Danger !
2. Please comply with the open source agreement
3. Please indicate the source for reprint reference: Lichuang Open Source Platform https://oshwhub.com/Red_mt/li-xian-yu
4. The case is for reference only. The author’s level is limited, so please bear with me. Just because it is feasible in actual testing does not mean that it will be feasible in actual testing in the future.
Just give me a thumbs up and go away
All reference designs on this site are sourced from major semiconductor manufacturers or collected online for learning and research. The copyright belongs to the semiconductor manufacturer or the original author. If you believe that the reference design of this site infringes upon your relevant rights and interests, please send us a rights notice. As a neutral platform service provider, we will take measures to delete the relevant content in accordance with relevant laws after receiving the relevant notice from the rights holder. Please send relevant notifications to email: bbs_service@eeworld.com.cn.
It is your responsibility to test the circuit yourself and determine its suitability for you. EEWorld will not be liable for direct, indirect, special, incidental, consequential or punitive damages arising from any cause or anything connected to any reference design used.
Supported by EEWorld Datasheet