Megasquirt 3 - Speed and Gear sensors

Home

Intro - Vehicle speed (VSS) - Shaft speed (SS) - Gear detection - VSS output - Wiring

Introduction


The vehicle speed sensors (VSS) allow one or two wheel speeds to be monitored. Presently the code only uses the first input, but a future release may take advantage of the second input for traction control. (e.g. front axle vs. rear axle) The inputs read from either a wheel/axle mounted pickup or a perhaps pickup that is part of the transmission. The input can be magnetic (with suitable interface) or more directly a hall type input. This input is converted to a linear speed (ms-1, mph or kph)
The shaft speed inputs work in a similar way to the vehicle speed but calculates to rpms. It could be used as gearbox input shaft speed to monitor convertor or clutch slip.
The VSS output feature provides a pulsed output in proportion to the VSS for driving a digital speedometer.
The gear detection calculates the current gear selected in the gearbox by a number of methods. Presently this is mainly used for display only. A future code release might take more advantage of this information.

speed/gear settings

Vehicle speed
Vehicle speed sensor1 = VSS 1. Vehicle speed sensor 2 = VSS2
Speed units are defined in your Project Properties / Settings

Vehicle speed is calculated in four main ways
1. analogue linear input where 0V = zero speed and 5V = max speed.
2. 0-5V pulse input to MS3
3. MS3 collects speed value from remote CAN device
4. MS3 collects pulse data from remote CAN device

1. Analogue linear input
A 0-5V signal is applied to one of the analogue inputs.
Set the analogue sensor input, the full scale speed and the smoothing lag factor.

2. 0-5V pulse input to MS3
This is most easily achieved with a hall-type sensor applied to one of the "switch" inputs on the MS3X.
With an external convertor a VR magnetic sensor can supply a 0-5V signal to the Megasquirt. JBPERF offers a suitable device. Alternatively DIY options can be found in the MS2/Extra manuals.
Analogue sensor should be set to Off and the 0-5V input pin specified as the Input. Set wheel diameter, VSS position, number of teeth and lag factor.
There are many options for mounting a reluctor and sensor on the vehicle, two basic categories exist - wheel mounted and driveline mounted.
Wheel mounted
Possibly the simplest option here is a gear tooth sensor (such as the Honeywell 1GT101DC) in close proximity to the back of the wheel studs, or a pre-existing ABS reluctor.
Driveline mounted
Many transmissions already offer a VSS output, if this is suitable, you may be able to just tap into this. Alternatively a magnet on the output flange and a hall sensor.

3. Speed value from a remote CAN device.
In the case where you have, say, a CAN-connected transmission controller that is already calculating vehicle speed, you can simply configure MS3 to collect this number.
Analogue sensor should be set to Off and CANVSS specified as the Input.
Set scaler% and lag factor. Internally MS3 stores speed in units of 0.1 ms-1 (metres per second). To convert from a remote device using mph a scaler of 46% would apply.
Configure the CANVSS offset/table/id through the CAN menus.


4. Pulse data from a remote CAN device.
This is similar to option 2, but the VSS connects to a remote CAN device, the time between pulses is collected and MS3 calculates the speed.
Analogue sensor should be set to Off and CANPWMin specified as the Input. Set wheel diameter, VSS position, number of teeth, PWM port and lag factor. Configure the CANPWM offset/table/id through the CAN menus.

Analogue sensor - If using an analogue sensor (method 1) this is set to the analogue input. Otherwise set it to Off
Full scale speed - only used with an analogue sensor. Sets the speed reported on a 5V input. Assumes 0V = 0 speed.
Input - specifies either the 0-5V pulse input (method 2), or CANVSS (method 3) or CANPWMin (method 4)
Wheel diameter - only applies to methods 2 and 4.
VSS position - either wheel or driveline - applies to methods 2 and 4. If using driveline, be sure to set your final drive ratio.
Speed sensor #teeth - how many teeth the reluctor has - applies to methods 2 and 4
PWM port - the CAN PWM "port" being used - applies to method 4
Scaler - applies a scaling to the CAN collected speed value, say for units conversion. Applies to method 4.
Smoothing lag factor - Smoothing on the speed value. Lower numbers mean more delay and smoothing. Sensible range is 15-100.

VSS dot smoothing
These settings control how the VSSdot (acceleration) calculation is performed. The lower the sample interval, the more respsonsive the calculation but the noisier it will be. Experimentation will be required to get the best settings for your application.
Calculating launch acceleration is particularly difficult to get right. Very low tooth counts and wheel speed collected via CAN will be the most difficult due to the low data rate and the communication delays.

Shaft speed
The shaft speed inputs work like "method 2" of VSS. [need to investigate CAN SS settings]

Gear detection
The gear detection supports three methods
-VSS/RPM
-Analogue
-CAN gear#

VSS/RPM
This calculates gear from engine rpm and wheel speed. It works well with a clutch, but might be difficult to get right with a loose convertor.
You need to setup VSS1 input, final drive ratio, method, number of gears and the gear ratios.

Analogue
Some bikes are fitted with a Gear Position Sensor. This 0-5V analogue input can be used directly to determine gear.
You need to setup the method, specify an input port and the mean voltage for each gear.

CAN Gear#
If you are running a CAN equipped transmission controller, you might be able to directly fetch the gear from it.
Setup the method here and configure the CAN settings on the CAN menus.

VSS output
The output is used to run a digital tacho.
Specify the output port you are using.
The time factor controls the rate of output pulses related to the vehicle speed.
The output time period is calculated as time factor / speed in ms-1

Wiring
This will depend on which of the methods you are using.
switch inputs
VSS input

ADC inputs
GPS input

If you have a question, comment, or suggestion for this FAQ please post it on the forum.

No part of this manual may be reproduced or changed without written permission from James Murray and Ken Culver.