-
Notifications
You must be signed in to change notification settings - Fork 14
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
Added e46 config and wiki #7
base: master
Are you sure you want to change the base?
Changes from 2 commits
802f831
82dcf8b
b047ae7
006a016
f6ddb2a
4a8dab7
a50ce39
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -4,24 +4,30 @@ The CAN bus is not available at the OBD-II port, so it must be tapped into behin | |
The easiest places to do this are either behind the intrument cluster or at the steering angle sensor, | ||
which is located at the base of the steering column near the firewall. | ||
|
||
![Steering Angle Sensor Plug](../images/e46_sensor_plug.jpg) | ||
|
||
A simple plug-in harness can be made by cutting both sides of this connector and a few inches of wiring | ||
timurrrr marked this conversation as resolved.
Show resolved
Hide resolved
|
||
from a donor car at the salvage yard. Constant and switched power can also be found at this connector. | ||
from a donor car at the salvage yard. The CAN-H and CAN-L are the Yellow/Black and Yellow/Brown wires, respectively. | ||
Constant/switched power and ground can also be found at this connector. The harness pictured does not include the | ||
power/ground. | ||
|
||
![CAN bus harness](../images/e46_harness.jpg) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. It's very hard to see the wire colors on that photos, presumably due to incandescent light source? Also I'd appreciate it if you can shrink/compress the file to be <300 kB. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. If you don't have GIMP/Photoshop to shrink/compress the photo please let me know and I can help with that. |
||
|
||
## Recommended CAN IDs: | ||
|
||
Channel name | CAN ID | Equation | Notes | ||
------------ | --- | -------- | ----- | ||
Accelerator position (%) | 809 | `F * 100 / 255` | | ||
Accelerator position (%) | 809 | `F / 2.54` | | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Umm, why |
||
Brake position (%) | 809 | `G & 1 * 100` | Brake pressures are not available on the main CAN bus, so this is just an on/off signal from the brake switch. | ||
Steering angle | 501 | `if(b & 0x80, 0 - ((b & 0x7f)<<8) \| a, (b<<8) \| a) * 0.04394` | Positive value = turning right. You can swap the equation in the if statement if you prefer it the other way around. | ||
Steering angle | 501 | `if(B & 0x80, -1, 1) * bitsToUIntLe(raw, 0, 15) * 0.04394` | Positive value = turning right. You can swap the equation in the if statement if you prefer it the other way around. | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. FYI I ended up flipping positive/negative in the BRZ/86 equations to match how RaceChrono visualizes the steering angle. You may also want to do left=positive. |
||
Speed | 339 | `bitsToUIntLe(raw, 11, 13) / 16 * 0.277778` | You may want to check the multiplier against an external GPS device, especially if running larger/smaller diameter tires | ||
Engine RPM | 790 | `((D<<8) \| C) / 6.4` | | ||
Engine RPM | 790 | `bytesToUIntLe(raw, 2, 2) / 6.4` | | ||
Coolant temperature | 809 | `B * 0.75 - 48.373` | | ||
Engine oil temperature | 1349 | `E - 48.373` | | ||
Air temperature | 1557 | `D` | | ||
Clutch position (%) | 809 | `D & 1 * 100` | on/off signal from the clutch switch | ||
Fuel level (l) | 1555 | `C & 0x7f` | | ||
Odometer | 1555 | `((B<<8) \| A) *10000` | | ||
Odometer | 1555 | `bytesToUIntLe(raw, 0, 2) * 10000` | | ||
|
||
Below is a table with a few more data channels that might be useful for more | ||
detailed analysis. When adding more channels, be aware that it will increase | ||
|
@@ -30,7 +36,7 @@ update rate of the more essential channels, due to limited Bluetooth bandwidth. | |
However, the communication protocol in RaceChrono is smart enough to optimize | ||
Bluetooth usage if multiple channels share the same CAN ID. As a general rule, | ||
if a new channel has the same CAN ID as an existing channel (such as "Throttle | ||
position" using the same CAN ID 320 as "Accelerator position"), then adding it | ||
position" using the same CAN ID 809 as "Accelerator position"), then adding it | ||
should not affect the update rates. Adding a channel based on a new CAN ID (such | ||
as "Wheel speed FL") will likely affect the update rates of all other channels. | ||
|
||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2,71 +2,71 @@ | |
// (1999-2005 model years). | ||
|
||
#if !defined(RACECHRONO_BIY_BLE_DEVICE_E46_H) | ||
#define RACECHRONO_BIY_BLE_DEVICE_E46_H) | ||
#define RACECHRONO_BIY_BLE_DEVICE_E46_H | ||
|
||
uint8_t getUpdateRateDivider(uint32_t can_id) { | ||
// This is sent over the CAN bus 140 times per second and carries: | ||
// vehicle speed | ||
// Let's go for ~10 per second | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Why so low? It's one of the most important data channels. I use 25 on 86's. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I was having throughput issues in testing and settled on 10Hz. I think this can be tuned further. |
||
if (can_id == 0x153) { | ||
return 14; | ||
if (can_id == 339) { | ||
return 7; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Need to update the comment above to say 20 per second? |
||
} | ||
|
||
// This is sent over the CAN bus 140 times per second and carries: | ||
// individual wheel speeds | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Ditto. Also, consider merging these two |
||
// we want ~10. | ||
if (can_id == 0x1F0) { | ||
return 14; | ||
if (can_id == 496) { | ||
return 7; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. ditto |
||
} | ||
|
||
// This is sent over the CAN bus 100 times per second and carries: | ||
// engine RPM | ||
// we want ~10. | ||
if (can_id == 0x1F0) { | ||
return 10; | ||
if (can_id == 790) { | ||
return 5; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. ditto |
||
} | ||
|
||
// This is sent over the CAN bus 100 times per second and carries: | ||
// Steering angle | ||
// we want ~10. | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I find it useful to have the steering angle updated more frequently, as it greatly simplifies synchronizing data to video. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I didn't consider the sync issues. Bandwidth is certainly a concern. I'm hoping this can be improved with a different processor/radio (esp32?) |
||
if (can_id == 0x1F5) { | ||
return 10; | ||
if (can_id == 501) { | ||
return 5; | ||
} | ||
|
||
// This is sent over the CAN bus 100 times per second and carries: | ||
// Coolant temp | ||
// Ambient pressure | ||
// Throttle Position | ||
// we want ~10. | ||
if (can_id == 0x329) { | ||
return 10; | ||
if (can_id == 809) { | ||
return 5; | ||
} | ||
|
||
// This is sent over the CAN bus 100 times per second and carries: | ||
timurrrr marked this conversation as resolved.
Show resolved
Hide resolved
|
||
// oil temp | ||
// we want ~1. | ||
if (can_id == 0x545) { | ||
if (can_id == 1349) { | ||
return 100; | ||
} | ||
|
||
// This is sent over the CAN bus 5 times per second and carries: | ||
// odometer | ||
// fuel level | ||
// we want ~1. | ||
if (can_id == 0x613) { | ||
if (can_id == 1555) { | ||
return 5; | ||
} | ||
|
||
// This is sent over the CAN bus 5 times per second and carries: | ||
// ambient air temp | ||
// we want ~1. | ||
if (can_id == 0x615) { | ||
if (can_id == 1557) { | ||
return 5; | ||
} | ||
|
||
// OBD responses should be rare, don't limit them at all if we're listening to | ||
// them. | ||
if (can_id > 0x700) { | ||
if (can_id > 1792) { | ||
return 1; | ||
} | ||
|
||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Great photo, makes it clear where the harness is.
I just pushed 56a8228 with a re-compressed version of that photo.
Sorry I grew up in dial-up time, and still trying to save a few kB when possible 😄
You can now remove the file from this PR.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
(please do keep the reference in the
.md
file though!)