CNC/3D Printer Motor Driver
plau45
Posts: 109
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
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 whats 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
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
@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.
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.
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.
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.
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
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.
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.
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.
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.
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.
The question now becomes, will it be a Propeller?
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.
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.
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.