-
Notifications
You must be signed in to change notification settings - Fork 1
Add files via upload #29
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
lonamle
wants to merge
8
commits into
master
Choose a base branch
from
wheel-speed-IR-sensor
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from 3 commits
Commits
Show all changes
8 commits
Select commit
Hold shift + click to select a range
e836f8a
Add files via upload
lonamle a3fb55e
Add files via upload
lonamle b27d244
Add files via upload
lonamle d77275d
Add files via upload
lonamle 8d0737a
Add files via upload
lonamle f751d8f
Add files via upload
lonamle 9755251
updated RPM calculation to format as float
8730b19
updated to calculate and output velocity value
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,9 @@ | ||
| #include <Arduino.h> | ||
|
|
||
| uint16_t baseTemp(); | ||
|
|
||
|
|
||
| uint16_t brakePressure(); | ||
|
|
||
|
|
||
| uint16_t tirePressure(); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,24 @@ | ||
| #include <Arduino.h> | ||
| #include <ISensorDriver.h> | ||
|
|
||
| uint16_t baseTemp(data, x) | ||
| { | ||
| // for tempurature sensors - analog reading is directly proportional to temperature in deg-C | ||
| uint16_t temperature = data*x; //where x = proportionality constant, | ||
| return temperature; | ||
| }; | ||
|
|
||
| uint16_t brakePressure(data) | ||
| { | ||
| //for brake pressure sensor (MIPAN2XX500PSAAX) | ||
| uint16_t pressure = 625*(data-0.5); // in PSI, V_supply @ 25 deg-C = 5V (ratiometric) | ||
| return pressure; | ||
|
|
||
| }; | ||
|
|
||
| uint16_t tirePressure(data) | ||
| { | ||
| //for coolant pressure sensor (116CP31-M04S2-50) | ||
| uint16_t pressure = 20*(data-0.5); | ||
| return pressure; | ||
| }; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,16 +1,26 @@ | ||
| #include "Logger.h" | ||
|
|
||
| void setup() | ||
| { | ||
| // put your setup code here, to run once: | ||
| Logger::Start(); | ||
| Logger::Notice("Setup"); | ||
| } | ||
|
|
||
| void loop() | ||
| { | ||
| // put your main code here, to run repeatedly: | ||
| Logger::Notice("Hello World"); | ||
|
|
||
| delay(1000); | ||
| } | ||
| #include <Arduino.h> | ||
| #include <ISensorDriver.h> | ||
|
|
||
| int sr = 4; // pin number | ||
|
|
||
| void setup() { | ||
| // put your setup code here, to run once: | ||
| pinMode(sr, OUTPUT); | ||
| Serial.begin(9600); | ||
| Serial.println("Connected"); | ||
| }; | ||
|
|
||
| void loop() { | ||
| int data = analogRead(sr); | ||
|
|
||
| float x=0.5; //temp sensor proportionality constant | ||
|
|
||
| // example implementation of functions | ||
| // data = brakePressure(data); | ||
|
|
||
| //display data | ||
| Serial.print("Sensor reading="); | ||
| Serial.println(data); | ||
|
|
||
| delay(1000); | ||
| }; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,87 @@ | ||
| #include <Arduino.h> | ||
| #include <iostream> | ||
|
|
||
| #define temp_PIN 4 // pin numbers | ||
| #define brakePressure_PIN 5 | ||
| #define coolantPressure_PIN 6 | ||
|
|
||
| #define wheelSpeed_PIN 14 | ||
|
|
||
| #define tempConst 5 // adjustable temperature proportionality constant for testing | ||
|
|
||
| uint16_t wheelPulses=120; // set at random number for testing | ||
|
|
||
| void IRAM_ATTR ISR(){ // interrupt service routine | ||
| wheelPulses ++; | ||
| } | ||
|
|
||
| void setup() { | ||
| // put your setup code here, to run once: | ||
| /*pinMode(temp_PIN, OUTPUT); | ||
| pinMode(brakePressure_PIN, OUTPUT); | ||
| pinMode(coolantPressure_PIN, OUTPUT); */ | ||
| pinMode(wheelSpeed_PIN, OUTPUT); | ||
|
|
||
| // attach interrupt that adds to pulse count when pin goes from HIGH to LOW | ||
| attachInterrupt(wheelSpeed_PIN, ISR, FALLING); | ||
|
|
||
| Serial.begin(9600); | ||
| Serial.println("Connected"); | ||
| }; | ||
|
|
||
| void loop() { | ||
| //------------- functions for temperature and pressure sensors ------------// | ||
|
|
||
| //int tempData = analogRead(temp_PIN); | ||
| //int brakePressureData = analogRead(brakePressure_PIN); | ||
| //int tirePressureData = analogRead(coolantPressure_PIN); | ||
|
|
||
| // example implementation of functions | ||
| // data = brakePressure(data); | ||
|
|
||
| // for tempurature sensors - analog reading is directly proportional to temperature in deg-C | ||
| //uint16_t temperature = tempData*tempConst; | ||
|
|
||
| //for brake pressure sensor (MIPAN2XX500PSAAX) | ||
| //uint16_t brakePressure = 625*(brakePressureData-0.5); // in PSI, V_supply @ 25 deg-C = 5V (ratiometric) //display data | ||
|
|
||
| //for coolant pressure sensor (116CP31-M04S2-50) | ||
| //uint16_t tirePressure = 20*(tirePressureData-0.5); | ||
|
|
||
| // for wheel speed sensor | ||
| //wheelPulses = 0; // start at 0 | ||
|
|
||
| //Serial.print("Temperature reading= "); | ||
| //Serial.println(temperature); | ||
|
|
||
| //Serial.print("Brake pressure reading= "); | ||
| //Serial.println(brakePressure); | ||
|
|
||
| //Serial.print("Tire pressure reading= "); | ||
| //Serial.println(tirePressure); | ||
|
|
||
| //-------------- wheel speed interrupt data --------------// | ||
|
|
||
| delay(1000); // interrupt detects pulses over 1000ms | ||
| uint16_t wheelRPM = wheelPulses/20*60; // 20 pulses from wheel speed sensor corresponds to 1 revolution | ||
|
|
||
| Serial.print("Wheel speed (RPM)= "); | ||
| Serial.println(wheelRPM); | ||
|
|
||
| //-------------- wheel speed sensor testing --------------// | ||
|
|
||
| int wheelSpeedData = analogRead(wheelSpeed_PIN); | ||
|
|
||
|
|
||
| if (wheelSpeedData == 1){ | ||
| Serial.println("Unblocked"); //test | ||
| }; | ||
|
|
||
| if (wheelSpeedData==0){ | ||
| Serial.println("Blocked"); //test | ||
| }; | ||
|
|
||
| //Serial.println(wheelPulses); | ||
|
|
||
| }; | ||
|
|
||
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.