Active Cooling 5v brushless fan with Motor Speed Controller soft PWM
#11
Addendum:  Reported Issues with GPIO18, pin(12) on debian.

edit:  I have changed the default soft-pwm to GPIO23, pin(16).



   I helped a couple of individuals install RPi.GPIO-PineA64 via chat on irc.pine64.xyz today; in preparation to use the fan_motor.sh codes presented here.  One individual and I spent quite some time because his motor would spin up for about 3 seconds and then stop ( this of course has not happened to me, nor does it make any sense ).

   While I was on errand, the two of them worked together and determined that 'something' in debian is interferring with GPIO18, pin(12).  When they switched to pin(16) everything worked as designed. 

   The one individual I worked with was using the nte123ap NPN transistor (which is fine) and the fan provided with the C4Labs Zebra case for PineA64.  (just for documentation's sake)

   On the other hand, I must report that my debian and ubuntu images are not the latest image; neither one of them. All of my GPIO pins function as expected with the single exception of GPIO04, pin(7).  Also, I am using an earlier version of RPi.GPIO-PineA64 !



So, it appears that on the new image ( debian ) something may be adversely affecting GPIO18, pin(12) on the PI bus. I would be interested in knowing if anyone is experiencing this failure.  In any case, I want everyone to know that the particular pin you decide to use for soft-pwm is entirely arbitrary; pick the one you want.  If pin(12) does not work, then try another one and report your experience.  I suspect that this has more to do with the on-going development of RPi.GPIO-PineA64 !  You see, on the real Raspberry PI pin(12) GPIO18 is the hardware pwm channel (one of the two channels supporting pwm in hardware) and as the developer of RPi.GPIO-PineA64 gets further along in his port, he may chose to restrict pin(12) GPIO18 to his own soft-pwm... which means that channel would not be available any longer for use as general GPIO.

I plan to post a query on the github site to try and narrow this down a bit.

edit: important: I have changed the default soft-pwm in my codes to GPIO23, pin(16) to avoid conflicts.
marcushh777    Cool

please join us for a chat @  irc.pine64.xyz:6667   or ssl  irc.pine64.xyz:6697

( I regret that I am not able to respond to personal messages;  let's meet on irc! )
  Reply
#12
So I finally got around to making this fancontrol on my PineA64 2Gb with Ubuntu Mate. It's in the C4Labs case, and it's looking quite sleek. 

As I don't have a glue gun or any nice way to fit things on the outside, I went for some double sided tape.
I managed so solder the transistor the wrong way the first time, and after soldering it off and back on (this time adding some shrink-sleeves as well), it works like a charm. I fired it up and checked if everything was working the way it was supposed to. The fan throttles slightly when the SOC temp is around 70°C when all cores run at 100% load. 
While checking, my solderingiron died on me for no apparent reason. It's just a 15W iron, but a quality brand. And I've only used it like 4 times. :/  

I'm going to add the fan-script as a service so I get it up and running on boot.

Here be pictars in an Imgur album.

(01-30-2017, 03:56 PM)CaptainZalo Wrote: So I finally got around to making this fancontrol on my PineA64 2Gb with Ubuntu Mate. It's in the C4Labs case, and it's looking quite sleek. 

As I don't have a glue gun or any nice way to fit things on the outside, I went for some double sided tape.
I managed so solder the transistor the wrong way the first time, and after soldering it off and back on (this time adding some shrink-sleeves as well), it works like a charm. I fired it up and checked if everything was working the way it was supposed to. The fan throttles slightly when the SOC temp is around 70°C when all cores run at 100% load. 
While checking, my solderingiron died on me for no apparent reason. It's just a 15W iron, but a quality brand. And I've only used it like 4 times. :/  

I'm going to add the fan-script as a service so I get it up and running on boot.

Here be pictars in an Imgur album.

And adding it to boot was about as easy as it gets:
sudo crontab -e
And on the bottom of the file I added  
Code:
@reboot nohup /path/to/fan_motor.sh

Now the fan starts when the Pine starts. Joy! Smile
  Reply
#13
Pardon my ignorance regarding electronics, but why do you need a transistor? Is it because the fan needs 5V but the GPIO is only 3.3? Also why is a resistor required?

Thanks,
Chris
  Reply
#14
(02-04-2017, 07:35 PM)psychedup Wrote: Pardon my ignorance regarding electronics, but why do you need a transistor? Is it because the fan needs 5V but the GPIO is only 3.3? Also why is a resistor required?

Please Read through this Link:

hi Chris, the transistor is needed as a current switch. The GPIO being used as a pwm pin is 3v3 on|off with a duty cycle to control the fan motor speed.  The fan brushless motor requires 5v period.  So, we are using a transistor (controlled by a 3v3 pwm signal) to switch on|off a 5v 400ma current with a duty cycle which slows the motor speed.

The 3v3 pwm signal on the base of the transistor switches on|off the motor current which has an EMF of 5v, and is being limited (collector emitter) somewhere between 200ma and 300ma. The current limiting resistor (ballast resistor) keeps the 3v3 pwm signal current (at the base) quite low just a few milli amps. Failing to put the base-emitter limiting resistor in the circuit has the same bad consequence for the transistor that trying to drive an LED without a ballast resistor has--- blown transistor.  Consequently the GPIO current is very low.  The motor current is relatively high at 5v,  and the GPIO signal voltage is 3v3 (its limit) with a relatively small current.  

The transistor-resistor combination is the simplest of the "driver" circuits (or switches) for controlling a relatively high load with a relatively low signal source.



Please Read through this Link:

The explanation in the link is pretty clear ; with diagrams, for the theory behind transistor switching.
marcushh777    Cool

please join us for a chat @  irc.pine64.xyz:6667   or ssl  irc.pine64.xyz:6697

( I regret that I am not able to respond to personal messages;  let's meet on irc! )
  Reply
#15
MarkHaysHarris777, thanks a bunch for posting your design!

Just finished building my active cooling system, learned a lot from you.

Cheers!
  Reply


Possibly Related Threads…
Thread Author Replies Views Last Post
  Controlling a Servo Motor casmiguefl 3 6,702 07-13-2017, 11:14 PM
Last Post: MarkHaysHarris777
  Active Cooling soft PWM follow-on fan motor speed controller driver MarkHaysHarris777 3 7,308 09-02-2016, 11:46 PM
Last Post: MarkHaysHarris777
  High-speed GPIOs dsnyder 3 5,496 05-05-2016, 09:07 PM
Last Post: martinayotte

Forum Jump:


Users browsing this thread: 3 Guest(s)