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.
DocJC wrote:Just for the record it would be nice to know what the Brown Out Detector Fuse is set to.
On all ZX devices, the BrownOut threshold is 2.7V (nominal). It would be interesting to know what the value of Register.ResetFlags is when the ZX resets.
DocJC wrote: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, [...]
That would be a possibility if the motors and the uC were powered by the same supply. However, the OP stated that the motor has a separate supply.
The motors have a separate power supply (11.1v). The ZX-40N device and motor Driver share the same regulated 5V power supply. I enclosed some hardware pictures for clarification.
Its hard to say for sure from the pictures, but it also appears that the motor grounds go back to the motor battery via heavy wires. Where is the common ground hooked to the motor batteries. The common ground connection should be connected as close as possible to the motor batteries.
If, for instance, there is a 10 milliohm resistance between the common ground connection point and the motor batteries, then when the motors pull 21A (each!), the common ground could be (V=IR) 42A * 0.010R = 0.42V above true ground!
I presume that the motors do have a common ground with the rest of the electronics, though they could be completely isolated. I suspect that with the motor driver powered by the ZX power supply, that there is a common ground.
With use of optoisolators, it may well be possible to completely isolate the ZX from the motors and motor controller.
spamiam wrote:Where is the common ground hooked to the motor batteries.
Not sure what is meant by that remark.
Each motor has two low gage wires connected to the motor driver. The motors' battery (11.1v LiPo) is also connected to the motor driver directly. Vendor schematic below:
At the motor leads, I connected 3 separate noise filters (0.1uF) as shown in the enclosed picture. Am I missing something aside from the optoisolation?
spamiam wrote:Where is the common ground hooked to the motor batteries.
Not sure what is meant by that remark.
At the motor leads, I connected 3 separate noise filters (0.1uF) as shown in the enclosed picture. Am I missing something aside from the optoisolation?
Well, the optoisolators isolate the signal, but do not necessarily isolate the ground. It is possible to have the ZX completely isolated from the motor section of the robot. No direct signal connection (i.e. using optos) and no shared ground either. However, I strongly suspect that you have a shared ground (i.e. the ground of the ZX and the ground of the motors are connected).
Depending on how the connection of the grounds is done, the actual voltage level of the ground may not be the same at the ZX and at the motor controller.
When using optoisolators it is not necessary to have the ZX ground connected to the motor ground.
Do you have the ZX ground connected to the motor ground? If so, you have to be quite careful because the high currents in the motor ground can cause the voltage of the "ground" to be something other than zero due to resistance between the ground interconnection point and the motor battery terminal. It took me a long time to realize that ground is not necessarily synonymous with "zero volts", and that ground at one place is not necessarily at the same voltage as ground at another place. In low current, low frequency designs it may not be a significant factor. At high current and high frequency, it is a big deal. I still do not understand all the ramifications and best practices for high current/frequency designs.
I have not implemented the optoisolated circuit. As the project now stands, the ZX and motor battery likely share the same ground somewhere inside the motor driver (schematic below) - that I can't undo.
Once I optoisolate the project, the motor driver will have its own motor battery and its own +5V regulated power source. The ZX circuit will also have its own battery. So that's a total of 3 batteries! I may consider a 4th for the IR range sensors, which are quite noisy. The 1,000uF low ESR filters at each IR sensor does help significantly.
liam.zbasic wrote:Once I optoisolate the project, the motor driver will have its own motor battery and its own +5V regulated power source. The ZX circuit will also have its own battery. So that's a total of 3 batteries! I may consider a 4th for the IR range sensors, which are quite noisy. The 1,000uF low ESR filters at each IR sensor does help significantly.
Wow, THREE batteries! I had envisioned two. One to run the ZX and sensors. The other to power the motor driver and motors. BUt three works too!
One can take isolation to an impractical and likely unnecessary
extreme. The objective is to reduce the noise from heavy loads that's
induced onto logic lines and, perhaps, minimize brownout droop - not to
isolate loads from one another. And, while it is possible to
galvanically isolate your controller from the load it controls - no
conductive path whatsoever from any point on one side to any on the
other side - it is probably not required, and I think makes
troubleshooting the circuit more difficult since there is no single
reference point from which to measure levels.
Motors can probably share a common supply with other inductive actuators
and with positive-temperature-coefficient loads like incandescent lamps,
and other dynamic high-demand loads. A simple method has been discussed
here - a common ground point at or very near the supply return (a star
ground) - which assures that logic ground is as close to zero volts as
possible - which has served many projects for many decades.
Ground noise is not a new problem; a number of books have been written
about it alone and it has probably been experienced since about 1890.
I wired up a PS2501-4 optoisolator to my project. The motor-driver logic signals that control fwd/reverse motion function correctly. The PWM signal does not work. The ZX-40n is sending a 20khz PWM to the optoisolator. My voltmeter detects that frequency on the output, but the output RMS voltage is near 5V regardless of the input duty cycle. The enclosed picture shows the optoisolator circuit used for both logic signals and PWM. Is this circuit appropriate for PWM? Is there a better optoisolator for this application? I'm driving a VNH2SP30 motor driver module from pololu. Appreciate your comments. Thanks.
I am not an electrical engineer, but usually I put the resistor on the (+) side of an NPN transistor. The reason for this is that the (-) side is common to the base and the 10K resistor will limit base current. Limiting base current will limit the gain of the transistor. It is harder to get the transistor to turn on.
But for you moving the 10K resistor would make the transistor act as an inverter. As a result you would have to reverse the duty cycle logic or add another (regular NPN, not opto) transistor to act as a second inverter. It is probably easier to change the PWM logic at the ZX.
-Tony
EDIT: This is not to say that you can't use your circuit as shown. Look up "common emitter" and "common collector" in wikipedia and other sources. then you can select whichever design you prefer.
spamiam wrote:But for you moving the 10K resistor would make the transistor act as an inverter.
You can avoid the inversion by sinking current through the LED and then taking the isolated signal from the collector of the transistor as illustrated in the accompanying image. When the PWM IN signal is low the LED will be emitting light thus switching on the transistor which pulls the collector low.
You'll have to check the datasheet for the opto isolator to confirm that the LED current (V/220) is sufficient to ensure that the transistor is fully saturated. If it isn't, you'll get a distorted signal at the collector.
dkinzer wrote:You can avoid the inversion by sinking current through the LED and then taking the isolated signal from the collector of the transistor...
I'll try your suggestion.
Separately, I FOUND SUCCESS with my PWM problem. Also, the ANOMALOUS INTERACTION BETWEEN THE ZX40N AND MOTOR DRIVER IS GONE. The optoisolator did the job.
The optoisolator issue was the load resistor (RL) on the output side - it was too high. The switching time (rise & fall times) depend on RL - the higher the value, the higher the delay. Datasheet below:
Although an RL value of 10K for the logic signals is okay, it's "off-the-charts" too high for the PWM signal. The switching time was so long that the optoisolator could not resolve the PWM signal with low duty cycles, and the isolator interpreted it as 100%. That's why my motors shot to their max RPM regardless of input duty cycle.
I'll try your suggested circuit. I'm uncomfortable with my setup. As "spamian" suggested, it's unusual putting RL on the emitter side of the phototransistor.
Separately, I'm eyeing a high speed an optoisolator with switching times in the order of nanoseconds as opposed to microseconds with the PS2501. I'll use the slow PS2501 for logic signals and the fast 6N137 for PWM signals.