The gear postition sensor is part of the bike, not my circuit, my
circuit just takes this information and campares it to voltages on my
voltage ladder and kicks on the proper comparator to give an indication
light.
As I understand it, the position sensor is a variable resistor
(potentiometer) connected to some supply voltage. If that voltage is
regulated, the engine speed (alternator voltage) should not affect the
output voltage. If the potentiometer is connected in series with a
fixed resistor to the positive side of the battery, then engine speed
will vary the total voltage across the potentiometer, and also the
output at each of the gear positions. You need to have your A/D
converter have the same voltage as its reference(full scale voltage)
as the potentiometer has, either by duplicating the way the
potentiometer develops its voltage (a second voltage divider across
the battery, instead of using the 5 volt regulator) or you need to
change the supply to the pot to power it from your 5 volt regulator.
This is the only way they will agree in spite of the battery voltage
variations.
Even with no circuit attached to the bike, I read the outpout of the
sensor and this is what I get(min to max.....manual stated value)
1st - 1.68 to 1.76....1.782
2nd - 2.13 to 2.21....2.242
3rd - 2.83 to 2.98....2.960
4th - 3.51 to 3.63....3.63
5th - 4.23 to 4.33....4.31
6th - 4.56 to 4.66....4.66
neu - 4.85 to 5.15....5.02
This looks like there are still clear divisions between these ranges
to make an unambiguous decision, as long as you can filter out any
noise. For example, taking the average of the highest the lower
voltage can be and the lowest the next highest level can be I get
these decision points:
1-2, 1.95 volts
2-3, 2.52
3-4, 3.25
4-5, 3.93
5-6, 4.45
6-n, 4.76
You can also do digital filtering, like I described earlier, to
prevent flicker on an occasional spike.
The 5v from the I am not sure if it flucuates with vehicle accel and
decel, however it shouldn't matter should it?
It is the full scale reference for your A/D converter, so if it
bounces around, it bounces your measurement around. 50% of full scale
output on the A/D occurs at half of the 5 volt regulator voltage. So
you may need a little high frequency capacitance on the regulator
input and output, and, perhaps a bit of resistor or inductor between
its input and the battery line.
If my 7805 output goes down, say due to decel, my voltage ladder
cutouts will drop also. And I would think that everything should be
equal.
I thought we were talking about the microprocessor doing the job. Are
we back to the string of comparators?
If so, yes, the ladder string will vary, but is it varying exactly the
same way the potentiometer supply is varying? If the potentiometer
uses a series resistor to drop the battery to approximately 5 volts
full scale, then your resistor string also needs a series resistor,
not a 5 volt regulator to drop the battery voltage to a range of taps
between 0 and about 5 volts. The two processes have to track each other.
I am still awaiting my PIC programmer, so it will eliminate all this
stuff, however, I beleive in the last week , I have learned a lot about
this stuff, and would still like to solve my initial problem.
Okay, I think I understand, now. If you use 5 volts as the full scale
reference for the A/D, don't be too surprised if the problem is
exactly the same as it is now.