I'm going to draw up a schematic to show how I think you have your digital caliper hooked up to the Arduino Uno board. Once we get that all figured out we can move on from there. In the mean time, can you take a picture of your caliper and post it? I think the code on Instructables might be for the older version of digital caliper, like the one I have, and the protocol has changed with the new ones.
How were you powering the digital caliper before you put the battery back in?
(03-10-2015, 04:59 PM)arvidj Wrote: Food for though on the "improvements" list ... attach the clock to pin 2 or 3 so interrupts can be used rather than polling.
That's a good suggestion Arvid. I'll look into the interrupts and see if we can program them to happen on either a rising or falling edge of the clock. Polling is OK for really slow clocks but since we are dealing with an unknown at this point, interrupts would be a wise choice.
On the Uno there are 4 interrupt modes available on pin 2 or 3 ... low, changing, rising and falling. I think falling is the one we would be looking for so we can read the value from the data line.
Then a variable to keep track of the last time the interrupt occurred to determine if it is the start of a string of digits [which implies the previous string of digits are complete], the start of a new bcd digit in the new string [which implies the previous bcd digit is complete] or the start of a new bit in the current bcd digit [which implies the previous bcd bit is complete].
Or a variable to keep track of the last time the interrupt occurred to allow syncing up on the start of a string of digits and then simple dead reckoning for the proper placement of the data line value in the string for the next 23 transitions.
Or ...
Anyway, the code is pretty straight forward and if our GoogleFoo is any good we can probably find something someone else has already written .
03-11-2015, 08:50 AM (This post was last modified: 03-11-2015, 08:52 AM by chucketn.)
I have attached schematics of the caliper supply voltage divider and the level shifter circuits I used. Can't do a picture of the caliper at the moment, as the batteries in the camera are dead. I'll post one as soon as the batteries charge.
Thanks for all the help. I find Arduino fascinating, though my programming skills suck. I have built the RT/Dividing head controller posted on another forum and am currently cutting gears with it.
When you post a suggestion for the programing of the Arduino, bear in mind I'm a programming dummy and add a bit of how and why. Many years ago, I was a technical instructor in the USAF, though you wouldn't think so now. I taught soldering, Basic Electronics, and digital theory, as well as several Avionics Systems. Use it or loose it, they say!
Chuck
Note: on the level shifter, PB1 and PB2 are the Arduino inputs.
Micromark 7x14 Lathe, X2 Mill , old Green 4x6 bandsaw
The difficult takes me a while, the impossible takes a little longer.