Skip to content

2-axis stepper controller add-on board for Raspberry Pi Zero based on GRBL

License

Notifications You must be signed in to change notification settings

dwinters42/PiZero-GRBL-Hat

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

27 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Pi Zero GRBL hat

documentation/Board.png

This is a RaspberryPi Zero-compatible add-on board that can be used to control up to 2 stepper motors using GCode commands. The board works with the non-Wifi (Pi Zero) and the Wifi version (Pi Zero W). It should also work with a standard Raspberrypi, although I have not tested this.

The hat has an on-board AVR Mega328P micro-controller that runs the GRBL firmware, 2 sockets for Pololu-compatible Stepper boards (e.g. DRV8825 and compatible) and connectors for the stepper motors, limit switches, stepper motor power and an extra I2C connector that is wired to the Pi Zero I2C contacts.

The big benefit of this arrangement is that the AVR takes care of all the timing-sensitive tasks, so that the Raspberry Pi can do other things.

Building instructions

Get components

See the bill of materials below.

Assemble board

Use the brilliant interactive HTML-BOM generated by the brilliant BOM KICAD plugin from openscopeproject to populate the board.

Program firmware on AVR

Make sure the populated board is not connected to the Raspberrypi. Use the ICSP connector on the front of the board to upload the GRBL firmware using e.g. avrdude and a compatible programmer.

Mount the board

With the Raspberrypi turned off, plug the GRBL hat board into the Pi header, so that the 2 boards are aligned to each other. Do not connect anything to the GRBL hat yet.

Set up Pi Zero

In order for the communication to work, the on-board serial board of the Raspberrypi has to be enabled with raspi-config: run raspi-config in a terminal, go to Interfacing Options -> Serial -> No to login shell -> Yes to enable serial port hardware. After rebooting, you should have a new serial port accessible as /dev/ttyS0.

Test serial connection

Connect to Grbl using the serial terminal of your choice. Set the port to /dev/ttyS0 and the the baud rate to 115200, 8 bits, no parity, 1 stop bit (8N1). One possibility is to use miniterm:

miniterm /dev/ttyS0 115200

Once connected, you will not see anything (GRBL started when the Pi was plugged into power).

Type $ and press enter to have GRBL print a help message. You should not see any local echo of the $ and enter. Grbl should respond with:

[HLP:$$ $# $G $I $N $x=val $Nx=line $J=line $SLP $C $X $H ~ ! ? ctrl-x]
ok

Congratulations, you have a working GRBL controller connected to your Pi Zero!

Shut down the Pi and disconnect power. Next, connect two stepper driver boards (e.g. 2x Pololu DRV8825 driver board). Make sure you get the orientation correct.

Then connect the motor power supply and set the current using the trimpot on the driver boards. Disconnect motor power, plug in 2 stepper motors (e.g. NEMA17 form factor) and apply motor power again.

First trial run

Turn on power to the Pi and log in via ssh. Run the following commands from a terminal to test the motors:

stty -F /dev/ttyS0 115200 # set baud rate to 115200 baud
cat testing/test.gcode > /dev/ttyS0

This should move first the x-axis to 45 degrees and back, followed by the y-axis. If there is jerky motion or no motion at all, make sure that the wire connections to the steppers are good.

Using the board

The Raspberrypi board communicates with the GRBL controller over the on-board serial port /dev/ttyS0. The serial port needs to be configured to 115200 baud, 8 databits, 1 stopbit, no parity (8N1).

The stepper resolution is set to 32 microsteps in hardware, this cannot be changed. For a standard stepper with 200 steps per revolution this gives 200*32/360 = 17.778 steps per degree.

Look at the GRBL wiki for any GRBL related questions.

Bill of materials

RefQtyValuePartMouser part
A11AXIS_XPololu DRV8825 module
A21AXIS_YPololu DRV8825 module
C1 C22100n 0805
C4 C5233p 0805
C8 C92100u dia 6.3 25V
J11GPIO_CONNECTORpin header 2x20
J21ISPpin header 2x03
J31LIMIT_XJST PH B2B 1x02 vert
J41LIMIT_YJST PH B2B 1x02 vert
J51VMOTJST PH B2B 1x02 vert
J61MOTOR_XJST PH B2B 1x04 vert
J71MOTOR_YJST PH B2B 1x04 vert
J81I2CJST PH B2B 1x04 vert
R111M 0805
R2110K 0805
U11uC TQFP-32Microchip ATmega328P-AU556-ATMEGA328P-AU
Y1116MHz ABM3Abracon ABM3-16.000MHZ-B2-T815-ABM3-16-D2Y-T

Todos for next revision

  • [ ] use less pins on the Raspi connector + cutout in PCB
  • [ ] add photos of the finished board

About

2-axis stepper controller add-on board for Raspberry Pi Zero based on GRBL

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages