DIY Smart Fan Upgrade Using Open-Source RISC-V Hardware

In this article, I show you how I modified my fume extractor and turned it into a remote-controlled device using a few cheap CH32 chips. I use my fume extractor quite often nowadays, and it is always a trouble to turn it on and off due to where it is located. So, I decided to make it remote-controlled, so I do not need to crawl on the floor whenever I need to switch it on or off. I had to come up with some smart solutions to integrate the receiver into the PCB of the fume extractor, but everything worked out well. I even designed and 3D-printed a nice enclosure for the remote at the end.

 

The remote

In my previous tutorial from the CH32 tutorial series, I introduced the CH9141K Bluetooth module. A very simple circuit board with just a few pins, which allows simple wireless serial communication with other Bluetooth devices. Actually, making a tutorial video on this specific topic was not a coincidence. I wanted to research the CH9141 chip so that I could build a Bluetooth-based remote controller for my fume extractor. So, after collecting all the necessary information about interfacing the BT module with CH32 microcontrollers, I documented everything in a tutorial, so other people could also benefit from the information I gathered.

The system (obviously) consists of a sender and a receiver. The sender simply sends some commands to the receiver when the button is pressed. The sender’s way of working is actually quite simple. By default, it is in standby mode: the microcontroller first puts the BT module to sleep mode, then it goes to sleep. In sleep mode, it consumes around 1.3 mA, and when it is awake and the BT module sends a package to the receiver, it consumes 9.5 mA. The annoying part is that in sleep mode, the microcontroller consumes only around 10 μA, a hundred times less than in its current shape. After investigating the circuit, I discovered that if I remove the wires between the MCU and the BT module that go to a GPIO pin, the consumption drops to 10 uA. So, something leaks towards the BT module, but I could not figure out why. Nevertheless, the battery holder I used has a small ON-OFF switch, so I can cut the battery off from the rest of the circuit, and there’s no current consumption at all. And for those short periods when I need the switch, the 1.3 mA is acceptable.

When the button is pressed once, an interrupt is triggered that causes the device to wake up, and then it sends a certain command to the receiver. This command only toggles the fume extractor once, so it just advances its state. If it was off, the device turns on, if it was on medium level, it goes to high level…etc.

But I also implemented another function. If the user presses the button for 1.5 seconds, the remote sends a different command to the receiver. This makes the receiver toggle the switch of the fume extractor until it turns off. So, if the device is in low mode, then it automatically goes to medium, then high and then it turns off. This way, I don’t have to keep pressing the button over and over to turn the device off.

 

Remote control assembled on a protoboard, sitting in a 3D-printed enclosure

 

The receiver

First, I opened the fume extractor so I could access its electrical circuit. I already opened the device and investigated it in my (not sponsored) review, so I already knew what to expect during disassembly. However, I did not know what to do with the circuit in order to make it remote-controlled.

I was looking for two things mainly: a solid DC power rail that I could tap into to power the receiver circuitry and the push button’s circuitry, so I can remotely control it.

The switch was easy to find. It was on the back side of the PCB, next to the RGB LED. The switch basically shorts two rails on the PCB when pressed. So, I had to mimic this behaviour. First, I just tested this by soldering wires to each side of the switch, and then I shorted the wires. It worked. But I also had to figure out the voltage between the two rails. This determines the device I can use to “press” the switch by shorting the rails together. I measured more than 18 V when the device was in standby, and more than 37 V when the fan was running. Obviously, not something I want to switch with a transistor, especially because during switching, there were transients, large voltage peaks, too. So, I went with a brute-force method, and I used an ordinary 5V relay to short the contacts of the switch. It is a simple solution.

Then, I had to figure out how to power the receiver circuit. I found U1 to be a 5V voltage regulator, so I inspected its rails to see how much voltage goes into it and how much voltage comes out of it. The input voltage of it is 15.6V and the output is 5V. Quite a large drop. I used this 15.6V, and with the help of an MP2315 DC-DC converter, I converted this voltage to 5V. The reason why I did not directly use the U1 regulator’s 5V is that it can only provide 100 mA, and when the relay switches, its peak current draw goes beyond that value. And my circuit would not be the only load on that voltage regulator.

 
 

So, the 5V output of the MP2315 goes to three points. One point is the VIN pin of the CH32V003F4P6 module. The module has an onboard voltage regulator that provides 3.3V. This 3.3V is then used by the MCU, and it also goes to the CH9141K Bluetooth module.

The relay cannot be switched by 3.3V directly, especially not by using the GPIO of the microcontroller. So, I trigger a BD135 NPN transistor with the GPIO of the MCU, and then this transistor switches the 5V from the voltage regulator to the IN pin of the relay. Then, a third point where the 5V goes is the relay panel itself, since it operates at 5V. Due to the relay’s sudden power draw, I added a 1000 μF capacitor to the circuit board to avoid browning out the digital circuitry due to a sudden dip in the supply.

Assembling both this and the remote circuit was relatively easy. I already had them assembled on breadboards, so I basically copied those circuits and transferred them to prototype boards. I even used the same wires that I used for the breadboards because they are so simple to use.

The receiver’s microcontroller does not do anything fancy. It just listens to the serial port’s RX pin and whenever the BT module puts some data there, it inspects it and does something when the incoming data matches one of the two preprogrammed command sequences. Either a single toggle to advance to the next level, or multiple toggles to advance the levels until the device is off. When the fume extractor is off, the MCU circuit is still alive, and it is waiting for an incoming command, so the fume extractor can be turned on remotely.

The receiver’s protoboard was fixed onto the enclosure by a few screws. I drilled through the front panel and attached the circuit panel by some hex screws. The panel is not in contact with the surface of the enclosure, but it is sitting on nylon nuts.

The remote also got a nice 3D-printed enclosure. It has a relatively small footprint, and I can turn it on entirely, so the battery can have a long service life. After powering it up, I can almost immediately send the commands to the fume extractor because both the booting and the establishment of the Bluetooth connection are quick.

Use my affiliate links to buy the relevant products

CH32V003F4P6 development board

CH32V003J4M6 chip

CH9141K Bluetooth module

MP2315 DC-DC converter

5V relay module

Prototyping boards

Push button for PCB

CR2032 battery holder

Breadboard

 
 

If you found this content useful, please consider joining my YouTube channel’s membership or leaving a donation.

Also, please consider using my affiliate links when buying relevant gadgets.

Next
Next

CH32V003F4P6 & CH32V006K8U6 - Bluetooth communication via the CH9141K