Re: RepRap using DC Motors! June 11, 2014 10:35PM |
Registered: 10 years ago Posts: 24 |
Quote
MrDoctorDIV
Except that this post isn't about buying a printer at the same price point and choosing DC motors. It's about using what he has for free and building a repstrap.
Pretty sure he didn't make his concern competing with price point or even function of accuracy and speed, as I read it he made it very clear his intention was to make a printer with what he got, namely DC motors.
Re: RepRap using DC Motors! June 12, 2014 04:29AM |
Registered: 14 years ago Posts: 7,616 |
Generation 7 Electronics | Teacup Firmware | RepRap DIY |
Re: RepRap using DC Motors! June 12, 2014 06:08AM |
Registered: 10 years ago Posts: 24 |
Quote
Traumflug
Undoubtly the first goal would be to get these encoders working. Once it's possible to follow current position with them, the remaining parts aren't trivial, but straightforward. One of the measures for success will be how fast an Arduino can follow the incoming signal.
Re: RepRap using DC Motors! June 13, 2014 11:41PM |
Registered: 10 years ago Posts: 48 |
Re: RepRap using DC Motors! June 14, 2014 12:54PM |
Registered: 10 years ago Posts: 814 |
Re: RepRap using DC Motors! June 15, 2014 03:11AM |
Registered: 11 years ago Posts: 87 |
Re: RepRap using DC Motors! June 15, 2014 04:03AM |
Registered: 10 years ago Posts: 210 |
Re: RepRap using DC Motors! June 15, 2014 05:24AM |
Registered: 11 years ago Posts: 87 |
It's the name I give for a dc motor with his encoder, and his regulator, that will respond well to a command as an angle, just like rc-servo does. but faster. After you have that working, you can put this "block" in a 3d printer .Quote
Dejay
What is an autonomous block?
Re: RepRap using DC Motors! June 15, 2014 01:22PM |
Admin Registered: 17 years ago Posts: 13,986 |
Quote
victorjung
So the only case it would be worth to use dc motors, would be when you can found them for free with the encoders. The other thing that dampen me, is tha it won't be compatible with actual electronics and firmware...
Re: RepRap using DC Motors! June 15, 2014 10:26PM |
Registered: 10 years ago Posts: 24 |
Quote
ShaneH
Not raining on your parade or anything, I've thought about using DC motors as well...but
You could use DC motors with linear encoder strips or radial encoder disks on something fairly slow moving, and where you could implement a PID control so you don't overshoot the target point, and also not slamming the motor too hard on a stop (at the expense of decreased print speed). The Arduino motor control can be programmed to apply 'HIGH' (or 255 if using PWM) values to both DC motor wires, effectively making it brake. However, the torque reaction of suddenly stopping (more technically speaking..the inertia of the motor stator) then suddenly heading off in the opposite direction in a very short period of time can be pretty violent. When I was testing my geared motors for my self balancing robot, they would throw themselves all over the workbench when simulating falling and fast direction changes. There is also the sudden electrical load when rapidly changing DC motor direction. I've heard that DC motors can spike draw up to 2 or even 3 x their rated current when suddenly thrown in the opposite direction.
Now..go and check out 3D printer videos where the job is in-filling between 2 walls that are close together. I have a Mendel90 (sturdy) and some of the prints I have done cause enough vibration through the base and onto the desk to make things fall off it...and it's not a el-cheapo desk and reasonably solid.
To overcome this, you would have to print at a VERY slow rate...and that's assuming you could get the coding right. As per noheads reply...it's like herding cats to get the print head to a point in 3D space, all at the same time, extruding the right amount of filament on the way. So..now you've got this thing printing, but can only manage CNC machine speeds (cutting speed), you will increase the printing time by several factors..I calculated approx 4 times longer.
As I said, not intending to rain on your parade, but as already mentioned in previous replies, there are some things cannot be skimped on if you want to maintain quality and/or speed. I tried with my A3 printer to CNC machine conversion project and using kitchen drawer slides for the X and Z axis rails. Fail army on that count!..was fine for basic engraving, but cutting was an absolute rubbish disaster. So..knock yerself out, and you my just surprise us all with some radical new concept, and good on ya for attempting it. This is just my 2 cents worth.
Re: RepRap using DC Motors! June 15, 2014 10:28PM |
Registered: 10 years ago Posts: 24 |
Quote
madmike8
I'd think I would start with making a small single axis pen plotter first with a simple linear rail design so you focus on getting precise movements from your motors. Then add axis till you have a working printer. Even if you don't succeed, you will definitely gain a lot of knowledge. Good luck, and keep us posted.
Re: RepRap using DC Motors! June 15, 2014 10:30PM |
Registered: 10 years ago Posts: 24 |
Quote
victorjung
that something I was thinking about a while ago... But I finally change my mind cause you can have 5 steppers for around 60 usd shipped, and it's hard to find 5 geared dc motors and 5 encoders for the same price...
So the only case it would be worth to use dc motors, would be when you can found them for free with the encoders. The other thing that dampen me, is tha it won't be compatible with actual electronics and firmware...
But now I am in the mood for thinking about that again... I think the best way to start is to buil an autonomous block, capable of controlling a shaft at the desired angle, using PID regulation with the encoder.
When this will be done, it will be worth to design new electronic for driving 5 or more of those blocks!
Re: RepRap using DC Motors! June 15, 2014 10:51PM |
Registered: 10 years ago Posts: 24 |
Re: RepRap using DC Motors! June 16, 2014 03:05AM |
Registered: 11 years ago Posts: 87 |
Re: RepRap using DC Motors! June 16, 2014 06:19AM |
Registered: 14 years ago Posts: 7,616 |
Quote
lucasmun09
Also guys, just wondering, what is the most efficient way to control the motors?
Generation 7 Electronics | Teacup Firmware | RepRap DIY |
Re: RepRap using DC Motors! June 16, 2014 02:42PM |
Registered: 10 years ago Posts: 24 |
Quote
Traumflug
Quote
lucasmun09
Also guys, just wondering, what is the most efficient way to control the motors?
Once you've anything running you can likely answer this much better. Doing a PWM driver is quite simple, see e.g. SevenSwitch. To do such a design, you have to know what you need, though.
Re: RepRap using DC Motors! June 16, 2014 02:44PM |
Registered: 10 years ago Posts: 24 |
Quote
victorjung
you can't drive dc motor directly with the arduino, you need an hbridge for that. You can also drive 2 dc motor CW and CCW with 1 stepper driver such as l298.
You will also need 2x2 input for the 2 ir quadratur encoders that comes with the 2 dc motors.
I don't think you need a ramps. you better wire everything on the arduino.
Re: RepRap using DC Motors! June 16, 2014 03:55PM |
Registered: 14 years ago Posts: 7,616 |
Quote
lucasmun09
I am not going to drive the motors on PWM
Generation 7 Electronics | Teacup Firmware | RepRap DIY |
Re: RepRap using DC Motors! June 16, 2014 06:20PM |
Registered: 10 years ago Posts: 24 |
Quote
Traumflug
Quote
lucasmun09
I am not going to drive the motors on PWM
I'm pretty sure you have to. How else would you manage to run motors with less than top speed?
Please don't answer "I want to run as fast as possible" Moving in directions other than 90° and 45° requires less than top speed for at least one of the motors.
Re: RepRap using DC Motors! June 17, 2014 02:34AM |
Registered: 10 years ago Posts: 210 |
Quote
lucasmun09
Ok, to clarify what I mean as "I am not going to drive the motors on PWM" was that I am not going to rely it's positioning and it's travel based on the PWM and the timing... First of all, it was an idea i just threw out on how I will change the speed. It seems the most ideal solution here but do you really need to reduce the speed of the motors when you can get very accurate positioning with linear encoders? Also the link I have posted to the h bridge motor shield. Will it be suitable for what I will be doing? Do motor shields also support PWM? Many thanks for reply and feed back!
Re: RepRap using DC Motors! June 17, 2014 02:48AM |
Admin Registered: 17 years ago Posts: 13,986 |
Re: RepRap using DC Motors! June 17, 2014 04:12AM |
Admin Registered: 17 years ago Posts: 7,881 |
Re: RepRap using DC Motors! June 17, 2014 04:29AM |
Admin Registered: 17 years ago Posts: 13,986 |
Re: RepRap using DC Motors! June 17, 2014 12:20PM |
Registered: 11 years ago Posts: 7 |
Re: RepRap using DC Motors! June 17, 2014 12:37PM |
Admin Registered: 17 years ago Posts: 13,986 |
Re: RepRap using DC Motors! June 19, 2014 04:53PM |
Registered: 10 years ago Posts: 24 |
/*************************************************************************************** * Lin_Enc_02.ino 05-12-2014 unix_guru at hotmail.com @unix_guru on twitter * [arduino-pi.blogspot.com] * * This sketch allows you to run two salvaged printer carriages for X/Y axis using their * linear encoder strips for tracking. * This example uses the Arduino PID Library found at: * [github.com] * * Hardware Interrupt 0 on Digital pin2 is used to determine X-Axis position * Hardware Interrupt 1 on Digital pin3 is used to determine Y-Axis position * PinchangeInterrupt is used to identify the Zero Endstop for X and Y axis *****************************************************************************************/ #include #include #include "utility/Adafruit_PWMServoDriver.h" #include #include #define frontstop = 100 // Right most encoder boundary #define backstop = 3600 // Left most encoder boundary // Create the motor shield object with the default I2C address Adafruit_MotorShield AFMS = Adafruit_MotorShield(); // Select which 'port' M1, M2, M3 or M4. In this case, M1 Adafruit_DCMotor *XaxisMotor = AFMS.getMotor(1); Adafruit_DCMotor *YaxisMotor = AFMS.getMotor(2); const int XaxisENCPinA = 2; // X-AXIS encoder 1 on pins 2 and 4 const int XaxisENCPinB = 4; const int XaxisENDSTOP = 10; // Endstop photointerrupter for X-Axis volatile double XaxisENCPos = 0; const int YaxisENCPinA = 3; // Y-AXIS encoder 2 on pins 3 and 5 const int YaxisENCPinB = 5; const int YaxisENDSTOP = 11; // Endstop photointerrupter for Y-Axis volatile double YaxisENCPos = 0; double XaxisSpd, YaxisSpd; // Carriage speed from 0-255 double XaxisPos, YaxisPos; // Current Carriage position /*working variables for PID routines*/ // Tuning parameters float KpX=0, KpY=0; //Initial Proportional Gain float KiX=10, KiY=10; //Initial Integral Gain float KdX=0, KdY=0; //Initial Differential Gain double XaxisSetpoint, YaxisSetpoint; // Taget position for carriage // Instantiate X and Y axis PID controls PID XaxisPID(&XaxisPos, &XaxisSpd, &XaxisSetpoint, KpX, KiX, KdX, DIRECT); PID YaxisPID(&YaxisPos, &YaxisSpd, &YaxisSetpoint, KpY, KiY, KdY, DIRECT); const int sampleRate = 1; long int reportTime; void setup() { Serial.begin(115200); Serial.println("Linear Encoder Test 05-12-2014"); AFMS.begin(); // Set up Motors XaxisMotor->run(BACKWARD); // Bring carriage to home position. XaxisMotor->setSpeed(70); delay(100); // Get endstop limiter working here XaxisMotor->run(FORWARD); // Bring carriage to home position. XaxisMotor->setSpeed(0); YaxisMotor->run(BACKWARD); // Bring carriage to home position. YaxisMotor->setSpeed(70); delay(100); // Get endstop limiter working here YaxisMotor->run(FORWARD); // Bring carriage to home position. YaxisMotor->setSpeed(0); attachInterrupt(0, doXaxisENC, CHANGE); // encoder pin on interrupt 0 (pin 2) attachInterrupt(1, doYaxisENC, CHANGE); // encoder pin on interrupt 1 (pin 3) PCintPort::attachInterrupt(XaxisENDSTOP,doXaxisEndstop,FALLING); //X-axis Endstop ISR PCintPort::attachInterrupt(YaxisENDSTOP,doYaxisEndstop,FALLING); //Y-axis Endstop ISR randomSeed(analogRead(0)); // Used to select random setpoints for testing XaxisPID.SetMode(AUTOMATIC); //Turn on the PID loop XaxisPID.SetSampleTime(sampleRate); //Sets the sample rate YaxisPID.SetMode(AUTOMATIC); //Turn on the PID loop YaxisPID.SetSampleTime(sampleRate); //Sets the sample rate reportTime = millis()+2000; } void loop() { uint8_t oldSREG = SREG; // Store interrupt status register cli(); XaxisPos = XaxisENCPos; YaxisPos = YaxisENCPos; SREG = oldSREG; // Restore interrupt status register // Temporary to create random X and Y axis setpoints for testing if(millis() > reportTime) { // Only validate this every 2 seconds if(XaxisPos == XaxisSetpoint && YaxisPos == YaxisSetpoint) { // If both X-axis and Y-axis have reached their target - get new targets XaxisSetpoint = random(200,3500); // Keep target within bounds of Endpoints YaxisSetpoint = random(200,3500); // Keep target within bounds of Endpoints } reportTime = millis()+2000; } // Manage X-axis positioning XaxisPID.Compute(); //Run the PID loop if(XaxisSetpoint < XaxisPos) XaxisMotor->run(BACKWARD); // Determine direction of travel else XaxisMotor->run(FORWARD); XaxisMotor->setSpeed(XaxisSpd); // Apply PID speed to motor // Manage Y-axis positioning YaxisPID.Compute(); //Run the PID loop if(YaxisSetpoint < YaxisPos) YaxisMotor->run(BACKWARD); // Determine direction of travel else YaxisMotor->run(FORWARD); YaxisMotor->setSpeed(YaxisSpd); // Apply PID speed to motor } /*************************************************************************************** The following code was taken from [forum.arduino.cc] to utilize the fast port based encoder logic. Thank you Lefty! please go there for a full explanation of how this works. I have truncated the comments here for brevity. ***************************************************************************************/ void doXaxisENC() { // ************** X- AXIS **************** if (PIND & 0x04) { // test for a low-to-high interrupt on channel A, if ( !(PIND & 0x10)) { // check channel B for which way encoder turned, XaxisENCPos = ++XaxisENCPos; // CW rotation } else { XaxisENCPos = --XaxisENCPos; // CCW rotation } } else { // it was a high-to-low interrupt on channel A if (PIND & 0x10) { // check channel B for which way encoder turned, XaxisENCPos = ++XaxisENCPos; // CW rotation } else { XaxisENCPos = --XaxisENCPos; // CCW rotation } } } // End of interrupt code for encoder #1 void doYaxisENC(){ // ************** X- AXIS **************** if (PIND & 0x08) { // test for a low-to-high interrupt on channel A, if (!(PIND & 0x20)) { // check channel B for which way encoder turned, YaxisENCPos = ++YaxisENCPos; // CW rotation } else { YaxisENCPos = --YaxisENCPos; // CCW rotation } } else { // it was a high-to-low interrupt on channel A if (PIND & 0x20) { // check channel B for which way encoder turned, YaxisENCPos = ++YaxisENCPos; // CW rotation } else { YaxisENCPos = --YaxisENCPos; // CCW rotation } } } // End of interrupt code for encoder #2 void doXaxisEndstop() { XaxisENCPos=0; // X-Axis Endstop indicates ZERO position } void doYaxisEndstop() { YaxisENCPos=0; // Y-Axis Endstop indicates ZERO position }
Re: RepRap using DC Motors! June 20, 2014 11:36AM |
Registered: 10 years ago Posts: 5 |
Re: RepRap using DC Motors! June 20, 2014 02:29PM |
Registered: 11 years ago Posts: 7 |
Re: RepRap using DC Motors! June 20, 2014 03:50PM |
Registered: 10 years ago Posts: 55 |
Re: RepRap using DC Motors! June 21, 2014 06:48AM |
Registered: 14 years ago Posts: 7,616 |
Quote
thomassmith1969
Using the msp430, you put all of the control/coordination out to a separate processor, with can do speed control based on current position, and distance to target, and then it is just send request to block, and wait for notification of either complete, or error (because you are using the rotary encoders, you can actually determine when things aren't moving and they should, or ARE moving when they shouldn't).
Generation 7 Electronics | Teacup Firmware | RepRap DIY |