pcmanbob
Posts: 4268
Joined: Fri May 31, 2013 9:28 pm
Location: Mansfield UK

Re: Adding a 5V Fan to a Raspberry Pi 3 Model B and having control of it

Sun Dec 24, 2017 12:00 am

2N2222A is the same transistor.
What's the rating on your fan ? May be current drawn by fan is to much for transistor.
Are you sure it's connected correctly?
Remember we want information.......................no information no help
The use of crystal balls & mind reading is not supported

lcamilo
Posts: 5
Joined: Mon Dec 18, 2017 6:59 pm

Re: Adding a 5V Fan to a Raspberry Pi 3 Model B and having control of it

Sun Dec 24, 2017 12:26 am

pcmanbob wrote:
Sun Dec 24, 2017 12:00 am
2N2222A is the same transistor.
What's the rating on your fan ? May be current drawn by fan is to much for transistor.
Are you sure it's connected correctly?
Yes, every things conecte correctly. Is a ver small fan, but I don't know the rating.
20171223_222027-min.jpg
20171223_222027-min.jpg (246.76 KiB) Viewed 1511 times
20171223_222232-min.jpg
20171223_222232-min.jpg (204.38 KiB) Viewed 1511 times

pcmanbob
Posts: 4268
Joined: Fri May 31, 2013 9:28 pm
Location: Mansfield UK

Re: Adding a 5V Fan to a Raspberry Pi 3 Model B and having control of it

Sun Dec 24, 2017 11:49 am

Cant be sure because I cant see clearly but Ii think you might have things connected wrong.

your circuit should look like this ( diode left out for clarity )

Image

which matches this diagram

Image

for reference.

Image
Remember we want information.......................no information no help
The use of crystal balls & mind reading is not supported

User avatar
Burngate
Posts: 5410
Joined: Thu Sep 29, 2011 4:34 pm
Location: Berkshire UK
Contact: Website

Re: Adding a 5V Fan to a Raspberry Pi 3 Model B and having control of it

Sun Dec 24, 2017 12:07 pm

The resistor shouldn't be less than 140 ohms to protect the Pi, and the fan shouldn't draw more than 800mA to protect the transistor.

I got those figures from the 2N2222A data sheet.
Ic max = 800mA
At Ic = 500mA and Ib = 50mA, HFE min = 30, Vce max = 1v, and Vbe max = 2v
At Ic = 150mA and Ib = 15mA, Vce max = 0.3v, and Vbe max = 1.2v

140 ohms, with the GPIO at 3v3 and the transistor base at 1v2, takes 15mA from the GPIO into the base.
The transistor should then be able to supply 30 times that current, or 450mA.

If your fan wants more than that, choose a different transistor!

lcamilo
Posts: 5
Joined: Mon Dec 18, 2017 6:59 pm

Re: Adding a 5V Fan to a Raspberry Pi 3 Model B and having control of it

Sun Dec 24, 2017 1:57 pm

pcmanbob wrote:
Sun Dec 24, 2017 11:49 am
Cant be sure because I cant see clearly but Ii think you might have things connected wrong.

your circuit should look like this ( diode left out for clarity )

Image

which matches this diagram

Image

for reference.

Image
😓

I inverted the emitter / collector terminals. I saw a reference to an npn transistor and took it into consideration. After I connected the terminals correctly, it ran smoothly with the 470 ohm resistor as well.
Sorry by waste your time. Thank you very much for your assistance.

User avatar
mahjongg
Forum Moderator
Forum Moderator
Posts: 10867
Joined: Sun Mar 11, 2012 12:19 am
Location: South Holland, The Netherlands

Re: Adding a 5V Fan to a Raspberry Pi 3 Model B and having control of it

Wed Dec 27, 2017 2:15 pm

If you are still not satisfied with the lowly 2n2222(a), try a 2n3904, its a little better suited for this task.

toldcodger
Posts: 18
Joined: Sat Feb 25, 2017 7:15 pm

Re: Adding a 5V Fan to a Raspberry Pi 3 Model B and having control of it

Tue May 29, 2018 8:15 pm

Firstly, thanks for this info.

I had a tiny 5 volt fan so I got the transistor, diode and resistor and set it up. The fan wasn’t actually up to the job, so it wouldn’t go below 75% speed.

I bought a couple of 5 volt fans from Pi Hut and using the same circuit, I tried again. I hacked some code together to use the cpu temperature to control the speed. I can now control the fan from 0, 25%, 50%, 75%, and of course full speed.

Thanks again.

Dave

Mortifis
Posts: 6
Joined: Sat Mar 17, 2018 12:19 pm

Re: Adding a 5V Fan to a Raspberry Pi 3 Model B and having control of it

Sun Jun 10, 2018 4:24 pm

I just took a CPU fan from an old PC motherboard and wired it to a usb cable and run it off a usb port on the pi, works perfect and I have all of GPIO pins available :)

CodeOhms
Posts: 5
Joined: Sat Jul 07, 2018 8:27 am

Re: Adding a 5V Fan to a Raspberry Pi 3 Model B and having control of it

Thu Jul 12, 2018 6:40 am

Just thought I'd add a shameless self promo :roll:.
Lightweight program in C++, which automatically installs a systemd file for starting at boot. Can be customised for different speeds at different temps.
It has a script for easy install, and soon a deb installer. Also includes a description on how to wire a fan to be compatible.
viewtopic.php?f=41&t=217607&p=1339897#p1339897.

Return to “Other projects”

Who is online

Users browsing this forum: Idahowalker and 9 guests