Mixed Scale Controller Firmware Posted

Sunday, November 24, 2013

Recently I've been working on a new version of a DRO controller that will be able to read a combination of different scales. Although the project is taking much more time than I anticipated, I’m making steady [but slow] progress. Last week I had some free time, so I was finally able to button-up some stability issues with the common “Chinese” scales. Unfortunately I still haven’t finished a truly universal version, so you won’t be able to mix glass and capacitive linear scales (yet). Never the less I posted two versions of the firmware: one that read up to four scales and one that reads the common capacitive linear scales. Links to both versions are posted on the DRO Project Downloads Page.

In the near future I hope to combine them, so both types of scales can be used in combination.

Capacitive Scale Controller

So far this version of the firmware can read three types of scales: iGaging "Remote DRO"*, scales that use the 24x2 Sylvac Protocol, and inexpensive Chinese calipers. The firmware can auto-detect those protocols, so no configuration is required.

24x2 Sylvac Scales

This protocol is used by the vast majority of Chinese linear scales and some better calipers. It was originally designed in 1980 by a company called Sylvac and copied ever since. The data is sent in two consecutive streams of 24 bits each. The resolution is approximately 20,480 ticks per inch*.

*The scale I’m using on my mill reads 20,482 per inch, so I suspect there are some inconsistencies between different units. I would suggest that you calibrate the DROto your particular scale. The easiest way to do so is to set the axis (in the app) to 10,000 TPI. Next you should zero out the dial on the mill and the DRO, move the mill 10 inches (for example), divide the DRO reading by 10 and enter the result as TPI for the axis.

Inexpensive “Harbor Freight” Calipers

I should start by saying that I strongly recommend you avoid using these calipers on a DRO. Since the calipers reset completely when they shut down, they are unsuitable for proper DRO operation. Moreover, these calipers output the contents of the screen, so when you change from inches to mm and vice versa, the output changes accordingly. With that said, the controller will correctly detect and read these calipers, taking care of the units conversion as well, but it will not be able to deal with position resets. The resolution is 254000 in both modes, but as with the other scales, I suggest you calibrate the DRO to your particular unit.

iGaging Scales

The controller threats iGaging scales similar to the other two kinds. I.e. it auto-detects the protocol and reads the scales properly. There is one caveat, though: the firmware can’t provide the clock to the scales yet, so unless this feature is added you will need to use the iGaging display unit to do so. Using a piece of mini-USB cable, connect Vcc and Ground (red and black wires) from the display to the appropriate lines on the adapter board and the white clock wire to the clock inputs of the iGaging scales.

Quadrature Encoders

This version of the firmware can read any incremental quadrature encoders, not just glass scales. This includes rotary encoders and magnetic scales as well, since they work on the same principle, but the interface hardware might need to be tweaked a bit. To connect these encoders to the controller you will need to use the datasheet to locate Vcc, Ground, A, and B pins. Vcc and Ground should be connected to the corresponding lines on the controller. Outputs from A and B need to be connected to the “Clock” and “Data” lines. It doesn’t matter which is connected to which line, since you can reverse the direction in the application.

Future Improvements

In addition to the obvious task of combining both firmwares into one that can handle capacitive scales side-by-side with quadrature encoders, there are a few little items I still need to address.

Clock Signal for iGaging Scales

Rather than jerry rigging the display unit, I’d like the controller to be able to provide it’s own clock. I can’t do it the way it worked in the iGaging-only version of the controller, since the firmware is completely asynchronous. Instead, I intend to use MSP430’s second timer to output the clock to a separate pin that can then be connected to the clock lines as needed.

Tachometer Input

Tachometer has been one of the top five most requested features. It looks like this controller should be able to handle tachometer input as long as the ticks per rotation aren’t too high.

Support for BCD7 Protocol

I had one caliper that used this protocol, but it suffered an untimely death. It appears that those calipers still show from time to time, so if I come across another one I will add support for it in one of the future versions.

Conclusion

Even though the project as a whole is still “work in progress” portions of the functionality that read common chinese scales and quadrature encoders are ready for [cautious] use. Please keep in mind though, that I had only a few hours to test the glass scales on my mill; capacitive scale testing was even more limited. If you end up using the new version of the firmware in your shop, double check that the measurements are accurate until you’re sure the controller is behaving correctly.

9 comments :

  1. Yuriy,
    Looking forward to you releasing this code. I'm building a setup for my mill with 3 of the iGaging scales plus I was thinking of using a HF caliper for the quill. After reading you warning above about the HF calipers I've been doing a little research on them. The ones I have are turning off (like you mentioned) when there's about 4 minutes of inactivity. If there's movement they stay on. I'm thinking of having the controller keep track of whether or not there's been any movement in the two minutes, if not cycle power to the caliper. That does reset it to zero, but the controller should know where it was when the reset happened, so it can keep the "relative" position based on the new "zero". There's always the risk of the quill being moved just as it's reset, but I think that's likely to be a relatively small risk... In reality, it's probably not worth the effort to use the HF calipers, should just buy another iGaging scale, but now I'm seeing it as a challenge.

    Thanks again for putting this project together!

    ReplyDelete
  2. Yuriy,
    Great work. One caveat that should probably be noted -- recent BlueSmirf/RN42 breakout boards come set to 115200 baud rate by default. This is easily configured by connecting to the RN42 device by bluetooth serial during startup. For the first ~60sec after powerup, the status light (red) blinks fast -- during this time, connect at 115200 over bluetooth and send "$$$" to enter config mode. There, check settings with "D" -- if baud rate isn't set to 9600, do so by typing "SU,96"

    "---" will end command mode. Note, I had to power-cycle my device to get it to take this setting -- I nearly went nuts with a logic probe until I realized that my data Tx to the BlueSmirf was still coming out at 115200...

    Your firmware comments indicate that you used 115200 at some time; it now appears that UART output is hard-coded to 9600 regardless of device used; I'm certainly getting plenty of position chirps/second.

    Awesome project -- thanks for posting.

    ReplyDelete
    Replies
    1. Adam,
      Good catch and thank you for the detailed instructions.
      I run my DRO's BT module at 115200, which works beautifully well with BlueSMIRF but the cheaper Chinese HC-0x modules had some issues around my VFD. Since 9600 is plenty fast for the 20 Hz refresh rate I changed the firmware to the slowest BAUD rate possible to avoid problems.

      Thank you
      Yuriy

      Delete
  3. Hello Yuriy;

    Interface working ok. Can only get working interface output from chinese scale to work on the 'y' axis input.: P2.1. P2.4 with the newest capacitive scale firmware.

    ReplyDelete
  4. Hi Yuri,
    Am following your project and am putting the finishing touches on my controller. Tying to downloud the firmware there seem to be an error with the link to the digital readout universal V0.2.hex file, the txt one works.

    Keep up the great work and thank you for sharing it.

    Abraham

    ReplyDelete
  5. Hey Yuriy,

    Is there a link to the C Code for the Mixed Scale version of the DRO. I have the TXT file for flashing but would love to play with the code a bit more. I could only find a link for the iGaging version.

    Great project by the way. Love the Android APK.
    Cheers.

    Peter

    ReplyDelete
    Replies
    1. Peter,
      Not yet. I need to clean up the code a bit before making it available (i.e. I don't want to embarrass myself :) )

      Thank you
      Yuriy

      Delete
  6. I don't know if you've seen this yet but, You might want to take a look at this link. " http://www.robogaia.com/3-axis-encoder-conter-arduino-shield.html ". it is a factory made three axes quadrature encoder board using the LFLS7366R-S 32-bit Quadrature Counter with Serial Interface. It can easily be adapted to any 5V SPI capable board. And is compatible with your original circuitry, -1 RPM input on pin 8. All counting functions are controlled by the chip, very little programming necessary. it should be more reliable than any hardwired circuit that is under program control.

    ReplyDelete