Mixer      06/14/2019

Scheme controller control of the cnc machine. The choice of controller for stepper motors, engraving, milling, lathes, foam cutters. Board appearance

The controller for the machine can easily assemble and House master. It is not difficult to set the desired parameters, it is enough to take into account a few nuances.

Without right choice controller for the machine, it will not be possible to assemble the controller for the CNC on the Atmega8 16au with your own hands. These devices are divided into two types:

  • Multichannel. This includes 3 and 4 axis stepper motor controllers.
  • Single-channel.

Small ball motors are most effectively controlled by multi-channel controllers. The standard sizes in this case are 42 or 57 millimeters. This great option for self-assembly of CNC machines, in which the working field has a size of up to 1 meter.

If the machine is assembled independently on a microcontroller with a field of more than 1 meter, it is necessary to use motors that are produced in sizes up to 86 millimeters. In this case, it is recommended to organize the control of powerful single-channel drivers, with a control current of 4.2 A or more.

Controllers with special driver chips are widely used in case of need to control the operation of machines with desktop-type milling machines. The best option there will be a chip designated as TB6560 or A3977. This product has a controller inside to help generate the correct sine wave for modes that support different half steps. Winding currents can be set by software. With microcontrollers, achieving results is easy.

Control

The controller is easy to manage using specialized software installed on a PC. The main thing is that the computer itself has a memory of at least 1 GB, and a processor of at least 1 GHz.

You can use laptops, but stationary computers in this regard give top scores. And they are much cheaper. The computer can be used for other tasks when the machines do not require control. Well, if there is an opportunity to optimize the system before starting work.

Parallel port LPT - that's what detail helps organize the connection. If the controller has a USB port, then an appropriately shaped connector is used. At the same time, more and more computers are being released that do not have a parallel port.

Making the simplest version of the scanner

One of the most simple solutions For homemade creation CNC machine - the use of parts from other equipment equipped with ball motors. The function is perfectly performed by old printers.

We take the following details extracted from the previous devices:

  1. microchip itself.
  2. Stepper motor.
  3. A pair of steel bars.

When creating the controller case, you must also take the old cardboard box. It is permissible to use boxes made of plywood or textolite, the source material does not matter. But cardboard is easiest to process using ordinary scissors.

The list of tools will look like this:

  • Soldering iron together, complete with accessories.
  • Glue gun.
  • Scissor tool.
  • Wire cutters.

Finally, making the controller will require the following additional parts:

  1. Connector with wire, for organizing convenient connection.
  2. Cylindrical socket. Such designs are responsible for powering the device.
  3. The lead screws are threaded rods.
  4. Nut with suitable dimensions for the lead screw.
  5. Screws, washers, wood in the form of pieces.

We begin work on creating a homemade machine

The stepper motor along with the board must be removed from the old devices. At the scanner, it is enough to remove the glass, and then unscrew a few bolts. You will also need to remove the steel rods used in the future, creating a test portal.

The ULN2003 control chip will be one of the main elements. Separate purchase of parts is possible if other types of chips are used in the scanner. If there is a desired device on the board, carefully unsolder it. The procedure for assembling a controller for a CNC on an Atmega8 16au with your own hands is as follows:

  • First, heat up the tin using a soldering iron.
  • Removing the top layer will require the use of suction.
  • At one end, we install a screwdriver under the microcircuit.
  • The tip of the soldering iron should touch each pin of the microcircuit. If this condition is met, the tool can be pressed.

Next, the microcircuit is soldered to the board, also with maximum accuracy. For the first trial steps, you can use layouts. We use the option with two power rails. One of them is connected to the positive terminal, and the other to the negative.

The next step is to connect the output of the second parallel port connector with the output in the chip itself. The pins of the connector and the microcircuit must be connected accordingly.

The zero terminal is connected to the negative bus.

One of last stages– Soldering the stepper motor to the control device.

It is good if there is an opportunity to study the documentation from the device manufacturer. If not, then you will have to find a suitable solution on your own.

The wires are connected to the leads. Finally, one of them connects to the positive bus.

Busbars and power sockets must be connected.

Hot glue from a gun will help secure the parts so they don't chip off.

We use Turbo CNC - a program for control

The Turbo CNC software will definitely work with a microcontroller that uses the ULN2003 chip.

  • We use a specialized site from where you can download software.
  • Any user will understand how to install.
  • It is this program that works best under MS-DOS. Some errors may appear in compatibility mode on Windows.
  • But, on the other hand, it will allow you to assemble a computer with certain characteristics that are compatible with this particular software.

  1. After the first launch of the program, a special screen will appear.
  2. You have to hit the space bar. So the user is in the main menu.
  3. Press F1 and then select Configure.
  4. Next, you need to click on the “number of Axis” item. We use the Enter key.
  5. It remains only to enter the amount of soybeans that you plan to use. In this case, we have one motor, so we click on the number 1.
  6. To continue, use Enter. We again need the F1 key, after using it, select Configure Axis from the Configure menu. Then - press the space bar twice.

Drive Type - this is the tab we need, we reach it with numerous Tab presses. The down arrow helps you get to Type. We need a cell called Scale. Next, we determine how many steps the engine takes only during one revolution. To do this, it is enough to know the part number. Then it will be easy to understand how many degrees it turns in just one step. Next, the number of degrees is divided by one step. This is how we calculate the number of steps.

The rest of the settings can be left as is. The number obtained in the Scale cell is simply copied to the same cell, but on another computer. The value 20 must be assigned to the Acceleration cell. The default value in this area is 2000, but it is too high for the system being built. The initial level is 20, and the maximum is 175. Then it remains to press TAB until the user reaches the Last Phase item. Here you need to put the number 4. Next, press Tab until we reach the row of x's, the first in the list. The first four lines should contain the following positions:

1000XXXXXXXX
0100XXXXXXXX
0010XXXXXXXX
0001XXXXXXXX

The rest of the cells do not need to be changed. Just choose OK. Everything, the program is configured to work with a computer, the executive devices themselves.

For self-assembly milling machine CNC controller must be selected. Controllers are available as multi-channel: 3- and 4-axis stepper motor controllers, and single-channel. Multi-channel controllers are most often found to control 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 1m. At self assembly for a machine with a working field of more than 1m, stepper motors of size 86mm (nema34) should be used, to control such motors you will need powerful single-channel drivers with a control current of 4.2A or more.

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

Controller management using specialized or or Linux EMC2 and others installed on a PC. It is recommended to use a computer with at least 1GHz processor and 1GB memory. A desktop computer gives better results than laptops and is much cheaper. In addition, you can use this computer for other jobs when it is not busy operating your machine. When installing on a laptop or PC with 512MB of memory, it is recommended to run the .

The LPT parallel port is used to connect to a computer (for a controller with a USB interface, the 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 aluminum engraving and milling machine CNC-2020AL, complete with a control unit with the ability to adjust the spindle speed, Figure 1 and 2, the control unit contains a stepper motor driver on a TB6560AHQ chip, stepper motor driver power supplies and a spindle power supply.

picture 1

Figure 2

1. One of the first CNC milling machine controllers based on the TB6560 chip was nicknamed the "blue board", Figure 3. This board option has been discussed a lot on the forums, it has a number of disadvantages. The first is slow PC817 optocouplers, which requires, when setting up the MACH3 machine control program, to enter the maximum allowable value in the Step pulse and Dir pulse = 15 fields. The second is poor matching of the optocouplers outputs with the inputs of the TB6560 driver, which is solved by finalizing the circuit, Figure 8 and 9. Third - Linear power supply regulators of the board and, as a result, a large overheating, switching regulators are used on subsequent boards. Fourth - the lack of galvanic isolation of the power circuit. Spindle relay 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 the control panel. This controller does not apply.

Figure 3

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

More high-frequency (fast) 6N137 optocouplers are used here. Spindle relay 10A. The presence of galvanic isolation for power supply. There is a connector for connecting the driver of the fourth axis. 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 decoupling, Figure 5. Small size, but as a result, the size of the radiator is also smaller.

Figure 5

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

Figure 6

5. 4 axis controller of CNC router, 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 machine controller on the stepper motor driver from Allegro A3977, Figure 8.

Figure 8

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

Figure 9

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

Figure 10.

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

Since I assembled a CNC machine for myself a long time ago and have been using it for hobby purposes for a long time, I hope my experience will be useful, as well as the source codes of the controller.

I tried to write only those moments that personally seemed important to me.

The link to the controller sources and the configured Eclipse + gcc shell, etc. are in the same place as the video:

History of creation

Regularly faced with the need to make one or another small “thing” of complex shape, I initially thought about a 3D printer. And even started doing it. But after reading the forums and evaluating the speed of the 3D printer, the quality and accuracy of the result, the percentage of rejects and the structural properties of thermoplastics, I realized that this is nothing more than a toy.

The order for components from China came in a month. And after 2 weeks the machine was working with control from LinuxCNC. Collected from any garbage that was at hand, because I wanted to quickly (profile + studs). I was going to redo it later, but, as it turned out, the machine turned out to be quite rigid, and the nuts on the studs did not have to be tightened even once. So the design remained unchanged.

The initial operation of the machine showed that:

  1. Do not use a 220V “china noname” drill as a spindle best idea. It overheats and is terribly loud. The side play of the cutter (bearings?) is felt by the hands.
  2. The Proxon drill is quiet. The lift is not noticeable. But it overheats and turns off after 5 minutes.
  3. A loaned computer with a bidirectional LPT port is not convenient. Taken for a while (finding PCI-LPT turned out to be a problem). Takes up space. And generally speaking..
After the initial operation, I ordered a water-cooled spindle and decided to make a controller for autonomous operation on the cheapest version of STM32F103, sold complete with a 320x240 LCD screen.
Why people still stubbornly torment 8-bit ATMega for relatively complex tasks, and even through Arduino, is a mystery to me. They probably love challenges.

Controller development

I created the program after a thoughtful review of the sources of LinuxCNC and gbrl. However, neither those nor those source codes for calculating the trajectory were taken. I wanted to try to write a calculation module without using float. Exclusively on 32-bit arithmetic.
The result suits me for all operating modes and the firmware has not been touched for a long time.
Maximum speed selected experimentally: X:2000mm/min Y:1600 Z:700 (1600 step/mm. mode 1/8).
But it is not limited by controller resources. Just above the already nasty sound of skipping steps even straight stretches through the air. The budget Chinese stepper control board on the TB6560 is not the best option.
In fact, the speed on wood (beech, 5mm depth, d = 1mm cutter, step 0.15mm) is not more than 1200 mm. Increases the risk of cutter breakage.

The result is a controller with the following functionality:

  • Connecting to an external computer as a standard usb mass storage device (FAT16 on SD card). Working with standard G-code format files
  • Deleting files through the controller's user interface.
  • Viewing the trajectory for the selected file (as far as the 640x320 screen allows) and calculating the execution time. In fact, emulation of execution with the summation of time.
  • View the contents of files in a test form.
  • Mode manual control from the keyboard (moving and setting "0").
  • Starting the task for the selected file (G-code).
  • Pause/resume execution. (sometimes useful).
  • Emergency software stop.
The controller will be connected to the stepper control board through the same LPT connector. Those. it acts as a control computer with LinuxCNC/Mach3 and is interchangeable with it.

After creative experiments on carving hand-drawn reliefs on a tree, and experiments with acceleration settings in the program, I also wanted encoders on the axes. Just on e-bay I found relatively cheap optical encoders (1/512), the pitch of which for my ball screws was 5/512 = 0.0098mm.
By the way, the use of high-resolution optical encoders without a hardware scheme for working with them (the STM32 has it) is pointless. Neither interrupt processing, nor, moreover, a software poll will ever cope with the “bounce” (I say this for ATMega fans).

First of all, I wanted for the following tasks:

  1. Manual positioning on the table with high precision.
  2. Control of missed steps with control of deviation of the trajectory from the calculated one.

However, I found another application for them, albeit in a rather narrow task.

Using encoders to correct the path of a machine tool with stepper motors

I noticed that when cutting out the relief, when setting the acceleration in Z to more than a certain value, the Z axis begins to slowly but surely creep down. But, the relief cutting time with this acceleration is 20% less. At the end of the cutting of the 17x20 cm relief with a step of 0.1 mm, the cutter can go down by 1-2 mm from the calculated trajectory.
An analysis of the situation in dynamics by encoders showed that when the cutter is raised, sometimes 1-2 steps are lost.
A simple step correction algorithm using an encoder gives a deviation of no more than 0.03 mm and reduces processing time by 20%. And even a 0.1 mm protrusion on a tree is difficult to notice.

Design


Ideal for hobby purposes desktop version with a margin slightly larger than A4. And I still have enough of it.

movable table

It still remains a mystery to me why everyone chooses a design with a movable portal for desktop machines. Its only advantage is the ability to process a very long board in parts or, if you have to process material on a regular basis, the weight of which is greater than the weight of the portal.

During the entire period of operation, there has never been a need to cut out the relief on a 3-meter board in parts or make an engraving on a stone slab.

The sliding table has the following advantages for desktop machines:

  1. The design is simpler and general case, the design is more rigid.
  2. All giblets (power supplies, boards, etc.) are hung on a fixed portal, and the machine turns out to be more compact and more convenient to carry.
  3. The mass of the table and a piece of typical material for processing is significantly lower than the mass of the portal and spindle.
  4. The problem with the cables and hoses of the water cooling of the spindle practically disappears.

Spindle

I would like to note that this machine is not for power processing. CNC machine for power processing is easiest to do on the basis of a conventional milling machine.

In my opinion, a machine for power metalworking and a machine with a high-speed spindle for wood / plastics is completely different types equipment.

Create at home universal machine at least it doesn't make sense.

The choice of spindle for a machine with this type of ball screw and guides with linear bearings is unambiguous. This is a high speed spindle.

For a typical high speed spindle (20,000 rpm), milling non-ferrous metals (not even talking about steel) is an extreme mode for the spindle. Well, unless it is very necessary, and then I will eat 0.3 mm per pass with watering the coolant.
The spindle for the machine would recommend water-cooled. With it, only the “singing” of stepper motors and the gurgling of the aquarium pump in the cooling circuit are heard during operation.

What can be done on such a machine

First of all, the problem of cases went away for me. The case of any shape is milled from "plexiglas" and glued together with a solvent along ideally smooth cuts.

Fiberglass refused to be a universal material. The precision of the machine allows cutting seat under the bearing, into which it will go cold, as it should be with a slight tightness, and after that it can no longer be pulled out. Textolite gears are perfectly cut with an honest involute profile.

Woodworking (reliefs, etc.) - a wide scope for the realization of their creative impulses, or at least for the implementation of other people's impulses (ready-made models).

But I haven't tried jewelry. There is nowhere to ignite / melt / pour the flasks. Although a bar of jewelry wax is waiting in the wings.

This is my first CNC machine assembled with my own hands from available materials. The cost of the machine is about $170.

I dreamed of assembling a CNC machine for a long time. Basically, I need it for cutting plywood and plastic, cutting some details for modeling, homemade and other machines. My hands itched to assemble the machine for almost two years, during which time I collected parts, electronics and knowledge.

The machine is budget, its cost is minimal. In what follows, I will use words that ordinary person may seem very scary and it can scare away from self-built machine, but in fact it's all very simple and easy to master in a few days.

Electronics assembled on Arduino + GRBL firmware

The mechanics are the simplest, plywood frame 10mm + screws and bolts 8mm, linear guides from a metal corner 25 * 25 * 3 mm + bearings 8 * 7 * 22 mm. The Z axis runs on an M8 stud and the X and Y axes on T2.5 belts.

Spindle for CNC homemade, assembled from a brushless motor and collet clamp+ toothed belt drive. It should be noted that the spindle motor is powered by a 24 volt main power supply. IN technical specifications it is indicated that the motor is 80 amps, but in reality it consumes 4 amps under serious load. I can’t explain why this is happening, but the motor works fine and does its job.

Initially, the Z axis was on self-made linear guides from angles and bearings, later I redid it, pictures and description below.

The working space is about 45 cm in X and 33 cm in Y, 4 cm in Z. Given the first experience, I will make the next machine with large dimensions and I will put two motors on the X axis, one from each side. This is due to the large shoulder and the load on it when work is carried out at the maximum distance along the Y axis. Now there is one motor and this leads to distortion of the parts, the circle turns out to be a little elliptical due to the resulting deflection of the carriage along X.

The native bearings of the motor quickly loosened up, because they were not designed for lateral load, but it is serious here. Therefore, above and below on the axis I installed two large bearing with a diameter of 8 mm, this should have been done immediately, now there is vibration because of this.

Here in the photo you can see that the Z-axis is already on other linear guides, the description will be below.

The guides themselves are very simple design, I somehow accidentally found it on Youtube. Then this design seemed to me ideal from all sides, a minimum of effort, a minimum of details, simple assembly. But as practice has shown, these guides do not work for long. The photo shows what kind of groove formed on the Z axis after a week of my test runs of the CNC machine.

I replaced the homemade Z-axis rails with furniture ones that cost less than a dollar for two. I shortened them, left a stroke of 8 cm. There are still old guides on the X and Y axes, I won’t change them yet, I plan to cut parts for a new machine on this machine, then I’ll just disassemble this one.

A few words about cutters. I have never worked with CNC and have very little experience in milling. I bought several cutters in China, all have 3 and 4 grooves, later I realized that these cutters are good for metal, other cutters are needed for milling plywood. While new cutters cover the distance from China to Belarus, I am trying to work with what I have.

The photo shows how a 4 mm cutter burned on 10 mm birch plywood, I still don’t understand why, the plywood is clean, and on the cutter there is soot similar to pine resin.

Further on the photo there is a 2 mm four-start cutter after an attempt to mill plastic. This piece of melted plastic was then very poorly removed, biting off a little bit with wire cutters. Even at low speeds, the cutter still gets stuck, 4 grooves are clearly for metal :)

The other day my uncle had a birthday, on this occasion I decided to make a gift on my toy :)

As a gift, he made a full house of plywood. First of all, I tried to mill on foam plastic in order to check the program and not spoil the plywood.

Due to backlashes and deflections, the horseshoe was cut out only from the seventh time.

In total, this full house (in its pure form) was milled for about 5 hours + a lot of time for what was spoiled.

Somehow I published an article about the key holder, below in the photo is the same key holder, but already cut on a CNC machine. Minimum effort, maximum accuracy. Due to the backlash, the accuracy is certainly not the maximum, but I will make the second machine more rigid.

And I also cut gears out of plywood on a CNC machine, it's much more convenient and faster than cutting with a jigsaw with my own hands.

Later I also cut out square gears from plywood, they actually spin :)

The results are positive. Now I will develop a new machine, I will cut parts already on this machine, manual labor practically comes down to assembly.

You need to master the cutting of plastic, because work on a homemade robot vacuum cleaner got up. Actually, the robot also pushed me to create my own CNC. For the robot, I will cut gears and other parts from plastic.

Update: Now I buy straight cutters with two edges (3.175*2.0*12 mm), they cut without severe scuffing on both sides of the plywood.

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

Mechanical

bed
The bed of our machine is made of plastic 11-12 mm thick. The material is not critical, you can use aluminum, 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 attachment points with glue, if you use wood, you can use PVA glue.

Calipers and guides
Steel bars with a diameter of 12mm, length 200mm (on the Z axis 90mm), two pieces per axis, were used as guides. Calipers are made of textolite with dimensions 25X100X45. Textolite has three through holes, two of them for the guides and one for the nut. The guide parts are fixed with M6 screws. Supports X and Y in the upper part have 4 threaded holes for fixing the table and the Z-axis assembly.


Caliper Z
The Z axis guides are attached to the X support through a steel plate, which is transitional, plate dimensions 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 used as a rubber hose. When using a rigid shaft, the system will not work accurately. The nut is made of brass, which is glued into the caliper.


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

  • First you need to install all the guide components in the calipers and screw them to the sidewalls, which were not initially installed on the base.
  • We move the caliper along the guides until we achieve a smooth ride.
  • We tighten the bolts, fixing the guide parts.
  • We attach a caliper, a guide assembly and a sidewall to the base, we use self-tapping screws for fastening.
  • We assemble the Z assembly and, together with the adapter plate, attach it to the X caliper.
  • Next, install lead screws along with clutches.
  • We install stepper motors, connecting the motor rotor and the screw with a coupling. We pay strict attention to the fact 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 bought at any hardware store and trim to fit your needs. When using screws with M6x1 thread, the length of the nut will be 10 mm.

Machine drawings.rar

We turn to the second part of the assembly of the CNC machine with our own hands, namely to electronics.

Electronics

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

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


Control Controller
The control controller was assembled on only 3 microcircuits of the 555TM7 series. The controller does not require firmware and has a fairly simple circuit diagram, thanks to this, this CNC machine can be made by a person who is not particularly versed in electronics with his own hands.

Description and pin assignment of the LPT port connector.

Pin. Name Direction Description
1 STROBE input and output Set by PC after completion of each data transfer
2..9 DO-D7 conclusion Conclusion
10 ASC input Set to "0" by an external device after receiving a 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 scheme, 7 bits are not used. 3 engines used. You can hang a key on it to turn on the main engine (cutter or drill).

Driver for stepper motors
To control the stepper motor, a driver is used, which is an amplifier with 4 channels. The design is implemented on 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 on .


Having assembled this CNC machine with your own hands, you will become the owner of a machine capable of machining (drilling, milling) plastics. Steel engraving. Also, a home-made 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