Go Down

Topic: How to condition a VSS signal? (Read 482 times) previous topic - next topic

TomGeorge

Hi,
What cable and how long between sensor and controller?
Is it shielded?

I would suggest you supply 12V and gnd from the controller end of the cable, not from odd locations that are different to the controller gnd and supply.
The controller is measuring the signal with respect to its own gnd, not the gnd at the sensor end, there could be all sorts of currents running through the vehicle chassis between the sensor gnd connection and the controller gnd connection.

Thanks.. Tom :)
Everything runs on smoke, let the smoke out, it stops running....

kitt3000

The sensor is not a factor right now because its completely disconnected from the Arduino. There is just a wire plugged into pin 5 and its getting readings from like 2-7 mph. The wire is not connected to anything. If i remove the wire from pin 5 the readings show 0. I tried grounding the Arduino to the chassis of the car but no change. Ugh.

hzrnbgy

#17
Jan 19, 2021, 03:09 am Last Edit: Jan 19, 2021, 03:16 am by hzrnbgy
Code: [Select]
    bitSet(TCCR1B, CS12); // start counting pulses
    bitSet(TCCR1B, CS11); // Clock on rising edge


FYI, that is counting on a falling edge. If you want to count on rising edge, do this instead

Code: [Select]
TCCR1B = 1<<CS12 | 1<<CS11 | 1<<CS10

You want to set TCCR1B in a single statement as doing the following

Code: [Select]
bitSet(TCCR1B, CS12)

Would start the timer at 62500 Hz immediately

Just replace these two statements
Code: [Select]
    bitSet(TCCR1B, CS12); // start counting pulses
    bitSet(TCCR1B, CS11); // Clock on rising edge


with

Code: [Select]
TCCR1B = 1<<CS12 | 1<<CS11 | 1<<CS10

kitt3000

@hzrnbgy
Is it more accurate to capture the pulses on the rise as opposed to when they are falling? What is  the advantage to change that portion of the code? 

raschemmel

#19
Jan 20, 2021, 04:42 pm Last Edit: Jan 20, 2021, 07:24 pm by raschemmel
Quote
So I did another test where I disconnected the pin 5 wire from the sensor, I then started the car and I got the same erratic reading from 4-8 mph and this is without the VSS signal connected to pin 5 :o . Pin 5 only has the disconnected wire plugged into it. If I removed the wire from pin 5 the reading goes to 0 mph. What the heck is going on? The wire in pin 5 is acting like an antenna...

Any ideas?
Yes.
When you connected pin-5 and your voltage divider you changed the impedance of the VSS signal. (dampened it)
Try using an op amp voltage follower buffer. If has a 10 Mohm input impedance and a low impedance
output that can drive the voltage divider. With the buffer inserted between the VSS and the voltage
divider it should not be affected and should read 0 mph when the wheels are not turning.

hzrnbgy

Quote
Is it more accurate to capture the pulses on the rise as opposed to when they are falling? What is  the advantage to change that portion of the code?
It really depends on the sensor. Most hall-sensor type I've dealt with are active high which means its best to capture pulses on the RISING EDGE. Now if your sensor is active low, then you capture on the falling edge.
Code: [Select]
TCCR1B = 1<<CS12 | 1<<CS11 | 1<<CS10  <------------ this captures RISING EDGE
TCCR1B = 1<<CS12 | 1<<CS11 | 0<<CS10  <------------ this captures FALLING EDGE



These
Quote
bitSet(TCCR1B, CS12); // start counting pulses
  bitSet(TCCR1B, CS11); // Clock on rising edge
are equivalent to the latter (capture FALLING EDGE)


raschemmel

#21
Jan 20, 2021, 07:12 pm Last Edit: Jan 20, 2021, 07:33 pm by raschemmel
Try adding the voltage follower with a rail to rail op amp. I think an LT1215 might even work running
on 5V since your voltage divider outputs 4V.



kitt3000

Thanks everyone for the help. I figured out what the problem was. Originally, I had the VSS powered from the vehicle electrical 12v system and I had the VSS grounded to the chassis. I disconnected all wires and ran them straight to the Arduino. So the power went to the Arduino 5v, ground went to Arduino ground and the signal wire went to pin 5. Now it works without any voltage divider or anything connected to the signal wire . So anyone who comes across this type of issue, try running all the wires directly to the Arduino! 

Go Up