Go Down

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

Ant5

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.

PaulS

Quote
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?

Ant5

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_DDR     DDRB
#define STEPPERS_DISABLE_PORT    PORTB
#define STEPPERS_DISABLE_BIT         0

#define STEPPING_DDR       DDRD
#define STEPPING_PORT      PORTD
#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

#define SPINDLE_ENABLE_DDR DDRB
#define SPINDLE_ENABLE_PORT PORTB
#define SPINDLE_ENABLE_BIT 4

#define SPINDLE_DIRECTION_DDR DDRB
#define SPINDLE_DIRECTION_PORT PORTB
#define SPINDLE_DIRECTION_BIT 5


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.

PaulS

Take a look at this page:
http://www.arduino.cc/playground/Learning/PortManipulation
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.


DocBrown

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+

Ant5

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

Go Up