PDA

View Full Version : Arduino Controlled Water Cooling info center.



Oneslowz28
05-27-2010, 09:50 PM
This is actually a side project for my COD MW2 case mod found in my sig. I plan on building a water pump cover that has a 16x2 or 20x4 LCD that will display several parameters about its WC loop including: 2 temperature locations, Pump RPM liquid flow rate and possibly even an audio alarm in the event of pump / flow failure.

This is what I have so far.


http://thebestcasescenario.com/oneslowz28/personal/Arduino_temp_display_layout.jpg

The 2 10k thermistors are 2 temp sensors from Bits Power which use a 10k thermistor epoxied into the stop fitting. The 10k Trim pot is there to set the contrast on the LCD.

What I have left to do:

Figure out flow meter
Figure out how to read pump rpm (PPM signal on yellow wire?)
Write code
Set alarm parameters.


My fritzing page on this project. (Download all the files there)
http://fritzing.org/projects/arduino-controlled-pc-water-cooling-info-display/


Here is the beginning of the code. Thanks to OvRiDe for helping me with this.


//Arduino Controlled 2 sensor Temp Display. Uses 2 10k thermistors and a 10k pull up resistor.
//Code By Charles Gantt http://themakersworkbench.com
//Code based on Thermistor2 Elaborate code found here http://www.arduino.cc/playground/ComponentLib/Thermistor2
//This code was developed as a side project to my Call of Duty Modern Warfare 2 Case mod found at http://www.thebestcasescenario.com/forum/showthread.php?t=21320

#include <LiquidCrystal.h>
#include <math.h>
LiquidCrystal lcd(7, 8, 9, 10, 11, 12);
double Thermistor(int RawADC) {
long Resistance;
double Temp;
Resistance=((10240000/RawADC) - 10000);
Temp = log(Resistance);
Temp = 1 / (0.001129148 + (0.000234125 * Temp) + (0.0000000876741 * Temp * Temp * Temp));
Temp = Temp - 273.15;
return Temp;
}

void printDouble(double val, byte precision) {

lcd.print (int(val));
if( precision > 0) {
lcd.print(".");
unsigned long frac, mult = 1;
byte padding = precision -1;
while(precision--) mult *=10;
if(val >= 0) frac = (val - int(val)) * mult;
else frac = (int(val) - val) * mult;
unsigned long frac1 = frac;
while(frac1 /= 10) padding--;
while(padding--) Serial.print("0");
lcd.print(frac,DEC) ;
}
}

void setup() {
Serial.begin(115200);
lcd.begin(16, 2);
}

#define ThermistorPIN 0
#define Thermistor2PIN 1
double temp;
void loop() {
lcd.setCursor(0, 0);
temp=Thermistor(analogRead(ThermistorPIN));
lcd.print("Sensor 1 ");
printDouble(temp,2);
lcd.print((char)223);
lcd.print("C ");
lcd.setCursor(0, 1);
temp=Thermistor(analogRead(Thermistor2PIN));
lcd.print("Sensor 2 ");
printDouble(temp,2);
lcd.print((char)223);
lcd.print("C ");
delay(100);
}




Code sources
http://www.arduino.cc/playground/ComponentLib/Thermistor2
http://www.arduino.cc/en/Reference/LiquidCrystal

Oneslowz28
06-01-2010, 04:21 AM
I posted the first bits of code I have worked on. I am having trouble figuring out how to get the arduino to print the temp to the LCD. As the code sits right now it will not compile due to the last line. What am I doing wrong?

Edit: I just spent the last hour consulting with crenn and he helped me sort things out. Once he explained how the arduino tells the LCD what to display it was not that hard. Thanks to crenn for editing that code and showing me what I was doing wrong. The new code has been uploaded to the first post.

**note to self. Add a "c" after temp display


lcd.print("c"); //label temp format displayed

Kayin
06-01-2010, 10:56 AM
Hook up a wire to read off the RPM sensor on the pump and you can do flow too.

Oneslowz28
06-01-2010, 02:01 PM
I found some code for that also. More later

rendermandan
06-01-2010, 05:12 PM
very nice!

Oneslowz28
06-01-2010, 08:25 PM
Thanks Dan!

The code I found for reading RPM via the PPM signal does not work for some reason. I think its more to do with me than the code. I think I have the pull up resistor hooked up wrong. I have asked for more information over on the arduino forums. My post is on the second page of this thread http://www.arduino.cc/cgi-bin/yabb2/YaBB.pl?num=1152891511/15#15

Kayin
06-02-2010, 05:28 PM
Let me know how tis works out, I might get one off of you!

Oneslowz28
06-02-2010, 07:46 PM
I will keep you updated Kayin.

I can not get the Arduino to read the fan RPM correctly. I have tried 4 different fans including a CPU fan I know has a working RPM sensor. As it is right now the Arduino is just printing random RPM numbers out to the serial console. I can stop the fan with my fingers Arduino makes no change in the serial output.

I am using a 10k resistor per the second post in this thread (http://www.arduino.cc/cgi-bin/yabb2/YaBB.pl?num=1152891511/0).

Here is how I have tings wired up.


http://themakersworkbench.com/sites/default/files/images/Fan_RPM_Arduino.jpg

And this is the sketch I am using. (found on page 1 of this (http://www.arduino.cc/cgi-bin/yabb2/YaBB.pl?num=1152891511/15#23) thread)


volatile byte NbTopsFan;
int hallsensor = 2;

void rpm()
{
NbTopsFan++;
}


/***************************************/
void setup()
{
// pinMode(hallsensor, INPUT);
Serial.begin(9600);
attachInterrupt(0, rpm, RISING);
};

void loop ()
{
NbTopsFan = 0;

delay (1000);
NbTopsFan = NbTopsFan * 30;
Serial.print (" ");
Serial.print (NbTopsFan, DEC);
Serial.print (" rpm");


};

Can anyone see where I am going wrong? Anyone want to breadboard this schematic and double check that you also get random RPM numbers in the serial console?

Oneslowz28
06-05-2010, 06:24 AM
With much help from Crenn we finally got this figured out.

The water pump I have selected outputs RPM signals similar to a standard three wire PC fan. In fact you can plug the signal wire to the CPU fan header on a motherboard and if your pump dies or stops sending a signal it will shut your PC down to prevent a CPU failure due to heat. While a nice feature for safety, it will be much cooler to see the RPM at which your pump is running than knowing your CPU wont melt if it dies right?

Since the Fan and Pump RPM signals are so similar, and my water pump has not arrived yet I decided to dev using a 120mm PC fan. The following schematic should explain how to wire things up.


http://themakersworkbench.com/sites/default/files/images/Fan_RPM_Arduino_0.jpg

This is pretty simple to hook up. First you need to run the Signal wire (almost always yellow) to the breadboard. Then from it connect a jumper wire to Arduino Digital Pin 2. Also from the sensor wire you need to connect a 10k resistor to the Arduino's 5V pin. This is a simple pull-up resistor. We also need to make sure that we connect the fans ground line to one of the Arduino's ground pins. Next just connect the fans power wire to the PSUs 12v line and the fans ground wire to the PSUs ground.

Now upload the following code to your Seeeduino, and then open the serial terminal. Again I would like to thank Crenn for his help with the code.


//code by Crenn from http://thebestcasescenario.com
//project by Charles Gantt from http://themakersworkbench.com


/*To disable interrupts:
cli(); // disable global interrupts

and to enable them:
sei(); // enable interrupts
*/


//Varibles used for calculations
int NbTopsFan;
int Calc;

//The pin location of the sensor
int hallsensor = 2;


typedef struct{ //Defines the structure for multiple fans and their dividers
char fantype;
unsigned int fandiv;
}fanspec;

//Definitions of the fans
fanspec fanspace[3]={{0,1},{1,2},{2,8}};

char fan = 1; //This is the varible used to select the fan and it's divider, set 1 for unipole hall effect sensor
//and 2 for bipole hall effect sensor


void rpm () //This is the function that the interupt calls
{
NbTopsFan++;
}

//This is the setup function where the serial port is initialised,
//and the interrupt is attached
void setup()
{
pinMode(hallsensor, INPUT);
Serial.begin(9600);
attachInterrupt(0, rpm, RISING);
}
void loop ()
{
NbTopsFan = 0; //Set NbTops to 0 ready for calculations
sei(); //Enables interrupts
delay (1000); //Wait 1 second
cli(); //Disable interrupts
Calc = ((NbTopsFan * 60)/fanspace[fan].fandiv); //Times NbTopsFan (which is apprioxiamately the fequency the fan is spinning at) by 60 seconds before dividing by the fan's divider
Serial.print (Calc, DEC); //Prints the number calculated above
Serial.print (" rpm\r\n"); //Prints " rpm" and a new line
}

You should see an RPM output in the serial terminal. It is accurate within 10-15 RPM of the fans actual RPM which is close enough for me. If your RPM output seems to be double what it should be your fan may have a bipolar Hall efect sensor and its counting each pass of the magnets pole as a single RPM when each should be 1/2 an RPM. No worries though as this is an easy fix. Just simply change the " char fan = 0 code from 0 to 1. Upload the modified code and you should be seeing accurate RPM numbers.

Next time we will cover how to measure and display the liquid flow rate of the system.

What I have left to do:


Work out flow meter design and schematic
Determine alarm parameters
Complete code and refine it.


My fritzing page on this project. (Download all the files there)
Reading PC Fan / Water Pump RPM with an Arduino (http://fritzing.org/projects/reading-pc-fan-rpm-with-an-arduino/)

Oneslowz28
06-23-2010, 08:22 PM
Just wanted to post an updated schematic of the whole project.

I am still working on refining the custom board but thought I would post my latest revision to the schematic. This was created in Eagle. I will get a new fritzing schematic up soon.


http://themakersworkbench.com/sites/default/files/images/ACLCIC_eagle_schematic_S.jpg (http://themakersworkbench.com/sites/default/files/images/ACLCIC_eagle_schematic.jpg) Click the image for a full sized version.

Oneslowz28
06-27-2010, 04:12 AM
I just wanted to update this.

I have decided to scale this up a little. The new design will be able to display information on 2 water loops. It will include:


3 Temp sensor inputs
2 Pump RPM inputs
2 Flow Meter inputs
3 Fan RPM input Plus PWM speed control
1 16x2 LCD
1 Alarm System to warn of flow stop. Blinking LED and Buzzer


I do plan on selling these as a complete working device. I will be creating a custom PCB for this project which will have an on-board ATMEGA328 Micro Controller. This will allow me to use as little space as possible as well as save some $$ on the production run. It will be able to be programmed by anyone with an USBASP programmer ($10 on ebay) so updating the firmware will able to be done by the user. The ACLCIC will ship with the most up to date firmware installed. I have not worked out what else will be included but as it sits right now I will be able to sell these for $99.00 USD and still turn a very small profit.

I think I may offer a few options like:


5.25 bay adapter (fan controls would be moved here as well.)
2 or 3 bits power temp stop fittings
1 or 3 temp probes
Different Color LCDs (Maybe RGB)


This still wont be ready for production for another month or so and then I will have to get at least a pre-order of 10 before I can manufacture and sell them at the $99.00 price. This is because it is much cheaper to buy components in bulk than single items. Think like 45% cheaper.

So just out of curiosity, If I were to list these at $99 would you consider buying one with a lead time of 2-3 weeks?

Note: No orders are being accepted at this time. I am just curious if the demand is there.