DIY CNC controllers. Selecting a controller for controlling stepper motors, engraving, milling, lathes, and foam cutters. We begin work on creating a homemade machine


Good day everyone! And here I am with a new part of my story about CNC machine. When I started writing the article, I didn’t even think that it would turn out to be so voluminous. When I wrote about the electronics of the machine, I looked and got scared - the A4 sheet was covered with writing on both sides, and there was still a lot, a lot to tell.

In the end it turned out like this guide to creating a CNC machine, working machine, from scratch. There will be three parts of an article about one machine: 1-electronic filling, 2-mechanics of the machine, 3-all the subtleties of setting up the electronics, the machine itself, and the machine control program.
In general, I will try to combine in one material everything that is useful and necessary for every beginner in this interesting business, what I myself have read on various Internet resources and passed through myself.

By the way, in that article I forgot to show photographs of the crafts made. I'm fixing this. Styrofoam bear and plywood plant.

Preface

After I assembled my small machine without significant expenditure of effort, time and money, I became seriously interested in this topic. I watched on YouTube, if not all, then almost all the videos related to amateur machines. I was especially impressed by the photographs of the products that people make on their “ home CNC" I looked and made a decision - I will assemble my own large machine! So, on a wave of emotions, without thinking everything through, I plunged into a new and unknown world CNC.

I didn't know where to start. First of all, I ordered a normal stepper motor Vexta by 12 kg/cm, by the way with the proud inscription “made in Japan”.


While he was traveling across Russia, he sat in the evenings on various CNC forums and tried to decide on his choice STEP/DIR controller and stepper motor drivers. I considered three options: on a chip L298, on field workers, or buy ready-made Chinese TB6560 which had very mixed reviews.


For some it worked without problems for a long time, for others it burned out at the slightest user error. Someone even wrote that it burned out when he slightly turned the shaft of the motor connected to the controller at that time. Probably the fact of the unreliability of the Chinese played in favor of the choice of scheme L297+ actively discussed on the forum. The scheme is probably really indestructible because... The driver's field amperes are several times higher than what needs to be supplied to the motors. Even though you have to solder it yourself (that’s just a plus), and the cost of the parts was a little more than a Chinese controller, but it’s reliable, which is more important.

I'll digress a little from the topic. When all this was done, the thought did not even arise that I would ever write about it. Therefore, there are no photographs of the assembly process of mechanics and electronics, only a few photos taken with a mobile phone camera. Everything else was clicked specifically for the article, in already assembled form.

The soldering iron case is afraid

I'll start with the power supply. I planned to do an impulse one, I tinkered with it for probably a week, but I still couldn’t overcome the excitement that was coming from out of nowhere. I change the trans to 12V - everything is OK, I change it to 30 and it’s a complete mess. I came to the conclusion that some kind of bug is creeping through the feedback from 30V to TL494 and demolishes her tower. So I abandoned this impulse generator, fortunately there were several TS-180s, one of which went to serve the homeland as a trance power supply. And whatever you say, a piece of iron and copper will be more reliable than a pile of powder. The transformer rewound to the required voltages, but it needed +30V to power the motors, +15V to power IR2104, +5V on L297, and a fan. You can supply 10 or 70 to the motors, the main thing is not to exceed the current, but if you do less, the maximum speed and power are reduced, but the transformer did not allow more because needed 6-7A. Voltages 5 and 15V were stabilized, 30V was left “floating” at the discretion of our electrical network.


All this time, every night I sat at the computer and read, read, read. Setting up the controller, choosing programs: which one to draw, which one to control the machine, how to make mechanics, etc. etc. In general, the more I read, the scarier it became, and more and more often the question arose: “Why do I need this?!” But it was too late to retreat, the engine is on the table, the parts are somewhere on the way - we must continue.

It's time to solder the board. The ones available on the Internet did not suit me for three reasons:
1 - The store where I ordered the parts was not available IR2104 V DIP packages, and they sent me 8-SOICN. They are soldered onto the board from the other side, upside down, and accordingly it was necessary to mirror the tracks, and their ( IR2104) 12 pieces.


2 - I also took resistors and capacitors in SMD packages to reduce the number of holes that needed to be drilled.
3 - The radiator I had was smaller and the outer transistors were outside its area. It was necessary to shift the field switches on one board to the right, and on the other to the left, so I made two types of boards.

Machine controller diagram


For the security of the LPT port, the controller and computer were connected via an optical isolation board. I took the diagram and signet from one well-known site, but again I had to remake it a little to suit myself and remove unnecessary details.


One side of the board is powered via a USB port, the other, connected to the controller, is powered from a +5V source. Signals are transmitted through optocouplers. I will write all the details about setting up the controller and decoupling in the third chapter, but here I will only mention the main points. This decoupling board is designed for secure connection stepper motor controller to the LPT port of the computer. Completely electrically isolates the computer port from the machine electronics, and allows you to control a 4-axis CNC machine. If the machine has only three axes, as in our case, unnecessary parts can be left hanging in the air, or not soldered at all. It is possible to connect limit sensors, a forced stop button, a spindle switch relay and another device, such as a vacuum cleaner.


This was a photo of the optocoupler board taken from the Internet, and this is what my garden looks like after installation in the case. Two boards and a bunch of wires. But there seems to be no interference, and everything works without errors.


The first controller board is ready, I checked everything and tested it step by step, as in the instructions. Using a trimmer, I set a small current (this is possible thanks to the presence of PWM), and connected the power (to the motors) through a chain of 12+24V light bulbs, so that there was “nothing, if anything.” My field workers are without a radiator.

The engine hissed. The good news is that the PWM is working as it should. I press the key and it spins! I forgot to mention that this controller is designed to control a bipolar stepper motor i.e. the one with 4 wires connected. I played with the step/half-step and current modes. In half-step mode, the engine behaves more stable and develops higher speeds + accuracy increases. So I left the jumper in the “half step”. With the maximum safe current for the engine at a voltage of approximately 30V, it was possible to spin the engine up to 2500 rpm! My first machine without PWM never dreamed of this.))

I ordered the next two engines more powerful, Nema by 18kg/s, but already “made in China”.


They are inferior in quality Vexta, after all, China and Japan are different things. When you rotate the shaft with your hand, with a Japanese it happens somehow softly, but with the Chinese the feeling is different, but so far this has not affected the work. There are no comments about them.

I soldered the two remaining boards, checked them using the “LED stepper motor simulator”, everything seemed to be fine. I connect one motor - it works great, but not 2500 rpm, but about 3000! According to the already worked out scheme, I connect the third motor to the third board, spins for a couple of seconds and stops... I look with an oscillator - there are no pulses on one output. I call the fee - one of IR2104 broken.

Well, okay, maybe I got a defective one, I read that this often happens with this little thing. I solder in a new one (I took 2 pieces with a spare), the same nonsense - it turns for a couple of seconds and STOP! Here I tensed up, and let's check the field workers. By the way, my board has IRF530(100V/17A) versus (50V/49A), as in the original. A maximum of 3A will go to the motor, so a reserve of 14A is more than enough, but the price difference is almost 2 times in favor of the 530s.
So, I check the field devices and what I see... I didn’t solder one leg! And all 30V from the field worker flew to the output of this “irka”. I soldered the leg, examined everything carefully again, and installed another one. IR2104, I’m worried myself - this is the last one. I turned it on and was very happy when the engine did not stop after two seconds of operation. The modes were left as follows: engine Vexta– 1.5A, motor NEMA 2.5A. With this current, approximately 2000 revolutions are reached, but it is better to limit them in software to avoid skipping steps, and the engine temperature at long work does not exceed safe values ​​for motors. The power transformer copes without problems, because usually only 2 motors spin at the same time, but additional air cooling is desirable for the radiator.

Now about installing field guards on the radiator, and there are 24 of them, if anyone hasn’t noticed. In this version of the board they are located lying down, i.e. the radiator simply rests on them and is attracted by something.


Of course, it is advisable to put a solid piece of mica to isolate the heatsink from the transistors, but I didn’t have one. I found a solution like this. Because For half of the transistors, the housing goes to the plus power; they can be mounted without insulation, just with thermal paste. And under the rest I put pieces of mica left over from Soviet transistors. I drilled the radiator and the board through in three places and tightened them with bolts. I got one large board by soldering three separate boards along the edges, while soldering around the perimeter for strength copper wire 1mm. I placed all the electronic stuffing and the power supply on some kind of iron chassis, I don’t even know why.

I cut out the side and top covers from plywood, and placed a fan on top.

The article describes a homemade CNC machine. Main advantage this option machine tool - a simple method of connecting stepper motors to a computer via the LPT port.

Mechanical part

bed
The bed of our machine is made of plastic with a thickness of 11-12mm. The material is not critical, aluminum can be used, organic glass plywood and any other available material. The main parts of the frame are attached using self-tapping screws; if desired, you can additionally decorate the fastening points with glue; if you use wood, you can use PVA glue.

Calipers and guides
Steel rods with a diameter of 12mm, length 200mm (Z axis 90mm), two pieces per axis, were used as guides. The calipers are made of textolite with dimensions 25X100X45. The textolite has three through holes, two of them for guides and one for the nut. The guide parts are fastened with M6 screws. The X and Y supports at the top have 4 threaded holes for attaching the table and Z axis assembly.


Caliper Z
The Z axis guides are attached to the X support through a steel plate, which is a transition plate, the dimensions of the plate are 45x100x4.


Stepper motors are mounted on fasteners, which can be made of sheet steel with a thickness of 2-3mm. The screw must be connected to the axis of the stepper motor using a flexible shaft, which can be a rubber hose. If you use a rigid shaft, the system will not work accurately. The nut is made of brass, which is glued into the caliper.


Assembly
Assembly of a homemade CNC machine is carried out in the following sequence:

  • First you need to install all the guide components into the calipers and screw them to the sidewalls, which are not first installed on the base.
  • We move the caliper along the guides until we achieve smooth movement.
  • Tighten the bolts, fixing the guide parts.
  • We attach the caliper, guide assembly and side frame to the base; we use self-tapping screws for fastening.
  • We assemble assembly Z and, together with the adapter plate, attach it to support X.
  • Next, install the lead screws along with the couplings.
  • We install stepper motors by connecting the motor rotor and the screw with a coupling. We pay strict attention to ensure that the lead screws rotate smoothly.

Recommendations for assembling the machine:
Nuts can also be made from cast iron; you should not use other materials; screws can be purchased at any hardware store and trim to suit your needs. When using screws with M6x1 thread, the nut length will be 10 mm.

Machine drawings.rar

Let's move on to the second part of assembling a CNC machine with our own hands, namely the electronics.

Electronics

power unit
A 12Volt 3A unit was used as a power source. The block is designed to power stepper motors. Another voltage source of 5 Volts and a current of 0.3 A was used to power the controller microcircuits. The power supply depends on the power of the stepper motors.

Here is the calculation of the power supply. The calculation is simple - 3x2x1=6A, where 3 is the number of stepper motors used, 2 is the number of powered windings, 1 is the current in Amperes.


Controller
The control controller was assembled using only 3 555TM7 series microcircuits. The controller does not require firmware and has a fairly simple schematic diagram, thanks to this, this CNC machine can be made by a person who is not particularly versed in electronics.

Description and purpose of the LPT port connector pins.

Vvyv. Name Direction Description
1 STROBE input and output Sets the PC after each data transfer is completed
2..9 DO-D7 conclusion Conclusion
10 ASK input Set to "0" external device after receiving the byte
11 BUSY input The device indicates that it is busy by setting this line to "1"
12 Paper out input For printers
13 Select input The device indicates that it is ready by setting this line to "1"
14 Autofeed
15 Error input Indicates an error
16 Initialize input and output
17 Select In input and output
18..25 Ground GND GND Common wire

For the experiment, a stepper motor from an old 5.25-inch was used. In the circuit, 7 bits are not used because 3 engines are used. You can hang the key to turn on the main engine (mill or drill) on it.

Driver for stepper motors
To control the stepper motor, a driver is used, which is an amplifier with 4 channels. The design is implemented using only 4 transistors of the KT917 type.


You can also use serial microcircuits, for example - ULN 2004 (9 keys) with a current of 0.5-0.6A.


The vri-cnc program is used for control. Detailed description and instructions for using the program are located at.


By assembling this CNC machine with your own hands, you will become the owner of a machine capable of performing machining(drilling, milling) plastics. Engraving on steel. Also, a homemade CNC machine can be used as a plotter; you can draw and drill printed circuit boards on it.

Based on materials from the site: vri-cnc.ru

"RFF" - can control both separate 3 stepper motor drivers and a ready-made board with drivers for 3-axis CNC with LPT output.
This board is an alternative to an old computer with an LPT port on which MACH3 is installed.
If the G-code is loaded into the MACH3 program on the computer, then here it is read “RFF” from the SD card.

1. Appearance boards

1 - SLOT for SD card;

2 - start button;

3 - manual control joystick;

4 - LED (for X and Y axes);

5 LED (for Z axis);

6 - leads for the spindle power button;

8 - conclusions low level(-GND);

9 - high level pins (+5v);

10 - pins on 3 axes (Xstep, Xdir, Ystep, Ydir, Zstep, Zdir), 2 pins each;

11 - LPT connector pins (25 pins);

12 - LPT connector (female);

13 - USB connector (only for +5v power supply);

14 and 16 - spindle frequency control (PWM 5 V);

15 - GND (for spindle);

17 - output for spindle ON and OFF;

18 - spindle speed control (analog from 0 to 10 V).

When connecting to a ready-made board with drivers for a 3-axis CNC that has an LPT output:

Install jumpers between 10 pins and 11 pins.

8 and 9 pins with 11, they are needed if additional on and off pins are allocated for the drivers (there is no specific standard, so these can be any combinations, you can find them in the description, or at random :) -)

When connecting to separate drivers with motors:

Install jumpers between the 10 Step, Dir pins of the "RFF" board and the Step, Dir pins of your drivers. (don’t forget to supply power to the drivers and motors)

Connect "RFF" to the network. Two LEDs will light up.

Insert the formatted SD card into LOT 1. Press RESET. Wait until the right LED lights up. (Approximately 5 seconds) Remove the SD card.

A text file named "RFF" will appear on it.

Open this file and enter the following variables (Here in this form and sequence):

Example:

V=5 D=8 L=4.0 S=0 Dir X=0 Dir Y=1 Dir Z=1 F=600 H=1000 UP=0

V - conditional value from 0 to 10 of the initial speed during acceleration (acceleration).

Explanations of commands

D - step crushing installed on the motor drivers (should be the same on all three).

L is the length of passage of the carriage (portal), with one revolution of the stepper motor in mm (it should be the same on all three). Insert the rod from the handle instead of the cutter and manually turn the motor one full turn, this line will be the L value.

S - which signal turns on the spindle, if 0 means - GND if 1 means +5v (can be selected experimentally).

Dir X, Dir Y, Dir Z, the direction of movement along the axes, can also be selected experimentally by setting 0 or 1 (it will become clear in manual mode).

F - speed at idling(G0), if F=600, then the speed is 600mm/sec.

H - the maximum frequency of your spindle (needed to control the spindle frequency using PWM, for example, if H = 1000, and S1000 is written in the G-code, then the output with this value will be 5v, if S500 then 2.5 v, etc., variable S in G code must not be greater than the variable H on SD.

The frequency at this pin is about 500 Hz.
UP - logic for controlling SD drivers (there is no standard, it can be like high level+5V, and low -) set 0 or 1. (works for me in any case. -)))

The controller itself

See video: control board with 3-axis CNC

2. Preparation of the control program (G_CODE)

The board was developed for ArtCam, so the Control Program must have an extension. TAP (remember to put it in mm, not inches).
The G-code file saved on the SD card must be named G_CODE.

If you have a different extension, for example CNC, then open your file using notepad and save it as G_CODE.TAP.

x, y, z in G-code must be capitalized, the dot must be a dot, not a comma, and even an integer must have 3 zeros after the dot.

Here it is in this form:

X5.000Y34.400Z0.020

3. Manual control

Manual control is carried out using a joystick, if you have not entered the variables in the settings specified in point 1, “RFF” board
will not work even in manual mode!!!
To go to manual mode you need to press the joystick. Now try to control it. Looking at the board from above (SLOT 1 at the bottom,
12 LPT connector at the top).

Forward Y+, backward Y-, right X+, left X-, (if the movement in the Dir X, Dir Y settings is incorrect, change the value to the opposite).

Press the joystick again. The 4th LED will light up, which means you have switched to Z-axis control. Joystick up - spindle
should go up Z+, joystick down - go down Z- (if the move is incorrect, change the value in the Dir Z settings
to the opposite).
Lower the spindle until the cutter touches the workpiece. Click on button 2 start, now this is the zero point from here the execution of the G-code will begin.

4. Autonomous operation (performing G-code cutting)
Press button 2 again, briefly holding it down.

After releasing the button, the "RFF" board will begin to control your CNC machine.

5. Pause mode
Briefly press button 2 while the machine is running, cutting will stop and the spindle will rise 5mm above the workpiece. Now you can control the Z axis both up and down, not be afraid to even go deeper into the workpiece, since after pressing button 2 again, cutting will continue from the paused value along Z. In the pause state, you can turn the spindle off and on with button 6. The X and Y axes are in Pause mode cannot be controlled.

6. Emergency stop of work with the spindle going to zero

By holding button 2 for a long time during autonomous operation, the spindle will rise 5 mm above the workpiece, do not release the button, 2 LEDs, 4th and 5th, will start flashing alternately, when the flashing stops, release the button and the spindle will move to the zero point. Pressing button 2 again will execute the job from the beginning of the G-code.

Supports commands such as G0, G1, F, S, M3, M6 to control the spindle speed there are separate pins: PWM from 0 to 5 V and a second analog from 0 to 10 V.

Accepted command format:

X4.000Y50.005Z-0.100 M3 M6 F1000.0 S5000

There is no need to number the lines, no spaces, and indicate F and S only when changing.

A small example:

T1M6 G0Z5.000 G0X0.000Y0.000S50000M3 G0X17.608Y58.073Z5.000 G1Z-0.600F1000.0 G1X17.606Y58.132F1500.0 X17.599Y58.363 X17.597Y58.476 X17.603Y58.707 X17.605Y58.748

Demonstration of the RFF controller operation

To independently assemble a milling machine, you need to select a CNC control controller. Controllers are available as multi-channel: 3 and 4 axis stepper motor controllers, and single-channel. Multichannel controllers are most often found for controlling small stepper motors, size 42 or 57mm (nema17 and nema23). Such motors are suitable for self-assembly of CNC machines with a working field of up to 1 m. At self-assembly For a machine with a working field of more than 1 m, stepper motors of standard size 86 mm (nema34) should be used; to control such motors, powerful single-channel drivers with a control current of 4.2 A and higher will be needed.

To control desktop milling machines controllers based on specialized driver chips for controlling motor motors are widely used, for example, TB6560 or A3977. This chip contains a controller that generates the correct sine wave for different modes half-step and has the ability to programmatically set winding currents. These drivers are designed to work with stepper motors up to 3A, motor sizes NEMA17 42mm and NEMA23 57mm.

Controlling the controller using specialized or Linux EMC2 and others installed on a PC. It is recommended to use a computer with a processor frequency of at least 1 GHz and 1 GB memory. Desktop computer gives best results, compared to laptops and much cheaper. In addition, you can use this computer for other tasks when it is not busy controlling your machine. When installing on a laptop or PC with 512MB memory, it is recommended to carry out.

To connect to a computer, a parallel LPT port is used (for a controller with a USB interface, a USB port). If your computer is not equipped with a parallel port (more and more computers are being released without this port), you can purchase a PCI-LPT or PCI-E-LPT port expander card or a specialized USB-LPT controller-converter that connects to the computer via a USB port .

With a desktop engraving and milling machine made of aluminum CNC-2020AL, complete with a control unit with the ability to adjust spindle speed, Figure 1 and 2, the control unit contains a stepper motor driver on a TB6560AHQ chip, power supplies for the stepper motor driver and a spindle power supply.

figure 1

Figure 2

1. One of the first control controllers for CNC milling machines on the TB6560 chip was nicknamed the “blue board”, Figure 3. This version of the board was discussed a lot on the forums; it has a number of disadvantages. The first is slow optocouplers PC817, which requires, when setting up the machine control program MACH3, to enter the maximum valid value in the fields Step pulse and Dir pulse = 15. The second is poor matching of the outputs of the optocouplers with the inputs of the TB6560 driver, which can be solved by modifying the circuit, Figure 8 and 9. The third is the linear power supply regulators of the board and, as a result, there is a lot of overheating; on subsequent boards, pulse stabilizers are used. The fourth is the lack of galvanic isolation of the power supply circuit. The spindle relay is 5A, which in most cases is not enough and requires the use of a more powerful intermediate relay. The advantages include the presence of a connector for connecting a control panel. This controller is not used.

Figure 3.

2. The CNC machine control controller entered the market after the “blue board”, nicknamed the red board, Figure 4.

Higher frequency (fast) optocouplers 6N137 are used here. Spindle relay 10A. Availability of galvanic isolation for power supply. There is a connector for connecting the fourth axis driver. Convenient connector for connecting limit switches.

Figure 4.

3. The stepper motor controller marked TB6560-v2 is also red, but simplified, there is no power supply decoupling, Figure 5. Small size, but as a result of this the radiator size is smaller.

Figure 5

4. Controller in an aluminum case, Figure 6. The case protects the controller from dust and metal parts; it also serves as a good heat sink. Galvanic isolation for power supply. There is a power connector additional circuits+5V. Fast optocouplers 6N137. N low-impedance and Low ESR capacitors. There is no relay for controlling the spindle turning on, but there are two outputs for connecting a relay (transistor switches with OK) or PWM for controlling the spindle rotation speed. Description of connecting relay control signals on the page

Figure 6

5. 4-axis controller of a CNC milling and engraving machine, USB interface, Figure 7.

Figure 7

This controller does not work with the MACH3 program; it comes with its own machine control program.

6. CNC controller of the machine on the SD driver from Allegro A3977, Figure 8.

Figure 8

7.Single-channel stepper motor driver for CNC machine DQ542MA. This driver can be used when self-production a machine with a large working field and stepper motors with a current of up to 4.2A, can also work with Nema34 86mm motors, Figure 9.

Figure 9

Photo of the modification of the blue stepper motor controller board on the TB6560, Figure 10.

Figure 10.

Scheme for fixing the blue stepper motor controller board on the TB6560, Figure 11.



CATEGORIES

POPULAR ARTICLES

2024 “mobi-up.ru” - Garden plants. Interesting things about flowers. Perennial flowers and shrubs