1
\$\begingroup\$

I have a hobby project with four-wheel mobile-robot-platform, where I have attached two optical wheel encoders, that are further connected to micro-controller:

Schematic

(Source: https://www.dfrobot.com/wiki/images/b/b9/FIT0029_Encoder_Schematics.png)

The micro-controller handles the encoder input by using two interrupts, that are set up to trigger for rising-edge. In general the setup works OK.

However, the problem is that every now and then false interrupts are detected, which makes tracking the position impossible. Here is an example sequence of time differences between the interrupts for a specific wheel: 0.059 0.059 0.060 0.061 0.064 0.063 0.058 0.006 0.064 0.062 0.060 0.025 0.034 0.058 0.060.

The time difference is rather contrast around 0.06, put then suddenly the interval is split to two interrupts, summing together to around 0.06. I'm also observing much shorter intervals, but these are easy to remove by just detecting the too short interval.

The splitting of interval, might be related to sawtooth like profile of the encoder, i.e., when the voltage drops, due to reaching hole region, it causes some sort of short oscillation generating false rising edge. I have tried to reduce the problem by using a Schmitt trigger, which inputs are connected to low-pass filter (10kOhms, 9nF, and 20kOhms and 9nF combinations tested, not sure if these are optimal?).

This greatly reduces the short intervals but the longer ones are still a problem. The setup contains lots of wiring which are also potential sources of interference.

I would be grateful for any suggestions how to remove the false interrupts.

\$\endgroup\$
4
  • \$\begingroup\$ "... then false interrupts are detected," how do you know? your example shows abnormal measurement (of time?) but that may or may not be due to false interrupt triggered by the decoder. I'm not say that false interrupt isn't a problem, just that you haven't established conclusively that it is a problem. \$\endgroup\$
    – dannyf
    Feb 18, 2017 at 14:10
  • \$\begingroup\$ Hi, I have also tried to removed the "false" detections by manual inspections and in this case I can see that the position is tracked very well (in offline test using recorded data). Yes it possible/likely that the problem is not in the encoder but the problem is in interference or in the voltage bouncing in interrupt bin causing false detections. \$\endgroup\$
    – Vili
    Feb 18, 2017 at 14:23
  • \$\begingroup\$ "but the problem is in interference or in the voltage bouncing in interrupt bin causing false detections." maybe, maybe not. think about the entire chain of events and envision all possibilities that could go wrong and try to eliminate as many of them as possible. you simply haven't provided enough information for others to help you narrow it down. \$\endgroup\$
    – dannyf
    Feb 18, 2017 at 15:00
  • \$\begingroup\$ If you have only one sensor per wheel, then you cannot distinguish forward motion from reverse motion, including any mechanical jitter, which is probably what you're seeing here. For unambiguous direction and distance sensing, you need to have at least two sensors per wheel, arranged to give quadrature signals. This is how the sensors in a mechanical mouse operate, for example. \$\endgroup\$
    – Dave Tweed
    Feb 18, 2017 at 16:31

3 Answers 3

1
\$\begingroup\$

The schmitt trigger you are specifically using hasn't got that great a differential between trigger threholds. If you look at the data sheet you will see that for 4.5 volts operation Vhi has a min value of 2.16 volts and Vlo could be as high as 1.79 volts.

That's a range of 370 mV and quite likely is too low. However, the DS does indicate that the likely worst case differential is 0.71 volts but it's food for thought.

Standard CMOS is probably better but, of course, you will struggle to find that tiny 1-gate part.

\$\endgroup\$
4
  • \$\begingroup\$ Thank you for your answer. My question was a bit misleading because I did not realize that the wheel encoder already included a build in schmitt-trigger (SN74LV...) as you pointed out and is visible in the encoder schematics posted. I also use an external schmitt trigger (74HCT14) combined with a low pass filter, which greatly improves the accuracy (without external trigger the signal is pretty much useless). I noticed that I got perfect signal if I place the external trigger far away from the rest of the setup. For that reason I believe the problem is related to interference. \$\endgroup\$
    – Vili
    Feb 22, 2017 at 18:51
  • \$\begingroup\$ Or... at a certain distance the noise reduced enough to not cause false triggers. I don't believe it's an interference thing or you would get problems when the opto was permanently blocked or open. It's a threshold thing. \$\endgroup\$
    – Andy aka
    Feb 22, 2017 at 18:53
  • \$\begingroup\$ Ok, so do you mean noise causing false triggers to external schmitt and what do you mean about "threshold thing". \$\endgroup\$
    – Vili
    Feb 22, 2017 at 19:11
  • \$\begingroup\$ As noise and all signals reduce with distance, in fact, you don't need much of a reduction to fall below a threshold. In other words its easy to believe one thing when it's something else. \$\endgroup\$
    – Andy aka
    Feb 22, 2017 at 19:46
0
\$\begingroup\$

Andy's note about limited hysteresis might be mitigated by reducing gain of the detecting phototransistor. Try reducing R3 from 10K until you get no interrupts at all, then double that value for R3.
Falsely detected edges are a big problem when the interrupter must operate over a wide speed range. The most difficult situation is a very slow transition of a hole. A schmitt circuit should be tested carefully for this case.

There are a few other less likely causes:

  • Phototransistors are sensitive to ambient light too. Can other light sources get in?
  • The optical interrupter (with holes that you provide) might transmit some infrared light. Some materials block visible, but pass infra-red light Ensure that it has no pin-holes.
  • For a thick interrupter, you may have reflections from the interior sides of the hole, before and after the main alignment of hole with source and detector, yielding a false pulse. The solution is a very thin (but opaque) interrupter.
  • Schmitt capacitive feedback can cause instability problems, because its output edge speeds are very high. Keep output signals well away from the phototransistor.
\$\endgroup\$
0
\$\begingroup\$

Put the robot up on bricks. Make a 2" by 2" loop of insulated wire, taped to a thin bit of cardboard so you can probe the magnetic fields. Go looking for large transients with your Hfield antenna.

Do you have the LED VDD voltages bundled up with stepper-motor power?

Do you have the wires in/out of 7414 bundled with, or exposed to stepper-motor power?

How severe can this be? Assume 10 amps motor power, switching in 10 nanoseconds, or dI/dT = 10^+9 amps/second. Assume 4" by 4" loop of victim wire, located 4" from the jammer. Math:

$$Vinduce = 2*10^-7 *(area/distance) * dI/dT$$

$$Vinduce = 2*10^-7 * [(0.1meter * 0.1meter)/0.1meter ] * 10^+9$$

$$Vinduce = 2*10^-7 * 0.1 * 10*+9$$

$$Vinduce = 2 * 10^(-7-1+9) = TWENTY VOLTS$$

\$\endgroup\$
1
  • \$\begingroup\$ The motor is powered by and external battery and the wheel-encoders and micro-controller are powered by another power-source. However the wiring goes "long way" near the stepper-motors and are likely exposed interference from motors. As was pointed in my comment to Andy Aka above, the false detections can be removed by placing the external schmitt-trigger far enough from the rest of the setup in test case. However I'm still experiencing the problem when all is packed up. I was wondering if there are some special wires that could be more tolerant to interference and more suitable in this case. \$\endgroup\$
    – Vili
    Feb 22, 2017 at 19:04

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.