4
\$\begingroup\$

I am building an optical rotation encoder for my "autonomous robot" (a LED pointing to a photodiode that gets interrupted as the axis rotates).

My issue is that at the voltage that I am using the motors (~9v) they generate too much electromagnetic interference so the microcontroller (arduino) triggers a "falling" without any physical move (it makes a ~5v value oscillate below ~2.2v)

I believe that's what is happening. See my image for my testing setting.

I have my circuit connected to the computer and I have a completely independent dc motor connected to isolated batteries. When I turn the motor ON, the microcontroller starts triggering like crazy (even 50 times per second, at about 20cm of distance).

I think that the only possible cause is electromagnetic interference. I realize my circuit is exposed (I am using LEDs, resistors, etc., without covering).

So, as a test I covered my "rotation encoder" (the red protoboard in the image) in aluminium foil. It helped a lot (but it didn't fix the issue completely in the static testing setting - the issue is even worse if the axis is actually moving). I also covered the DC motor in aluminium foil with no improvement (I believe that it actually made it worse).

I didn't cover the resistences and LEDs with plastic isolation (thermoshrinkable) because this is the prototype in the protoboard (want to avoid investing all the time it takes because I am breaking it apart the minute it works to mount it in the real robot). I can do that if I find indications it would help.

So the question is: for a DIY/hobby level project, what approach should I take to isolate the circuit from the interference that seems to be coming from the DC motor?.

Thanks.

Note: per request added encoder circuit.

testing setting circuit

\$\endgroup\$
6
  • \$\begingroup\$ Good experiment, it distinguishes your problem from the usual power-dropout issues. Will you edit your question to include a diagram for the sensor circuit that's being triggered? Show long wires and resistor / capacitor values on the diagram. \$\endgroup\$
    – tomnexus
    Apr 10, 2015 at 2:34
  • \$\begingroup\$ @tomnexus: done. It was a good learning experience (hopefully it the diagram is clear). \$\endgroup\$
    – rufo
    Apr 10, 2015 at 3:31
  • \$\begingroup\$ Just to confirm, the triggering only exists when the motor is on and a minimum 20cm away but disappears when the motor is off?? \$\endgroup\$
    – dwightreid
    Apr 10, 2015 at 8:47
  • \$\begingroup\$ @dwightreid: yes, only with the motor ON. With the motor OFF nothing happen in the circuit (as expected, since I am not moving it at all). The motor can be at any distance between 0 and 20cm. The closer it is to the circuit the more interferences occur. \$\endgroup\$
    – rufo
    Apr 10, 2015 at 14:48
  • 1
    \$\begingroup\$ Try a small cap (say 100nF) across the motor terminals, with leads as short as possible. Also make sure the motor's wiring is twisted all the way. You really want to catch this interferance at the source, then improve compatibility by shielding the 'receiver' circuit. Make sure when you use shields (like the aluminum foil) is grounded (same potential as the battery ground). \$\endgroup\$
    – jippie
    Apr 10, 2015 at 17:37

2 Answers 2

6
\$\begingroup\$

I'm not entirely surprised that you've got pickup. You've got wires hanging all over the place. I'd suggest two things to do:

1) Twist your phototransistor wires (blue and yellow) together to form a twisted pair. At the same time, make sure your phototransistor connections are as compact as you can without shorting anything - I suggest moving your connection pins much closer together. Also, make your 5k resistor connections using as short a pair of wires as possible - I recommend making the connection on the protoboard right at the Arduino pins without using any wires at all. As a bonus, get some copper braid and enclose your 20 cm pair in the braid, with one end tied to Arduino ground.

2) As close as possible to the Arduino, connect a small (100 pF to 1000 pF) capacitor between D2 and GND. I can't be more specific as to the value, since I don't know what rate the isolator will operate at. Generally, the bigger the better, except that at some point you'll find that the cap reduces signal amplitude as you rotate the motor shaft.

\$\endgroup\$
2
  • \$\begingroup\$ I guess that means that I should forget about isolation measures implying aluminium foil are discarded. I'll try this and ping back/accept answer (it'll probably take me a few days). Thanks. \$\endgroup\$
    – rufo
    Apr 10, 2015 at 14:51
  • 1
    \$\begingroup\$ Well, as a matter of fact you can wrap your twisted pair in aluminum foil rather than using copper braid. The problem arises when you try to make good electrical contact with the aluminum to connect to ground. It's easy enough with large pieces of metal, but trickier with foil. You can't solder to it, and mechanical connection tight enough to guarantee contact despite the oxide layer can rip the foil. It is used widely in communications multiconductor cables. \$\endgroup\$ Apr 10, 2015 at 14:59
2
\$\begingroup\$

After a lot of experimentation I have found two things that are surely evident to somebody with more knowledge:

  1. I was holding the motor with my hand directly while testing (some times). I was acting like an antenna to the interference. Don't do that.
  2. The motor is rated to 3V (max 4.5). I was using ~14V in PMW. Also don't do that.

I also find very hard to actually do some sort of physical shielding (nothing I tried worked).

Using the information provided by the accepted answer (twisting cables, making them shorter, using capacitors) it improved a lot.

Also, using a lower voltage (~7V) helped a lot. I am still having issue, but it is working way better (need to try to get the voltage to about 4V to see if that helps).

In any case: I include this as an "answer" because it provides factual information on how to fix the original problem/question.

\$\endgroup\$

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.