dDUKATDLq

Fan controller used in a certain brand of desktop smoking device.

 
Overview

The green section

represents the original controller inside the smoking device, featuring two touch buttons and three LED indicators. The touch buttons are used to turn the LEDs and fan on and off.
The white section represents the redesigned fan controller, structurally compatible with the original PCB.
Interfaces, LEDs, capacitors, and touch springs were all directly reused from the original PCB.
The power chip has been replaced with a CJA1117-3.3 to power the microcontroller.
The touch functionality is programmable.
Currently, the function is:
pressing a button gradually increases the fan speed, and pressing the button again at maximum speed turns the fan off. This cycle repeats.
The fan speed program is located in `key_function`. The original code has been modified to:
     `if (key_fan_short_flag == 1) { // If the fan button is pressed, execute the following program //function if(pwm_fan == 0) { pwm_fan = 480; } else { pwm_fan += 40; if(pwm_fan > 640) { pwm_fan = 0; } } //function key_fan_short_flag = 0; // Release the button }`
The fan is too noisy at high duty cycles, so it's limited to between 48-64%, where the noise level is acceptable.



The fan speed settings are
: 0
1
2
3
4
5


PWM_DUTY
0
48%
52%
56%
60%
64%.



A short press of the LED button gradually increases its brightness; pressing the button again at maximum brightness turns the LED off. This cycle repeats.
The LED brightness has 10 levels, each increasing by 10%. There's no need to use so many levels; you can modify the code yourself.
Simultaneously, the indicator light synchronously shows the current status, allowing you to determine the current brightness level by the light intensity.

Software:

Download
and install WCHISP_TOOL.
Press the button and then insert the USB; the software will recognize the device.
 
Finally, click download and wait for the programming to complete.
 
If reprogramming is required, please first download the WCH compilation environment: Mountriver. This is a RISC-V microcontroller compilation and development environment from Qinheng Micro.
Download the CH32X035 series SDK package.
I have already placed the written program in the folder; you can directly open the project.
The project folder is:
xxxxxCH32X035EVTEVTEXAMTIMFan_Control . Two C files are used for
global compilation : one is the interrupt program, containing a 1ms timer interrupt for button timing; the other is the main program, containing system initialization, PWM initialization, etc. A picture of the completed soldered device:




 
参考设计图片
×
 
 
Search Datasheet?

Supported by EEWorld Datasheet

Forum More
Update:2026-03-28 02:44:01

EEWorld
subscription
account

EEWorld
service
account

Automotive
development
community

Robot
development
community

About Us Customer Service Contact Information Datasheet Sitemap LatestNews


Room 1530, 15th Floor, Building B, No.18 Zhongguancun Street, Haidian District, Beijing, Postal Code: 100190 China Telephone: 008610 8235 0740

Copyright © 2005-2024 EEWORLD.com.cn, Inc. All rights reserved 京ICP证060456号 京ICP备10001474号-1 电信业务审批[2006]字第258号函 京公网安备 11010802033920号