Go Down

Topic: 2-fan controller with OLED Display and navigation knob? (Read 1 time) previous topic - next topic

iLearn

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.

PaulRB

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.

PaulRB

#17
Jul 19, 2014, 10:04 am Last Edit: Jul 19, 2014, 10:16 am by PaulRB Reason: 1
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

iLearn

Awesome, thank you!  8)

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

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

PaulRB

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

iLearn

#20
Jul 22, 2014, 04:44 am Last Edit: Jul 22, 2014, 05:04 am by iLearn Reason: 1
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?


iLearn

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

Code: [Select]
//***************************************//
// --- 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++;
    }
}


PaulRB

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.

iLearn

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

PaulRB

#24
Jul 28, 2014, 03:28 pm Last Edit: Jul 28, 2014, 03:31 pm by PaulRB Reason: 1
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:


iLearn

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

PaulRB

#26
Aug 08, 2014, 10:29 pm Last Edit: Aug 08, 2014, 10:30 pm by PaulRB Reason: 1
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.

iLearn

yes = have
no = do not have...yet  :P

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!

PaulRB

#28
Aug 10, 2014, 09:34 am Last Edit: Aug 10, 2014, 10:01 am by PaulRB Reason: 1
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.

Go Up