List of M- and G commands as used by the CraftBot and expert specs.

 

This post will be updated as knowledge progresses… If you find some more info about the effect of M/Gcodes, please post it here, so I can update this list.

Specs:
Microprocessor Atmel ATSAM3X8E ARM CORTEX M3 84 MHz
Stepperdrivers: DRV8825
MosFET International Rectifier IRLH5034PbF
Thermistor extruder: 100k NTC. It’s this one from Robotdigg. This is the doc belonging to it.

About the transistors steering the fans: the special marking code was FFt the type number is BCV27 , that is the usual name , you could also use FGt , which means it is a BCV47 ( able to work at a higher voltage ).  So , if you search use the name BCV27 or BCV47

Battery CB+ PCB: CR2032 or CR2025.

Extruder Heater: 12V 40W / CB PLUS / CB 2 and CB XL= 24V
Bed Heater: ? silicon


Extruder fans: 40x40x10 mm, 12V, 6000 rpm. Maybe to replace with  Sunon MB40101V2-A99


 

Lineair movement

XY Lineair bearings (8 pieces) linear bearings are all 8mm x15mm x 24mm. Buy quality: like IKO. They are fastened by tiny grub screws!

Replacement possible with plastic bearings: Drylin RJ4JP-01-08. Smooth rods needed to be replaced too as the original ones are slightly to thick.

The XY smoothed rods are all 8mm. The length of the X rod is 331 mm, the length of the Y rod is 351 mm.
The Z smoothed rods are both 12mm

steppermotor 17HS3001-20B (40 N-cm / shaft 5mm, NEMA17
Motor step angle: 200/rev
Driver microstepping: 1/32 : 6400 steps for 1 rotation

Belt pitch BELT GT2: 2mm. The belt lengths are 132cm and 128cm.
Pulley 20 teeth x2mm= 40mm per rotation = 3200/40=80 steps per mm for XY movement EDIT: apparently I missed something when trying it with another electronics, or CoreXY needs double steps: it turned out it needs 160 steps per mm

Z screw pitch TR10x2: it needs (200 x 32) /2mm pitch = 3200 steps for 1mm Z height. EDIT, but Oh No! In practice I had to tweak it to 3050 steps for 1mm Z height (also when trying with another electronics).

 


Filament Gear

Filament Gear: diameter 10.8mm x pi = 33,9292 mm per rotation. Stepper: 200×32=6400 steps per rotation, so per 1mm Raw filament it needs 6400/33,9292=188.628 steps for the E (T0 extruder).

Filament gear: inside diameter:5mm, Outside diameter:10.8mm, Height:12mm, Number of teeth:38, Fixing hole:M3
(http://www.ebay.com/itm/5mm-38-teeth-Makerbot-3D-Printer-Kit-Feeding-Wheel-Extruder-Drive-Gear-/111682426600?ssPageName=ADME:L:OC:NL:3160)


Stepper frequencies

There are just two fixed frequencies for the stepper: 42000/13 Hz and 42000/40 Hz. . With the extruder doing about 188 steps per millimeter, the speeds are about 17 mm/s and 5.5 mm/s.


Max Speed limitation

At the moment the max XY speed is hardcoded in the firmware at a max of 120mm/s


General:

The Firmware will report an error -and stops printing- when there is a character as “(” or “)” is encountered when executing Gcode.
Simultaneous axis movement depends on the GCODE. For example if you send G1 X100 Y80 Z50 E10 in one line, this means that CraftBot will execute 4 movements at the same time with interpolation, thus all the movements will be started and finished at the same time. Slicers most often separate these commands by new line characters, for that reason they are not executed at the same time.
The left-front bed corner seems to be at X8 Y0, in stead of X0 Y0. Abjects are 8mm shifted because of that. Adjust in the slicer -if possible- to be able to print at the complete print area.

You can add in the startGcode of each slicer to following lines (after heating)

G1 X8 Y1 E10; to prime the extruder 10mm and move to the real bed corner
G92 X0 Y0 E0; reset X,Y and E value to zero

 


 G codes

G0: Linear move: E F X Y Z

same function as G1? (EDIT: G0 seems to result in more un-accelerated moves than G1 !?)

 

G1: Linear move: E F X Y Z

Normal move E=extrusion in mm Raw filament (before heated) , F=speed in mm/minute(not seconds), XYZ=position: all positioned to a absolute origin. Without the E value it’s a travel move, wit the E value it’s a print move, simple said.

 

G4: Dwell: P S Limited to 5 seconds.

A wait command: P=millisecond, S=second, So G4 S4 is a 4 second wait

 

G20: Set units to inches. for the no-standard countries ;-

 

G21: Set units to millimeters. for the rest of the world…

 

G28: Move to origin: X Y Z  Homing command, XYZ axis to the endstops

 

G69: endless  moves for testing the CB.Do not use.

 

G90: Set to absolute positioning.

The normal setting: the X0 Y0 Z0 is at the left-front corner with the CraftBot, the build plate at the highest point: all XYZ points are absolute to the X0,Y0,Z0 point

 

G91: Set to relative positioning. All the following XYZ commands are relative to the last point

 

G92: Set position: E X Y Z

Most used is the G92 E0 command, to reset the Extrusion value each layer, to avoid very high E-values at the end of the print when not done so

 

G101: Relative linear move: E F X Y Z Same as G1, but all coordinates relative to the last position

 

G197 pauses the print after excecuting all commands in the queue, and moves the head to X0, Y100.

  • Pause message will be displayed if the message is included in the G-code. (example: G197 ”print message”)

 

G198 moves the head back to the original location after pausing. The extrusion value keeps untouched.

 

G199 pauses the print immediately, and moves the head to X0, Y100. (this is the command the LCD screen uses)


 

M codes

M18: Disable stepper motors. The motors turned off and more or less able to moved by hand

 

M82: Set extruder to absolute mode. ???? makes the extruder interpret extrusion as absolute positions.

 

M83: Set extruder to relative mode. ???? makes the extruder interpret extrusion values as relative positions.

 

M84: Switch off Motors. The S parameter should turn the motors off after a period of time, but ignores it for now.

 

M104: Set extruder temperature: parameter S is temperature, So M104 S220 sets the extruder to 220 degrees. No waiting excecuting the folowing comands while heating.

 

M105: Get extruder temperature: P T Feedback about the extruder temperature

 

M106: Turn cooling fan on: H L S ???? M106 S255 is full speed? What is H and L? Terminal feedback: ok S:255 H:255 L:50

 

M107: Turn cooling fan off. ???? Duh.. only for the two print cooling fans, not the extruder fan.

 

M109: Wait Head Temperature: S

Set the extruder temp and wait for that temp to be reached before executing following commands
It looks like, it stops waiting if the temperature is within a 3 percent range of the set temperature, in Celsius. Eg. it is += 6 C at 180 C, but += 8 C at 240 C.

 

M110: Set current line number. ???? The number of the line of the list of Gcode commands

 

M114: Get current position.

???? This causes the machine to report its current X, Y, Z and E coordinates to the host.
Terminal feedback: ok X:60.21 Y:35.74 Z:9.47 E:0.00

 

M115: Get firmware version.

???? Request the Firmware Version and Capabilities of the current microcontroller
Terminal feedback: PROTOCOL_VERSION:0.1 FIRMWARE_VERSION:1.1.6197 FIRMWARE_NAME:pr3Dator MACHINE_TYPE:CraftBot EXTRUDER_COUNT:1

 

M117: Get zero position.

???? eport the X, Y, Z and E coordinates in steps not mm to the host that it found when it last hit the zero stops for those axes.
No terminal feedback

 

M140: Set bed temperature: The parameter S sets the temperature. Same as M104, but for the bed. No waiting excecuting the folowing comands while heating.

 

M190: Wait Bed Temperature: S  Same as M109, only for the bed.

 

M199: overrides the default pause position (normally X0 Y100, so M199X0Y100).

 

M300 : Beep.  P S (P is duration 100 is one second:  S is pitch: 3 is high 500 is low.

This command is not waiting thus it attempts to play the sound at once, but since there is an ongoing sound (first line) not other M300 commands are interpreted. Try to use this with the G4 command. M300 followed by a G4 and repeat.

 

M906: feedback about the set motor currents:

For the old steppermotors, also with new firmware, they use this kind of code:

M906 X50 E60
M906 gives this feedback:  ok A:56 B:56 Z:39 E:66

For the new silent drivers in the CB+

  • M906 command is updated with R,H parameters (motor current settings) for new silent stepper drivers (TMC2208):

M906 X R1100 H800 (A, B motor run current: 1100mA , hold current: 800mA)

    •  Answer:

Hold currents: A:800 mA B:800 mA E:380 mA Z:380 mA
Run currents: A:1100 mA B:1100 mA E:1600 mA Z:1300 mA

So for more current for the AB motors you can set:

M906 X R1600 H1200
Hold currents: A:1200 mA B:1200 mA E:380 mA Z:380 mA
Run currents: A:1600 mA B:1600 mA E:1400 mA Z:1300 mA

and for the extruder motor:
M906 E R1600 H600

For the CB3 the M5003 command is used.

M907:  Set decay mode:  A B E Z ok Decay  A:0, B:0, Z:0, E:0,

 

M1000: List supported commands.  ???? That way I started with this list ;-)

M1000 S69 gives also all secret codes

M1002: Get unique ID: S  ???? The ID of the specific CraftBot

Terminal feedback: My unhackable ID nummer in HEX probably: 12008, 0x314e304d08, 0x3230373108, 0x3231303908

 

M1003: Get firmware version: S

???? the firmware version loaded to the CraftBot
Terminal feedback: ok pr3Dator version: 1.1.6197 – 2014-12-18/1

 

M1004: Get HMI version. ???  Terminal feedback: *HMI version: 0.0.1

 

M1006: Set limits s=1 Case / S=2 Head: H L S

Psanyi (Sandor) has found out that adding some M codes to the header (startGcode) let the extruder fan spin faster. There is a
way in the stock firmware to modify the peek fan “aggressiveness”. The non-secret code is M1006S2, about M1000 tells this:
“- M1006:  Set limits s=1 Case / S=2 Head:  H L S”
The way it works is this: the firmware measures the head temperature, and if it is greater, than 80C, then it computes a value:
X = 50+TEMPERATURE/2
This in turn determines the duty cycle of the fan in 0-255 range:
DUTY = X*((H-L)/256)+L
These L and H values can be set with M1006 and the defaults are H=255, L=50.
Either you can solve the equation :-) or try different values for H, but anything over 255 will help you.
You can mess with L too, for example M1006S2LxHx sets the fan fixed at x.
You can modify your head fan cooling with the M1006 S2 code. The default is M1006 S2 L50 H255. Although it seems, like those are limited to 0-255 range, but in fact they are not. With higher H values you can speed up your fan, try M1006S2H300, M1006S2H350, etc.

To spin the extruder fan fast (as liked by my E3d metal hotend) I added this line to the startGcode:

M1006 S2 H350 ; spin the extruder fan faster

 

M1014: Get ADC values.

???? the readout of temps and voltage?
Terminal feedback: ADC: 20C, 19C, 22.5C, 12.0V

 

M1015: Get PWM duty.

gets the duty cycles of the heaters and the fans. For example you can monitor the working of the PID or the temperature dependence of the head fan.

M1114: Get machine coordinates.

gives back the CURRENT machine coordinates in STEPS, where the head is RIGHT NOW.

 

M1115: Get queue.

gives back the coordinates last entered into the queue of movements, that is the last GCODE line processed, but not necessarily executed yet.

 

M1160: Fan control (Case,Head,Obj):  C H O

M1160 H255 makes the extruder fan spinning faster, but it’s overrides quickly and returns to default.

 

M1200: Set feed properties: F H L   minimum(L), maximum(H) and multipler(F)

Works only with the terminal window. L:600 H:7200 F:1.00

 

M1201: Not in use (anymore)

 

M1202: Set axis soft limit: E X Y Z

???? The values specified set the software limits for axis travel in the positive direction.?
no feedback in terminal

 

M1203:  Set XY acceleration: A D F (values changed with the firmware from 1-1-2016)

default: M1203 A2000 D2000 F240

experimental faster acceleration: M1203 A3000 D3000 F1200
M1203 A = Acceleration. When set to 0, the acceleration is disabled. Causing more vibration. The higher the number, the steeper the acceleration.
M1203 D = Deceleration. When set to 0, the deceleration is disabled. Causing more vibration. The higher the number, the steeper the acceleration.

M1204: K1.0 E shift, experimental

The “K” is the correction parameter specified in potato units. The default is 1.0 potato. This one works the best when LH=0.2mm

M1205
E415 ; set 415 extruder esteps for 1mm RAW processing … this will not persist after power toggle, so put it in your slicers start-g-code or something.

 

M1210:   The default value is M1210 K0 F2400 (which means it’s not used at the moment by CraftUnique, but it still works) 

This is an essential feature to compensate for the delay in response of the extruder pressure related to accelerated XY movement.
The corner compensation has a K parameter, that is the strength of the compensation, and an F parameter, that is the minimum speed, that it applied to. The default is
M1210K1F1200, looks good for a generic PLA print.

M1300: Set extruder PID:  D F I P W

Extra parameter, F, meaning “Fan Correction”
Terminal feedback: ok S:255 H:255 L:50
An expert feature IMO. The PID controller algorithm involves three separate constant parameters, and is accordingly sometimes called three-term control: the proportional, the integral and derivative values, denotedP, I, and D. Simply put, these values can be interpreted in terms of time: P depends on the present-error, I on the accumulation of past errors, and D is a prediction of future errors, based on current rate of change What is the W value?

 

M1301: Set bed PID: D F I P W

extra parameter, F, meaning “Fan Correction” ???? Same as M1300 only for the Bed
Terminal feedback: Bed PID: P=25.00, I=0.10, D=0.00, W=100.00

 

M1400: Start heating and waiting:  B E H P Q

B E H P Q B=bed temp E=extrusie H=extruder ok H<Head temp> B<Bed temp> E<Extrusion after heating(mm)>. All parameter are optional
Here is an example:
M1400 H220 B60 E20 (heat extruder to 220 degrees, the bed to 60 degrees, and after that extrudes 20mm filmanent)


 

M1401: Not in use (anymore)

M1402: Not in use (anymore)

M1403: Not in use (anymore)

 

M4001 will display the current value of the Heated Bed (probably it is 80 now.)

To set a new max current for the bed: M4001 P70 should be ok.

M4002 P1: this will let the bed heating element to get as many current as it requires to heat up fast.


M5000 XY Z    Jog feed settings: 

M5000 XY Z
example: (these are the default factory settings)

M5000 Z2000 (Z feed 2000 mm/min)
M5000 X3500 (X and Y feed 3500 mm/min)

can be combined: M5000 Z2000 X3500

Mechanical parameter settings: (Necessary if somebody make changes the mechanics of the printer. The ratio is counted by these parameters.)

M5000 answer: ok XY:3500 Z:2000


M5001 XY Z E 

XY: diameter of the pulley
Z: pitch
E: diameter of the cog wheel
example: (these are the default factory settings)

M5001 X9.01 (in mm)
M5001 E10.8 (in mm)
M5001 Z2.0 (in mm)

can be combined: M5001 X9.01 E10.8 Z2.0

M5001 answer: ok XY_diameter:9.010000 , Z_pich:2.000000 , E_diameter:10.800000 X-Y jog limit bug fix.

M5003 current CB3

If you have layer shift then X and Y must be set.
Using M5003 without parameters you can read the actual motor current values.
You can set by issuing “M5003 X1000 Y1000” for example
The unit is mA so 1000 is 1000mA

M7001: Set WIFI SSID/Pass. There is also a new M-command in the CB2


M8002 a r200 h50
Hold currents:  A:50 mA  B:50 mA  E:380 mA  Z:380 mA
Run currents:  A:200 mA  B:200 mA  E:1400 mA  Z:1300 mA

M8004: code to diagnostic overcurrent error occured or not on HMI, Predator or on FFC cable. It is working only with v3.1t Pr3dator board.

Answers:

  • In case of old boards: Not supported at this predator board version.
  • In case of v3.1t borad: Head heat electrical wire OK. HMI board power supply OK. Pr3d board power supply OK.
  • In case of any fault ERROR appears instead of OK.
  • The new v3.1t Pr3dator board mounted with TMC2208 stepper motor driver is supported.

M4003 S270: sets max temp of the hotend, in this case 270c (At your own risk)

M6666 S69 does the reset. It really resets the main board, but no feedback to the LCD panel, so it won’t show you the changes. For example if you heat up using the LCD and you issue this command the LCD still shows its heating up, but that is not true.

M6666 reset without parameters, but you won’t see too much using this.

M6969 S69 erases the firmware.


Power Break and continue feature (only for CB+ and firmware 8886 and above):

Information I got from power coder Psanyi  about the power break and continue feature:

The limits of restart-ability:

  • the gcode has to be in the top directory, or maximum 2 directories lower.
  • the file must have absolute coordinates with millimeter dimensions.

The restart process:

  • the program detects, that there was a failed print, finds the file and asks, what you want to do first: heat the head or home the XY. if you have chosen home, then it lifts up the head some, then goes to XY0.
  • after that it starts to scan the file, passing almost all M commands to the printer, good for your motor tweaks and stuff.
  • if finds the position, then waits for the temperatures to settle, and after that goes to pause. In pause you can extrude, tweak stuff, etc.
  • if you press play, then it resumes printing

Some hidden CraftWare features:

ALT+CTRL+x = FPS and other screen rendering information.
ALT+CTRL+c = Camera path editor. I have used this to create animations shown in our Indiegogo campaign video
ALT+CTRL+z = Show / Hide buttons and info panel

CTRL+right mouse click and move is a look around function.