GRBLDroidBT - Documentation


Prerequisites
In order to use GRBLDroidBT you need :
1) A CNC machine
2) An Arduino Duemillanove / UNO board
3) An HC 05 Bluetooth module that can be found at ebay
4) An CNC SHIELD that can be found at ebay
5) 4pcs A4988 StepStick stepper drivers that can be found at ebay
6) One 1K resistor and one 1.8K or 2K resistor
7) Some Jumper wires
8) An Android tablet with Bluetooth

Connecting the Bluetooth HC-05 module device with Arduino.
If you have Arduino Nano use this schematic:
How to connect HC05-ARDUINO-NANO
If you have Arduino UNO use the schematic below :
How to connect HC05-ARDUINO-UNO

Configuring HC-05 device using Arduino GUI 1.0.6.
Once you have connected your HC-05 Bluetooth module with your Arduino board connect Arduino with your PC via USB cable.
Now open Arduino GUI and upload the following sketch :
// Basic Bluetooth sketch HC-05_02_9600+ECHO
// Connect the HC-05 module and communicate using the serial monitor
//
// The HC-05 defaults to communication mode when first powered on.
// The default baud rate for communication mode is 9600. 
//Your module may have a different speed.
//
 
#include <SoftwareSerial.h>
SoftwareSerial BTserial(2, 3); // RX | TX
// Connect the HC-05 TX to Arduino pin 2 RX. 
// Connect the HC-05 RX to Arduino pin 3 TX through a voltage divider.
 
char c = ' ';
 
void setup() 
{
    Serial.begin(9600);
    Serial.println("Arduino is ready");
 
    // HC-05 default serial speed for communication mode is 9600
    BTserial.begin(9600);  
    Serial.println("BTserial started at 9600");
}
 
void loop()
{
    // Keep reading from HC-05 and send to Arduino Serial Monitor
    if (BTserial.available())
    {  
        c = BTserial.read();
        Serial.write(c);
    }
 
    // Keep reading from Arduino Serial Monitor and send to HC-05
    if (Serial.available())
    {
        c =  Serial.read();
 
        // Copy the serial data back to to the serial monitor. 
        // This makes it easy to follow the commands and replies
        Serial.write(c);
        BTserial.write(c);  
    }
 
}

The HC-05 should be in communication mode with the LED on the HC-05 blinking about 5 times a second.
This indicates the module is waiting for a connection or to be paired.
Open the serial monitor from Arduino GUI and set :
BOTH NL & CR and speed : 9600 baud.
How to set arduino gui

Press the small button switch of the BT HC-05 board located at bottom right like the photo below.

HC05-BUTTON

Release the small button switch.
That’s it. You are now in "mini" AT mode.
The LED does not change. It still blinks quickly at 5 times a second.
In the serial monitor enter "AT" (no quotes) and hit Send.
You should get an "OK"

Query the version by typing "AT+VERSION?" and hit the Send button.
Query the name by typing "AT+NAME?" and hit the Send button.
Set a new name by typing "AT+NAME=NEW_BT_NAME" and hit the Send button.
Query the password by typing "AT+PSWD?" and hit the Send button.
Set a new password by typing for example : "AT+PSWD=2987" and hit the Send button.
Query the role of the device (master/slave) by typing "AT+ROLE?" and hit the Send button.
We need to set the device into slave mode so type : "AT+ROLE=0" nd hit the Send button.
Query the speed of the device by typing "AT+UART?" and hit the Send button.
We need to set a transmission rate to 115200 bps one stop bit and no parity bit so we have to give: "AT+UART=115200,0,0".

Uploading the GRBL firmware into Arduino board using Arduino GUI.
Download grbl-master.zip from here
Unzip only the grbl folder
Run Arduino gui
Hit : Sketch > import library > select the grbl unzipped folder
This will copy the selected folder at
C:\Users\[user]\Documents\Arduino\libraries

Now go to : File > Examples > Grbl > Grbl Upload
Now select
Tools > Board. Select your board
Tools > Serial port. Select your COM port
Hit the upload button

This operation generates a temporary hex file at : (example)
C:\Users\[user]\AppData\Local\Temp\build5690384548105260924.tmp\grblUpload.cpp.hex
using the option : File > Preferences > show verbose at compilation

Connect the CNC shield over Arduino UNO.
Now Connect 0,1 pins instead of digital 2,3 and remove the USB cable from Arduino.
Move Digital 2 to 0 RX Arduino
Move Digital 3 to 1 TX Arduino
See the pictures below for example on how we connect the CNC SHIELD with the configured HC-05 module.

How to connect cnc shield

How to connect cnc shield

How to connect cnc shield

How to connect cnc shield


Now power Arduino using the 12V DC and connect it with GRBLDroidBT

How to connect cnc shield


You are ready to pilot your machine using GRBLDroidBT.

Usage of GRBDroidBT
GRBLDroidBT is pretty easy to use.
All you need is to install it on an android tablet (4.0+) that has Bluetooth support.

Enable Bluetooth at the tablet.
Now go to "Settings" at your Android Device and hit "Bluetooth".
Hit "Search for devices".
Find your HC-05 device and pair it with your tablet using the password.
Now run GRBLDroidBT and press the "Connect" button in order to connect.
Hit the SCAN FOR DEVICES button like the picture below
scan for devices

Select your Bluetooth HC-05 device from the list.
The "Verbose" button shows more details into the bottom blue scroll box.
GRBLDroidBT supports only 0.9+ grbl firmware. The 0.8c firmware is not supported.

1) Command :
From the "command" tab you can send commands to your machine.
By sending "$$" you can see all the stored grbl firmware settings into the bottom blue scroll box.
More information about the commands can be found here
For example if we want to change the x max feedrate speed set it and store it at a value of 500mm/min then we have to send the command :
$110=500
In order to re-control the new stored value simply send "$$" again.
Main GRBLDroidBT form


2) Manual movements (Jogging) :
First of all make sure you have set a valid step size.
Step sizes can be integers or decimal numbers.
A step size of 1mm means that each time you press the +Y button you will moved +1mm towards the y direction from the current position that you are located.
You can also toggle between mm and inches.

RESET0 : redefines the origin of the machine
X0: redefines the X origin (Set to 0 the X Work)
Y0: redefines the Y origin (Set to 0 the Y Work)
Z0: redefines the Z origin (Set to 0 the Z Work)
Return 0 : return at origin of the Work coordinates
Soft Reset : resets the machine immediately. It's real-time and can be sent at any time.
$H : This command is the only way to perform the homing cycle in Grbl.
$X : Kill alarm lock. $X override the locks and allow G-code functions to work again.
$C : This toggles the Grbl's gcode parser to take all incoming blocks process them completely, as it would in normal operation, but it does not move any of the axes.
$G : This command prints all of the active gcode modes in Grbl's G-code parser.

Some considerations about the minimal value of the step size.
Let's say we have a CNC machine using a stepper motor of 1.8 degree stepping angle.
This means that the motor has 360degrees / 1.8 = 200 steps for one full round.
If we are using microstepping x2 (our example) then we have 200*2 = 400 microsteps for a full round.
We are going to use a M8 metric threaded rod with a pitch of 1.25 mm.
This means that for each rotation of the rod we slide linearly by 1.25mm.
So our minimal resolution (1 step) is 1.25mm/400steps = 0.003125mm/step
GRBL responds with a resolution of three decimal points like this :
<Idle,MPos:0.000,0.000,0.000,WPos:0.000,0.000,0.000>
So in our example a minimal step of 0.003125mm/step it is not fully understandable by GRBL firmware.
Try multiplying this minimal step with integers in order to get 0 after the third decimal point.
In our example we have : 0.003125*8 = 0.025 = 25 micron
This we can consider 0.025 as "minimal understandable resolution" for our machine.
Also after founding the "minimal understandable resolution" make sure that you always use multiple of this as step sizes.
So for example : 1mm step size is valid since 1/0.025 = 40 times.
10mm is valid since 10/0.025 = 400 times.
1.01mm step size is "invalid" since 1.01/0.025 = 40.4 times.

GRBLDroid jogging


3) Send g-code file :
"Load gcode" button opens a dialog and you can load your gcode file.
"Check gcode" checks the gcode file for long strings.
Each line of the gcode file should not be longer than 80 characters including the ending enter character.
Each gcode file must be checked before sending.
More informations about this limitation can be found here

GRBLDroidBT supports simple and advanced file mode.
We followed the official instructions from here
The simple mode is implemented as described here :
Streaming Protocol: Simple Send-Response [Recommended for Grbl v0.9+]

The advanced mode is implemented as described here :
Streaming Protocol: Character-Counting [Recommended with Reservations]

Start by using the simple mode.
The "Send" button sends the gcode file to the machine.
The "Hold(! command)/Resume(~ command)" button holds and resumes the file job.
The "Cancel" button cancels the job and soft resets the machine.

GRBLDroidBT send file


Video presentation :



Tips :
Use a dedicated tablet for GRBLDroid
Disable WiFi
Disable data / internet connections while using GRBLDroid
Disable GPS
Disable Autorotation
Enable only Bluetooth


Copyright © TrustFm.net 1998-2017 - Made by TrustFm - All Rights Reserved Worldwide