Peyton SenffnerChrista BarsantiEtienne Lambert
Published © GPL3+

MEGR 3171 Tire Temperature Sensor for Racecar

This device makes it easier and cheaper for racecar hobbyists to collect and analyze data at the racetrack.

IntermediateFull instructions provided10 hours11
MEGR 3171 Tire Temperature Sensor for Racecar

Things used in this project

Hardware components

Argon
Particle Argon
×3
Jumper wires (generic)
Jumper wires (generic)
×25
Breadboard (generic)
Breadboard (generic)
×5
Adafruit Waterproof DS18B20 Digital temperature sensor
Adafruit Waterproof DS18B20 Digital temperature sensor
×1
PTS 645 Series Switch
C&K Switches PTS 645 Series Switch
×1
Adafruit Monochrome 0.96" OLED Graphic Display
×1
Toggle Switch, Toggle
Toggle Switch, Toggle
×1

Software apps and online services

Particle Build Web IDE
Particle Build Web IDE
Maker service
IFTTT Maker service

Story

Read more

Schematics

Display Diagram

This circuit schematic shows how to connect the OLED display to the Particle argon.

Temperature Diagram

This circuit schematic shows how to wire the temperature sensor and a button to a Particle Argon

LED Toggle Diagram

This circuit schematic shows how to connect a switch to a Particle Argon to provide an on/off switch to the system. There is an LED included to make it abundantly clear whether the system is on or off.

Code

Display Code

C/C++
This code is for our OLED display. It uses the particle.Subscribe ability to subscribe to our temperature code. This allows us to output the most recent temperature onto the display. The library used in this code is Adafruit_SSD1306_RK.
//OLED Display Code

#include <SPI.h>
#include <Wire.h>
#include <Adafruit_GFX.h>
#include <Adafruit_SSD1306.h>

#define SCREEN_WIDTH 128                                                // OLED display width, in pixels
#define SCREEN_HEIGHT 64                                                // OLED display height, in pixels

                                                                        // Declaration for an SSD1306 display connected to I2C (SDA, SCL pins)
#define OLED_RESET     -1                                               // Reset pin # (or -1 if sharing Arduino reset pin)
Adafruit_SSD1306 display(SCREEN_WIDTH, SCREEN_HEIGHT, &Wire, OLED_RESET);

int data = D0;                                                          // Create int for data to be declared for later

void setup() {
  
  Serial.begin(9600);

                                                                        // SSD1306_SWITCHCAPVCC = generate display voltage from 3.3V internally
  display.begin(SSD1306_SWITCHCAPVCC, 0x3D);                            // Address 0x3D for 128x64
  
    pinMode(data, OUTPUT);                                              // Declare data as an output
    digitalWrite(data, LOW);
    
   Particle.subscribe("temp", displayTemp, MY_DEVICES);                 // Particle.subscribe("event from other device", event we want to happen, MY_DEVICES)
                                                                        // use MY_DEVICES for a private event

    
}

void displayTemp(const char *event, const char *data) {
          
  display.clearDisplay();                                               // clear any initial screen
      
  display.setTextSize(2);                                               // text size 
  display.setTextColor(WHITE);                                          // text color
  display.setCursor(0,0);                                               // text initial position
  display.println("Temp:");                                             // text - temp label
  display.print(data);                                                  // display data

  display.display();                                                    // display everything above

delay(200);
  
}
  
void loop() {

  }

 

Temperature & Button Code

C/C++
This code is for our temperature sensor and the button. This code recognizes to take the temperature when the button is pressed. It uses the particle.Publish ability to be able to connect it with the display code.
// This #include statement was automatically added by the Particle IDE.
#include "DS18.h"

DS18 tempSensor(D4);

int temp;

int checkHandler(String command) {
        checkTemp();
        
        return 1;
    }
    
int button = D2;


void checkTemp() {
    
    if (tempSensor.read()) {
        temp = (tempSensor.fahrenheit() *100) / 100;
        
        Particle.publish("temp", String(temp));
    }
    
}

void setup() {
    
    pinMode(button, INPUT_PULLUP);                      
    pinMode(temp, OUTPUT);
    
    Particle.variable("Temp", temp);
    
    Particle.function("checkTemp", checkHandler);
    
}

void loop() {
    
    int buttonState = digitalRead(button);
    
    if (buttonState == LOW) {
        
        checkHandler("Temp");
        
    }
    
}
    
    
    
    

Switch Code

C/C++
This code is for our switch. When the switch turns on, there is power to the system. Then, the LED turns on which indicates to us that there is power.
int led = D2; //This indicates which port distributes the voltage through the system.

void setup() { //Initiates the loop system to operate continuously, delivering power.

  pinMode(led, OUTPUT);// Indicates the constant output to go through the digital write port.
  
}
void loop() {
    delay(1000);
      
    digitalWrite(led, HIGH);
    Particle.publish("Power_ON");
     
}

Credits

Peyton Senffner

Peyton Senffner

1 project • 0 followers
Christa Barsanti

Christa Barsanti

1 project • 0 followers
Etienne Lambert

Etienne Lambert

1 project • 0 followers

Comments

Add projectSign up / Login