Lessons in measurement error

Lessons in measurement error

I built a tachometer for the milling machine, as a step in giving the cnc controller full spindle control (auto-change with tool change, and sense when it’s stalling.)  The first version uses an arduino and this code: http://arduino.cc/playground/Learning/Tachometer

The sensor is a mouse encoder wheel LED/phototransistor pair, with a turned aluminum disc that has a hole drilled in it, as the encoder itself.

(You may ask why I’m not using an AS5040.  That’s the wrong tool for the job, since it senses position rather than just rotation, and the encoder wheel I just cut fits right on the hollow mill spindle, which provides no easy place to put a magnet.)

Anyway.  The arduino code works fine.  The schematic, however, has a problem: if you wire it up just as this says, the phototransistor output is always at about Vcc: the analog input to the arduino measures between 1017 and 1023 no matter how carefully you block the phototransistor.

But the moment you go to measure the voltage coming off the phototransistor with respect to ground, it works perfectly: any bit of anything blocks the lightbeam and the output goes to a fraction of a volt.

The meter’s input impedance drags down the output and makes it work.  It’s hard to troubleshoot something that works when you’re measuring it, and only doesn’t work when you’re not measuring it.

A 1 megohm resistor between the output and ground makes it work great.

optical tachometer schematic
optical tachometer schematic

 

Tomorrow I’ll add an LCD rather than having to keep a laptop in there to see the RPM, and a bit later I’ll turn the whole thing into a standalone board on the back of the LCD, but for the moment this will do.

 

Comments are closed.