weesliceofpi
Posts: 2
Joined: Fri Mar 24, 2017 7:52 pm

Raspberry PI3 Fan without a Relay switch

Fri Mar 24, 2017 8:17 pm

I have read dozens upon dozens of articles/forum/google/etc.. of controlling a fan with Fan.py like scripts and seems everyone is using a relay switch.
I currently have a fan running on the 3v3 and a Ground and it works well. Probably should leave it alone since it does a good job.
I have tried using a few FAN Scripts with different GPIO pins but no success to get the Fan to rotate.
So I was wondering if my Raspberry PI3 with using the Correct GPIO could utilize a Simple Script to Turn on Fan when the OS Boots - Turn Off Fan when OS Shutdowns but without a Relay switch?
---------------
RPI3 - vB
Raspbian GNU/Linux 8 (jessie)
Linux raspberrypi 4.4.50-v7+
5V 2.5 Amp Power

klricks
Posts: 6444
Joined: Sat Jan 12, 2013 3:01 am
Location: Grants Pass, OR, USA
Contact: Website

Re: Raspberry PI3 Fan without a Relay switch

Fri Mar 24, 2017 11:32 pm

weesliceofpi wrote:I have read dozens upon dozens of articles/forum/google/etc.. of controlling a fan with Fan.py like scripts and seems everyone is using a relay switch.
I currently have a fan running on the 3v3 and a Ground and it works well. Probably should leave it alone since it does a good job.
I have tried using a few FAN Scripts with different GPIO pins but no success to get the Fan to rotate.
So I was wondering if my Raspberry PI3 with using the Correct GPIO could utilize a Simple Script to Turn on Fan when the OS Boots - Turn Off Fan when OS Shutdowns but without a Relay switch?
No..... A GPIO pin does not have the capability to run a fan or anything else other than an LED. You must use the 3V3 or 5V power pins or a separate power supply to run the fan. If you also want to control the fan then you need to add either a transistor / FET of some sort or a relay as everyone else does. Then use a GPIO to control power to the fan via the relay or transistor.
Unless specified otherwise my response is based on the latest and fully updated Raspbian Buster w/ Desktop OS.

darkbibble
Posts: 602
Joined: Mon Mar 09, 2015 5:20 pm
Location: corby, england

Re: Raspberry PI3 Fan without a Relay switch

Sat Mar 25, 2017 1:55 pm

a GPIO pi can supply 20ma i think where as a small 5v fan is usually around 200ma use, so a relay or transistor is required switch them on the 5v rail controlled by the GPIO pin
Q; How many Windows users does it take to fix a Linux problem??
A; Whats a Linux problem

weesliceofpi
Posts: 2
Joined: Fri Mar 24, 2017 7:52 pm

Re: Raspberry PI3 External LED without a Relay switch

Sat Mar 25, 2017 3:50 pm

Thank you very much. That fixes that :)

My next question was going to be about an External 5V -10mA - 8 mcd -Green 3mm- LED with a built in resistor. See Example Model B4302F5http://www.intertexelectronics.com/Linr ... 10499.aspx
Question: Is it possible to hook This LED up directly to a GPIO pin and a Ground and have a script so the LED lights on at boot and turns off at shutdown.?
I have already hooked it up to a 3v3 and ground and it works and of course it stays on all the time.
I do not care about the Brightness, just would be nice to have an indicator that lets me know when the system is off.

thanks again for any help on this topic.
---------------
RPI3 - vB
Raspbian GNU/Linux 8 (jessie)
Linux raspberrypi 4.4.50-v7+
5V 2.5 Amp Power

Electron752
Posts: 142
Joined: Mon Mar 02, 2015 7:09 pm

Re: Raspberry PI3 Fan without a Relay switch

Sat Mar 25, 2017 8:57 pm

The Led thing depends on how complex or simple you want things to be.

The simple solution is to just write a startup and shutdown script that runs when the PI starts up, and shuts off when it halts. If I recall, you do this through /dev/gpio.

I think Linux has a user space LED driver library that you can use for more advance stuff or even write a simple driver(It really isn't that hard).

Electron752
Posts: 142
Joined: Mon Mar 02, 2015 7:09 pm

Re: Raspberry PI3 Fan without a Relay switch

Sat Mar 25, 2017 8:59 pm

BTW, you know you will need to probably have a resistor in series with that LED, otherwise it probably won't last long.

Electron752
Posts: 142
Joined: Mon Mar 02, 2015 7:09 pm

Re: Raspberry PI3 Fan without a Relay switch

Sat Mar 25, 2017 9:03 pm

Sorry, I just noticed you said it has a built in resistor. You will have some issues with the pins of the RPI being 3.3V instead of 5v except for the power rail. So to use that LED, your going to need to use a transistor(probably a mosfet).

User avatar
davidcoton
Posts: 3810
Joined: Mon Sep 01, 2014 2:37 pm
Location: Cambridge, UK

Re: Raspberry PI3 Fan without a Relay switch

Sat Mar 25, 2017 9:10 pm

weesliceofpi wrote:Question: Is it possible to hook This LED up directly to a GPIO pin and a Ground
So it will draw about 10mA (first guesstimation) at 3V3. Within the capabilities of a GPIO, as long as they aren't all doing the same. So no problem. Of course, you must not connect the other end to 5V, only 3V3.

[quote="weesliceofpi"and have a script so the LED lights on at boot and turns off at shutdown.?[/quote]
I believe one of the serial port pins on the GPIO connector might actually do what you want without any programming, but I haven't tried it
Signature retired

Return to “General discussion”