Moved to:

http://www.killerbug.net

Over the past few weeks, I have posted various bits of Arduino sketches for controlling 7-segment displays and reading thermistors. This has all been leading up to this release.

So What is a “Hardware Mod Firmware”? It is a basic sketch that does all the things that most PS3 modders will want to do, while leaving room for other things. It supports from 1-4 thermistors, and you can use 0, 2, 4, 6, or 8 displays to read out the various temperatures. It also transmits the 4 temperatures by serial to a PC or other device with a serial monitor; so you can read all 4 temperatures without any 7-segment displays. Based on the temperatures gathered, the fan speed is set. I intend to refine the process considerably…right now, it is extremely aggressive in trying to maintain a very small heat range…because of this, the fan sounds a bit like a car revving the engine. Smoothing this out is just one of several things on my unofficial “to do” list…but if anyone has any other ideas, feel free to post…you might even think up something that I didn’t.

The sketch is highly configurable; supporting ground and hot controlled displays, and being easily adaptable to different thermistors. The sketch will work fine with any combination of 1-4 thermistors, and 0-8 displays as is; you do not need to modify anything if you are not using sensor(s) or display(s). The minimum number of thermal sensors is 1, but I recommend at least 2…3 for BC units. The 4th sensor is completely useless if you do not have all eight of the 7-segment displays as it does not factor into the fan speed calculations…that is another thing I am thinking of adding.

Unofficial “TO DO” List:

-Incorporate intake temperature into fan speed calculations (?maybe?).

-Smooth out fan curve and try to make it change less suddenly.

-Cut size, leaving more room for other things.

-Move some of the stuff from loop() into dedicated functions; to make writing things in loop() easier.

-A few other things I won’t even mention until I figure out if they are theoretically possible…I know one of them is possible with a Teensy 2.0++; but that is a much better chip than the ATmega328p.

-Add fan speed percentage to the serial report and to one of the displays (probably alternating with intake temperature on the same pair of displays).

// This is a script primarly designed for Sony PS3 mods, but designed to be easily // changable for other applications. // // PS3_HW_MOD_FW_KillerBug_Arduino - Version 0.01a // // By Killer Bug // // // Features: // 1.) Reads 4 thermistors, translates reading to degrees celsius. // -As the script is designed, these are placed as follows: // -Thermistor 0 is attached to CPU heatsink base // -Thermistor 1 is attached to GPU heatsink base // -Thermistor 2 is attached to the northbridge chip, or the emotion engine if equiped. // -Thermistor 3 is placed at the front, in front of the vents, to get room temperature. // // 2.) Displays the 4 thermistor readings on 7-segment displays. // -Displays are setup in four pairs, and controlled by just two Arduino pins. // -This script is designed for ground-controlled displays with ground controlled // decimal points. It can be converted to work with hot-controlled displays with // hot-controlled decimal points. To do this, first make a copy of all the // instructions between the two sets of long ==== lines elsewhere , as the process // will destroy the instructions before you are done doing the steps: // ========================================================== // Search for each of the first halves of // the lines below (without the quotes), and // replace with the second half of the line // (without the quotes) (these must be done // in the order shown): // "gpiotmp |= 1 << 0;" = "gp0" // "gpiotmp |= 1 << 1;" = "gp1" // "gpiotmp |= 1 << 2;" = "gp2" // "gpiotmp |= 1 << 3;" = "gp3" // "gpiotmp |= 1 << 4;" = "gp4" // "gpiotmp |= 1 << 5;" = "gp5" // "gpiotmp |= 1 << 6;" = "gp6" // "gpiotmp |= 1 << 7;" = "gp7" // "gpiotmp &= ~(1 << 0);" = "gpiotmp |= 1 << 0;" // "gpiotmp &= ~(1 << 1);" = "gpiotmp |= 1 << 1;" // "gpiotmp &= ~(1 << 2);" = "gpiotmp |= 1 << 2;" // "gpiotmp &= ~(1 << 3);" = "gpiotmp |= 1 << 3;" // "gpiotmp &= ~(1 << 4);" = "gpiotmp |= 1 << 4;" // "gpiotmp &= ~(1 << 5);" = "gpiotmp |= 1 << 5;" // "gpiotmp &= ~(1 << 6);" = "gpiotmp |= 1 << 6;" // "gpiotmp &= ~(1 << 7);" = "gpiotmp |= 1 << 7;" // "gp0" = "gpiotmp &= ~(1 << 0);" // "gp1" = "gpiotmp &= ~(1 << 1);" // "gp2" = "gpiotmp &= ~(1 << 2);" // "gp3" = "gpiotmp &= ~(1 << 3);" // "gp4" = "gpiotmp &= ~(1 << 4);" // "gp5" = "gpiotmp &= ~(1 << 5);" // "gp6" = "gpiotmp &= ~(1 << 6);" // "gp7" = "gpiotmp &= ~(1 << 7);" // ========================================================== // // Circuits for the thermistors: // // HOT -> 100K Resistor 0 _____ CPU Thermistor -> Ground // | // Arduino A0 // // HOT -> 100K Resistor 1 _____ GPU Thermistor -> Ground // | // Arduino A1 // // HOT -> 100K Resistor 2 _____ Exhaust Thermistor -> Ground // | // Arduino A2 // // HOT -> 100K Resistor 3 _____ Intake Thermistor -> Ground // | // Arduino A3 // // // Pinout for the MCP23008 chips: // // IC | PIN | Connection //---------------------- // All| 1 | Arduino Analog 5 // All| 2 | Arduino Analog 4 // 0 | 3 | GND // 0 | 4 | GND // 0 | 5 | GND // 1 | 3 | GND // 1 | 4 | GND // 1 | 5 | 5V // 2 | 3 | GND // 2 | 4 | 5V // 2 | 5 | GND // 3 | 3 | GND // 3 | 4 | 5V // 3 | 5 | 5V // 4 | 3 | 5V // 4 | 4 | GND // 4 | 5 | GND // 5 | 3 | 5V // 5 | 4 | GND // 5 | 5 | 5V // 6 | 3 | 5V // 6 | 4 | 5V // 6 | 5 | GND // 7 | 3 | 5V // 7 | 4 | 5V // 7 | 5 | 5V // ALL| 6 | 5V // ALL| 9 | GND // ALL| 18 | 5V // // Pins 10-16 of each device drive the 7 segments, as shown here: // // 10 // ________ // | | // 15 | | 11 // | 16 | // |________| // | | // 14 | | 12 // | | // |________| // 13 // // // // This is designed for a specific thermistor, the // Vishay NTCLE100E3104HB0. This is a common and // affordable thermistor, although it is not the // most accurate available. // // If you would like to switch to another // thermistor because this part number is not // available in your country, or because you would // like better accuracy, you will want to find a // part with the same resistance @ temperature // ratings, or else you will have to spend a lot // of time rewriting the main body of the // "getCelsius" command: // // 00C = 340.9 K ohm // 05C = 263.1 K ohm // 10C = 204.4 K ohm // 15C = 160.0 K ohm // 20C = 126.1 K ohm // 25C = 100.0 K ohm // 30C = 79.81 K ohm // 35C = 64.08 K ohm // 40C = 51.75 K ohm // 45C = 42.02 K ohm // 50C = 34.31 K ohm // 55C = 28.16 K ohm // 60C = 23.22 K ohm // 65C = 19.25 K ohm // 70C = 16.02 K ohm // 75C = 13.40 K ohm // 80C = 11.26 K ohm // 85C = 9.496 K ohm // 90C = 8.042 K ohm // 95C = 6.837 K ohm // 100C = 5.835 K ohm // // // The MCP23008 datasheet specifies that the maximum current for // the chip is 125mA. Because of this, the maximum amperage per // segment for a 7-digit display with no decimal point should be // kept at or under 15mA. If you are using a decimal point, the // amperage should be kept at or under 12mA. // #include <Wire.h> #include <avr/pgmspace.h> #include <WProgram.h> int thermPin0 = A0; //Arduino Analog pin 0 = CPU Temp int thermPin1 = A1; //Arduino Analog pin 1 = GPU Temp int thermPin2 = A2; //Arduino Analog pin 2 = Northbridge/EE Temp int thermPin3 = A3; //Arduino Analog pin 3 = Intake Temp int PWMpin = 10; //Sets digital pin 10 as the PWM control for the fan. short maxTempC = 50; //Sets the temperature where the fan goes to full speed. short yyyy; short rawThermTMP000; short rawThermTMP001; short rawThermTMP002; short rawThermTMP003; short rawThermTMP; short cThermTMP; short therm0C; short therm1C; short therm2C; short therm3C; short rawThermTMP00; short rawThermTMP01; short rawThermTMP02; short rawThermTMP03; short rawThermTMP04; short rawThermTMP05; short rawThermTMP06; short rawThermTMP07; short rawThermTMP08; short rawThermTMP09; short rawThermTMP10; short rawThermTMP11; short rawThermTMP12; short rawThermTMP13; short rawThermTMP14; short rawThermTMP15; short rawThermTMP16; short rawThermTMP17; short rawThermTMP18; short rawThermTMP19; short rawThermTMP20; short rawThermTMP21; short rawThermTMP22; short rawThermTMP23; short rawThermTMP24; short rawThermTMP25; short rawThermTMP26; short rawThermTMP27; short cccc; short highestReading; uint8_t gpio000 = 0xFF; //These will always contain the last signal uint8_t gpio001 = 0xFF; //sent to each respective display, or the uint8_t gpio002 = 0xFF; //signal being sent to that display as part uint8_t gpio003 = 0xFF; //of the running command. uint8_t gpio004 = 0xFF; // uint8_t gpio005 = 0xFF; // uint8_t gpio006 = 0xFF; // uint8_t gpio007 = 0xFF; // uint8_t gpiotmp = 0xFF; void setup(){ pinMode(PWMpin, OUTPUT); //sets the PWM Fan Control pin as an output. startUp(0x20); //These startUp(0x21); //start startUp(0x22); //each startUp(0x23); //of startUp(0x24); //the startUp(0x25); //eight startUp(0x26); //digits startUp(0x27); // digitWrite (0, 10); // If you want a digit to start with digitWrite (1, 10); // a certain number, you can change digitWrite (2, 10); // it here. Removing these lines digitWrite (3, 10); // for any chip will make them start digitWrite (4, 10); // with "8". digitWrite (5, 10); // digitWrite (6, 10); // digitWrite (7, 10); // decPointWrite (0, 0); // If you are using a decimal point, decPointWrite (1, 0); // or if you are using that pin for decPointWrite (2, 0); // some other function, and you want decPointWrite (3, 0); // that decimal point or function to decPointWrite (4, 0); // start by default, just remove the decPointWrite (5, 0); // line from here and it will start decPointWrite (6, 0); // by default. decPointWrite (7, 0); // Serial.begin(9600); //Starts the serial communication } void loop(){ getTemps(); if ((therm0C >= therm1C) && (therm0C >= therm2C)) (highestReading = therm0C); if ((therm1C >= therm0C) && (therm1C >= therm2C)) (highestReading = therm1C); if ((therm2C >= therm0C) && (therm2C >= therm1C)) (highestReading = therm2C); if (highestReading >= maxTempC) (analogWrite(PWMpin, 254)); if (highestReading == (maxTempC - 1)) (analogWrite(PWMpin, 234)); if (highestReading == (maxTempC - 2)) (analogWrite(PWMpin, 213)); if (highestReading == (maxTempC - 3)) (analogWrite(PWMpin, 193)); if (highestReading == (maxTempC - 4)) (analogWrite(PWMpin, 172)); if (highestReading == (maxTempC - 5)) (analogWrite(PWMpin, 152)); if (highestReading == (maxTempC - 6)) (analogWrite(PWMpin, 132)); if (highestReading == (maxTempC - 7)) (analogWrite(PWMpin, 111)); if (highestReading == (maxTempC - 8)) (analogWrite(PWMpin, 91)); if (highestReading == (maxTempC - 9)) (analogWrite(PWMpin, 70)); if (highestReading <= (maxTempC - 10)) (analogWrite(PWMpin, 50)); if ((therm0C >= 0) && (therm0C <= 9)){ digitWrite (1, 0); // Write a "0" on chip 1 if (therm0C == 0) (digitWrite (0, 0)); if (therm0C == 1) (digitWrite (0, 1)); if (therm0C == 2) (digitWrite (0, 2)); if (therm0C == 3) (digitWrite (0, 3)); if (therm0C == 4) (digitWrite (0, 4)); if (therm0C == 5) (digitWrite (0, 5)); if (therm0C == 6) (digitWrite (0, 6)); if (therm0C == 7) (digitWrite (0, 7)); if (therm0C == 8) (digitWrite (0, 8)); if (therm0C == 9) (digitWrite (0, 9)); } if ((therm0C >= 10) && (therm0C <= 19)){ digitWrite (1, 1); if (therm0C == 10) (digitWrite (0,0)); if (therm0C == 11) (digitWrite (0,1)); if (therm0C == 12) (digitWrite (0,2)); if (therm0C == 13) (digitWrite (0,3)); if (therm0C == 14) (digitWrite (0,4)); if (therm0C == 15) (digitWrite (0,5)); if (therm0C == 16) (digitWrite (0,6)); if (therm0C == 17) (digitWrite (0,7)); if (therm0C == 18) (digitWrite (0,8)); if (therm0C == 19) (digitWrite (0,9)); } if ((therm0C >= 20) && (therm0C <= 29)){ digitWrite (1, 2); if (therm0C == 20) (digitWrite (0,0)); if (therm0C == 21) (digitWrite (0,1)); if (therm0C == 22) (digitWrite (0,2)); if (therm0C == 23) (digitWrite (0,3)); if (therm0C == 24) (digitWrite (0,4)); if (therm0C == 25) (digitWrite (0,5)); if (therm0C == 26) (digitWrite (0,6)); if (therm0C == 27) (digitWrite (0,7)); if (therm0C == 28) (digitWrite (0,8)); if (therm0C == 29) (digitWrite (0,9)); } if ((therm0C >= 30) && (therm0C <= 39)){ digitWrite (1, 3); if (therm0C == 30) (digitWrite (0,0)); if (therm0C == 31) (digitWrite (0,1)); if (therm0C == 32) (digitWrite (0,2)); if (therm0C == 33) (digitWrite (0,3)); if (therm0C == 34) (digitWrite (0,4)); if (therm0C == 35) (digitWrite (0,5)); if (therm0C == 36) (digitWrite (0,6)); if (therm0C == 37) (digitWrite (0,7)); if (therm0C == 38) (digitWrite (0,8)); if (therm0C == 39) (digitWrite (0,9)); } if ((therm0C >= 40) && (therm0C <= 49)){ digitWrite (1, 4); if (therm0C == 40) (digitWrite (0,0)); if (therm0C == 41) (digitWrite (0,1)); if (therm0C == 42) (digitWrite (0,2)); if (therm0C == 43) (digitWrite (0,3)); if (therm0C == 44) (digitWrite (0,4)); if (therm0C == 45) (digitWrite (0,5)); if (therm0C == 46) (digitWrite (0,6)); if (therm0C == 47) (digitWrite (0,7)); if (therm0C == 48) (digitWrite (0,8)); if (therm0C == 49) (digitWrite (0,9)); } if ((therm0C >= 50) && (therm0C <= 59)){ digitWrite (1, 5); if (therm0C == 50) (digitWrite (0,0)); if (therm0C == 51) (digitWrite (0,1)); if (therm0C == 52) (digitWrite (0,2)); if (therm0C == 53) (digitWrite (0,3)); if (therm0C == 54) (digitWrite (0,4)); if (therm0C == 55) (digitWrite (0,5)); if (therm0C == 56) (digitWrite (0,6)); if (therm0C == 57) (digitWrite (0,7)); if (therm0C == 58) (digitWrite (0,8)); if (therm0C == 59) (digitWrite (0,9)); } if ((therm0C >= 60) && (therm0C <= 69)){ digitWrite (1, 6); if (therm0C == 60) (digitWrite (0,0)); if (therm0C == 61) (digitWrite (0,1)); if (therm0C == 62) (digitWrite (0,2)); if (therm0C == 63) (digitWrite (0,3)); if (therm0C == 64) (digitWrite (0,4)); if (therm0C == 65) (digitWrite (0,5)); if (therm0C == 66) (digitWrite (0,6)); if (therm0C == 67) (digitWrite (0,7)); if (therm0C == 68) (digitWrite (0,8)); if (therm0C == 69) (digitWrite (0,9)); } if ((therm0C >= 70) && (therm0C <= 79)){ digitWrite (1, 7); if (therm0C == 70) (digitWrite (0,0)); if (therm0C == 71) (digitWrite (0,1)); if (therm0C == 72) (digitWrite (0,2)); if (therm0C == 73) (digitWrite (0,3)); if (therm0C == 74) (digitWrite (0,4)); if (therm0C == 75) (digitWrite (0,5)); if (therm0C == 76) (digitWrite (0,6)); if (therm0C == 77) (digitWrite (0,7)); if (therm0C == 78) (digitWrite (0,8)); if (therm0C == 79) (digitWrite (0,9)); } if ((therm0C >= 80) && (therm0C <= 89)){ digitWrite (1, 8); if (therm0C == 80) (digitWrite (0,0)); if (therm0C == 81) (digitWrite (0,1)); if (therm0C == 82) (digitWrite (0,2)); if (therm0C == 83) (digitWrite (0,3)); if (therm0C == 84) (digitWrite (0,4)); if (therm0C == 85) (digitWrite (0,5)); if (therm0C == 86) (digitWrite (0,6)); if (therm0C == 87) (digitWrite (0,7)); if (therm0C == 88) (digitWrite (0,8)); if (therm0C == 89) (digitWrite (0,9)); } if ((therm0C >= 90) && (therm0C <= 99)){ digitWrite (1, 9); if (therm0C == 90) (digitWrite (0,0)); if (therm0C == 91) (digitWrite (0,1)); if (therm0C == 92) (digitWrite (0,2)); if (therm0C == 93) (digitWrite (0,3)); if (therm0C == 94) (digitWrite (0,4)); if (therm0C == 95) (digitWrite (0,5)); if (therm0C == 96) (digitWrite (0,6)); if (therm0C == 97) (digitWrite (0,7)); if (therm0C == 98) (digitWrite (0,8)); if (therm0C == 99) (digitWrite (0,9)); } if ((therm1C >= 0) && (therm1C <= 9)){ digitWrite (3, 0); if (therm1C == 0) (digitWrite (2,0)); if (therm1C == 1) (digitWrite (2,1)); if (therm1C == 2) (digitWrite (2,2)); if (therm1C == 3) (digitWrite (2,3)); if (therm1C == 4) (digitWrite (2,4)); if (therm1C == 5) (digitWrite (2,5)); if (therm1C == 6) (digitWrite (2,6)); if (therm1C == 7) (digitWrite (2,7)); if (therm1C == 8) (digitWrite (2,8)); if (therm1C == 9) (digitWrite (2,9)); } if ((therm1C >= 10) && (therm1C <= 19)){ digitWrite (3, 1); if (therm1C == 10) (digitWrite (2,0)); if (therm1C == 11) (digitWrite (2,1)); if (therm1C == 12) (digitWrite (2,2)); if (therm1C == 13) (digitWrite (2,3)); if (therm1C == 14) (digitWrite (2,4)); if (therm1C == 15) (digitWrite (2,5)); if (therm1C == 16) (digitWrite (2,6)); if (therm1C == 17) (digitWrite (2,7)); if (therm1C == 18) (digitWrite (2,8)); if (therm1C == 19) (digitWrite (2,9)); } if ((therm1C >= 20) && (therm1C <= 29)){ digitWrite (3, 2); if (therm1C == 20) (digitWrite (2,0)); if (therm1C == 21) (digitWrite (2,1)); if (therm1C == 22) (digitWrite (2,2)); if (therm1C == 23) (digitWrite (2,3)); if (therm1C == 24) (digitWrite (2,4)); if (therm1C == 25) (digitWrite (2,5)); if (therm1C == 26) (digitWrite (2,6)); if (therm1C == 27) (digitWrite (2,7)); if (therm1C == 28) (digitWrite (2,8)); if (therm1C == 29) (digitWrite (2,9)); } if ((therm1C >= 30) && (therm1C <= 39)){ digitWrite (3, 3); if (therm1C == 30) (digitWrite (2,0)); if (therm1C == 31) (digitWrite (2,1)); if (therm1C == 32) (digitWrite (2,2)); if (therm1C == 33) (digitWrite (2,3)); if (therm1C == 34) (digitWrite (2,4)); if (therm1C == 35) (digitWrite (2,5)); if (therm1C == 36) (digitWrite (2,6)); if (therm1C == 37) (digitWrite (2,7)); if (therm1C == 38) (digitWrite (2,8)); if (therm1C == 39) (digitWrite (2,9)); } if ((therm1C >= 40) && (therm1C <= 49)){ digitWrite (3, 4); if (therm1C == 40) (digitWrite (2,0)); if (therm1C == 41) (digitWrite (2,1)); if (therm1C == 42) (digitWrite (2,2)); if (therm1C == 43) (digitWrite (2,3)); if (therm1C == 44) (digitWrite (2,4)); if (therm1C == 45) (digitWrite (2,5)); if (therm1C == 46) (digitWrite (2,6)); if (therm1C == 47) (digitWrite (2,7)); if (therm1C == 48) (digitWrite (2,8)); if (therm1C == 49) (digitWrite (2,9)); } if ((therm1C >= 50) && (therm1C <= 59)){ digitWrite (3, 5); if (therm1C == 50) (digitWrite (2,0)); if (therm1C == 51) (digitWrite (2,1)); if (therm1C == 52) (digitWrite (2,2)); if (therm1C == 53) (digitWrite (2,3)); if (therm1C == 54) (digitWrite (2,4)); if (therm1C == 55) (digitWrite (2,5)); if (therm1C == 56) (digitWrite (2,6)); if (therm1C == 57) (digitWrite (2,7)); if (therm1C == 58) (digitWrite (2,8)); if (therm1C == 59) (digitWrite (2,9)); } if ((therm1C >= 60) && (therm1C <= 69)){ digitWrite (3, 6); if (therm1C == 60) (digitWrite (2,0)); if (therm1C == 61) (digitWrite (2,1)); if (therm1C == 62) (digitWrite (2,2)); if (therm1C == 63) (digitWrite (2,3)); if (therm1C == 64) (digitWrite (2,4)); if (therm1C == 65) (digitWrite (2,5)); if (therm1C == 66) (digitWrite (2,6)); if (therm1C == 67) (digitWrite (2,7)); if (therm1C == 68) (digitWrite (2,8)); if (therm1C == 69) (digitWrite (2,9)); } if ((therm1C >= 70) && (therm1C <= 79)){ digitWrite (3, 7); if (therm1C == 70) (digitWrite (2,0)); if (therm1C == 71) (digitWrite (2,1)); if (therm1C == 72) (digitWrite (2,2)); if (therm1C == 73) (digitWrite (2,3)); if (therm1C == 74) (digitWrite (2,4)); if (therm1C == 75) (digitWrite (2,5)); if (therm1C == 76) (digitWrite (2,6)); if (therm1C == 77) (digitWrite (2,7)); if (therm1C == 78) (digitWrite (2,8)); if (therm1C == 79) (digitWrite (2,9)); } if ((therm1C >= 80) && (therm1C <= 89)){ digitWrite (3, 8); if (therm1C == 80) (digitWrite (2,0)); if (therm1C == 81) (digitWrite (2,1)); if (therm1C == 82) (digitWrite (2,2)); if (therm1C == 83) (digitWrite (2,3)); if (therm1C == 84) (digitWrite (2,4)); if (therm1C == 85) (digitWrite (2,5)); if (therm1C == 86) (digitWrite (2,6)); if (therm1C == 87) (digitWrite (2,7)); if (therm1C == 88) (digitWrite (2,8)); if (therm1C == 89) (digitWrite (2,9)); } if ((therm1C >= 90) && (therm1C <= 99)){ digitWrite (3, 9); if (therm1C == 90) (digitWrite (2,0)); if (therm1C == 91) (digitWrite (2,1)); if (therm1C == 92) (digitWrite (2,2)); if (therm1C == 93) (digitWrite (2,3)); if (therm1C == 94) (digitWrite (2,4)); if (therm1C == 95) (digitWrite (2,5)); if (therm1C == 96) (digitWrite (2,6)); if (therm1C == 97) (digitWrite (2,7)); if (therm1C == 98) (digitWrite (2,8)); if (therm1C == 99) (digitWrite (2,9)); } if ((therm2C >= 0) && (therm2C <= 9)){ digitWrite (5, 0); if (therm2C == 0) (digitWrite (4,0)); if (therm2C == 1) (digitWrite (4,1)); if (therm2C == 2) (digitWrite (4,2)); if (therm2C == 3) (digitWrite (4,3)); if (therm2C == 4) (digitWrite (4,4)); if (therm2C == 5) (digitWrite (4,5)); if (therm2C == 6) (digitWrite (4,6)); if (therm2C == 7) (digitWrite (4,7)); if (therm2C == 8) (digitWrite (4,8)); if (therm2C == 9) (digitWrite (4,9)); } if ((therm2C >= 10) && (therm2C <= 19)){ digitWrite (5, 1); if (therm2C == 10) (digitWrite (4,0)); if (therm2C == 11) (digitWrite (4,1)); if (therm2C == 12) (digitWrite (4,2)); if (therm2C == 13) (digitWrite (4,3)); if (therm2C == 14) (digitWrite (4,4)); if (therm2C == 15) (digitWrite (4,5)); if (therm2C == 16) (digitWrite (4,6)); if (therm2C == 17) (digitWrite (4,7)); if (therm2C == 18) (digitWrite (4,8)); if (therm2C == 19) (digitWrite (4,9)); } if ((therm2C >= 20) && (therm2C <= 29)){ digitWrite (5, 2); if (therm2C == 20) (digitWrite (4,0)); if (therm2C == 21) (digitWrite (4,1)); if (therm2C == 22) (digitWrite (4,2)); if (therm2C == 23) (digitWrite (4,3)); if (therm2C == 24) (digitWrite (4,4)); if (therm2C == 25) (digitWrite (4,5)); if (therm2C == 26) (digitWrite (4,6)); if (therm2C == 27) (digitWrite (4,7)); if (therm2C == 28) (digitWrite (4,8)); if (therm2C == 29) (digitWrite (4,9)); } if ((therm2C >= 30) && (therm2C <= 39)){ digitWrite (5, 3); if (therm2C == 30) (digitWrite (4,0)); if (therm2C == 31) (digitWrite (4,1)); if (therm2C == 32) (digitWrite (4,2)); if (therm2C == 33) (digitWrite (4,3)); if (therm2C == 34) (digitWrite (4,4)); if (therm2C == 35) (digitWrite (4,5)); if (therm2C == 36) (digitWrite (4,6)); if (therm2C == 37) (digitWrite (4,7)); if (therm2C == 38) (digitWrite (4,8)); if (therm2C == 39) (digitWrite (4,9)); } if ((therm2C >= 40) && (therm2C <= 49)){ digitWrite (5, 4); if (therm2C == 40) (digitWrite (4,0)); if (therm2C == 41) (digitWrite (4,1)); if (therm2C == 42) (digitWrite (4,2)); if (therm2C == 43) (digitWrite (4,3)); if (therm2C == 44) (digitWrite (4,4)); if (therm2C == 45) (digitWrite (4,5)); if (therm2C == 46) (digitWrite (4,6)); if (therm2C == 47) (digitWrite (4,7)); if (therm2C == 48) (digitWrite (4,8)); if (therm2C == 49) (digitWrite (4,9)); } if ((therm2C >= 50) && (therm2C <= 59)){ digitWrite (5, 5); if (therm2C == 50) (digitWrite (4,0)); if (therm2C == 51) (digitWrite (4,1)); if (therm2C == 52) (digitWrite (4,2)); if (therm2C == 53) (digitWrite (4,3)); if (therm2C == 54) (digitWrite (4,4)); if (therm2C == 55) (digitWrite (4,5)); if (therm2C == 56) (digitWrite (4,6)); if (therm2C == 57) (digitWrite (4,7)); if (therm2C == 58) (digitWrite (4,8)); if (therm2C == 59) (digitWrite (4,9)); } if ((therm2C >= 60) && (therm2C <= 69)){ digitWrite (5, 6); if (therm2C == 60) (digitWrite (4,0)); if (therm2C == 61) (digitWrite (4,1)); if (therm2C == 62) (digitWrite (4,2)); if (therm2C == 63) (digitWrite (4,3)); if (therm2C == 64) (digitWrite (4,4)); if (therm2C == 65) (digitWrite (4,5)); if (therm2C == 66) (digitWrite (4,6)); if (therm2C == 67) (digitWrite (4,7)); if (therm2C == 68) (digitWrite (4,8)); if (therm2C == 69) (digitWrite (4,9)); } if ((therm2C >= 70) && (therm2C <= 79)){ digitWrite (5, 7); if (therm2C == 70) (digitWrite (4,0)); if (therm2C == 71) (digitWrite (4,1)); if (therm2C == 72) (digitWrite (4,2)); if (therm2C == 73) (digitWrite (4,3)); if (therm2C == 74) (digitWrite (4,4)); if (therm2C == 75) (digitWrite (4,5)); if (therm2C == 76) (digitWrite (4,6)); if (therm2C == 77) (digitWrite (4,7)); if (therm2C == 78) (digitWrite (4,8)); if (therm2C == 79) (digitWrite (4,9)); } if ((therm2C >= 80) && (therm2C <= 89)){ digitWrite (5, 8); if (therm2C == 80) (digitWrite (4,0)); if (therm2C == 81) (digitWrite (4,1)); if (therm2C == 82) (digitWrite (4,2)); if (therm2C == 83) (digitWrite (4,3)); if (therm2C == 84) (digitWrite (4,4)); if (therm2C == 85) (digitWrite (4,5)); if (therm2C == 86) (digitWrite (4,6)); if (therm2C == 87) (digitWrite (4,7)); if (therm2C == 88) (digitWrite (4,8)); if (therm2C == 89) (digitWrite (4,9)); } if ((therm2C >= 90) && (therm2C <= 99)){ digitWrite (5, 9); if (therm2C == 90) (digitWrite (4,0)); if (therm2C == 91) (digitWrite (4,1)); if (therm2C == 92) (digitWrite (4,2)); if (therm2C == 93) (digitWrite (4,3)); if (therm2C == 94) (digitWrite (4,4)); if (therm2C == 95) (digitWrite (4,5)); if (therm2C == 96) (digitWrite (4,6)); if (therm2C == 97) (digitWrite (4,7)); if (therm2C == 98) (digitWrite (4,8)); if (therm2C == 99) (digitWrite (4,9)); } if ((therm3C >= 0) && (therm3C <= 9)){ digitWrite (7, 0); if (therm3C == 0) (digitWrite (6,0)); if (therm3C == 1) (digitWrite (6,1)); if (therm3C == 2) (digitWrite (6,2)); if (therm3C == 3) (digitWrite (6,3)); if (therm3C == 4) (digitWrite (6,4)); if (therm3C == 5) (digitWrite (6,5)); if (therm3C == 6) (digitWrite (6,6)); if (therm3C == 7) (digitWrite (6,7)); if (therm3C == 8) (digitWrite (6,8)); if (therm3C == 9) (digitWrite (6,9)); } if ((therm3C >= 10) && (therm3C <= 19)){ digitWrite (7, 1); if (therm3C == 10) (digitWrite (6,0)); if (therm3C == 11) (digitWrite (6,1)); if (therm3C == 12) (digitWrite (6,2)); if (therm3C == 13) (digitWrite (6,3)); if (therm3C == 14) (digitWrite (6,4)); if (therm3C == 15) (digitWrite (6,5)); if (therm3C == 16) (digitWrite (6,6)); if (therm3C == 17) (digitWrite (6,7)); if (therm3C == 18) (digitWrite (6,8)); if (therm3C == 19) (digitWrite (6,9)); } if ((therm3C >= 20) && (therm3C <= 29)){ digitWrite (7, 2); if (therm3C == 20) (digitWrite (6,0)); if (therm3C == 21) (digitWrite (6,1)); if (therm3C == 22) (digitWrite (6,2)); if (therm3C == 23) (digitWrite (6,3)); if (therm3C == 24) (digitWrite (6,4)); if (therm3C == 25) (digitWrite (6,5)); if (therm3C == 26) (digitWrite (6,6)); if (therm3C == 27) (digitWrite (6,7)); if (therm3C == 28) (digitWrite (6,8)); if (therm3C == 29) (digitWrite (6,9)); } if ((therm3C >= 30) && (therm3C <= 39)){ digitWrite (7, 3); if (therm3C == 30) (digitWrite (6,0)); if (therm3C == 31) (digitWrite (6,1)); if (therm3C == 32) (digitWrite (6,2)); if (therm3C == 33) (digitWrite (6,3)); if (therm3C == 34) (digitWrite (6,4)); if (therm3C == 35) (digitWrite (6,5)); if (therm3C == 36) (digitWrite (6,6)); if (therm3C == 37) (digitWrite (6,7)); if (therm3C == 38) (digitWrite (6,8)); if (therm3C == 39) (digitWrite (6,9)); } if ((therm3C >= 40) && (therm3C <= 49)){ digitWrite (7, 4); if (therm3C == 40) (digitWrite (6,0)); if (therm3C == 41) (digitWrite (6,1)); if (therm3C == 42) (digitWrite (6,2)); if (therm3C == 43) (digitWrite (6,3)); if (therm3C == 44) (digitWrite (6,4)); if (therm3C == 45) (digitWrite (6,5)); if (therm3C == 46) (digitWrite (6,6)); if (therm3C == 47) (digitWrite (6,7)); if (therm3C == 48) (digitWrite (6,8)); if (therm3C == 49) (digitWrite (6,9)); } if ((therm3C >= 50) && (therm3C <= 59)){ digitWrite (7, 5); if (therm3C == 50) (digitWrite (6,0)); if (therm3C == 51) (digitWrite (6,1)); if (therm3C == 52) (digitWrite (6,2)); if (therm3C == 53) (digitWrite (6,3)); if (therm3C == 54) (digitWrite (6,4)); if (therm3C == 55) (digitWrite (6,5)); if (therm3C == 56) (digitWrite (6,6)); if (therm3C == 57) (digitWrite (6,7)); if (therm3C == 58) (digitWrite (6,8)); if (therm3C == 59) (digitWrite (6,9)); } if ((therm3C >= 60) && (therm3C <= 69)){ digitWrite (7, 6); if (therm3C == 60) (digitWrite (6,0)); if (therm3C == 61) (digitWrite (6,1)); if (therm3C == 62) (digitWrite (6,2)); if (therm3C == 63) (digitWrite (6,3)); if (therm3C == 64) (digitWrite (6,4)); if (therm3C == 65) (digitWrite (6,5)); if (therm3C == 66) (digitWrite (6,6)); if (therm3C == 67) (digitWrite (6,7)); if (therm3C == 68) (digitWrite (6,8)); if (therm3C == 69) (digitWrite (6,9)); } if ((therm3C >= 70) && (therm3C <= 79)){ digitWrite (7, 7); if (therm3C == 70) (digitWrite (6,0)); if (therm3C == 71) (digitWrite (6,1)); if (therm3C == 72) (digitWrite (6,2)); if (therm3C == 73) (digitWrite (6,3)); if (therm3C == 74) (digitWrite (6,4)); if (therm3C == 75) (digitWrite (6,5)); if (therm3C == 76) (digitWrite (6,6)); if (therm3C == 77) (digitWrite (6,7)); if (therm3C == 78) (digitWrite (6,8)); if (therm3C == 79) (digitWrite (6,9)); } if ((therm3C >= 80) && (therm3C <= 89)){ digitWrite (7, 8); if (therm3C == 80) (digitWrite (6,0)); if (therm3C == 81) (digitWrite (6,1)); if (therm3C == 82) (digitWrite (6,2)); if (therm3C == 83) (digitWrite (6,3)); if (therm3C == 84) (digitWrite (6,4)); if (therm3C == 85) (digitWrite (6,5)); if (therm3C == 86) (digitWrite (6,6)); if (therm3C == 87) (digitWrite (6,7)); if (therm3C == 88) (digitWrite (6,8)); if (therm3C == 89) (digitWrite (6,9)); } if ((therm3C >= 90) && (therm3C <= 99)){ digitWrite (7, 9); if (therm3C == 90) (digitWrite (6,0)); if (therm3C == 91) (digitWrite (6,1)); if (therm3C == 92) (digitWrite (6,2)); if (therm3C == 93) (digitWrite (6,3)); if (therm3C == 94) (digitWrite (6,4)); if (therm3C == 95) (digitWrite (6,5)); if (therm3C == 96) (digitWrite (6,6)); if (therm3C == 97) (digitWrite (6,7)); if (therm3C == 98) (digitWrite (6,8)); if (therm3C == 99) (digitWrite (6,9)); } Serial.print("CPU = "); Serial.print(therm0C); Serial.print("C / "); Serial.print("GPU = "); Serial.print(therm1C); Serial.print("C / "); Serial.print("Northbridge = "); //Change this to EE if you have a BC PS3. Serial.print(therm2C); Serial.print("C / "); Serial.print("Intake = "); Serial.print(therm3C); Serial.println("C"); delay(500); } // // Below here are the various functions; I put everything right in the sketch...I only // like to use libraries built into Arduino, as it makes copying the sketch into // arduino easier when you don't have to install libraries. // // Functions & Useage: // ------------------- // celsiusConvert(X); //Where "X" is 0-3, for the three thermistors; this function // //is not usually used by itself, but instead by the "getTemps" // //function. If you are using a different thermistor, this is // //the only area you must change. // // getTemps(); //This function will read all 4 sensors, 4 times each. It // //will then average the raw readings, and will call the // //celsiusConvert function for each of the raw averages. // //The outputs are "therm0C", "therm1C", "therm2C", & "therm3C". // // startUp (X); //This command is only used to start the MCP23008 chips which // //control the 7-segment displays. "X" can be 0, 1, 2, or 3. // // decPointWrite (X, Y); //This command is used to turn the decimal points on and off. // // X = 0-7; for the display number. // // Y = 0 or 1. 0=Off, 1=On // // digitWrite (X, Y); //This command writes individual digits to individual displays. // //X = 0-7 - the digit being set // //Y = 0-9, 10 - the number that will be displayed on the digit. // // 0-9 are available. "10" displays nothing. void celsiusConvert(short yyyy){ if (yyyy == 0) (rawThermTMP = rawThermTMP000); if (yyyy == 1) (rawThermTMP = rawThermTMP001); if (yyyy == 2) (rawThermTMP = rawThermTMP002); if (yyyy == 3) (rawThermTMP = rawThermTMP003); if (rawThermTMP <= 58) (cThermTMP = 99); if ((rawThermTMP >= 59) && (rawThermTMP <= 60)) (cThermTMP = 98); if ((rawThermTMP >= 61) && (rawThermTMP <= 62)) (cThermTMP = 97); if ((rawThermTMP >= 63) && (rawThermTMP <= 64)) (cThermTMP = 96); if ((rawThermTMP >= 65) && (rawThermTMP <= 66)) (cThermTMP = 95); if ((rawThermTMP >= 67) && (rawThermTMP <= 68)) (cThermTMP = 94); if ((rawThermTMP >= 69) && (rawThermTMP <= 70)) (cThermTMP = 93); if ((rawThermTMP >= 71) && (rawThermTMP <= 72)) (cThermTMP = 92); if ((rawThermTMP >= 73) && (rawThermTMP <= 74)) (cThermTMP = 91); if ((rawThermTMP >= 75) && (rawThermTMP <= 76)) (cThermTMP = 90); if ((rawThermTMP >= 77) && (rawThermTMP <= 79)) (cThermTMP = 89); if ((rawThermTMP >= 80) && (rawThermTMP <= 81)) (cThermTMP = 88); if ((rawThermTMP >= 82) && (rawThermTMP <= 84)) (cThermTMP = 87); if ((rawThermTMP >= 85) && (rawThermTMP <= 86)) (cThermTMP = 86); if ((rawThermTMP >= 87) && (rawThermTMP <= 89)) (cThermTMP = 85); if ((rawThermTMP >= 90) && (rawThermTMP <= 92)) (cThermTMP = 84); if ((rawThermTMP >= 93) && (rawThermTMP <= 95)) (cThermTMP = 83); if ((rawThermTMP >= 96) && (rawThermTMP <= 98)) (cThermTMP = 82); if ((rawThermTMP >= 99) && (rawThermTMP <= 101)) (cThermTMP = 81); if ((rawThermTMP >= 102) && (rawThermTMP <= 104)) (cThermTMP = 80); if ((rawThermTMP >= 105) && (rawThermTMP <= 108)) (cThermTMP = 79); if ((rawThermTMP >= 109) && (rawThermTMP <= 111)) (cThermTMP = 78); if ((rawThermTMP >= 112) && (rawThermTMP <= 115)) (cThermTMP = 77); if ((rawThermTMP >= 116) && (rawThermTMP <= 118)) (cThermTMP = 76); if ((rawThermTMP >= 119) && (rawThermTMP <= 122)) (cThermTMP = 75); if ((rawThermTMP >= 123) && (rawThermTMP <= 126)) (cThermTMP = 74); if ((rawThermTMP >= 127) && (rawThermTMP <= 130)) (cThermTMP = 73); if ((rawThermTMP >= 131) && (rawThermTMP <= 134)) (cThermTMP = 72); if ((rawThermTMP >= 135) && (rawThermTMP <= 138)) (cThermTMP = 71); if ((rawThermTMP >= 139) && (rawThermTMP <= 142)) (cThermTMP = 70); if ((rawThermTMP >= 143) && (rawThermTMP <= 147)) (cThermTMP = 69); if ((rawThermTMP >= 148) && (rawThermTMP <= 152)) (cThermTMP = 68); if ((rawThermTMP >= 153) && (rawThermTMP <= 157)) (cThermTMP = 67); if ((rawThermTMP >= 158) && (rawThermTMP <= 162)) (cThermTMP = 66); if ((rawThermTMP >= 163) && (rawThermTMP <= 167)) (cThermTMP = 65); if ((rawThermTMP >= 168) && (rawThermTMP <= 173)) (cThermTMP = 64); if ((rawThermTMP >= 174) && (rawThermTMP <= 178)) (cThermTMP = 63); if ((rawThermTMP >= 179) && (rawThermTMP <= 184)) (cThermTMP = 62); if ((rawThermTMP >= 185) && (rawThermTMP <= 189)) (cThermTMP = 61); if ((rawThermTMP >= 190) && (rawThermTMP <= 195)) (cThermTMP = 60); if ((rawThermTMP >= 196) && (rawThermTMP <= 201)) (cThermTMP = 59); if ((rawThermTMP >= 202) && (rawThermTMP <= 208)) (cThermTMP = 58); if ((rawThermTMP >= 209) && (rawThermTMP <= 214)) (cThermTMP = 57); if ((rawThermTMP >= 215) && (rawThermTMP <= 221)) (cThermTMP = 56); if ((rawThermTMP >= 222) && (rawThermTMP <= 227)) (cThermTMP = 55); if ((rawThermTMP >= 228) && (rawThermTMP <= 235)) (cThermTMP = 54); if ((rawThermTMP >= 236) && (rawThermTMP <= 242)) (cThermTMP = 53); if ((rawThermTMP >= 243) && (rawThermTMP <= 249)) (cThermTMP = 52); if ((rawThermTMP >= 250) && (rawThermTMP <= 257)) (cThermTMP = 51); if ((rawThermTMP >= 258) && (rawThermTMP <= 265)) (cThermTMP = 50); if ((rawThermTMP >= 266) && (rawThermTMP <= 273)) (cThermTMP = 49); if ((rawThermTMP >= 274) && (rawThermTMP <= 281)) (cThermTMP = 48); if ((rawThermTMP >= 282) && (rawThermTMP <= 289)) (cThermTMP = 47); if ((rawThermTMP >= 290) && (rawThermTMP <= 298)) (cThermTMP = 46); if ((rawThermTMP >= 299) && (rawThermTMP <= 306)) (cThermTMP = 45); if ((rawThermTMP >= 307) && (rawThermTMP <= 315)) (cThermTMP = 44); if ((rawThermTMP >= 316) && (rawThermTMP <= 325)) (cThermTMP = 43); if ((rawThermTMP >= 326) && (rawThermTMP <= 334)) (cThermTMP = 42); if ((rawThermTMP >= 335) && (rawThermTMP <= 343)) (cThermTMP = 41); if ((rawThermTMP >= 344) && (rawThermTMP <= 353)) (cThermTMP = 40); if ((rawThermTMP >= 354) && (rawThermTMP <= 363)) (cThermTMP = 39); if ((rawThermTMP >= 364) && (rawThermTMP <= 373)) (cThermTMP = 38); if ((rawThermTMP >= 374) && (rawThermTMP <= 384)) (cThermTMP = 37); if ((rawThermTMP >= 385) && (rawThermTMP <= 394)) (cThermTMP = 36); if ((rawThermTMP >= 395) && (rawThermTMP <= 404)) (cThermTMP = 35); if ((rawThermTMP >= 405) && (rawThermTMP <= 415)) (cThermTMP = 34); if ((rawThermTMP >= 416) && (rawThermTMP <= 426)) (cThermTMP = 33); if ((rawThermTMP >= 427) && (rawThermTMP <= 437)) (cThermTMP = 32); if ((rawThermTMP >= 438) && (rawThermTMP <= 448)) (cThermTMP = 31); if ((rawThermTMP >= 449) && (rawThermTMP <= 459)) (cThermTMP = 30); if ((rawThermTMP >= 460) && (rawThermTMP <= 471)) (cThermTMP = 29); if ((rawThermTMP >= 472) && (rawThermTMP <= 483)) (cThermTMP = 28); if ((rawThermTMP >= 484) && (rawThermTMP <= 494)) (cThermTMP = 27); if ((rawThermTMP >= 495) && (rawThermTMP <= 505)) (cThermTMP = 26); if ((rawThermTMP >= 506) && (rawThermTMP <= 517)) (cThermTMP = 25); if ((rawThermTMP >= 518) && (rawThermTMP <= 529)) (cThermTMP = 24); if ((rawThermTMP >= 530) && (rawThermTMP <= 541)) (cThermTMP = 23); if ((rawThermTMP >= 542) && (rawThermTMP <= 552)) (cThermTMP = 22); if ((rawThermTMP >= 553) && (rawThermTMP <= 564)) (cThermTMP = 21); if ((rawThermTMP >= 565) && (rawThermTMP <= 576)) (cThermTMP = 20); if ((rawThermTMP >= 577) && (rawThermTMP <= 588)) (cThermTMP = 19); if ((rawThermTMP >= 589) && (rawThermTMP <= 600)) (cThermTMP = 18); if ((rawThermTMP >= 601) && (rawThermTMP <= 612)) (cThermTMP = 17); if ((rawThermTMP >= 613) && (rawThermTMP <= 623)) (cThermTMP = 16); if ((rawThermTMP >= 624) && (rawThermTMP <= 635)) (cThermTMP = 15); if ((rawThermTMP >= 636) && (rawThermTMP <= 647)) (cThermTMP = 14); if ((rawThermTMP >= 648) && (rawThermTMP <= 658)) (cThermTMP = 13); if ((rawThermTMP >= 659) && (rawThermTMP <= 670)) (cThermTMP = 12); if ((rawThermTMP >= 671) && (rawThermTMP <= 681)) (cThermTMP = 11); if ((rawThermTMP >= 682) && (rawThermTMP <= 692)) (cThermTMP = 10); if ((rawThermTMP >= 693) && (rawThermTMP <= 703)) (cThermTMP = 9); if ((rawThermTMP >= 704) && (rawThermTMP <= 714)) (cThermTMP = 8); if ((rawThermTMP >= 715) && (rawThermTMP <= 725)) (cThermTMP = 7); if ((rawThermTMP >= 726) && (rawThermTMP <= 736)) (cThermTMP = 6); if ((rawThermTMP >= 737) && (rawThermTMP <= 746)) (cThermTMP = 5); if ((rawThermTMP >= 747) && (rawThermTMP <= 756)) (cThermTMP = 4); if ((rawThermTMP >= 757) && (rawThermTMP <= 766)) (cThermTMP = 3); if ((rawThermTMP >= 767) && (rawThermTMP <= 776)) (cThermTMP = 2); if ((rawThermTMP >= 777) && (rawThermTMP <= 786)) (cThermTMP = 1); if (rawThermTMP >= 786) (cThermTMP = 0); if (yyyy == 0) (therm0C = cThermTMP); if (yyyy == 1) (therm1C = cThermTMP); if (yyyy == 2) (therm2C = cThermTMP); if (yyyy == 3) (therm3C = cThermTMP); } void getTemps(){ rawThermTMP00 = analogRead(thermPin0); rawThermTMP01 = analogRead(thermPin1); rawThermTMP02 = analogRead(thermPin2); rawThermTMP03 = analogRead(thermPin3); delay(50); rawThermTMP04 = analogRead(thermPin0); rawThermTMP05 = analogRead(thermPin1); rawThermTMP06 = analogRead(thermPin2); rawThermTMP07 = analogRead(thermPin3); delay(50); rawThermTMP08 = analogRead(thermPin0); rawThermTMP09 = analogRead(thermPin1); rawThermTMP10 = analogRead(thermPin2); rawThermTMP11 = analogRead(thermPin3); delay(50); rawThermTMP12 = analogRead(thermPin0); rawThermTMP13 = analogRead(thermPin1); rawThermTMP14 = analogRead(thermPin2); rawThermTMP15 = analogRead(thermPin3); delay(50); rawThermTMP16 = (rawThermTMP00 + rawThermTMP04); rawThermTMP17 = (rawThermTMP08 + rawThermTMP12); rawThermTMP18 = (rawThermTMP01 + rawThermTMP05); rawThermTMP19 = (rawThermTMP09 + rawThermTMP13); rawThermTMP20 = (rawThermTMP02 + rawThermTMP06); rawThermTMP21 = (rawThermTMP10 + rawThermTMP14); rawThermTMP22 = (rawThermTMP03 + rawThermTMP07); rawThermTMP23 = (rawThermTMP11 + rawThermTMP15); rawThermTMP24 = (rawThermTMP16 + rawThermTMP17); rawThermTMP25 = (rawThermTMP18 + rawThermTMP19); rawThermTMP26 = (rawThermTMP20 + rawThermTMP21); rawThermTMP27 = (rawThermTMP22 + rawThermTMP23); rawThermTMP000 = (rawThermTMP24 / 4); rawThermTMP001 = (rawThermTMP25 / 4); rawThermTMP002 = (rawThermTMP26 / 4); rawThermTMP003 = (rawThermTMP27 / 4); celsiusConvert(0); celsiusConvert(1); celsiusConvert(2); celsiusConvert(3); } void digitWrite (uint8_t aaaa, uint8_t bbbb){ if (aaaa == 0) (cccc = 0x20); if (aaaa == 0) (cccc = 0x20); if (aaaa == 1) (cccc = 0x21); if (aaaa == 2) (cccc = 0x22); if (aaaa == 3) (cccc = 0x23); if (aaaa == 4) (cccc = 0x24); if (aaaa == 5) (cccc = 0x25); if (aaaa == 6) (cccc = 0x26); if (aaaa == 7) (cccc = 0x27); if (aaaa == 0) (gpiotmp = gpio000); if (aaaa == 1) (gpiotmp = gpio001); if (aaaa == 2) (gpiotmp = gpio002); if (aaaa == 3) (gpiotmp = gpio003); if (aaaa == 4) (gpiotmp = gpio004); if (aaaa == 5) (gpiotmp = gpio005); if (aaaa == 6) (gpiotmp = gpio006); if (aaaa == 7) (gpiotmp = gpio007); if (bbbb == 0){ gpiotmp |= 1 << 6; //Set output 1 as hot gpiotmp &= ~(1 << 0); //Set output 0 as ground gpiotmp &= ~(1 << 3); //Set output 2 as ground gpiotmp &= ~(1 << 5); //Set output 3 as ground gpiotmp &= ~(1 << 1); //Set output 4 as ground gpiotmp &= ~(1 << 4); //Set output 5 as ground gpiotmp &= ~(1 << 2); //Set output 6 as ground } if (bbbb == 1){ gpiotmp &= ~(1 << 1); gpiotmp &= ~(1 << 2); gpiotmp |= 1 << 0; gpiotmp |= 1 << 6; gpiotmp |= 1 << 3; gpiotmp |= 1 << 5; gpiotmp |= 1 << 4; } if (bbbb == 2){ gpiotmp &= ~(1 << 0); gpiotmp &= ~(1 << 6); gpiotmp &= ~(1 << 3); gpiotmp |= 1 << 5; gpiotmp &= ~(1 << 1); gpiotmp &= ~(1 << 4); gpiotmp |= 1 << 2; } if (bbbb == 3){ gpiotmp &= ~(1 << 3); gpiotmp &= ~(1 << 2); gpiotmp &= ~(1 << 6); gpiotmp &= ~(1 << 1); gpiotmp &= ~(1 << 0); gpiotmp |= 1 << 5; gpiotmp |= 1 << 4; } if (bbbb == 4){ gpiotmp &= ~(1 << 2); gpiotmp &= ~(1 << 1); gpiotmp &= ~(1 << 6); gpiotmp &= ~(1 << 5); gpiotmp |= 1 << 0; gpiotmp |= 1 << 3; gpiotmp |= 1 << 4; } if (bbbb == 5){ gpiotmp &= ~(1 << 3); gpiotmp &= ~(1 << 2); gpiotmp &= ~(1 << 6); gpiotmp &= ~(1 << 5); gpiotmp &= ~(1 << 0); gpiotmp |= 1 << 1; gpiotmp |= 1 << 4; } if (bbbb == 6){ gpiotmp &= ~(1 << 0); gpiotmp &= ~(1 << 5); gpiotmp &= ~(1 << 4); gpiotmp &= ~(1 << 3); gpiotmp &= ~(1 << 2); gpiotmp &= ~(1 << 6); gpiotmp |= 1 << 1; } if (bbbb == 7){ gpiotmp &= ~(1 << 0); gpiotmp &= ~(1 << 1); gpiotmp &= ~(1 << 2); gpiotmp |= 1 << 6; gpiotmp |= 1 << 3; gpiotmp |= 1 << 5; gpiotmp |= 1 << 4; } if (bbbb == 8){ gpiotmp &= ~(1 << 0); gpiotmp &= ~(1 << 6); gpiotmp &= ~(1 << 3); gpiotmp &= ~(1 << 5); gpiotmp &= ~(1 << 1); gpiotmp &= ~(1 << 4); gpiotmp &= ~(1 << 2); } if (bbbb == 9){ gpiotmp &= ~(1 << 0); gpiotmp &= ~(1 << 6); gpiotmp &= ~(1 << 3); gpiotmp &= ~(1 << 5); gpiotmp &= ~(1 << 1); gpiotmp |= 1 << 4; gpiotmp &= ~(1 << 2); } if (bbbb == 10){ gpiotmp |= 1 << 0; gpiotmp |= 1 << 6; gpiotmp |= 1 << 3; gpiotmp |= 1 << 5; gpiotmp |= 1 << 1; gpiotmp |= 1 << 4; gpiotmp |= 1 << 2; } if (aaaa == 0) (gpio000 = gpiotmp); if (aaaa == 1) (gpio001 = gpiotmp); if (aaaa == 2) (gpio002 = gpiotmp); if (aaaa == 3) (gpio003 = gpiotmp); if (aaaa == 4) (gpio004 = gpiotmp); if (aaaa == 5) (gpio005 = gpiotmp); if (aaaa == 6) (gpio006 = gpiotmp); if (aaaa == 7) (gpio007 = gpiotmp); Wire.beginTransmission(cccc); Wire.send(0x09); Wire.send(gpiotmp); Wire.endTransmission(); } void decPointWrite (short dddd, short eeee){ if (dddd == 0) (gpiotmp = gpio000); //Devices are numbered 0-7. if (dddd == 1) (gpiotmp = gpio001); if (dddd == 2) (gpiotmp = gpio002); if (dddd == 3) (gpiotmp = gpio003); if (dddd == 4) (gpiotmp = gpio004); if (dddd == 5) (gpiotmp = gpio005); if (dddd == 6) (gpiotmp = gpio006); if (dddd == 7) (gpiotmp = gpio007); if (eeee == 0) (gpiotmp |= 1 << 7); if (eeee == 1) (gpiotmp &= ~(1 << 7)); if (dddd == 0) (gpio000 = gpiotmp); if (dddd == 1) (gpio001 = gpiotmp); if (dddd == 2) (gpio002 = gpiotmp); if (dddd == 3) (gpio003 = gpiotmp); if (dddd == 4) (gpio004 = gpiotmp); if (dddd == 5) (gpio005 = gpiotmp); if (dddd == 6) (gpio006 = gpiotmp); if (dddd == 7) (gpio007 = gpiotmp); Wire.beginTransmission(dddd); Wire.send(0x09); Wire.send(gpiotmp); Wire.endTransmission(); } void startUp(uint8_t X){ Wire.begin(); Wire.beginTransmission(X); Wire.send(0x00); Wire.send(0xFF); Wire.send(0x00); Wire.send(0x00); Wire.send(0x00); Wire.send(0x00); Wire.send(0x00); Wire.send(0x00); Wire.send(0x00); Wire.send(0x00); Wire.send(0x00); Wire.endTransmission(); Wire.beginTransmission(X); Wire.send(0x00); Wire.send(0x00); Wire.endTransmission(); }

Awesome work, i have front paged on PS3HaX :)

Congrats, you are on hackaday :)

What about directly reading the on board temp sensors?

http://stefde69.blogspot.com/2011/04/thermal-probes.html

The dev board needed to do it would be almost the same size as the PS3…they are not normal thermistors; they are I2C; and they need to be connected, so you need to sniff and decode.

Seems possible with an arduino or a buspirate:

http://hackaday.com/2011/05/21/arduino-i2c-sniffer/

http://dangerousprototypes.com/docs/Features_overview

You have an emoticon on line 715. It’s due to 8-parenthasis ’8)’

Otherwise, awesome job!

No offense, but your code is so inneficient that it is painful to look at. It should be about 1/10th of this size. Why did you use so many if statements? You must know that the NTC’s resistance has a relatively linear relationship with temperature. You have pages of if statements that should be replaced with a single mathematical statement. You then use a variable in that statement which can be changed to suit other NTC’s.

You have plenty of I/O pins left on the Atmel processor, so why not use 7 pins for the segments of the displays, and another 4 for the commons? This eliminates the need for any sort of display driver, and your code would still be smaller.

I’m sorry for being so critical, but you are posting this as if others should follow your example – They should not! You need to completely re-evaluate how you are doing this.

I know it is crap as it is, it is in a very early stage. I know that every part of it could use some cleaning…but that has to wait. Right now I am trying to make it work perfectly…and then I can worry about making it smaller. I shrunk the size a little last night, and I fixed the “revving engine” issue as well…but I see a few more places where I can easily save 1-2K, so I’m holding off on releasing until I fix those bits.

This is all open source, and I am only making it because it does not exist…you won’t hurt my feelings if you steal the idea and do it better as long as you mention that you did so somewhere in the readme or the // section of the script.

I am confused – What here did not exist already? An Atmel MCU that reads thermistors and displays a temperature? One that also sends the temperature out a UART? Placing thermistors inside a PS3??

If you look around the internet, this has been done thousands of times, in thousands of different ways. You should evaluate the code that other people are using – You have hundreds of if statements that could be replaced with a single statement.

Good luck.

this is in regards to the fan revving. how are your controlling the fan? it cannot be controlled with resistance. it is controlled by pwm i believe. Mr_worried had a good writeup on it at dashhacks but i cannot find his post. this could be part of your problem but i have no idea. you can pm him here to bounce ideas http://forums.dashhacks.com/member.php?u=356247

Yes, using PWM…the reason the fan is revving is because I had the fan speed tied directly to the temperature; and 3/4 of the fan speed range was tied to a 10 degree spread…every time a temperature went up or down by even a single degree, the fan would change speed enough to be easily noticed by noise. This is already fixed in my private beta.

Wouldn’t it be easier to Use PID closed loop control? instead of using a look up table for the speed control?

It would probably be easier if I was willing to give up all speeds below 25C.

file:///C:/Users/tasneem/Downloads/first-fully-working-ps3-hw-mod-firmware.jpg

I don’t even understand how I ended up right here, but I thought this publish used to be great. I don’t understand who you are but

certainly you are going to a well-known blogger should you aren’t already. Cheers!