[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

(sensor swapping) Speed of Relay Switches



Here's the relevant entry from my lab notes:

 - Measured the maximum frequency at which the relay switch will operate.
   This was done by connecting it to the scope and the function generator.
   The DPDT relay that is used for the motor control circuit was tested.
   The purpose of testing the relay is to determine its suitability for
   turning individual sensors on/off --- the computer needs this to be
   performed with a certain amount of speed.  This particular relay can
   be reasonably switched at 40Hz, with about a one to two ms delay from
   being turned off to actually turning off.

When I say a maximum frequency of 40Hz, I mean that if I performed the
switching at greater than 40Hz, then the amount of time that the relay
spent being connected to neither output node (ie. the amount of time it
spent moving through air) become significant.  This is why there is a
different measurement for time to turn on/off and time for the relay
to switch between nodes --- on/off speed is related to bouncing
and arcing, whereas max switching frequency is related to the
distance the relay needs to travel to get from one node to the other
node.

In retrospect, my measurement of the amount of time required for the
relay to actually turn on/off may be incorrect.  The time required may
be (significantly) smaller than the one to two ms that I mention.

A reed relay, of course, may be able to move significantly faster than
40Hz, still.

It just occurred to me that for the purposes of our sensor-switching
scheme, it is useful to have a higher emittor frequency --- in the
limit that our emittor frequency approaches our sensor switching
frequency, it becomes impossible to tell the noise from the signal.  I
will consider this and other factors in the following math.

Another factor we did not consider during our lunch conversation is
the different ambient light levels that each sensor will be exposed
to.  It's true that for a given intensity, each sensor should output
the same voltage.  However, the ambient intensity that each sensor is
exposed to will change as the robot moves.  As our amp+filter circuit
is switched between different sensors, it needs to adapt to the
different level of ambient light that each sensor is being exposed to.
Again, it will be easier for the amp+filter circuit to do this
adaptation if we use a relatively high frequency.

Here's the math.

At 40Hz, one cycle is 0.025s.  That means one positive pulse is
0.0125s.  This means that if I spend less than 0.0125s looking at an
individual sensor, then the time that the relay spends switching
between the two nodes will become significant relative to the time
spent being connected to the two nodes.  With a better scope, it would
be easy to calculate the amount of time the relay spends switching
between nodes.  For my analysis, I shall merely assume that we want
to avoid switching so fast that the amount of time required for the
relay to switch positions is significant.  This is not a necessary
assumption --- it is a conservative assumption.

If we consider that the computer turns the old sensor off and a new
sensor on every 0.020s, then we will cycle through 1s / 0.020s = 50
sensors every second.  That is, we will check each sensor six times
in one second, or approximately once every 15cm that we move
(assuming our speed is 0.9m/s).  This is on the same order of
magnitude at which the wheel-speed feedback system is expected to
work.  I consider it to be acceptable -- we will not need to adjust
our direction every 15cm.

[By switching sensors every 0.015s, approximately the maximum speed
 that the relays will allow us to switch them at, this can be changed
 to "check each sensor 8 times in one second" and "every 11cm that we
 move".  I choose 0.020s for reasons that will become clearer in the
 proceeding paragraphs.]

Question: It 0.015s long enough for the computer to get a good reading
from the sensor?

Consider our emitter frequency to be 1KHz.

If we allow a generous 5ms for the sensor to become active when we
turn it on, that leaves 0.015s to actually read a sensor.  During this
time, our 1KHz emitter frequency will result in 15 pulses that the
computer may be able to read.  I think this will be enough unless the
frequencies with which we check the signal and with which it pulses
become badly synchronized.  A higher emittor frequency can help ensure
it is enough.

What about noise?

If the the relay requires 2ms to connect, then 5ms - 2ms leaves 3ms
for the amp+filter circuit to activate itself.  In this context,
"activate itself" means that it will begin filtering low-frequency
noise correctly (and differences due to varying ambient light
conditions).  I _do_not_know_ if this is enough time for the filter
circuit to adjust itself.  I think it will suffice, but I can't say so
with full confidence.  The conclusion here is that we should use a
higher frequency than 1KHz.  If we use a higher frequency, then the
filter circuit will be able to adjust more quickly (smaller time
constant Tau, right).  There is one disadvantage to a higher frequency
that I discuss in the last paragraph of this mail.

Question?  If we don't use an A/D converter, do we still want to use an
averager circuit of some sort?

If we do not use and A/D converter and we do connect the comp input to
a digital line, then it will see pulsations occurring at 1KHz.  1KHz
is fine, but there probably is some limit to how quickly an input line
to the computer may be pulsed.  I do not know what this limit is.
This problem can be overcome by keeping the rectifier circuit even
though we remove the A/D converter.  It will be necessary to test
voltage levels carefully to ensure that it reacts correctly.  It is
good that you have begun constructing the sensor circuit.  :)

I am still considering the A/D vs. no A/D converter question.


-- 
Signature withheld by request of author.