|Main screen of the Touch DRO Androd app|
Last time I posted the schematic and firmware code for the Arduino DRO, for reading the iGaging scales. The plan is that the Arduino will read the positions and send it over UART to the app running on Android tablet via an inexpensive Bluetooth module. The nice part of using a serial-to-bluetooth adapter is that it's completely Plug-and-Play, so the hardware layer isn't too complicated. On the Arduino side we simply connected the Rx and Tx to the Tx and Rx on the Bluetooth board respectively, and provided power via Vdd and Ground. On the Android side all you need to do is to pair with the device. These Bluetooth modules use the so-called SPP (Serial Port Profile), also known as RFCOMM. When the controller is paired with the tablet it will behave like a regular serial port.
|Application screenshot taken from Nexus 7|
Recently I started working on a new version of my DIY digital readout project to that uses an Arduino DRO controller and an Android tablet. The DRO I'm building for my milling machine uses three inexpensive iGaging scales. (The whole set for my Hardbor Freight Mini Mill set me back less than $100 on amazon, in fact.) Since the bulk of the functionality is handled in the digital readout application, the controller design becomes much simpler, requiring only a few extra components. The parts listIn reality I've been toying with the software-based design for some time, and even wrote a basic desktop application on my computer. I scraped the idea of Windows application because without a touch screen the unit would be too cumbersome. When my Nexus 7 arrived in late July, it only made sense to use it for the DRO display unit. I've done some Android programming before, so it didn't take too long to get a basic app up and running. The app in the screenshot is a crude proof of concept, but I should be able to post a working version in a week or two.
As I mentioned before, my unit uses three iGaging scales and a controller based on Arduino UNO board to read them, as shown in the schematic below.
UPDATE: There is another version of this controller that uses MSP430 Launchpad and can read other types of encoders, such as “Standard” Chinese scales, cheap calipers as well as glass scales and rotary quadrature encoders. Please take a look at the "Android DRO" page for more details on different hardware versions.
|Google Nexus 7 Running an Early Version of DRO Application|
Having a full-featured DRO on a milling machine or a lathe would, no doubt, be very convenient. Unfortunately the cost of commercial units is very high, so the only way I could afford one would be to go the do-it-yourself route. My initial plan was to build a tradition digital readout unit using six 7-segment LED displays per axis and an ARM microcontroller (STM32VL Discovery Board). To build the first prototype I used the free version of Atollic Studio. Even though it was "crippled", compared to the full version, at least there was no code size limits. Well, as of the last version, Atollic added a code size limit so I decided to scrap the idea of an ARM-based DRO. Instead the DRO would consist of an Arduino-based scale driver and an inexpensive Android tabled as a readout display.
A few days ago I posted some intructions on how to use a standalone Atmega328 (or Atmega168) on a breadboard. This approach offer a good cost reduction for Arduino-based hobby projects by reusing the USB-to-TTL circuit between the projects. The cost saving can be close to $20, but there is a small tradeoff in convenience. Instead of the customary "plug in the USB cable and click 'Upload' ", we will need to hook-up a few wires; nothing too bad, though. Let's look at two different approaches: using FTDI adapter and an existing Arduino board.
|Arduino on a Breadboard|
In the previous post I showed threeways to reduce the cost of an embedded Arduino-based project: using one of the Arduino Pro variants, using a preloaded Atmega MCU and burning the bootloader yourself into a blank Atmega MCU. For the first option, a “Pro” board with a Sparkfun's FTDI adapter all you need to do is to plug the board in (making sure that GND pin on the board matches that of the adapter) and you're good to go. The only drawback is the price tag of $20. The last option is the cheapest, but requires an AVR in-system programmed, and if you have an AVR ISP, chances are you don't need me to explain how to use it. The “Goldilocks” approach is to purchase the chips preloaded with Arduino bootloader. This approach provides a good balance between beginner-friendliness and cost. This is the option I will be using in my open source projects. In this post I will show you how to build a basic Arduino circuit on the breadboard.
Arduino Pro Mini, Atmega 328 with Arduino Ominiloader Uno and a blank Atmega328P
In response to the reader feedback I'm going to use Arduino for the DIY DRO Project and the stepper motor driven power feed. Arduino makes a great choice for beginners, in large part due to the standardized form factor and self-contained hardware. The flip side is that the boards cost between $35 and $70. “Wasting” a full-blown board for each little project gets expensive quickly. Every “mainstream” Arduino board comes with a USB-to-TTL adapter on-board that adds about $15-$20 to the board price. Having the adapter is convenient for prototyping, but in a “deeply embedded” projects this is a waste of money. Once you buy your first Arduino board or an “FTDI” adapter, the USB circuitry can be omitted. There are many ways to implement a minimalistic Arduino controller, but the most common ones are:
|Ten brand-spanking-new LED display PCBs|
for the DRO project
A week or so ago I finished laying out the LED display PCB for my DRO project. I built one unit some weeks ago using a prototyping board, but when a friend asked me to built one for her husband, I decided to bite the bullet and make a proper circuit board. This is by no means necessary, but wiring three MAX7221 on a prototyping board isn't my favorite pass time. Additionally, by using surface mount parts I was able to squeeze 24 digits (three rows of eight digits) and six tactile switches into a 5.75” x 3” board, whereas the initial prototype took 7”x5” prototype board for 18 digits (6x3) and no buttons.
Yesterday I installed the "Large Table Assembly" and the "Air Spring Kit" from LittleMachineShop.com, so today was the time to tram the column and the head. I've seen some people tramming the column by attaching a dial indicator to the quill and adjusting the column unti the reading on both end of the table are equal. There is one huge flaw with this method: it doesn't tram the column, it trams the spindle. If you look carefully, the head is composed of two castings. The part that holds the bearings and the spindle is held by grou long bolts, and, you guessed it, is not always parallel to the dovetails. A tell-tale sign that your mill has this problem is when you jobber drill bits miss the spot that you started with the started drill bit. Essentially the head is perpendicular to the table but the column being at the angle offsets the head in the X axis as you move it up and down.
|Mini Mill Large Working Table Next to The Stock Model|
I've had my Harbor Freight mini mill for over a year. Overall I like the mill, and can't imagine living without it, but after I started making some larger parts for my CNC router, I keep bumping into the limited Y and Z travel. I was almost set on getting an X3 mill, but one evening, while browsing LittleMachineShop's catalog I noticed that they had a "Mini Mill Large Table Assembly" for $299.95 (roughly $340 shipped). According to the description, the table provides 30% of extra movement on both axes. Long story short, I placed my order last Thursday and today UPS dropped (literally) the package at my garage door. The table came preassembled in a standard wooden shipping box, bolted down to the bottom board with two bots. UPS managed to seriously bust the box, but luckily the contents were undamaged. I haven't had a chance to install it yet, since I'm doing some other upgrades at the same time.
This is the first part of a tutorial on driving MAX7221/7219 display drivers with STM32VLDiscovery board. In this part we will cover the basics, i.e. how 7-segment display work, how the shift registers work and how to talk to MAX7221/7219 chip. In the next section I will post the source code for STM32 Value Line Discover board and explain the kay points.
As I mention in the post on DRO Design Considerations, I decided to use standard 7-segment LED display for the position readout. Since the DRO is targeted at a small milling machines, 6 digits per axis is more than enough *. This means that we need to drive 18 dits total, and by far the most convenient way is provided by Maxim 7221/7219 shift registers. Many hobbyist are intimidated by these ICs, but under the hood they are very simple. Both chips use SPI protocol to receive data and can drive up to 64 LEDs, or 8 7-segment displays. MAX7219 and MAX7221 are almost identical, with one minute difference: MAX7219 is not SPI-compliant. I will elaborate on this a bit later, but for this project they are interchangeable.
As I'm waiting for the parts for my do-it-yourself Android DRO, I'll start doing some proof-of-concept prototypes with the parts I already have. So, first things first - we need to figure out how to read the Grizzly/iGaging scales. The easiet way to reverse engineer the protocol is to connect a logic analyzer (Open Lgic Sniffer in my case) and see what's happening in the wires. The screenshot below gives a good idea how those things tick (no pun intended).
|21 Bit Protocol Capture|
|Power Feed Prototype on a Bread Board|
Power feed is generally pretty useful, and a Mini Mill model can be had for about $150 from LittleMachineShop.com, but as usual, I want more than an off-the-shelf model could provide. I'm making some part for my CNC router and will have to do repeated passes to a specific position. Initially I was going to rig-up some sort of adjustable limit switch, but after some experiments discovered that they are not very repeatable (at the leas the ones I had). A stepper motor, on the other hand, could be programmed to stop after a predefined number of steps. I didn't want to do a full CNC conversion, so I decided to go with a simple microcontroller-driven driver that would let me set 0-position and then jog the table to that position multiple times.
|STM32VL and STM32F4 Discover Boards|
These are ST Micro's evaluation boards for ARM Cortex-M3 and ARM Cortex-M4F microcontrollers. Mouser sells them for $9.88 and $16.25 respectively, placing them well within the reach of most hobbyists. Both boards come with built-in ST-Link/V2 programmer/debugger, and Unlike LCPXpresso's LPCLink, ST-Link is not locked into any particular IDE. There are even some reports of people using it with GNU C compiler and debugger. Better yet, the ST-LINK/V2 can be used to program any STM32 chip by manipulating a couple of jumpers.
In my last post I mentions that I'm starting to work on a new DIY project - a “Digital Readout on steroids” for my Harbor Freight (Sieg X2) mini mill. I imagine it will be one of my “constantly evolving” projects, i.e. there likely won't be a “done” state, and new features will be added as I think them up. For now I pretty much made up my mind on what will be included in the initial version, but I will try to leave some space for future improvements. The first step will be to prototype the hardware and get the basic low-level functionality working, i.e. reading the scales, writing the position etc. I will make the design as modular as possible, so the parts can be reused or easily replaced if the magic smoke runs out. The unit will consist roughly of the following building blocks (I will go into more details in future posts...)