• Welcome to Overclockers Forums! Join us to reply in threads, receive reduced ads, and to customize your site experience!

FEATURED Building PWM Controller for 4 wires PWM fan

Overclockers is supported by our readers. When you click a link to make a purchase, we may earn a commission. Learn More.
The progression in this thread never ceases to amaze me. I have only four lots of parts to arrive, then I can start building......which makes me about two years behind :confused:

don't worry you'll catch up soon,
watching others with their coding had made me left on the stone age for sure :rain:

I, myself do need a breakfast first now....
care to ship your cook here, Bob :chair: :bday:
 
Amusingly we had french toast for dinner. Generally a breakfast food but whatever :p


In other news, this is the board:
MSP430-boardTop.jpg

You get it, a second (different) chip, a crystal for accurate timing (but no caps to go with it), two female headers to solder onto perfboard and stick on top for prototyping space, plus the proper USB cable. All for $4.30, shipped, with tax.
Hell of a deal.

Throw the following (woefully unpolished, but functional) code in and you have a six setting, one button, one port, PWM fan controller running at ~25kHz!

Code:
boolean debounced = false;
byte pushCounter = 0;



#include  <msp430g2553.h>
void setup(){   //Everything in Setup except the pinMode line is from this post:
   //http://e2e.ti.com/support/microcontrollers/msp43016-bit_ultra-low_power_mcus/f/166/t/178595.aspx
   //A few changes have been made to suit my speeds and purposes.
  WDTCTL = WDTPW + WDTHOLD;                 // Stop WDT
  P1DIR |= 0x0C;                            // P1.2/TA0.1 and P1.3 output
  P1SEL |= 0x0C;                            // P1.2 and P1.3 TA1/2 options
  P2DIR |= 0x02;                            // P2.1/TA1.1 output
  P2SEL |= 0x02;                            // P2.1 options

  CCR0 = 640;                               // PWM Period
  CCTL1 = OUTMOD_7;                         // CCR1 reset/set
  CCTL2 = OUTMOD_7;                         // CCR1 reset/set
  CCR1 = CCR0 / 2;                          // CCR1 PWM duty cycle

  TACTL = TASSEL_2 + MC_1;                  // SMCLK, up mode


__delay_cycles (16000000); //wait one second at 50% PWM to kickstart the fan.
  pinMode(PUSH2,INPUT_PULLUP); //Need to enable the button and turn the pullup on
}

void loop(){

  if (digitalRead(PUSH2) == LOW && !debounced){  //Button got pressed!
    pushCounter++;         //Increment the counter.
    if (pushCounter > 5){  //Make sure the counter doesn't get out of hand
      pushCounter = 0;     //this wraps it back around to zero
    }
    debounced = true;          //This prevents the button from activating continually while held
    CCR1 = pushCounter * 128;  //Turn the counter into a PWM level.
    __delay_cycles (5000000);  //Wait a bit, 5 million CPU cycles.
  }
  if (debounced && digitalRead(PUSH2) == HIGH){   //Button has been released if this is true
    __delay_cycles(800000);         //wait a bit incase it's a bouncing button spike.
    debounced = false;  //enable the next button press.
  }


}
I don't really understand everything in the setup section. The key bits I do, CCR0 is the value at which the PWM timer counter goes back to zero (and sets the pin LOW), CCR1 is the value at which the PWM timer sets the pin HIGH (3.3v).
TASSEL_x sets which clock source the timer uses, in this case the straight 16MHz rather than the internally stepped down 1MHz sub-clock.
 
I have decided to buy myself an oscilloscope to test various things such as the PWM controller, and what is actually coming out of the various pins of the fan outlets on my motherboard.
To the peeps that have a little more experience with these than myself.....I last used one a few decades ago.....what are your comments on this:-

http://www.eyou.com.au/product/rigo...ope-ds1052e-50mhz-1gss-2-channels-colore-lcd/

On one of the electronics sites it was voted as the best hobbyist oscilloscope at the moment.
 
By the specs and such it looks good.
I don't have any experience with that scope at all.
 
Thats a good scope its a smaller version of the one i am using ed, which is a 100mhz instead of the 50. They are good solid scopes. They have a ton of capabilties its gonna take you a few days specificly if you've never used a scope before, to get down what all does, and the special functions and so on. Its sadly not suited for the more high end applications, but it more than enough to do what your looking for and then some. Though you might look at paying the extra 50$ and getting the 100mhz version so you can have the higher bandwith when using both channels at once.
 
If you have a look at the bottom of the page there are directions to convert it to 100 mhz , lol
 
If you care about the calibration on it, the conversion to 100mhz voids that. When your working with extremely low voltage high speed circuits it does make a difference. Not to mention If the scope dies on you and you send it back theres a chance they might decide not to warranty it.
 
DIdn't realise the calibration part.thanks for that....sounds like spending the xtra 50 might be the way to go
 
Unless you're getting into buck regulator design/analysis, you don't need the extra MHz.
Certainly not for PWM fan usage.
 
Have received the Oscilliscope, and almost completed the first attempt of a controller. The one I have chosen to start with is the dual 555 with the LM311.......0% - 100%. Photo attached. Stopped when I found I lacked a 1K resister.
 
Congratulation on the scope ! :clap: Now it will be really easy to troubleshoot if there are any problems when building this.

About that 1 K resistor, not that critical, any resistors you have there is fine within the range from 1K to 10K .
 
Thought you guys would like to see an arduino based fan speed controller I am building.

It will mount to an arduino like a shield, and will be able to drive 2 banks of fan's, 4 for the case and 8 for the radiators, control the pump speed, drive a strip of RGB LED's, and drive an LCD backpack shield I am making as well. It will be able to make fan speed decisions based on the input from up to 4 temperature sensors, set up to be interfaced with either 10k thermistors, or 3 wire temperature sensors. It will also have a header to report case fan and pump speed tachometer signals to your motherboard.

I am sending 3 boards to the fab house, I will let you all know how they turn out. If anyone is interested in them, I can have more sent. The board's will run about $15.
 
I wonder, where do you guys fab your PCBs?
my previous one had 20mils of trace width and 10mils of clearance with no copper pour and it got bridges all over the place :bang head
 
I've had great luck with that outfit, they do really good work.
I'd make the VCC12V traces wider on that PCB, they look awfully small given that all the fans feed through the one trace (though it is fed at both ends, I like that). It looks like you could make a pretty juicy VCC12V plane on the top side of the board.
That said, I like overkill :D
 
I've had great luck with that outfit, they do really good work.
I'd make the VCC12V traces wider on that PCB, they look awfully small given that all the fans feed through the one trace (though it is fed at both ends, I like that). It looks like you could make a pretty juicy VCC12V plane on the top side of the board.
That said, I like overkill :D

Good idea! I thought about doing a 12v plane, but I got nervous about it initially due to potential shorts. However, since the last few boards I have gotten have been quite good, there shouldn't be any concern about that. I will make that quick modification.
 
Updated the board.

also, for those who are interested, I have modified LadyAda's LCD Backpack to have a few terminals for remote mounting. This LCD is designed to be used with my fan driver, or any other i2C system one could come up with.

Hope you all like these.
 
Back