Pages: 1 [2]   Go Down
Author Topic: 2-fan controller with OLED Display and navigation knob?  (Read 823 times)
0 Members and 1 Guest are viewing this topic.
Offline Offline
Newbie
*
Karma: 0
Posts: 18
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Thanks PaulRB,
 
  I contacted the ebay seller asking the details you mentioned.  Regarding arduino Uno reading the fan speed, that is a good question.  How can I setup Arduino to read a 4-pin pwm fan's speed?  (This is the smaller 120mm fan)

I'll perform the temperature test within 24 hours . smiley-mr-green

Because of shipping delays, it looks like the OLED display will be the last part of this project.  So, 1st stage = get this Arduino Uno Fan Controller working without a display.
Logged

West Yorkshire, UK
Offline Offline
Edison Member
*
Karma: 48
Posts: 1444
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Search the forum for reading pc fan speeds. Someone is sure to have done that already.

Until your oled arrives, you can send the same text you would send to the oled to Serial.print(). To get the formatting you posted earlier, I recommend using the sprintf () command. You wont find that command listed on the Arduino language reference page, so search the forum or google.
Logged

West Yorkshire, UK
Offline Offline
Edison Member
*
Karma: 48
Posts: 1444
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Here's something. Looks like you may not need those npn transistors after all. The diagram shows the fan already has one built-in

http://forum.arduino.cc/index.php?topic=15514.msg113575#msg113575
« Last Edit: July 19, 2014, 03:16:53 am by PaulRB » Logged

Offline Offline
Newbie
*
Karma: 0
Posts: 18
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Awesome, thank you!  smiley-cool

So, is this enough to get me started controlling both fans?:

http://www.microcenter.com/product/431997/Arduino_Uno_R3_MainBoard
Logged

West Yorkshire, UK
Offline Offline
Edison Member
*
Karma: 48
Posts: 1444
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Yes it should be more than enough, but see advice re size from my earlier post.
Logged

Offline Offline
Newbie
*
Karma: 0
Posts: 18
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

PaulRB,

  According to my findings, the Arduino Uno I linked earlier will fit in the top 5.25" drive bay with room to spare.  I considered your other options (and thank you for recommending them), but they were more expensive and I need to stay within budget, hence the cheaper (and bigger) Aruino Uno.

Ohm Resistance Findings

Higher resistance = lower temperature
Lower resistance = higher temperature

Regular room temperature produces the ~10K ohm resistance.  Granted the cooking thermometer is not 100% precise and accurate, what is the best way to scale the Resistance values with real temperature values?  i.e. is there a standard norm or scalar that is used for these type of 10K ohm sensors?



* Sensor Test.jpg (131.4 KB, 612x612 - viewed 12 times.)

* 10K sensor 4.jpg (144.72 KB, 608x683 - viewed 11 times.)

* 10K sensor 7.jpg (134.46 KB, 612x612 - viewed 11 times.)

* 10K sensor 9.jpg (128.42 KB, 612x612 - viewed 12 times.)
« Last Edit: July 21, 2014, 10:04:34 pm by iLearn » Logged

Offline Offline
Newbie
*
Karma: 0
Posts: 18
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

How does this sketch look for the 20 x 4 Character OLED display?:

Code:
//***************************************//
// --- WIDE.HK---//
// --- Revised Date : 02/05/2014
// --- I2C Arduino - Arduino UNO Demo ---//
// --- SSD131x PMOLED Controller      ---//
// --- SCL, SDA, GND, VCC(3.3v -5v)   ---//
//***************************************//

#include <Wire.h>          // *** I2C Mode
#define OLED_Address 0x3c
#define OLED_Command_Mode 0x80
#define OLED_Data_Mode 0x40

void setup()
{
  Wire.begin();
}

void loop()
{
int i;
 // *** I2C initial *** //
 delay(100);
 sendCommand(0x80);
 sendCommand(0x2A); // **** Set "RE"=1 00101010B
 sendCommand(0x71);
 sendCommand(0xC0);
 sendCommand(0x00);
 sendCommand(0x28);

 sendCommand(0x08); // **** Set Sleep Mode On
 sendCommand(0x2A); // **** Set "RE"=1 00101010B
 sendCommand(0x79); // **** Set "SD"=1 01111001B

 sendCommand(0xD5);
 sendCommand(0x70);
 sendCommand(0x78); // **** Set "SD"=0
 
 //sendCommand(0x08);
 sendCommand(0x09); // **** Set 5-dot, 3 or 4 line(0x09), 1 or 2 line(0x08)


 sendCommand(0x06); // **** Set Com31-->Com0  Seg0-->Seg99
 sendCommand(0x72);
  sendCommand(0xC0);
   sendCommand(0x01);
 // **** Set OLED Characterization *** //
 sendCommand(0x2A);  // **** Set "RE"=1
 sendCommand(0x79);  // **** Set "SD"=1

 // **** CGROM/CGRAM Management *** //
// sendCommand(0x72);  // **** Set ROM
// sendCommand(0x00);  // **** Set ROM A and 8 CGRAM

sendCommand(0xDC);  // **** Set ROM
sendCommand(0x00);  // **** Set ROM A and 8 CGRAM

 sendCommand(0xDA); // **** Set Seg Pins HW Config
 sendCommand(0x10);   

 sendCommand(0x81);  // **** Set Contrast
 sendCommand(0xD9);  //
  sendCommand(0x8F);  // **** Set Contrast

 sendCommand(0xF1);

 sendCommand(0xDB);  // **** Set VCOM deselect level
 sendCommand(0x30);  // **** VCC x 0.83

 sendCommand(0xDC);  // **** Set gpio - turn EN for 15V generator on.
 sendCommand(0x03);

 sendCommand(0x78);  // **** Exiting Set OLED Characterization
 sendCommand(0x28);
 //sendCommand(0x2A);
 //sendCommand(0x05); // **** Set Entry Mode (invert)
 sendCommand(0x06); // **** Set Entry Mode

 sendCommand(0x28); // **** Set "IS"=0 , "RE" =0 //28
 sendCommand(0x01);
 sendCommand(0x80); // **** Set DDRAM Address to 0x80 (line 1 start)

 delay(100);
 sendCommand(0x0C);  // **** Turn on Display



 // ********************************************************************//
 // **** Show Data Value *** //

send_string("\0"); send_string("1 English - Term 6  ");   //1   line
send_string("\0"); send_string("2 English - Term 7  ");   //2   line
send_string("\0"); send_string("3 English - Term 8  ");   //3   line
send_string("\0"); send_string("4 English - Term 9  ");   //4   line

/*
sendCommand(0x2C); //2 in 1 line

*/
   
 while(1);

 // **** Show Data Value *** //

}


void sendData(unsigned char data)
{
    Wire.beginTransmission(OLED_Address);  // **** Start I2C
    Wire.write(OLED_Data_Mode);      // **** Set OLED Data mode
    Wire.write(data);
    Wire.endTransmission();                     // **** End I2C
}

void sendCommand(unsigned char command)
{
    Wire.beginTransmission(OLED_Address); // **** Start I2C
    Wire.write(OLED_Command_Mode);      // **** Set OLED Command mode
    Wire.write(command);
    Wire.endTransmission();                  // **** End I2C
      delay(10);
}

void send_string(const char *String)
{
    unsigned char i=0;
    while(String[i])
    {
        sendData(String[i]);      // *** Show String to OLED
        i++;
    }
}

 
Logged

West Yorkshire, UK
Offline Offline
Edison Member
*
Karma: 48
Posts: 1444
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Hmm... not quite as "standard" as I was hoping (I thought the display might be compatible with the standard Aduino lcd library) but as long as you have a working example to demonstrate how to code for it, that's the important thing. Most of that code seems to be for initialising the display (and should really be in the init function, not loop) and there are ways to simplify that.

Nano 3 and Pro Micro are generally cheaper than Uno. I have purchased Pro Micro for less than £2.50 and Nano 3 for around £3 from China/HK on eBay.
Logged

Offline Offline
Newbie
*
Karma: 0
Posts: 18
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Will this Arduino Nano suffice if I want to control a 3rd fan and add a 4th sensor later?:

http://www.ebay.com/itm/331178319577
Logged

West Yorkshire, UK
Offline Offline
Edison Member
*
Karma: 48
Posts: 1444
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Yes, that shouldn't be a problem.

This table shows the differences between Uno and Nano 3:

http://arduino-tutorials.com/wp-content/uploads/2011/12/arduino-board-comparison-chart.png

Nano can be very cheap from China:

http://www.ebay.co.uk/itm/Arduino-Nano-V3-0-with-ATMEGA328P-Module-/291200554253?pt=UK_BOI_Electrical_Components_Supplies_ET&hash=item43cce7d50d

I just spotted this screw-terminal adaptor - could be useful

http://www.ebay.co.uk/itm/Nano-Terminal-Adapter-Board-for-the-Arduino-Nano-V3-0-AVR-ATMEGA328P-AU-Module-/281349447954?pt=UK_BOI_Electrical_Components_Supplies_ET&hash=item4181bbe112:

« Last Edit: July 28, 2014, 08:31:30 am by PaulRB » Logged

Offline Offline
Newbie
*
Karma: 0
Posts: 18
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

It has arrived smiley .  So, how do I connect all this?


* image.jpg (2320.88 KB, 2448x2448 - viewed 18 times.)
Logged

West Yorkshire, UK
Offline Offline
Edison Member
*
Karma: 48
Posts: 1444
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

By doing it one thing at a time, getting a short test sketch working for each component. Only then start combining them.

So... list what you have so far. Do you have a breadboard, some resistors, caps, leds and some solid-core hookup wire? What type of Arduino?

If this is your first Arduino circuit, start with the basic flash-an-led sketch first so you know you have the Arduino IDE installed and working and you can upload a sketch.

Then maybe hook up that display and run the test sketch that came with it. The picture of the connectors on the back of the display from the eBay page was blurry. Post an up-close pic. Its an i2c interface, so there should just be 4 connectors: +V, 0V, SCL and SDA. The SCL/SDA connectors must go to specific connectors on the Arduino. Which ones depends on the type of Arduino. You may also need pull-up resistors (usually 4K7) between SCA and +V and SCL and +V.
« Last Edit: August 08, 2014, 03:30:36 pm by PaulRB » Logged

Offline Offline
Newbie
*
Karma: 0
Posts: 18
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

yes = have
no = do not have...yet  smiley-razz

As I'm trying to keep cost as low as possible and use what I have.  Here is what I have now:

1. solid wire 26 awg = yes
2. Many ~57 ohm resistors and four 3.3K ohm resistors = yes
3. Arduino Uno R3 = yes
4. Breadboard = yes
5. LED bulb = have old flashlights and devices that have LED, but no singular LED bulb.
6.  caps meaning capacitors? = no ( might be able to find some in some junk electronics @ home )

Regarding my temp sensors, is my understanding correct I can plug these 2-pin connectors directly into arduino pins?

Thanks PaulRB!


* image.jpg (480 KB, 2448x786 - viewed 16 times.)
Logged

West Yorkshire, UK
Offline Offline
Edison Member
*
Karma: 48
Posts: 1444
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Have you sucessfully upload anything to the Arduino yet?

Clearly you are going to have to solder some wires to the connectors on the back of the display. Use 4 different colours, ideally red to Vcc, black to Gnd, 2 other colours to sda and scl. Then connect them to +5V, 0V, sda and scl either directly to the Arduino connectors or via your breadboard. Its usual with i2c bus to have a pair of pull-up resistors on sda and scl, but on Uno you can sometimes get away without them.

Then try uploading the sketch you were given for the display. If the sketch uploads ok and nothing happens, try connecting via the breadboard and use your 3K3 as pull-ups.

You cant connect the temp sensors direct to the Arduino because you need to form a voltage divider with a 10K resistor. Have another look at that link you posted earlier to remind yourself.

But concentrate on the display first.

This page tells you which outputs do which jobs on the uno

http://arduino.cc/en/Main/ArduinoBoardUno

You will be using the Analog pins for the thermistors, pwm pins for the fans and the i2c bus is referred to as the twi bus on that page.
« Last Edit: August 10, 2014, 03:01:25 am by PaulRB » Logged

Pages: 1 [2]   Go Up
Jump to: