Capable motion control from a $2 PIC and an $8 PCB? Yep! The higher end
PICs that can be installed on the BOB
Panel board actually have enough power to provide ultra low cost
motion control: Accepting
G-Code commands from a PC (via the
RLC3 USB adapter) and producing step
and direction for several axis CNC Mill, etc... control. Of course, that
depends on a PIC wizard like VegiPete writing hand optimized assembly code
to run the critical parts.
All the standard G-CODE commands are supported, 4 axis, XYZ plus A (or E),
rapids, feedrates, etc... With a ESP-8266
Serial to Web interface, the browser interface can add features like
remote interface, preview, status display, easy
configuration, etc..
Connect to the controller at 38,400 baud, N81, Xon/Xoff handshaking. A serial
to USB converter like the RLC3 provides
easy connection to modern computers or a low cost
ESP-8266 unit can provide a Web
interface. After power on or reset (S1 option during
Assembly) you should see:
;GPICode v0.83
Followed by the current configuration (see below) and then the homing sequence
if set to automatically home on startup or ;Waiting for Home command.
The unit is now ready to recieve commands via G-CODE. See
http://www.linuxcnc.org/docs/2.4/html/gcode_overview.html
for a more detailed overview of G-CODE.
A block is one line of text consisting of one or more "words" where each
word consists of a letter and a number. White space is ignored. Lower case
is converted to upper. A line of text ends with a CR and/or a LF.
A number can be positive or negative and may contain a decimal. A number
begins with optional '+' or '-' and ends with any non digit. Extra decimal
points are ignored. 12.34.56 = 12.3456 Extra +/- signs restart the number.
+12.3-4.5 = -4.5 (The number of decimal digits is specified in the config
and excess digits are ignored.
Recognized Words:
-
X,Y,Z,A recognized axes. X and Y movement is
coordiated. 2.5 axis functionality means that if a Z or A axis move appears
in a block, it will be acted on before any X and/or Y axis move.
-
F feedrate - inches (or mm) per minute
-
M (0-127) 3 = relay on, 5 = relay off, 226 = wait for eStop, others
ignored
-
N line number - (0-32767) - ignored
-
P parameter - (0-127) - unused
G-Codes:
-
G00 rapid positioning
-
G01 linear feed positioning
-
G02 unrecognized (Arcs are not supported.)
-
G03 unrecognized (Arcs are not supported.)
-
G80 cancel positioning mode (default)
--------
-
G17 XY plane - no effect (default) ONLY XY plane supported.
-
G18 no effect, XZ plane not supported
-
G19 no effect, YZ plane not supported
--------
-
G20 inches (default) (v 0.77 or 0.83 only)
-
G21 millimeters (v 0.77 or 0.83 only)
--------
-
G90 absolute (default)
-
G91 relative
-
G4 Pause P value is 1/10 seconds e.g. P10 G4 = 1 second pause
-
G92 set absolute position of any axes found to zero e.g. G92 X0
sets the X axis position count to zero.
Other / non-standard commands
-
% toggle UART echo (default on). Also resets line count on error messages.
-
/ block delete - ignore block if block delete is on.
-
( start of comment - remainder of line ignored.
-
; start of comment - remainder of line ignored.
-
(MS message - a 16 character string will be echoed. Extra chars ignored.
Must start at beginning of line.
-
(CF configuration setup/display. Must be at start of block. Must start
at beginning of line.
-
(?? returns current positions, in steps, at end of move, and status.
e.g. ";=X1233,Y200,Z0,A0,Relay OFF" Must start at beginning of line.
-
M66 turns of the actual generation of step pulses for testing purposes.
-
M77 turns step pulse generation back on.
To see the current configuration values, send the command
(CF
The current configuration is displayed and appears as follows:
;Config:
;Steps/inch X:+10000 Y:-10000 Z:+10000 A:+10000
;Fmax(F):60000 Accel(D):00030 SigFigs(B):4 BlockDel(C):ON
;Homing Config(E):ON
;Back speed: 100
;01 Y 050 040 010
;81 Y 050 040 020
;00 - 050 040 200
;80 - 025 040 010
To change configuration, send (CF followed by the letters
and values to set the configuration parameters. All configuration values
are integers. Decimal places are ignored. Case sensitive (use upper case
letter). A web page to ease configuration settings is available
bobmotion-setup.html
A,X,Y and Z are the steps per inch for the
corresponding axes. Negative values reverse the direction of the axis.
F is the maximum speed. (All axes use the same value.) Inches (or
mm) per minute
D is the acceleration value for all axes. Same units as F. Start with
30 and adjust up until there are problems, then back off for stable operation.
B is number of recognized decimal places. Extra decimal digits are
ignored with no rounding. For example, if N=3, 3.141592 is treated as 3.141.
C is block delete. 0 turns it off, any other value turns it on. When
on, any block starting with "/" is ignored. When off, any block starting
with "/" is processed as if the "/" were not present. (Note: untested with
"(CFG" blocks.)
E - power-up home if not zero
G - homing back-off speed
H - step 1 axis & direction bit pattern
I - step 1 speed
J - step 1 timeout
K - step 1 back-off distance
L - \
M - \ step 2
N - /
O - /
P - \
Q - \ step 3
R - /
S - /
T - \
U - \ step 4
V - /
W - /
For example:
(CF X 2000
(CF Y 2000
(CF Z 2000
(CF A 2000
(CF D 1000
(CF F 500
(CF B 3
(CF C 1
(CF E 1
(CF G 2
(CF H 2
(CF I 42
(CF J 40
(CF K 1
(CF L 1
(CF M 42
(CF N 40
(CF O 1
(CF P 16
(CF Q 42
(CF R 40
(CF S 1
(CF T 32
(CF U 42
(CF V 40
(CF W 1
(MSConfig updated.
In order to accomodate the reduced number of pins on the PIC vs the Parallel
Port on a PC, if your drivers depend on an enable signal from the controller,
we have to modify the board to consolidate all the drive enable lines into
one signal. Since Z and A are already together, that means cutting the traces
that connect X and Y enables and then jumpering them to Z/A. See the info
graphic here for those modifications, and the correct installation of R2
(required if you want spindle relay control). If your drivers don't need
an enable signal, simply don't connect it at the driver.
After the board modifications, install
-
Socket for U1. A specially programmed PIC18F14K22 chip is available on request.
-
J2 Serial port - bottom mounted, right angle header, for
RLC1 serial or
RLC3 USB adapter. FTDI cable can be used
if pins 1 and 3 are swapped.
-
JP4 & 5 (tie Z & A step pins to PIC, no xtal needed)
-
RP1 (Switch pullup. Includes !MCLR pull-up when S1is jumpered
to A3)
-
JP4 (20x2 header for 4Axis cable to stepper driver PMinMO connectors)
-
C5, C7 (power decoupling)
-
S1 - (optional) reset button see
optional
modifications
E-STOP and Limit Switches:
-
S4 E-Stop and Limit switches (Require
optional modification
to connect S4 to RC6 TODO: Add this to the standard modifications.).
To use the unit without limit switches, you will need to
configure it to not home on power up via (CF
E 0
-
The E-Stop and Limit switches are Normally Closed switches connect in series.
I.E. they are wired as a daisy chain, with the S4 signal from the BOB going
to one side of the NC E-STOP switch, then the other side, to one side of
the X limit switch, and the other side going to one side of the Y, and so
on until the last wire connects back to ground. This means that if a wire
breaks, or a connection is lost, the limit won't be missed.
-
Each Limit switch needs a ~4K7 resistor across it's pins, the E-STOP should
NOT have this resistor. When a limit is pressed, the line will still show
some resistance, which allows the unit to differentiate between limits and
e-stop.
Power Indicator:
-
D9 Power LED Installed on TOP
-
R5 (power LED current limit)
Spindle Relay Driver
The relay driver uses +5 logic power to drive the relay coil. If your relay
coil requires more than 5 volts or more current than is available from the
logic power supply, you can connect D8 directly accross the relay coil (stripe
to coil+) and then connect coil- to J8 and coil+ to a +DC power supply. J7
is not used. Or you can modify the board to use V+ as shown in
optional modifications
-
Q1 TIP122 (relay drive transistor)
-
R2 installed as per mods shown above,
To protect against spindle activation when bootloading
new code into the PIC, a 4k7 pull down resistor (from PIC pin end of
R2 to ground) can be installed. Or keep the spindle power off!
-
J7-8 (terminal blocks for relay coil)
-
D8 (relay spike clamp)
-
R3 (1k current limit resistor for relay LED)
-
D7 Relay LED Installed on TOP
Logic Power Regulator (not requred if USB will supply logic power)
-
U4 (LM317)
-
R6 (820 ohm)
-
R7 (270 ohm) - R6/R7 carefully measured to select exact values for 5 volt
output
-
C4 (power regulator filter)
-
J4-J5 (terminal blocks for power connection) A
barrel jack (e.g. CUI Inc p/n PJ-102A) can be installed instead but will
require an extra hole drilled in ground plane at the point where J4 and J5
meet as shown in optional
modifications. Scrape the solder mask to expose the copper ground layer
so you can solder down the tab of the jack.
-
D6 (input power polarity protection)
LCD Display (optional, nice for feedback when running without a program
that displays the current state)
-
J-LCD - 16 pin single row, also right angle header bottom mounted, connect
backlight pins if needed
-
R4 - a 5 or 10K potetiometer must be installed to provide contrast control
-
JP2 pin 6 (the LCD RW pin) must be jumpered to pin 2 (GND)
Errata
The power and ground pins (pins 1 and 3) are swapped on J2, the serial adapter
cable. If you are using an FTDI cable, be sure to swap the pins around in
the cable connector before plugging it in.
See also:
Setup configuration calculator
Source documentation
Interested: