Brushless Fan (5v) for Rock64 Clear Case Soft PWM Drive 2N2222
#1
Information 
See full update on post #2 below:


         


I plan to mount this 5v brushless fan under the clear Rock64 shipping case using very tiny machine screws set directly into the soft plastic ( for a little later ).  The motor leads ( red +5v,  black grnd ) are plugged into the PI-2 bus voltage pins with a 2N2222 transistor in the power lead ( collector emitter ) and with the base lead plugged into the GPIO2_C2 (82) via biasing resistor.  

The theory is that a driver script ( fan_motor.sh ) will generate a soft-pwm signal to the base of the driver transistor allowing current to flow from collector to emitter;  with greatly reduced current, heat, and noise.  I have wrapped the 2N2222 transistor in an aluminum clip ( heatsink ) to help extend the life of the transistor;  the heatsink gets warm but does it's job quite well.

The simple driver script is listed below, and is also visible in the terminal pics below:

fan_motor.sh

Code:
#!/bin/sh
#        sudo ./fan_motor.sh pwm_pin# ctrl_pin# time_ON time_OFF &

while [ `cat /sys/class/gpio/gpio$2/value` -gt 0 ]; do
  echo 1 > /sys/class/gpio/gpio$1/value
  sleep $3
  echo 0 > /sys/class/gpio/gpio$1/value
  sleep $4
done
echo 0 > /sys/class/gpio/gpio$1/value


                     



The pic at the far right-hand is the fan happily spinning away !  The other two pics are views of the control terminal and the commands used to control the 2N2222 transistor bias.  The code sets up a loop that monitors the control pin ( in this case gpio83 ).  gpio83 must be set HIGH to run the loop, which runs in the background.  Momentarily pulling the control pin (83) LOW causes the loop to break and the motor will stop ( the control pin is on parm $2 ).

The control loop turns gpio(82) ON|OFF using parms $3 and $4 with a slow duty cycle in this case of 75% ON, and a frequency of about 6cps;  for a brushless fan this is perfect for keeping the fan running ( very nice airflow ) but with greatly reduced current and far less noise !

The stopled.sh script is simply a three line script that pulls the control pin low for 1.5 seconds and then releases it.  This breaks the control loop effectively stopping the motor. 

Shy
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


Messages In This Thread
Brushless Fan (5v) for Rock64 Clear Case Soft PWM Drive 2N2222 - by MarkHaysHarris777 - 08-30-2017, 12:08 AM

Possibly Related Threads…
Thread Author Replies Views Last Post
  Are HW design files available for ROCK64? irenek 3 5,078 12-11-2023, 09:31 PM
Last Post: tllim
  Rock64 is unreliable after 3 years of service - power problem? ReleaseTheGeese 0 350 11-23-2023, 05:05 AM
Last Post: ReleaseTheGeese
  Rock64 PoE compatbility with Pi4 Hatt recent Single Board Computer offering from PINE kharak 1 1,101 04-26-2023, 11:38 PM
Last Post: tllim
  Case for the rock64 that supports the POE hat. o1CRiMSON1o 0 635 03-21-2023, 03:48 PM
Last Post: o1CRiMSON1o
Brick Rock64 usb2.0 Power Control Floating GPIO Tutorial Files & Notes MarkHaysHarris777 6 13,334 01-15-2023, 10:36 AM
Last Post: ds00
  rock64 totally brick dakobg 2 1,789 11-07-2022, 05:45 PM
Last Post: olivercfc
  3D-Printable Button Pegs for the ROCK64 Aluminium Case CounterPillow 2 3,553 08-04-2022, 01:31 AM
Last Post: Vicky Weimann PhD
  Where can I find the ROCK64 POE HAT Zoz 2 2,663 06-08-2022, 12:44 AM
Last Post: Zoz
Smile wooden case for ROCK64 killor 13 16,651 03-04-2022, 06:56 AM
Last Post: killor
  1wire DS18b20 on Rock64? mypineme 6 7,112 09-28-2021, 03:07 PM
Last Post: TRS-80

Forum Jump:


Users browsing this thread: 1 Guest(s)