Welcome! Log In Create A New Profile

Advanced

RepRap using DC Motors!

Posted by lucasmun09 
Re: RepRap using DC Motors!
June 11, 2014 10:35PM
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.

Yes that is very true! I my sole purpose of this repstrap to prove people thatgrinning smileyC motors can be used in 3D printer. Low torque and inaccurate, meh, that's linear encoders are for inside the printers!
Re: RepRap using DC Motors!
June 12, 2014 04:29AM
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.


Generation 7 Electronics Teacup Firmware RepRap DIY
     
Re: RepRap using DC Motors!
June 12, 2014 06:08AM
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.


Oh arduino can handle the speed of the incoming signal pretty well. Someone else has done a demonstration in YouTube before and also placed a code along with it. I am expecting to get my arduino today or so. I am hoping to have a learning curve of couple of days and try out his code and tweak it so the motors move as it reads the encoder. I may need some help on this though... Very thanks for the feed back!
Re: RepRap using DC Motors!
June 13, 2014 11:41PM
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 14, 2014 12:54PM
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 03:11AM
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 04:03AM
What is an autonomous block?
Re: RepRap using DC Motors!
June 15, 2014 05:24AM
Quote
Dejay
What is an autonomous block?
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 .
But as other said before, you better have that working before thinking of a whole machine.
VDX
Re: RepRap using DC Motors!
June 15, 2014 01:22PM
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...

... from my actual daywork I'm sometimes salvaging high precision (originally really expensive!) DC-motors for my DIY-projects ... and have drivers for servos+encoders, that are controlled with STEP+DIR, as normal steppers.

Until now I have a gantry-style CNC with stronger servos and an XY-laserscanner for laser-engraving and sintering, that runs with the same controller and drivers.

And have plans to build some other machines with up to 5 synchronous axes for milling and/or laser-sintering/DLM.

I've posted some of this builds/convesions here, in the RepRap-forums, too -- but not all of the related infos are free ...


Viktor
--------
Aufruf zum Projekt "Müll-freie Meere" - [reprap.org] -- Deutsche Facebook-Gruppe - [www.facebook.com]

Call for the project "garbage-free seas" - [reprap.org]
Re: RepRap using DC Motors!
June 15, 2014 10:26PM
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.

Thank you for the reply! Well when I mentioned PWM, I was talking controlling it's speed, not the movement of the position on it's axis. I figured out that using PWM for positioning is veryhard and is even not worth trying. Well, thanks for the feedback!
Re: RepRap using DC Motors!
June 15, 2014 10:28PM
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.

Hello! Thank you for having interest on what I am doing right now. I found out this gentleman who have already nearly finished using DC motors and linear encoders. He has some codes and blog posts about it but it seems that it has died since I have not seen any other new posts.

Also, that is the exactly the thing I am trying to achieve. Sadly, the arduino mega I have ordered has been stolen or got lost or something by USPS so I need to wait another week to be delivered to my house. I am thinking about using raspberry pi that I have right now but it just doesn't have enough pins sad smiley
Re: RepRap using DC Motors!
June 15, 2014 10:30PM
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!

To be honest, I have not gotten half of the things you have said other than PID but ya, I think we have same mindset! Just saying, DC motors and linear encoders can be accurate as stepper motors... Well, maybe not exactly accurate but good enough for me to build other 3D printer parts
Re: RepRap using DC Motors!
June 15, 2014 10:51PM
Also guys, just wondering, what is the most efficient way to control the motors? Just bare bone arduino mega, ramps, the other ramps looking thing that starts with letter "S"? I know I defiantly need arduino and have to experiment with it no matter what but for what I am doing,( about 4 inputs, 2 DC motors, and I guess 3 smaller stepper motors that I also salvaged out of the 3 HP printers that has 5 pins so... give or take with the extruder and to turn on the heating bed so... about 25 pins?) I did some research about RAMPS and etc but I still have no clue on which way to go. Once again, I have raspberry pi right now and I can't even make a 2D drawer out of the things I have due to the lack of GPIO pins. I need thoughts and feedback! Thanks!
Re: RepRap using DC Motors!
June 16, 2014 03:05AM
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 06:19AM
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.


Generation 7 Electronics Teacup Firmware RepRap DIY
     
Re: RepRap using DC Motors!
June 16, 2014 02:42PM
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.

Well once again, I am not going to drive the motors on PWM, I am using the encoders to position the rotation and position of the motors and PWM might just be handy for little roughness around the movement and make it less jerky.
Re: RepRap using DC Motors!
June 16, 2014 02:44PM
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.

Will this motor shield work? Planning to use it on ardunio mega, Just want your ideas grinning smiley http://www.ebay.com/itm/New-Motor-Drive-Shield-Expansion-Board-L293D-for-Arduino-Mega-UNO-Duemilanove-/201109756832?pt=LH_DefaultDomain_0&hash=item2ed3135ba0
Re: RepRap using DC Motors!
June 16, 2014 03:55PM
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 possbile" smiling smiley Moving in directions other than 90° and 45° requires less than top speed for at least one of the motors.


Generation 7 Electronics Teacup Firmware RepRap DIY
     
Re: RepRap using DC Motors!
June 16, 2014 06:20PM
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" smiling smiley Moving in directions other than 90° and 45° requires less than top speed for at least one of the motors.

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:34AM
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!

AFAIK the firmwares compute movement with a configurable maximum acceleration in mind. So movements don't stop abruptly because that would create jerk and backlash and stuff, they slow down and speed up. That is what you'd need the PWM for. Theoretically you could see the PWM as very fast "top speed - no speed" signal changes and do the same in the firmware just triggering on / off. It would be too slow though probably. But you can't just stop abruptly when your linear encoder shows the target value, you have to slow down before that. Again, I have no clue about the electronics part so this is just AFAIK.
VDX
Re: RepRap using DC Motors!
June 17, 2014 02:48AM
... I'm driving DC-motors with encoders really fine with normal stepper-firmwares - the software calculates the acceleration/decceleration for the steppers -- and the controller in the servo-drivers does the same for every 'encoder-step', what's obviously perfectly harmonizing until 150mm/s winking smiley


Viktor
--------
Aufruf zum Projekt "Müll-freie Meere" - [reprap.org] -- Deutsche Facebook-Gruppe - [www.facebook.com]

Call for the project "garbage-free seas" - [reprap.org]
Re: RepRap using DC Motors!
June 17, 2014 04:12AM
The classic way to do this is to use the step and direction signals to increment and decrement a counter that represents the motor's target position at any instant. At the same time you process the quadrature signals from the encoder to keep track of its actual position.Then feed the difference into a PID feedback loop that produces a signed PWM value to control power to the motor. The difficult part is tuning the PID constants to get a good compromise between undershoot and overshoot.

This can be done using the signals from the standard firmware and a separate micro to control the motors or it could be hacked into the standard firmware. I have no idea if the ATmegas are fast enough to do this all in one micro but an Arm version like the Due should be able to do it.

If there is any backlash in the gearing you will have stability issues. This isn't a problem in the 2D printer the motors came from because it doesn't change direction while it is actually printing a dot. Any overshoot or backlash on the direction change is irrelevant because the encoder knows exactly where it is but it will be an issue when 3D printing because the filament will need to be deposited while it is changing direction.


[www.hydraraptor.blogspot.com]
VDX
Re: RepRap using DC Motors!
June 17, 2014 04:29AM
... here I'm laserengraving wood with my gantry with the 'STEP+DIR-servo-drivers' ... it's running with something between 30-50mm/s only -- but more for better separating the laser-pulses, as the 'step'-rates are around 100kHz what's a bit close to the 10 microseconds average pulse-duration.

[vimeo.com]


The encoders have 2000 'clicks' per rev and the spindles are 5mm/rev types ...


Viktor
--------
Aufruf zum Projekt "Müll-freie Meere" - [reprap.org] -- Deutsche Facebook-Gruppe - [www.facebook.com]

Call for the project "garbage-free seas" - [reprap.org]
Re: RepRap using DC Motors!
June 17, 2014 12:20PM
@VDX,

Your video shows incredible control for your laser engraver! Would you be willing to share your firmware/software for your system and the hardware you use? I would love to use DC motors as well instead of steppers and get the quality you do on your machine!

-Alex
VDX
Re: RepRap using DC Motors!
June 17, 2014 12:37PM
Hi Alex,

... as posted in the email, the firmware/software is Editasc10 from Trimeta - [www.editasc.com]

I'm cooperating with the developer to max. the possibilities, but until now he only gets it running with slightly more than 100kHz stepping frequencies, so actually the max. possible speed is 250mm/s.

But the servo-drivers are designed for max. 300kHz -- so speeds of 750mm/s (45m/min) could be possible with sturdier mechanics and faster controllers!


Viktor
--------
Aufruf zum Projekt "Müll-freie Meere" - [reprap.org] -- Deutsche Facebook-Gruppe - [www.facebook.com]

Call for the project "garbage-free seas" - [reprap.org]
Re: RepRap using DC Motors!
June 19, 2014 04:53PM
UPDATE

Here, I found someone who has actually been working on making a repstrap using a printer encoder and its motors!

He said he has used PID library or some sort but I limited knowledge in C++ has really bottlenecked me from fully understanding this. Will this code be suitable for what I am trying to achieve right now?

Here's the link to the blog where I found.

[arduino-pi.blogspot.com]

/***************************************************************************************
*  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
I just happened upon this thread. I have actually been tinkering with just such a configuration... I have been using MSP430G2403IPW20 chips programmed using energia on a Launchpad to make controllers for the blocks... They end up being about 4 bucks each (after a bit of waste to get it right), and have nice serial I/O for coordination. I built them for use in the prototype printer that I am building (based on the SCARA robotic arm). 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). I think that this tech has pretty good potential in the not-to-distant-future.

P.S. I am getting my rotary encoders for about $.10/each, my motors for about $1/each(for more power, just buy more power here), and the msp430s for about $1.30/each (plus various resistors, capacitors, and printed gears/assemblies)

P.P.S. Separating out the control this way allows for some REALLY cool freebies... The overall controller for my printer is just a few bucks (I use a group of 4 msp430's to do all the heavy lifting). You have extra processing/communication power at each motor that can be used for self-leveling, or communicating to modular components.

P.P.P.S. msp430s and Arduinos are pretty much interchangeable in this design (energia is actually a port of the Arduino development enviornment), I just like msp430s because they are cheaper, and can be easily embedded.

Edited 1 time(s). Last edit at 06/20/2014 11:44AM by thomassmith1969.
Re: RepRap using DC Motors!
June 20, 2014 02:29PM
@thomassmith1969

Would you be willing to post your code, more detailed configuration of your setup, etc? I'm interested on what all components you have and how you control it. I have done all my mechanical design but I'm lacking in the electronics/programming realm.
Re: RepRap using DC Motors!
June 20, 2014 03:50PM
and fwiw, dc motor and ribbon strip that you saw in the printer, the ribbon strip... its not necessarily for positioning control, it probably is but probably not for super precision positioning. the ribbon strip can also be used to clock the fpga inside to squirt the nozzle who knows? whats missing in your post is the stepper motors thats also inside there working in sych with the dc motor, usually to feed paper and other stuffs didnt you notice? its all sort of engineering there, each type with its own purpose carefully selected and decided by experienced people. the idea of using dc motor for reprap also came into my mind sometime ago, but rethinking it...

seriously brother, dont waste your time on this. a big FAT NO? with so many noobs questions? there are reasons why the stepper motor is used or invented in the first place, its not easy compared to making the DC motor you know? ever wonder why they keep doing it? and the reasons are not laid by the people who are just getting into the fun (esp arduino fun). you may hate me now for posting an utter useless, but mark my name brother, one day you'll remember me. keep learning and good luck. a big FAT NO? thats probably an offense cough cough tongue sticking out smiley
Re: RepRap using DC Motors!
June 21, 2014 06:48AM
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).

The big question here is, how well work several axes together? I you do a G1 X10 Y20, arrive X and Y at exactly the same time at their target? If not, geometry is ineviteable wrong.

Also, error control isn't of much use, because when moving errorneous, printing material is already laid down and there's no way to suck it back into the nozzle.


Generation 7 Electronics Teacup Firmware RepRap DIY
     
Sorry, only registered users may post in this forum.

Click here to login