Post Reply 
Thread Rating:
  • 0 Votes - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Simplifyng b-robot code
01-11-2017, 11:47 AM
Post: #2
RE: Simplifyng b-robot code
unfortunately, the code is hard to understand. I am in the process of breaking the code down and putting it together in modules so that one can just play with parts of it and lean something on the way.

The key to the A4988 stepper motors is the use of Interrupts to feed the pulses to the motors. By varying the interrupt timer they change how often a pulse is sent to the motors. The higher the number the faster the motors spin. The motors start at 0 and can go up to 500. This leads to a short pulse of about 86 microseconds in length.

The A4988 can not except a pulse of less than 1 microsecond so in the interrupt routine there is a 1 microsecond delay code because you can not use delay functions in an interrupt routine since they are disabled.

You will also need an accelerometer and gyro if you want it to balance. The code they are using is Quaternions to balance the bot but that is really over kill since Quaternions are used for 3 dimensional objects and the bot only uses one axis to balance, so that can easily be done using a complimentary filter.

Find all posts by this user
Quote this message in a reply
Post Reply 

Messages In This Thread
Simplifyng b-robot code - batata003 - 01-10-2017, 02:57 PM
RE: Simplifyng b-robot code - iseries1 - 01-11-2017 11:47 AM

Forum Jump:

User(s) browsing this thread: 1 Guest(s)