Project the circuit for a fan controller

AnalogKid

Joined Aug 1, 2013
11,056
I've done around two dozen fan control projects over the decades, from dumb to smart, and have never seen any system advantage to smart. I'm not raining on your project, and completely get wanting to do something a certain way when other ways are faster/cheaper/whatever. In fact, I'm doing that right now with a garage door project. But - if you run into problems with the STM31L0 approach, here is another option. ebay, cheap, zero programming, serious reliability.

https://www.ebay.com/itm/2Pcs-Norma...nsor-Thermostat-KSD-01F-50-R-es-/363265306097
http://j5d2v7d7.stackpathcdn.com/wp-content/uploads/2015/09/KSD-01F.pdf

Also on Amazon:
https://www.amazon.com/uxcell-KSD-01F-Temperature-Control-Thermostat/dp/B008SOC49A

ak
 

Thread Starter

PsySc0rpi0n

Joined Mar 4, 2014
1,773
I've done around two dozen fan control projects over the decades, from dumb to smart, and have never seen any system advantage to smart. I'm not raining on your project, and completely get wanting to do something a certain way when other ways are faster/cheaper/whatever. In fact, I'm doing that right now with a garage door project. But - if you run into problems with the STM31L0 approach, here is another option. ebay, cheap, zero programming, serious reliability.

https://www.ebay.com/itm/2Pcs-Norma...nsor-Thermostat-KSD-01F-50-R-es-/363265306097
http://j5d2v7d7.stackpathcdn.com/wp-content/uploads/2015/09/KSD-01F.pdf

Also on Amazon:
https://www.amazon.com/uxcell-KSD-01F-Temperature-Control-Thermostat/dp/B008SOC49A

ak
Thank you. I will try to keep things smaller than that. An just to let know, that PDF file didn't open for me.

No, that's a part number for an ADC. Something like this would make sure you have what you need: https://pt.aliexpress.com/item/1005001810931300.html
Hum, ok, so I think those needs to be literally in contact with the part I want to monitor. I'm not sure how am I gonna do that.
Because I'll have to measure the distance between the spot where I will place the small PCB and the spot I want to measure the temperature on my NVMe drive.


Edited;

But with these thermistors, I can read the temperature value and act according the temperature on the PWM signal for the fan?
I mean, if I understand, I will have to use the ADC device on the STM32L0 to read the analogic value, do the math and then, act on the PWM, is this correct?
 
Last edited:

Ya’akov

Joined Jan 27, 2019
9,170
Thank you. I will try to keep things smaller than that. An just to let know, that PDF file didn't open for me.



Hum, ok, so I think those needs to be literally in contact with the part I want to monitor. I'm not sure how am I gonna do that.
Because I'll have to measure the distance between the spot where I will place the small PCB and the spot I want to measure the temperature on my NVMe drive.
It can be on wires. It’s not critical since you’ll calibrate it anyway.
 

Thread Starter

PsySc0rpi0n

Joined Mar 4, 2014
1,773
It can be on wires. It’s not critical since you’ll calibrate it anyway.
I'm not sure I understand.
I mean, the thermistor needs to be in contact with the NVMe drive, which makes it a bit more complicated how and where am I going to place/hold the PCB I will build with this project.

This is what I think it will look like. Front view. So, I'm not sure this is still the best option.
I will have to hold the project PCB to the case and then, make sure the size of the thermistor is enough to be in contact with the NVMe drive surface.
1619556951661.png
 

Ya’akov

Joined Jan 27, 2019
9,170
I'm not sure I understand.
I mean, the thermistor needs to be in contact with the NVMe drive, which makes it a bit more complicated how and where am I going to place/hold the PCB I will build with this project.

This is what I think it will look like. Front view. So, I'm not sure this is still the best option.
I will have to hold the project PCB to the case and then, make sure the size of the thermistor is enough to be in contact with the NVMe drive surface.
View attachment 236956
You put leads on the thermistor and use Kapton tape or a little cyanoacrylate glue to stick it on, then put put something like a JST connector on the board and plug it in.
 

Thread Starter

PsySc0rpi0n

Joined Mar 4, 2014
1,773
You put leads on the thermistor and use Kapton tape or a little cyanoacrylate glue to stick it on, then put put something like a JST connector on the board and plug it in.
Wait, but the thermistor will be, somehow, connected to the PCB and the JST connector you are talking about is to power my project PCB, is that it? I'm sorry, I'm not sure I'm following.
 

Ya’akov

Joined Jan 27, 2019
9,170
Wait, but the thermistor will be, somehow, connected to the PCB and the JST connector you are talking about is to power my project PCB, is that it? I'm sorry, I'm not sure I'm following.
Leads terminated in a small connector like a JST are attached to the thermistor. They are long enough to reach from where they will be attached on the drive to where the PCB is located. The PCB has a mating connector on it. The thermistor is taped or glued to the drive, and the leads are routed to the PCB and plugged it.
 

Thread Starter

PsySc0rpi0n

Joined Mar 4, 2014
1,773
Leads terminated in a small connector like a JST are attached to the thermistor. They are long enough to reach from where they will be attached on the drive to where the PCB is located. The PCB has a mating connector on it. The thermistor is taped or glued to the drive, and the leads are routed to the PCB and plugged it.
Ahh ok, I got it. Thanks.

I'll order the parts as soon as I can and then will start reading about how each part works to be able to build the circuit with the least possible questions asked!
 

Thread Starter

PsySc0rpi0n

Joined Mar 4, 2014
1,773
Leads terminated in a small connector like a JST are attached to the thermistor. They are long enough to reach from where they will be attached on the drive to where the PCB is located. The PCB has a mating connector on it. The thermistor is taped or glued to the drive, and the leads are routed to the PCB and plugged it.
One last question about the items to buy.

Is this ok for the JST connectors?
https://pt.aliexpress.com/item/32913230037.html
 

Ya’akov

Joined Jan 27, 2019
9,170
One last question about the items to buy.

Is this ok for the JST connectors?
https://pt.aliexpress.com/item/32913230037.html
Sure, but I wailed also get some prepared pigtails which are cheap and will save you a lot of problems with crimping. Most come as pairs but you really old need the females to attach to the thermistor. Just make sure the PCB connector and the pigtail are the same size.

https://pt.aliexpress.com/wholesale?catId=0&initiative_id=AS_20210427225508&SearchText=jst+pigtail
 

Thread Starter

PsySc0rpi0n

Joined Mar 4, 2014
1,773
Is it good idea to buy the STM32L0 chip from Aliexpress or better to buy it from some more reputable online shop?

Edited;
I'm not even sure I can find it on Aliexpress! And from Mouser (EU), they want 20€ for shipping. Crazy people!
 
Last edited:

Thread Starter

PsySc0rpi0n

Joined Mar 4, 2014
1,773
Hello.

I have an update to this small project. If I was experienced, this should be done in like 1h or so, but I'm in a learning process and I don't know many components that should figure in this project. Anyways, this is where I'm at now. I have searched for some components I know I can purchase either on Aliexpress or in an online shop near me, so please, let's try to stick to the components I have so far, or if impossible, ok, suggest others as replacement.

I know I'm still missing filtering capacitors, smoothing capacitors, maybe even an inductor, but those will be for later. I mean, not for the last hour but for now I would like to discuss the main circuit components and circuit.

So, the components I can get for now, are:
1x STM32L031K6T6 LQFP32
1x AMS1117 3.3v
1x MF58 thermistor (I'm still trying to understand the values of this one, here)
1x FDN335N mosfet. Datasheet says 0.4V < Vth < 1.5V
Some resistors, see circuit for their values.

Below is the circuit. I have some questions. See after the image, please.1619996650109.png

So, first questions is about if the connections are correct or not. Probably not, but this was just my first thought.
Then, I'm not sure how to connect the fan with 3 pins.
Also, I still haven't checked the typical circuits for the AMS1117 and for the mosfet, so, probably there are resistors and caps and maybe a diode missing there for improving/protecting the circuit.
Another thing is that I connected the thermistor output randomly to PB0, I'll have to check if this is suitable. Same for the PWM output at PA0.

This was done wihtout even consulting the datasheets with much attention, so, I think I have to take responsibility for any huge mistake.
Guide me, please!

Thanks
Psy
 

wayneh

Joined Sep 9, 2010
17,498
The MOSFET should be between the Fan and GND, with no R3. You want that source pin to be tied to ground. Do you require R2 to limit the fan current? Is it not rated to 12V? A 12V rated fan would not require a resistor.

One of the 3 pins on the fan is the tachometer signal output, which you can just ignore if you want.

You should place a reverse-biased diode across the poles of the fan to absorb any inductive spike when you turn the fan off at the MOSFET.
 

Thread Starter

PsySc0rpi0n

Joined Mar 4, 2014
1,773
The MOSFET should be between the Fan and GND, with no R3. You want that source pin to be tied to ground. Do you require R2 to limit the fan current? Is it not rated to 12V? A 12V rated fan would not require a resistor.

One of the 3 pins on the fan is the tachometer signal output, which you can just ignore if you want.

You should place a reverse-biased diode across the poles of the fan to absorb any inductive spike when you turn the fan off at the MOSFET.
Like this:1620069266239.png

The fan is rated at 12V, 40mA, that's why I put there the 12V/40mA = 300Ω resistor.

Is this better now?
 

wayneh

Joined Sep 9, 2010
17,498
Like this:View attachment 237384

The fan is rated at 12V, 40mA, that's why I put there the 12V/40mA = 300Ω resistor.

Is this better now?
Much. R7 could be a much lower value and possibly eliminated. Do you know the specs of that output from your micro? The only reason to limit current with R7 would be to protect that output. You can estimate the current you need from the gate capacitance and PWM frequency. If the micro can’t keep up, you may need an additional transistor to drive the gate.

Don’t forget the flyback diode around the motor poles. It’ll protect your MOSFET.
 
Last edited:

MisterBill2

Joined Jan 23, 2018
18,600
Much. R7 could be a much lower value and possibly eliminated. Do you know the specs of that output from your micro? The only reason to limit current with R7 would be to protect that output. You can estimate the current you need from the gate capacitance and PWM frequency. If the micro can’t keep up, you may need an additional transistor to drive the gate.

Don’t forget the flyback diode around the motor poles. It’ll protect your MOSFET.
If the fan motor i a brushless DC type, it already has electronic commutation and probably some components to protect the internal transistors. In addition, a protection diode could be put across the mosfet and protect it just a well, or even netter.
 
Top