Upgraded Adapters for iGaging and Shahe Scales

Saturday, April 24, 2021

If you've been following my Facebook page, you probably know that for the last few months I've been working on redesigning the TouchDRO adapters for Shahe and iGaging scales to use the ESP32 microcontroller module. The work started around the end of December of 2020 and at this point, I have gone through a couple of iterations. After a lot of testing and tweaking, I'm finally pretty happy with the performance of the new iGaging scale adapter, and all of the parts appear to finally be in stock; so, I will be finally placing an order for the first production run; Shahe version is still a few weeks out. If things go as planned, I should have the iGaging adapters ready for sale by the end of May. The technical details will be posted on the product page; so, in this post, I want to address some of the questions that came up so far or I anticipate will come up as the adapter is available for sale.

This post goes into some technical rabbit holes. If you're not interested in those, skip to the summary for the short version.

Introduction

The current [old] versions of the TouchDRO Adapters for Shahe and iGaging scales uses Texas Instruments MSP430 G-series mixed-signal microcontroller in combination with HC-05 UART-to-Bluetooth adapter. The main reason for the redesign is that I can't order the HC-05 modules from any reputable suppliers in the USA; so, I have to order them from random sellers on eBay or Aliexpress. Unfortunately, there are many fakes on the market, and it's been exceedingly difficult to reliably source good quality modules. While searching for a brand-name alternative that wasn't going to cost 10x what HC-05 costs, I came across the Espressif ESP32 WiFi/Bluetooth module based on Tensilica Xtensa multicore processor. The part seems to be very well supported and documented, has a very attractive price point, and most importantly, is readily available from Mouser, DigiKey, and other mainstream electronic component distributors.

ESP32 is a fundamentally different and much more powerful module than MSP430. First and foremost, it comes with two 32-bit processors that can run at a clock speed of up to 240 MHz, compared to MSP430 that has a single 16-bit processor core running at 16 MHz. Second, ESP32 has more advanced peripherals, which allow for the hardware-level implementation of tachometer pulse counter, scale clock generation, etc. Finally, it's a single integrated module, so communications between the processor and BlueTooth transceiver are done internally.

Design Goals

Before jumping into more details, I would like to explain my design goals for the new adapter and address a potentially controversial issue of DIY-ability.

At this point, it's been over 9 years since I started work on the project, so I have a good amount of experience with capacitive DRO scales and have received a lot of feedback from the customers regarding common issues. While iGaging and Shahe linear scales have some shortcomings and can't perform at the same level as glass and magnetic DRO scales, they offer a very good value for budget-minded hobby shop setups. Even as the princess of Chinese glass scales have fallen to a sub-100-dollar level, there are still many hobbyists that chose capacitive scales for various reasons.

As such, once I made the decision to switch to ESP32, my main focus was to squeeze more performance out of these inexpensive scales. Ultimately, I decided to concentrate on optimizing the input stage and scale power supply to give these scales the best chance to perform well. While working on the new circuit, I realized that in order to obtain the performance and features I was looking for the circuit, it would be much more complex than the previous version. Furthermore, several of the components that I selected don't have easy-to-solder through-hole variants. Consequently, designing the adapter circuit so that it was easy to scratch build, I'd have to make too many compromises that would make the pre-assembled adapters more expensive for me to manufacture and the performance would be somewhat compromised.

iGaging and Shahe Scale Adapters use different circuit to optimize scale performance

After a lot of consideration, I decided to sacrifice the DIY-ability and optimize for performance and manufacturability. In my opinion, this approach is fairer to the customers who pay for pre-assembled adapters and ultimately keep the lights on for this project. I realize that this sets up a different "freemium" model for the project, where the free product is less capable than the paid version, but, in my opinion, the performance of the MSP430-based adapters is very good, so it's not a crippled product compared to ESP32. Furthermore, I intend to keep supporting the MSP430 design and incorporate some of the lessons learned into it, so the spread between the two will likely shrink.

To preemptively answer the question of when the firmware will be available for free download: I will make the design and the firmware available once I recoup the cost and effort of the development. It might be several months to over a year, depending on how the sales go and what my margin ends up being.

Practical Differences

The two microcontrollers have very different performance characteristics and design requirements. On one hand, ESP32 has much more processing power and significantly more sophisticated peripherals, but on the other hand, it is much more power-hungry than MSP430 and doesn't like to be connected directly to remote sensors. This means that using the module in a DRO scale adapter required a different circuit design and firmware. The new circuit added more complexity to the adapter but also offered an opportunity to better optimize it for the particular scales and improve overall noise resiliency and reliability. The end result ended up being a much more robust and capable adapter that is able to squeeze even more performance and utility from the budget capacitive scales.

New adapter (left) next to the current version (right)

Without getting too deep into the technical details of the two architectures, let's take a look at a few of the practical differences offered by the new design and their advantages.

Faster Position Transfer

As mentioned earlier, MSP430-based adapters use HC-05 Bluetooth transceiver modules to communicate with the TouchDRO application. This has two drawbacks:

  • HC-05 is a BlueTooth 2.0 module that doesn't support BlueTooth Low Energy, which defeats the purpose of low power microcontroller and scales.
  • The module uses the UART protocol to send and receive data, so there is inherent latency introduced by the relatively slow data transfer rate. Furthermore, this is a "dumb" link, so the firmware doesn't know if the module is connected to the Android device or if there is a congesting in the link.

ESP32, on the other hand, is a self-contained module with processor cores and the BlueTooth transceiver sharing the same system memory, which has a few huge advantages:

  • There is no latency or practical throughput limit between the processor and the Bluetooth transceiver.
  • The firmware has full access to the Bluetooth connection state, link quality, and can detect congestion.
  • ESP32 natively supports Bluetooth Classic and Bluetooth Low Energy, allowing for a future addition of BTLE mode via firmware update.

As a result, ESP32 can transfer data much faster and more frequently to the application, resulting in a more immediate readout and reduction in the perceived lag.

HC-05 comes with a default BAUD rate of 9600. In theory, it can be increased to 1382400, in practice, anything over 9600 is extremely unreliable. As a result, since each axis position readout packet can contain up to 10 characters, and the UART can handle about 1000 characters, the adapter can reliably send 4 scale positions around 25 times per second at most.

In contrast, the [theoretical] limiting factor for ESP32 is the Bluetooth data transfer rate of 24 MB per second (9600 BAUD is equivalent to about 0.001 MB/second). While this is not a 100% valid comparison since BlueTooth has some overhead due to error correction, etc. it can easily transmit readout from four scales thousands of times per second. In practice, the limiting factor in this system is the Android screen refresh rate.

Better Noise Resistance and Reliability

The new TouchDRO Adapter for iGaging Scales uses a much more complex scale input conditioning circuit that includes dedicated Schmitt triggers for each scale, series current limiting resistors, and a separate power rail that can be powered by a rechargeable battery. There are a few big advantages to this approach. First and foremost, the inputs are much more resilient to voltage spikes and are less prone to be damaged by ESD. Second, by using optimized series and pull-up resistor values, the circuit is able to reduce noise current levels and even provide a passive low-pass filter that blocks noise above a certain frequency. Third, powering scales and the ESP32 module from two separate power rails improves overall system stability since line noise won't affect the processor, and spikes in the current draw from BlueTooth won't affect the scales' power supply. Finally, the adapter has a built-in Lithium battery charging and management IC that can be used to provide battery backup to the scales and further isolate them from any line noise or brownouts.

Optional LiPo battery cell provides backup power to scales

Thanks to these input and power supply improvements, the overall DRO setup will perform much more reliably. Furthermore, by adding an inexpensive Lithium battery [which can be simply plugged into the board] the adapter will be able to retain scale position even when it's not plugged into power, thus providing the benefits of absolute encoders and much lower price.

More Sophisticated Firmware

ESP32 has at least a factor of magnitude of raw processing power and much more advanced peripherals. For instance, ESP32 has a dedicated capture/compare device that can be used to implement a tachometer almost completely at the hardware level. In other words, handling tachometer input is done independent of the main processor, so it can be done more precisely and doesn't use up computation power that can be then used by the main code. Similarly, there is a peripheral that can generate a very precise scale clock signal independently for each of the four scales without interfering with the input interrupts.

As a result, the firmware can handle a wider tachometer pulse input range, for example. More importantly, though, the module is able to do more advanced signal processing to improve the stability and accuracy of the scale readout. One such enhancement is the ability to oversample the scale input, and average a number of values to reduce the flickering of the last digit that is very common with iGaging scales. Similarly, it can detect and reject readouts that are clear outliers caused by spurious pulses and noise.

Summary

As you can see, there are several improvements the new TouchDRO adapter brings to the table. It's built on the experience and the lessons I learned while developing MSP430-based adapters, but is able to push the envelope a bit further. The hardware is optimized to be more noise resilient, and the firmware uses ESP32's processing power and advanced features to mitigate some of the shortcomings of the capacitive scales. With the exception of the built-in battery management controller, the adapter has almost identical features to the current MSP430 Adapter for iGaging scales. The main difference is in how these features are implemented. By leveraging a more sophisticated scale input conditioning circuit and dedicated power supply rail, the adapter can provide better noise resiliency; digital post-processing in the firmware can reject outlier readings and somewhat smooth out the flickering of the last digit. Finally, by adding a rechargeable Lithium battery, the adapter can mimic the functionality of absolute encoders that don't lose their position when the DRO is powered down.

So, Should You Upgrade?

Surprisingly, the most common question so far has been along the lines of "I have version X of TouchDRO adapter, should I upgrade?". The short answer is that you don't need to. If your existing TouchDRO adapter is working smoothly with your current scales, you probably won't notice a significant difference in speed and performance.

On the other hand, if you are experiencing intermittent noise issues and random position jumps, the new adapter will likely improve or even completely eliminate them. Furthermore, having the option of powering the scales from a separate battery-backed power rail will get you the functionality of absolute position encoders that don't lose their position between work sessions.

15 comments :

  1. so the new adapter will be this one. No more the yellow box. No more adapter kit ?
    i need to provide an enclosure, right ? how is the connection ? USB ? DB9 ?

    I am new on the DRO thing, so excuse my stupid questions.

    Also, i need to buy the scale bar from iGaging , right ? so what i do is interface THEIR BAR with your adapter and them to the computer thru bluetooth ? right ?

    your adapter comes with a software for my tablet or computer ?
    i am trying to understand the product.

    Funny thing: I am new on machinist thing, a new hobby, but old on electronics ...
    i am an electronic engineer with 37 years of experience, One of the first to work with intel 8085 microprocessors back in 1979. NIce what you are doing here ...

    regards, eloy

    ReplyDelete
    Replies
    1. Eloy,
      There will be an option to buy an enclosure, so you won't have to make it.
      Take a look at these two pages: https://www.touchdro.com/resources/info/intro-to-touchdro.html
      https://www.touchdro.com/resources/info/diy-dro-build-overview.html
      That will answer at least some of your questions.
      Regards
      Yuriy

      Delete
  2. Hi when will the updated units become available on the store please?

    best regards
    Doug G

    ReplyDelete
    Replies
    1. Doug, that is covered in the first paragraph of this article. Direct quote: " If things go as planned, I should have the iGaging adapters ready for sale by the end of May. "

      Delete
  3. Cant wait! just got TouchDRO working on a Raspberry Pi 3b+, and want to wait before I buy the upgraded boards! great job Yuriy, this is such a cool project! (If you have a wait list, I would love to be first in line)

    ReplyDelete
    Replies
    1. Would you mind posting the details how you did that somewhere? You can post something on the forum (link above) or if you have a site, I will link to it. I get a lot of question about this and haven't had a chance to do it myself.
      Thank you
      Yuriy

      Delete
    2. I actually put it on YouTube. https://youtu.be/lnCpPtOLq8E

      Delete
    3. https://www.facebook.com/touchdro/posts/3668610396601091

      Delete

  4. Hello Yuriy, is the launch of the new touchdro confirmed for the end of May? I really need to buy a new one. Thank you for your attention.

    ReplyDelete
    Replies
    1. FedEx says that I should have the boards tomorrow. If they pass the test, I will have them listed by the end of next week.

      Delete
    2. Thanks a lot for your attention! One is mine :) !

      Delete
  5. This comment has been removed by the author.

    ReplyDelete
  6. any update on the availability of the new boards and will they be mini-usb?

    ReplyDelete
    Replies
    1. The boards are available on www.touchdro.com/store/

      Delete