Brushless Fan (5v) for Rock64 Clear Case Soft PWM Drive 2N2222
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 ( ) 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:

#        sudo ./ 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
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 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. 

marcushh777    Cool

please join us for a chat @   or ssl

( I regret that I am not able to respond to personal messages;  let's meet on irc! )

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
  1wire DS18b20 on Rock64? mypineme 3 938 02-10-2021, 11:21 AM
Last Post: TRS-80
Heart Best quick/easy way to control case fan speed? idillicah 1 652 12-15-2020, 04:57 PM
Last Post: kidfrostbite
  Display options for the Rock64 joey49 1 526 11-23-2020, 09:52 AM
Last Post: joey49
  Are HW design files available for ROCK64? irenek 1 892 09-29-2020, 05:57 PM
Last Post: tllim
  No sound from Rock64 DAC codebreaker 2 791 09-29-2020, 02:14 PM
Last Post: codebreaker
  Which Voltage and Amper to supply both Rock64 + External drive enclosure ? prog-amateur 0 824 08-21-2020, 09:16 PM
Last Post: prog-amateur
  Assembling the premium aluminum case mlefevre 7 3,622 07-09-2020, 05:30 AM
Last Post: flyingscorpio
Information Rock64 RTL8188EU Wifi Adapter from Pine Store Tested Well MarkHaysHarris777 7 4,199 05-13-2020, 06:00 PM
Last Post: Leon Rembowski
  accident got 12v at my rock64 lifeform 1 1,064 04-17-2020, 09:46 AM
Last Post: fire219
  Help! Rock64 won't boot anything! trohn_javolta 3 1,814 03-09-2020, 06:03 PM
Last Post: tllim

Forum Jump:

Users browsing this thread: 1 Guest(s)