Leakage current

Have questions about the equipment used for macro- or micro- photography? Post those questions in this forum.

Moderators: Chris S., Pau, Beatsy, rjlittlefield, ChrisR

mkbn
Posts: 277
Joined: Thu Jan 25, 2024 10:58 pm

Re: Leakage current

Post by mkbn »

WojTek wrote:
Sun May 19, 2024 11:11 am
This is not about tracking the position, but about recognising obstacles.
The position is tracked by the controller of the rail (Arduino, Raspberry-Pi, etc).
What I mean is the driver of the stepper motor TMC 5130.
Please read the user manual of this driver, then everything will be clear :-)

It's a 130 page document, so if you'd be so kind to elucidate rather than have me read that, it'd be beneficial :P

I'm assuming you're mentioning the sensorless homing scheme or something to detect current/load fluctuations. In ether case, implementing the extra hardware is a complexity tradeoff as it has to take into account what existing controller fotochris has, tacking this on, and reading up on implementation for the TMC. As I mentioned in one of my schemes, one limit switch or no limit switch but programmed in known values for rail length and starting always at 0 are other complexity trade off options. There are a myriad of control schemes for linear motions, none can be stated to be the best invariant of knowing what system one is integrating for and one's appetite or ability to modify the controller hardware/software, to me. This may be my issue with proclaiming a 'best,' especially given that the current controller may natively support limits and have routines for homing as an option. Even if the 5130 may be an excellent overall option.
CrispyBee wrote:
Sun May 19, 2024 12:15 pm
In case anyone is interested: I opened the MJKZZ controller box and the case is not grounded. In fact it wouldn't even matter if it was, as the power supply it was shipped with only has a flat Euro plug, meaning it isn't grounded either.

I wonder how why or whether they are selling tose legally in the EU, I have my doubts about that.

The mjkzz controllers are powered by raspberry pi, no? If so, I'd not be too concerned, they're usually isolated DC USB power supplies. I can't speak to EU regulations, tho.

CrispyBee
Posts: 1195
Joined: Mon Apr 03, 2023 11:17 am

Re: Leakage current

Post by CrispyBee »

mkbn wrote:
Sun May 19, 2024 1:11 pm

The mjkzz controllers are powered by raspberry pi, no? If so, I'd not be too concerned, they're usually isolated DC USB power supplies. I can't speak to EU regulations, tho.
It didn't look like a raspberry inside, more like a custom circuit board and this seems to be the driver that runs the whole thing:

https://gleanntronics.ie/en/products/st ... -1089.html

But really there isn't much to be seen besides this chip which is covered with thermal pads (cooling passive via the case). The rest are mainly traces and connectors, die display and IR-reciever.

EDIT: I think it's Arduino-based.

mkbn
Posts: 277
Joined: Thu Jan 25, 2024 10:58 pm

Re: Leakage current

Post by mkbn »

CrispyBee wrote:
Sun May 19, 2024 2:36 pm
mkbn wrote:
Sun May 19, 2024 1:11 pm

The mjkzz controllers are powered by raspberry pi, no? If so, I'd not be too concerned, they're usually isolated DC USB power supplies. I can't speak to EU regulations, tho.
It didn't look like a raspberry inside, more like a custom circuit board and this seems to be the driver that runs the whole thing:

https://gleanntronics.ie/en/products/st ... -1089.html

But really there isn't much to be seen besides this chip which is covered with thermal pads (cooling passive via the case). The rest are mainly traces and connectors, die display and IR-reciever.

EDIT: I think it's Arduino-based.
Ah, I see! Would love to see pics of what's inside out of curiosity, but I'd imagine it would've either been a Pi, Arduino, or any number of cheap similar microcontrollers on a simple custom board. I thought I had heard someone else mention a pi with the mjkzz but I could be forgetting or misremembering. In other news, if that lv8792 board is in that pop off form factor like they often are and not directly soldered to the board, something like the TMC Adi mentioned could be a viable option if you're looking to unravel a mystery a bt

On anther note, I'd love it if people wanted to collaborate on some simple motion controllers for the rails in an open source fashion. I've got mine and it's great/cheap with the pico, but I probably don't have ambitions to solo the project and make it fully usable for every use case for others people. I'l release what I use and how to assemble it and update it as I add functionality that *I* need, but I want to get more people engaged in a project to make the very easily and already well solved problem accessible to all and generalized for everyone's wants. Would also prevent people from ending up in a dead end situation when something goes EOL from a manufacturer. I just don't have the time to make it all perfect immediately for what I want the thing to be (open source hardware and not just for profit). Of course we'd argue about ideal solutions, but that's half the fun hehe. There are many open projects in this vein in the CNC community (grblhal based boards), and our use case is far less demanding.

Edit: ah, actually no, the tmc5310 is configured and used via SPI it seems plus diff form factor, so it wouldn't be a drop in replacement

CrispyBee
Posts: 1195
Joined: Mon Apr 03, 2023 11:17 am

Re: Leakage current

Post by CrispyBee »

mkbn wrote:
Sun May 19, 2024 2:54 pm
CrispyBee wrote:
Sun May 19, 2024 2:36 pm
mkbn wrote:
Sun May 19, 2024 1:11 pm

The mjkzz controllers are powered by raspberry pi, no? If so, I'd not be too concerned, they're usually isolated DC USB power supplies. I can't speak to EU regulations, tho.
It didn't look like a raspberry inside, more like a custom circuit board and this seems to be the driver that runs the whole thing:

https://gleanntronics.ie/en/products/st ... -1089.html

But really there isn't much to be seen besides this chip which is covered with thermal pads (cooling passive via the case). The rest are mainly traces and connectors, die display and IR-reciever.

EDIT: I think it's Arduino-based.
Ah, I see! Would love to see pics of what's inside out of curiosity, but I'd imagine it would've either been a Pi, Arduino, or any number of cheap similar microcontrollers on a simple custom board. I thought I had heard someone else mention a pi with the mjkzz but I could be forgetting or misremembering.
I had thought the same thing but that's probably due to some stuff they sold for Raspberry Pi:

https://www.mjkzz.de/collections/contro ... 6333162741

I think I'll give the whole thing another go in a week or so and I'll add some cable shielding to the mix. Should stop induction from happening with both the motor cable and the limiter switch cables. And I'll also look for switches that are more suitable for the task, the ones I used had some small integrated circuit stuff added in order to output a signal - which would be irrelevant for my setup but probably drew a constant (low) current.

Combined with the already isolated motor and separated controller box it should get rid of all the remaining issues.

WojTek
Posts: 2881
Joined: Mon Nov 30, 2015 1:09 pm

Re: Leakage current

Post by WojTek »

mkbn wrote:
Sun May 19, 2024 1:11 pm
WojTek wrote:
Sun May 19, 2024 11:11 am
This is not about tracking the position, but about recognising obstacles.
The position is tracked by the controller of the rail (Arduino, Raspberry-Pi, etc).
What I mean is the driver of the stepper motor TMC 5130.
Please read the user manual of this driver, then everything will be clear :-)
It's a 130 page document, so if you'd be so kind to elucidate rather than have me read that, it'd be beneficial :P

Information on stall detection can be found in the description of the StallGuard2:
https://www.analog.com/media/en/technic ... ev1.21.pdf

e.g. Page 84:

15.3 Detecting a Motor Stall
For best stall detection, work without StallGuard filtering (sfilt=0). To safely detect a motor stall the
stall threshold must be determined using a specific SGT setting. Therefore, the maximum load needs
to be determined, which the motor can drive without stalling. At the same time, monitor the
SG_RESULT value at this load, e.g. some value within the range 0 to 100. The stall threshold should be
a value safely within the operating limits, to allow for parameter stray. The response at an SGT
setting at or near 0 gives some idea on the quality of the signal: Check the SG_RESULT value without
load and with maximum load. They should show a difference of at least 100 or a few 100, which shall
be large compared to the offset. If you set the SGT value in a way, that a reading of 0 occurs at
maximum motor load, the stall can be automatically detected by the motion controller to issue a
motor stop. In the moment of the step resulting in a step loss, the lowest reading will be visible.
After the step loss, the motor will vibrate and show a higher SG_RESULT reading.

mkbn
Posts: 277
Joined: Thu Jan 25, 2024 10:58 pm

Re: Leakage current

Post by mkbn »

WojTek wrote:
Mon May 20, 2024 2:21 am



Information on stall detection can be found in the description of the StallGuard2:
https://www.analog.com/media/en/technic ... ev1.21.pdf

e.g. Page 84:

15.3 Detecting a Motor Stall
For best stall detection, work without StallGuard filtering (sfilt=0). To safely detect a motor stall the
stall threshold must be determined using a specific SGT setting. Therefore, the maximum load needs
to be determined, which the motor can drive without stalling. At the same time, monitor the
SG_RESULT value at this load, e.g. some value within the range 0 to 100. The stall threshold should be
a value safely within the operating limits, to allow for parameter stray. The response at an SGT
setting at or near 0 gives some idea on the quality of the signal: Check the SG_RESULT value without
load and with maximum load. They should show a difference of at least 100 or a few 100, which shall
be large compared to the offset. If you set the SGT value in a way, that a reading of 0 occurs at
maximum motor load, the stall can be automatically detected by the motion controller to issue a
motor stop. In the moment of the step resulting in a step loss, the lowest reading will be visible.
After the step loss, the motor will vibrate and show a higher SG_RESULT reading.


Ah, thanks. So, a bit of interfacing/software complexity as a tradeoff for hardware (sensor) complexity.

I was curious because I received a motorized microscope stage which was far cheaper than a regular stage which includes hall limit sensors. Figuring out the motor wiring was no problem for the steppers (short leads together unconnected to power and feel for resistance to turning to find motor windings), but the hall sensors are undocumented and the manufacturer hasn't responded, so there was a bit of an appeal.

It would seem the tmc5310 is detecting back-emf from a missed step when hitting the physical end of rail motion. Reading up on a klipper document from printers which can implement this with appropriate drivers I read:
"
Limitations¶
Be sure that your mechanical components are able to handle the load of the carriage bumping into the limit of the axis repeatedly. Especially leadscrews might generate a lot of force. Homing a Z axis by bumping the nozzle into the printing surface might not be a good idea. For best results, verify that the axis carriage will make a firm contact with the axis limit.

Further, the stall detection of the stepper driver is dependent on the mechanical load on the motor, the motor current and the motor temperature (coil resistance).

Sensorless homing works best at medium motor speeds. For very slow speeds (less than 10 RPM) the motor does not generate significant back EMF and the TMC cannot reliably detect motor stalls. Further, at very high speeds, the back EMF of the motor approaches the supply voltage of the motor, so the TMC cannot detect stalls anymore. It is advised to have a look in the datasheet of your specific TMCs. There you can also find more details on limitations of this setup."

https://www.klipper3d.org/TMC_Drivers.html?h=sensorless

Pont 3 may be an issue for us in stacking applications. We're almost invariably running at extremely low speeds for motion, so I wonder if the driver would really be able to detect a stall accurately for our use case.

CrispyBee
Posts: 1195
Joined: Mon Apr 03, 2023 11:17 am

Re: Leakage current

Post by CrispyBee »

mkbn wrote:
Mon May 20, 2024 12:46 pm

Pont 3 may be an issue for us in stacking applications. We're almost invariably running at extremely low speeds for motion, so I wonder if the driver would really be able to detect a stall accurately for our use case.
I had the same thought - especially with vastly different loads it's difficult to estimate how well the system does all those auto-configurations and how much work is involved.

Lastly - while I had messed up regarding the choice of limiter switches and not using shielded wiring, it still worked perfectly fine and reliably and it was a cheap and (if you know what you're doing) easy installation.

rjlittlefield
Site Admin
Posts: 24496
Joined: Tue Aug 01, 2006 8:34 am
Location: Richland, Washington State, USA
Contact:

Re: Leakage current

Post by rjlittlefield »

Chris, I don't see where you've ever said exactly how you had the limit switches wired up.

But I note that you're using an MJKZZ controller, and I see that at least one of the MJKZZ controllers provides
2 limit switch inputs. This is necessary for a lot of application
where hardware limit switches can be installed on the rail to prevent
accidental ramping into end of rail.
...
Limit Switch Port – this is where limit switches can be plugged in. It
is a 3.5mm stereo socket and supports two limit switch inputs. The
two limit switches can be installed at each end of the rail. The base
ring of 3.5mm plug is the common ground shared by the two limit
switches. The middle ring and the tip are the two limit switches.

Is that what you're using, or something else?

--Rik

CrispyBee
Posts: 1195
Joined: Mon Apr 03, 2023 11:17 am

Re: Leakage current

Post by CrispyBee »

rjlittlefield wrote:
Mon May 20, 2024 2:53 pm
Chris, I don't see where you've ever said exactly how you had the limit switches wired up.

But I note that you're using an MJKZZ controller, and I see that at least one of the MJKZZ controllers provides
2 limit switch inputs. This is necessary for a lot of application
where hardware limit switches can be installed on the rail to prevent
accidental ramping into end of rail.
...
Limit Switch Port – this is where limit switches can be plugged in. It
is a 3.5mm stereo socket and supports two limit switch inputs. The
two limit switches can be installed at each end of the rail. The base
ring of 3.5mm plug is the common ground shared by the two limit
switches. The middle ring and the tip are the two limit switches.

Is that what you're using, or something else?

--Rik
Hi Rik, yes that's what I was using!

I used the same adapter that was used in the MJKZZ video showing the video:
https://www.youtube.com/watch?v=I5xVd5Xm3HQ

My biggest mistake (aside from the unshielded cables next to my aluminum tower) was using limiter switches that seem to have an additional circuitry between the switch an the contacts (similar to those https://www.aliexpress.com/item/1005004192770835.html ) with a pinout that looks to be "Voltage Ground Signal" - but the switch was always drawing some current for the circuitry, at least that's what it looks like.

Overall the switches only generated a bit of induction current.
But the motor cables also generated a bit of induction current.
The motor felt a bit "excited" and the controller box too induced a current.

Individually the currents aren't that noticeable but everything put together produces quite the "buzz" :lol:

Anyway, the new 'simple' switches and the shielding should be arriving on Friday, then finally the whole setup is complete.

rjlittlefield
Site Admin
Posts: 24496
Joined: Tue Aug 01, 2006 8:34 am
Location: Richland, Washington State, USA
Contact:

Re: Leakage current

Post by rjlittlefield »

CrispyBee wrote:
Mon May 20, 2024 3:59 pm
I used the same adapter that was used in the MJKZZ video showing the video:
https://www.youtube.com/watch?v=I5xVd5Xm3HQ
That looks conventional. He's using the normally open terminals, closed when the rail hits limit.
https://www.aliexpress.com/item/1005004192770835.html ) with a pinout that looks to be "Voltage Ground Signal" - but the switch was always drawing some current for the circuitry, at least that's what it looks like.
This is another place where a cheap multimeter would help a lot, but only if combined with the appropriate electronics knowledge.

The ad looks like they've taken a standard SPDT microswitch and added a couple of resistors, a diode, and a capacitor for signal conditioning and chip protection, probably to reduce picking up stray signals from nearby motor drive wires and maybe to avoid frying a processor chip if some program accidentally configures the limit switch I/O pin for output instead of input. But I've never seen that particular packaging so I won't speculate on exactly how all that stuff is connected together.

As for the leakage current, since you've sort of ruled out the power supply itself, my next guess would be that the stray "buzz" is originating in the way the motor is driven. Those stepper drivers work by rapidly switching each motor winding between +/-, -/+, and shorted together, so between two wires it's oddly easy to see something like 24 volts peak-to-peak AC, despite only a 12 VDC power supply. I don't have an MJKZZ system on hand, but the oscilloscope I have wired across one winding of a StackShot motor right now shows the following at 10V per division (and yep, it's a 12 VDC power supply):
PXL_20240521_055249261_gray.jpg

I see lots of opportunity here for mischief in stray coupling.

I expect you'd get better results faster by just grounding the rig, rather than fiddling with details of the wiring.

--Rik

CrispyBee
Posts: 1195
Joined: Mon Apr 03, 2023 11:17 am

Re: Leakage current

Post by CrispyBee »

rjlittlefield wrote:
Mon May 20, 2024 11:17 pm

As for the leakage current, since you've sort of ruled out the power supply itself, my next guess would be that the stray "buzz" is originating in the way the motor is driven. Those stepper drivers work by rapidly switching each motor winding between +/-, -/+, and shorted together, so between two wires it's oddly easy to see something like 24 volts peak-to-peak AC, despite only a 12 VDC power supply.
Well yes and no, I've removed and isolated the motor but the current is still noticeable as soon as the wires get close - which is most likely due to the constant flow of electricity to hold the rail in position during idling.

And the same thing happened with the cables for the switches so induction "has" to be the reason for that. While that wouldn't be possible for the regular switches with open contact in regular mode, mine seemed to also consume some electricity in that situation, probably in order to send a signal on the third contact.
rjlittlefield wrote:
Mon May 20, 2024 11:17 pm
I expect you'd get better results faster by just grounding the rig, rather than fiddling with details of the wiring.

--Rik
Of course but I'd rather have both a grounded system (just in case) and proper isolation and shielding at the same time.

CrispyBee
Posts: 1195
Joined: Mon Apr 03, 2023 11:17 am

Re: Leakage current

Post by CrispyBee »

UPDATE:

I used very simple and cheap ESD grouding plugs and wires, which work incredibly well to remove all the current from the system.
The only thing that gave me some headache was when used washers/spacers between the wire connector and the rail, I assumed because they're metal washers it would simply conduct the current with zero resistance, but the thin anodizing layer was enough to reduce the grounding so that there was still some current left over.
Now that it's screwed directly into the rail/frame, it's great. Zero "buzz", no stickyness to the metal, no dust attraction. #-o

In case anyone else is suffering from the same problem, it's the BYUP ESD earth plug / erdungsstecker (the yellow one)

Lou Jost
Posts: 6497
Joined: Fri Sep 04, 2015 7:03 am
Location: Ecuador
Contact:

Re: Leakage current

Post by Lou Jost »

For what it's worth, I also have had problems with leakage current, but from my Panasonic S1R camera, when using an external power supply. It actually shocks my face when I look through the viewfinder.

blekenbleu
Posts: 158
Joined: Sat May 10, 2008 5:37 pm
Location: U.S.
Contact:

Re: Leakage current - motor vs transformer

Post by blekenbleu »

One source of stray current in motors is by transformer action between stator and rotor.
Many motor have provisions to avoid damaging currents flowing thru armature shaft bearings or bushings.

This current is arguably induced, rather than leaked.
Metaphot, Optiphot 1, 66; AO 10, 120, and EPIStar 2571
https://blekenbleu.github.io/microscope

enricosavazzi
Posts: 1571
Joined: Sat Nov 21, 2009 2:41 pm
Location: Västerås, Sweden
Contact:

Re: Leakage current

Post by enricosavazzi »

CrispyBee wrote:
Sun May 19, 2024 12:15 pm
[...]
I wonder how why or whether they are selling tose legally in the EU, I have my doubts about that.
FWIW, I have plenty of EU-"legal" equipment, and more than half of the power supplies that lack a wire to the ground contact of the electrical outlet have ground leaks easily perceptible by touch. In general, if a power supply is entirely encased in plastic, with no metal parts normally reachable by the user's hands, it is quite normal for the power supply not to be properly grounded. If a third-party device encased in metal is then connected to the power supply and the casing has a perceptible leak, it is not the problem of the power supply maker. It would probably be illegal, however, for the device ground to have a voltage and/or current leak with respect to true ground sufficiently high to be a danger to the user.

In most of the EU, at least some of the electrical outlets in a household have a built-in ground contact, and construction codes require the ground contact to be wired separately from either the live of the neutral wire. I grew up in Italy, and at that time (some 50 years ago), it was quite common for the ground contact in every outlet to be wired to neutral instead of having its own wire to ground (a widespread construction fraud aiming to save the cost of a separate ground wire and its installation - electricians had no problem openly admitting it if questioned, this was simply what everybody did). Now I live in Sweden, and here it is currently obligatory for each and every electrical outlet to be wired to true ground. However, grounded as well as non-grounded power plugs are still allowed by EU standards and therefore allowed in Sweden, and many (probably most) power supplies made in China and sold in the EU lack a ground cable.

As you found out, even in a simple device there can be multiple ground leaks. You could try to wire each "leaky" part of the system separately to ground, but you may easily end up creating ground loops that are a worse problem than the one you are trying to solve. The "local" ground of different parts of a system may be at different potentials, and connecting it to other local grounds may even create a short somewhere. It is probably safest to encase each leaky part into a plastic casing and electrically insulate it from the frame of the device. Capacitive/inductive coupling to the metal frame of a microscope, macro stand or other device always remains a possibility, and grounding this frame may then be all that is really necessary.
--ES

Post Reply Previous topicNext topic