I made one more tweak this afternoon that I think is pretty crucial for this build. The PCBs that I used from O2Surplus have a built in fan controller (arduino nano). O2 had programmed it to have the fan speed scale exactly with the power of the chosen channel. Only 1 can be used, and in my case i chose channel 1 because that is the channel that will always be on if/when the light is on at all. When using 3 pin fans (which come stock with the heatsink), they dont appear to start until you get above 25% or so power. This means that while ramping the lights, the fans dont even kick in until above 25% power...IMO thats not good. Because the fans are basically dead silent up until 50% anyway, I decided to modify the arduino code to ramp the fans to 50% if the light is on at all (even 1%). Once the power is ramped above 50%, the lights scale with the power again.
Here is the new source code if you happen to buy this board and want to use the same programming as I am:
<pre class="code">// Reads the PWM signal duty cycle and frequency from Analog pin A0
// and outputs the same PWM duty cycle to pin D10 @ 25Khz for quiet cooling fan control.
// last updated 1/29/2016 by Aaron Kovacs
#include <TimerOne.h>
#define READ_PIN A0
#define PWM_OUTPUT 10
//#define BUFFER_POWER 8 // used to provide "overtemp ON/OFF Control" on O2Surplus BFMiniA6211 six channel driver boards only. Please comment out for other boards.
int dutyValue = 0;
int inputState = 0;
static double duty;
static double freq;
static long highTime = 0;
static long lowTime = 0;
static long tempPulse;
void setup(){
//pinMode (BUFFER_POWER, OUTPUT);
pinMode(READ_PIN,INPUT);
Serial.begin(9600);
Timer1.initialize(40); // 25Khz PWM = (40). Raised even higher for use with smaller NanoBox cooling fans.
Timer1.pwm(PWM_OUTPUT, 0);
}
void loop(){
// this section of the code determines the input's (A0) frequency/duty cycle(true 0 - 100%)
// A 25KHz copy of the original input signal is then sent to pin D10 as an output.
// The serial monitor can be used to display the input duty cycle and the signal status of the output.
readPWM(READ_PIN);
int dutyValue = (duty);
dutyValue = map(dutyValue, 0, 100, 0, 255);
int inputState = digitalRead(READ_PIN);
if (tempPulse > 1){
analogWrite(PWM_OUTPUT,dutyValue);
Serial.print("Duty % = " );
Serial.println(duty);
}
if (tempPulse < 1 && inputState == 0) {
digitalWrite(PWM_OUTPUT,LOW);
Serial.print("Input_State = "
Serial.println(inputState);
Serial.println ("Cooling Fan - OFF"
}
if (tempPulse < 1 && inputState == 1) {
digitalWrite(PWM_OUTPUT,HIGH);
Serial.print("Input_State = "
Serial.println(inputState);
Serial.println ("Cooling Fan - ON"
}
}
//Takes in reading pins and outputs pwm frequency and duty cycle.
void readPWM(int readPin){
highTime = 0;
lowTime = 0;
tempPulse = pulseIn(readPin,HIGH);
if(tempPulse>highTime){
highTime = tempPulse;
}
tempPulse = pulseIn(readPin,LOW);
if(tempPulse>lowTime){
lowTime = tempPulse;
}
freq = ((double) 1000000)/(double (lowTime+highTime));
duty = (100*(highTime/(double (lowTime+highTime))));
if (duty > 1 && duty < 50){
duty = 50;
}
//digitalWrite(BUFFER_POWER, HIGH);
}
</pre>
Here is the new source code if you happen to buy this board and want to use the same programming as I am:
<pre class="code">// Reads the PWM signal duty cycle and frequency from Analog pin A0
// and outputs the same PWM duty cycle to pin D10 @ 25Khz for quiet cooling fan control.
// last updated 1/29/2016 by Aaron Kovacs
#include <TimerOne.h>
#define READ_PIN A0
#define PWM_OUTPUT 10
//#define BUFFER_POWER 8 // used to provide "overtemp ON/OFF Control" on O2Surplus BFMiniA6211 six channel driver boards only. Please comment out for other boards.
int dutyValue = 0;
int inputState = 0;
static double duty;
static double freq;
static long highTime = 0;
static long lowTime = 0;
static long tempPulse;
void setup(){
//pinMode (BUFFER_POWER, OUTPUT);
pinMode(READ_PIN,INPUT);
Serial.begin(9600);
Timer1.initialize(40); // 25Khz PWM = (40). Raised even higher for use with smaller NanoBox cooling fans.
Timer1.pwm(PWM_OUTPUT, 0);
}
void loop(){
// this section of the code determines the input's (A0) frequency/duty cycle(true 0 - 100%)
// A 25KHz copy of the original input signal is then sent to pin D10 as an output.
// The serial monitor can be used to display the input duty cycle and the signal status of the output.
readPWM(READ_PIN);
int dutyValue = (duty);
dutyValue = map(dutyValue, 0, 100, 0, 255);
int inputState = digitalRead(READ_PIN);
if (tempPulse > 1){
analogWrite(PWM_OUTPUT,dutyValue);
Serial.print("Duty % = " );
Serial.println(duty);
}
if (tempPulse < 1 && inputState == 0) {
digitalWrite(PWM_OUTPUT,LOW);
Serial.print("Input_State = "
Serial.println(inputState);
Serial.println ("Cooling Fan - OFF"
}
if (tempPulse < 1 && inputState == 1) {
digitalWrite(PWM_OUTPUT,HIGH);
Serial.print("Input_State = "
Serial.println(inputState);
Serial.println ("Cooling Fan - ON"
}
}
//Takes in reading pins and outputs pwm frequency and duty cycle.
void readPWM(int readPin){
highTime = 0;
lowTime = 0;
tempPulse = pulseIn(readPin,HIGH);
if(tempPulse>highTime){
highTime = tempPulse;
}
tempPulse = pulseIn(readPin,LOW);
if(tempPulse>lowTime){
lowTime = tempPulse;
}
freq = ((double) 1000000)/(double (lowTime+highTime));
duty = (100*(highTime/(double (lowTime+highTime))));
if (duty > 1 && duty < 50){
duty = 50;
}
//digitalWrite(BUFFER_POWER, HIGH);
}
</pre>