the last challenge is: how to detect if a stepper-motor is rotating - Page 1
Forum section: electronics / general

author: legacy
author_rank: Super Contributor
timestamp: August 19, 2018, 02:33:07 pm
content: so, you have four stepper motors, you can't touch them, neither you can directly sniff their phases, you can't do it!And you can't attach a sensor, i.e. a quadrature encoder, to the mechanical load. You can't do it.But you have to detect if your step-motors are rotating. Don't matter of which speed, and increments.Hints? I am tempted to "sense" the phases with a sort of magnetic sensor, since when current flows in a wire ... it produces a magnetic field, and an impulse (from the stepper-driver) for sure will alter the magnetic field around the wire of one of the stepper's phase.here, *if* the motor's driver doesn't use micro stepping, you have one phase changing per incrementCode:motor's phases {a, b, b, d}abcd0000000100110010011001110101010011001101111111101010101110011000sort of circuit based on an hall-effect sensor amplified by an OA, and then triggered to a flip-flop if one of the four phases has a change in the magnetic field (0->1, or 1->0) ?what do you think?

author: JustMeHere
author_rank: Frequent Contributor
timestamp: August 19, 2018, 02:34:19 pm
content: That's what dual shaft steppers and rotary encoders are for.

author: Richard Crowley
author_rank: Super Contributor
timestamp: August 19, 2018, 02:42:22 pm
content: Quote from: legacy on August 19, 2018, 02:33:07 pmQuoteYour distinction between "sniff" and "sense" is likely lost on most of us.Just because you sense a changing current amplitude or direction in a wire doesn't tell you whether the rotor is actually turning.

author: legacy
author_rank: Super Contributor
timestamp: August 19, 2018, 02:43:31 pm
content: Quote from: JustMeHere on August 19, 2018, 02:34:19 pmand you can't change your steepers, neither add an encoder, in my case: you can't, that's *THE* problem

author: legacy
author_rank: Super Contributor
timestamp: August 19, 2018, 02:54:17 pm
content: Quote from: Richard Crowley on August 19, 2018, 02:42:22 pmFour wires go the stepper-motor from the driver. Right? You can't cut them to add a patch to them, in order to know if the current flowing through them. This is what I called (current) "sniff".You can't do any intrusive measurement, and you can't touch the cable between the driver and motors.Hence, my ... well, it's just an idea, is about attaching a sensor to the cable, in order to indirectly know if there is a current flowing in one of the phases since if there is a current flowing change, there is a magnetic field change, and you can measure it without being intrusive.Quote from: Richard Crowley on August 19, 2018, 02:42:22 pmwhy not? You mean: the driver forces the rotor to keep the position?in this case, there is no changing current, the current should be constantbetter ideas are welcome

author: JS
author_rank: Frequent Contributor
timestamp: August 19, 2018, 02:57:52 pm
content: Do you need to know if the driver is sending the movement order or a closed loop to see if the rotor is acctually rotating?If just checking the driver is trying to move it you could use a hall sensor to see the change in the magnetic field of the core.JS

author: langwadt
author_rank: Super Contributor
timestamp: August 19, 2018, 03:02:36 pm
content: Quote from: legacy on August 19, 2018, 02:54:17 pmcan't touch the cable but you can attach a sensor to the cable?

author: Richard Crowley
author_rank: Super Contributor
timestamp: August 19, 2018, 03:05:58 pm
content: Hard to conceive how you could accurately sense the magnetic field of each wire accurately without "touching" them at least to the point where you can separate the wires to get independent measurements? Your thought experiment quickly devolves into practical issues.Certainly your scheme would be a decent monitor whether. the drivers were operating properly.But, unless you can actually do some (invasive) experiments with locked-rotor (or even missing rotor), hard to see how examining the magnetic flux in the wires will tell you anything about the mechanical operation of the rotor. Even high-end stepper-motor products use optical encoders on the shaft to close the loop for actual position confirmation.

author: legacy
author_rank: Super Contributor
timestamp: August 19, 2018, 03:17:11 pm
content: Quote from: JS on August 19, 2018, 02:57:52 pmin theory, this means assuming the mechanic-stuff is OK and there is no stall: I have to properly consider how strong is this hypothesis, it might be considered the first order of approximation to my problem.Quote from: JS on August 19, 2018, 02:57:52 pmeh, this should be the best answer to the problem, whose question digs into remote controlling a closed-source 3d printer, to the question: is everything ok? is there any stall with the printing-wire-loader?similar questions dig to the tree axis step motors, and I can't add an encoder sensor, neither I can convince other guys to find a mechanical solution, so ... I wonder I can sort it out by the hall-sensor approachI know we'd better abandon that 3d-printer, buy a new one, already designed to remote control, or moving ourselves to an opensource one where you have the full control of the firmware &C ... but life is so complex ... and guys in the team have already said "definitively NO!, we won't change the 3dprinter!", so ... that's life(I am tempted to buy a single ticket to Haiti, they have three "internet-off" weeks where wifi and cell-phones are put off-line around all the island and nobody can physically reach you)

author: legacy
author_rank: Super Contributor
timestamp: August 19, 2018, 03:22:44 pm
content: Quote from: Richard Crowley on August 19, 2018, 03:05:58 pmthe driver uses a big shielded sock to route the cable around the mechanical frame, but at some point, near the motor, the shielded sock ends with four separated wires, and they go into the motor. There are 2mm between each wire, and 20mm from the end of the shielded sock and the motor's connector, I assumed (maybe I am wrong) enough to wrap a wire around each one

author: vk6zgo
author_rank: Super Contributor
timestamp: August 19, 2018, 03:27:11 pm
content: Fasten a microphone to the outside--- there will be a whirring sound when they are rotating.

author: legacy
author_rank: Super Contributor
timestamp: August 19, 2018, 03:37:07 pm
content: Quote from: Richard Crowley on August 19, 2018, 03:05:58 pmthe idea is: if you can sense a current change in all of the four phases and save it into a latch, you (by a CPLD) can compare the current status with the previous, and understand if the motor trying to rotatee.g.previous status: 0001current status: 0011------------------------------the difference --x-is it an increment? a decrement? don't have closed-loop information to confirm, but the router has been driven to rotateCode:0000000100110010011001110101010011001101111111101010101110011000if in a large time-window (of minutes), there is no difference between the current-status and previous-status at sensing the stepper's phases, you might be able to conclude that- there is a mechanical stall (the rotor is driven to rotate, but it doesn't)- the printing-wire is finished (the rotor is really stopped)- the printer is halted (the rotor is really stopped)

author: legacy
author_rank: Super Contributor
timestamp: August 19, 2018, 03:37:48 pm
content: Quote from: vk6zgo on August 19, 2018, 03:27:11 pmintriguing

author: langwadt
author_rank: Super Contributor
timestamp: August 19, 2018, 03:39:11 pm
content: Quote from: legacy on August 19, 2018, 03:22:44 pmif there is a connector on the stepper just make a short extender cable to get to the wires

author: legacy
author_rank: Super Contributor
timestamp: August 19, 2018, 03:40:11 pm
content: Quote from: langwadt on August 19, 2018, 03:39:11 pmthis can't be done, there is not enough space there for a patch.

author: Richard Crowley
author_rank: Super Contributor
timestamp: August 19, 2018, 03:57:24 pm
content: Quote from: legacy on August 19, 2018, 03:37:07 pmDoes the current-status in any of the wiresactually changewhen the rotor is turning vs. locked? I would bet that there is no practically discernible difference that would be useful for this scheme.QuoteSurely there are simpler and more straightforward ways of sensing when the printing-wire is finished?QuoteAgain, it comes back to whether there is any practically measurable difference between the rotor turning vs. not. The very fine "teeth" used on the rotor and the large number of poles that I have seen in stepper-motor tear-down videos suggests to me that there probably isn't much variation in current whether the rotor is turning or not. But only a practical test can prove that right or wrong.

author: langwadt
author_rank: Super Contributor
timestamp: August 19, 2018, 03:57:56 pm
content: seems like a big waste of time to try an invent rube goldbergish workarounds for self imposed limitations, what's next, have to do it blindfolded with one arm behind back? just patch into the cable and be done with it.if not, it seems the rest of the team just volunteered to fix the problems themselves

author: langwadt
author_rank: Super Contributor
timestamp: August 19, 2018, 04:01:21 pm
content: Quote from: Richard Crowley on August 19, 2018, 03:57:24 pmthe current rise time should be faster when the motor isn't turning and there isn't any bmf

author: Richard Crowley
author_rank: Super Contributor
timestamp: August 19, 2018, 04:06:24 pm
content: Quote from: langwadt on August 19, 2018, 04:01:21 pmPerhaps. But how big is that difference? Can it be measured with the very passive methods within the limits of this scheme? How sophisticated would the sensing method need to be? How sensitive? How fast (sampling rate)? It feels like the sophistication and complexity of reliable sensing may have crossed the line of cost/benefit practicality. But maybe that doesn't matter if this is only a theoretical thought-experiment?

author: Mr. Scram
author_rank: Super Contributor
timestamp: August 19, 2018, 04:07:48 pm
content: Can we get a comprehensive situational sketch of the actual problem? Now it all feels a bit contrived, with limitations randomly popping up.

author: langwadt
author_rank: Super Contributor
timestamp: August 19, 2018, 04:14:28 pm
content: Quote from: Mr. Scram on August 19, 2018, 04:07:48 pmI can speculate, they don't want him to touch the printer because he has a history of fixing things until they breakor they are crazy ...

author: legacy
author_rank: Super Contributor
timestamp: August 19, 2018, 04:16:20 pm
content: This idea posted onhackadaymeasures the filament movement by a wheel and encoder.Interesting. It doesn't completely solve my problem, but it's a good step ahead

author: legacy
author_rank: Super Contributor
timestamp: August 19, 2018, 04:18:26 pm
content: Quote from: langwadt on August 19, 2018, 04:14:28 pmMainly for warranty reason. if you modify the 3d printer in a permanent way, you can say goodbye to the warranty. It's a ~>2.5K euro 3d-printer, the warranty-extension will cover the product until 2020.

author: senso
author_rank: Frequent Contributor
timestamp: August 19, 2018, 06:01:56 pm
content: Microphone and analyze the audio?Motor moving makes a sound, motor stuck makes another sound.

author: Fred27
author_rank: Unknown
timestamp: August 19, 2018, 06:31:53 pm
content: Quote from: legacy on August 19, 2018, 04:18:26 pmDoes it work right now? Then leave it alone.

author: Nusa
author_rank: Super Contributor
timestamp: August 19, 2018, 07:31:29 pm
content: You need to work on your basic knowledge of stepper motors first. What you describe in your original post is right for a 4-phase unipolar motor. That would require 5 wires minimum if a common ground is used, 6 wires for a common ground per phase, or 8 wires if the coils are independent. But you later say there are only 4 wires going to the motor, which means you have a TWO-phase bipolar stepper motor. (6 and 8 wire unipolar motors can wired in a bipolar configuration. 5-wire motors can't.)Most motors you come across in consumer-level 3-d printers are going to be bipolar. The full-step sequence for the a two-phase bipolar motor is accomplished by reversing the phases in sequence like so: ++, +-, --, -+, ++. For half-stepping you it would be: ++, +0, +-, 0-, --, -0, -+, 0+, ++. For microstepping you keep dividing the number of steps between full-range + and -, trading torque for precision. Some degree of microstepping is usually used in printers...you don't need a huge amount of torque. The really good drivers will actively switch between full-stepping and microstepping as required.Anyway, back to the actual problem. I'd suggest the easiest way to is simply to put a cheap camera pointed at the device with software set up to detect movement. If it fails to detect movement for a configurable amount of time, sound the alarm for someone to check on it.

author: legacy
author_rank: Super Contributor
timestamp: August 19, 2018, 08:02:20 pm
content: Quote from: Nusa on August 19, 2018, 07:31:29 pmThe motor used to move the printing-wire is a unipolar motor, I was talking about the four wires for the 4-phases, the 5th wire was not mentioned since it doesn't add any contributions to the idea I was describing

author: Nusa
author_rank: Super Contributor
timestamp: August 19, 2018, 08:12:16 pm
content: Hey, we can only go on what you tell us, not what you omit.QuoteNow if you'd said five wires, then I'd immediately say you have no need to sense the first four wires. Looking for current changes in the common ground would be sufficient to detect activity. And it would work with micro-stepping.

author: langwadt
author_rank: Super Contributor
timestamp: August 19, 2018, 08:30:43 pm
content: Quote from: Nusa on August 19, 2018, 08:12:16 pmthe fifth wire would normally be supply and the current shouldn't change much, it is just "alternating" between the coils

author: JS
author_rank: Frequent Contributor
timestamp: August 20, 2018, 01:23:29 am
content: Are you trying to close the loop or just check if the thing is moving?If all is wired correctly as you send the signal to the driver the current will be there, so I don't see the point just seeing if the driver is actually trying to drive the motors. With some sensitive care in the current sensing you can detect you are missing steps but how many is hard to tell and just knowing you are missing them allows to pause the print and throw away less plastik but not to get a better print. If you do close the loop with encoders or whatever you can get better and faster prints, as you know how much you moved and keep moving till you get there, you can push the thing harder and don't mind missing a few steps that you are going to recover.JS

author: besauk
author_rank: Contributor
timestamp: August 20, 2018, 01:33:58 am
content: Try looking at the transient voltage on the lines with a scope when stepping and when restricted from turning. I think you'll see a notch in the voltage when the stepper moves, and that notch will be noticeably missing when it is kept from turning. An analog differentiator and comparator could be set up to 'catch' that notch. Same idea applies when trying determine if a solenoid really moved or got stuck. Just a thought.

author: legacy
author_rank: Super Contributor
timestamp: August 20, 2018, 07:30:05 am
content: Quote from: besauk on August 20, 2018, 01:33:58 amWow, that's definitively an intriguing idea. Thanks, I will for sure experiment it!

author: In Vacuo Veritas
author_rank: Frequent Contributor
timestamp: August 20, 2018, 02:39:26 pm
content: A camera with OpenCV?

author: langwadt
author_rank: Super Contributor
timestamp: August 20, 2018, 05:39:46 pm
content: Quote from: besauk on August 20, 2018, 01:33:58 ambut that requires connection to the wires which apparently isn't possible

author: nctnico
author_rank: Super Contributor
timestamp: August 20, 2018, 06:31:06 pm
content: Quote from: legacy on August 19, 2018, 02:43:31 pmI think I have already warned you not to use steppers without encoders.

author: legacy
author_rank: Super Contributor
timestamp: August 20, 2018, 07:33:36 pm
content: Quote from: nctnico on August 20, 2018, 06:31:06 pmfeel free to address your claim to the company who built the 3dprinter. They offer the warranty but only if don't modify the frame/motors, and it's so fscking irritating, no doubt about it is, but that's is the problem I have to solveedit:for the record, it's also irritating that a2500 euro3d printer doesn't come with all the sensors already installed, including a holy sensor to stop the printing-wire motor to rotate when the wire is blocked, and feature like x,y,z coordinates exported(1) to resume the print from the point it was interrupted when the electricity is lot; for such amount of money we wish all of this already built-in ... and it didn't happen, that's life.(1) we sorted out by adding a UPS battery in the hope the electricity comes back online with a time windows of one hour as batteries won't last long.

author: nctnico
author_rank: Super Contributor
timestamp: August 20, 2018, 07:53:30 pm
content: How about simply returning it and buy something which works? You already knew where to look for: encoders on the steppers so why did this POS made it past your doorway?

author: legacy
author_rank: Super Contributor
timestamp: August 20, 2018, 09:33:06 pm
content: Quote from: nctnico on August 20, 2018, 07:53:30 pmin my team I am THE person who wishes to return the printer, but ... you know about the democratic theory of voting? well, the rest of the group sayNo-Go! Probably because we can't return the 3d-printer without wasting up to the 40% of the money. More than one month has already gone since the purchase, and that is what is written in the contractThat 3d-printer isn't so shitty, anyway, it's solid, it comes with a decent slicer that is 100% compatible with SolidWorks, and it does a good job, it's also certified on the paper to be hosted and used in a public a room (e.g. a toy shop) since it has a fire hazard alarm.But it's definitively hilarious that it has a built-in fire hazard alarm, but not a fscking sensor to stop the printing wire, and to completely stop the unit when there is a problem with the extruder.This makes it irritating when we use certain 3d-printing wires, and they block the extruder while the stupid printer goes ahead, and we waste time before realizing what happened, praying to what might also happen, like a bit damage to the wire-loader mechanism, that is, of course, covered by the warranty, but ... it takes up to three weeks to be replaced, and for sure we can't babysit the machine for twenty hours of printing to avoid it happening

author: Richard Crowley
author_rank: Super Contributor
timestamp: August 20, 2018, 11:21:24 pm
content: Is the back end of the stepper-motor visible? Even if the shaft doesn't extend beyond the motor body?I have seen examples where people just glue something on to the end of the shaft which can be used to visually sense movement.It can be easily snapped off if you need to restore the gadget for return, etc.Some integrated motor controllers just glue a disc magnet onto the end of the shaft and use a hall-effect sensor to detect rotary motion.Photos would quite possibly stimulate further ideas for solutions.

author: langwadt
author_rank: Super Contributor
timestamp: August 20, 2018, 11:32:58 pm
content: Quote from: Richard Crowley on August 20, 2018, 11:21:24 pmhttps://www.kickstarter.com/projects/301805155/ustepper

author: ebclr
author_rank: Super Contributor
timestamp: August 22, 2018, 12:08:27 pm
content: What about a simple microphone ?

author: legacy
author_rank: Super Contributor
timestamp: August 22, 2018, 12:50:07 pm
content: Quote from: ebclr on August 22, 2018, 12:08:27 pmI have already used an ultrasonic microphone with an LO (local oscillator) to report the frequency into the audio-spectrum, and used a dsPIC to sample, filter and trigger-detect the event, which in this case is "the rotor of the motor is rotating", whose spectrum and proprieties - I suppose - must be unique, therefore identifiable from the ambient noise with a decent S/N ratio in order to have a low failure rate at false positive. This is what I am worried about the microphone methodanyway, I am waiting for HAL sensors, and other components to be delivered, then I will try all the suggested methods

author: perieanuo
author_rank: Frequent Contributor
timestamp: September 14, 2018, 09:17:24 am
content: Once I had to measure rpm speed of a 45 KW motor, cheef engineer says the motor was tooo slow.I put a reflexive aluminium little piece of adhesive alu, put 5V on a reflexive optical sensor,put my multimeter on Frequency position and that's it.That was in 1996,my first year as engineerNot much intrusive as method...And yeah,the motor had the correct speed.So just draw some star lines on the back of the shaft with some black marker, get o slower sensitivity on the optical sensor and you can obtain even rotor position.It's not theory,it works.But if you guys want sophysticated hall sensor solutions with peak monitor pid monitoring,it can be done.It depends on what you need,see if motor turns or more precise position redings.Regards,pierreEnvoyé de mon iPad en utilisant Tapatalk

author: Richard Crowley
author_rank: Super Contributor
timestamp: September 14, 2018, 01:29:10 pm
content: Quote from: perieanuo on September 14, 2018, 09:17:24 amA sensor from an optical mouse would be great for sensing movement of the pattern. It is just a low-resolution camera and light source in a tiny package. And you can get one for free (or the cost of a cheap, generic optical mouse) Nice and small to mount on the end of the motor. And should be pretty simple to interface. You are just looking for a CHANGE in the image (to indicate rotation). You don't need to actually measure movement, etc.

author: legacy
author_rank: Super Contributor
timestamp: September 14, 2018, 01:48:28 pm
content: Quote from: perieanuo on September 14, 2018, 09:17:24 amall good and neat, but ... there is no space back of the shaft

author: perieanuo
author_rank: Frequent Contributor
timestamp: September 14, 2018, 03:40:01 pm
content: Quote from: legacy on September 14, 2018, 01:48:28 pmYou're shure?I worked with 39x39 step motors,can be done.if not in the back side,find a point in the front side shaft or on the mechanical moving part.I worked (in fact,manufactured) once laser reflexion detection sensors, expensive of course,the beam was 1-1.5mm diameter,if you got a laser point it om moving part and stick some reflexion aluminium for example,then detecting returning laser beam is piece of cake,I used modulated 10 KHz beam to avoid interference.You need 1 square mm free space on moving part to do it like this.for detecting laser returning beam I used light detector sensor with incorporated lens .worked from 2cm distance up to several metres with class 1 or 2red laser.But I'm sure you can do it with generic light reflexion sensor, i had experiences from for example textile industry,I had detection like this for fabric detection.and if detection was too strong (like light source for machine operator) I put some semitranslucide stuff between and get the sensor trigerring even with great light 20 W halogen present at less than 10 cm.Try,you can succeed with no more than a few euros from farnell if you "fabric" yourself the detector.and stick to infrared imho.Laser solution works great but cost is elevate.Regards,pierreEnvoyé de mon iPad en utilisant Tapatalk

author: Richard Crowley
author_rank: Super Contributor
timestamp: September 14, 2018, 04:37:52 pm
content: Quote from: legacy on September 14, 2018, 01:48:28 pmIt would be extraordinarily helpful if you could post photos of what you are dealing with.Else we are all just wasting our time shooting around here in complete darkness.

author: legacy
author_rank: Super Contributor
timestamp: September 14, 2018, 06:06:39 pm
content: optical flow sensor, 128x128bit, SPI outputdue to the frame of the 3d printer, there is absolutely no space on the back side and there is absolutely no space in the front side shaft. Can't be done with an optical sensor like an optical flow like the one in the pic, unless you are willing to use a fiberglass wire ... which is frankly crazy and costly.

author: legacy
author_rank: Super Contributor
timestamp: September 14, 2018, 06:10:12 pm
content: Quote from: Richard Crowley on September 14, 2018, 04:37:52 pmI have already solved the problem with a HAL sensor, attached to flat-cable. You can avoid wasting your precious time.

author: legacy
author_rank: Super Contributor
timestamp: September 14, 2018, 06:24:14 pm
content: oh, about that, the circuit I have made is able to detect the notch made by the motor of a quartz watch, it just needs to be the closest possible.

author: donotdespisethesnake
author_rank: Super Contributor
timestamp: September 16, 2018, 05:22:53 pm
content: Quote from: legacy on September 14, 2018, 06:10:12 pmCommon stepper drivers such as A4988 etc use a PWM output to the motor, I'm interested to see how the Hall sensor copes with that (I assume you mean Hall sensor).