Stepper motors (Steppers)
ATTENTION: To enable the Pin type Stepper, Stepper_Dir and Pwm_Fast you must use at least theversion 5.0 the HAL, and the form Theremino Master should be updated with the firmware 3.2 or later.
To find out what firmware you have just use the latest HAL, connect the Master and count the pins. The original firmware only had six pins, from version 3.2 they 10 and since version 4 they 12.
The latest firmware (4.0) Add six new Master Pin (passing by 6 PIN to 12 PIN). Therefore, with every Master module, You can control, from three engines plus six generic pin up to five engines plus two generic pin. Optionally you can add additional masters and Slaves.
Stepper control features with firmware Theremino:
- Ultra management-simple thereminico style.
- The software must send only one given, the destination in millimeters (Note 1)
- Useful working range from -10 to +10 Km (kilometers) (with steps for mm = 200)
- Managing up to five axes CNC machines.
- RepRap type machines management up to six engines (x, y, z, According to z gantry and two extruders). You can then extrude two colors.
- In addition 65 KHz maximum frequency on all five engines simultaneously (Note 2)
- Jitter of less than 20 nano seconds (Note 3)
- Adjustable maximum speed (from 1 to 18000 mm/min) (Note 4)
- Adjustable maximum acceleration (from 5 to 1000 mm/s/s) (Note 4)
- Audit reports the position reached, in millimeters, for each axis (Note 5)
- Possibility of using independent or coordinated axes in 2D and in 3D (Note 6)
- With coordinate axes in 2D or 3D, Write applications to control made easy. You do not need to calculate acceleration and speed. You can send simple target commands, in millimeters. (Note 7)
- Pulses with automatic width. Operation is simplified and doesn't risk step loss, caused by an incorrect setting of this parameter. You can use photo-couplers lenses, If you limit the max speed (Note 8)
- Automatic polarity. Operation is simplified and you avoid step loss, caused by incorrect setting of this parameter (Note 9)
(Note 1) Simple applications send only the final destination, but advanced applications can precisely specify the path and the working speed. Sending intermediate destinations with sufficient frequency (at least 100 per second) you get smooth motion. The firmware implements a continuous supervision of the route and if errors, avoid losing steps “cutting curves”.(Note 2) As comparison: With Mach3 working normally until 25 KHz (going further you start to fry your CPU and Windows is becoming increasingly slow and unstable) (Note 3) As comparison: Mach3 has a Jitter 500 times greater (from 2 to 15 us depending on the PC). Have a very low Jitter, allows you to work at maximum speed without risking losing steps. Timing defects than Mach3 are well explained in this article. (Note 4) The firmware protects the motor from each error. If your PC stops responding for some time, the firmware slowly comes, without losing steps. The same applies if the data is sent with irregular timing or contain errors. (Note 5) The software can read the missing distance, every millisecond, for each axis and with high precision (fraction of a thousandth of a millimeter). You do not need to use this information, but some applications may find it very comfortable. May be useful for diagnostic purposes, or for algorithms that must meet a specified tolerance. With this information the software can work with closed loop and always at maximum speed. Continually checking distance of each engine by the target, the software can slow down exactly when you need it, without doing complex calculations of speed, trajectories and accelerations. (Note 6) In version 5.0 the HAL axis coordination is not complete. Important applications take care of themselves, We are therefore focusing on the CNC Theremino application, and only after we finish the axes coordination. (Note 7) The intermediate destinations are reset, up to 500-1000 times per second. The best route, is continuously recalculated. The control algorithm takes into account, the actual positions from each engine and maximum acceleration that can withstand. Although the CNC application calculates wrong path, you avoid in any case to lose steps. (Note 8) Usually you have to specify the width of the pulses (with Mach3 from 1 to 15 uS). This is a poorly understood and many users regulate it randomly. Use wide pulses allows placing electronic devices lenses, as some photo-couplers (for example the cheap 4N25, 4N26 and 4N27). But baggy impulses restrict the maximum usable. Theremino rule this time 50 uS (allowing you to use sluggish electronics for slower machines), but reduces it automatically if you use high speeds and high values of microstep. To a minimum of 7.7 uS, When using the maximum frequency (65.535 KHz). (Note 9) With other pulse generators (such as Mach3) you have to specify the polarity of the pulse. In order to set it you must know if the driver acts on the rising edge or descent. This information is not always available and if you get it wrong can happen sporadically step loss, very difficult to spot. Theoretically using the wrong front should not cause any problems, because at every rising edge, necessarily follows a falling edge. But, If the direction sign is updated at the wrong time, may lose steps, or take additional steps. The firmware of Theremino Master controls the direction sign with care. The signal can also be used to drive drivers (a minority) acting on falling edge. Eliminating this adjustment, the use is easier and eliminates the risk of losing steps.Set the Pin type Stepper in application HAL
Each stepper motor needs two physical Pin, one STEP and one for the management. The microcontroller would place the Pin to pleasure, but we decided to limit confusion, by specifying preset positions, for Pin-type Stepper and Stepper_Dir.
The Pin type Stepper reading from a value, which is simply the destination in mm. Simple applications, can specify a destination far away, and let it do all the firmware. Most demanding applications, can calculate their own path and send frequent intermediate destinations. With this technique, an application can check the working speed (feed), and determine precisely the path, even in multiple dimensions. To get smooth motion just 20 destinations per second (up to 50 for the most demanding applications).
Reverse an axis:To reverse the direction of movement of an axis, they swap the values “1000” and “0”, of boxes “1000 means mm” and “0 means mm”.
Specific parameters of the Pin type Stepper:Max Speed – This is the fastest speed, in millimeters per minute. The firmware continuously checks the destinations sent by software. If the software is asking too much for the engine, the firmware restricts his speed, to avoid losing steps. Raise this value until you see that the motor will lose steps (It makes a high pitched noise and stops) and then decrease it by a 20..50%, to return to a safe area. Repeat the tests under load, or by braking the motor manually, so make sure you have some room.
Max Acc – This is the maximum acceleration (and deceleration), in millimeters per minute. The firmware continuously checks the destinations sent by software. If the software is asking too much for the engine, the firmware restricts its acceleration, to avoid losing steps. Raise this value until you see that the motor will lose steps during changes of direction (It makes a high pitched noise and stops) and then decrease it by a 20..50%, to return to a safe area. Repeat the tests under load, or by braking the motor manually, so make sure you have some room.
Steps for mm – Here you have to set the step, the engine is in a spin, multiplied by the microstep, set in the controller, and divided into millimeters, produced by a rotation of motor. If each spin, produces a millimeter of movement, and the engine is a 200 steps per revolution, and don't use the microstep, then you set the value: 200 (steps per revolution) x 1 (microstep) / 1 (mm per revolution) = 200. If using sixteen microstep then you set the value: 200 (steps per revolution) x 16 (microstep) / 1 (mm per revolution) = 3200.
Linked to previous – By enabling this check box, the motor is connected to the previous, and is therefore part of a pool, running 2D tweens, 3D, 4D or 5 d. Without this interpolation, the engine needs to do less road, arrive early and then the path, would a broken line, composed of two or more segments. By enabling the interpolation, the speed of all motors is coordinated, so that the actual trajectory, is a straight line. Taking advantage of this coordination, the control software can, in some cases, simplify considerably (in the current version of HAL axis coordination is not implemented, the finish in upcoming releases)
Feb update 2015: Maybe this option is not as important, as we thought at the beginning. We'll probably end up before other more pressing projects. Possibly write to us, If you urgently need.
The Pin type Stepper_Dir have no parameters to adjust. I'm just a placeholder for the physical output Pin, establishing the direction of the motor. It is not necessary to use the value, that these pins are writing into the Slot, but some applications may find it useful. The value that is written into the slot, is the distance to the destination, in millimeters (and up to fractions of a thousandth of a millimeter). This information can be used for diagnostic purposes, or for algorithms that must meet a specified tolerance. With this information the software can work with closed loop and always at maximum speed. Continually checking distance of each engine by the target, the software can slow down exactly when you need it, without doing complex calculations of speed, trajectories and accelerations.
View the details of the PinPin details show the acceleration and top speed in Hz (steps per second). These values are useful to design electronics, During testing and to determine how many micro-step use. In some cases, It can be useful to know the rough target (in steps), in place of destination in mm.
In application HAL, Double click on the line of the Pin (Stepper type). In the second window, at the bottom, you read the details of the selected Pin. Click on the image for a larger view.
Video showing the accuracy of impulses produced by the Master module, than Mach3Videos on YouTube: http://www.youtube.com/embed/CeC5WD4866o?fs=1&rel=0&loop=1&hd=1&autoplay=1
In this video we see the heeling over time, the period between an impulse and subsequent. The scale of the two videos is the same, 100 NS for square. The Theremino Master produces pulses, with a slip of only 20 nano seconds. Instead Mach3 continually exceeds 2 micro seconds and in the worst moments come to 10 micro seconds. If you are travelling to 25 KHz, heeling of Theremino Master is only the 0.05%, While the Mach3 is equal to 25%. When you exceed the 10% stepper motors are beginning to suffer and can lose steps. In slower machines jittering Mach3 is harmless and use micro-steps improves the situation. In all cases, however,, in the presence of Jitter, You must decrease the maximum speed. For more information, timing defects than Mach3 (and even worse on defects of LinuxCNC – EMC2), read This article and especially look l’image at the bottom of this page.
Protractor for stepper motorsDownload the image with the right mouse button.
This Protractor by 200 steps (1.8 degrees per step), It is useful to control the operation, stepper motors. We have long sought on the Web, and in the end we had to let us. The current print sizes (75 x 75 mm) are for Nema motors 23. With a program for drawing, or with the printer settings, You can adjust the size, to smaller engines, or larger. The Protractor can be printed, with an inkjet printer, on cardboard.
Hack the goniometer Theremino CNCWe have transformed the image of the goniometer in GCode (with “Theremino ImgToGcode“). The GCode is among the “Engraving examples”, Theremino CNC, and it's called “StepperMotor Protractor gc”.
As a basis we recommend plexiglas, or coloured plastic.
To get maximum exposure, Glue a sheet of thin plastic, on a thick sheet, different color and affect only the top sheet.
Recommendations for stepper motorsAs a basic principle that the engines must be avoided “sgranino” (you hear a “Natasha” and the engine plant). If an engine shells the workpiece gets corrupted. There is no way to go back and throw the piece. Besides losing hours of machine time you lose the semis.
To make sure you don't miss steps proceed so: increase each adjustment, one at a time, until the engine shells and then go back one 30%, or even 50% to be on the safe side. The regulations are: maximum speed and Acceleration (in HAL). For optimum performance you should also adjust the current to the motor (a trimmer on the module driver). The small trimmer should be shot with a suitable screwdriver and very carefully. If the screwdriver escapes and makes a short circuit, the driver instantly fries (and sometimes breaks out).
If the driver permits it is always good to set the micro-steps at least to 4. If you do not use the micro-step motor produces strong vibrations. Mechanical resonances, triggered by vibration, can cause you to lose steps even at very low speeds. To avoid this you should increase the current to the motor, but this would limit the maximum speed.
Limit mechanical friction and add flexible couplings to prevent the engine from efforts due to the inevitable small off-axis errors. Furthermore the couplings are decoupling the engine from resonances of the mechanical parts of the machine. If the mechanics are well made and the motor runs free, current can be reduced and that's always a plus.
Minimize the current on the motor it is important. You should not set the Max current! The current specified by the manufacturer is not the power that you have to use. But this is the maximum current, beyond which the engine heat up so much to ruin. Reducing working current, minimizing vibration and increases the maximum speed. The best operating current, It is usually about a quarter of that shown on the motor.
In the presence of strong friction we are forced to increase the current. But this increase has a beneficial effect, only at low speeds. At high speeds you don't get improvements. Indeed, the danger of losing distance increases and you are forced to limit the maximum speed.
Drivers for steppersSteppers cannot be fed directly as you do with the Servo. You must add a driver. We recommend that you avoid the old design drivers that contain the integrated SA1042, SA1027, Uln2003, L297 and similar. Best drivers contain A4988 chips produced by Allegro.
The maximum voltage of A4988 is 35 Volts (so it is recommended to feed them to 24 Volts) and the maximum current is 2 Ampere (but in this case it takes a heat sink and a fan that blows air from above on all drivers)
The drivers are not adjusted to the current maximum bearable by the engine!!! The current shown on the motor is the most, beyond which the motors would damage!
If the engines are from 1 Then the current is ampere right 250 but and 500 mA. So the engine does not heat, the drivers little heat and the maximum speed increases.
Reducing the current is reduced a little’ the couple, but engines run smoother and allow a maximum speed greater than, before shelling. To adjust the trimmers of current, always use a plastic screwdriver, otherwise you may burn the drivers or to start the fuse CncShield tab.
The drivers are acquired on Thereminostore o r on eBayDriver A4988 DRV8825
The DRV8825 are perfectly compatible with the A4988, but you should be careful which have to be assembled on the contrary (see the following images).
It is recommended that, both 4988 that the 8825, with voltage 12 or 24 Volts and no more. With 24 Volts maximum speed is slightly higher. The 36 Volt is best not to use them because the 4988 don't hold them right and the 8825 would work too close to the limit.
You should not use them at current greater than 1 Ampere. Maximum 2 Ampere, but with every dissipators on drivers and a single fan that cools them all from above.
Although in these pictures the A4988 appear without heatsink, almost all sellers offer them with the heatsink.
The latest tests also appear more reliable and cost drivers less A4988 DRV8825 (about 3 Euro on thereminostore)
The A4988 are also for sale from Pololu, without heatsink, for about 5 Euro: http://www.pololu.com/product/1182
Which controller to use for stepper motors?Are definitely avoid the cnc-controller with drivers welded on one plate. The first flaw you have to throw the whole controller. So you spend a lot, You'll waste and pollute, even going against our principles to limit waste.
Drivers can break easily (just a momentary bad contact on an engine) and you cannot replace the chips on the plate, then you throw away the entire controller-dtiver, you lose hundreds of dollars and stop the car takes a long time. It is also not possible to weld new drivers on a plate, so if we start, for example,, with three drivers, You can add a fourth and a fifth. This will lead to produce controller with four or five drivers, even if the fourth and fifth are never used, going back against our principles to limit waste.
A good solution is to use drivers with the connectors, so I can replace or add easily.
Rediculously replacement drivers (about 3 Euro) and replace in thirty seconds. If you buy a spare and you have ensured that the machine will never stop.
Do not be fooled by salespeople who do not publish schematics and “Let think” that their drivers are better. When you go to check the chips are the same as these drivers, It's always great A4988 (or equivalent) products from Allegro.
And do you also attention to the controller soldered directly onto the main printed circuit board, No cooling fan and heatsink-less chip. The chips will warm a lot, increasing the probability of failure and losing the entire controller.
Driver Board – A support base for driversDon't buy expensive cnc-controller with the chip directly soldered on board! The drivers must always be replaceable, as in Driver Board of these images.
Recommend that you keep the maximum modularity, to allow future changes, improvements and replacements. Or with Breadboard and sideburns Dupont leads, or with DriverBoards as "Ramps", that costing very little (5 Euro) or with a CncShieldV3, that It also costs less (It is also found on eBay for less than 3 Euro).
Plates as the Ramps and the CncShieldV3, are not built specifically for the sistemaTheremino, to make the connections refer to the wiring diagrams. If in doubt please email us.
Posizionare i driver sulla CncShieldV3 e sulla RampsThese images are only valid for the drivers DRV8825, sure that the A4988 must be inserted with the trimmer across. For other drivers check manufacturer's website.
ATTENTION: To enable the engines ENABLE signal must be connected to GND. So always put a jumper on “EN / GND”. If you forget to do this the search engines do not move.
In this picture you can see an example of wiring between Master and CncShieldV3.
In this wiring nine master Pin assignments are linked to four drivers and five InOut “of service”. The InOut can serve to control the ignition of the spindle motor and to read the bottom switch. Doesnít, still available three more InOut, on the Master.
Signal wires can be unplugged and moved at any time, even with everything turned on, but since there's a big, bad power supply connected to 220 Volts, you have to be very careful that the ground wire, between CncShield and Master, are shorts, strong and always connected.
Connections between the Master and drivers ThereminoHere we explain how to connect directly the Master drivers, without using a Driver-Board.
Drivers A4988M0(Ms1)M1(MS2)M2(Ms3)Microstep settingsDrv8825Microstep settingsA4988LowLowLowFull stepFull stepHighLowLowHalf stepHalf stepLowHighLow1/4 step1/4 stepHighHighLow1/8 step1/8 stepLowLowHigh1/16 step–HighLowHigh1/32 step–LowHighHigh1/32 step–HighHighHigh1/32 step1/16 step
Low means: “Connected to GND” i.e. “Unjumpered” Alto means: “Connected to positive” i.e. “With bridge”
CncShield tabs and Ramps bridges lead to positive signals, so with all three jumpers removed you get “Full step”. Always use 8, 16 or 32 microstep, then insert the first two bridges or the last, or even all three. And remember to multiply, in HAL, the value “Steps for mm” for the number of micro-steps set.
ATTENTION: Some cards (Ramps 1.4 Some manufacturers), have the jumpers microstep selection not working. Some evil genius has altered the PCB to set them to fixed 16 microstep (why so serve in 3D printers). Just check with a tester selection jumper pins, If the pairs of pins are shorted, then it's one of these cards. In this case by removing the plastic bridges, with patience and with the Dremel, You can correct the PCB.
Adjust the trimmer to the current limitingA4988 module, product to Pololu, The trimmer is from 10 Kohm and is connected to the 5 Volts with a resistor from 20 Kohm. Whereby the reference voltage, with the trimmer at maximum, is of 1.6 Volts. This reference is divided by eight internally on the chip and then compared with resistors 0.05 ohm resistor. Then you get a current equal to two and a half times the reference voltage.
On form DRV8825, produced by Pololu, The trimmer is from 10 Kohm and is connected to the 3.3 Volts stabilized. Whereby the reference voltage, with the trimmer at maximum, is of 3.3 Volts. This reference is divided by five inside the chip and then compared with resistors 0.1 ohm resistor. Then you get a current equal to twice the reference voltage.
The reference voltage is measured by a tester with the negative to GND and the positive on center of trimmer.
These are the current regulations that are obtained:
Position of trimmersA4988Drv8825At most4.0 Ampere6.6 AmpereThree-fourths3.0 Ampere4.9 AmpereA two-thirds2.7 Ampere4.4 AmpereIn mid-2.0 Ampere3.3 AmpereIn a third1.3 Ampere2.2 AmpereIn a quarter1.0 Ampere1.6 AmpereZero0 Ampere0 Ampere
ATTENTION: As you can see, who designed these forms has completely missed the full scale. The maximum current bearable (even with the maximum of heatsinks and fans) is of 2 Amperes for 4988, and 2.2 Amperes for 8825.
The full scale of the trimmer is so two or three times greater than what would be reasonable. With a full scale so high the trimmer adjustment becomes two or three times harder. So be very careful to never go more than half (with the 4988) and never more than one-third (representing the 8825).
In addition, just to make the adjustment even harder, some trimmers have no mechanical background. You get to zero, the pass without noticing and you switch from ’ other side, giving the maximum current and immediately jump fuses and drivers.
SUPER ATTENTION: There are drivers with the trimmers that acts on the contrary. Whereby before trusting their drivers, It is good to measure the voltage trimmer. Adjusting to a minimum, counterclockwise, the tension should be minimal (from zero volts up to 100 millivolts). By adjusting the maximum, clockwise, the voltage should be maximum (from 1.5 to 3.3 Volts depending on the driver). If it doesn't take great care to use those drivers, always remember that act contrary (who made those PCBS should be transferred to the Department “sewer cleaning”, before he can do any more damage).
To adjust the trimmer you can proceed in one of three waysMETHOD 1 – SLOW: This method is suitable for precision lovers, wanting to know the numeric value of the current. Apply voltage to the drivers (even the 12 or 24 Volts that you need to feed internally on 5 Volts of some drivers) but do not connect the motors. Measure the voltage between ground and the metal part of the trimmer. Adjust the voltage to obtain a current that is half the rated current (= two and a half times the voltage, with 4988, or 2 times the voltage, with the 8825). Then begin to make tests up or down, always measured with meter for each test. Use a suitable screwdriver (better plastic) and be very careful. Of course for every test you should remove the power, disconnect and reconnect the power engines. Why this method is very slow.
METHOD 2 – FOR EXPERTS: Set the trimmers to eye, According to the current table. Then from one quarter and never go more than half (with the 4988) and never more than one-third (representing the 8825). To determine location make sure you where is the minimum (use lots of light and a good lens).
METHOD 3 – FOR EXPERTS: Mark the tip of the trimmer (opposite the flat spot), with a small sign of Sharpie. Procure a plastic screwdriver, lots of light and goggles. Turn the trimmer about a quarter, or less, before powering. Try the engine repeatedly, in order to get the maximum speed and power (If you increase the current increases the torque, but with too much current maximum speed decreases). Rises gradually the speed, until the engine shells and stops, then you try to move it several times and to amend the current to make it go better. With a little’ experience you can hear the sweet spot, listening to the sound of engines. The adjustments are done with micro-steps set permanently.
Who knows English well might also look this cute video of Pololu that explains how to adjust the trimmers.
Considerations that apply to all driversA single Theremino Master can control up to five stepper motors. The two wires red and black, that lead “+ 5 Volts” and “GND” the first driver, food can also be continued and other drivers.
Always connect, at least the wire GND, between the Master and the drivers. Also remember to connect “Reset” with “Sleep”.
ATTENTION: Always connect a capacitor to 100 UF between “VMOT” and “GND”. The electrolytic capacitor must be, Not type “Low ESR”, with the positive hooked up to “+”, It must be near the module driver (up a few centimeters). The operating voltage of the capacitor, must be at least 5 Volt more, motor power supply voltage.
In the absence of this capacitor, You can create extra hazardous voltages, that can cause you to lose the USB communication, damage the drivers and also damage the Master.
In this particular case, to avoid resonance phenomena produced by the high inductance present, do not use low resistance electrolytic capacitors in series (Low ESR), but the communes 100 uF, with approximately 1 ohm serial resistance. Read the warnings of Pololu on these pages: https://www.pololu.com/docs/0J16/all https://www.pololu.com/product/1182
Before powering everything must be connected reliably. If it comes off a wire motor, or link GND, A4988 driver becomes corrupted. If turning the trimmer does a short with the screwdriver, the driver instantly bursts. In some cases his chip explodes and sets off to smoke. The Theremino Master should withstand these tortures, but it's best not to put it to the test.
This is not to say, that the drivers are unreliable. If you do not make mistakes, never break.
However we recommend to always connect the drivers, with male and female connectors, for quick and easy replacement. We recommend that you buy five or ten, to get a little’ Commons, and bring down the price.
Connect to the machines with the parallel portDisconnect the ignition cable from the parallel, you connect it to Theremino CNC Adapter, and we start working right away. This adapter can be used for Mach3 or LinuxCNC (with the appropriate PlugIn), but better yet, with the application Theremino CNC, It is much easier to use.
Comments