Mixed Scale DRO Controller with MSP430 Launchap |
So far the DRO controllers I’ve designed have been able to read only the IGaging (Shahe) Remote DRO scales. Lately I’ve been getting an increasing number of requests for a firmware that could read the standard “chinese” linear scales.A few months ago I started working on a new version that would do just that. Although the project is still a bit rough around the edges, I’m pretty sure that the hardware will stay unchanged and any future updates will be done via firmware. Rather than holding off until the whole shebang is done, I decided to post the stable version of the firmware. In the next few posts I will provide details for the project, design considerations, build instructions and firmware implementation.
Overview
My main goal was to design a controller that could read a mix of common inexpensive digital scale types. After digging through my garage, couple of eBay orders and donations from few generous readers I was able to source about a dozen of different scales and calipers. The first thing I discovered (to my delight) was that all of them used the same 4-pin data port; pin functions appeared to be identical as well. Moreover, the power supply voltage was 1.5V [nominal] across the board.
After analyzing the output I discovered that majority of [better] digital calipers and linear scales use the 2x24-bit protocol; a few cheap calipers used a funky 24-bit protocol* I described in the post "Harbor Freight Caliper Data Format". One caliper used a 28-bit format, but it didn’t live long enough for me to decipher it. All of the caliper used data clock speed around 80-90 KHz. Interestingly, only two of the 2x24-bit scales worked in the “fast” mode with 50 Hz data refresh rate; the rest had refresh rate of 3 Hz or so.
*One of the readers told me that this protocol is called “BIN6”, so I will use that name for it from now on.
Since I wasn’t able to find another caliper that uses the 28-bit format, I decided to skip it for now. This meant that the new controller would need to support three different protocols: iGaging [Shahe] 21-bit, BIN6 and “standard” 2x24-bit. In future support for more protocols can be added as needed, as long as the scales use the same 4-wire connection. As a stretch goal, it would be nice for this controller to support quadrature encoders [glass scales] as well.
Some rough calculations suggested that the MSP420G2553 microcontroller [ that ships with the MSP430 Value Line Launchpad kit] should be capable of handling three or four scales, so I decided to use it for this controller.
Design Considerations
There are two things that make this version of the controller different from the one used for iGaging scales:
- The scales use 1.5 Volt power supply. Although seemingly minor difference, it means that the voltage levels at the data port are below the threshold of what MSP430 can read. Similarly, the 5V that the glass scales output will damage MSP430 inputs. In other words the controller will require additional level shifting circuitry that will translate 1.5V and 5V to 3.3V or that the Launchpad can work with.
- Unlike the iGaging [Shahe] “Remote DRO”, standard scales provide their own clock. In other words the Launchpad has no control over when the data will arrive. In the worst case scenario all four scales might decide to send the data at the same time, and the firmware will need to be able to deal with it efficiently (without losing bits).
Complete DRO controller setup with a "fancy" 1.5V power supply |
Current Status
At this time the controller can auto-detect and read up to four iGaging [Shahe] Remode DRO scales, standard scales that use the 2x24-bit protocol and “Harbor Freight” calipers. It is set up to provide 1.5V, 3.3V and 5V power supply to the scales. The latter two voltages are provided directly from the MSP430 Launchpad board; 1.5V requires an external power supply (either using single 1.5V battery or a DC power converter). Current version of the firmware doesn’t have a way to switch the scales into the “fast” mode, but the if switched manually, the controller seems to keep up with the input pretty well.
The hardware is designed to work with 5V quadrature encoders [glass scales] but the firmware doesn’t support their input yet.
Complete test setup with four types of scales |
Summary
The new controller will extend the capabilities of the Touch DRO Android application by offering support for more capacitive linear scale types. It appears that there are two common protocol that should cover a large portion of the scales on the market. Fortunately MSP430 chip that ships with the current version of MSP430 Value Line Launchpad kit should be able to handle it pretty well. In the next post I will explain what additional hardware is needed and describe one of the designs I came up with.
Awesome, I can't wait! Looks like it'll be out before I make any headway on my firmware.
ReplyDeleteI can't tell you how big a deal this project is for me! I bought a bunch of these calipers a couple years ago in the hopes of getting/building a Shumatech DRO or my own solution and just never got around to it... And then this summer, I picked up some cheap Chinese Android 4.0 tablets from a DealExtreme half-off sale (They barely cost more than my calipers, no joke!) so this is *PERFECT*!
Thanks for making such an awesome and useful app, and a DRO solution that requires almost no hardware!
Its been a while...
ReplyDeleteAND... its the witching hour...
any progress in the Great Crusade...
Turning Blue down here...!!! 8-)
Will have the rest of the stuff posted this weekend. Got distracted with a few issues with the application...
DeleteI'm guessing...
ReplyDeleteyou are still 'distracted with a few issues'
yeah.. been there bro
it always a major PITA to clean up the mess and make it real...
When you're done...
I'm gonna buy you a pizza...!!!
comments always welcome 8-)
Yah, I mounted the whole thing on the mill (for final testing) and the 2x24 bit scale started behaving weird, so I spent 2 weeks looking for bugs to find out that the output on the scale is shot, so now I'm waiting for a replacement (should be here on Monday) to test with. :(
DeleteWhile on the subject of MSP430:
ReplyDeleteThe US Air Force Academy just moved their embedded systems course over to the MSP430. Course director [Capt Todd Branchflower] just put all the course materials online:
with the notes, datasheets, and labs available on Github:
Hi,
ReplyDeleteI have a question regarding grounding. It seems most of the Chinese scales have the positive side of the 1.5v battery connected to the metalwork of the scale. When you screw the scale to your machine you will then connect this to mains earth. It seems you connect the MSP430 GND to the scales GND. All ok so far, until you connect your MSP430 Launchpad to your PC and in doing connect it's GND to mains earth via the PC, completing the loop and shorting the scales 1.5v battery. What am I missing ?
Regards.
Cam.
Cam,
DeleteIGaging/AccuRemote scales have the frames connected to the ground. If you're using Chinese calipers, you have to use a ground-isolating power supply (cheap wall wart that has a heavy transformer).
Regards
Yuriy
Hi Yuriy,
DeleteThanks for the reply. I have Chinese scales, I liked your idea of using a C cell so I had planned on doing that. Although thanks for the reminder on the transformer.
My problem is when programming (or debugging) the project. The machine (mill, lathe, etc) will connect +Vcc 1.5v to mains earth, and your PC (via USB) will connect GND to mains earth, therefore shorting the 1.5v supply. Even an isolated battery won't be safe here.
So what do you when programming ? Simply unplug the machine from the mains ? I didn't see this mentioned anywhere hence asking.
All the best.
Cam.
Hi Yuriry,
ReplyDeleteI was going to buy a cheap(ish) chinese DRO for my mill before I stumbled across your project. Since my mill already has the igaging style of DROs on the X and Y axis I decided that this may be a better approach for me.
Om my mill though the Z axis already has a chinese style of DRO on it. My problem is that I cannot source the MSP420G2553 kit here only the Ardino one.
Can I ask if there is any HW reason why the Ardino cannot be used with the chinese scales? I am happy to try port changes you made for the TX chip to the Atmel chip.
Thanks from South Africa
Anthony
Anthony,
DeleteFirst of all, here is a link to your local Mouser site: http://za.mouser.com/Search/Refine.aspx?Keyword=msp430+launchpad
As far as Arduino goes, there answer is "complicated": no, there is not hardware reason (I think) why ATMega chip can't handle Chinese scales. The reason is Arduino "software", i.e. all that junk that makes Arduino easy to program adds a lot of overhead and limitations. Namely, you have only two pin interrupts to start with.
Regards
Yuriy
Thanks mate, the mouser site I knew about but at $60 for shipping (without duties) it is somewhat pointless to order from them.
DeleteWow. That's marginally insane :(
DeleteI started playing with Arduino Due, so there might be a version of firmware for that, but I don't know how soon that will happen...
Cheers mate, I am awaiting the arrival of my Ardunio kit once I have it I will get everything put together and see if I can lend a hand (been writing code for embedded systems for over 18 years). Will also try to keep finding a source for the TX kit.
DeleteOne more question, any plans on supporting the radius function on the Android app? I have only taken a quick look at it but didnt see this.
Hi Yuriy,
Deletedid you succeed using the Arduino?
Because using an Arduino would be better for me as well.
I have an unreliable DRO called SLA1, and want to replace it, it annoys me totally.
The chinese scales are already there and mounted to the machine.
Best regards!
PS:
I saw here how to read out chinese scales:
http://www.instructables.com/id/Reading-Digital-Callipers-with-an-Arduino-USB/?ALLSTEPS
Is it very different from your approach?
No, I didn't have a chance to do it yet.
DeleteI've seen that article before, but that's not a good way to read scales for a couple of reasons. It might work OK for reading a single caliper, but simply won't work for 3-4 scales. Moreover, better scales can work in "fast mode" and that has no hope of working with this approach.
Thank you
Yuriy
P.S. I've finished MSP430 firmware that handles up to 4 "Chinese scales". You can find the details on the project page.
Then the decision is clear, I'll use the MSP430.
DeleteThe instruction how to setup the firmware are quite clear described.
Indeed the fast mode is very important, and my scales do support it.
On my SLA1 I manually switch to it with an extra button every time.
Thanks Yuriy!
Hmm, additional question:
ReplyDeleteIs the fast mode invoked by the MSP430, or do I need a manual switch as it is now?
Hi Yuriy
ReplyDeleteI cannot find the Bluetooth Module easily in Romania, also Mouser doesn't have it. Is it correct to assume that any HC-05 module would work? There are plenty others, for example http://www.aliexpress.com/wholesale?catId=0&initiative_id=SB_20150104135506&SearchText=Arduino+Wireless+Bluetooth+Transceiver+Module
Thanks for this great project!
Bogdan,
DeleteAny HC-0x modile will work (04,05,06 etc.). In fact any UART-to-Bluetooth module should work.
Thank you
Yuriy
Excellent! Thanks! Meanwhile, I checked ebay uk and amazon.de and found plenty of suppliers closer to RO :)
DeletePopped up an idea: a bluetooth mouse paired with your app will show what? Is it compatible? I've read about the (un)accountability of optical mouses as DROs, but I have an unsophisticated setup with only one axe, and where an error of say 0,5mm is okay.
DeleteMouse won't work. The DRO controller uses a protocol I made up, so the app expects the data in that specific format.
DeleteSorry to insist. Would it be complicated for you to write code for interfacing a mouse as a "poor man's" easiest DRO possible? From a design point of view, that would be the most elegant setup ever (only two hardware pieces, not wired). Older mechanical mouses could become cheap rotary encoders (don't know if they still exist, I have for sure a couple in some dusty boxes). Of course, for a technical point of view I don't know if it's worth the effort.
DeleteI haven't looked into it, so I don't know how difficult it would be. In any case, I don't think I will have time to play with that any time soon. I barely have time to keep up with bug fixes, and I have a huge backlog of features I need to do.
DeleteOk. Thanks alot for sharing this project!
DeleteHi Yuri
ReplyDeleteI have Shumatech display module that I have tamed and works well with Chinese scales. Last week I had a scale failure and am struggling to find 24bit scales as all current ones seem to be quadrature. Do you offer a converter module to take quadrature and convert to 24bit to allow me to use quadrature on the Shumatech ?