The Stack Overflow podcast is back! Listen to an interview with our new CEO.

Hot answers tagged

4

use disable output class in accelstepper library. http://www.airspayce.com/mikem/arduino/AccelStepper/


4

Generating a linear frequency ramp with accurate timings is not an easy task. I am providing here only a partial answer, where I first go through the math of the problem, then give some ideas for the implementation. The math We are dealing with a frequency-modulated signal, with the frequency ramping linearly from f = 0 at t = 0 up to a ...


4

stepper.step(num)is used to rotate your motor 'num'-step. i.e. num=25, then calling stepper.step will cause your motor do 25-step. STEPS is number of steps per revolution for your motor. It will be depending on the motor you used. For more information, you can check here. You have to check for your motor stepper resolution. Most common motor stepper has ...


4

First you have to compare the pinouts of the two shields. If the shields use completely different pins then yes, you can use them together. However if they share pins then you need to look in more detail at what those pins are and how they are being used. In your example you have SPI being used (pins 10-13) for one shield and PWM (3/11) and GPIO (8/9/12/13)...


4

In setup(), add randomSeed(analogRead(0)); This reads the value of an analog input pin, which if not connected, will float to relatively random values between 0 and 1023. This "seeds" the random number generator so the pattern of random numbers you will get later doesn't always give the same results each time you start the sketch. In your delay() call, ...


4

I had this issue myself, when I tried to use these stepper motors (which are to be honest really crappy ones, but very cheap). Vibrating mostly means, that the phases of the motor are not activated in the correct order. These motors seem to work with an activation pattern for half steps (I don't know, if the motor is really doing half steps with this, ...


3

1) it is probably something like A1, A2, Common, B1, B2. You could confirm this with an ohmmeter. Common to any of the others would be a certain resistance X, while between any of the others (A1-A2, B1-B2, A1-B1, A1-B2, B1 A2) would be 2X. 2) You can't. It is a unipolar stepper. The EasyDriver faq number 5.1 at http://www.schmalzhaus.com/EasyDriver/ ...


3

It would be more accurate to say that it can be used as part of a microstepping system, though it's probably not a good choice for any use today. The L293D is merely an (effectively obsolete implementation of an) H-bridge, not a stepper motor sequencer, hence it is no more capable of autonomously driving a motor in full or half step mode than it is of ...


3

Manually set the ENABLE pins as OUTPUTs, i.e. add in the setup() function: pinMode(MOTOR_A_ENABLE_PIN, OUTPUT); pinMode(MOTOR_B_ENABLE_PIN, OUTPUT);


3

I'd look for a proper stepper driver, e.g. something based on A4988 or similar. I wasted a fair amount of time on the Adafruit motor-shield 2.3 until I finally abandoned it after failing to achieve higher speeds (I also had lots of issues with the motor getting hot). The A4988 takes care of step sequencing including micro-stepping and interfacing and ...


3

As mentioned in comments and other answers, using timer 1 for hardware-timed bit toggling is likely to produce better results than code using delays based on calls like delayMicroseconds(), primarily because of overhead causing poor resolution or jitter. Using timer 1 in a PWM mode offers an advantage: loading of the OCR1A register is double buffered in PWM ...


3

Have you searched for other libraries or example code for this particular sensor? I found this NewPing library that claims to have been developed to fix poor performance of such modules due to poor timing methods.


3

Make CTR static or place it in the global scope. As it stands you set it to 0 every time you go through loop. The line: int ctr = 0; literally means "Create a new variable on the stack called 'ctr' and give it the value 0", and that happens every time loop() is executed. Instead making it static will change it so that it only happens the first time loop()...


3

Connect it to an IO port and set it to OUTPUT and LOW. That's what it means to "pull low". It helps if you understand how an IO port works. This may help you.


3

The step function from the Stepper library is blocking. So it can only run one motor at a time. You need a different stepper library that is non-blocking. Try AccelStepper.


3

Convert the RPM of the motor to RPS. Take reciprocal to get seconds per revolution. Divide it by 360 to get seconds per degree. Multiply by 1.8 to get seconds per step.


2

You need a struct for each stepper with a timestamp, a position and rate of change and a loop that updates the postion based on rate which is the change in position over some time: struct stepper { unsigned long timestamp; int position; int rate; }; // init steppers array while (keepGoing()) { unsigned long now = millis(); int si; delay(10); ...


2

I have two ideas: I don't have personal experience working with the AccelStepper Library, but I believe it implements a class that allows you to work with multiple steppers. I plan on controlling two steppers for a project of my own (a self-balancing robot implemented with an STM32 processor), and I plan on using hardware timer interrupts to control the ...


2

I don't quite understand the problem. A arduino mega would have no problem controlling 9 of these steppers alone. If you are asking about i2c protocol please be more specific about what you need help with.


2

According to Pololu's website, the VMOT pin needs at least 8V to function. Try a 12V switching (important!) wall wart supply that can supply at least 1A instead of your USB supply. Avoid supplies that can deliver currents >3A, as they are overkill for a small stepper motor and can be dangerous if shorted. Be sure to put a large (100uF is good) capacitor ...


2

How did you set the amps on the http://www.schmalzhaus.com/EasyDriver/ to 0.5A? What was the voltage at the test point? The EasyDriver v4.5 schematic says the formula for coil current is A = V/6. So rearranging, V=A*6, and to get 0.5A, the voltage should be 0.5*6=3V at the motor driver's test point. The linked motor spec is 0.6A max per coil, and if ...


2

On stepper motors there are a few types of wiring, but essentially there are two coils inside the stepper motor. To figure out where the wiring is you need a way to test if the coils are being connected. On your setup I would suggest to connect two of the wires together at a time and spin the shaft. If the shaft offers resistance then you have found the two ...


2

Since microcontrollers typically only have one "core" or "thread" they can only do "one thing at a time". A microcontroller will step through your code and do everything in order (if you don't call interrupts). Basically, when you put in a for-loop (or any other type of loop) or a delay, it will only continue with the rest of your code when that is done. ...


2

You could try something along these lines, I haven't put all of the code in, but just how this could be done for the sweep timer using millis(). unsigned long sweepTime; unsigned long animationTime; int stepperPosition; void setup() { //... other setup code sweepTime = millis(); // initialise the variables for the sweep timer, and the ...


2

The basic pattern goes like this: when you start the timer, you essentially store the current millisecond. After this, in your loop code, among other things you should check if the time has passed by comparing current millisecond with the stored one. If their difference is equal or bigger of the desired delay interval, then the time has passed. Make sure ...


2

As this link states: Stepper motors are normally used for positioning, and are not known for their speed. However, the link is to an on line stepping motor speed calculator. As for the size of the step, this is a function of the way the stepping motor is built. Some controllers / stepping motor combinations can do half steps or micro steps. Disable ...


2

You must set EN BEFORE you set DIR. The datasheet says EN must be high for at least 5 microseconds before you set DIR. You should probably just set EN high when your program starts, then not fool with it until your program ends. The next thing is that I don't see you incrementing the variable "step" anywhere. So, if you did get the stepper to turn, it ...


2

Steppers require current - and power, due to I^2*R losses) to hold a position. Power off, they free-wheel. What kind of efficiency do you need? A stepper might not be the most power efficient. An escapement permits or causes a gear to index one position and prevents it turning any farther. In a clock, it permits a weight-driven or spring-driven shaft to ...


2

I have mentioned in the comments that you should read the buttons with analogRead(). But you can do it other way by simply connecting the button pin to digital inputs on arduino(any from 0-13). Analog pins are mostly used for accessing the sensor data as far as I know. I am correcting your code as below: #include <Stepper.h> #define ...


2

A 12 volt DC motor is good for dragging items, but then again it depends on the items weight. Stepper is used for millimeter precision, like 3D printing. Servo is an DC motor with precision for 180 degree movement, like robot arms. If the moving object is over 1kg you should look into geared DC motors or even the stronger brushed motors, or geared brushed ...


Only top voted, non community-wiki answers of a minimum length are eligible