12-11-2019, 11:04 PM
Hello all!
So a few of you may be in the same situation as me, looking at some other Forum posts I'd guess there's a few of us.
So, you've got your Arduino, you've got the 'wrong' scales, what now?
Communication types
Shahe scales work differently than the iGaging type scales. The iGaging type scales are told what to do by the screen units attached to them, meaning once the screen is removed, it's easy to tell the scales what to do, or more specifically, how fast to send the data they're checking.
On the other hand, Shahe scales work at their own pace, they have an internal clock in the scale unit itself, meaning we have to wait patiently until the scales are ready to send the data they're reading.
Having an internal clock also means we are unable to use a single clock line to send signals to all scales at once, we need to check each scale's clock status to see if we're able to read a data packet. This means we need 1 pin on the Arduino per each scale we plan on using. Not a major issue for most Arduino boards in terms of pin count but definitely something to note as it will affect our coding and circuitry.
Format
The data format used by the Shahe scales appears to be the standard 'Chinese Caliper' standard, this is referred to as BIN6 protocol. BIN6 protocol is a 24-bit protocol, meaning each data packet contains 24 'pulses' - either on or off. This is different than the iGaging type, which uses a 21-bit protocol. For our purposes, this doesn't matter too much but is important to note when looking at the code required to make the different types work.
What does this mean?
Basically, Shahe scales are slow. Not unusable though, so not all is lost, but from looking at videos of the proper iGaging scales being used, they look much smoother when paired with the TouchDRO application than the Shahe type scales. I've heard rumours of a 'fast read' mode but I've been unable to replicate this in my setup, if you are able to experiment with this, please feel free.
I've got my scales, soldering iron, and the will to use them
Great! But not so fast. There's a couple of extra things you need to know before wiring up your scales:
Green = GND[/url]
Vcc = Black
Clock = White
Data = Red
The lower voltage means we need to drop the voltage going to the Vcc pin to safely and reliably read data from our scales. I've accomplished this using the method described [url=https://www.instructables.com/id/Reading-Digital-Callipers-with-an-Arduino-USB/]HERE.
Essentially, hook up a red LED & ~100ohm resistor between your 3.3v output & Arduino ground, then a capacitor across the LED legs. Your ground rail for the scales then becomes the -ve leg of the LED, and your 1.6-ish V input is then taken from the +ve leg of your LED. This is difficult to describe without images, so I've attached one
Your CLK and DATA lines are then just direct inputs to the Arduino. It's probably a good idea to add some pull-down resistors here but I haven't and my circuit seems to be OK, but that doesn't mean it's not a good idea. Do as I say, not as I do
Once you have your voltage dropper circuit connected, you can use USB headers, or just solder directly to your circuit, USB headers are definitely the neater option, but they're able to be accidentally unplugged, but do what you want, I'm not your mom.
Coding
I am by no means a 'developer', I know enough to be dangerous and that's about it. Anyway, the code I've attached works, but only for 2 axis. If you want to add more, it's a case of duplicating all the values, loops & WHILE statements to check for another axis. There's probably a sleeker and faster way of doing this, but I refer you to my earlier comment about not being a developer. If you are, please feel free to modify this to your needs, and it would be grand if you'd share your work with the community.
Code stolen from here - Full credit goes to Mr Huang for the development of this, I've just modified it to attach both my X & Y scales.
Yuriy's TouchDRO application seems to require input in INCH format, so there's some calculations performed in my sketch to translate the measured values to inches, I'm not 100% on what magic is performed behind the scenes in the Android application, but this is Yuriy's secret to disclose
All the usual disclaimers, I'm not responsible if your scales break, if you fry an Arduino, if your house burns down because you left your soldering iron on etc. Be safe, have fun.
ATB - n00bz.
So a few of you may be in the same situation as me, looking at some other Forum posts I'd guess there's a few of us.
So, you've got your Arduino, you've got the 'wrong' scales, what now?
Communication types
Shahe scales work differently than the iGaging type scales. The iGaging type scales are told what to do by the screen units attached to them, meaning once the screen is removed, it's easy to tell the scales what to do, or more specifically, how fast to send the data they're checking.
On the other hand, Shahe scales work at their own pace, they have an internal clock in the scale unit itself, meaning we have to wait patiently until the scales are ready to send the data they're reading.
Having an internal clock also means we are unable to use a single clock line to send signals to all scales at once, we need to check each scale's clock status to see if we're able to read a data packet. This means we need 1 pin on the Arduino per each scale we plan on using. Not a major issue for most Arduino boards in terms of pin count but definitely something to note as it will affect our coding and circuitry.
Format
The data format used by the Shahe scales appears to be the standard 'Chinese Caliper' standard, this is referred to as BIN6 protocol. BIN6 protocol is a 24-bit protocol, meaning each data packet contains 24 'pulses' - either on or off. This is different than the iGaging type, which uses a 21-bit protocol. For our purposes, this doesn't matter too much but is important to note when looking at the code required to make the different types work.
What does this mean?
Basically, Shahe scales are slow. Not unusable though, so not all is lost, but from looking at videos of the proper iGaging scales being used, they look much smoother when paired with the TouchDRO application than the Shahe type scales. I've heard rumours of a 'fast read' mode but I've been unable to replicate this in my setup, if you are able to experiment with this, please feel free.
I've got my scales, soldering iron, and the will to use them
Great! But not so fast. There's a couple of extra things you need to know before wiring up your scales:
- They operate on ~1.6v
- They aren't wired up the same as the iGaging scales - You need to use a different circuit than shown in the Arduino circuit build
Green = GND[/url]
Vcc = Black
Clock = White
Data = Red
The lower voltage means we need to drop the voltage going to the Vcc pin to safely and reliably read data from our scales. I've accomplished this using the method described [url=https://www.instructables.com/id/Reading-Digital-Callipers-with-an-Arduino-USB/]HERE.
Essentially, hook up a red LED & ~100ohm resistor between your 3.3v output & Arduino ground, then a capacitor across the LED legs. Your ground rail for the scales then becomes the -ve leg of the LED, and your 1.6-ish V input is then taken from the +ve leg of your LED. This is difficult to describe without images, so I've attached one

Your CLK and DATA lines are then just direct inputs to the Arduino. It's probably a good idea to add some pull-down resistors here but I haven't and my circuit seems to be OK, but that doesn't mean it's not a good idea. Do as I say, not as I do

Once you have your voltage dropper circuit connected, you can use USB headers, or just solder directly to your circuit, USB headers are definitely the neater option, but they're able to be accidentally unplugged, but do what you want, I'm not your mom.
Coding
I am by no means a 'developer', I know enough to be dangerous and that's about it. Anyway, the code I've attached works, but only for 2 axis. If you want to add more, it's a case of duplicating all the values, loops & WHILE statements to check for another axis. There's probably a sleeker and faster way of doing this, but I refer you to my earlier comment about not being a developer. If you are, please feel free to modify this to your needs, and it would be grand if you'd share your work with the community.
Code stolen from here - Full credit goes to Mr Huang for the development of this, I've just modified it to attach both my X & Y scales.
Yuriy's TouchDRO application seems to require input in INCH format, so there's some calculations performed in my sketch to translate the measured values to inches, I'm not 100% on what magic is performed behind the scenes in the Android application, but this is Yuriy's secret to disclose

All the usual disclaimers, I'm not responsible if your scales break, if you fry an Arduino, if your house burns down because you left your soldering iron on etc. Be safe, have fun.
ATB - n00bz.