Welcome to Our Community

Some features disabled for guests. Register Today.

NEMA 17 Toolhead -- how to control

Discussion in 'General Talk' started by LukePrints, Jan 18, 2020.

  1. LukePrints

    Builder

    Joined:
    Jan 18, 2020
    Messages:
    14
    Likes Received:
    1
    First time putting together a CNC machine, got all my parts from OpenBuilds and have a quick question, any advice or googling instructions appreciated!

    I'm trying to use a NEMA 17 as the Toolhead on my build. It powers a paste extruder I built.

    I'm using a BlackBox as my controller
    BlackBox Motion Control System

    However, the 10v that controls the toolhead isn't enough for the 24v of the NEMA motor. My understanding is I need some kind of motor controller that switches the motor on or off when it receives signal from the BlackBox.

    I'm not sure how to tell if the controllers I'm looking at will work. I'm using OpenBuildsCONTROL and liking it. I just want some motor controller that can interpret the toolhead signals from OpenBuildsCONTROL (eg. for a laser or router). Except I want it to power my NEMA 17 Stepper Motor.

    Am I on the right track? I haven't done this before.

    Would any of these fit my needs? Thanks for any and all help!
    https://www.amazon.com/SMAKN®-Router-Single-Stepper-Stepping/dp/B01G55LNPO/

    DQ542MA Stepper Motor Driver

    https://www.amazon.com/SainSmart-Router-Single-Stepper-Stepping/dp/B0093Y88SK/
     
  2. Gary Caruso

    Gary Caruso OpenBuilds Volunteer
    Staff Member Moderator Builder

    Joined:
    May 19, 2016
    Messages:
    1,193
    Likes Received:
    532
    Hi Luke, you would need to use something like this 0-10v to pulse converter connected up to the stepper drivers step input. Use the same 24v PSU for the driver power as the BlackBox.
    DQ542 is overkill for a nema17, the other two should work. The 0-10v output on the BB is not for driving anything it is just a control signal.

    Maybe there is a way to change the 5v pwm BB output signal for controlling step rate, but it would involve some editing, somebody else would have to help with this (Peter Van Der Walt).
    All stepper drivers use a step direction signal, this is held high (+5v) or low (ground) depending on what direction you want.
    Then the "speed" is the pulse rate or step signal, which this converter I linked to could provide.
    Cheers
    Gary
     
  3. LukePrints

    Builder

    Joined:
    Jan 18, 2020
    Messages:
    14
    Likes Received:
    1
    Thanks so much for getting back to me Gary!

    Yes, I'm planning on using the same PSU.

    So I'll pick up the pulse converter you linked and the stepper motor driver and try to get it working.
     
  4. Gary Caruso

    Gary Caruso OpenBuilds Volunteer
    Staff Member Moderator Builder

    Joined:
    May 19, 2016
    Messages:
    1,193
    Likes Received:
    532
    Be sure to follow the notes on the product page, regarding stepper driver use:)

    4.Note:

    1>.Input voltage, output frequency signal

    2>.Output signal fine tuning, users can adjust the potentiometer to calibrate the

    relationship between voltage and frequency

    3>.This module output can be used as pulse signal for drivers; when you use it with

    the driver, please choose common anode connection, relative connection wire is

    OC-OUT; connect driver PUL- or PUL 12-30V; connect driver PUL+ or COM +5V (if the

    power supply is 12V, please serial connect a 330 ohm resistor; when the power supply

    is 13-24V, please serial connect a 2.7K ohm resistor to limit the current)
     
  5. LukePrints

    Builder

    Joined:
    Jan 18, 2020
    Messages:
    14
    Likes Received:
    1
    Good to know! We really don't want to burn this thing up :(

    I see a lot of cheap resistors that max out at 1/4 watt, but if we're running 24v it seems like we could easily hit 10 watts or more when the stepper motor is being powered.

    Is this right? Do you know what kind of wattage we'll need on the resistor?

    I'm looking at these:

    1/4W resistors: https://www.amazon.com/Elegoo-Values-Resistor-Assortment-Compliant/dp/B072BL2VX1
    5W resistors: https://www.amazon.com/uxcell-Tolerance-Resistance-Electronic-Experiments/dp/B07RVD2RWZ
    10W resistors: https://www.amazon.com/NTE-Electronics-10W227-Tolerance-Resistance/dp/B007Z7PUJM
     
  6. LukePrints

    Builder

    Joined:
    Jan 18, 2020
    Messages:
    14
    Likes Received:
    1
    If we get the 10W or 5W resistors, do you think we should put a 10W/5W fuse in too?
     
  7. Gary Caruso

    Gary Caruso OpenBuilds Volunteer
    Staff Member Moderator Builder

    Joined:
    May 19, 2016
    Messages:
    1,193
    Likes Received:
    532
    The resistor is just for the signal from converter to motor driver nothing to do with motor power.
    The output of the device is 13-30vdc depending on whatever the psu you use is (in your case 24) and the signal input for your stepper driver is typically limited to 5v. 1/4watt is enough.
    Here is a clip from the dq542ma manual showing the same issue if using 12 or 24v input signal. The "R" would be 1kOhm for 12v or 2kOhm for 24v this is just for the step, direction, and enable signal. The motor power all comes straight from the motor driver, with 24v supply.
    Gary

    upload_2020-1-19_20-47-55.png
     
  8. LukePrints

    Builder

    Joined:
    Jan 18, 2020
    Messages:
    14
    Likes Received:
    1
    Makes sense! Thanks so much for getting back to us Gary!
     
  9. Peter Van Der Walt

    Peter Van Der Walt OpenBuilds Team
    Staff Member Moderator Builder Resident Builder

    Joined:
    Mar 1, 2017
    Messages:
    15,050
    Likes Received:
    4,313

    Its more a question of Why! :) use a 3D printing controller where the hardware and firmware already caters for the extruder.

    Grbl just isnt meant for this, so up ahead lies but workarounds, frustrations, and pain. Lol. Get the right tool for the job :)
     
    Deleted member 148176 likes this.
  10. LukePrints

    Builder

    Joined:
    Jan 18, 2020
    Messages:
    14
    Likes Received:
    1
    Hey Peter,

    Thanks for the wisdom! Wish I'd asked you guys a couple months ago :banghead:
    We're only running this on 2 axis, so I thought a CNC controller was actually what we wanted. Sounds like I was wrong :cry:

    Do you think I shouldn't move ahead with this workaround? The frequency converter + driver seems like an affordable way to go compared to purchasing a new controller. Am I missing something or are you just suggesting "buy the right tools" for next time?

    Thanks!
    Luke
     
  11. Peter Van Der Walt

    Peter Van Der Walt OpenBuilds Team
    Staff Member Moderator Builder Resident Builder

    Joined:
    Mar 1, 2017
    Messages:
    15,050
    Likes Received:
    4,313
    I personally don't
    It's just really going to be too much "hacking to make it work", frustrations, things not working and more money down the drain.

    The converter is useless anyway (takes 0-10v and turns it into PWM - we already have PWM on the Toolhead header )
    But you can't drive a stepper with PWM - you want to send it a certain number of pulses to move a certain amount of material. PWM is "pulses per second" with no real control over the parameters you want.
    Trust me, buy the right tools! Now :)

    Unless you have a couple years of development experience (in which case using the Z axis driver to drive the stepper instead is a very crazy and remote option, but you will need extensive software development ($200/hour kind of work) to write a post processor to convert your extrusion gcode to Z axis code, and also will have to modify Grbl to run Z as an unmetered axis. Development time is too expensive, get a 3D printer board it already does all that! - compare the cost of a board to a month of development and/or wiring hacks)
     
  12. LukePrints

    Builder

    Joined:
    Jan 18, 2020
    Messages:
    14
    Likes Received:
    1
    Good to know!

    I have a little over 5 years development experience, which is exactly why I'm worried about getting too far into the weeds here! I already built a little demo of the extruder using a z-axis post-processor, but it's going to be a pain to maintain or suss out bugs :nailbite:

    So you're saying there isn't a couple converters we can put in between the BlackBox Toolhead output and the stepper and make it run, correct? I thought the Stepper Motor driver I was looking at seemed promising, but obviously I'm new to this :confused:

    What kind of 3D printing controller would you recommend? I have a ACRO CNC setup from OpenBuilds and would be looking for something that would play nice with it.

    Thanks again for your help!
     
  13. Rob Taylor

    Rob Taylor Master
    Builder

    Joined:
    Dec 15, 2013
    Messages:
    1,470
    Likes Received:
    749
    So this is a 2D "printer"- I'm guessing, laying down ceramics or icing or something more useful than plastic in a single layer- and you just want to convert "laser power" to "extrusion rate". That seems... Extremely easy?

    There may be off-the-shelf PWM-frequency converters that allow you to set the min, max and resolution, but it's probably not a difficult electronics problem either.

    You could use a low pass filter to convert the PWM to a voltage, or a microcontroller board that allows PWM "analog" input and true analog voltage out. There are digital frequency generator ICs like the AD9833 that would allow you to use an A/D converter to tell it what frequency to output, or you could probably write a simple sketch that reads a PWM input and outputs it in an SPI/I2C serial output to such a chip.

    For really hacky and simple with on-hand parts, you could use a voltage-controlled device (ie. a BJT transistor) to control the current into the capacitor governing a 555 timer's frequency, with a schmitt trigger on the output to crisp up the waveform.

    There are probably any number of similar possibilities, and I'm sure many conversations out there on Google for PWM-frequency converter options. Totally doable! Probably a fun project too.
     
  14. LukePrints

    Builder

    Joined:
    Jan 18, 2020
    Messages:
    14
    Likes Received:
    1
    Yes, you're exactly right about our "printer" and I thought the conversion wouldn't be too complex either, but I'm a programmer and occasional electronics hacker, so am really feeling my lack of electronics background right now ;)

    I thought the frequency converter + stepper motor driver Gary was suggesting above would do exactly what you're talking about. If I can pick up the pieces for $20 I'm happy to if it'll save me time on acquiring, computing and troubleshooting my own breadboard setup.

    Driver: https://www.amazon.com/SMAKN®-Router-Single-Stepper-Stepping/dp/B01G55LNPO/
    Converter: https://www.amazon.com/SMAKN®-Router-Single-Stepper-Stepping/dp/B01G55LNPO/

    Do you think that could work? Worth picking them up and just trying?

    Thanks so much!
    Luke
     
  15. Rob Taylor

    Rob Taylor Master
    Builder

    Joined:
    Dec 15, 2013
    Messages:
    1,470
    Likes Received:
    749
    Driver should be ok, but hard to tell without a decent range of reviews. Usually there's a black-case one for about $13 with reliable-looking good reviews. Claims to be a TB6600, probably isn't, but works fine for NEMA 17s.

    Duplicate link though, what's the converter? I'll check it out.

    If you're accustomed to thinking in programming, I think there'd be a way of doing it all in a single sketch, from a simple RC low pass filter, on an Adafruit Cortex M4 board. They have analog in and frequency control over their PWM output, so you could program it in like, 30 minutes!
     
  16. LukePrints

    Builder

    Joined:
    Jan 18, 2020
    Messages:
    14
    Likes Received:
    1
    Whoops, sorry for the dupe link, meant to send you this: https://www.amazon.com/KNACRO-Frequency-voltage-converted-frequency/dp/B01HXS9SOA

    I'm happy to spend another few $ and get a more reliable chip.

    I'm very familiar with thinking in programming! I do it all day. That board looks interesting and I'm happy to learn new things :) However I don't want to make this more complex than it needs to be, I'm hoping not to introduce extra points of failure. If you think it'll be better or more reliable I'm sure I could figure it out. Any suggestions on a good tutorial? Maybe I'll get both and see if I can get them both working...
    Is one of these what you're talking about: Adafruit Feather M4 Express - Featuring ATSAMD51
     
  17. Rob Taylor

    Rob Taylor Master
    Builder

    Joined:
    Dec 15, 2013
    Messages:
    1,470
    Likes Received:
    749
    Oh, yeah, an LM331 breakout board is a solid option, as long as you can get the 0-10V VFD-type signal out of something. 10kHz, maxed out, at 200 steps/rev, would give 50 rpm. Depending on your extruder type/diameter, that could be useful, or possibly not, I don't know.

    A Metro M4 would give you a traditional Arduino Uno form factor, but you could get more reliable connections soldering to the Express. Up to you. I've used the M4 Express, it's nice. I don't know what it's frequency range is, though, and this doc page- PWMOut – Output a Pulse Width Modulated signal — Adafruit CircuitPython 0.0.0 documentation - isn't much help. With a 120MHz CPU, I'd be surprised if it were lower than 10kHz though, but with embedded type hardware, writing in lower-level C might be a better option.
     
  18. LukePrints

    Builder

    Joined:
    Jan 18, 2020
    Messages:
    14
    Likes Received:
    1
  19. LukePrints

    Builder

    Joined:
    Jan 18, 2020
    Messages:
    14
    Likes Received:
    1
    I think I found the black TB6600 you were talking about:
    https://www.amazon.com/MYSWEETY-TB6600-Stepper-Driver-Controller/dp/B01MYMK1G9

    I thought I could use the TB6600 to drive the motor and convert the PWM signal from the BlackBox Controller with that converter Gary Caruso recommended above:
    https://www.amazon.com/KNACRO-Frequency-voltage-converted-frequency/dp/B01HXS9SOA

    I'm looking at the BlackBox Controller instructions and it says it outputs PWM so the converter would convert the BlackBox PWM to something the TB6600 would interpret?
     
  20. Rob Taylor

    Rob Taylor Master
    Builder

    Joined:
    Dec 15, 2013
    Messages:
    1,470
    Likes Received:
    749
    Yeah, Mysweety is the one, couldn't remember the name. Used a couple of those.

    The voltage-frequency converter, the LM331 board, is good for the task, except you need at least a 20kHz output and you really need a 0-5V/TTL input. Might be worth looking at LM331 example circuits to see if you can DIY it, or just hack say one of the resistors on the board or something, to get you what you want.

    The actual chip will use 0-5V and go up to 100kHz, apparently: http://www.ti.com/document-viewer/LM331/datasheet

    If I thought the CAM/"slicing" on the 3D printer/Marlin board mentioned earlier was gonna be very workable, I'd probably just recommend that, but I think that'd turn into a nightmare on the software side, depending on how much variability you need on the extruder speed over a run. This is just a little bit of hardware tinkering and you're set.
     
  21. Rob Taylor

    Rob Taylor Master
    Builder

    Joined:
    Dec 15, 2013
    Messages:
    1,470
    Likes Received:
    749
    Scratch that: the chip does need 0-10V, will take up to 15V for power. That makes the project a little more complex using that IC. You need a fairly precise voltage doubler, which would be an LC+op-amp circuit, then the LM331 circuit, and then a frequency doubler, which I think is some kind of comparator/flip-flop circuit or something, IIRC.

    I can't see if it's possible to get higher stock frequency out of the ATSAMD51 driving the M4 boards either. It seems to be in the ~kHz range.

    Doesn't seem like one of those issues that should be super tricky, but perhaps not.

    Best solution I can see right now is either use Stepper library on Arduino at a high refresh rate (poll AnalogIn, set speed, fire a few steps, repeat), or find a 3rd party variable frequency generator library- there are a few, for different purposes- to add to your IDE and include that. Arduino seems to be more the way to go, though; 8/16MHz is plenty for this purpose. Plus side; off-brand Unos are $11 on Amazon.

    Edit because I can't leave well enough alone: Arduino is the way to go. This library: Google Code Archive - Long-term storage for Google Code Project Hosting. - is perfect for this application. Non-blocking, tens of kHz range.
     
    #21 Rob Taylor, Jan 20, 2020
    Last edited: Jan 20, 2020
  22. LukePrints

    Builder

    Joined:
    Jan 18, 2020
    Messages:
    14
    Likes Received:
    1
    Hey Rob, thanks so much for the help!

    I studied the LM331 circuit and I understand how to reproduce with my breadboard.

    I'm thinking I'll get an Arduino and the converter/driver setup and see if I can get either one to work.

    For your Arduino plan, any advice for getting up and running interpreting the TTL signal?

    Also, when you reference the 'voltage doubler' do you mean to double the signal coming out of the BlackBox from 0-5v to 0-10v?
     
  23. Rob Taylor

    Rob Taylor Master
    Builder

    Joined:
    Dec 15, 2013
    Messages:
    1,470
    Likes Received:
    749
    Yeah LM331 is an old school analog IC like the 555, should be easy to make work. The 8-pin DIP packages are $4 or so on Digikey if you want to try your own.

    AnalogRead(), with a two-stage RC low-pass filter to smooth the PWM. That Tone library page is well-written, looks super easy to implement. Then just have the thing whizzing around and around at maybe 1-5kHz (depending on how long it takes to set the Tone() pin) and you have a 256-stepped output of 0-65kHz (depending on how you parameterize it in code, of course, that's just the 16-bit int limitation). Long as you're not trying to accelerate the stepper faster than your reader sketch is cycling, should be good!

    Yeah, if you filter the PWM signal so it's just analog 0-5V, then double that fairly precisely with a 2x gain (or maybe more, 5-10X even, depending on how much the RC filter attenuates the signal) op-amp circuit (a cheap LM358 should be plenty good enough for that, I think, depending on the voltage you have available to drive the op-amp, it's not rail-to-rail), then you also get your 0-10V input. If you can modify the LM331 circuit to be able to adjust your max output frequency, then this is also a pretty easy analog-only option.

    In any case, the first order of business is to make a nice, reasonably accurate low-pass filter. This is discussed in a lot of places online, largely for the same reasons we are, though there's also a lot of talk in the DIY subwoofer crossover community that I've seen in the past. This'll all be on Google results in 6 months too! If you have access to an oscilloscope to see what it's doing, it'll be much easier, but I think enough people have talked about it elsewhere in enough detail that you can just plug a couple of resistors and capacitors into a breadboard and see what happens.
     
  24. LukePrints

    Builder

    Joined:
    Jan 18, 2020
    Messages:
    14
    Likes Received:
    1
    @Rob: Thanks for your help! I got the Arduino and demoed some simple signal interpretation and output with LEDs. I glazed over your statement that I'd need an OpAmp, and was only able to get 1v out of my Arduino which doesn't seem like enough to control the TB6600, so I'll get some LM358s this week and give it another go soon.

    @warren: Thanks for the input! I looked at the Nema 23s as well and wasn't sure if we'd need one or not. I am (kinda) building a 3D printer. It's powering an extruder, kinda like this: Large Volume Paste Extruder by AtomKemp. Peter's advice was to get the right controller, do you have any recommendations?

    Thanks again for all the help guys!
     
    Peter Van Der Walt likes this.
  25. Rob Taylor

    Rob Taylor Master
    Builder

    Joined:
    Dec 15, 2013
    Messages:
    1,470
    Likes Received:
    749
    Depending on the viscosity/texture and rate of deposition of what you're dispensing, I don't know that you'll need to go as far as a NEMA 23. NEMA 17s are pretty underrated as steppers go. But maybe, you'll find out soon enough, I guess!

    Another option on this type of project is a low ratio 12V gearmotor with a PID control loop and an H-bridge output. Essentially a servo spindle.

    The voltage on the Arduino output should be 5V (or 3.3V if it's a 3.3V board) though, shouldn't need an op-amp amplifying/buffering the output. Not sure what's going on there, unless you're just measuring with a multimeter, in which case some combination of the frequency and pulse width of the variable frequency output may be the culprit. An oscilloscope should show 5V peaks, in theory.

    The op-amp was to ensure full resolution on the input, but may not be strictly necessary, depending how critical the speed is. You can probably do in-software scaling in the meantime since the RC filter is likely attenuating the signal; you may only be getting somewhere in the region of 0-2V analog input or something. The Arduino, if you're scaling 0-5V to 0-20kHz output, is naturally going to limit its output frequency since you're not inputting that full scale. Setting your AnalogRead to 0-300 on the A/D converter (or whatever a multimeter suggests is appropriate) and scaling that to your full 0-20kHz would do the job, though at the cost of reduced resolution to make up for the limited input bandwidth.
     
  26. LukePrints

    Builder

    Joined:
    Jan 18, 2020
    Messages:
    14
    Likes Received:
    1
    Hey Warren, I do have an old cordless drill around with dead batteries. If I can't get this stepper driver strategy to work, I'll give it a go!
     

Share This Page

  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.
    Dismiss Notice