Wednesday, August 10, 2016

HiTorque Mini Mill CNC Conversion

About 6 months ago, I became the proud and excited owner of a HiTorque Mini Mill from LittleMachineShop.com.

New life goals include buying more things that come on pallets
Owning a mill has been a goal of mine since sometime in high school. Getting to work on full sized manual and CNC machine tools in college only further prioritized this goal to a need. It also revealed that while my manual milling work might be passable, the speed, precision, and geometric flexibility afforded by a CNC setup would be invaluable as my projects became more ambitious. After months of consideration, this was the route I chose to get there. There was essentially no design or analysis involved with getting this tool set up, so the following isn't much more than an annotated slideshow.

But first - the details people actually want to know about:

The Tool & Tooling
1 x Mini Mill - $895.95 (plus ~$200 or so for residential shipping!)
1 x Drill Chuck - $10.95 (I was a dummy and bought a second not realizing one came with the mill)
1 x Tooling package - $229.95
1x Dial Indicator - $24.95

The Conversion Equipment
1 x CNC fusion Mini Mill Kit #5 - $655 (You can pay a little extra for pre-loaded ball nuts, which I did)
3 x "Green Monster" Stepper motors -$224.85 (total)
3 x "MondoStep" 4.2 Bi-polar stepper drivers - $239.85 (total)
1 x 40V 10A Linar Power Supply - $89.95
1 x PBX-MX Parallel Isolated Breakout Board - $69.95
3 x IDC Mondo Cable Kit - $50.97 (total)

The Random Amazon/McMaster Stuff 
1 x Generic Cheap Grey Enclosure - $27.43
1 x Bag of  Tiny Cable Glands - $5.12
1 x Extra Clicky Limit Switches - $6.08
1 x IDC Female Sockets - $11.95 (I find myself looking for excuses to use these everywhere now)
1 x Colorful Ribbon Cable - $10.95 (Complements the IDC sockets)
1 x Uncomfortably Cheap E-Stop - $5.92
1 x Extra misc. parts and fasteners - $100

Total: ~$2,659.82 (shipping not included)

A few thoughts:
-Don't skimp on the tooling package, that was an awesome value for what you get
-CNC Fusion is run by some very nice people who produce really high quality kits. However, turn around time seems to really depend on how busy they are, so consider ordering well in advance.
-Probotix seems a little overpriced, but for peace of mind and a deadline constrained build, it worked out
-The PBX-MX board works fine, but it makes me sad that the CNC world still hasn't really advanced beyond the year 2000's communication standards. If I were to do it again, I'd pay up a little more for something USB capable.
-That linear power supply (at least at the time) was supported with absolutely no documentation, which is a shame, because it wasn't immediately obvious to me how it should get wired. Check out the images below if you're in the same boat.
-Yeah, that IDC cable kit is silly expensive...but at least it looks nice.

So were the results worth the price tag? For me, absolutely. I suspect that will also be the case for anyone else who looks forward to putting in the time to assemble a setup like this. That doesn't mean that there aren't potentially better options out there for different needs though. I spend a good deal of time looking at CNC solutions in the sub-$10k market, and for me it came down to the following highly oversimplified chart:


Here's how the conversation goes in my head:

I don't have the time to design and built a Bridgeport conversion kit from scratch, or the money to buy an off-the-shelf solution. I definitely don't have that kind of space availability either. I've done the CNC router thing before. Although I donated my Franken-ShapeOko creation to a student team a few months ago, I wouldn't be opposed to buying/making another in the future. But those machines still lack the spindle power and rigidity to pull off more demanding machining. The Tormach machines have been documented to death on Youtube as being awesome and surprisingly capable for the price. But that price (especially with the addition of tooling and peripherals) is too high for me right now. One day I'll probably be ready to make the investment, but I feel reasonably confident that that day is far enough away that I'll have gotten my money's worth out of the mini mill by then. Of course, it could just be that my impatience is making up justifications to buy now...

(Just as a note, LittleMachineShop does also sell a Sieg prebuilt CNC option, which seems to fall into the cost and capability space between a benchtop conversion and Tormach. Unfortunately, it has a fairly limited y-axis travel distance, which was a deal breaker for me.)

The Documentation

(Please note that this is far from comprehensive. Just a quick tour of some of the highlights from the build)



It turns out that I don't have the patience to do nothing while waiting for parts to arrive. So instead, I built this big box to hold the mill. The idea was to have big sliding doors with polycarb windows to seal off the machining area. I never got around to installing the doors because....


The conversion kit was here (not pictured: lots of additional parts). Following the CNC Fusion assembly guide in parallel with a video guide, I took apart the brand new Hi-Torque bed.


This was a fun and informative process. I'd not seen gibs before, nor how the leadscrew nuts were retained. It turns out they're allowed to float in machined slots on the x and y axes (visible with nuts still installed above), before being tightened down with set screws once threaded and aligned with the leadscrew.

Slightly more detail of the x-nut slot
Fitting in the ballscrews basically involves reversing the previous process with some new hardware, except with ball nuts.


And grinding. Somewhat excessive amounts of grinding. To be fair, the instructions note that the y ballscrew is slightly too long for this model of mill. A small relief has to be put at the back of the base for it to fit.


It doesn't hurt to grind a little more than you think is necessary. I probably stopped before I should have, and now get very occasional grinding noises from the y ballscrew if I approach the max table travel. It doesn't seem to affect performance, and it's not quite annoying enough to convince me to take the whole thing apart again.


Mounting the z-axis is probably one of the trickiest steps, as it requires somewhat precise drilling into steel that doesn't want to be drilled into. I messed up one of the holes by using a wandering dull drill bit, so had to make full use of the slotted mount points on the z-block. Getting the mill head support block aligned with the ballscrew and the z-block was also slightly time consuming, and took a little fiddling before I got clean up and down operation. Clamping the head or resting it down on a block is probably a good idea for safety.


And suddenly, a nearly complete mill appears. Installing the motors and lovejoy-couplings was fairly uneventful. A single bolt on a motor mount block was bent from shipping, but it was redundant and easy to replace.


In parallel with the machine, I was making progress on the control box.


It's not perfect, but I think I did an acceptable job at keeping things neat. I used a scrap piece of plastic to act as a back plane in the enclosure. The E-Stop and main power switch are mounted on the outside facing the operator, while the parallel port and stepper lines exit near the back.


The crucial shot. No, that's not the stock fuse...


The E-Stop really is a must. It saved me from countless crashes during the "getting to know you" stages of Mach3 wrangling.

All told, I'd guess the built took 2 days going at a slow-medium pace. True to my expectations, the debug period involved about another 3 days of playing around. As my experience grew with the software and the controller layout, it became much more convenient to use.

For my first "test" project on the machine, I machined a LED lamp casing for a friend. It involved some tricky to fixture and indicate parts, as well as gave me a chance to get familiar with Fusion 360 CAM. 

Material prepped on the lathe

Temporary clamps to spot drill holes




It's a good idea to protect nearby outlets from flying aluminum chips
Some deep inner and outer cuts, plus fixture plate action



The finished piece
 Overall, I was pleased with the surface finishes being produced by the machine. After completing the piece, I noticed some x-axis slop that I then corrected for. I think that it should be fairly easy to get within a few thou on most parts with this setup, and that's perfect for most of the work that I do. A couple annoyances I discovered:

- Jogging with the mouse and keyboard is frustrating. I might invest in a peripheral for this.
- Resetting the tool height for every tool is extremely time consuming, and increases the risks of crashing because I have to stop and restart the program from a certain point. I started outfitting certain endmills with collar stops (kind of like a cheap version of the Tormach Tooling System), which should allow me to get consistent tool heights.
- Using the drawbar to swap endmills is slow. I see the appeal of power drawbar systems. I often found it faster to just do drilling tasks manually on the drill press

Unfortunately, my time with the machine was limited due to winter break. Since then I haven't had the chance to do an accuracy or precision study on the parts the machine produces. Nevertheless, I'm extremely happy with how the conversion turned out, and hope to get years of prototyping out of it. If I ever spend some time making modifications or updates to the machine, I'll be sure to document those as well.









Tuesday, August 9, 2016

mechEtroller v1.4 and v1.5



MechE-troller: the brushed motor controller that just keeps staying true to its namesake. Until now at least. The last update on this project was way back in last August (and even that post was months late), so it seems like time for the annual update. 1.3 made good progress, but reflected some fundamental goofs in designing with N-channel FETs. After the end of finals last year, I took some time to read up on a little more h-bridge theory. For any who haven't already discovered it, the H-bridge Secrets series of articles (by Andras Tantos) is a truly fantastic resource.

As referenced in my last post, I decided to move forward with a new unified gate driving solution in v1.4: the Allegro Microsystems A4940.




Reviewing the goals from v1.3:

• Swapping out the four individual gate drivers for the A4940 chip [check]
• Overall cleaner component layout, particularly with the capacitors for logic components [kinda...]
• Simplifying voltage regulation down to just one regulator (thanks to the A4940) [check]
• Switching to a surface mount crystal (just to standardize) [check]
• ICSP header (it's not worth the hassle of using a pogo ICSP programmer when I have the extra board real estate) [check]
• Possibly using FETs with a lower Rds (at least on the high side) [nope]
• Larger reverse polarity protection diode on the voltage regulator [uh oh]
• More capacitance across the power input (to provide buffering for larger motors) [check]

The lack of protection diode would come back to haunt me later. Besides that, this design and layout was a significant improvement. Upon receiving the boards, I went through my usual step-by-step approach to avoid immediately smoking expensive components. Voltage regulation worked well, as did bootloading and programming the microcontroller. All component footprints were fine too.


Problems began, as usual, when I tried to start switching the gates. Power levels seemed good, logic voltages were within range, but nothing would ever happen. A double check of the datasheet led me to try reading off the fault line. Sure enough, the chip was throwing a fault and locking its outputs. Another hour staring at the datasheet revealed the deal-breaker for this board: VDD was tied to ground. The above schematic reflects the correct VDD connection, after I discovered the error.

Version 1.5 started out as a simple correction to that one trace, but quickly grew in scope as I became more and more dissatisfied with the layout of 1.4. I think I nearly completely redesigned the board about three times before I finally cutting myself off, each change a few months apart. Issues I wanted to address were:

-The terrible capacitor layout that I'd been stuck with since the very first design
-The B+ solder point located right in the middle of the board
-The spread out locations of the logic headers
-The through-hole cap package
-The general mess created from the autorouted logic side
-The non-impedance matched lines going to the crystal

Here's how it turned out:


Pro-tip for the clueless like me: the frames library really cleans up your schematic
The long gate drive lines still make me wince every time I look at it, but that may have to wait for a future revision. I like how this layout could feasibly be built into a case, something I'll probably look into as the board gets closer to full functionality. So this is the design I'll be adopting in the future. The power capacitors are much closer to the action now (though still not quite ideal), and got converted to a slick SMD package. Similarly, I tried really hard to get the logic caps right where they needed to go. My linear voltage regulator and poorly isolated power and logic grounds probably aren't going to stop much noise, so I need all the decoupling I can get. Other notable additions include resistors on the gate drive lines, silkscreen that actually tells you how to plug things in, and (closer to) impedance matched traces (meander command in EAGLE if you're unfamiliar). Notable absences include a diode on the voltage regulator, which killed every single IFX27001 LDO in my inventory in a single night. After that point, I had to run the board's logic side off a separate 5v power supply.

So with new boards in hand, (and a new, very small workshop) I set about testing. The first board tested successfully for power and microcontroller bootloading, but kept throwing faults on the gate driver. With nervous flashbacks to 1.4, I chalked it up to hasty soldering, and began again on the second board. Frustration high from hours of debugging with the first, I managed to bodge the voltage regulator trace on the second board, rendering it useless. Coming back later, I finally put the third together, MOSFETs and all.

And it worked. For the first time ever. High side gates were boosted to the proper voltage, and switched with a clean waveform. The low side was flawless too.

A happy gate drive

With the hardware working, it was time to turn to the software side. I wrote a program designed to operate the bridge under a lock anti-phase drive scheme. Summed up very simply, this mode effectively runs the motor at each polarity for a different percentage of a set period. At a stop, the bridge drives the load forward 50% of the time, and in reverse 50% of the time, creating a brake effect. At full forward or reverse, 100% of the period would be devoted to driving in that direction. This can also act as a form of regenerative braking, where motor inductance forces current to keep flowing in the same direction even after the polarity switch occurs, charging the battery slightly during motor deceleration. Unfortunately, my efforts to duplicate this effect were only marginally successful.

Instead of working with the internal timer registers of the 328p, I tried to use a combination of Arduino functions and direct port manipulation to control the output pins. This worked, but only at a frequency of about 10kHz. Furthermore, that was only after removing analog signal reading ability and additional math used to produce more accurate outputs. It was possible to drive the motor, but not without a painful 10kHz whine and a strong vibration. Lots of current was wasted as heat, and control was basically non-existent. Finally admitting defeat, I went to go research some of the lower level functionality of the 328p chip, only to realize that one of my high side gate drive traces was not connected to a compatible pin. That effectively sealed the fate of lock anti-phase drive.

So after a few days of work on that control scheme, I decided to try one last option to get v1.5 working. That was sign-magnitude drive, or the method of only driving in one direction at a time, and switching the low side's duty cycle while holding the high side constant. This simply requires you to swap FETs when the time comes to spin in the reverse direction, and repeat the same process. What it meant for me was that I could cheat and just use analogWrite on the low side. As it turns out though, sometimes the easy route is pretty effective:




With the PWM pins effectively running in "parallel" with the rest of the code, I've had ample time to add in additional functionality without slowing down my switching speed. In my tests so far, I've been unable to even get the MOSFETs warm yet. Clearly I need to find a bigger motor and a battery with a higher discharge rate!

The next step for mechEtroller is getting the issues identified in 1.5 fixed for 1.6. Before sending out to the fab house, I'd also like to get current control and possibly encoder input tested, just to verify that it works. I think it may also be time to step up to 2oz copper on the next round to handle those higher currents. A final goal is to see if I can break the once annual cycle of mechEtroller updates.

Check back for more soon.

Tuesday, May 31, 2016

PUMA 260A Robot Arm Video

Some long overdue video footage of the PUMA's first post-repair moves:


It's being run quite slowly in the video out of cautiousness. Once I had more confidence in the controller, I bumped it up to higher speeds. Currently the serial connection is getting spotty again. I suspect the card edge connector corrosion is still continuing despite removing the battery acid crystals. I'll definitely be replacing the controller with some custom hardware, so check back for more updates in the near future!

Tuesday, March 1, 2016

Recent work on the RPI Formula Hybrid team

Lots of projects have been underway recently, both RPI Formula Hybrid related and personal. My free time has been minimal over the past few months, but I wanted to document a couple pieces of what I've been involved with recently!

Quick progress update on the high voltage accumulator subsystem (with lots more to come):

http://rpihybrid.blogspot.com/2016/03/building-battery-pack-new-sponsor-li.html

A write up for the sponsor of the team's programmable DC power supply:

http://magna-power.com/blog/2016/battery-charging-rensselaer-formula-hybrid-team

In addition to the battery pack, a huge amount of effort is going into this year's scratch-built battery management system. Fellow student Szymon Morawski and I have been designing this hardware as part of an independent study course this semester. I look forward to completely documenting it once the final debugging is done, but for now here is a snapshot of the primary microprocessor board and string monitoring peripheral board from about a month ago:





New updates on mechEtroller (my brushed motor controller project), a battle robot project, CNC mill retrofit and more are coming soon as well!