MEGR 3171 Engine Sound, Acceleration, and Temperature Sensor

0 8977 Medium

This sound system will measure the temperature, acceleration, and sound emitted from any engine.

projectImage

Things used in this project

Hardware components

HARDWARE LIST
1 DFRobot DFR0034 Sound Sensor
11 Jumper wires (generic)
1 SparkFun Triple Axis Accelerometer Breakout - ADXL335
1 Amazon Web Services NTC 10KOhm Thermistor
3 Particle Argon
3 Breadboard (generic)

Software apps and online services

 

Particle Build Web IDE

 

ThingSpeak API

 

Fritzing

Story

 

The purpose of this project is to determine differences in characteristics of different types of exhaust systems. Due to environmental regulations today, the common exhaust system includes a catalytic converter to scrub unwanted particulates from combustion and resonators and mufflers for sound dampening. Two exhausts will be tested using a temperature sensor, accelerometer, and sound sensor. One of the vehicles included all components mentioned above for the common exhaust system. This vehicle was used as the control in order to test various other types of exhaust systems if needed in the future. For this example, the other example used did not have a catalytic converter and housed a downpipe, which drastically changed the sound emitted from the system, also resulting in a change in temperature that came from the catalytic converter being absent. The temperature sensor then told us how a component of the exhaust affected the temperature of the surrounding parts, especially as the engine was started and began to warm. The accelerometer will give data from any changes in movement i.e. any vibration issues that could come from modifications. The sound sensor told us how different modifications to an exhaust system could affect the sound the engine output. The data collected from this project will be useful to someone looking to modify their exhaust system as it shows how removing parts will affect the integrity and noise level of the system. This system that has been created would be appealing to the general population of vehicle owners because the results could tell if there are any overheating issues or shaking issues with the exhaust. I know from personal experience that using this for the sound sensor especially would have helped me in the past with vehicular issues. This solution to checking for any exhaust issues is unique to any other option that I have seen before. Not only is this option less expensive, but also it will be quick and easy for any issue that could come up. Now that the team has figured out how to work with the Particle Argon, ThingSpeak, and Fritzing, this solution is much easier to make for the problem put before the team. After learning how to use basic C++ commands, this project quickly came to life.

Project Setup

projectImage
projectImage
projectImage
projectImage
projectImage

ThingSpeak Data

 

ThingSpeak was used to track the data received from the Particle Argons. Once the data was received, the data was graphed as the data was live. Below are the four different graphs used in order to show the changes in each variable at different times throughout the project. The live data can be found at the links below.

 

Accelerometer and Sound Sensor: https://thingspeak.com/channels/1571995

 

Temperature Sensor: https://thingspeak.com/channels/1582439

projectImage
projectImage
projectImage
projectImage

Schematics

 

Accelerometer Fritzing Circuit Diagram

This is the diagram of how the accelerometer was connected to the Particle Argon. The accelerometer ADXL335 had six connections. The VCC was connected to the 3V3 pin on the Argon. The GRD was connected to the Argon GRD pin. The X pin was connected to the A1 Argon pin. The Y and Z pins were connected to the A2 and A3 pins on the Argon respectively.

projectImage

Thermistor Fritzing Circuit Diagram

This is the circuit diagram for the temperature sensor connected to the second Argon. In this circuit, a 10 KOhm Resistor was used, as well as the 20KOhm NTC Thermistor. As seen in the diagram, the resistor was connected on one leg to both the thermistor and the A3 pin of the Argon. The second resistor leg was connected to the ground pin of the Argon. The other leg of the thermistor was connected to the 3V3 Argon pin in order to give power to the circuit.

projectImage

Sound Sensor Fritzing Circuit Diagram

This sound sensor DFR0034 was used in order to intake any sound data that may come from the car's exhaust or engine. There were only three pins that were on the sound sensor that needed connection to the third Particle Argon. The VCC pin is connected to the 3V3 pin on the Argon in order to give power to the circuit. The GND pin then was connected to the GND pin on the Argon. The final sensor pin with the output was connected to the A0 Argon pin.

projectImage

Code

 

Accelerometer Sensor Code

C/C++

This code has a twofold purpose. It first is coded to read the sensor data and output specific values if the sensor is connected correctly. The second purpose of this code is to take all the data that is recorded from the acceleration sensor and transfer the data onto graphs on ThingSpeak.

CODE
// This #include statement was automatically added by the Particle IDE.
#include <ThingSpeak.h>

TCPClient client;

unsigned long myChannelNumber = 1571995;		
const char * myWriteAPIKey = "4OF8C29D3MSP8SOY";

const int x_out = A1; /* connect x_out of module to A1 of Particle Photon board */ 
const int y_out = A2; /* connect y_out of module to A2 of Particle Photon board */ 
const int z_out = A3; /* connect z_out of module to A3 of Particle Photon board */ 

void setup() 
{  
  // Subscribe to the integration response event
  Particle.subscribe("hook-response/Project3171_", myHandler, MY_DEVICES);
}

void myHandler(const char *event, const char *data) {
  // Handle the integration response
  
Serial.begin(9600);  

}
void loop() {

int x_adc_value, y_adc_value, z_adc_value; 
double x_g_value, y_g_value, z_g_value;   
double roll, pitch, yaw;  

x_adc_value = analogRead(x_out); /* Digital value of voltage on x_out pin */    
y_adc_value = analogRead(y_out); /* Digital value of voltage on y_out pin */   
z_adc_value = analogRead(z_out); /* Digital value of voltage on z_out pin */    

Serial.print("x = ");   
Serial.print(x_adc_value);   
Serial.print("\t\t");   
Serial.print("y = ");   
Serial.print(y_adc_value);   
Serial.print("\t\t");   
Serial.print("z = ");   
Serial.print(z_adc_value);   
Serial.print("\t\t"); 


x_g_value = ((((double)(x_adc_value * 3.3) / 4095) - 1.65) / 0.330);
y_g_value = ((((double)(y_adc_value * 3.3) / 4095) - 1.65) / 0.330);
z_g_value = ((((double)(z_adc_value * 3.3) / 4095) - 1.65) / 0.330);

roll = (((atan2(y_g_value , z_g_value) * 180) / 3.14) + 180);
pitch = (((atan2(z_g_value , x_g_value) * 180) / 3.14) + 180);

 String data = String(roll);
 
const char * eventName = "Project3171_";        
    unsigned long myChannelNumber =1571995;
    const char * myWriteAPIKey = "4OF8C29D3MSP8SOY";
       // Particle.publish(eventName, "{ \"Roll\": \"" + String(roll) + "\", \"Pitch\": \"" + String(pitch) + "\", \"key\": \"" + myWriteAPIKey + "\" }", PRIVATE);  
        Particle.publish(eventName, "{ \"Roll\": \"" + String(roll) + "\", \"Pitch\": \"" + String(pitch) + "\"}", PRIVATE);  

}

Temperature Sensor Code

C/C++

This code also has a twofold purpose. It first is coded to read the sensor data and output specific values if the sensor is connected correctly. The second purpose of this code is to take all the data that is recorded from the temperature sensor and transfer the data onto graphs on ThingSpeak.

CODE
// This #include statement was automatically added by the Particle IDE.
#include <ThingSpeak.h>

TCPClient client;

unsigned long myChannelNumber = 1571995;		
const char * myWriteAPIKey = "4OF8C29D3MSP8SOY";

const int thermistor_output = A3;
void setup() {

  // Subscribe to the integration response event
  Particle.subscribe("hook-response/Project3171_", myHandler, MY_DEVICES);
}

void myHandler(const char *event, const char *data) {
  // Handle the integration response

Serial.begin(9600);
 
double temperature;
}

void loop() {
int thermistor_adc_val;
double output_voltage, thermistor_resistance, therm_res_ln, Temperature;

thermistor_adc_val = analogRead(thermistor_output);

output_voltage = ((thermistor_adc_val * 3.3)/ 4095.0);

thermistor_resistance = ((3.3 * (10/output_voltage))-10);

thermistor_resistance = thermistor_resistance * 1000;

therm_res_ln = log(thermistor_resistance);

Temperature = (1/(0.001129148 + (0.000234125 * therm_res_ln)+( 0.0000000876741 * therm_res_ln * therm_res_ln)));

Temperature = Temperature - 273.15;
Temperature = ((Temperature*1.8) + 32)-15;

String data = String(Temperature);
delay(10000);

Serial.print("Temperature=");
Serial.print(Temperature);
Serial.print("\n\n");

 const char * eventName = "Project3171_";        
        unsigned long myChannelNumber =1571995;
        const char * myWriteAPIKey = "4OF8C29D3MSP8SOY";
        Particle.publish(eventName, "{ \"Temperature\": \"" + String(Temperature) + "\", \"key\": \"" + myWriteAPIKey + "\" }", PRIVATE, NO_ACK);  
    
	delay(10000);
}

Sound Sensor Code

C/C++

This code also has a twofold purpose. It first is coded to read the sensor data and output specific values if the sensor is connected correctly. The second purpose of this code is to take all the data that is recorded from the sound sensor and transfer the data onto graphs on ThingSpeak.

CODE
// This #include statement was automatically added by the Particle IDE.
#include <ThingSpeak.h>

int sensorPin = A0; //analog --> most helpful when recording realtime data!!
int Decibel = 0; //define variable to store analog value

TCPClient client;

unsigned long myChannelNumber = 1571995;		
const char * myWriteAPIKey = "4OF8C29D3MSP8SOY";

const int sound_output = A0;

void setup()  {
    
    // Subscribe to the integration response event
    Particle.subscribe("hook-response/Project3171_", myHandler, MY_DEVICES);
}

void myHandler(const char *event, const char *data) {
  // Handle the integration response
 

Serial.begin(9600);
}
void loop()
{
    Decibel = analogRead(sensorPin);
    Serial.println(String(Decibel) );//print analog value onto serial monitor
    delay(5000);
     String data = String(Decibel);
     
 const char * eventName = "Project3171_";        
        unsigned long myChannelNumber =1571995;
        const char * myWriteAPIKey = "4OF8C29D3MSP8SOY";
       // Particle.publish(eventName, "{ \"Roll\": \"" + String(roll) + "\", \"Pitch\": \"" + String(pitch) + "\", \"key\": \"" + myWriteAPIKey + "\" }", PRIVATE);  
                Particle.publish(eventName, "{ \"Decibel\": \"" + String(Decibel) + "\", \"key\": \"" + myWriteAPIKey + "\"}", PRIVATE, NO_ACK);  


	delay(5000);
}

The article was first published in hackster, November 23, 2021

cr: https://www.hackster.io/dshirill/megr-3171-lake-data-project-a09395

author: Daniel Shirilla

License
All Rights
Reserved
licensBg
0