www.photomacrography.net :: View topic - TMC5130A-TA BOB & ARDUINO UNO
www.photomacrography.net Forum Index
An online community dedicated to the practices of photomacrography, close-up and macro photography, and photomicrography.
Photomacrography Front Page Amateurmicrography Front Page
Old Forums/Galleries
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 
TMC5130A-TA BOB & ARDUINO UNO
Goto page Previous  1, 2, 3, 4  Next
 
Post new topic   Reply to topic    www.photomacrography.net Forum Index -> Equipment Discussions
View previous topic :: View next topic  
Author Message
Adalbert



Joined: 30 Nov 2015
Posts: 775

PostPosted: Fri Jul 19, 2019 12:22 am    Post subject: Reply with quote

Hello Elf,
Good idea but for the next project :-)
BR, ADi
Back to top
View user's profile Send private message
kaleun96



Joined: 20 Oct 2018
Posts: 135
Location: Stockholm, Sweden

PostPosted: Fri Jul 19, 2019 1:28 am    Post subject: Reply with quote

Adalbert wrote:
Hello Kaleun96,
Unfortunately only green marked pins are free Sad
The remaining digital pins are used by the keypad-shield.
The pin 10 too, so that I have to use pin3 for SS / CSN.
BR, ADi

Ah, of course! Forgot about the keypad and LCD display haha.

Have you thought about using a Mega instead? Most Uno breakout boards and shields are compatible with the Mega. I'm using one myself for a TFT display, stepper driver, joystick, camera shutter trigger, and light sensor.

I also concur with Mike about connecting the EN pin to a digital pin. I disable/enable the outputs on my driver all the time in my code, it is very useful to have that functionality.

I didn't know you could power the VIO pin via a digital pin as Mike suggested but that seems like a good option too. Though digital pins from an Arduino can only handle 20-40mA so hopefully that is enough for the driver.
Back to top
View user's profile Send private message
Adalbert



Joined: 30 Nov 2015
Posts: 775

PostPosted: Fri Jul 19, 2019 3:58 am    Post subject: Reply with quote

Hi Kaleun96,
Yes MEGA would have been better but I have already started with UNO,
then I’ll try to implement it.
Maybe the next project :-)
BR, ADi
Back to top
View user's profile Send private message
elf



Joined: 18 Nov 2007
Posts: 1384

PostPosted: Fri Jul 19, 2019 10:19 pm    Post subject: Reply with quote

I used an Uno in my first automated stacking setup, but controlled it with either an Android smart phone or a PC over a Bluetooth connection. The PC interface was fairly simple to implement, but the Android was not.
Back to top
View user's profile Send private message
Adalbert



Joined: 30 Nov 2015
Posts: 775

PostPosted: Sat Jul 20, 2019 3:43 am    Post subject: Reply with quote

Hello everybody,
Does anybody know if I can use the analog pins 1, 2, 3, 4, 5 as outputs if the analog pin 0 is already used as an input pin for the keypad-shield?
https://www.arduino.cc/en/Tutorial/AnalogInputPins
A0 = Pin 14
A1 = Pin 15
A2 = Pin 16
A3 = Pin 17
A4 = Pin 18
A5 = Pin 19
BR, ADi
Back to top
View user's profile Send private message
kaleun96



Joined: 20 Oct 2018
Posts: 135
Location: Stockholm, Sweden

PostPosted: Sat Jul 20, 2019 3:46 am    Post subject: Reply with quote

Adalbert wrote:
Hello everybody,
Does anybody know if I can use the analog pins 1, 2, 3, 4, 5 as outputs if the analog pin 0 is already used as an input pin for the keypad-shield?
https://www.arduino.cc/en/Tutorial/AnalogInputPins
A0 = Pin 14
A1 = Pin 15
A2 = Pin 16
A3 = Pin 17
A4 = Pin 18
A5 = Pin 19
BR, ADi

Should be fine as you specify the pin mode on a per-pin basis. So it might be something line pinMode(15, OUTPUT);
Back to top
View user's profile Send private message
Adalbert



Joined: 30 Nov 2015
Posts: 775

PostPosted: Sat Jul 20, 2019 3:52 am    Post subject: Reply with quote

Hello kaleun96,

I have just connected a diode (and 200 R) to the analog pin 1 and a piezo buzzer (and 100 R) to the analog pin 5.

pinMode(A1, OUTPUT);
pinMode(A5, OUTPUT);


for(int j=0; j<3; j++)
{
digitalWrite(A1, HIGH);
tone(A5, 1000); // Send 1KHz sound signal...

delay(1000); // 1 sec

digitalWrite(A1, LOW);
noTone(A5); // Stop sound...

delay(1000);
}

It works without any problem with the keypad-shield :-)

BTW, the digital pins 0 and 1 are connected to the relays.
During the programming they make some noise but sketch can be uploaded.

BR, ADi
Back to top
View user's profile Send private message
Adalbert



Joined: 30 Nov 2015
Posts: 775

PostPosted: Sun Jul 21, 2019 1:35 pm    Post subject: Reply with quote

Hello everybody,
I have moved the IR from the Pin2 to the A1 and used Pin2 for the DRV_ENN.
The first test with 256 micro-steps:
https://drive.google.com/open?id=1B5oN9JdDVH1j3z_JXNLNQAS3cORF35Fh
BR, ADi
Back to top
View user's profile Send private message
kaleun96



Joined: 20 Oct 2018
Posts: 135
Location: Stockholm, Sweden

PostPosted: Mon Jul 22, 2019 6:30 am    Post subject: Reply with quote

Adalbert wrote:
Hello everybody,
I have moved the IR from the Pin2 to the A1 and used Pin2 for the DRV_ENN.
The first test with 256 micro-steps:
https://drive.google.com/open?id=1B5oN9JdDVH1j3z_JXNLNQAS3cORF35Fh
BR, ADi

Nice! I'm surprised you have it running so fast with 256 microsteps. If you try and stop it from turning, does it stall very easily or does it require a bit of force to stall the motor?

I'm running at only 4 microsteps on my TMC2130 and it's still not as fast as I would perhaps like. If I go use more microsteps I find the motor stalls easier and I have to recalibrate the parameters for StallGuard.

At the moment are you just using digitalWrite to the STEP and DIR pin to control the motor or are you controlling the motor current directly via SPI?
Back to top
View user's profile Send private message
Adalbert



Joined: 30 Nov 2015
Posts: 775

PostPosted: Mon Jul 22, 2019 8:03 am    Post subject: Reply with quote

Hi Kaleun96,

Yes, SPI has been implemented and the following example used:
http://blog.trinamic.com/2017/04/05/how-to-use-tmc5130-eval-with-your-arduino-mega/
I only changed the pins CSN=3 and DRV_ENN=2
and disabled the clockout, because pin9 is used by the keypad-shield.

BR, ADi
Back to top
View user's profile Send private message
mawyatt



Joined: 22 Aug 2013
Posts: 2230
Location: Clearwater

PostPosted: Mon Jul 22, 2019 11:30 am    Post subject: Reply with quote

kaleun96,

The TMC5130 internal micro-controller changes the microsteps on the fly based upon what the demand motor speed is. Speeds over 600rpm are capable with the good motor, light load, proper motor parameters and good power supply & decoupling. Check the videos I did on these, recall doing 1000 rotations in under 30 seconds.

Nice work ADi, your KR20 will love this controller Very Happy

Sorry I haven't responded more, but tied up with a new Piezo Electric Stage Controller development, these stages are amazing.

Best,
_________________
Research is like a treasure hunt, you don't know where to look or what you'll find!
~Mike
Back to top
View user's profile Send private message
Adalbert



Joined: 30 Nov 2015
Posts: 775

PostPosted: Mon Jul 22, 2019 1:50 pm    Post subject: Reply with quote

Hi Mike,
Thanks! OK, it works but I have to adapt my software to this driver :-)
I’m not sure if I really have to check the target position.
If I start the movement e.g. tmcSendData(0xAD,step); and call the next one without any delay then the previous one will not be executed to the end.
So, I could place a delay or check with tmcSendData(0x21,0x00000000); if the target position has already been reached.
OK, this is not a problem in my rail.
BR, ADi
Back to top
View user's profile Send private message
mawyatt



Joined: 22 Aug 2013
Posts: 2230
Location: Clearwater

PostPosted: Mon Jul 22, 2019 4:09 pm    Post subject: Reply with quote

ADi,

You don't to worry about what goes on in between the start and end positions, the 5130 micro-controller will take care of that. It won't mis steps unless you do something to the motor, assuming you have the proper parameters. Just set all your motor parameters, then simply tell the 5130 to goto a particular position, it will manage with the profiles you've setup.

I have routines that move the motor and wait until the destination is achieved, and one that doesn't (so you can do stuff while the motor's running).

Best,
_________________
Research is like a treasure hunt, you don't know where to look or what you'll find!
~Mike
Back to top
View user's profile Send private message
kaleun96



Joined: 20 Oct 2018
Posts: 135
Location: Stockholm, Sweden

PostPosted: Tue Jul 23, 2019 12:19 am    Post subject: Reply with quote

mawyatt wrote:
kaleun96,

The TMC5130 internal micro-controller changes the microsteps on the fly based upon what the demand motor speed is. Speeds over 600rpm are capable with the good motor, light load, proper motor parameters and good power supply & decoupling. Check the videos I did on these, recall doing 1000 rotations in under 30 seconds.

I think the TMC2130 has this too but since I'm not relying on the driver to determine position, lost steps, steps travelled etc I think it would be very hard to make the auto-adjusting microsteps work with my script that uses another library for knowing those parameters (position, travel distance etc).

Knowing that these tests were via SPI it makes sense that they're much faster than I'm getting. Arduino's digitalWrite() function can top out at only 110kHz or so, port manipulation is about 20x faster at 2.6MHz, and SPI could theoretically be much faster but on a 16MHz controller it's probably going to be somewhere around 4 to 8MHz.

Changing to either port manipulation or SPI would require some changes to the AccelStepper library, maybe I'll fork it and give it as go at some point in the future!
Back to top
View user's profile Send private message
mawyatt



Joined: 22 Aug 2013
Posts: 2230
Location: Clearwater

PostPosted: Tue Jul 23, 2019 6:57 am    Post subject: Reply with quote

kaleun96 wrote:
mawyatt wrote:
kaleun96,

The TMC5130 internal micro-controller changes the microsteps on the fly based upon what the demand motor speed is. Speeds over 600rpm are capable with the good motor, light load, proper motor parameters and good power supply & decoupling. Check the videos I did on these, recall doing 1000 rotations in under 30 seconds.

I think the TMC2130 has this too but since I'm not relying on the driver to determine position, lost steps, steps travelled etc I think it would be very hard to make the auto-adjusting microsteps work with my script that uses another library for knowing those parameters (position, travel distance etc).

Knowing that these tests were via SPI it makes sense that they're much faster than I'm getting. Arduino's digitalWrite() function can top out at only 110kHz or so, port manipulation is about 20x faster at 2.6MHz, and SPI could theoretically be much faster but on a 16MHz controller it's probably going to be somewhere around 4 to 8MHz.

Changing to either port manipulation or SPI would require some changes to the AccelStepper library, maybe I'll fork it and give it as go at some point in the future!


Yes this is one of the many fundamental advantages of the RPi over the Arduino. You can let the micro-controller handle the motor details with tight control and the RPi can act as the master issuing higher level commands, plus do all the user interfaces.

Best,
_________________
Research is like a treasure hunt, you don't know where to look or what you'll find!
~Mike
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    www.photomacrography.net Forum Index -> Equipment Discussions All times are GMT - 7 Hours
Goto page Previous  1, 2, 3, 4  Next
Page 3 of 4

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group