Author Topic: Cheaply controlling a USB fan with an MCU?  (Read 1955 times)

0 Members and 1 Guest are viewing this topic.

Offline kalelTopic starter

  • Frequent Contributor
  • **
  • Posts: 880
  • Country: 00
Cheaply controlling a USB fan with an MCU?
« on: June 25, 2017, 08:22:57 pm »
I have a USB fan of about 0.5 A draw.

For fun, I want to try to add some modes, where the ran ramps up and down, and makes pauses (externally controlled with a MCU, not planning to build it in). Why is this useful? Well, it might be useless, I just want to try it and see. If you keep a fan constantly blowing towards you, your body adjusts to this. Once you remove the fan, the part of your body where the fan was blowing suddenly feels warmer than the rest, for a little while. If the fan is not constantly blowing, perhaps your body will not have as much time to adapt, so you might feel that the air is "colder".

The other thing is, I want to do this as cheaply as possible (I already have a clone of Arduino Uno, but no power transistors, and connecting 10-20 in parallel seems impractical, unstable - e.g. one might hog more current and heat up - and more expensive).

The cheapest relay I could find is about $0.3. But a relay might not be practical. Cheapest power transistors I could find are these:
"B0083 50pcs NPN power transistors BD139 TO-126". One costs about $0.05 or less if you order 50.
PNP variants are slightly cheaper, but it should be easier to work with NPN.

One buyer tested one on Aliexpress, and got the following data from the tester:
BJT-NPN
hFE=233
Ic=2.1mA
Vbe=668mV

Fairchild's datasheet (https://www.fairchildsemi.com/datasheets/BD/BD139.pdf) shows the following characteristics:

Absolute maximum ratings:
Collector Current (DC) 1.5 A
Collector Current (PULSE) 3.0 A
Base Current 0.5 A

Do you think this transistor would be sufficient to drive that load? Obviously, I'm not considering any commercial products (just want to test this out for a few minutes and see how it works) so I don't really need reputable / high quality parts, it's more important that the cost is minimal.
« Last Edit: June 25, 2017, 08:27:50 pm by kalel »
 

Offline MosherIV

  • Super Contributor
  • ***
  • Posts: 1530
  • Country: gb
Re: Cheaply controlling a USB fan with an MCU?
« Reply #1 on: June 25, 2017, 10:16:18 pm »
Quote
Do you think this transistor would be sufficient to drive that load?
You will have to learn to interprit the specifcation for yourself......
Quote
I have a USB fan of about 0.5 A draw.

Quote
Absolute maximum ratings:
Collector Current (DC) 1.5 A
That sound like a yes it will work IF the part is real!

Avoid getting parts from vendors like ebay, Aliexpress and the like. There is a very high chance of getting fake parts that do not work or do not meet the specifications.

To ramp the fan up/down you can vary the voltage across it. PWM into a capacitor and put fan accross capacitor should work. Do not forget, since you are dealing with a motor, to use a flyback diode across transistor to catch back volt from motor.

Edit: best put these questions in beginners or projects NOT in general chat. General chat is for non project stuff
« Last Edit: June 25, 2017, 10:19:00 pm by MosherIV »
 
The following users thanked this post: kalel

Offline kalelTopic starter

  • Frequent Contributor
  • **
  • Posts: 880
  • Country: 00
Re: Cheaply controlling a USB fan with an MCU?
« Reply #2 on: June 25, 2017, 10:31:17 pm »
Quote
Do you think this transistor would be sufficient to drive that load?
You will have to learn to interprit the specifcation for yourself......
Quote
I have a USB fan of about 0.5 A draw.

Quote
Absolute maximum ratings:
Collector Current (DC) 1.5 A
That sound like a yes it will work IF the part is real!

Avoid getting parts from vendors like ebay, Aliexpress and the like. There is a very high chance of getting fake parts that do not work or do not meet the specifications.

Exactly, not knowing and considering that the ratings are absolute maximum ratings (not recommended usage), I'm left to hope it would work. Fortunately, the transistors are cheap enough that if they do overheat or not last long, at least not much money was spent, and not being any commercial thing there's less long term reliability to worry about (in fact, I'm just experimenting).

Quote
To ramp the fan up/down you can vary the voltage across it. PWM into a capacitor and put fan accross capacitor should work. Do not forget, since you are dealing with a motor, to use a flyback diode across transistor to catch back volt from motor.

Thanks for the useful tips.

Quote
Edit: best put these questions in beginners or projects NOT in general chat. General chat is for non project stuff

You're right about that, it would fit better in Projects. My fault.
 

Offline NiHaoMike

  • Super Contributor
  • ***
  • Posts: 9018
  • Country: us
  • "Don't turn it on - Take it apart!"
    • Facebook Page
Re: Cheaply controlling a USB fan with an MCU?
« Reply #3 on: June 26, 2017, 03:49:12 am »
Use a MOSFET. Even high current ones are fairly cheap and if you have an old motherboard lying around, you can easily salvage some MOSFETs with way more current capacity than you need.
Cryptocurrency has taught me to love math and at the same time be baffled by it.

Cryptocurrency lesson 0: Altcoins and Bitcoin are not the same thing.
 

Offline kalelTopic starter

  • Frequent Contributor
  • **
  • Posts: 880
  • Country: 00
Re: Cheaply controlling a USB fan with an MCU?
« Reply #4 on: June 26, 2017, 04:15:34 am »
Use a MOSFET. Even high current ones are fairly cheap and if you have an old motherboard lying around, you can easily salvage some MOSFETs with way more current capacity than you need.

Thanks for the suggestion. Just wondering, are you recommending a MOSFET because it needs less current for switching being voltage-controlled (thus might heat less), might be cheaper to obtain than a BJT capable of the same amount of current, or is there another reason?
 

Offline NiHaoMike

  • Super Contributor
  • ***
  • Posts: 9018
  • Country: us
  • "Don't turn it on - Take it apart!"
    • Facebook Page
Re: Cheaply controlling a USB fan with an MCU?
« Reply #5 on: June 26, 2017, 06:01:03 am »
A bipolar transistor will need a pretty good amount of drive current, maybe more than what some microcontrollers can supply. You can get around it by cascading another bipolar, but small (10A or so max current at 20V or so) MOSFETs will run nicely off a microcontroller at least for low switching frequencies. (For high switching frequencies and/or large MOSFETs, use a MOSFET driver.)

BTW, since larger (higher voltage/current) MOSFETs have higher gate charge, you'll actually want a fairly small MOSFET. If you're salvaging from an old motherboard, try looking for SO8 packages near some inductors or capacitors that have several pins connected together.
Cryptocurrency has taught me to love math and at the same time be baffled by it.

Cryptocurrency lesson 0: Altcoins and Bitcoin are not the same thing.
 
The following users thanked this post: kalel

Offline kalelTopic starter

  • Frequent Contributor
  • **
  • Posts: 880
  • Country: 00
Re: Cheaply controlling a USB fan with an MCU?
« Reply #6 on: June 26, 2017, 04:29:24 pm »
A bipolar transistor will need a pretty good amount of drive current, maybe more than what some microcontrollers can supply. You can get around it by cascading another bipolar, but small (10A or so max current at 20V or so) MOSFETs will run nicely off a microcontroller at least for low switching frequencies. (For high switching frequencies and/or large MOSFETs, use a MOSFET driver.)

BTW, since larger (higher voltage/current) MOSFETs have higher gate charge, you'll actually want a fairly small MOSFET. If you're salvaging from an old motherboard, try looking for SO8 packages near some inductors or capacitors that have several pins connected together.

Thanks. Since I didn't consider drive current much, I agree that a MOSFET may really work better here. I will get a module (they are about $0.5) driver with a MOSFET designed for MCU use (although it's just a mosfet and a few passives it seems). It comes with screw terminals so slightly easier to test than soldering things in/out.  They suggest adding a heatsink at 1A or higher, but shouldn't be necessary at half that value.
 

Offline Red Squirrel

  • Super Contributor
  • ***
  • Posts: 2750
  • Country: ca
Re: Cheaply controlling a USB fan with an MCU?
« Reply #7 on: June 26, 2017, 07:54:46 pm »
I'm thinking pwm would do, essentially a really basic buck converter topology if you want to smooth it out but straight pwm might work fine too.  Heck, if you use a computer fan that has an actual pwm pin you can control that and just apply a constant 12v to the rest of the fan.  That way you may even be able to drive it directly from the MCU. (the 12v would be separate of course and ensure it has the same ground as the mcu)

I can't say I've ever played with the pwm of a computer fan myself though so not sure how specific it is, like if it needs to be a specific frequency etc or if it does not matter.  Worth checking into.
 


Share me

Digg  Facebook  SlashDot  Delicious  Technorati  Twitter  Google  Yahoo
Smf