[youtube=http://www.youtube.com/watch?v=maB28gXoZV4]
The folks over at NerdKits got a shiny new Smithy 1220xl lathe/ mill. They found, however that adjusting the Z axis wasn’t as accurate as they desired. They decided to resolve this by installing a digital caliper and an LCD interface to display the adjustments. The writeup is quite detailed and the results seem to work great.
Be sure to check the accuracy of a digital caliper with a good test standard before using it, especially if it is a cheap one like this. One of the machinists I learned from called calipers (vernier, digital, whatever) ‘guessing sticks’. Personally I’ve found my cheap ass dial caliper from princess auto works pretty well to within .005″ or so but if I need to be more precise I pull out a micrometer. A quickie solution to this problem (you get it a lot with old equipment where the dials are no longer reliable) is to use a simple dial indicator, and that should let you get accuracy within .001″.
That’s great. But that not a lathe. :-(
who is the first person that’s gonna shout “not a hack”?
@woah
not a hack
@chris:
Smithy 1220XL lathe / mill combo machine
@loans
Maybe I should lay off the crack…
around 6:30 he explains why you should use a pullup resistor on a switch. but he forgets the biggest reason!
during the switching (/wout pullup) the voltage is undefined when neither of the terminals is connected. the microcontroller will choose one of the 2 at random which may have undesired results.
That digital caliper can be purchased from harbor freight on the cheap in a few different lengths (4, 6, 8, 12). I had no idea it had data lines that were so easy to access, this is great!
Hi @urlax — thanks for the feedback!
You’re right that without a pull-up resistor, the microcontroller pin is momentarily left “floating”. However, the input pin capacitance will essentially maintain the previous state. Although, if there is significant switching noise radiated from a nearby circuit (perhaps a nearby unterminated digital line with fast edges), it might capacitively couple onto that floating pin and cause it to change state. This is much more likely to happen when there’s no pull-up (purely floating), but at some extremes of high nearby switching noise and a high enough resistance value to the pull-up resistor, it might be possible to have that coupling happen even in the pull-up case.
But most importantly, with a pull-up resistor or not, there’s always a transition through the middle, and you need to deal with the inherent “junk” during the transition, period. Debouncing the switch, or alternatively having a UI that simply doesn’t care if there are multiple button presses (like we have here — zeroing it a couple times within a few milliseconds doesn’t make a darn difference), will be necessary with or without a pull-up resistor. With a pull-up resistor + SPST switch, the “junk” comes from the physical movement of the switch contacts, and with a SPDT switch without a pull-up resistor, there may be some extra “junk” (noise capacitively coupled onto a floating pin) within the “junk” of the physical switch contact transition — does that make sense?
I would say that a pull-up resistor might also be useful in a case where a switch could physically become disconnected and you establish a default state — imagine a “fire zee missiles” button, where if the switch somehow gets disconnected, it’d be best if the input pin were kept in a particular “DON’T fire zee missiles” state. :-)
In the end, we all agree that a pull-up resistor is the best solution for a number of reasons.
Hope that helps!
(FYI, I’m the guy in the video.)
a breadboard to the wall !
could someone teach this poor boy how to make a pcb
Sah-weet! I just picked up one of these machines (for free) and I’ve been noticing the same problem. Awesome work!
wow, another great video.. can’t wait to see what new parts they’ll be turning out.
I’m embarrassed to say I’ve always used external pull-ups. You set the internal ones with DDRB..?
DealExtreme has the 6in/150mm digital caliper for $15 shipped, I own one from there and it has the same exact battery and signal covers/layout.
Ok, so you spent all that time to get the accuracy of the z axis down to the thousandth’s, then in your video demonstration you take it to a whopping .100″? I think you stuck the 1 in the wrong place:) Nice solution to the problem.
@Matt: to enable the internal pullup, you configure the port pin as an input via DDRx and then set the corresponding output (PORTx) bit. ie:
DDRA = 0x00;
PORTA = 0x01;
@Mark: 0.100″ requires the same accuracy as 0.001″
Hmm it’s not a production machine. It is for fun. Mini lathe/ mill machines do not turn/mill out serious quantities of parts. @ Josh good point but again What do you expect from such a cheap and small machine. It has no ball screws to my knowledge,this means, backlash of course and lower tolerance expectations. Not CNC. No high volume obviously. A vast improvement on a small machine however. +/-.005″ on the Z of a manual mill is far from good but better than 0.042″ graduations fo sho.
@jproach:
You are correct, I guess I shouldn’t ignore those zeros huh?
Next revision: add motors and use the calipers as a feedback loop to automate the damn thing? ;)
@eric: great idea. Sadly the update rate is likely not enough for a full CNC, but might be fine for manual machining.
one discussion: http://dev.forums.reprap.org/read.php?14,17905
Hint: to avoid corrupted data, don’t just send the clock and data signals from the caliper to the dro (that’s Digital Read Out electronics) single-ended; generate their inverse signals (clock-bar and data-bar), have a couple of extra wires to send those too, then re-combine them at the receiving end using the inverting and non-inverting inputs of an op-amp (or whatever – line-driver and line-receiver chips do that automatically). That way you get several times the noise immunity.
I once had to do that while making a converter for a metric linear scale to use it on an inch machine. The data was garbage until I switched to having my PIC receive both A and A-bar, B and B-bar. Then there were no glitch problems evermore.
The failure mode: An external electrical noise source couples in to both the Clock and Data signals. If it’s a positive-going noise pulse, it will have no effect on a 1, but will briefly make a 0 look like a 1. Conversely, if it’s negative-going, it can temporarily make a 1 look like a 0.
Now if you’ve got both the A and A-bar version of the signal to look at, only one of them can be corrupted, and that’s not enough to make the output change state. Viola: noise immunity.
Hope that helps someone.
Wow! You really covered this topic well. Are there other resources that I should check out?