Arduino Stepper Tutorial Schematic (อ้างอิง www.arduino-board.com/arduino/stepper-motor? )
Arduino Stepper Tutorial Schematic
There are only three parts to this circuit - Arduino Uno, driver, and stepper motor. The wiring should be 26 gauge or larger on the 12V and ground lines. The driver inputs are just 5V signal level. You must provide an external 12V power supply, plugged into the Arduino power jack. If the motor is too large, you will need to run the 12V directly to the driver board, and not run it through the Arduino.
Arduino Code
The Code
The example code is very simplistic. Setting the step rate too high will cause the motor to miss steps. A proper stepper controller accelerates from a low step rate to a high rate, and then decelerates from the high rate to a low rate. This is because inertia tries to prevent the stepper from turning at first, and then tries to keep the motor turning after the electrical drive has stopped. Acceleration and deceleration help prevent dropping steps and overshoot during starts and stops without limiting the maximum speed. It takes software to build a profile and a controller to apply the profile to the drive, but very high speeds can be had. One particular drive would turn a prism 90 degrees in 30 mS from stop to stop, accelerating to 5000 steps per second and immediately decelerating to a stop. The motor just made a "click" sound at that speed.
#include <Stepper.h> // change this to fit the number of // steps per rev for your motor. const int stepsPerRevolution = 200; Stepper stepper(stepsPerRevolution, 8, 9, 10, 11); void setup() { // set the speed at 30 rpm: stepper.setSpeed(30); } void loop() { // Turn clockwise one revolution stepper.step(stepsPerRevolution); delay(500); // Turn counterclockwise one revolution stepper.step(-stepsPerRevolution); delay(500); }
ความคิดเห็น
แสดงความคิดเห็น