Download PDF
      SAMOVAR                                  
×
Menu

Driver. Stepper Motor.

Samovar 7.00: the motor direction and smooth acceleration are set on the "Stepper motor" («Шаговый двигатель») tab of the configurator.
 
 
 
The project uses stepper motor drivers (hereinafter the motor)  A4988 or DRV8825.
Which driver to choose? Read this article to get an idea of the subject; the main differences between these drivers are given at the end.
 
It is best to install the driver the same way as the ESP32 - on a pin header.
Before setting up the driver, the ESP32 must be installed on the board  and the Samovar sketch must be uploaded to it.
Do not connect the power or the motor.
 Take the driver, going by the pin labels on the driver board and the printed circuit board, and insert it into the header.
Check with a multimeter in continuity mode. The GND pins must be at ground, VMOT must have +12 volts from the VIN power connector, and VDD must have +3.3 from the first pin of the ESP32.
Apply 12 volts of power to the VIN connector. You can check once more that the voltages are present.
 
The printed circuit board has switches for the driver:
- H1 - connect all three pins
- SW1 - if there are switches, set them all to the OFF position. If there are no switches - do not install the jumpers yet.
 
Now the driver needs to be set up.
Do not connect the motor.
A driver is a delicate thing. There are even recommendations to set it up with the power turned off.
That is, turn the trimmer resistor a little, apply power, measure the voltage, remove power - turn it again. And so on all the time, until you set the value you need.
There is another, faster way.
A screwdriver with an insulated handle. Connect one multimeter probe  anywhere on the printed circuit board to ground (GND), and with the other either carefully touch the trimmer and turn the wiper with the screwdriver, or put an "alligator clip" on the probe, clip it to the screwdriver tip and turn the screwdriver through the clip.
 
See the setup procedure at the links.
 
 
Connecting the stepper motor.
 
The project uses a bipolar NEMA17 stepper motor. First check that the motor matches the project.
Bipolar motors have two independent windings. Motors from different manufacturers may have different pin layouts.
 
 
Connect the connector with wires that came in the kit to the motor, take any wire and use the multimeter continuity test  to find its pair. This is one winding. Mark both wires. Check the second pair. If it beeps, good.
Now take any wire from one pair and any wire from the second. Test them. They must not beep. If they do beep, it is not a bipolar motor.
 
Now connect the motor to the connector on the printed circuit board.  According to the picture above 1A-1B is one winding, 2A-2B is the other. "A" is the start of a winding and "B" is the end. You can, of course, connect strictly by the labels, but it is not necessary.
The main thing is to connect one winding to  pins 1A-1B of the driver and the second to 2A-2B. It does not matter which goes where, and it does not matter whether it is the start of the winding  or the end.
Connected. Apply power. The motor does not turn. Open the web interface and give the take-off command.
The motor shaft should start to turn.

The motor hums and does not turn; the motor turns in jerks
 
Remember to select the motor operating modes with the power of the Samovar printed circuit board completely disconnected.)
 

 If the shaft turns in the wrong direction, swap the wires of either winding at the connection to the board.
 
Note.
In the file
Samovar_ini.h contains a line that lets you change the rotation in software:
  //#define STEPPER_REVERSE     //change the stepper motor rotation direction
In the configurator this is the "Reverse stepper motor direction" («Обратное направление шагового двигателя») checkbox on the "Stepper motor" («Шаговый двигатель») tab; the same tab has "Smooth stepper motor acceleration" («Плавный разгон шагового двигателя») (USE_STEPPER_ACCELERATION). But it is more convenient to swap the wires once than to watch the parameter at every update.
 
Run the motor at different speeds through the take-off program. Set the take-off to 70-150 ml/h. Hold the motor body with one hand and try to stop the shaft with the other; if the shaft stops easily, go back to the driver settings and raise the voltage a little, literally by 0.02-0.04 volts.
Check again how easily the shaft can be stopped.
Glue the heat sink that comes in the kit onto the driver chip.
 
Now you can install the pump head. First lubricate the rollers and the tube with neutral silicone grease.  Lubrication will need to be done periodically (once every 5-7 distillation runs); this extends the life of the rollers and the tube, and the motor will have an easier time too.
Run it with the pump, see whether there are any stops, whether the motor sounds overloaded, and how hot the motor and the driver chip heat sink get...
 
Now you can move on to fine tuning, if it is needed.
 
A little theory.
Unlike traditional DC and AC motors, stepper motors move in discrete steps or increments, hence the name "stepper".
Each step of a stepper motor corresponds to a precise angular rotation. Typically the step angles of stepper motors are 1.8° or 0.9°, which corresponds to a full revolution divided into 200 or 400 steps respectively.

Standard NEMA17 motors have a rotation angle of 1.8° per step (200 steps per full revolution)
The motor can work in several modes - full-step and microstep.
Full-step mode is when the motor turns the shaft by 1.8° in 1 step
In full-step mode the motor has the highest torque of all the modes.
 
Microstepping  is dividing the standard step into several microsteps. The standard step can be divided into 2, 4, 8, 16 and 32 parts
The step division can be set with the SW1 switches
 
MS1, MS2, MS3 – microstep resolution selection pins. With them we can choose one of five modes:
 
For the A4988 driver
MS1
MS2
MS2
Steps
off
off
off
Full
on
off
off
1/2
off
on
off
1/4
on
on
off
1/8
on
on
on
1/16
 
For the DRV8825 driver
MS1
MS2
MS2
Steps
off
off
off
Full
on
off
off
1/2
off
on
off
1/4
on
on
off
1/8
off
off
on
1/16
on
on
on
1/32
Explanation.
Suppose the 1/4 mode is chosen. Then in 1 microstep the motor shaft will turn by 1.8°/4 = 0.45°, which corresponds to 200*4 = 800 (or, counting differently, 360°/0.45° = 800)  microsteps per 1 full revolution of the shaft.
 
In microstep mode the motor has reduced torque but increased smoothness and accuracy (which is not particularly important for the project)
Stepper motors in full-step mode produce higher levels of vibration and noise.
Microstepping significantly reduces vibration and noise, which makes the motor run more smoothly and quietly.
 
 In general, watch and listen to how your motor works. You can try different modes and compare them.

Attention.
The motor operating modes are selected with the power of the Samovar printed circuit board completely disconnected.
 
After you decide on the motor operating mode and set the DIP switches to the right position (or finally solder the jumpers), you will need to calibrate the pump.  The calibration must be repeated every time you decide to change the motor operating mode.
The accuracy of take-off is also affected by how regularly the pump is lubricated. The less often you lubricate, the lower the actual take-off rate.
 
Differences between the DRV8825 and A4988 motor drivers
( in simple terms, without specific details )
 
 

Reference information.