Post Reply 
Thread Rating:
  • 0 Votes - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Simplifyng b-robot code
01-10-2017, 02:57 PM
Post: #1
Simplifyng b-robot code

I see b-robot code uses lots of lines of code to WITA and things I will not use.

I just have an arduino nano, 2 stepper motors and 2 A4988 driver and nothing more. I tried simplifying the code of B-ROBOT to just work with these componentes but that is really hard. I spent the last night and this entire morning trying to get this robot to work but it's freaking hard.

Can someone tell me if there is a simplyfied version of this b-robot code with just the essentials?
Find all posts by this user
Quote this message in a reply
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 

Forum Jump:

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