Smart Micro Fan Controller

Mark Harris
|  Created: February 11, 2021  |  Updated: March 17, 2021

If you’ve ever had to wear eye protection for an extended period of time, especially if you have prescription inserts in that eye protection, you’ve probably noticed fogging can be a major issue. Last year I designed and 3D printed a small fan unit that mounts a 25mm x 25mm x 10mm fan on each side of a military eye protection. It directs a small flow of air over the inside of the lenses and keeps them clear even during physical exertion on cool humid days, allowing the wearer to maintain clear vision. It uses a small 2 cell lithium polymer battery mounted on the back of the eyewear’s band, which feeds the 12 fan - it’s enough to keep the fan spinning but uses very little current and is not audible despite the fans being right next to your ear. There are some issues with this system however, firstly there’s no battery protection, so during extended periods of use the battery can be completely depleted beyond the point it can be recharged safely. Secondly, there’s no speed control, so you’re stuck with the airflow speed the battery provides, which is generally fine but occasionally a small burst of extra airflow would be useful.

On the surface, it is a relatively simple project to design a device to operate as a fan controller, but the application and design requirements add some interesting constraints. The project had the following constraints to take into consideration:

  1. PCB dimensions should be 25 mm x 10 mm
  2. Components should be placed on one side of the PCB only
  3. PCB should ideally be 2 layers but could be 4 layers if necessary
  4. The device must be able to control a small 5V fan
  5. The device will be powered using a small single cell Lithium Polymer battery
  6. There should be no Ball Grid Array (BGA) package components on the PCB
  7. Battery connector placement must be as specified

The fan controller needs to have the following functions:

  1. The fan speed should be controlled by a microcontroller using PWM
  2. The user should have the ability to turn the device on and off and select different fan speed modes
  3. The device should have a battery charge indicator in the form of an RGB LED.
  4. Hard switch off when battery voltage is critical.

The PCB size is determined by the fan, I want to have a circuit board that can sit on one edge of the fan so as to be as compact as possible. This also drives the requirement for single sided components, and impact/shock as well as hand assembly leads to my no BGA packages. For a board this size, anything BGA is likely to be wafer scale, and therefore extremely fine pitched which can be more challenging to hand place than the wider pitched BGA packages commonly found in larger packages.

To switch the device off when the battery voltage drops too low, I’ll be implementing a “Suicide Switch”. To turn on the device, the user will press the one button on the device which will pull the regulator’s enable pin high, allowing the microcontroller to boot and assert that pin high itself. Once the microcontroller determines the battery voltage is too low, it can pull the voltage regulator enable pin low, switching off the unit and ceasing any current draw. For this type of device, it’s a more optimal solution than simply putting the microcontroller to sleep, as if the unit is in storage it could damage the battery through over-depletion from the micro-current draw.

Component selection

Compared to the previous design, I wanted each fan unit to have it’s own battery that can be quickly swapped. The radio controlled model industry has some fantastic options for small batteries, which lead me to using a 150mAh battery that is common in small indoor helicopters and planes - they are extremely cheap, high quality and have tremendous discharge capabilities. This size battery is relatively well standardised, so the board will use a Molex Picoblade (Molex51021-2P) connector for the battery. For placement, the battery should be at the top of the board/fan unit, which will make placing a small button at the bottom of the board accessible while the unit is mounted on the wearer’s eye protection. This will also place the fan along the glasses arm in the final assembly, which keeps things nice and compact.

Turnigy Nano-Tech 150 mAh 1S 25C Li-Pol battery specified for the project
Turnigy Nano-Tech 150 mAh 1S 25C Li-Pol battery specified for the project:

https://hobbyking.com/en_us/turnigy-nano-tech-150mah-1s-25-40c-lipo-pack.html?___store=en_us

The battery's electrical parameters and mechanical dimensions are as follows:

Capacity: 150 mAh
Voltage: 1 cell / 3.7 V
Discharge: 25C Constant
Weight: 5 g
Dimensions: 40 mm x 12 mm x 5.5 mm
Balance Plug: Pico (Molex51021-2P)
Discharge Plug: Pico (Molex51021-2P)

Where the original design used a 12V fan, that is not a particularly practical choice for a design powered by a single lithium polymer cell. For the new design, I’m using a 5V variant in the same 25x25x10mm size.

Example 5 V brushless DC motor fan F251R-05LB for the project
Example 5 V brushless DC motor fan F251R-05LB for the project

https://www.digikey.com/product-detail/en/nidec-copal-electronics/F251R-05LB/563-1109-ND/1165503

The fan's electrical parameters and mechanical dimensions are as follows:

Voltage - Rated: 4.2 ~ 5.7 V
Current Rating (Amps): 60 mA
Size / Dimension: Square - 25 mm x 25 mm
Width: 10 mm
Weight: 0.015 lb (6.8 g)
Air Flow: 1.8 CFM (0.050 m³/min)
Power (Watts): 300 mW
RPM: 8000 RPM
Generated noise: 15.0 dB(A)
Termination: 2 Wire Leads

This block diagram presents the most critical components and the interconnections necessary to perform these functions.

Block diagram representation of the primary device hardware functions showing hardware component requirements
Block diagram representation of the primary device hardware functions showing hardware component requirements

 

Microcontroller (MCU)

A microcontroller is used to provide the fan's pulse width modulation, the battery voltage sensing, and the drive for an RGB LED. My goal was to use a very low cost ARM Cortex M0 or M0+ microcontroller, hopefully with support for the MBED platform which would allow code to be written in just an hour or so. A more complex microcontroller is not needed as there are very few functions for it to perform, an ARM Cortex M0 is still going to be complete overkill but they are very cheap.

The microcontroller chosen was the NXP LPC812M101JDH16J. It is an inexpensive 16 pin microcontroller available in a 16TSSOP package. This is one of the cheapest microcontrollers available on the market, despite offering relatively high performance for the price range. Microcontrollers without USB licensing/support are incredibly cheap! This package was chosen as it allows enough space for the PCB layout design to position routing traces underneath it.

Footprint of the 16TSSOP microcontroller package - although this package is slightly bigger than the QFN 5 mm x 5 mm option, it allows routing of traces underneath the device on the same layer.
Footprint of the 16TSSOP microcontroller package - although this package is slightly bigger than the QFN 5 mm x 5 mm option, it allows routing of traces underneath the device on the same layer.

https://www.digikey.com/product-detail/en/nxp-usa-inc/LPC812M101JDH16J/568-13781-2-ND/4843237

Although there are other smaller packages available for this microcontroller and other low cost options, like the QFN 5 mm x 5 mm, such packages would utilize most of the space under the device with the exposed ground pad. This would leave no possibility of routing traces underneath the MCU on the top layer, making routing more of a challenge.

QFN 5 mm x 5 mm package of the LPC845M301JHI33Y microcontroller that was initially suggested for use
QFN 5 mm x 5 mm package of the LPC845M301JHI33Y microcontroller that was initially suggested for use

https://www.digikey.com/product-detail/en/nxp-usa-inc/LPC845M301JHI33Y/568-14091-1-ND/9449756

Fan Control

The fan needs to be controlled using a PWM signal generated by the microcontroller. However, the fan cannot be directly controlled by the MCU because the microcontroller's output pins cannot deliver the current required to flow through the fan. Therefore, an additional MOSFET is needed that is capable of driving the fan. Initially, I was looking at using a MOSFET driver IC to correctly open and close the MOSFET using the PWM signal, to reduce the RDS(on) of the FET, however I realised that with just a 5v supply there wouldn’t be a lot of difference between a gate driver controlled FET and microcontroller IO driven FET - the PWM speed would not be high enough to put much strain on the microcontroller’s IO current source/sink capabilities.

For the MOSFET, I decided to use the Diodes Incorporated DMN1019USN-13 logic level MOSFET. This transistor's source-drain resistance when a 3.3 V voltage is applied to the gate is around 10 milliohm, which is low enough to make me happy. As a result, there will only be a minimal voltage drop across the device, and the MOSFET will not heat up significantly considering the relatively tiny load of the fan. The maximum drain-source voltage is 12 V, which is sufficient for this device as the fan driving voltage is 5 V, and the drain-source current capability when 3.3 V is applied to the gate is around 8.5 A.

SC-59 package chosen for the MOSFET transistor driving the fan. This package is very small, easily solderable, and great for PCB projects with limited space.
SC-59 package chosen for the MOSFET transistor driving the fan. This package is very small, easily solderable, and great for PCB projects with limited space.

https://www.digikey.com/product-detail/en/diodes-incorporated/DMN1019USN-13/DMN1019USN-13DICT-ND/4898885

RGB LED

For the battery indication, a small RGB LED was chosen. The RGB LED can display the three colors required to indicate the different battery charge levels with the displayed color controlled by the MCU. The CL-505S-X-SD-T RGB LED from Citizen was chosen. The LED is available as a 4 pin SMD 0404 package. The typical forward voltage drop is 1.85 V for the red color, 2.7 V for the green color, and 2.75 V for the blue color. The maximum current is 30 mA for the red color and 20 mA for both green and blue colors. The current limiting resistors required by the LEDs will be chosen according to its specification. I could have chosen to use an addressable RGB LED here, however for the small number of units I will build the additional programming time wasn’t worth the tradeoff for a more compact board with fewer components.

Compact CL-505S-X-SD-T RGB LED selected for battery charge indication
Compact CL-505S-X-SD-T RGB LED selected for battery charge indication

https://www.digikey.com/product-detail/en/citizen/CL-505S-X-SD-T/1642-1510-1-ND/6005950

User Input

A small tactile button was chosen for the ON/OFF and fan speed mode control selection, so the user can operate the device without difficulty. The switch needed to be small, but not too small that it was difficult to interface with mechanically. It needed to be easily accessible and simple to press. The enclosure will integrate a button that will press on the button, so having the button sitting higher off the board than other components is advantageous. For this purpose, small membrane buttons are not very suitable. I chose to use the KMR741NG ULC LFS component supplied by C & K.

Simple KMR741NG ULC LFS 4.20 mm x 2.80 mm SMD tactile switch
Simple KMR741NG ULC LFS 4.20 mm x 2.80 mm SMD tactile switch

https://www.digikey.com/product-detail/en/c-k/KMR741NG-ULC-LFS/CKN10688CT-ND/6035360

Power Supply

All these devices require a power source, and appropriate voltage regulators must be chosen for this purpose. Using just one voltage regulator was not a practical solution because the fan requires a 5 V supply, and the MCU requires a 3.3 V supply requiring two separate regulators. With the voltage range of the single cell lithium polymer battery, it’s easier and more effective to step-up the voltage from the battery using a boost converter to supply 5V and then step it down utilizing a low-dropout (LDO) regulator to supply the MCU.

For generating the 5 V supply, I wanted a very high-efficiency DC-DC boost converter. High efficiency is required because the most significant current drawn from the battery will be by the fan, and the size of the selected small battery means that it does not have much in the way of capacity to spare on an inefficient regulator. With the serious size constraints imposed by the board area, I chose to use the Texas Instruments TPS61240IDRVRQ1 as it has high efficiency, around 93 % at the required output current for this application, is intended for battery-powered applications, and can output currents well in excess of my requirements. Its fixed 5 V output and small 6-WSON package dimensions (2 mm x 2 mm) made this converter a very suitable choice for this project. When considering a highly compact regulator, it’s amazing how much extra space the two resistors for a feedback voltage can take up when using an adjustable regulator vs a fixed output voltage regulator.

TPS61240IDRVRQ1 DC-DC Boost converter in a small 6-WSON package
TPS61240IDRVRQ1 DC-DC Boost converter in a small 6-WSON package

https://www.digikey.com/product-detail/en/texas-instruments/TPS61240IDRVRQ1/296-28184-1-ND/2522312

For the 3.3 V supply, an LDO regulator was chosen even though the component's efficiency is significantly lower. The LDO has a lower component count (no inductors required), and it is only needed to supply the microcontroller, which will spend most of its time in a sleep state and consuming only negligible current. I’m using the Diodes Incorporated AP7313-33SRG-7 which has a stable output voltage of 3.3 V. The LDO was chosen for its low price, small SC-59 package footprint, and fixed output voltage. Once again, it’s not worth wasting board space on feedback resistors for an adjustable regulator.

AP7313-33SRG-7 LDO in SC-59 package
AP7313-33SRG-7 LDO in SC-59 package

https://www.digikey.com/product-detail/en/diodes-incorporated/AP7313-33SRG-7/AP7313-33SRG-7DICT-ND/2270841

Schematic Design

Power Supply

A small 0402 SMD package TVS diode, the DRTR5V0U1LPQ-7B available from Diodes Incorporated, was added to protect the circuits from ESD damage caused by human contact with the device or any voltage transients. As this device is being worn, and touched regularly as a new battery is installed a small amount of ESD protection is highly desirable.

Battery Connection and TVS Diode schematic
Battery Connection and TVS Diode schematic

The input and output capacitors were chosen using the datasheet recommendations, simple X5R type ceramic capacitors with a 4.7 uF capacitance value were used. No high capacitance value bulk capacitors are required because there are no components within the device that could suddenly increase current. Also, the only voltage drop sensitive device is the MCU, which is supplied from another voltage source, namely the LDO. An SMD 0806 packaged inductor with a small footprint, the 1.5 uH Murata Electronics LQH2MCN1R5M52L, was chosen because it perfectly suits our application and does not take up a lot of space. Also, a Schottky diode RBE05SM20AT2R was selected for the output overvoltage protection.

5 V DC-DC Boost Converter schematic
5 V DC-DC Boost Converter schematic

The LDO schematic design was very simple. It only required two capacitors, 1 uF at the input and 4.7 uF at the output, using components with a 0402 SMD footprint.

3.3 V LDO schematic
3.3 V LDO schematic

 

Battery Monitoring

For the battery charge monitoring, I chose to use a simple voltage divider to the microcontroller ADC pin. While a battery fuel gage IC could provide a more precise measurement of battery state we have batteries that are easily user changeable, and are not charging the batteries in circuit. We also do not need a high precision of battery percentage, just a basic indication of charge compiled with a hard cutoff voltage. While the ADC pin can read the battery voltage, it cannot be directly connected because the maximum battery voltage of up to 4.2 V would damage the MCU input, hence why the divider is required. The chosen resistor values were 33 kiloohm and 1 megaohm. These values, combined with the microcontroller's ADC pin input resistance of 0.1 megaohm, provide 3.3 V to the ADC input when the actual voltage is 4.5 V. This means we can get the maximum range from the microcontroller's ADC input for all possible battery voltages without the possibility of damaging the MCU.

Battery Monitor Voltage Divider schematic
Battery Monitor Voltage Divider schematic

 

Fan Control

For the fan control, a simple low side MOSFET switch was chosen to control the fan speed using the MCU's PWM signal. For the fan connections, plain 1.25 mm diameter test points were used to which the fan wires can be directly soldered to. They are simple, compact, do not add any cost to the BOM, and are an excellent solution for making permanent connections. A bidirectional 5V clamping voltage TVS diode, the Micro COmmercial Co ESDSLC5V0L2B-TP, was chosen for protection. The purpose of this diode is to protect the transistor or DC-DC converter from any back EMF generated by the fan motor when current switching. An internal MCU pull-down resistor is used for both Bill Of Materials (BOM) optimisation and space-saving considerations on the pin controlling the gate.

Fan Control schematic
Fan Control schematic

 

LED Indicator

Initially, my idea was to drive the RGB LED battery charge indicator using the microcontroller's GPIO pins as current sinks. However, it was determined that the current which the microcontroller's pins can sink would generate an insufficient amount of light to be bright enough to be seen outdoors on a sunny day. Consequently, three small N-Channel MOSFETs were added to drive the RGB LED with the appropriate current limiting resistors. To save space, A twin N-ch MOSFET array (Nexperia 2N7002BKS,115) was used along with an single N-ch MOSFET (Rohm Semiconductor RE1C002UNTCL) in a small SC-89 package.

RGB LED Indicator schematic
RGB LED Indicator schematic

 

Power Control

As mentioned in the introduction, I decided to use a "Suicide Switch” circuit technique to provide a way to have a single user button for power/input and also provide a way to use a hard shut off of the circuit. This circuit's purpose is to control the voltage regulator’s enable pin and also provide an input signal to MCU's GPIO pin to change the fan speed mode once the device is powered up.

If the device was OFF, it is necessary to hold down the button for at least 0.4 sec due to the RC time constant of the circuit that turns ON the boost converter and the other IC's in the device, as shown below.

Suicide switch schematic and current flow during the turn ON operation
Suicide switch schematic and current flow during the turn ON operation

When the MCU is switched ON, the circuit will hold the DC-DC converter's ENABLE pin high until the user turns OFF the device, as shown below.

The voltage regulator’s ENABLE pin is pulled up by the microcontroller EN SIGNAL pin
The voltage regulator’s ENABLE pin is pulled up by the microcontroller EN SIGNAL pin

When both the voltage regulator and the MCU are turned ON, the user can control the fan speed modes by sending a signal to MCU's GPIO pin (labeled BTN), as shown below.

Sending a signal to the MCU BTN pin and controlling fan speed modes or turning OFF device by pressing or holding the button
Sending a signal to the MCU BTN pin and controlling fan speed modes or turning OFF device by pressing or holding the button

 

Microcontroller

The LCP812 microcontrollers are nice and simple to use, with an internal oscillator that is more than precise enough for our application, there is very little supporting circuitry required. The supporting circuitry for this application only requires decoupling capacitors for the MCU supply. The pins' allocation was determined by iterating through different connections during the PCB layout to find the most convenient placement and optimal routing possible. The final MCU schematic is as shown below.

Microcontroller schematic with final pin configuration
Microcontroller schematic with final pin configuration

It was decided to use castellated holes at the end of the PCB for connecting the MCU programming pins. This will allow programming the microcontroller in production as well as debugging in development without taking up much valuable board space. A set of spring pin probes can be used with a jig to make contact with the programming header.

Schematic of the connector with castellated holes specially created for the project to enable microcontroller programming
Schematic of the connector with castellated holes specially created for the project to enable microcontroller programming

 

PCB Design

I really enjoy trying to cram as many components into small boards like this. It’s always a pleasure to see the jigsaw puzzle of components and tracks come together. There are a total of 33 components that all need to be placed on the top side of the PCB.

View in Altium Designer after all the components have been added
View in Altium Designer after all the components have been added

The component placement process begins with positioning the parts that had to be strictly placed in an exact location, which are the battery connector, the castellated holes for microcontroller programming, and the button. Strictly speaking, the castellated holes can move along the edge of the board as necessary but they do need to be on the edge.

2D view of components placement with specified restrictions
2D view of components placement with specified restrictions

The larger components such as the MCU, the fan connection points, the voltage regulators, and the RGB LED are then placed, as shown below. Roughing in the position of critical components can make figuring out the locations of the less critical components a lot easier.

2D view of critical components placed in Altium Designer
2D view of critical components placed in Altium Designer
2D PCB view after component placement in Altium Designer
2D PCB view after component placement in Altium Designer

I started the design using reasonably wide 0.3 mm traces for signals and 0.5 mm traces for power and ground. These are much wider than the vast majority of board fabricators can handle, but I like to start with what I consider an ideal track width, then if there are any points with insufficient space for these traces, I can make them thinner. The same approach was taken for the vias; as you can see below, there are few wider vias in the final design.

Fully routed project PCB layout in Altium Designer
Fully routed project PCB layout in Altium Designer

You may have noticed that there is an added additional TVS diode in this layout. During the layout process, it was easier to route two separate paths from the battery positive connection. One path to the voltage regulator and another path to the battery sensing circuit and RGB LED diode. A TVS diode is most effectively able to mitigate an ESD event if it is in series with the track that the ESD event has occurred on. By having a route away from the battery terminal that was not protected by a series diode directly, we could still damage sensitive circuitry on that path.

Second TVS diode added for both power and battery sense paths protection. This shows that schematics are often modified due to situations identified during the PCB layout process.
Second TVS diode added for both power and battery sense paths protection. This shows that schematics are often modified due to situations identified during the PCB layout process.

After the component placement and routing is completed, the ground layer on the bottom side of the PCB can be poured. It's important to have a fully routed board using traces, including the ground nets. If you simply fill the ground net with a polygon and hope for the best with regards to the return path, you are likely to end up with a terrible ground path.

Fully routed PCB with a bottom ground polygon in Altium Designer
Fully routed PCB with a bottom ground polygon in Altium Designer

Here you can see the component density on the PCB in the 3D view.

Project PCB 3D view in the Altium Designer
Project PCB 3D view in the Altium Designer

All the desired components were able to be placed without needing to remove any optional functionality to make room for routing. All the design objectives for this smart fan control board were able to be achieved.

Conclusion

This small project shows that even devices with the simplest of functions can have a complex design. The board's limited size and the specified battery connector placement necessitated the need to choose components wisely. Many microcontrollers, regulators, MOSFETs, and diodes can perform the required functions, however as the PCB area was very limited, the selected component package types were critical.

Another consideration was minimizing the component count during the schematic design. This minimization was critical because of the PCB space restrictions. Making use of array packages and making smart choices about components that will be easy to prototype with yet not take up a lot of space can make the difference between a compact board that is easy to route, and a lot of space wasted with inefficient component selection.

Implementing dense component placement requires you to think several steps ahead to correctly place components. If just one part does not fit, or it is impossible to route tracks to it, you may need to redo the entire component placement.

It is crucial when designing the layout to route every trace manually and then check that all the pads can be connected. Starting out using wide traces to see if the PCB can be correctly routed. If a trace does not fit, you can often just make it thinner, reducing it to 0.2 mm or 0.25 mm from 0.3 mm as necessary.

Would you like to find out more about how Altium Designer® can help you with your next PCB design? Talk to an expert at Altium.

About Author

About Author

Mark Harris is an engineer's engineer, with over 12 years of diverse experience within the electronics industry, varying from aerospace and defense contracts to small product startups, hobbies and everything in between. Before moving to the United Kingdom, Mark was employed by one of the largest research organizations in Canada; every day brought a different project or challenge involving electronics, mechanics, and software. He also publishes the most extensive open source database library of components for Altium Designer called the Celestial Database Library. Mark has an affinity for open-source hardware and software and the innovative problem-solving required for the day-to-day challenges such projects offer. Electronics are passion; watching a product go from an idea to reality and start interacting with the world is a never-ending source of enjoyment. 

You can contact Mark directly at: mark@originalcircuit.com

Recent Articles

Back to Home