wiki:Maschinen/CncFräse/SpindleMeter

SpindleMeter

Simple spindle rpm measurement with emc

Hardware

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.

Schematic

Software

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


#####rpm-counter########
# in: 1x encoder  out: spindle: pyvcp speed in rpm
setp encoder.0.x4-mode FALSE
net rpm-wheel-a encoder.6.phase-A <= parport.1.pin-11-in-not
net rpm-wheel-b encoder.6.phase-B <= parport.1.pin-12-in-not
# 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 => abs.0.in
net measured-speed-sign abs.0.sign => pyvcp.spindle-cw-led-measured

PyVCP config

add something like this to your custompanel.xml

<vbox>
	<hbox>
		<led>
			<halpin>"spindle-cw-led-measured"</halpin>
			<size>15</size>
			<on_color>"red"</on_color>
			<off_color>"green"</off_color>
		</led>
		<label>
			<text>"CW(green) CCW(red)"</text>
		</label>
	</hbox>
	<label>
		<text>"Spindle Speed Ist:"</text>
	</label>
	<bar>
		<halpin>"spindle-speed-measured"</halpin>
		<max_>3000</max_>
	</bar>
</vbox>
Last modified 8 years ago Last modified on Feb 13, 2012, 10:54:55 PM

Attachments (5)

Download all attachments as: .zip