Notifications
Clear all

controlling stepper motors with shift registers & Arduino

103 Posts
5 Users
20 Likes
12.1 K Views
robotBuilder
(@robotbuilder)
Member
Joined: 5 years ago
Posts: 2042
 

@dryden

I'm glad you guys know about this stuff, I'm confused as all heck lol

Sorry dryden but I don't really know all that much,Β  it is a learning experience for me,Β  although I seem to know more about programming than you,Β  and Will appears to know more than me.

Can we not adapt @robotbuilder 's code to send the bites out like this? That being said I've tried this particular example and couldn't get any movement from my steppers, although I kinda blame my code writing skills and not the example code.

Not sure what particular code you tried I haven't actually provided any complete code to move more than one stepper.

I'm still not sure why we need angles other than to maybe record the position of an event, I am happy just having the step count, if it saves space.

Computing paths through 3d space will involve floating point arithmetic even if it is rounded down to integer step positions for the stepper motors.Β  The positions of the stepper motors would be integers. I called them "angles" but they were step positions in a circle of 4096 positions.

Yes KISS is a good principle which means maybe don't use stepper motors πŸ™‚Β  And use a Mega so you don't have to shift data out.Β 

I trust your opinions, and thank you both so much!

Very dangerous trust in my case I am also an amateur.Β  This is all just a "problem to solve" for fun like doing any other puzzle.

Β 

Β 

Β 


   
ReplyQuote
Will
 Will
(@will)
Member
Joined: 3 years ago
Posts: 2531
 
Posted by: @robotbuilder

@will

Note that I dropped the timing stuff as it only seemed to apply when multiple step phases were done in the module.

You can only start the steppers moving at a minimum pulse rate otherwise the inertia stops them turning and the best minimum number is 1000 msec. Once the stepper is moving you can then decrease the time between the pulses (acceleration) and that is what the 6 servo demo code utube example was doing.

Working multiple stepper motors simultaneously is just a mental programming problem to solve for me as a self taught hobby programmer but an advanced programmer who understands all this to explain it with simple code would be the best response for dryden.Β  Ideally I would have six stepper motors to play with and come back in a months time with some kind of software solution which must exist out there for allΒ  those robotic arms that use stepper motors.

Β 

Β 

Β 

Rats ! Then I'll have to redo the module and re-introduce the timing. Also, I noticed that you already have a value "dir" in the stepperInfo for direction. I stopped looking when it hit dirFunc.

I'll have another go at adding the timing back into pulseStepper if you like and you can move on to other parts. Just let me know.

Anything seems possible when you don't know what you're talking about.


   
ReplyQuote
Will
 Will
(@will)
Member
Joined: 3 years ago
Posts: 2531
 
Posted by: @dryden

@robotbuilderΒ 

Yes I need this as basic and simple as possible lol!!!Β 

I should throw in here that when I ran the code with all 3 shift registers hooked up and all 6 stepper motors, it was trying to move all 6 steppers but only the first 4 were moving as I dont believe there was enough power for the last 2 steppers, so technically there is enough power to move 4 steppers at once but if it just moves one stepper at a time it would be simpler for me to understand for now.Β 

Sounds like you just need a beefier power supply for the robot

Anything seems possible when you don't know what you're talking about.


   
ReplyQuote
robotBuilder
(@robotbuilder)
Member
Joined: 5 years ago
Posts: 2042
 

@Will
Also, I noticed that you already have a value "dir" in the stepperInfo for direction. I stopped looking when it hit dirFunc.

I am not using the stepperInfo struct that comes from the utubes 6 stepper motor example it was just to show dryden how complicated it can become. I downloaded the utube code and it is too complicated for me to follow!Β 

Β 

Β 


   
ReplyQuote
Will
 Will
(@will)
Member
Joined: 3 years ago
Posts: 2531
 
Posted by: @robotbuilder

I am not using the stepperInfo struct that comes from the utubes 6 stepper motor example it was just to show dryden how complicated it can become. I downloaded the utube code and it is too complicated for me to follow!Β 

Ummm, OK, can you please describe and list whatever arrays or structs you're using so that I can write the function using it/them to merge seamlessly with your code.

Anything seems possible when you don't know what you're talking about.


   
ReplyQuote
robotBuilder
(@robotbuilder)
Member
Joined: 5 years ago
Posts: 2042
 

@dryden

I dont believe there was enough power for the last 2 steppers,

Are these motors still attached to the arm? They may not be strong enough to lift the weight. I don't see why the last steppers would be any different power wise than the first stepper motors. It is not as if the first stepper motors have a monopoly on the power. The voltage would be applied equally to all of them and they would all draw as much current as needed. If one is weaker than the other than it is doing more work. If there is not enough power delivered to the motors than it should effect all of them equally according to how much work they are doing.

Β 

Β 


   
ReplyQuote
Dryden
(@dryden)
Member
Joined: 3 years ago
Posts: 77
Topic starter  

@willΒ 

Oh, ok I understand.

Posted by: @will

Unless you're going to manoeuvre your robot's arm by hand, you'll need to start thinking about how to get the "hand" from where it is now to where you want it to be. That means you'll have to calculate the angles of the shoulder, forearm, wrist angle, wrist rotation and grabber (finger) positions.

with the camera mounted on the arm just before the wrist joint, I was thinking because the open cv is tracking the object on the screen and returning the co-ordinates to move left right up and down, You can also measure distance with a single camera in open cv, and that should tell the robot if an object is close enough for it to reach, and when the object is in range to grab, The one thing I am not sure about is determining angle of attack... Im sure there is something in open cv that should be able to measure the angle of an object, there is a tutorial on how to measure objects in open cv

I found one on triangulation and angles but he uses stereo vision, which I have on my desktop πŸ™‚ but I know that one dsnt work on a single cam, Ill have to do more research on that one.


   
ReplyQuote
robotBuilder
(@robotbuilder)
Member
Joined: 5 years ago
Posts: 2042
 

@willΒ 

Ummm, OK, can you please describe and list whatever arrays or structs you're using so that I can write the function using it/them to merge seamlessly with your code.

The moveSteppers() is an illustration and not part of an actual program. There is no complete program to move multiple stepper motors. Clearly the struct would have desiredPosition, actualPosition and direction as three of its variables.Β  I would add more as needed.

Hopefully I will make some more progress later today.Β  It is 5:10 am in the morning here.

Β 

Β 


   
Dryden reacted
ReplyQuote
Will
 Will
(@will)
Member
Joined: 3 years ago
Posts: 2531
 

@robotbuilderΒ 

Understood = it's noon here.

Is there any good way I can help you ?Β 

Anything seems possible when you don't know what you're talking about.


   
ReplyQuote
Dryden
(@dryden)
Member
Joined: 3 years ago
Posts: 77
Topic starter  

@robotbuilder

Posted by: @robotbuilder

It is not as if the first stepper motors have a monopoly on the power.

I might have gave them that monopoly. The power comes into the small bread board from either the power module when the battery is plugged in, or with these experiments I'm using my bench power with a couple jumper wires going into the bread board, for each row on the bead board I have a jumper going to the next row and the next and the next, I have only one stepper plugged into each of these rows using 6 rows on the board + one for the dc motors, I believe what is happening is the first rows have better access to that power than the later rows, or the latter shift registers are getting less signal than the first?Β 

not sure that was really just an observation I made. I suppose I could do it again and test it with my voltmeter.


   
ReplyQuote
Dryden
(@dryden)
Member
Joined: 3 years ago
Posts: 77
Topic starter  
Posted by: @will

Sounds like you just need a beefier power supply for the robot

I'm not sure if I have anything bigger than the 18 volt battery it has

I've been looking at making my own Carbon based batteries based off Robert Murray-Smith You tube channel. Eventually.Β 

I also started playing around with making my own conductive silicone for use in soft robotics (this has turned into my most expensive project yet) and Electro-Active Polymers (E.A.P.). I need to figure out aΒ  SAFE power source that can create the voltages I need to control a polymer based actuator. between 500 volts to 10 Kv. I've tried 2 experiments with small cheap transformers but I fried them both, I have a couple old Microwaves that I've been thinking about taking the transformers out of one of them, but that High Voltage scares me. I can wait on that project until I find someone that knows a lot about that before I go and burn down my house or electrocute myself lol


   
ReplyQuote
robotBuilder
(@robotbuilder)
Member
Joined: 5 years ago
Posts: 2042
 

@dryden

You might like to think about what sorts of tasks you want you robotic arm to do for there is no general vision solution available yet and practical tasks require a highly constrained environment both physically and visually. In the utube example the objects needed to be placed on a white background and I see there is no overlap of parts which again complicates things. And also he controls the lighting to avoid shadows. Now all that is not real world visual processing. His objects are "flat" on a flat surface of a known distance from the camera. It is not a general purpose solution at all.

Machine vision is something I know a lot about having had an interest in a long time ago.
https://forum.dronebotworkshop.com/ai/robot-vision/#post-7960

Β 


   
ReplyQuote
Dryden
(@dryden)
Member
Joined: 3 years ago
Posts: 77
Topic starter  
Posted by: @robotbuilder

Sorry dryden but I don't really know all that much,Β  it is a learning experience for me,Β  although I seem to know more about programming than you,Β  and Will appears to know more than me

@robotbuilderΒ 

@willΒ 

You both are a massive help! I sure couldn't do it alone! regardless of how much experience any of us have. I put my part in by getting you both to think about a new way of doing things πŸ™‚ lol

Posted by: @robotbuilder

Not sure what particular code you tried I haven't actually provided any complete code to move more than one stepper.

I was referring to the example code in that post, not the code you shared.

Posted by: @robotbuilder

Computing paths through 3d space

That makes more sense to me.

Posted by: @robotbuilder

Yes KISS is a good principle which means maybe don't use stepper motors 🙂Β  And use a Mega so you don't have to shift data out.Β 

There is a bigger picture for doing this, What if I had need for say 400 pins that only really need to go high or low and in a pattern not far off from the same pattern that these steppers use. Im pretty sure that the Arduino cant handle that much information (maybe it can, I dont know) but I thought shift registers might be the answer to that problem in the end.

Posted by: @robotbuilder

Very dangerous trust in my case I am also an amateur.Β  This is all just a "problem to solve" for fun like doing any other puzzle.

I hope you are enjoying this puzzle, I have many more if your interested lol πŸ™‚


   
ReplyQuote
robotBuilder
(@robotbuilder)
Member
Joined: 5 years ago
Posts: 2042
 

@dryden

Posted by: @will
Sounds like you just need a beefier power supply for the robot

dryden replied:

I'm not sure if I have anything bigger than the 18 volt battery.

You do know that voltage has nothing directly to do with the power it can deliver?

Power is measured in watts. Power(watt) = Current(amp) x Force(volt)

A beefier power supply does not mean a higher voltage.Β  All components have a optimal voltage required across their terminals. If you attach more components in parallel to that power supply they will draw more current from the power supply but ideally the voltage would stay at some fixed value.

Β 

Β 


   
ReplyQuote
Dryden
(@dryden)
Member
Joined: 3 years ago
Posts: 77
Topic starter  

@robotbuilder

Posted by: @robotbuilder

Machine vision is something I know a lot about having had an interest in a long time ago.

That's good to know as I'm just learning obviously.

There was another utube tutorial I saw and I would really have to go through my computer vision playlist to find the tutorial but he wrote a program that counted how many pixels the object took up on the screen and as the object moved away of course it used less pixels on the screen as it moved closer it used more pixels on the screen, if you know how many pixels a set object of a set size of object uses at a set distance, can you not determine the size of that object object? Obviously if there is shade on the object it may not pick up those pixels properly and the measurements would be off. what about using the built in flash/light on the esp32 to illuminate the object.... ? just a thought, Im not sure if any of that is correct or not.


   
ReplyQuote
Page 6 / 7