DIY DRO with Arduino and Android

Friday, September 21, 2012
Google Nexus 7 Running an Early Version of DRO Application

UPDATE October 2022: Since the time of the original posting, I've developed a few new designs that perform much better, work with more scale types and read the scales more reliably. The latest version uses an ESP32 wireless module. You can find the circuit diagram and instructions on the ESP32-Based DIY Digital Readout. Other designs that use MSP430 LaunchPad development board can be found in the Do-it-Yourself DRO Build Instructions

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.

Decoupling the driver and the display unit has several benefits:

  • The hardware is much simpler, making the DRO much more accessible to people without electronics experinces. In fact I build the first protoptype using Arduino UNO, 5 resitors and a $10 Bluetooth module.
  • The DRO uses a wireless (Bluetooth) link between the controller and the tabled, so the latter can be easily moved around. Therefore single Anroid tablet or phone can be used with multiple controllers. For example, if you have a milling machine and a lathe, you can share the display between the two.
  • More controllers can be designed to support other types of scales without any changes to the display unit
  • Since many people already have a device running Android OS, the total cost of the DRO (excluding the scales) can be as low as $20
  • Even the low-end Android tablets have gobs of processing power and memory (when compared to microncotrollers tha are accessible to the hobbyists), the tablet can easily support advanced features that would be unavailable on an "embedded" DRO

Scale Driver

Reading iGaing scales with Arduino UNO and a few parts
Parts required to make a wireless reader
for Grizzly iGaging scales using Arduino Uno

IGaing Remote DRO scales use a design that makes reading them very easy. Unlike the standard calipers and scales that provide their own clock, iGaging scales receive their clock signal from the display unit. Furthermore, they used 3.3V power supply which eliminates the need to input level shifter etc. Using code similar to that described in the Reading iGaging Scales with Arduino the controller can convert the raw data into "clicks" and send them to the Android application wirelessly, using a UART to Bluetooth adapter. Only four general IO pins are required, so even the smaller Arduino boards would work well for this project. For that mattery any microcontroller with six available digital IO pins can be used in a controller.

DRO Display

Using a tablet as a DRO display unit offers several important benefits. First of all, a DRO unit performs surprisingly large amount of mathematical operations in order to display the readout. Furthermore, things like unit conversion, tool offsets, trigonometric calculations etc. require floating point multiplication and division. Unfortunately very few microcontrollers available to the hobbyists have floating point hardware, so they tend to really struggle with such operations. Application processors that come with even low-end tablets and phones are super-computers in comparison that can do millions of floating point operations per second. Second, Android tablets come with large, bright touch screens. Instead of scrolling through the functions using a 10-key pad and a 7-segment LED display, you would be dealing with an intuitive and convenient graphical user interface. Finally, since most tablets are internet-enabled, you would have access to any reference materials, notes, powerful scientific calculators right at your fingertips.

Taking a nice shiny tablet into the garage might be a bit unnerving. After all it can be easily scratched, dropped etc. Fortunately several companies make excellent protective cases, some even water proof, that would make a table much more garage-worthy.

Flexible Architecture

Since the CPI can be configured individually for each axis in the software, the Digital Readout application can support any type of position encoder, as long as the controller implements the standard communications protocol. The application would receive the position data in Clicks-per-Inch (CPI) and would then convert them to the standard units, apply offsets etc. based in the user-entered settings. Similarly, the user interface can be tweaked on-the-fly. For example, things like font size, number of digits and axis labels can be changed at will. Finally, adding new features would be as easy as downloading the new version of the application.

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 and phones 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 core ARM processor running at 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 Digital Readout duties.

42 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
  14. Nice software. I would like to extend it a bit with quadrature encoder support.
    I will try to have a look on Android Application to see the protocol used.
    Did you used Android Developer Tools (ADT) plugin for Eclipse ?
    BR
    Daniel

    ReplyDelete
    Replies
    1. Daniel,
      I'm working on a controller that can read quadrature encoders. The hardware is almost ready but I'm still tweaking the firmware.
      The protocol is documented here: http://www.yuriystoys.com/2012/09/android-dro-communication-layer.html
      The app is ready as it is...

      Delete
  15. Fantastic arduino project and android app - thanks very much.

    I built the reader with an 3.3V arduino mini + jy-mcu bluetooth, a little bit of veroboard and pigtail mini usb leads to the three DRO's. (3.3v mini is good because you dont have to worry about any resistors for the 5v/3.3v level matching). I power it with usb (5v). The arduino mini has a 3.3v output. It all fits nicely into a clear 50ml urine collection container. The bluetooth pairing led flashes through the clear container so it also a good on/off indicator. I screwed the urine container to my bench below my sieg sx2 mill.

    I am using my galaxy S4 phone as the display with a "keep screen" app to stop it turning off. (I can charge my phone with the same usb charger that use for the reader). I Might get a cheap tablet but I used my phone to test it and so far I have kept it because it works really well.


    So much better than the LCDs that came with the DRO, these were dark in the shed and i needed a separate lamp. The displays used to turn off automatically which is annoying.

    A tachometer to read the spindle rotation speed would be nice (seig have an output that could be potentially decoded or one could use a white dot and light detector on the spindle etc) This would be nice to show on the display as a forth readout.

    I used to think about a better display but it always looked too hard. However, this project went so smoothly I wish I had done it months ago.

    ReplyDelete
  16. Hi Yuriy,

    Just installed Android 4 on an Acer Aspire D255 netbook, installed your DRO app and as far as I can tell all seems to be OK. Will report back once I get the hw side sorted.

    Cheers
    Rob

    ReplyDelete
  17. Just an update. Working quite well over USB with the Netbook. The only issues I've noticed are due to running Android on the Netbook.
    As Jethro has I'm using a 3.3v mini, mounted it all in a box but I'm using 4 pin metal microphone connectors to connect to the interface box. I've got a blue tooth module for both the netbook and the interface box on order, but being Down Under who knows when they'll arrive.
    Eventually I'll move over to a tablet.
    Is there a way to zero each axis without affecting the others ? Maybe I'm missing something basic.
    Anyways this is a fantastic project and you've got my thanks for all your work.

    ReplyDelete
    Replies
    1. In the application you can hold the "Abs/Incr" button and it will zero out that one axis.
      Thank you
      Yuriy

      Delete
    2. Just a quick update, bluetooth & netbook are working spot on.

      Thanks for all your effort and generosity.

      Rob

      Delete
  18. Hi Yuriy,

    Well I finished my DRO and it works perfectly I want to thank you for giving us this great tool.

    Couple pictures of my build
    [URL=http://s60.photobucket.com/user/MarcusB_photos/media/70C5296E-C54F-494E-A7B4-9EC2D5CED5CE_zpsfjkys0yp.jpg.html][IMG]http://i60.photobucket.com/albums/h12/MarcusB_photos/70C5296E-C54F-494E-A7B4-9EC2D5CED5CE_zpsfjkys0yp.jpg[/IMG][/URL]

    ReplyDelete
  19. just to share with you
    i'm frensh and i'd like your project that was so cool to make it and to share it
    i just have buy on web the parts and i will make it
    thank you guy

    ReplyDelete
  20. Yuriy,
    Thanks for making this available to everyone. Ive been thinking of adding a DRO to my lathe for a while now and this looks like it will be just the ticket. I have a question though: is it possible to use scales with this design other than the iGaging scales? And if so which would you advise? I dont mind spending a little more on better and more reliable scales. Dont want to break the bank either though lol!

    ReplyDelete
    Replies
    1. Helder22,
      I'm not planning to add support for more scales to the Arduino version (at least any time soon), but the MSP430-based controller can read the standard scales, chinese calipers and glass scales. Please take a look at the "Android DRO" page for more details.
      Thank you
      Yuriy

      Delete
  21. Question? will this app work on a unit that does not have Bluetooth? When I start the app it hangs during start up even when I choose not to approve start of Bluetooth...

    ReplyDelete
    Replies
    1. It should work. What version of the OS is the tabled running?

      Delete
    2. The tablet runs 4.1.1

      I actually got it to start now, I re-installed the app and had to answer "no" twice when the app wanted bluetooth access... Another question; is there any way to only show two axes (x and y) when you use the DRO for lathes? Maybe a box under settings would be implemented?

      Thanks for a great looking DRO solution by the way... keep up the good work!

      Delete
    3. First, glad you got it to work. I don't know why it did it twice. In theory the "request for feature" should happen only once, and I am not able to reproduce this behavior on my tablet :(
      The short answer to the question: not in the version you have. The new version is fully configurable. I'm starting "beta testing" this weekend, so if you want to, please give me your email address and I will invite you to it. (it's through Google's App Store...).
      Regards
      Yuriy

      Delete
  22. Yuriy, your DRO is brilliant and I love it. Because I have it running on an Arduino Droid PCB, so I had to change the sketch to skip over D4 (Y axis now D5, D6, etc) as D4 performs some reserved functions on the Droid board. It was so simple to edit the sketch because you have already done all the hard yards and documented the code so well.

    I'd like to get the RPM function working next, and I was hoping you could explain what variable name the Sketch needs to pass to the TouchDRO app? Or is there a sketch available that already has this incorporated? Also has anyone published a circuit or construction guide for a DIY RPM sensor you might recommend? (Sorry for so many questions.)

    Thanks for you patience in bringing us novices up to speed through your blogs and web pages.
    Regards,
    Greg

    ReplyDelete
    Replies
    1. Greg,
      The axis name for the tachometer is T, so the output should be X123;y123;z;123;t123;.
      I haven't created a sketch that does it yet, but a few people on the beta testing group are working in that direction, so it might be a worth while idea to "collaborate".
      Regards
      Yuriy

      P.S. And ... you're very welcome :)

      Delete
    2. Yuriy,
      Thank you for replying. The tacho (T axis) worked perfectly first try, as does the W axis. Your coding is so intuitive.
      One of the most brilliant aspects of your project is the new user is protected for the complexity of JAVA on Android and can simply fiddle with the Arduino sketches and extend the DRO's capabilities by using a spare axis to display what ever one wants.
      Regards,
      Greg

      Delete
  23. Ok so I just clipped the end of my I gaging scales.

    My wires are diffrent?

    Red is VDD
    Black - Ground
    Blue - SST (is this clock?)
    Yellow - Data
    Green - unused?

    Should I hook all of my Yellow together?

    ReplyDelete
    Replies
    1. Steve,
      What version of iGaging scales are those?

      Delete
    2. Hi Yuriy, I have the same issue with the igaging cable.They are new and as far as I can tell V.06

      Delete
    3. Steve did you ever figure this out? I have the some colors

      Delete
  24. Good afternoon.. And as it is possible to connect the android and arduino on USB as on a plasheta there is no bluetooth

    ReplyDelete
  25. This is a very nice project but I have a question. In the app there is CPI while you can work in inch or mm is it not better for use CPU counts per unit

    ReplyDelete
    Replies
    1. Internally the app uses microns. CPI us used in the UI only and I'm planning to make it unit-specific at some point.

      Delete