(I'm a mathematician by training)
Then you are ten steps ahead of the game, so much will be easy for you!
I struggle with mathematics (being entirely self taught later in life) but it is an essential part of electronics and programming control systems and science in general. Again and again I come across explanations in the form of equations.
We all start off even because I started from nowhere in electronics (other than Ohm's law) and mechanics (other than a mechano set about 65 years go).
I think that's why we're all here, everybody builds off of everybody else's strengths 🙂
Anything seems possible when you don't know what you're talking about.
would have to write your own bit patterns to transfer and latch per unit of time.
Sorry Im trying to understand.
in the examples on Arduino IDE it shows
// set all pins at once
uint8_t pinValues[] = { B10101010 };
sr.setAll(pinValues);
delay(1000);
So I would change the { B1000000 }; and then to { B00100000 } and so on and so forth changing the delay in between should adjust the speed at witch the stepper moves yes? then I should build a function as
def moveStepper1forward
uint8_t pinValues[] = { B10000000 };
sr.setAll(pinValues);
uint8_t pinValues[] = { B00100000 };
sr.setAll(pinValues);
uint8_t pinValues[] = { B01000000 };
sr.setAll(pinValues);
uint8_t pinValues[] = { B00010000 };
sr.setAll(pinValues);
Is that kind of what your talking about? although I guess with a variable delay in-between, and also because this uses 3 shiftR's do I have to change it from uint8_t to uint24_t?
Im just glad the we have open source knowledge now, and people sharing new ideas and helping each other.
I have some civil engineering background as I worked on a surveying crew for about 8 yrs, I have been in landscaping for the past 17 yrs though and I hate to say but my body and mind are both done with that though! I want to build robots that can do the work lol.
Anything seems possible when you don't know what you're talking about.
Thank you!
I'm wiring everything in right now and getting the bot put together except the arm for right now, as I will want the steppers out of the arm until I figure out how far each stepper can move, or at least get an idea anyway. But thank you so much for that!
I'll let you know how it goes!
OMG, that code was just to help illustrate the concepts. I have no idea if it will work or even if it's suitable. It was just to help you get an basic understanding of the structure. It's so incomplete that it doesn't even have any code to call the subs that do the stepping. If you try to run it nothing will move.
Now I'm really worried.
Anything seems possible when you don't know what you're talking about.
I suppose I should say that I wasnt going to try that code exactly, however showing me that code did illustrate the general idea.
Whew ! 🙂
I was trying to show you how you would need to have a call inside your loop that would then need to decide whether or not that stepper needed to move and in which direction. That's the point of the takeAStep() routine inside the loop. It then calls moveStepper(ID) which determines if that stepper needs to move and if so, in which direction.
It also calls stepOnePhase which returns the appropriate nybble (4 bits) for the current step phase for that particular stepper and direction and combines it with the other stepper to make an 8-bit byte which will later be passed off to the shift register. The "<<4" operator moves the first stepper's step phase command 4 bits to the left so that the second stepper's step's command will be added into the lower 4 bits of the byte.
The resulting bytes are then sent off to the sendToShiftRegister routine which sets the latch LOW, writes out all three commands for all 6 steppers, and then resets the latch HIGH to end the transfer. I'm not familiar with shift registers, so I'm not sure about the order the bytes need to be sent and what order the most and least significant bytes need to be in.
Let me know if you have any questions about the code or the general outline of the operations above. I don't present it as a complete solution but just as an illustration to help you consider what has to happen and how it all fits together. I believe @robotbuilder will be able to provide a lot more detail and reasoned explanations.
You'll need to write the moveStepper(int stepperID) to meet your needs. You'll need to provide:
- some mechanism for determining where your steppers are (in steps and also in space)
- some calculations to determine where your steppers need to be (in steps and space)
- whether you move each stepper individually or all together
- how to synchronize the steppers so they all arrive at their target at the same time or whether to move them all at the same speed and just stop moving each one as it gets to its target position
- you'll need to be able to convert a (x,y,z) position in space to a set of angles for your stepper motors and then to step counts for each stepper.
- Similarly, you'll need to be able to use step counts for each stepper to convert back into angles and again back into (x,y,z) co-ordinates
For a start, you can just work on one stepper at a time though 🙂
Anything seems possible when you don't know what you're talking about.
@robotbuilder and @will
Thank you guys so much!!!
@robotbuilder I'm set up the same as you with the only difference being I have data in pin 3, clock in 4, and latch in 5 but that is nothing really as long as we know what pin is controlling what.
I am all set up with everything wired up today and I'm going to plug myself into the Arduino IDE and see if I can figure out what you guys are explaining to me.
It really feels awesome to be able to talk about these things to someone, I don't know anybody that is interested in these things.
i'm sorry but I've looked through my stash of electronic parts and I can't find any BYJ steppers anywhere, so I won't be able to make out a working sketch of the Arduino driving one through a shift register.
Anything seems possible when you don't know what you're talking about.