Raspberry Pi CNC - Quick Start Guide
The Raspberry Pi CNC board is a simple board that plugs into a Raspberry Pi and turns a Raspberry Pi into a useful little CNC machine controller. (Credit to the GRBL, Arduino, Raspberry Pi and all the wonderful projects on the internet)
A basic understanding of the following is needed... (There are many tutorials online covering these topics):
- Raspberry Pi systems
- Arduino Hardware / Serial Interfaces
- Basic computer skills
- GRBL g-code interpreter
What you will need to get started
- Raspberry Pi CNC Board/Hat
- Raspberry Pi B+ / Raspberry Pi 2 or 3 (Raspberry Pi with 20x2 pin header) + accessories like screen, keyboard, mouse.....
- 8GB or Bigger Micro SD Card or bigger. (Internet connection to download the pre-made Raspberry Pi Image)
- CNC Hardware - This will not be covered in this wiki but includes things like Stepper Motors+ Pololu Drivers, Linear rails and all the mechanical bits.
Download the pre-configured Raspberry Pi image
Raspberry Pi's run a full blown Operating system from it's on board SD card. Pre-configured SD card images are available to speed up the setup process. For this project we created a new image that includes a bunch of applications that can interact with the Raspberry Pi CNC board.
- Standard Raspberry Pi Jesse Image.
- bCNC : A python based user interface application for controlling GRBL Boards.
- CNC.js : A nodeJS web based interface for controlling GRBL boards.
- Added extras's : MiniCom,XRDP and NodeJS
To install the image follow the standard process as documented by the Raspberry Pi website : Raspberry Pi - INSTALLING OPERATING SYSTEM IMAGES
Install the Raspberry Pi CNC board while waiting for the download
- Start by attaching the copper spacers to the Raspberry Pi. Depending on the board there will be 3 or 4 spacers.
- Plug the Raspberry Pi CNC board into the Raspberry Pi. The pin connector should be aligned properly.
- Screw the Raspberry Pi CNC board in place.
Command Line interface
This might seem hard but it is actually the fastest way to get started.
Included with the Raspberry Pi image is a small command line app called Minicom . It's a capable Serial terminal application and will be used to connect to the GRBL from a terminal window.
- Start by opening a new Terminal Window.
- Open Minicom in setup mode.
- Scroll down to "Serial port setup" with the arrow keys and press enter.
- A Raspberry Pi's hardware serial port is linked to device "/dev/ttyAMA0" and GRBL works at a baud rate of "115200 8N1".
- Press enter to exit the "Serial port setup" menu and arrow down to "Save setup as dfl". Then down to exit to switch to command mode.
- If all goes well you will get a window like this :
- To get a reaction from GRBL press "?". This will return the current machine position :
- To exit from Minicom press "Ctrl+A" then "Z" then "Q" then Enter.
Playing with bCNC
- On the Raspberry Pi desktop there is a shortcut for bCNC. Double click on it to start bCNC.
- Once bCNC has loaded it will open in an disconnected state like this :
- Click on the Open button to connect to GRBL :
- bCNC should now say Connected :
- To move the machine around, click on the Control tab at the top and use the arrow buttons to move the machine around.
This was a very quick introduction into using bCNC. For information on doing more advanced work refer to the bCNC Wiki Page
Playing with CNC.js
CNC.js is a web-based interface for GRBL. It hosts a webpage on the Raspberry Pi that can be accessed from a browser by any computer that's on the same network as the Raspberry Pi.
- To start the CNC.js service click on the CNC.js shortcut(Only do this once as it needs time to start-up) on the Raspberry Pi desktop.
- A terminal window running the CNC.js server should pop-up and looks like this.
- You will need the IP of the Raspberry Pi to connect to CNC.js . The easiest way to do this is by running the ifconfig command. In my case my IP was 192.168.1.10
- On a remote computer that is connected to the same local network as the Raspberry Pi open a Chrome Browser and in the address bar enter the Raspberry Pi's IP address with the port number of 8000 added at the end - "192.168.1.10:8000"
- Then all you need to do is open the hosted webpage.
- To move the machine, click on the arrow buttons on the right of the screen.
This was a very quick introduction into using CNC.js. For information on doing more advanced work refer to the CNC.js website.
Links and extra reading
- Raspberry Pi CNC - Electronic circuit that connects a Raspberry, GRBL , Stepper Drivers , Steppers.
- Raspberry Pi - Small Credit Card size computer.
- Arduino - Magic device that connects to sensors and computers.
- GRBL - GCode Interpreter that runs on an Arduino(Atmel ATMEGA328) Micro-controller
- bCNC - Python Based GCode sender that connects to GRBL
- CNC - Webbased GCode sender that connects to GRBL