Page 1 of 1
CAN Bus Questions
Posted: Mon Jul 13, 2015 9:31 am
I would like to have the option of a number of sensors, some that need to be sampled at 500Hz, and some that have a native I2C interface.
- How many channels can the RCM2 capture through the CAN interface?
- What is the maximum sampling speed?
- What is the maximum data speed?
- How are the maximum sampling and data speeds affected by the number of channels
- How many CAN nodes can the RCM2 communicate to?
Some of the sensors are simple analog (e.g. shock position linear sensors), some are PWM (e.g. 4 wheel sensors, RCM2 only supports 3), and some are I2C (e.g. four 16x4 infrared array sensors, such as the wide angle (120°x30° version of the MLX90621).
Can the CAN bus be used to increase the capability of the unit?
Posted: Tue Jul 14, 2015 9:13 pm
I've logged up to ~16 CAN messages at 30hz without any issues on the latest firmware. I've also used the RCPmk2 with a terminal program to grab everything off the HS vehicle CAN bus at the 30hz max sample (tick) rate.
Max sample speed is 30hz: http://www.autosportlabs.net/RaceCaptur ... .28rate.29
Max baud rate is 1000000: http://www.autosportlabs.net/RaceCaptur ... C_baud_.29
Not sure if it would handle what you want to do, but there's two CAN channels and a aux serial on the RCPmk2:
http://www.autosportlabs.net/RaceCaptur ... _Reference
Posted: Wed Jul 15, 2015 12:21 am
Thanks for you answer.
From your answer it can read anything in CAN 2.0 (29-bit addressing, 1 Mb/s speed). The documentation does (unfortunately) say it is limited 30 virtual channels. I was hoping for more channels.
The tick seems to be an interrupt timer that defaults to 1Hz but can be faster. Lua (http://www.lua.org/manual/5.3/manual.html#3.3.5
) supports functions and various loops and conditional branches. I would have thought the CAN bus could be read in a loop and was limited by either processing power or I/O bandwidth writing the data.
The linear position sensors used for shock movement need to be sampled around 500Hz. The max sampling rate for the 8 analog inputs is listed as 1000Hz.
I would have thought the CAN sampling would be similar...or that using both CAN buses and lots of inputs would hit a processing or I/O maximum.
Update: The virtual channels can be set to 1, 10, 25, 50, 100, or 200 Hz according to the docs. Presumably they record the value the channel was last set to with setChannel().
Posted: Fri Jul 17, 2015 5:49 pm
The logging sampling is independent of the rate at which the virtual channels are updated. In other words, a virtual channel sampled at 200Hz may receive updates from a CAN message received at 1Hz. The data will still show changes at a 1Hz rate, oversampled at 200Hz.
The 30 channel limitation is somewhat arbitrary based on anticipated needs. How many channels is practical for you?
Posted: Fri Jul 17, 2015 9:22 pm
Brent, thanks for getting back to me.
- Linear Position, brake pressure, steering angle, and throttle consume the the 8 analog ports
- Tire temps come in as 4 CAN addresses per wheel, each with 4 multiplexed 2-byte readings. 16 CAN addresses ideally to 64 channels but I'm guessing they can remain multiplexed and put on 16 channels.
- 4 wheel speed sensors
- ODBII data if testing an ODBII equipped car. It looks like both CAN and pre-CAN ODBII.
In the future we would expect to also do the late model.
[*] Some engine data from sensors. May include things like crankcase pressure with a dry sump scavanged sealed motor.
[*] Some minimal aero data to correlate with suspension data. The speeds aren't high but the spoiler is 6" tall at 80°.
[*] Brake rotor temps.
The wheel position sensors need to be connected to the analog ports because they need to be sampled at 500Hz. That could be reduced in a math calc to 100-200Hz but I'd like to capture the raw data. Steering angle from a string pot and brake pressure, depending on the car one or two. With a brake balance adjuster we have two brake pressure gauges which really help the driver reset the brake balance system before sessions; it would nice to know what is actually happening throughout the session.
The tire temp sensors are the big issue. The setup I'm looking at would have have 16 readings per tire multiplexed onto 4 CAN addresses. That would be 16 channels. I initially thought there was probably 8-bit addressing for the channels with maybe 128 or 192 available. That would have allowed demuxing the tire temp data into 64 channels. Ideally 4 wheel speed sensors to capture wheel spin in the rear and brake locking on the inside front.
Then there is the engine info which is in ODBII but not RCM2 compatible in pre-CAN cars. Presumably that also goes to virtual channels. In race cars without ODBII there will need to be an intermediate analog to CAN conversion, I'm guessing with some Ardunio boards. Unless there is a reasonably priced off the shelf unit.
Each situation may present its own problems. For example, knowing brake rotor temps may help in pad selection even if cooling isn't an issue.
Posted: Fri Jul 17, 2015 9:31 pm
Thanks. Off the cuff, sounds like about 100 virtual channels might be needed.
MK2 has ample processing power and memory to manage more than 30 channels; it would be a matter of expanding and adding the channels. Providing the script is efficient, I don't forsee a problem managing that much data.
Posted: Fri Jan 22, 2016 8:07 am
I noticed there was no reply regarding the I2C interface.
I'm also interested in trying I2C for temperature arrays. I know there are LUA modules for I2C (which I've found on the NodeMCU), but can't figure out if the RCP has that built in, i'm guessing not.
For now I was going to use I2C to set my temperature sensors to PWM mode and then just use up some analog inputs, but would be nice if RCP had a way to do it.
Posted: Fri Jan 22, 2016 3:50 pm
Correct. CAN is the intended way to connect external devices as it it is a robust specification to transmit data between systems running in harsh industrial or automotive environments.
For using I2C devices your best option is to bridge the I2C device to CAN, then forward the data to RCP using CAN - just like other ECU and sensor devices you'll find in automotive / motorsports. There are many CAN arduino shields that can get you started down this path.
Hope this helps!