21 thoughts on “Lathe modification

  1. 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″.

  2. 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.

  3. 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!

  4. 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.)

  5. 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..?

  6. 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.

  7. @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″

  8. 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.

  9. 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.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s