Hello, I have seen a few threads related to VSS (Vehicle Speed Sensor), but as I am completely new to Arduino commands (outside of a few tutorials, I figured it would be best to ask the experts for some help with getting the framework laid out.
What I am looking to accomplish is a way to give un attentive drivers a little heads up with the brake light on my motorcycle when I engine brake.
The VSS sends a certain number of 5V pulses per second, I'm not concerned with the arduino knowing how many pulses equals what speed, I am hoping to do something like the following..
If the arduino could look at how many pulses happen during a period of time say 500ms 'WindowA' and then keep track of how many take place in the next 500ms 'WindowB'. And if the pulses in WindowB are less than say 75% of WindowA's value, then it would either illuminate the brake light for a few flashes, or flash it until WindowA is equal to or greater than windowB....
If anyone can help point me in the right direction with this that would be amazing. Thank you for your time
The key to your project is as you described this: "The VSS sends a certain number of 5V pulses per second,". The next step is to describe for everyone what the voltages of the pulses are and the limits of how slow they can occur and how fast they can occur.
Paul
The service manual states its a 5V square wave signal. 0V in the off position, 5V in the on position. 6000 Pulses in a mile. So umm 10mph would be 16.667 pulses a second, 80 mph would be 133.336 pulses a second, if I did that math right.
Start with a sketch to record the pulses from a normal operation. Save the data to EEPROM so that you can analyze it later. Personally, I would use the Wemos D1 Mini because it runs at 80 MHz. (But it's I/O ports are limited to 3.3V, so a voltage divider is needed).
FYI, Vss on a schematic means Voltage Source Supply. Normally at the battery positive point or positive of any DC power supply in the circuit schematic diagram.
You might want to also do some experiments to determine braking rates.
Use a GoPro or similar camera and take video of the speedo. Gather a bunch of footage for each gear: get up to a fixed speed and then release the throttle and slow under engine braking. Later, in GoPro Studio or the editor of your choice, collate the rates of deceleration (in MPH/ms based on counting frames) so you can understand how your code is going to determine what is actual engine braking in each gear.
Remember that that the engine braking effect will be more "gentle" in higher gears; a threshold of x%/mS set for 2nd gear likely won't work for 4th or 5th gear.
I would suggest you do some investigation into the electrical environment this will be working in. It can be quite severe. Since you cannot control it you have to tolerate it and protect your equipment from it. I would start with a simple schematic, not a frizzy drawing showing your basic system showing the power supplies and associated protection as well as the interface to any of the vehicle's electronics. A mistook can damage or ruin your bike.
crazycymbalmonkey:
The service manual states its a 5V square wave signal. 0V in the off position, 5V in the on position. 6000 Pulses in a mile. So umm 10mph would be 16.667 pulses a second, 80 mph would be 133.336 pulses a second, if I did that math right.
Be sure to explore measuring the length of the pulse. From your description as a square wave, the time the pulse is high is also an indication of speed.
Paul
I would measure the time between pulses. If the time goes up by some factor, turn on the brake lights. Otherwise, if the time goes down, turn off the brake lights. No need to count. If the deceleration is very slow, no need to light the lights at all. Maybe measure the pulse time deltas and see what values you get when coasting in neutral. Make the limit a little more than that.