is it possible to use I2C to control multiple A4988 stepper driver boards

Hi

I can interface an arduino to the PCA9685 to control x number of servo motors using I2C

is there an equivalent way to interface to multiple A4988 stepper driver boards?

usage is to control a stepper to move a model railway point so only 1 or maybe 2 at the same time steppers are linear ones e.g.

www.ebay.co.uk/itm/50PCS-Micro-Screw-Stepper-Motors-Miniature-2-phase-4-wire-Step-Motor-Driver-JD-/122754421020

so even with driver board are cheaper than a servo and probably easier to hide / interface with the point than the small servo's

any help appreciated as I'm on a steep learning curve with electronics

Stepper drivers almost invariably have a step+direction interface, not a bus interface. This is because of the need for accurate timing of all the step pulses, the latency of I2C would be too much. Bear in mind many (microstepping) stepper drivers go upto 100,000 step pulses/second.

thanks for the response

but doesnt the A4988 handle all that as it only needs 2 inputs direction and steps

as per

http://howtomechatronics.com/tutorials/arduino/how-to-control-stepper-motor-with-a4988-driver-and-arduino/

so is there a way to select the A4988 board and send it the 2 input signals wait till its moved and then wait to signal the next board?

Notlob: usage is to control a stepper to move a model railway point so only 1 or maybe 2 at the same time steppers are linear ones e.g.

A stepper motor seems a strange choice for that purpose. A servo would make much more sense.

An Arduino does not know where a stepper is when the Arduino starts and you need a limit switch that is triggered by the stepper and code to drive it to the limit at startup so that the Arduino can establish a zero position.

If you really do need to use I2C then you need two Arduinos. One to send the commands and the other to receive the commands and send signals to the stepper driver.

...R Stepper Motor Basics Simple Stepper Code

thanks Robin2

i have the option of using servos, and agree that they are probably the better option

but

I would like to experiment with these miniature steppers

I didn't think about where the stepper would be and setting a zero point for it, to reference a start position, but I could use a switch to identify end of travel in 1 direction and always move to that position on startup e.g. rotate clockwise on start till switch made / broke, if already broke, stepper is at start position

Hello, I would appreciate if this I2C communication would be explained with stepper motors (not servos). I have a project where Arduino Mega (or Teensy 3.1) would control several stepper motors (one at a time) and I am looking for solution. https://www.youtube.com/watch?v=aSf3S6qtWVo Basically main controller (Mega or Teensy) would be sending commands over I2C to several PCB with Attiny(s) 44 and stepper driver for each stepper motor.

The Mega doesn't have enough pins to do it by itself?

marjan_mike: Basically main controller (Mega or Teensy) would be sending commands over I2C to several PCB with Attiny(s) 44 and stepper driver for each stepper motor.

You could do that by having the Master send a message to an Attiny to move a stepper N steps in a particular direction - for example the message might be F2018meaning move Forward 2018 steps and then the Attiny would do all the control and timing for the individual steps.

...R

You can share direction pins if you are only operating one stepper at a time - the requirement is that the direction pin is correct only at the time the step input has a rising transition, otherwise its a "don't care" input.

Hello, thanks for your replies - my project is shown here: https://m.youtube.com/watch?v=aSf3S6qtWVo I have a code (for Arduino) but I would need to split this code to part on Mega and Attiny44 which I dont know how to do... If anyone is interested in cooperating in this project - please do not hesitate to contact me directly to my email. Thanks Mike

marjan_mike: . If anyone is interested in cooperating in this project - please do not hesitate to contact me directly to my email.

If you want help from this Forum please post your code and your questions here.

...R

Hello gents, The code is here; https://docs.google.com/document/d/1e6jO6kyDLVJ4ertSWo8UtZs9eSdoDVz9-PdK9j_N6Sk/edit?usp=sharing And I use 2x LB1848 as two stepper drivers per Attiny44, DC motor 3-5V for spool, 2 optos,.. Thanks Mike

marjan_mike: Hello gents, The code is here;

Your concept of "here" and mine are very different. When I used the word "here" in Reply #10 I meant that you should post your code in the Forum so we don't have to go to some other website to see it. I consider other websites to be "there"

...R

@marjan_mike, Your pick n place machine looks kind of awesome!

I am looking to build a machine with 12 DRV8825 Stepper Motor Drivers (https://smile.amazon.com/HiLetgo-DRV8825-Stepper-RAMPS1-4-StepStick/dp/B01NCE3ZW1).

Currently I am thinking a few i2c multiplexers would be able to get me there (https://learn.adafruit.com/adafruit-tca9548a-1-to-8-i2c-multiplexer-breakout)

My application is a robotic flower. It would be ideal if multiple motors could be moving at the same time (not necessarily synchronized). Will i2c work for this and do any of you have an example of i2c running a motor controller like the DRV8825?

Thanks!