Project 1
Project 1 deals with demonstrating a proof of concept of engine management systems. In this project following design should be implemented using Arduino Uno to have a setup that demonstrates the working model of a typical engine position management system inside an automobile
const int crankSensorPin = A0;
const int camSensorPin = A1;
int crankSensorReading;
int camSensorReading;
void setup() {
Serial.begin(9600); // initialize serial communication at 9600 baud rate
pinMode(crankSensorPin, INPUT); // set pin A0 as an input for the crankshaft position sensor
pinMode(camSensorPin, INPUT); // set pin A1 as an input for the camshaft position sensor
}
void loop() {
crankSensorReading = analogRead(crankSensorPin); // read the crankshaft sensor value
camSensorReading = analogRead(camSensorPin); // read the camshaft sensor value
Serial.print("Crankshaft position sensor: ");
Serial.println(crankSensorReading); // print the crankshaft sensor value to the serial monitor
Serial.print("Camshaft position sensor: ");
Serial.println(camSensorReading); // print the camshaft sensor value to the serial monitor
delay(1000); // delay for 1 second
}
This code uses the Arduino Uno board to read the sensor value of two sensors, one for crankshaft and one for camshaft position. The sensor values are read in the loop function, and are then printed to the serial monitor. You can observe the sensor values in the serial monitor in the Arduino IDE.