Simple spindle rpm measurement with emc


RPM-Aufnehmer-Skizze Photo-Transistor- und IR-Dioden-Halter

The measurement is done via 2 ir reflex couplers residing in one common case.

the sensor was harvested from a old kemo kit which apparently wanted to be a 'security' card reader. in reality it was reading a hardwired (as in pcb-layout) 'code' consisting of 4 fields in the right white-black combination. go figure ;)

to amplify and clean up the signals they are fed through 3 74HCT14 schmitt-trigger gates each which gives nice, clean edges.



the software is emc2 config again:

Hal config

you need to enable the extra parport if not done yet!

in this config parport.1 is used (2nd port)

# you need one encoder for this
loadrt encoder num_chan=1
# and one absolut value
loadrt abs count=1

# connect encoder to fast thread for pin-update
addf encoder.update-counters base-thread

# calculate new dataset
addf encoder.capture-position servo-thread
addf abs.1 servo-thread

# in: 1x encoder  out: spindle: pyvcp speed in rpm
setp encoder.0.x4-mode FALSE
net rpm-wheel-a encoder.6.phase-A <=
net rpm-wheel-b encoder.6.phase-B <=
# we are measuring rps in reality, so multiply by 60 through dividing by 1/60th
setp encoder.0.position-scale .01666666
# the encoder-output is signed, but we want a directional led and an absolut
net measured-speed abs.0.out => pyvcp.spindle-speed-measured
net measured-speed-signed encoder.0.velocity =>
net measured-speed-sign abs.0.sign => pyvcp.spindle-cw-led-measured

PyVCP config

add something like this to your custompanel.xml

			<text>"CW(green) CCW(red)"</text>
		<text>"Spindle Speed Ist:"</text>
Last modified 8 years ago Last modified on Feb 13, 2012, 10:54:55 PM

Attachments (5)

Download all attachments as: .zip