Shop OBEX P1 Docs P2 Docs Learn Events
CNC/3D Printer Motor Driver — Parallax Forums

CNC/3D Printer Motor Driver

plau45plau45 Posts: 109
edited 2015-03-31 14:30 in Propeller 1
I have been looking online for a microcontroller to use as a stepper motor driver for a cnc and 3d printer. I am designing and creating a cnc machine currently and I need to know if there is a microcontroller that parallax sells that could be used as a motor driver for such an application. Thanks

Comments

  • Bob Lawrence (VE1RLL)Bob Lawrence (VE1RLL) Posts: 1,720
    edited 2015-03-30 10:38
    Have a look at the Propeller Chip

    https://www.parallax.com/product/p8x32a-d40

    Here's an example of using it with a 3D printer:

    Lionhead 3D Printer and 3D Scanner with Li Modeling Software

    We wanted our circuit boards to be reliable and expandable while also providing the kind of processing power and autonomy that works best with our current and future plans. Because of this, we have been working with Parallax Semiconductor to design our boards and are using the Parallax Propeller as the brains of the Lionhead circuit board. The Propeller is an eight-core microcontroller and its parallel architecture is what’s enabling us to control so many motors, monitor temperatures and control heaters, watch calibration switch states, and talk to your computer at the same time.

    https://www.kickstarter.com/projects/radiantfabrication/lionhead-3d-printer-and-3d-scanner-with-li-modelin

    https://www.parallax.com/news/2013-09-18/radiant-fabrications-lionhead-3d-printer-and-3d-scanner
  • Bob Lawrence (VE1RLL)Bob Lawrence (VE1RLL) Posts: 1,720
    edited 2015-03-30 10:44
    Bruce is porting this software to Propeller Chip Spin(programming language)

    The Teacup Port - A Work In Progress - 3D Printer Firmware
    http://forums.parallax.com/showthread.php/159950-The-Teacup-Port-A-Work-In-Progress-3D-Printer-Firmware
  • DavidZemonDavidZemon Posts: 2,973
    edited 2015-03-30 10:50
    Minor correction: I think he's using C/C++, not Spin.
  • idbruceidbruce Posts: 6,197
    edited 2015-03-30 11:10
    Thanks for the plug Bob and Dave, I appreciate it.
    I have been looking online for a microcontroller to use as a stepper motor driver for a cnc and 3d printer. I am designing and creating a cnc machine currently and I need to know if there is a microcontroller that parallax sells that could be used as a motor driver for such an application. Thanks .

    @plau45

    The Propeller microcontroller is quite capable of running stepper motors quite well and you can definitely run some nice machinery from it as described in one of my earlier posts (pics available) http://forums.parallax.com/showthread.php/129612-My-Current-Prop-Based-CNC-Photos

    However in the thread that Bob linked to, I am currently having some memory problems and am now reevaluating my situation. As time passes, I am creating a new stategy to eliminate some of the current headaches that I am having and possibly make an even better machine.
  • Duane DegnDuane Degn Posts: 10,588
    edited 2015-03-30 11:24
    I haven't used other microcontrollers for stepper motor control so I can't offer a comparison but I have used the Propeller to control a stepper motor. I think my program will control multiple stepper motors but so far I've only used it with one.

    Here's a link to my Hackaday.io project.

    http://hackaday.io/project/4793-propeller-based-cnc-router-controller

    So far my program can only move two axes in a line (I haven't tested this yet but the numbers look right). I plan to add an algorithm to generate circular paths.

    I'm hoping my DIY CNC router controller will be able to cut basic shapes from what I'm calling G-code (though I'm not sure if my formatting of the data is correct).

    Here's an example of one of my faux G-code files.
    D08{EXTERNALLY_CREATED_D}
    D03, Test Triangle
    D02, 1.00
    D04, 1
    D05, March 25 2015
    D10, Duane Degn
    D11, Propeller Based CNC Controller
    G21
    G00, 200, 200
    G01, 150, 60
    G01, -200, 50
    G01, 50, -110
    M02
    

    I copied the "G" and "M" codes from the list I found on Wikipedia but I wanted to add some additional information to the file so I added a few "D" codes. I also added the ability to add comments between s-brackets.

    I've done a fair share a motor control software with DC motors and encoders but I was surprised how difficult writing the software to drive stepper motors has turned out to be.
  • Duane DegnDuane Degn Posts: 10,588
    edited 2015-03-30 11:28
    idbruce wrote: »
    I am currently having some memory problems and am now reevaluating my situation.

    Bruce, I also ran into memory issues. I've divided the program into several different parts and use the "bootPartition" method in Kye's SD driver to start the various parts of the program from the SD card.
  • Bob Lawrence (VE1RLL)Bob Lawrence (VE1RLL) Posts: 1,720
    edited 2015-03-30 11:29
    re:Minor correction: I think he's using C/C++, not Spin.

    Sorry, This line through me at a quick glance. "of the Teacup firmware, have been ported to SPIN, but I know the ported parts contain errors that need to be fixed and the code needs to be tied together." All I saw was ported to SPIN.

    Even I knew that Bruce has been working hard on the C version for a while . LOL
  • idbruceidbruce Posts: 6,197
    edited 2015-03-30 11:47
    Duane
    Bruce, I also ran into memory issues. I've divided the program into several different parts and use the "bootPartition" method in Kye's SD driver to start the various parts of the program from the SD card.

    I believe I will now be using two Prop chips, instead of one, one for processing the code and the other for executing it. And hopefully in the process , I can eliminate some of the problems that occur during locking.
  • plau45plau45 Posts: 109
    edited 2015-03-30 12:02
    Thanks this is a great help you guys and for your memory issues, do you mean your code is too large for the eeprom?
  • idbruceidbruce Posts: 6,197
    edited 2015-03-30 13:58
    plau45

    My CNC/3D printer controller is currently constructed from a Propeller Proto Board. The Proto Board has a 64KB EEPROM and I am sure someone will correct me if I am wrong, but the Propeller chip has 32KB of RAM and 32KB of ROM. It is the Propeller chip memory that I have run out of. more specifically the RAM. I have attached a pic of the controller. This will still be my main controller, but I will now be adding a second Protoboard as an assistant for processing the GCODE.
    603 x 474 - 58K
  • idbruceidbruce Posts: 6,197
    edited 2015-03-30 14:06
    Additionally, to add to the complexity of my current project, I will be attempting to use similar code (although in C this time), of Post #1 of this thread: http://forums.parallax.com/showthread.php/159926-Introducing-quot-SyncroStepper-quot-Syncronization-For-Multi-Axis-Machines. If I can accomplish that, then I really have something special.
  • plau45plau45 Posts: 109
    edited 2015-03-30 16:22
    Ok that makes since and could you just use an activity board for the whole thing along with the propeller chip that you guys said I should use?
  • Duane DegnDuane Degn Posts: 10,588
    edited 2015-03-30 16:28
    plau45 wrote: »
    Ok that makes since and could you just use an activity board for the whole thing along with the propeller chip that you guys said I should use?

    I think a Project Board would be a better starting point. The Activity Board has too many of its pins tied up to make a good CNC controller.
  • plau45plau45 Posts: 109
    edited 2015-03-30 17:06
    Ok I'll look into it. I thought it may be a problem too after looking at some of the board specs from bruce. Thanks
  • davidsaundersdavidsaunders Posts: 1,559
    edited 2015-03-30 18:47
    The project that brought me back to the Propeller is a home-made 3D Printer. I started off with a Raspberry Pi Model B as the controller, though that had its problems, so I moved to an AVR, that had a new set of troubles, now I am using a Propeller, and the Propeller is the perfect fit.

    I am not new to the propeller at all, I have been using them for about 7 years. Though as a result of going to the Raspberry Pi for my main computers before any Propeller programming software was available for ARM based systems I stepped away from the Propeller for a while.

    For a 3D printer application you need 12 pins for the 3 steppers (for a single extruder design), 1 pin for the continous rotation feed servo, 2 pins for communicating with the host computer (using serial, through the prop plug or similar FTDI), 2 pins for the EEPROM (can be recycled for something else after boot), 5 pins for sensors (2 for a delta sigma ADC on the thermistor, and 1 each for the zeroing micro switches), and one pin for PWM control of the heating element, and 4 cogs. Add two pins to comunicate with a secondary propeller and the expandability is endless.

    That is 24 pins, I use a few more for NTSC and SPI SRAM.

    For the Cog usage:
    0 = Stepper X, Y, Z control, and feed servo (continuous rotation servo).
    1 = Read Sensors and control tempurature.
    2 = Decode GCode and write simple commands to hub RAM for use by the other cogs.
    3 = Communicate with host computer.

    And additions in my design:
    4 = Read and Write SPI SRAM used for GCode buffer.
    5 = NTSC output (single cog).
    6 = Comunicate with other Propellers (for additions that may take more pins, or processing power).


    There are a few other IC's needed. The choice of what drivers to use is up to the board designer.
  • Duane DegnDuane Degn Posts: 10,588
    edited 2015-03-30 21:20
    Here are a couple of links to CNC controllers using other microcontrollers.

    Russell Cameron (aka OddBot) designs products for Dagu. He recently completed a CNC controller design using AVR chips.

    http://letsmakerobots.com/content/cnc-controller-mkiii

    Here's another AVR based CNC controller of sorts.

    http://letsmakerobots.com/node/38351

    Here's another one using a Teensy 3.1.

    http://letsmakerobots.com/robot/project/teensy-31-based-3d-printer-controller

    Back to the Propeller, here's a couple of links to other Propeller based CNC projects.

    Discussion of Don Starkey's CNC code.

    http://forums.parallax.com/showthread.php/145237-3-axis-CNC-control-packages-uploaded-to-the-OBEX-by-Don-Starkey

    Don's original thread:

    http://forums.parallax.com/showthread.php/138062-Who-is-interested-in-working-on-a-propeller-driven-CNC-control

    Mark_T's discussion about TI's DVR8711 chip:

    http://forums.parallax.com/showthread.php/160551-Gauging-interest-Prop-driver-for-DRV8711-stepper-drive-chip

    Another stepper control thread:

    http://forums.parallax.com/showthread.php/142705-Step-Dir-signal-generator-for-CNC

    Discussion why a parallel port is used for CNC control.

    http://forums.parallax.com/showthread.php/119683-Why-parallel-port-for-CNC-control

    In case it's not obvious, I'm very interested in this topic myself.
  • idbruceidbruce Posts: 6,197
    edited 2015-03-30 21:48
    Duane
    In case it's not obvious, I'm very interested in this topic myself.

    :) The question now becomes, will it be a Propeller? :)
  • plau45plau45 Posts: 109
    edited 2015-03-31 12:54
    So one last question. Could you use a quick start board because it says you have access to all pins. You would just have to attach it to another solderable or bread board.
  • Duane DegnDuane Degn Posts: 10,588
    edited 2015-03-31 13:06
    plau45 wrote: »
    So one last question. Could you use a quick start board because it says you have access to all pins. You would just have to attach it to another solderable or bread board.

    Absolutely. I'm using a QuickStart to test my code. I really like how the QS allows access to all the Prop's I/O pins.
  • Duane DegnDuane Degn Posts: 10,588
    edited 2015-03-31 13:13
    idbruce wrote: »
    :) The question now becomes, will it be a Propeller? :)

    This is certainly my intention.

    I'll likely use two Propellers. One will be used to control the video display and read the keypad inputs. The other Prop will read files from a SD card send appropriate pulses to the motor controllers.

    I have a couple DVR7811 boards I plan to use with this project.
  • idbruceidbruce Posts: 6,197
    edited 2015-03-31 13:43
    Are you shooting for SPIN or C?
  • plau45plau45 Posts: 109
    edited 2015-03-31 13:58
    Ok sweet. Thanks for the help.
  • JasonDorieJasonDorie Posts: 1,930
    edited 2015-03-31 14:00
    The Propeller is more than capable of controller stepper drivers. I wrote the code to move this arm in Spin, then ported it to C to make it a little faster. It's running 3 motors simultaneously, and computing acceleration / deceleration profiles on the fly.
  • plau45plau45 Posts: 109
    edited 2015-03-31 14:28
    And I will want to try C if possible Bruce but I can do SPIN if need be. It would be even better if there is already some code out there that someone would be willing to share. If you were asking me.
  • Duane DegnDuane Degn Posts: 10,588
    edited 2015-03-31 14:30
    idbruce wrote: »
    Are you shooting for SPIN or C?

    Right now I have Spin generate a table for delay times based on a set acceleration value. Then a PASM cog is launched to read the table and move the stepper.

    I've only tested my code on a single stepper so far but that test went well. Of course getting steppers to move in a coordinated fashion is a lot more work but I think I'm making progress towards my goal.

    Edit: I'm not comfortable sharing my code at this point. I generally don't wait for code to be polished before sharing but I want any code I share to be reasonably tested. I'm not at all sure my approach is a good one. Once I'm satisfied my method of driving multiple steppers will work, I'll probably move the code to my GitHub account.
Sign In or Register to comment.