Reading Digital caliper with Arduino
#31
Commented out the pullup lines and got the timer reading again...

Chuck
Micromark 7x14 Lathe, X2 Mill , old Green 4x6 bandsaw
The difficult takes me a while, the impossible takes a little longer.
Reply
Thanks given by:
#32
I think I'll set this aside for now, and get back in the shop. Got to finish the Stepper adapter as I have some gears to make.

Thanks for the help guys. Have to think about this some more.

Chuck
Micromark 7x14 Lathe, X2 Mill , old Green 4x6 bandsaw
The difficult takes me a while, the impossible takes a little longer.
Reply
Thanks given by:
#33
(03-10-2015, 10:01 AM)chucketn Wrote: Commented out the pullup lines and got the timer reading again...

Chuck

Hmmm, the pullup lines should not have affected the reading. Chin

Ed
Reply
Thanks given by:
#34
Chuck,

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?

Ed
Reply
Thanks given by:
#35
Food for though on the "improvements" list ... attach the clock to pin 2 or 3 so interrupts can be used rather than polling.
Reply
Thanks given by:
#36
(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.

Ed
Reply
Thanks given by:
#37
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 Smile . 
Reply
Thanks given by:
#38
Yup, this isn't rocket science. It's pretty straight forward stuff that we should be able to figure out once all of the facts are known.

Ed
Reply
Thanks given by:
#39
(03-10-2015, 06:19 PM)EdK Wrote: Yup, this isn't rocket science...

Speak for yourself Ed - this is all Greek to me Ouch
Hunting American dentists since 2015.
Reply
Thanks given by:
#40
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.


Attached Files Thumbnail(s)
       
Micromark 7x14 Lathe, X2 Mill , old Green 4x6 bandsaw
The difficult takes me a while, the impossible takes a little longer.
Reply
Thanks given by: EdK




Users browsing this thread: 1 Guest(s)