Friday, September 21, 2012

Do-it-yourself DRO with Arduino and Android

UPDATE: I recently published the source code for this project. Details are available in the "Source Code for the DRO" post
Google Nexus 7  Running an Early Version of DRO App
Earlier this year I started tinkering with an inexpensive, easy to build, do-it-yourself DRO using iGaging scales sold by Grizzly. You might recall from one of my posts that the original design was based on STM32VL Discovery board, subsequently switched to Arduino Uno. I was able to build two simple prototypes (one for me and one for a friend). The first version was pretty bare bones, consisting of three 6-digit LED displays with “zero set” and “mm/inch” buttons.
Even such basic DRO proved to be amazingly useful, but I quickly started compiling a list of features I would like to add. Soon it became obvious that the little Arduino board with six buttons would not be able to provide the “bells and whistles” I wanted. After playing with different microcontrollers, input designs and display ideas I decided to scrap the original plan and take a different approach. Instead of the traditional self-contained unit, the new design will consist of two separate parts: Arduino-based driver used to read the scales and an Android tablet as the main processor and user interface. The two devices will communicate with a simple serial protocol using an inexpensive Bluetooth modem.
Parts required to make a wireless reader
for Grizzly iGaging scales using Arduino Uno

Encoder Driver

Reading the iGaging scales or other digital calipers is a fairly simple exercise. The driver would need to read three scales, either sequentially or in parallel, convert this data into “ticks” and send the result to the “mothership” over UART. This doesn't require much processing power, but precise control over the timing is critical. While Arduino is an obvious choice due to the availability and ease of use, virtually any microcontroller with 6 available general purpose I/O ports will be up to the task.
The obvious benefit is that the driver can be built for as little as $20 by using MSP430 Launchpad, an old “USB” phone charger, and an inexpensive BlueTooth modem off eBay. While the low cost is definitely a good thing, there is an even more important benefit: this approach provides a layer of abstraction between the encoder hardware and the DRO software. As long as the positions sent to the table are in the expected format, the hardware used to read the position is largely irrelevant.

DRO Display

Once the data is read from the encoder, it needs to be post-processed. Ticks need to be converted to standard measurement units (inches, millimeters, palms etc.), predefined offsets applied to zero-out the origin and the results formatted for the display. Most of those operations require floating point multiplication and division. Unfortunately, the microcontrollers available to hobbyists fall seriously short when it comes to floating point math. Application processors that come in modern Android tables, on the other hand, have gobs of power and handle these tasks very well.
Even more important benefit of using a tablet is the large backlit touch screen. Besides being easy to read and interact with, graphical touch screens offer awesome flexibility. The user interacts with the DRO the buttons can be added or removed; the whole display can be resized or rearranged; complex functions can be presented as separate views etc. Instead of using multi-button sequences to access common functions, you can have a user-friendly graphical UI at your fingertips. Finally, software installation becomes virtually trivial using Android market or a standalone app installer utility.

Conclusion

Overall, I think this is a good approach for a do-it-yourself DRO. On one hand it significantly simplifies the construction process by reducing the complexity of the reader hardware. On the other hand it provides a way to tap into the performance and easy of use of a modern Android tablet. Android tablets, phones and netbooks are quickly becoming ubiquitous. Cheap no-name tables are sold for under $100 on eBay, but there are quite a few full featured “brand name” 7 inch models in $200 range. It only makes sense to use an Android app running on an old phone or tablet rather than building the display from scratch. In reality nothing you or I can build for under $200 will approach the performance, flexibility and utility of Google's Nexus 7 or a similar unit. In addition to the gobs of processing power available from dual or quad ARM processor running at or near 1 Gigahertz, hundreds of megabytes of RAM and gigabytes of storage those units offer a gorgeous, easy to read and use touch screen. Not to mention that the table can be used for other purposes when not busy performing it's DRO duties.

17 comments:

  1. Could you supply some details on the android software? I could use such an interface on a variety of my projects

    ReplyDelete
    Replies
    1. Stephen, I'm still working on it. I should have a stable version by the end of this week or mid next week at latest.

      Delete
  2. The DRO readout display is BEAUTIFUL! Care to share your code?

    ReplyDelete
  3. Is the source code for this app available, I have almost a direct application of the display with an accelerometer...

    ReplyDelete
  4. Rando and Bacwoods Engineer,
    I'm still working on the app, but it will be open source. I will make a public BitBucket repository in a day or two.

    Thank you
    Yuriy

    ReplyDelete
  5. I'd also like to see what you did with the plain 6 digit LED version.

    ReplyDelete
  6. This would also be useful as a wireless remote display for an inexpensive digital caliper. It would not be hard to have a button connected to the Arduino that would not only transmit the current reading, but would also trigger the tablet to make a short voice recording (with possible TTS conversion after).

    The use of a cheap BT module is the key. My prior efforts used cables that would get in the way or tangle during use.

    But I need something smaller, that can mount directly to the caliper. I'm thinking combining a DigiSpark with a RadioBlock (both on KickStarter) will do the job nicely.

    Time to fire up Py4A and see if I can quickly prototype this.

    Thanks for the idea!

    ReplyDelete
    Replies
    1. I think between Arduino Nano and a small BT module this should be small enough. Alternatively you can use someting like MSP430 (one of the target boads that comes with the "stick" is even smaller).

      Delete
  7. Great project and awesome display. When do you plan to post the Android code? What Bluetooth protocol will you use?

    ReplyDelete
  8. Any updates here? Would love to try this project.

    ReplyDelete
    Replies
    1. Still working on it. I got a bit busy with work over the last month. I'm expecting to get back to the project soon.
      Thank you

      Delete
  9. No problem. I'm a little while out for the need of a DRO. I ove Android and this just makes sense. Would love to see this come to fruition. I'll keep checking back. Thanks for doing this!

    ReplyDelete
  10. Yuriy -
    Fantastic project. I have been tinkering a little bit with a PIC based device that would be a good addition to your system - I saw your posting on the CNCzone forum and left you a PM with my e-mail. Have a look and shoot me a note and we can chat a bit more.
    All the best,
    Lewis

    ReplyDelete
  11. I had thought about the android tablet as a visual method of presenting data from my weather station. I'm not a programmer so thinking is as far as I got. This idea may have many applications and I applaud Yuriy, and encourage him to do more work in this area.

    ReplyDelete
  12. Yuri,

    Wanted to let let you know you have some interested followers here: http://groups.yahoo.com/group/ShumaTech/message/21789

    in case you didn't already know.

    Thanks again,
    JJ

    ReplyDelete
  13. Any news on source code availability for this? Many thanks...

    ReplyDelete