Anomalous Interaction

Discussion specific to the DIP and TQFP packaged ZX devices like the ZX-40, ZX-44, ZX-32 and ZX-328 series. The differences between these devices is primarily the packaging and pinout so most issues will apply to all devices.
liam.zbasic
Posts: 163
Joined: 24 March 2008, 23:33 PM
Location: Southern California (Blue)

Anomalous Interaction

Post by liam.zbasic »

Some weird power interaction is happening between my ZX40n device, Sharp IR range sensors (GP2D12), and a motor driver. I ruled out my ZX program. When the IR sensors output 0.6 volts (~21 inch distance) or less, the following happens:

* PWM frequency to motor driver drops from 20khz to roughly 10khz, +/- 1khz.
* LED indicators connected to ZX40n flash on & off.
* Motor Driver LEDs also flash on & off.
* Power to motors oscillate at same frequency as flashing LEDs.
* IR sensor output voltage drops from 0.6V to approximately 0.5V. If the output is pulled from the ZX40n chip, the voltage returns to 0.6V.

Power supply is fully charged and I just swapped in a new ZX40n device that arrived today - no change. When the IR sensors output more than 0.7V (~17 inches), the system behaves perfectly. Has anyone encountered this?

Thank you.

Liam
spamiam
Posts: 739
Joined: 13 November 2005, 6:39 AM

Post by spamiam »

Almost certainly the motors are the issue. They can create terrible noise in the electrical system. You can test to see if this is true by removing the power leads to the motors, while leaving everything else unchanged.

You should have a diode to ground on the power lead near the motors to prevent negative voltages inductively created on the power supply .

To add filtering near the ZX, you should have a big electrolytic capacitor and a (few) small ceramic caps. Also, you can improve the filtering a bit by adding a fairly low value resistor (e.g. 1-10 ohms) in the power lead before the filter caps. This will somewhat limit the current spikes to the caps, and improve their filtering. It will also cause a small voltage drop across the resistor. The ZX can probably tolerate a few 10's or 100's of mV drop pretty easily. You can calculate the series resistor value if you know the total current draw of the ZX. For example, if the ZX is going to draw up to 100mA peak, and you want no more than 100mV drop across the current limiter resistor, then the resistance should be (R=V/I) 0.100/0.100 = 1.0 ohm. You can also add a 5.x V zener (for a 5v power supply) between supply and ground. You probably should have a current limiter resistor if you plan on using the zener.
dkinzer
Site Admin
Posts: 3120
Joined: 03 September 2005, 13:53 PM
Location: Portland, OR

Post by dkinzer »

spamiam wrote:Also, you can improve the filtering a bit by adding a fairly low value resistor (e.g. 1-10 ohms) in the power lead before the filter caps.
Although a resistor is helpful, an inductor is generally better because its DC resistance is very low while its AC resistance (impedance) is higher with higher frequencies. Simply put, it blocks higher frequency AC current but passes DC current.
- Don Kinzer
liam.zbasic
Posts: 163
Joined: 24 March 2008, 23:33 PM
Location: Southern California (Blue)

Post by liam.zbasic »

I drove home from work to test the motor noise theory. Couldn't wait. The wife was confused. Anyway, sure enough, the anomalous flashing stopped when I disconnected the power to the motors.

I thought I mitigated all noise issues with low-ESR capacitors (1,000uF) at the ZX40n power source and at each IR range sensor (see thread below).

http://www.zbasic.net/forum/about1258.html

My new ground bot is a monster compared to the "gbot" in the thread above and features 21A motors from banebots (RS545). I soldered in their recommended filter capacitors.

I'll add the recommended diodes and inductors discussed here. I'm still confused about noise generated by the motors - at higher duty cycles, there is no issue. The ZX device and motors have separate power sources. The motor driver (VNH2SP30 from pololu.com) power does share the +5V source for the ZX device. Will a new +5V source for the driver solve the problem? How about shielding wires to the motors? To the IR sensors?

Thanks.
dkinzer
Site Admin
Posts: 3120
Joined: 03 September 2005, 13:53 PM
Location: Portland, OR

Post by dkinzer »

liam.zbasic wrote:The ZX device and motors have separate power sources.
In high current environments, you must be careful to connect the grounds of the two power sources at one and only one point. The high current motor leads need to be kept as far as possible from all digital signals to reduce inductive coupling. Further, it may be helpful to optically isolate the motor control circuitry from the other logic/control circuitry.
- Don Kinzer
mikep
Posts: 796
Joined: 24 September 2005, 15:54 PM

Post by mikep »

liam.zbasic wrote:...21A motors...
Yep, definitely requires some kind of opto-isolation. You are asking for trouble without it.
Mike Perks
liam.zbasic
Posts: 163
Joined: 24 March 2008, 23:33 PM
Location: Southern California (Blue)

Post by liam.zbasic »

dkinzer wrote:In high current environments, you must be careful to connect the grounds of the two power sources at one and only one point.
The motor driver module appears to connect the two power grounds. Link below shows Pololu schematic:
http://www.pololu.com/picture/view/0J411
dkinzer wrote: Further, it may be helpful to optically isolate the motor control circuitry from the other logic/control circuitry.
Are you saying optically isolate the ZX-40n circuitry from the motor driver? I enclosed a block diagram of my project. Notice that the regulated 5V source powers the ZX-40n device, IR range sensors, and motor driver. Not sure where the optical isolator needs to be.
Attachments
meanbot_block_diagram.png
(425.91 KiB) Downloaded 626 times
dkinzer
Site Admin
Posts: 3120
Joined: 03 September 2005, 13:53 PM
Location: Portland, OR

Post by dkinzer »

liam.zbasic wrote:Are you saying optically isolate the ZX-40n circuitry from the motor driver?
Yes. The link below shows a simple example of PWM optically coupled to a motor driver.
http://hades.mech.northwestern.edu/inde ... terference

If you search using "optoisolator" and "motor" you'll get several interesting hits including the wikipedia page on opto-isolators in general.
http://en.wikipedia.org/wiki/Opto-isolator
- Don Kinzer
liam.zbasic
Posts: 163
Joined: 24 March 2008, 23:33 PM
Location: Southern California (Blue)

Post by liam.zbasic »

Yes, I learned about the isolators in the "smiley's micro" articles in Nuts-and-Volts. I figured my $59.95 motor driver provided enough isolation.

Is it adequate to isolate the ZX-40n PWM signals, or do I also need to isolate the logic channels (2 per motor) that control motor direction?

I'm a bit concerned about my 20khz PWM frequency and the ability of the opto-isolator to respond. We'll see what the specs say.

Thank you.
mikep
Posts: 796
Joined: 24 September 2005, 15:54 PM

Post by mikep »

liam.zbasic wrote:Are you saying optically isolate the ZX-40n circuitry from the motor driver?

Is it adequate to isolate the ZX-40n PWM signals, or do I also need to isolate the logic channels (2 per motor) that control motor direction?
ALL signals to and from the motor controller should be isolated. Here are some schematics from a project I did some time ago: http://home.roadrunner.com/~perks/micro ... c111813262 . You might want to read the whole writeup when you have some time.[/quote]
Mike Perks
spamiam
Posts: 739
Joined: 13 November 2005, 6:39 AM

Post by spamiam »

liam.zbasic wrote:Yes, I learned about the isolators in the "smiley's micro" articles in Nuts-and-Volts. I figured my $59.95 motor driver provided enough isolation.

Is it adequate to isolate the ZX-40n PWM signals, or do I also need to isolate the logic channels (2 per motor) that control motor direction?

I'm a bit concerned about my 20khz PWM frequency and the ability of the opto-isolator to respond. We'll see what the specs say.

Thank you.
It is best to isolate all connections between the ZX and the motor controller/motors. So, you should probably isolate the logic signals too.

Then there is the issue of power and ground. This could be solved by having a separate power supply for the ZX so it does not get power spikes and brown out from the motors. You always have to be careful of ground loops too.

-Tony
liam.zbasic
Posts: 163
Joined: 24 March 2008, 23:33 PM
Location: Southern California (Blue)

Post by liam.zbasic »

So I'm completely optoisolating the ZX device from the motor driver and each will have separate power supplies. The grounding for each should remain separate, correct? And I suppose the power to the optoisolator for the phototransistors should originate from the motor driver power.
dkinzer
Site Admin
Posts: 3120
Joined: 03 September 2005, 13:53 PM
Location: Portland, OR

Post by dkinzer »

liam.zbasic wrote:The grounding for each should remain separate, correct?
Yes. The only[/] connection between the two sides is photons - that's the advantage of opto-isolation.
liam.zbasic wrote:And I suppose the power to the optoisolator for the phototransistors should originate from the motor driver power.
Indeed. Each side provides the power for its part of the LED/photo transistor pair.
- Don Kinzer
DocJC
Posts: 112
Joined: 16 March 2006, 6:23 AM
Location: Cleveland, OH
Contact:

Post by DocJC »

It seems that everyone is assuming that it is noise coupled back tothe uC that is causing the problem, but without a scope this is difficult to determine with certainty.

Just for the record it would be nice to know what the Brown Out Detector Fuse is set to.

Your system is oscillating at 10kHz. If the motors draw too much current for your power supply to provide the voltage will drop, whcih could trip the brown out detector, reset the uC, re-measure the IR sensor, re-turn on the motors, once again drawing too much current...

JC
spamiam
Posts: 739
Joined: 13 November 2005, 6:39 AM

Post by spamiam »

DocJC wrote:It seems that everyone is assuming that it is noise coupled back tothe uC that is causing the problem, but without a scope this is difficult to determine with certainty.

Just for the record it would be nice to know what the Brown Out Detector Fuse is set to.

Your system is oscillating at 10kHz. If the motors draw too much current for your power supply to provide the voltage will drop, whcih could trip the brown out detector, reset the uC, re-measure the IR sensor, re-turn on the motors, once again drawing too much current...

JC
It crossed my mind that the motors were causing brown-out, but I thought that it was unlikely that the ZX would reboot at 10KHz....

-Tony
Post Reply