Jump to content

Monitoring current from extruder motor for feedback?


Recommended Posts

Posted · Monitoring current from extruder motor for feedback?

I had a couple of questions about the hardware on the UM2 board.

It took a little searching but I think the stepper controller chips are A4983 controller chips. I was reading the datasheet for it because I was curious as to how the current for the extruder stepper could be controlled by the firmware and/or Gcode, but is not being fed back into the computer code.

It looks like current is controlled as a function of the VREF pin 17, and the two Rsense resistors placed inline on pins 27 and 23 of the A4983 chip. I can't quite seem to figure out the values of these resistors, I think they are 0.05 ohm precision resistors, but there is only the letter E after the 0.05 value, so I can't figure out the tolerance. The VREF signal looks like it is coming from pin 38 of the ATMEGA2560 chip. So this explains why the amount of current cannot be fed back into the computer code, the current control is a one way street with the A4983 chip doing the real current monitoring.

My questions are these:

1. If we know the value of the resistors emanating form sense 1 (pin 23) and sense 2 (pin 27) would it be possible to feed the voltage drop across those resistors back into the main computer so it knew that it was skipping steps and moving backwards? Calculations indicate an estimated voltage drop across those sense resistors of around 62.5 mV when 1.25 amps are flowing through the motor (assuming 2 ohms of motor winding resistance), so any deviation from this could indicate that the stepper is missing steps or grinding filament.

2. Has anyone tried this already?

3. Has it already been established that monitoring what the extruder motor does is irrelevant? I hope this is not the case, I think it would be a real benefit.

4. Are there simply not enough extra pins on the main Atmega chip? From the PDF of the schematics it looks like there would be ample room.

5. Am I completely off base and just jabbering about nothing?

 

  • Link to post
    Share on other sites

    Posted · Monitoring current from extruder motor for feedback?

    I heard second hand a month or so ago that Erik (a UM founder) is looking into a device that would measure the actual movement of the filament and feed that information back to the Arduino.

    I don't know how active this experiment is.

    There are really a bunch of things going on with UM engineering.

     

    5. Am I completely off base and just jabbering about nothing?

     

    Definitely! :) You need to get your damn UM2 so you can start playing with it and not spend all your time on these forums! :)

     

  • Link to post
    Share on other sites

    Posted · Monitoring current from extruder motor for feedback?

    Unfortunately it doesn't look like it's as easy as looking just at the current. This should be helpful:

    http://www.edn.com/design/analog/4368829/Back-EMF-method-detects-stepper-motor-stall

     

    Thanks for the link IRobertI, it cleared a lot up for me. Yeah it definitely looks like the current output at that spot wouldn't work, and that additional components need to be incorporated at different locations on the board to get anything useful out of it. Well there you go :-P I definitely learned about how the board circuitry works though.

     

    Definitely! :) You need to get your damn UM2 so you can start playing with it and not spend all your time on these forums! :)

     

    Well, it looks like the UM2s are still taking forever to ship, so until then I'll be on the forums in full force asking questions and such....who said I wasn't going to spend all my time on the forums when I do get my UM2 :mrgreen: I expect a lot of down time between prints.

    Also, thanks for answering at least one of the questions I had in this thread :blink:

     

  • Link to post
    Share on other sites

    Posted · Monitoring current from extruder motor for feedback?

    I don't think think there is a trivial way to do this.

    In a normal brushed motor the impedance goes low during a stall, as the inductors forming the electromagnet aren't being switched. This is easy to detect.

    There just isn't a simple fail state like that when dealing with stepper motors.

    I believe the most strait forward method of detection might be to make a pair of encoder wheels read by a pair of photo gates. One encoder wheel would be attached to the drive sprocket, the other would be turned by the idler bearing. If the first wheel did not advance, it would indicate a stall. If the second wheel did not advance, it would indicate grinding. Obviously, this would require a substantial redesign of the UM2 drive unit.

    A better solution might be to measure force exerted on the filament. This is discussed at some length in another recent thread. From some experimentation, you could determine acceptable operational parameters. A parameter for maximum acceptable force could be established to avoid stalling and grinding in the first place.

     

  • Link to post
    Share on other sites

    Posted · Monitoring current from extruder motor for feedback?

    I don't think think there is a trivial way to do this.

     

    Yeah, it's starting to look like this is the case. I was just hoping there was an easier way then adding an encoder to the filament stepper motor. I think being able to detect stalling of the motor would really help the extruder system and make the UM2 more like a commercial "use out of the box" style type printer. With the feedback stalling information there seems like a lot automatic adjustments the machine could make.

     

  • Link to post
    Share on other sites

    Posted · Monitoring current from extruder motor for feedback?

    The filament movement monitoring work that I think George is referring to is being done by Erik vd Zalm, the Marlin lead, not Erik from UM - the former posted about his experiments on my blog. Which is not to say that UM isn't also doing something; but I know that another Erik is working on it and has talked about it a bit lately.

     

  • Link to post
    Share on other sites

    Posted · Monitoring current from extruder motor for feedback?

    The other challenge with this is that measuring the position of the motor isn't necessarily all that helpful - particularly with regard to the extruder. It's certainly possible for the motor to turn happily without advancing the filament fully - that's how the UM1 extruder behaves all the time, and even on the UM2 it can happen if the filament is slipping back slightly, or stripping. It's actually more useful I think to directly measure the final target - the movement of filament - than to worry too much about the motor itself.

     

  • Link to post
    Share on other sites

    Posted · Monitoring current from extruder motor for feedback?

    The other challenge with this is that measuring the position of the motor isn't necessarily all that helpful - particularly with regard to the extruder. It's certainly possible for the motor to turn happily without advancing the filament fully - that's how the UM1 extruder behaves all the time, and even on the UM2 it can happen if the filament is slipping back slightly, or stripping. It's actually more useful I think to directly measure the final target - the movement of filament - than to worry too much about the motor itself.

     

    That is why I was thinking that driving an encoder wheel from the idler bearing might be a good idea. It should only turn if the filament is moving.

     

  • Link to post
    Share on other sites

    Posted · Monitoring current from extruder motor for feedback?

    Look at the TMC260 ;-)

     

  • Link to post
    Share on other sites

    Posted · Monitoring current from extruder motor for feedback?

    Thanks for the tip Daid! Are these the chips currently on the UM2 board? I would check mine, but I don't have my UM2 yet :-P.

    The stallGuard2 feature of the chip is really interesting, I haven't finished the whole datasheet so I'm not sure about it's applicability, admittedly I skipped to the main stallGuard description so I haven't gotten a feel for the chip yet, but this phrase got me wondering:

    "stallGuard2 does not operate reliably at extreme motor velocities: Very low motor velocities (for many motors, less than one revolution per second) generate a low back EMF and make the measurement unstable and dependent on environment conditions (temperature, etc.). Other conditions will also lead to extreme settings of SGT and poor response of the measurement value SG to the motor load.

    Very high motor velocities, in which the full sinusoidal current is not driven into the motor coils also lead to poor response. These velocities are typically characterized by the motor back EMF reaching the supply voltage."

     

  • Link to post
    Share on other sites

    Posted · Monitoring current from extruder motor for feedback?

    That is why I was thinking that driving an encoder wheel from the idler bearing might be a good idea. It should only turn if the filament is moving.

     

    I've been thinking about this, in some of the stepper motor extruder videos showing the motor skipping steps it looks like the filament actually pushes the opposite way through the extruder a short distance so an encoder may not accurately reflect the sum of the material that has passed through the extruder. Although, perhaps reading the encoder backwards and forwards could yield a very close approximation?

     

  • Link to post
    Share on other sites

    Posted · Monitoring current from extruder motor for feedback?

    I've been thinking about this, in some of the stepper motor extruder videos showing the motor skipping steps it looks like the filament actually pushes the opposite way through the extruder a short distance...

     

    I agree with you Aaron, some conclusion here...

     

  • Link to post
    Share on other sites

    Posted · Monitoring current from extruder motor for feedback?

    Encoders are very good at telling backwards from forwards. Don't ask me how that works.

    Once you start to go all encoder, and you have powerful computer (ARM computer) you should be able to throw away all those steppers and use ordinary motors with more torque and less weight. And less wasted energy when nothing is moving.

     

  • Link to post
    Share on other sites

    Posted · Monitoring current from extruder motor for feedback?

    To tell backwards from forwards you have multiple photo gates and multiple circles of slots. The easiest to implement is having 2 photogates and 2 over lapping circles of slots. They would overlap something like this...

     


    aa aa aa aa
    bb bb bb bb

    So, going to the right starting from "a" the encoder reads

    a, ab, b, -, a, ab, b...

    and going to the left from "a" the encoder reads

    a, -, b, ab, a, -, b, ab...

    (where "-" means that both gates are closed)

    Using a setup like this, every step made by the encoder is unique. Does that make sense?

     

  • Link to post
    Share on other sites

    Posted · Monitoring current from extruder motor for feedback?

    Quickly thinking about it again, you don't actually even need two rows of slots. Just putting one photo gate slightly in front of the other (maybe 1/4 the slot width) can achieve the same effect.

     

  • Link to post
    Share on other sites

    Posted · Monitoring current from extruder motor for feedback?

    May I make two replies - one on measuring stepper motor current and the other on a feed sensor that I have been pondering.

    Stepper Motor:

    Most stepper motor ICs have an internal clock (usually around 10khz) that determines when coil current is applied to the stepper motor. They have a sense resistor in each coil path to ground to measure coil current. Internally they have an amplifer and comparator that will trip when a specific voltage appears across the sense resistor thereby turning coil current off. This mythology allows the board designer to set max coil current and coil current only flows from the point it is initiated until the comparator is tripped.

    To measure that current you would need some access to the internal clock, which usually does not exist, so that you could trigger an ADC measurement. Just measuring voltage via a ADC with no synchronization to when the actual current is flowing will produce unstable and unreliable measurements.

    Material Feed Sensor:

    I have been pondering on a method to sense actual material being fed into the printhead. One of my design criteria is that the sensing mechanism imparts little to no additional forces/pressure onto the moving material.

    I have a design that uses a free-spinning bearing with rubber wheel. The material passes over and contacts the rubber wheel --- this could be before of after the extruder pinch/drive mechanism. The key is to impart as little friction onto the material but still have it freely turn the bearing/wheel assembly.

    Attached to the shaft of the bearing is a rare-earth magnet that will turn as the bearing turns.

    Place a magnetometer, like a LSM303 in close proximity to the rare-earth magnet--- no contact needed. The magnetometer is connected to the cpu using SPI or IIC.

    As the magnet rotates, the magnetometer will detect and report changes - hence material movement.

    What I have been pondering is a way of mechanically amplifying the amount of rotation imparted onto the magnet since the actual linear movement of material is very small per gcode segment.

    Measuring precision of flux changes in a rotating magnet is much higher than those obtained by using mechanical or chopper type sensors.

    Just my thoughts and 2 cents.

    Joe

     

  • Link to post
    Share on other sites

    Posted · Monitoring current from extruder motor for feedback?

    Just measuring voltage via a ADC with no synchronization to when the actual current is flowing will produce unstable and unreliable measurements.

     

    It's worse than this - there are 2 coils and the max current varies depending on how far you are through a step in a sine wave/cosine wave pattern.

     

  • Link to post
    Share on other sites

    Posted · Monitoring current from extruder motor for feedback?

    The actual voltage that appears at the sense coil will be the voltage on the "Part" of the sin wave that is associate with the associated microstep.

    Peak voltage will only appear at FULL step positions --- any microstep location will be less -- depending on where you are on the sine wave.

    Internally, the IC uses a lookup table as it steps through the microsteps. It measures the voltage across the sense resistors, amplifies them and then does an analog compare. When the voltage across the sense resistors reaches the internal values associated with the associated micrstep, the current thru the coil is turned off. That is how you get a sinusoidal current applied to the two coils of the stepper.

     

  • Link to post
    Share on other sites

    Create an account or sign in to comment

    You need to be a member in order to leave a comment

    Create an account

    Sign up for a new account in our community. It's easy!

    Register a new account

    Sign in

    Already have an account? Sign in here.

    Sign In Now
    • Our picks

      • UltiMaker Cura 5.7 stable released
        Cura 5.7 is here and it brings a handy new workflow improvement when using Thingiverse and Cura together, as well as additional capabilities for Method series printers, and a powerful way of sharing print settings using new printer-agnostic project files! Read on to find out about all of these improvements and more. 
         
          • Like
        • 18 replies
      • S-Line Firmware 8.3.0 was released Nov. 20th on the "Latest" firmware branch.
        (Sorry, was out of office when this released)

        This update is for...
        All UltiMaker S series  
        New features
         
        Temperature status. During print preparation, the temperatures of the print cores and build plate will be shown on the display. This gives a better indication of the progress and remaining wait time. Save log files in paused state. It is now possible to save the printer's log files to USB if the currently active print job is paused. Previously, the Dump logs to USB option was only enabled if the printer was in idle state. Confirm print removal via Digital Factory. If the printer is connected to the Digital Factory, it is now possible to confirm the removal of a previous print job via the Digital Factory interface. This is useful in situations where the build plate is clear, but the operator forgot to select Confirm removal on the printer’s display. Visit this page for more information about this feature.
          • Like
        • 0 replies
    ×
    ×
    • Create New...