Go Down

Topic: GRBL & Motor Shield config - newb question (Read 7301 times) previous topic - next topic


Hi all,
Great forum!
"Long time listener, first time caller"...

I apologise for the presumably simplicity of this question, I am fairly new to the Arduino/microcontroller/programming world.

I've had no troubles connecting hardware & uploading/running example sketches to my Arduino Uno & AdaFruit Motor Shield on Windows & Ubuntu.
Slowly understanding a few things on the way...

I'm currently messing around trying to create a simple drawbot/cnc using GRBL (0.7), using steppers for XY & a servo for Z.
I can compile & upload the grbl firmware with no problem (using Ubuntu) but I don't quite understand which pins I need to use for this specific setup & whether Z axis in config.h needs to be a servo/pwm? I'm at a bit of a loss here. Would anybody happen to have any "idiot-proof" reference material or guides handy?

Thanks in advance.


I can compile & upload the grbl firmware with no problem but I don't quite understand which pins I need to use for this specific setup & whether Z axis in config.h needs to be a servo/pwm?

You have access to the code. We don't. Who would be in the best position to answer that question?


Sorry, I didn't think it necessary to post the code (I presumed someone would be familiar with GRBL).
This is the part pertaining to pin assignments in config.h
Code: [Select]
#define STEPPERS_DISABLE_BIT         0

#define STEPPING_DDR       DDRD
#define X_STEP_BIT           2
#define Y_STEP_BIT           3
#define Z_STEP_BIT           4
#define X_DIRECTION_BIT      5
#define Y_DIRECTION_BIT      6
#define Z_DIRECTION_BIT      7

#define LIMIT_DDR      DDRB
#define LIMIT_PIN     PINB
#define X_LIMIT_BIT          1
#define Y_LIMIT_BIT          2
#define Z_LIMIT_BIT          3



As I said in first post, I don't have much of a clue, but I do want to learn, that's why my question was mainly if anybody has good reference material &/or guides. Thanks for the reply in any case.


Take a look at this page:
The 328 has the same pins.

The innermost set of names are short for either PINx (in) or PORTx (out). The digit is the pin number on that port. So, PB5 is the 5th pin on PORTB or PINB, depending on whether the pin is used for input or output.

The text in red then identifies how the Arduino refers to the same pin. PB5 is digital pin 13.

Your stepper motor controllers should be connected to PORTD (output), which is digital pins 0 to 7. The step pins should then be digital pins 2, 3, and 4. The direction pins are pins 5, 6, and 7.

If you have limit switches, they are connected to PINB (input), which is the rest of the digital pins (8 to 13). The limit switches connect to pins 8, 9, and 10.

Pins 11 and 12 are used for the spindle enable and spindle direction pins.


I know this is an old thread but google shows this when you search for GRBL + Adafruit motor shield.

So I'll try so sum this up.

Take a look at this link (https://github.com/grbl/grbl/wiki/H-Bridge-as-stepper-driver)

Tl;dr :
GRBL does not officially support H-Bridge drivers (Adafruit motorshield) but there is some modified code (3 files) that is able to use this board with GRBL.
The downside :

This code is for GRBL version 0.7 only. There is no update for 0.8 or anything higher then 0.7.
Since 0.7 a lot of fixes were pushed. So it not seems to be likely to get this shield working with GRBL excpet someone re-writes the code for v0.8+


Thanks everybody for your replies.
Looks like I have a LOT more learning to do!
Thanks again.

Go Up

Please enter a valid email to subscribe

Confirm your email address

We need to confirm your email address.
To complete the subscription, please click the link in the email we just sent you.

Thank you for subscribing!

via Egeo 16
Torino, 10131