Power supply for inductive proximity switch

The switch is rated 300ma thru and Id like to power it with a modified psu from a desktop box. I cannot seem to find the datasheet for it, you may have better luck- LJ12A3-4-Z/BY.

I dont imagine that matters. though. Its a matter of my ignorance of basic stuff. V/R is 12/.03=400 is that right? Im missing something here and always have, but I cant avoid it this time, Ive already cooked one.

If it matters, Im trying to read the rpm of a spindle by catching the key.

The drive on the lathe, a 4100 Hi-Torque from Little Machineshop, is digital, and reading the rpm and being able to control the spindle with emc2(linuxcnc) would be the ultimate goal, but for now I wanna play with this switch and arduino to work with the stepper I just attached to the leadscrew. Im used to per rev feedrates on a lathe and also dont want to be without the ability to thread for long, I've been cuttin a lot of em lately. Thanks for any help you can give me.

How many wires, 2 or 3? Color of wires?

Industrial switches may be AC with 2 wires and usually in series with the load, voltage could be from 24 to 220 AC.

DC switches are usually 24 volt (10 - 30) with + wire brown, - wire blue and output wire another color, the ouput is usually open collector either NPN (sinking) or PNP (sourcing), prox switches may be inductive, which work with ferrous targets or capacitive which will work with non ferrous targets or bulk stuff like sand or grain or even liquids. Also, they may be normally open or normally closed or both (with 4 wires).

What kind of readout device are you planning to use? Store bought or are you going to "roll your own" ?

I did a similar project once on a big Poreba engine lathe, I used a Red Lion time base counter but they are very expensive. It was an industrial job so I didn't care.

This looks like the sort of thing I used to use in my first job when I left school back in 1966. These has only two wires and you included a series resistor. They consisted of a coil that normally oscillated at a resonant frequency. When they are close to metal that shifts the resonant frequency and they stop oscillating and draw more current. So you apply power through a series resistor ( about 1K as I recall ), and when metal is in the proximity the voltage across that resistor goes up as the current through the coil rises. If you connect them without a resistor then you will burn them out. I think the voltage range was 12 to 35 V.

Yep, I've worked on hundreds of them, only problem with a tach application, it may not have high enough switching frequency, the large diameter ones (30 mm) will only do about 1 or 2 kHz.

I know plenty about the switch, its how to supply 12 volts and limit it to 300ma that has me confused. The switch has three wires as it is essentially a transistor with the gate being triggered by the presence of any ferrous object. It is of the NO variety with an input voltage of 12-35.

I found this on youtube earlier- DIY Arduino/Leonardo CNC Spindle Speed Control He uses an optical switch, which may be what I need to do since I can get by with a much smaller voltage. Its the basic electronics knowledge that is lacking here. How do I limit 12V from a desktop psu to 300ma?

Thanks for the interest, guys. Here's another video of the stepper in action. I bent the shaft threading it because I got in a hurry.

Stepper Steppin'

How do I limit 12V from a desktop psu to 300ma?

If it as you say then you don't need to do anything to limit it to 300mA, that is what the switch should take when it is connected to 12V on the power and ground. The output sounds like an open collector so connect that directly to an Arduino pin and enable the pull up resistor.

Wise to check the output voltage/function with a multimeter and a real resistor first
to check it isn't going to put 12V on the Arduino pin.

Grumpy_Mike:
If it as you say then you don't need to do anything to limit it to 300mA, that is what the switch should take when it is connected to 12V on the power and ground. The output sounds like an open collector so connect that directly to an Arduino pin and enable the pull up resistor.

I couldn't even tell you what a pull up resistor does lol. Im a machinist, not an electrical engineer, so pardon my ignorance. I really hope that this project will shine some light on some of those pitch black areas of electronic understanding I have. I cant remember how I had the other one hooked up (this was a month or two ago) that lead to a plume of magic blue smoke, but I thought, as you said, it would only take a small amount of current, well within its limits. Nope.

What do you guys think about using a hdd motor as a rotary encoder and using that to track spindle position and speed? Because obviously a single prox switch will not know anything about spindle position and Id really like to have this data as well, not just rpm.

If you put the voltage in the wrong wires then yes you will burn it out. If you put it in the right wires it will not. You need the data sheet of your switch to confirm what the right wires. Alternately measure it with your meter.

I just lost my whole reply.

Its been plugged up for hours now and no heat or signs of distress. However, about a couple hundred rpm the indicator light ceases to light up. I know this doesnt necessarily mean there is no signal. I want to use an arduino to check for a signal, I have a ton of them hanging around. I might actually get to use one.

Any advice on how to verify that I have a signal?

Any advice on how to verify that I have a signal?

Write a sketch that counts the pulses and then every N it toggles the on board LED. So with N at 10 and 600 RPM the LED will toggle at 1 second intervals.

Glossary - Toggle to change state, if on go off in off go on.

Use the % operator to pick out every N, as in if( (count % N) == 0 ) { // do the toggle

I took the easy way out and broke out the o-scope. It looks like around 2000 rpm the signal gets so small that it becomes indistinguishable from noise. For what its worth, the voltage is set at 5V/Div and the time is 5ms/Div. That should give you an idea of what youre looking at. Also, i know that spindle sounds rough, it's not the spindle making all that racket. Im about to go to radio shack and grab some op amps and give this old hdd spindle motor a shot as a quad encoder. Thanks everyone for your interest and help.