Control your pump, fan, RGB LEDs remotely with this smartphone app - Overclock.net - An Overclocking Community

Forum Jump: 

Control your pump, fan, RGB LEDs remotely with this smartphone app

 
Thread Tools
post #1 of 7 (permalink) Old 05-22-2017, 08:56 AM - Thread Starter
New to Overclock.net
 
Nautilus's Avatar
 
Join Date: Nov 2008
Location: Turkey
Posts: 3,736
Rep: 156 (Unique: 146)
Hey all,

Lately I've been working on some fun project: Controlling my water cooling pump, fans and all RGB LEDs in one place. I am aware that there are programs that can do this on PC. But since I'm into DIY & hobby electronics stuff, I like to play and tinker with things so decided to entertain this idea of controlling my PC components via my smartphone over bluetooth. Besides I had a lot of fun and learnt many things while developing this. I hope you like it too!


I like open hardware and open source so I'm going to share everything with you guys. The schematics, codes, parts lists etc... nothing is proprietary here so that you can build it or even better, improve upon it.



So the hardware is based on an Arduino board. For those who are not familiar with it, Arduino is a development board based on Atmega AT328P microcontroller. You can plug it in your PC via USB and start programming it right away. There are truckloads of electronic components you can use with it such as sensors, motors, wireless transreceivers etc... You might wanna check on YouTube video tutorials if you want to learn more about Arduino, hobby electronics.

So I used an Arduino UNO R3 model with Prototyping shield on it. The shield is not necessary, you can use a breadboard instead but it saves space. The system uses HC-06 bluetooth transreceiver unit to communicate via Android smartphone. It also has LM35 temp sensor for measurement and IRLB8721 MOSFETs to drive 12v RGB LED strips. That's all. To control the fans I'm using a fan hub from Silverstone (SST-CPF04). Arduino sends to PWM signals to fan hub, and fan hub distributes power and PWM signal to all my fans. You can either use a fan hub like me, or make your own fan hub via appropriate transistors and caps. There are tutorials online.

As I said the unit has an onboard placeholder temp sensor. Arduino reads it and sends the temp data to your smartphone over bluetooth. You can attach the sensor on female jumper cables and stick it to your GPU if you want. Further experiments can be done with different temp sensors.

The parts used in the project are easily obtainable on places like ebay and cost very little.

Parts list:
-Arduino UNO R3
-HC-06 bluetooth transreceiver
-3x IRLB8721 MOSFET
-LM35 temp sensor
-Couple of M to M, M to F jumper cables.
-Isolation tape.
-Molex to power jack connector to power Arduino and RGB LED strips.

Optional:
-Silverstone SST-CPF04 or any other fan hub with PWM support.
-Arduino Protoshield (or a regular breadboard)

So how do I connect the parts together?
See the diagram (Click to show)

Open in new tab to see in detail.




And how can I easily connect multiple RGB LED strips to this unit?
Click me (Click to show)
I salvaged this cable from DEEP COOL RGB 350 case lighting kit. It has 4 inner cables (3 color, 1 power) and the cable distributes these to 3 RGB LED strips. See below:


I seperated them and connected them to MOSFETs. Obviously you don't need this. You can do custom wiring instead.

How do I connect my fan hub and pump to Arduino? See image (Click to show)
This thin blue cable is coming from either #9 or #10 pins of Arduino and carries PWM signal. 9 for fans, 10 for pump. Attach it to your fan hub or pump cable like this:

How to power Arduino while it's in case? See image (Click to show)
With this nifty molex to power jack adapter of course. Arduino accepts 12v.


The Android app was built by me using MIT App Inventor 2. It does what it is intended to, no fancy interface.If you believe you have the skills, by all means go ahead and improve it. You can add color cycle animations, temp based lighting etc...You have all my permission, just make sure you name the original author, me.

Here's the .apk and .aia files of the Android app: Android_app.zip 1821k .zip file
You can install it on your smartphone using the .apk and develop&edit&improve using .aia file. All you have to do is visit the App Inventor page and upload the .aia file there. It is very easy to use with a friendly interface, you won't believe it!

You also need to upload this sketch to your Arduino after you hooked up all the parts correctly:

Arduino Sketch (Click to show)

//DEVELOPED BY ÇAĞAN ÇELİK 2017
//OVERCLOCK.NET

#include

#define tempCycle 1000U //Multi threading...
unsigned long tempLastMillis = 0;

const byte numChars = 32;
char receivedChars[numChars];
char tempChars[numChars];

int red;
int green;
int blue;
int fan;
int pump;
int temp;

boolean newData = false;

// Please note below you can find some codes turned to comments.
// These codes are playing with Arduino's PWM registers and pin #9 and #10
// to give true 25Khz PWM signal output (Intel's official PWM specs)
// This is useful if you are experiencing buzzing, humming noises with
// Arduino's default 490Hz PWM signal. But it makes other PWM outputs obsolete.
// So no RGB lighting control for you.

//word pwmA = 160; // 50% duty (0-320 = 0-100% duty cycle)
//word pwmB = 288; // 90% duty (0-320 = 0-100% duty cycle)

boolean cycleCheck(unsigned long *lastMillis, unsigned int cycle)
{
unsigned long currentMillis = millis();
if(currentMillis - *lastMillis >= cycle)
{
*lastMillis = currentMillis;
return true;
}
else
return false;
}


void setup() {
Serial.begin(9600);
pinMode(9, OUTPUT); //pwmA
pinMode(10, OUTPUT); //pwmB
pinMode(3, OUTPUT);
pinMode(5, OUTPUT);
pinMode(6, OUTPUT);

// 25Khz conversion code continues...
/*
TCCR1A = 0; //clear timer registers
TCCR1B = 0;
TCNT1 = 0;

TCCR1B |= _BV(CS10); //no prescaler
ICR1 = 320; //PWM mode counts up 320 then down 320 counts (25kHz)

OCR1A = pwmA; //0-320 = 0-100% duty cycle
TCCR1A |= _BV(COM1A1); //output A clear rising/set falling

OCR1B = pwmB; //0-320 = 0-100% duty cycle
TCCR1A |= _BV(COM1B1); //output B clear rising/set falling

TCCR1B |= _BV(WGM13); //PWM mode with ICR1 Mode 10
TCCR1A |= _BV(WGM11); //WGM13:WGM10 set 1010
*/
// 25Khz conversion code finishes here.

red = EEPROM.read(0);
green = EEPROM.read(1);
blue = EEPROM.read(2);
fan = EEPROM.read(3);
pump = EEPROM.read(4);
analogWrite(9,fan);
analogWrite(10,pump);
analogWrite(6,blue); //mavi
analogWrite(3,red); //kırmızı
analogWrite(5,green); //yeşil

}


void loop() {

recvWithStartEndMarkers();
if (newData == true) {
strcpy(tempChars, receivedChars);
parseData();
showParsedData();
newData = false;
analogWrite(9,fan);
analogWrite(10,pump);
analogWrite(6,blue);
analogWrite(3,red);
analogWrite(5,green);
EEPROM.update(0,red);
EEPROM.update(1,green);
EEPROM.update(2,blue);
EEPROM.update(3,fan);
EEPROM.update(4,pump);
}

if(cycleCheck(&tempLastMillis, tempCycle))
{
temp= analogRead(A0);
int mv = ( temp/1024.0)*5000;
int cel = mv/10;
Serial.print(" " );
Serial.println(cel);
}

}


void recvWithStartEndMarkers() {
static boolean recvInProgress = false;
static byte ndx = 0;
char startMarker = '<';
char endMarker = '>';
char rc;

while (Serial.available() > 0 && newData == false) {
rc = Serial.read();

if (recvInProgress == true) {
if (rc != endMarker) {
receivedChars[ndx] = rc;
ndx++;
if (ndx >= numChars) {
ndx = numChars - 1;
}
}
else {
receivedChars[ndx] = '\0'; // terminate the string
recvInProgress = false;
ndx = 0;
newData = true;
}
}

else if (rc == startMarker) {
recvInProgress = true;
}
}
}



void parseData() { // split the data into its parts

char * strtokIndx; // this is used by strtok() as an index

strtokIndx = strtok(tempChars,","); // get the first part - the string
red = atoi(strtokIndx);

strtokIndx = strtok(NULL, ","); // this continues where the previous call left off
green = atoi(strtokIndx); // convert this part to an integer

strtokIndx = strtok(NULL, ",");
blue = atoi(strtokIndx);

strtokIndx = strtok(NULL, ",");
fan = atoi(strtokIndx);

strtokIndx = strtok(NULL, ",");
pump = atoi(strtokIndx);

}

void showParsedData() {
/*
Serial.print("R ");
Serial.println(red);
Serial.print("G ");
Serial.println(green);
Serial.print("B ");
Serial.println(blue);
Serial.print("Fan ");
Serial.println(fan);
Serial.print("Pump ");
Serial.println(pump);

Serial.print("EEPROM 1: ");
Serial.println(EEPROM.read(0));
Serial.print("EEPROM 2: ");
Serial.println(EEPROM.read(1));
Serial.print("EEPROM 3: ");
Serial.println(EEPROM.read(2));
Serial.print("EEPROM 4: ");
Serial.println(EEPROM.read(3));
Serial.print("EEPROM 5: ");
Serial.println(EEPROM.read(4));
*/
}

Lastly, I know it needs a proper cable management! biggrin.gif Perhaps some of you print a case or shroud for it. smile.gif

P.S. Arduino uses 490Hz PWM signals, whereas official Intel spec says the PWM signal should be 25Khz. So PC hardware is obviously designed with Intel's specs in mind. So what does that mean? Will things explode? No. You can still adjust the speed, It's just some fans will probably make humming noise at certain speeds that's it.
Nautilus is offline  
Sponsored Links
Advertisement
 
post #2 of 7 (permalink) Old 05-22-2017, 09:38 AM
New to Overclock.net
 
garyd9's Avatar
 
Join Date: Apr 2017
Location: Pittsburgh, PA (USA)
Posts: 330
Rep: 20 (Unique: 17)
Interesting. I have an arduino board controlling the RGB lighting for my corsair fans (code based on FastLED) and really would like to have time to expand that.

What I think would be REALLY nice is if an arduino board could be set up to accept a thermsistor input for it's own use, and then somehow simulate passing that resistance value on to a motherboard temp sensor header. (So the single temp measurement can be used by BOTH the arduino board and the PC motherboard.) (Can an arduino be programmed to present variable resistance on a pin? I don't know..)

Once past that hurdle, it might be nice to read the "tach" signal from the fan headers and also somehow pass the signal on to the PC in a similar way as described above. The whole idea is to use the data on the arduino, but also feed it to the motherboard.

garyd9 is offline  
post #3 of 7 (permalink) Old 05-22-2017, 10:19 AM
New to Overclock.net
 
Yukss's Avatar
 
Join Date: Dec 2008
Location: Boca Raton Fl.
Posts: 1,552
Rep: 41 (Unique: 32)
This is good stuff, thanks for sharing thumb.gif
Yukss is offline  
Sponsored Links
Advertisement
 
post #4 of 7 (permalink) Old 05-22-2017, 12:46 PM - Thread Starter
New to Overclock.net
 
Nautilus's Avatar
 
Join Date: Nov 2008
Location: Turkey
Posts: 3,736
Rep: 156 (Unique: 146)
Quote:
Originally Posted by Yukss View Post

This is good stuff, thanks for sharing thumb.gif

Thanks. Glad you liked it.
Nautilus is offline  
post #5 of 7 (permalink) Old 05-26-2017, 01:48 PM
New to Overclock.net
 
CALiteral's Avatar
 
Join Date: Feb 2016
Location: Saskatchewan
Posts: 19
Rep: 2 (Unique: 2)
This is some awesome work. I started putting together a similar controller using an attiny85 but school got way too busy and I abandoned it.

My plan was to use a thermistor and voltage divider to input the loop and ambient temperatures then control the fans and pump via PWM. Ultimately, I imagined putting a small OLED display in the window of my case that would cycle through the current temperatures and fan and pump speeds.

By going to an Atmega328, and the work you've done here, it should be fairly easy to add bluetooth or serial communication to change fan curves and monitor the performance of the loop without reprogramming. Maybe I'll dig out my breadboard now that I have some time!
CALiteral is offline  
post #6 of 7 (permalink) Old 06-13-2017, 12:46 AM - Thread Starter
New to Overclock.net
 
Nautilus's Avatar
 
Join Date: Nov 2008
Location: Turkey
Posts: 3,736
Rep: 156 (Unique: 146)
Quote:
Originally Posted by CALiteral View Post

This is some awesome work. I started putting together a similar controller using an attiny85 but school got way too busy and I abandoned it.

My plan was to use a thermistor and voltage divider to input the loop and ambient temperatures then control the fans and pump via PWM. Ultimately, I imagined putting a small OLED display in the window of my case that would cycle through the current temperatures and fan and pump speeds.

By going to an Atmega328, and the work you've done here, it should be fairly easy to add bluetooth or serial communication to change fan curves and monitor the performance of the loop without reprogramming. Maybe I'll dig out my breadboard now that I have some time!

Glad you found it useful. I wanted to add temp based color change and fan curves but then other projects took my interest. tongue.gif Please share if you do progress.
Nautilus is offline  
post #7 of 7 (permalink) Old 09-01-2017, 07:05 PM
New to Overclock.net
 
Leethal's Avatar
 
Join Date: Feb 2009
Location: New York
Posts: 635
Rep: 6 (Unique: 6)
Sweet, have you thought about putting that into an enclosure?

Leethal is offline  
Reply

Quick Reply
Message:
Options

Register Now

In order to be able to post messages on the Overclock.net - An Overclocking Community forums, you must first register.
Please enter your desired user name, your email address and other required details in the form below.
User Name:
If you do not want to register, fill this field only and the name will be used as user name for your post.
Password
Please enter a password for your user account. Note that passwords are case-sensitive.
Password:
Confirm Password:
Email Address
Please enter a valid email address for yourself.
Email Address:

Log-in



Currently Active Users Viewing This Thread: 2 (0 members and 2 guests)
 
Thread Tools
Show Printable Version Show Printable Version
Email this Page Email this Page


Forum Jump: 

Posting Rules  
You may post new threads
You may post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are Off
Refbacks are Off