Hi there. I am working on a project where I've built a parallel robot that is controlled by 2 stepper motors, (specifically it's a dual arm plotter).
I want it to draw an 85 x 60 (mm) rectangle. Within my CAD software, I've obtained the coordinates for the four points of the rectangle, according to a local coordinate system, as well as the corresponding proximal link angles required for those points. The local coord system is placed at the centre of the spindle of the right stepper motor, as seen in the photo.
I have attached photos of the robot in this post for a better understanding. It is important to note that the plotter doesnt lift up, (there is no z-direction).
Ideally I would want an arduino code to make the robot draw the rectangle, however I am open to any suggestions as well. I have no idea how to go about this code as I'm a mechanical engineering student and I'm fairly new to these concepts.
Any help would be appreciated.
It looks like the frame isn’t ‘square’…
That’s going to introduce some tricky mapping from an XY coordinate system.
If that’s really the arrangement, you may find it easier to create an array of X-resolution and Y-resolution points to lookup the corrected output position,
That is correct. The frame isn't square. How would I go about implementing your suggestion?
Hi,
You might like to Google;
inverse kinematics
Tom..
![]()
This was my orginal idea. In Solidworks, I've assigned a 'home' position that is coincident witht the centre of a 85x35 mm rectangle. I then noted the angle of the proximal links with the positive x-axis. I then mated the pencil tip of the plotter to the four corners of the rectangle and in each instance, recorded the relevant angles of the links. Then I calculated the difference in angles between each consecutive position and converted it into steps for the motors to turn, (that what the weird decimals are in the code).
However, this method doesnt seem to work and I cant seem to figure out why. Maybe you could assist with this method?
// MultiStepper.pde
// -*- mode: C++ -*-
// Use MultiStepper class to manage multiple steppers and make them all move to
// the same position at the same time for linear 2d (or 3d) motion.
#include <AccelStepper.h>
#include <MultiStepper.h> //The Multistepper is a sub-class of the AccelStepper library therefore only called after the AccelStepper library
// EG X-Y position bed driven by two steppers
AccelStepper stepper1(1,3,5); //The first value in brackets '1' means that a driver is being used to power the stepper, The 2nd (CLK) and 3rd (CW) values are the PWM pins on the Arduino.
AccelStepper stepper2(1,9,11);
// Up to 10 steppers can be handled as a group by MultiStepper
MultiStepper steppers;
void setup() {
Serial.begin(9600);
// Configure each stepper
stepper1.setMaxSpeed(30); //Steps per second
stepper2.setMaxSpeed(30);
// Then give them to MultiStepper to manage
steppers.addStepper(stepper1);
steppers.addStepper(stepper2);
}
void loop() {
long positions[10]; // Array of stepper positions
// Point 1: Bottom Left
positions[0] = 9.683; //references to a coordinate
positions[1] = 8.839;
steppers.moveTo(positions);
steppers.runSpeedToPosition(); // Blocks until all are in position
// Point 2: Top Left
positions[0] = -2.1; //references to a coordinate
positions[1] = 3.91;
steppers.moveTo(positions);
steppers.runSpeedToPosition(); // Blocks until all are in position
// Point 3: Top Right
positions[0] = -21.9; //references to a coordinate
positions[1] = -20.317;
steppers.moveTo(positions);
steppers.runSpeedToPosition(); // Blocks until all are in position
// Point 4: Bottom Right
positions[0] = 5.367; //references to a coordinate
positions[1] = -2.061;
steppers.moveTo(positions);
steppers.runSpeedToPosition(); // Blocks until all are in position
// Point 1: Bottom Left
positions[0] = 18.63; //references to a coordinate
positions[1] = 18.467;
steppers.moveTo(positions);
steppers.runSpeedToPosition(); // Blocks until all are in position
}
This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.
