Gregory H. WebbCully Crott
Published © GPL3+

Keeping It Cool

"Keeping It Cool" is a project that implements the use of two Particle Photons to control the temperature of a vehicle's intercooler.

IntermediateShowcase (no instructions)7 hours404
Keeping It Cool

Things used in this project

Hardware components

Photon
Particle Photon
×2
Breadboard (generic)
Breadboard (generic)
×2
Resistor Kit
×1
Particle Maker Kit
×2
Intake Air Temperature Sensor
×2
Windshield Whiper Reservoir
×1
Windshield Washer Hose
×1
Flexible Coupling 2 in x 2 in
×1

Software apps and online services

Particle Build Web IDE
Particle Build Web IDE

Hand tools and fabrication machines

7/16 inch Drill Bit
Black and Decker Drill

Story

Read more

Custom parts and enclosures

Project Graphs

These graphs show the data received from the sensors during the experiment

Schematics

Circuit 1. Transmitter Configuration

BLACK LINE-Connects from particle photon pin GND to negative terminal
ORANGE LINE-Connects from particle photon pin 3v3 to positive terminal
PURPLE LINE-Connects from particle photon positive terminal to 22k ohm resistor
RESISTORS-The resistors in series are 22k,1k,10k, and 2.2k ohm resistors.
RED LINE-Connects to end of resistors in series to positive power supply
YELLOW LINE-connects from particle photon pin A0 to end of resistors in series

Circuit 2. Receiver Configuration

BLUE LINE-Connects from particle photon pin GND to LCD pin GND
RED LINE-Connects from particle photon pin 3v3 to LCD pin VCC
GREEN LINE-Connects from particle photon pin D0 to LCD pin D0
ORANGE LINE-Connects from particle photon pin D1 to LCD pin D1
Yellow LINE-Connects from particle photon pin D4 to LCD pin RST
PURPLE LINE-Connects from particle photon pin D2 to LCD pin DC
GREY LINE-Connects from particle photon pin D3 to LCD pin CS

Temperature Sensors

These are the two temperature sensors placed in a rubber coupling that should be placed before and after the intercooler in order to measure the temperature difference.

Project Components

This is a picture of the different components being put together and finally assembled and ready for testing

Code

Transmitter Code (Publisher)

C/C++
This is the code ran by the first particle photon and the hardware set-up can be seen in the circuit diagram 1. This code is responsible for recording the temperature from the sensors and sending the values obtained to the second particle photon.
// This #include statement was automatically added by the Particle IDE.


#include <math.h>

const int PULLUP_RES = 35200; // in Ohms

const double BETA = 4390; // In Kelvin

const double THERMISTOR_RES = 100000; // in Ohms

const double THERMISTOR_NOM_TEMP = 21; // Celcius

bool tempHot = false;

const int maxictemp = 24.6;

int led = D7;
int negrelay= D6;
int posrelay= D5;

void setup()
{
    pinMode(led, OUTPUT);
}

void loop()
{
    thermistor_temp(analogRead(0)); // where 0 is pin A0
    delay(1000);
    thermistor_temp2(analogRead(3));
}

void thermistor_temp(int aval)
{
    
    double R, T;
    
    R = (double) PULLUP_RES / ((4095 / (double) aval ) - 1 );
    
    T = 1 / (1 / (THERMISTOR_NOM_TEMP + 273.15 )) + (( 1 / BETA ) - log ( R / THERMISTOR_RES));
    
    T -= 273.15;
    
    T += 32;
    
    delay(500);
     Particle.publish("Temperature_Post_Intercooler", String (T) + "*F", PUBLIC);
     Particle.variable("TPIC", T);


    
    if (T>=59) 
    {
        
            tempHot==true;
            delay(10000);
            digitalWrite(led,HIGH);
            Particle.publish("tempHot",10);
    }
    
    
    else {
       tempHot==false;
        digitalWrite(led,LOW);
    }
            
   // if (T<59)
           // {
               // tempHot==false;
                //digitalWrite(led,LOW);
            
       // }
        
}

    void thermistor_temp2(int aval)

    {
    double R_2, T_Pre;
    
    R_2 = (double) PULLUP_RES / ((4095 / (double) aval ) - 1 );
    
    T_Pre = 1 / (1 / (THERMISTOR_NOM_TEMP + 273.15 )) + (( 1 / BETA ) - log ( R_2 / THERMISTOR_RES));
    
    T_Pre -= 273.15;
    
    T_Pre += 32;
    
    delay(500);
     Particle.publish("Temperature_Pre_Intercooler", String (T_Pre) + "*F", PUBLIC);
     Particle.variable("TPIC_Pre", T_Pre);
}

Receiver Code (Subscriber)

C/C++
This is the code for the second particle photon. This code is subscribed to the previous one and retrieves values measured and displays them on an LCD screen for visual aid. The hardware set-up for this particle photon can be seen below in the circuit diagram 2 display.
#include "Adafruit_GFX.h"
#include "Adafruit_SSD1306.h"

// Uncomment this block to use hardware SPI
// If using software SPI (the default case):
#define OLED_MOSI   D0
#define OLED_CLK    D1
#define OLED_DC     D2
#define OLED_CS     D3
#define OLED_RESET  D4
Adafruit_SSD1306 display(OLED_MOSI, OLED_CLK, OLED_DC, OLED_RESET, OLED_CS);

int test = D7;

#if (SSD1306_LCDHEIGHT != 64)
#error("Height incorrect, please fix Adafruit_SSD1306.h!");
#endif

void setup()   {  
   // Particle.subscribe("BodyTemp", String::format("%3.1f *C", (float)tempC));
  
  Serial.begin(9600);
  // by default, we'll generate the high voltage from the 3.3v line internally! (neat!)
  /*
  display.println("");
  display.println("");
  //display.println("www.sarathiblog.com");
  
  delay(2000);
  /*
  display.startscrollleft(0x00, 0x07);
  delay(2000);
  display.stopscroll();*/
  Particle.subscribe("Temperature_Post_Intercooler",thermistor_temp, "270041000d47343438323536");    
  Particle.variable("TPIC","270041000d47343438323536");
 
}
void thermistor_temp(const char *event, const char *data)
{
    display.begin(SSD1306_SWITCHCAPVCC);
  // init done
  int x = display.width();
  display.display(); // show splashscreen
  delay(2000);
  display.clearDisplay();   // clears the screen and buffer
 // display.setTextWrap(false);
  //testscrolltext();
  // text display tests
  display.setTextSize(2);
  display.setTextColor(WHITE);
  display.setCursor(0,0);
    display.println(data); 
    pinMode(test, OUTPUT);
    digitalWrite(D7,HIGH);
    display.display();
}

Credits

Gregory H. Webb

Gregory H. Webb

1 project • 1 follower
UNCC Mechanical Engineering
Cully Crott

Cully Crott

1 project • 1 follower

Comments