Installing a grblHAL Teensy based motion controller in a MillRight Mega V
Here is the process to upgrade a MillRight Mega V from an Arduino Mega Grbl board to a Teensy based grblHAL breakout board (T41U5XBB). It is fairly straightforward though there are quite a few steps. I have grouped them logically so it is a little easier to understand than a long laundry list.
First get the parts you will need.
Obtain the Teensy break out board. There is also an assembly kit available that has all the connectors. You can find them cheaper if you work at it though shipping can add up fast..
Get a Teensy 4.1 from PJRC.com or one of their distributors like Digikey or Mouser. Don't get the lockable version.
Get a USB B to MicroUSB panel cable extension. I got this one from Amazon.
Get or make a mounting bracket. See below.
Prepare the components.
Assemble the T41U5XBB following the instructions in the User Manual. Or, follow step by step in pictures. This will require soldering.
Download and install grblHAL. I have prebuilt versions so you can skip source code building. You will want to install the "grblHAL_T41 3X gangY qei.hex" file by following the instructions.
Configure the T41U5XBB. Run your favorite GCode Sender (I like ioSenderXL) and connect to grblHAL. Using the grblHAL wiki first run info, configure your board to use NO limit switches and control inputs. You may need to power cycle the Teensy to get all the settings to work. Try jogging an axis - if the DRO changes, you are good to go! For an alternative to the wiki page (which is a bit cut and dried) take a look at this blog.
Save all the Grbl settings from the Arduino in the MillRight control box. In ioSender, there is a Backup button that will write them out to a text file. But there are many ways to do it. Display the settings and copy paste or even a screen shot works fine, too.
Install the T415UXBB
Unplug the MillRight Mega V control box, disconnect the probe, limit switch and stepper motor cables. Move the box to a comfortable, well lit work area. Remove the acrylic cover. Label all the wires based on the screw terminals they plug into. There will be two wires per stepper motor (4 pairs total), 2 wires per limit switch, a pair of wires for the probe. There will also be several ground wires. Label all these wires so you can easily hook them up again. Did I mention to label the wires?
Disconnect all the wires from the Arduino Mega V board. You will need a small Phillips head screwdriver. Unscrew the 4 screws holding the board in place and remove it. Carefully move the wires out of the way.
If you are using a mounting bracket, install it now.
Remove the USB panel cable and replace it with the USB B to microUSB one. The one I got (listed above) was an exact match but if yours is different you may need to drill holes or nibble sheet metal to get it to fit.
Study the T41U5XBB - you will see labels for the various terminals. It should be fairly obvious where you will connect the wires. Unscrew the terminals you will be connecting until you hear them click - that means they are fully open. You will need a very small flat bladed screwdriver. Position the T41U5XBB over the opening with the USB port facing the power supply.
I recommend you use ferrules but it is not absolutely necessary. Twist any stranded wire as tight as you can - it will be a tight fit into the screw terminals. You may want to trim the bare wire a bit - mine were stripped a little longer than needed. Be careful not to get any bits of wire onto the board or into the controller box. You might want to practice inserting the wire a couple of times. Try to avoid "cat whiskers" as they can cause shorts and system malfunction. Once the wire is well inserted into the screw terminal, tighten the screw. Repeat that for each wire.
Plug in the USB panel cable and gently rest the board on the control box. You might want to use some cardboard to make sure it doesn't short on anything.
Move the control box back to the machine and hook up the cables but not the power cord.
Plug in the USB cable to the control box and PC.
Open up your GCode Sender and verify that it can talk to grblHAL and that it sees the limit switches.
Plug in the power cord and reset the EStop button if needed. Watch for any bad signs and be ready to hit EStop.
In your GCode Sender, reset your stepper motor settings (that you saved earlier). - $100-102, $110-112, $120-122 and $130-132. Do not change any other settings yet.
Try jogging each axis. If it jogs in the wrong direction, change the Stepper Direction Invert ($3) setting for that axis.
Once the stepper direction is correct, turn on homing ($22=1). Give it a few seconds and power cycle the controller by unplugging and replugging the USB cable. You may need to restart your GCode Sender. Now, press homing (or send a $H). If any of the axes move in the wrong direction, stop the homing (End key in ioSender) and use Homing Direction Invert ($23) to change it. I had to invert the X axis on our machine. Once you have it homing, your are ready to finish it up.
If using a mounting bracket, attach the board to the bracket. Power the system down and unplug USB first.
Reinstall the acrylic cover.
Place the controller box where you want it.
And thus it is done!
Mounting the T41U5XBB.
You could mount the board on the bottom of the control box. You will need to drill 4 1/8" holes in the bottom. Use the T41U5XBB as a template or use the hole diagram below. Nylon stand offs (or similar insulating tube) are need to keep the board from contacting the metal case. Use 4-40 screws. This will work ok but makes it hard to gain access to the board.
Sheet metal mounting bracket. This is a work in progress. [Update: new blog on mounting the PCB.]
I plan on adding a front panel to give access to cycle start, feed hold and EStop so wanted the board to be more accessible. A bracket could hold the board about 2 inches above the bottom of the case. Here is my first design. I'll be cutting and bending from 22 gauge steel. Note that the diagram says 18 ga but I only have 16 and 22 ga readily available. I'm not sure how well my brake will handle 16 ga so 22 it is. Note slots on the bottom foot of the brackets. This is allow a little adjustability to better position the board in the middle of the space. Once the optimal location is determined, the slots can be replaced with holes in the design. I plan on using 4-40 screws/nuts on the bottom and #4 sheet metal screws to hold the board in place. The top holes will need to be smaller than 1/8" that is called out.
Mounting hole template for the bottom of the controller box. Position so board has clearance from the sides and stepper driver when mounted.