In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-01-29 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >
Share
Shulou(Shulou.com)06/01 Report--
This article mainly introduces how to use Arduino to make a plotter in linux, which has certain reference value. Interested friends can refer to it. I hope you will gain a lot after reading this article. Let Xiaobian take you to understand it together.
Since I'm a nostalgic person, I really liked the original Arduino Uno. Here's a list of other things I used (FYI, some of which I wasn't happy with):
FabScan shield: Carries stepper motor drivers.
SilentStepSticks: Stepper motor drivers, because Arduino itself cannot handle the voltages and currents required by stepper motors. So I used a Trinamic TMC2130 chip, but it worked in standalone mode. These were replaced with Pololu 4988, but they run quieter.
Silent StepStick protector: A diode that prevents your motor drive from spinning too fast (trust me, you'll need it).
Stepper motor: I chose a NEMA 17 motor that uses 12 V (e.g., models from Watterott and SparkFun).
linear guide
wooden base
wood screws
GT2 belt
GT2 Synchronous pulley
This is something I designed as a personal project. If you want to find an off-the-shelf tool kit, you can find MaXYposi from German Make magazine.
hardware installation
As you can see, I started out too big. This plotter doesn't fit on my desk. But it doesn't matter, I'm just learning it (and, I'm also remaking something, next time I'll use a smaller beam).
Plotter base plate with X axis and Y axis rails
The belt is installed on the side of the track and is used to hang some auxiliary wheels and motors together:
Belt routing on motor
I stacked several components on top of the Arduino. Arduino is at the bottom, FabScan shield is above it, then StepStick protector installed on motor slots 1 and 2, SilentStepStick is at the top. Note that the SCK and SDI pins are not connected.
Arduino stack configuration (HD large picture)
Take care to connect the connecting wires of the motor to the correct pins. If in doubt, check its data sheet or use an ohmmeter to find out which pair of wires is correct.
Software Configuration Basics
While software like grbl can interpret G-codes such as device movement and other actions, and I can also brush it into Arduino, I am curious to better understand how it works. (My X-Y plotter software can be found on GitHub, though I don't offer any warranty.)
Using StepStick (or other compatible) drivers to drive stepper motors basically requires sending a high or low signal to the respective pins. Or to use Arduino terminology:
digitalWrite(stepPin, HIGH);delayMicroseconds(30);digitalWrite(stepPin, LOW);
At the position of stepPin is the pin number of the stepper motor: 3 is motor 1 and 6 is motor 2.
Before the stepper motor can work, it must be enabled.
digitalWrite(enPin, LOW);
In fact, StepStick is able to understand three states of the stitch:
Low: Motor enabled
High: Motor disabled
Pin Not Connected: Motor is enabled but enters energy saving mode after a while
After the motor is activated, its coils are already energized and used to maintain position. It is almost impossible to rotate its shaft by hand. This ensures good accuracy, but it also means that the motor and driver chips are "full" of power and therefore heat up.
***, also important, we need a way to determine the orientation of the plotter:
digitalWrite(dirPin, direction);
The following table lists the functions and pins:
< 如显示不全,请左右滑动 >Function Motor 1 Motor 2 Enable 25 Direction 47 Step 36
Before we can use these pins, we need to set its OUTPUT mode in the setup() section of the code.
pinMode(enPin1, OUTPUT);pinMode(stepPin1, OUTPUT);pinMode(dirPin1, OUTPUT);digitalWrite(enPin1, LOW);
With this knowledge, we can easily move the stepper motor around:
totalRounds = ... for (int rounds =0 ; rounds < 2*totalRounds; rounds++) { if (dir==0){ // set direction digitalWrite(dirPin2, LOW); } else { digitalWrite(dirPin2, HIGH); } delay(1); // give motors some breathing time dir = 1-dir; // reverse direction for (int i=0; i < 6400; i++) { int t = abs(3200-i) / 200; digitalWrite(stepPin2, HIGH); delayMicroseconds(70 + t); digitalWrite(stepPin2, LOW); delayMicroseconds(70 + t); } }
This will cause the slider to move left and right. This code operates only one stepper motor, but for an X-Y plotter we have two axes to consider.
command interpreter
I started with a simple command interpreter to use canonical paths, such as:
"X30|Y30|X-30 Y-30|X-20|Y-20|X20|Y20|X-40|Y-25|X40 Y25
Relative movement is described in millimeters (1 millimeter equals 80 steps).
The plotter software implements a persistent mode that allows a PC to give it a large path (many paths) to draw. (This video shows how to draw Hilbert curves.)
Design a useful pen holder
In the *** picture above, the pen is tied to the Y axis with a thin string. This drawing is also inaccurate, and it is not possible to lift and lower the pen in the software (such as the large black dot in the example).
So I designed a better, more precise pen grip that uses a server to lift and lower the pen. The new, improved pen holder can be seen in the image below, and the Hilbert curve in the video link above was drawn using it.
The close-up in this picture is the image of the server arm lifting the pen
The pen is held in place by a small clamp (shown here is a size 8 clamp that is typically used to secure cables to walls). The server arm can lift the pen; when the server arm is lowered, the pen is lowered.
drive servo
Driving the servo is very simple: just provide the position and the servo will do all the work.
#include // Servo pin#define servoData PIN_A1 // Positions#define PEN_UP 10#define PEN_DOWN 50 Servo penServo; void setup() { // Attach to servo and raise pen penServo.attach(servoData); penServo.write(PEN_UP);}
I connected the server connector to motor number 4 on FabScan shield, so I'm going to use analog pin number 1.
It's easy to put down the pen:
penServo.write(PEN_DOWN); further extended
One of my further extensions is to add some stop detectors, but I can also use the TMC2130's StallGuard mode instead without them. These detectors can also be used to implement a home command.
Later, I might add a real Z-axis so that it can mill and carve a piece of wood, or drill a PCB, or carve a piece of acrylic, or…(I also think of laser).
Thank you for reading this article carefully. I hope that Xiaobian's article "How to use Arduino to make a plotter in Linux" will help everyone. At the same time, I hope that everyone will support you a lot and pay attention to the industry information channel. More relevant knowledge is waiting for you to learn!
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.