Motor Shield RPM increase

Adafruit Ethernet, Motor, Proto, Wave, Datalogger, GPS Shields - etc!

Moderators: adafruit_support_bill, adafruit

Please be positive and constructive with your questions and comments.
Locked
User avatar
kalniss
 
Posts: 7
Joined: Sun Aug 31, 2014 9:38 am

Motor Shield RPM increase

Post by kalniss »

I have two Adafruit motor shields V2 and three steppers on Arduino Mega. I only use onestep() to run them. My i2c is set to 400 kHz, thus I can now achieve only ~770 steps/s max combined among all three motors. I can't afford to loose MICROSTEPing capability to increase RPMs like this post suggests:

http://forums.adafruit.com/viewtopic.ph ... 1&start=15

However I found this reference here viewtopic.php?f=19&t=61371&p=310840&hil ... ed#p310840 that references a possibility for a further increase in i2c frequency. The question is how and/or if it's really possible?

User avatar
adafruit_support_bill
 
Posts: 88093
Joined: Sat Feb 07, 2009 10:11 am

Re: Motor Shield RPM increase

Post by adafruit_support_bill »

You can try changing the 4000000L divisor in the line:

Code: Select all

TWBR = ((F_CPU /400000l) - 16) / 2; // Change the i2c clock to 400KHz
Some have reported success with 500KHz. The absolute max for your case will depend on the processor and what else you may have attached to the i2c bus.

User avatar
kalniss
 
Posts: 7
Joined: Sun Aug 31, 2014 9:38 am

Re: Motor Shield RPM increase

Post by kalniss »

Of course doing it this way is the same as changing the #define TWI_FREQ 850000L in twi.h line, however this pushed me to do some incremental tests, and I was able to rise i2c frequency to 850kHz until it stopped responding. This gave me comfortable 1000 steps/s combined among my three motors (DOUBLE/MICROSTEP combo). It starts to get jerky at around 1050 steps/s.

Thanks for the replay.

User avatar
adafruit_support_bill
 
Posts: 88093
Joined: Sat Feb 07, 2009 10:11 am

Re: Motor Shield RPM increase

Post by adafruit_support_bill »

Great! Thanks for posting your results. With 2 shields plugged in, you have effectively stronger pullups and a very short bus, both of which favor higher speeds.

Locked
Please be positive and constructive with your questions and comments.

Return to “Arduino Shields from Adafruit”