top of page
Search
casseyjufkal

How to Control the Speed of a Stepper Motor Using a Potentiometer and Arduino



About a year ago I paid about EUR 20 for a WDD35 potentiometer with a linearity of 0.5%.It looks quite beautiful on the inside, with ball bearings and conductive plastic track which is milled to width for calibrating linearity. Quality costs money and you get what you pay for.




Characterising A Potentiometer With A Stepper Motor



These potentiometers are not meant to be fiddled by human hands, but are meant to be mounted on motor shafts or other machines, can rotate continuously and are rated for tens of millions of revolutions.


A curious coincidence. Not only could I set up a system like this, but I have. I am characterizing the potentiometers in an old Faro arm.My setup is a bit crazy, I happened to have a huge NSK Megatorque servo with a super high resolution encoder, so I am using that. It makes 147Nm of torque, though so I am using deliberately weak 3D printed fittings.Voltage is measured by a 32 bit SPI ADC and then an Adaffuit ItsyBitsyM4.These pots are astonishingly linear. Excel reckons the R^2 is 0.999995


This product is a carrier board or breakout board for the DRV8434S stepper motor driver from Texas Instruments (TI); we therefore recommend careful reading of the DRV8434S datasheet before using this product. This stepper motor driver lets you control one bipolar stepper motor at up to approximately 1.2 A continuous per phase without a heat sink or forced air flow (see the Power dissipation considerations section below for more information).


This version of the DRV8434S Stepper Motor Driver Carrier uses an on-board trimmer potentiometer to set the maximum current limit. Header pins are included but not soldered (see item #3767 for a version of this carrier with header pins already installed). For a version with a fixed 2 A maximum current limit see item #3768.


The driver requires a motor supply voltage of 4.5 V to 48 V to be connected across VIN and GND. This supply should be capable of delivering the expected stepper motor current. Note that supply voltages below 6 V limit the maximum settable current limit; see the Current limiting section for more details. The VSDO pin must also be supplied with the desired SPI logic voltage. The SPI interface on the DRV8434S is compatible with 1.8 V, 3.3 V, and 5 V systems.


Stepper motors typically have a step size specification (e.g. 1.8 or 200 steps per revolution), which applies to full steps. A microstepping driver such as the DRV8434S allows higher resolutions by allowing intermediate step locations, which are achieved by energizing the coils with intermediate current levels. For instance, driving a motor in quarter-step mode will give the 200-step-per-revolution motor 800 microsteps per revolution by using four different current levels.


While the DRV8434S allows control of a stepper motor through a simple step and direction interface, it must first be enabled and configured through its SPI interface after each power-up. This means that the controlling microcontroller must be capable of acting as an SPI master (either with an SPI peripheral or software SPI), and it must be connected to the SDI, SCLK, and SCS pins. While the SDO and FAULT pins are not required to use this driver, it is generally a good practice to use them to monitor for error conditions.


The rising edge of each pulse to the STEP input corresponds to one microstep of the stepper motor in the direction selected by the DIR pin. These inputs are both pulled down by default. If you just want rotation in a single direction, you can leave DIR disconnected. Stepping and direction can also both be controlled solely through SPI.


To achieve high step rates, the motor supply is typically higher than would be permissible without active current limiting. For instance, a typical stepper motor might have a maximum current rating of 1 A with a 5 Ω coil resistance, which would indicate a maximum motor supply of 5 V. Using such a motor with 9 V would allow higher step rates, but the current must actively be limited to under 1 A to prevent damage to the motor.


The DRV8434S supports such active current limiting. The trimmer potentiometer on the board can be used to set the maximum current limit, and the TRQ_DAC bits can be used to scale that maximum current limit by a configurable percentage. For example if the potentiometer is turned all the way clockwise to achieve a 2 A maximum limit and TRQ_DAC = 0b0000 (100%), the effective current limit will be 2 A. If the potentiometer is left at the maximum and TRQ_DAC = 0b1111 (6.25%), the effective current limit will be 125 mA. This is useful for adjusting the motor current on the fly, and by decreasing the current when less torque is needed you can save power and reduce heat dissipation.


Before using the driver, we recommend setting the maximum current limit at or below the current rating of your stepper motor with the current scalar at its default of 100%. One way to set the maximum current limit is to put the driver into full-step 100% current mode and then measure the current running through a single motor coil without clocking the STEP input.


So, the effective current limit in amps (A) is equal to the VREF voltage in volts (V) times the current scalar (TRQ_DAC) percentage divided by 1.32, and if you have a stepper motor rated for 1 A, for example, you can set the current limit to about 1 A by setting the reference voltage to about 1.32 V and leaving TRQ_DAC at 100%.


When the driver ships, the current limit potentiometer will not be set at the 2A maximum of the driver, or any other specific setting. It must be manually set as described above before using the driver. We also carry a version of the DRV8434S with a set 2 A maximum current limit and no potentiometer where the effective current limit is set solely through SPI.


Please note that measuring the current draw at the power supply will generally not provide an accurate measure of the coil current. Since the input voltage to the driver can be significantly higher than the coil voltage, the measured current on the power supply can be quite a bit lower than the coil current (the driver and coil basically act like a switching step-down power supply). Also, if the supply voltage is very high compared to what the motor needs to achieve the set current, the duty cycle will be very low, which also leads to significant differences between average and RMS currents. Additionally, please note that the coil current is a function of the set current limit, but it does not necessarily equal the current limit setting as the actual current through each coil changes with each microstep.


Next to stepper motors, the Permanent Magnet DC Motor (PMDC) is the most commonly used type of small direct current motor available producing a continuous rotational speed that can be easily controlled. Small DC motors ideal for use in applications were speed control is required such as in small toys, models, robots and other such electronics circuits.


Also the amplitude of the motor voltage remains constant so the motor is always at full strength. The result is that the motor can be rotated much more slowly without it stalling. So how can we produce a pulse width modulation signal to control the motor. Easy, use an Astable 555 Oscillator circuit as shown below.


While the restive value of a potentiometer can be continuously varied from 0 to 100%, rotary switches with fixed value resistors attached as you suggested can also be constructed allowing its resistive value to be in defined steps of the values you require, (eg. 25, 50, 75 and 100%). For 100% full speed, the final switch position could be connected directly to the supply voltage.


I need to control a 300W 240V DC motor, using Pulse Width Modulation to give good torque at lower speeds.I cant find a ready made controller to handle 240V.Any suggestions for a robust circuit diagram that I can build this myself.Hopefully with thanks.


For those beginning to learn about robotics, particularly in the area of building circuits, you may have come across the question of how to change the brightness of a LED, without having to keep switching parts. Quite simply, the solution to this issue is a potentiometer.


Hello,I have a question about how to use a potentiometer.Everything works fine when using the usual code of " sensorValue = analogRead pot..... analogWrite(motor, outputValue)" on arduino nano board 16Mhz.Now I have programmed an atmega328 chip at 8Mhz in order avoid using the external crystal on my circuit.Everything works just fine except the potentiometer. It is only switched from low to high.Any suggestions about this issue?RegardsNicos


By driving a known current through the potentiometer, the voltage between two terminals can be measured to find the corresponding resistance. A simple VCCS can be made with an op-amp and a MOSFET, mocked up in LTspice:


Limitations lie in the range of resistances that can be measured. Following Ohm's law, as the total resistance of the potentiometer increases the current that must be driven through the device must drop in order to produce a voltage that can be measured within the limits of my DAQ. Driving smaller currents increases the circuit's sensitivity to noise and voltage offsets, requiring more thought on how to achieve good performance.


Stepper motors can be viewed as electric motors without commentators. Typically all windings in the motor are part of the stator and the rotor is permanent magnet or in the case of variable reluctance motors, a toothed block of some magneti- cally soft material. All of the commutation must be handled externally by the motor controller, and typically, the motors and controllers are designed so that the motor may be held in any fixed position as well as being rotated one way or the other [1,trol. Stepper systems are economical to implement, intuitive to control, and have good low speed torque, making them ideal for many low power, computer-controlled applications. They can be for example interfaced to computer using few transistors and made to rotate using a small piece of software. Stepper mo- tors provide good position repeatability. Stepper motors are used in robotics control and in computer accessories (disk drives, printers, scanners etc.). 2ff7e9595c


0 views0 comments

Recent Posts

See All

Comments


bottom of page