Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Q: Two motors #11

Open
SCiunczyk opened this issue Jun 30, 2020 · 11 comments
Open

Q: Two motors #11

SCiunczyk opened this issue Jun 30, 2020 · 11 comments
Labels
help wanted Extra attention is needed

Comments

@SCiunczyk
Copy link

Hi,

I have working "Pi HAT" now - both drivers are working perfectly on RPi4 . As I'm not very strong in python .... yet ;-) I'm not sure what is the best approach to have two channels working on this same time. It's possible to pass parameters to chipdrive.tmc5130 constructor? I mean something like this

motorpan=chipdrive.tmc5130(drvenpin=12, spiChannel=1)
motortilt=chipdrive.tmc5130(drvenpin=24, spiChannel=0)

Thanks for your indulgence.

Slawek

IMAG1778

IMAG1779

@pootle
Copy link
Owner

pootle commented Jun 30, 2020

Well done. Yes you're right - those parameters should give you control of the 2 motors.

@SCiunczyk
Copy link
Author

Just that simple ??? Wow! Thanks.

I will try tomorrow morning. Now is to risky ;-) I'm a little bit tired.

@SCiunczyk
Copy link
Author

Hi @pootle, what is the propoer syntax that should I use to create two motors with two different names and two different drvenpin and spiChannel?

When I try to use in motors2.py construction:

motorpan=motorPanel(motor=chipdrive.tmc5130(drvenpin=12, spiChannel=1), gridx=1, pfields=pfields, panel=mpanel)

I get:
TypeError: init() got an unexpected keyword argument 'drvenpin'

@SCiunczyk
Copy link
Author

I know that I should learn the lesson "Python class constructor (default) parameters " ;-)

@pootle
Copy link
Owner

pootle commented Jul 1, 2020

Ah! silly code - the params aren't getting passed through - and I haven't got a test rig running just now.

I can put a couple of edits into github, but can't test them just now....

@SCiunczyk
Copy link
Author

Heheheh maybe I'm not so stupid as I was thinking.

I will test. The hardware is on my desk now.

I'm in the middle of this article: http://www.memonic.com/user/pneff/folder/python/id/1tHgm now.

@SCiunczyk
Copy link
Author

I mean I will test any changes if you will find time to make them.

@pootle
Copy link
Owner

pootle commented Jul 1, 2020

I've done the updates - not been able to test though - give it a go.

@SCiunczyk
Copy link
Author

I can confirm - it works as expected. Many thanks for your effort. I'm surprise how smooth the driver power motors.

Now I'm programming two motors demo. When will be ready I'll share it with you.

One more question:
In chipdrive.py line 136 you are using: name='fred' If we have more than one motor maybe we should use separate names ? Or it doesn't matter at all because is inside the object?

Have nice evening and thanks again.

@pootle
Copy link
Owner

pootle commented Jul 2, 2020

name is used for log messages, so not vital, but helps if it is different.

These chips are really great at driving steppers - but getting all the reg settings right to get the best from the motor can take a while.

Enjoy!

@pootle pootle added the help wanted Extra attention is needed label Jul 2, 2020
@SCiunczyk
Copy link
Author

So probably we can close the issue. What do you think about making the name "passed through" parameter as well ?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
help wanted Extra attention is needed
Projects
None yet
Development

No branches or pull requests

2 participants