Machsupport Forum

Mach Discussion => General Mach Discussion => Topic started by: hudmut on February 23, 2010, 05:13:25 PM

Title: RPM and counting ?
Post by: hudmut on February 23, 2010, 05:13:25 PM
Can any one tell me if I'm right here

In ports and pins/inputs iv got Index switched on so when i earth pin 10 on and off i get a rpm count on my screen.

Is this the right why about getting a rpm count on my screen if so is it OK to just use a hall effect sensor/pickup on my spindle. one pass over the pickup = rpm or do i need to look at this in a diffrent way.

Some thing like a disc with lots of slots in with a total diffrent type of pick up.

Either way can some one point me at a good set up/pick up to use 
Title: Re: RPM and counting ?
Post by: Hood on February 23, 2010, 05:19:31 PM
Opto with a single slotted disc is the way I did it but others have used a hall effect sensor.

Hood
Title: Re: RPM and counting ?
Post by: hudmut on February 23, 2010, 05:31:40 PM
Just done a quick googel on a opto do i just run my pin 10 in one side and out the other back to earth or is there a bit more to it than that. 
Title: Re: RPM and counting ?
Post by: Hood on February 23, 2010, 05:46:08 PM
I use an Optek OPB917B, you also need a current limiting resistor, I used 220 Ohm on mine for 5v.  http://www.farnell.com/datasheets/35000.pdf
You connect 5v  to the the VCC and 0V to the Gnd and also connect the 0V to the LEDs cathode. The LEDs Anode gets connected to the 5V but the resistor is in series with the 5V to limit the current. The Output is then connected to an input on your BOB.

Hood
Title: Re: RPM and counting ?
Post by: RICH on February 23, 2010, 07:30:58 PM
hudmut,
I use a hall sensor on my lathe and works great. It was much easier to mount / implement that an opto with a single slotted disc when i did my lathe conversion.  So have used both with success. For a pickup i used a rare earth magnet from Radio Shack ( about 1/8" in diameter ) and just cleaned a spot and crazy glued it to the back of a gear. You will need look up the max current allowed by the sensor and limit it to the the sensor via a resistor. Just needed +5v / signal wire back as an input in MAch / and a grd.

RICH
Title: Re: RPM and counting ?
Post by: RICH on February 23, 2010, 07:34:17 PM
Here is a link to a pic which shows what i did
http://www.machsupport.com/forum/index.php/topic,12484.msg82818.html#msg82818
RICH
Title: Re: RPM and counting ?
Post by: hudmut on February 26, 2010, 04:42:58 PM
thank you for all this boys got my head round most of it but the earth is the one that is doing me. iv got 3 wires on my switch. so iv got power going in from my power supply from the PC as well as my neg. so I'm left with one wire witch is my signal going back to pin 10 do i still need to earth as I'm going back to the PC all read thought My neg power supply
Title: Re: RPM and counting ?
Post by: Hood on February 26, 2010, 07:00:37 PM
By Earth I am presuming you are meaning the 0V? If the 0V of the power supply is shared with the BOB then you shouldnt need to connect it to the BOB again but if its a separate power supply you may need to common the 0V of the supplies.
Hood
Title: Re: RPM and counting ?
Post by: ianober on April 02, 2010, 01:25:34 AM
I am running into a similar situation.  I have a spindle sensor that I added onto my lathe CNC conversion and am having trouble getting it working.  The sensor requires 12 volts to power it and since I do not have a 12 volt source on my board (Hobby-CNC driver board) I am using an old PC power supply.  I have power going to the sensor and I have the "normally closed" wire going to pin 10.  The sensor also has a "normally open" wire which I am not using currently.  I can get a signal to show in my diags screen but Mach3 is not getting feedback from the sensor some how.  It does not show the Limit opening and closing when I rotate the spindle.  I attached a pic of the sensor, any ideas fellas?  Thanks!!

Title: Re: RPM and counting ?
Post by: RICH on April 02, 2010, 08:55:30 AM
Like the other posts you will need an input to Mach in your config to say what pin / input and port is used for the signal.
I am curious as to what your sensor is reading off of. Are you reading off the gear teeth? ( Can't tell from the pic )
If so that would be timing and won;t work as you need a single index from a slot or magnet ( Hall sensor ).
Have a look at the Threading On the lathe Manual section 7 as that has info on configuration.
Post info on your sensor.
RICH
Title: Re: RPM and counting ?
Post by: ianober on April 02, 2010, 01:10:50 PM
There is a small strip of steel that has been screwed onto the spindle so it reads each revolution.  I have the pins configured properly as far as I know.  As I rotate the spindle the sensor is picking up the strip mounted on the spindle so I know the sensor is working.  It has a little LED on the back of it that lights up when the spindle plate passes.  The problem is that the signal is not getting into Mach3.

As I said before I am using 2 different power supplies, is this a problem?  I am using a separate PC power supply for the spindle sensor (12V) and I am using my driver board on its own.  The driver board does not have a 12 volt output, thats why I need the PC power supply.  My question I guess is does the ground need to be shared between the 2 power supplies for this setup to work?

I dont have my sensor info in front of me but I will post it ASAP.
Title: Re: RPM and counting ?
Post by: ianober on April 02, 2010, 04:40:05 PM
To add, the sensor I have is a proximity sensor.  Model number IS12-Y4-N-OC-DC.  I looked up the specs here: http://eurospecdirect.com/DataSheet/cs12_sensor.pdf  It looks like either of the NC or NO wires, which ever I am using, needs to be grounded.  It also looks like the sensor can take 24 volts so that means I can use my driver board as it has a 24 volt output for a fan.
Title: Re: RPM and counting ?
Post by: RICH on April 02, 2010, 06:07:35 PM
Hmm....., I am not sure on this, there are four wires. The Blue / conn 3 is ground and would go back to your power supply ground.
Now when it senses the strip, you have two choices for an output to Mach, as the internal switch can be opened or closed so that is conn 4 or 2 and one of them would be used an input to Mach. I guess the difference would high to low or low to high voltage change but that can be addressed in configuration. Check the voltage output from connection 4 or 2 and see what the swing is ie; 0 - 24v ? I would limit it to 0 to 5 volts.

I see Hood is in here, how do you see it?
RICH
Title: Re: RPM and counting ?
Post by: ianober on April 02, 2010, 06:22:59 PM
Do you think that it matters that the ground from my driver board and the ground from my sensor power supply are not shared?  The driver board is powered by its own supply and the sensor is being powered by a converted PC power supply.
Title: Re: RPM and counting ?
Post by: RICH on April 02, 2010, 06:32:10 PM
As i have been informed......
You should take the circuit ground back to the supply source where the positive came from. If you take it to some other ground that ground may be at a different potential as compared to the one that supplied the power. 
Now does it matter? Well sometimes no and sometimes yes, you can try and see how it goes!
RICH
Title: Re: RPM and counting ?
Post by: ianober on April 02, 2010, 06:39:39 PM
I see your point Rich.  I also gathered from the diagram that one of the 4 or 2 wires needs to be grounded back to the negative.  Well that was not the case in my setup.  I have one of those wires terminating in the 15 port.  Should I run a jumper wire from the 15 port back to the 12 V power supply ground to complete the circuit?  I was thinking that is why I am not getting a reading.
Title: Re: RPM and counting ?
Post by: RICH on April 02, 2010, 07:13:15 PM
conn 1 / browne wire -  gets the supply from the power source for the circuit ( + )
conn 3 / blue wire - is connnected back to the supplies ground as that completes the circuit ( - )
conn 2 or 4 - one will go to an input pin so Mach will see the pulse
The one you don't use should be left alone as no current will flow through it since the circuit is not completed.
That's what i get out the info you posted.

RICH
Title: Re: RPM and counting ?
Post by: ianober on April 02, 2010, 07:18:58 PM
Yeah, thats how I got it hooked up Rich and Mach3 wasn't seeing anything.  I will do like you said and see if there is any voltage coming out of the 2 or 4 wire when the spindle LED activates when I get home.  If it is more than 5 volts then perhaps Mach3 does not see it.
Title: Re: RPM and counting ?
Post by: ianober on April 02, 2010, 09:29:00 PM
So Rich, I hooked up the sensor to the 24 volt supply on my driver board.  The output of the the NC wire when the sensor is activated was ~22volts, a little high.  So I got a small regulator from Radio Shack and stepped the output down to 5 volts exactly.  I checked pin 15 with everything powered up and spun the spindle till the sensor LED came on and the pin was getting 5 volts exactly.  But when I went in the Mach 3 Diags the LED was not lighting up.  I tried this on both the Timing option and the Limit Option.  Do I have something configed wrong in Mach?  I tried reading in the manual to no avail for setup info, perhaps I missed something.
Title: Re: RPM and counting ?
Post by: RICH on April 02, 2010, 10:28:21 PM
You have a light on your sensor which which should come on when it just sees the tab, and it should just stay on until you just get past the tab and then it  should go off. In diagnostics and if the signal is sensed by Mach via the input, then you will see the same kind of thing, namely the index led will will turn on and then as you rotate the spindle it will turn off until the tab is seen again.

If you measure the voltage  out of the sensor conn pin 2 or 4 ( which ever one your are using ) to ground , you will see the voltage change from a low value to a high value. The low may be .8 volts and the high may be 4.9 volts, but there is a difference between the low and the high. That difference, in order to change the state at the PP from low to high, needs to be around 3 volts. If that is not the case then you may  not be able to change the the state of the signal from a high to a low. It's just a square wave _----_----_     on so long and off so long at a low and high voltage. So lets make sure that is correct first. Since you are using 5 volts there may be enough of a voltge drop across the internal circuitry of the sensor such that you are only getting 3 volts out say and which may be insufficient to change the pp state from low to high. If thats the case try adjusting your feed voltage to say 10 volts and see how it goes as 10 volts may be the min voltage required for that sensor.

Attach your xml file you are using and we will have a look at your settings.

RICH
Title: Re: RPM and counting ?
Post by: RICH on April 02, 2010, 10:55:33 PM
CONFIGURATIONS:
config>PORTS AND PINS>INPUT SIGNALS - enable the index, assign the port amd pin #, set active low
                                                            - timing should not be enabled
                                   >SPINDLE SET UP - relay control unchecked, use spindle feedback should be checked and also spindle
                                                                speed feedback
You need to turn on the spindle in order for rpm to be displayed...so in MDI type M3


RICH
                                         
Title: Re: RPM and counting ?
Post by: ianober on April 02, 2010, 11:13:17 PM
ok Rich, check the settings and all looks good.  Here are some pics and the XML file.
Title: Re: RPM and counting ?
Post by: RICH on April 02, 2010, 11:16:43 PM
No attachments were included in your reply.
RICH
Title: Re: RPM and counting ?
Post by: ianober on April 02, 2010, 11:21:10 PM
For some reason attachments are not working for me, Ill keep trying.

Finally, man, I am having one hell of a night.
Title: Re: RPM and counting ?
Post by: RICH on April 02, 2010, 11:45:37 PM
quick look at xml and looks ok.
now let me look harder at the wiring in your pics.

RICH
Title: Re: RPM and counting ?
Post by: RICH on April 02, 2010, 11:51:24 PM
Where are you running the ground wire conn #3 / blue wire which is ground on the sensor?
rich
Title: Re: RPM and counting ?
Post by: RICH on April 02, 2010, 11:53:53 PM
When you check the voltage from the sensor output does it change from the high of 20 volts to a low of 0 volts  when you turn the spindle ?
RICH
Title: Re: RPM and counting ?
Post by: ianober on April 02, 2010, 11:54:48 PM
In Pic 2 your can see it, grounded to the 24 volt output terminal block.
Title: Re: RPM and counting ?
Post by: ianober on April 02, 2010, 11:56:32 PM
When I check the normally closed wire voltage and the sensor LED is OFF, voltage output is 0V ion the normally closed wire.  When I rotate the spindle and the sensor LED is on I get 5V output on the normally closed wire.  Without the 5V regulator I would get about 22V.
Title: Re: RPM and counting ?
Post by: RICH on April 03, 2010, 12:05:33 AM
Good so the sensor is working.
Do you see the LED in diagnostics turning on and off?
RICH
Title: Re: RPM and counting ?
Post by: ianober on April 03, 2010, 12:15:33 AM
LED in the diags is not turning on or off.  I am uploading a video I took showing you the ouputs and wiring.  Should be up soon.
Title: Re: RPM and counting ?
Post by: RICH on April 03, 2010, 12:34:19 AM
You may want to try changing the index in Mach from active low to active high in ports and pins. It should work as you have it.

BUT.............

I have never used an LM7805 voltage regulator in the fashion you are using it. I am not sure just how well it will turn on and off
as it is meant to take  the higher voltage and limit it to constant 5v and can deliver up to 1 amp. So if you are running your spindle at 1200 rpm
that regulator will be switching on and off 20 times a second and don't think it is meant to do that. A signal going into a computer needs to have the current limited else you can do damage. Not sure what the max current for a PP and so just won't guess.

That said, I would of put the regulator upstream of the sensor ( maybe a LM7812 , puts out 12 volts ) and then use  a resitor to control current. But i am not an electronics guy by any means.

So that is why i am not gong to tell you to try a different pin on the PP.

RICH
Title: Re: RPM and counting ?
Post by: ianober on April 03, 2010, 12:44:23 AM
Yeah, I see what you are saying Rich.  Switching the active low didnt work.  I could try the other regulator like you said and bring it to 12 volts.  How big of a resisitor would you think I would need to bring it down 7 volts?

I was thinking to that even if the regulator is too slow it still should be tripping the LED in Mach3 but its not.  It should be on and staying on if it was fast enough.  Hmmmmm, interesting.  Not sure who to turn to in order to fix this.

Here is the post for the video just in case you are curious:

http://www.youtube.com/watch?v=bMJUCqT974s

Title: Re: RPM and counting ?
Post by: RICH on April 03, 2010, 08:05:30 AM
Good  video and confirmed all we have been saying and here is a schematic.

- Check the voltage on pin#12 of the BOB's db25 connection.
- Check the voltage on pin#12 of the cable at the other / PC end.
You should see roughly the same .5 to 5 V change and if so that would mean the index signal is good up to
pc and there is not a cable or pin problem.

RICH
Title: Re: RPM and counting ?
Post by: Fastest1 on April 03, 2010, 10:56:06 AM
I have a hobby cnc board and use a spindle sensor. Mine has an exterior power source and works fine. The 1 thing I would try, is to disconnect the fan from the board during the test. I dont trust anything in line during testing. It wont burn up anytime soon. In fact my fans are 110v and I dont use the 24v terminals at all. Worth a try, but you should see something in the diagnostics window and we know your switch is recognizing the  mark since we see the led light up. Do you have a grounding adapter for your 120v plug that removes the ground for a test? I notice you have a metal  case for your hobby cnc board. I cant tell you how many problems that caused in my case. Since Dave recommends a plastic case, he doesnt have the grounding issues we have brought upon ourselves. Do it just for a test if you dont mind. EVERY TIME I brought anything new into the system, (limit switches, probes and spindle index and speed control circuits) it always faulted and wouldnt proceed. It did not trigger a reset. Worth a try and I dont have enough electrical knowledge to explain why.
Title: Re: RPM and counting ?
Post by: RICH on April 03, 2010, 11:55:56 AM
IANOBER,
After you have checked out the PP cable as recomended and it that was not the problem try a different debounce setting.

In General Config> Index Debounce - instead of 100 try 1 or 10 or 30. That setting has an affect on what Mach considers
a valid signal for the index and can affect the displayed rpm. Easy to do.....
RICH
Title: Re: RPM and counting ?
Post by: Fastest1 on April 03, 2010, 04:33:55 PM
Btw debounce will have no effect on the grounding issue if that is what it is. If the debounce interval was too long it would miss the counting.
Title: Re: RPM and counting ?
Post by: ianober on April 03, 2010, 06:29:58 PM
Fastest, the case is not metal, it is the same case that is recommended in the Pro driver board installation.  It is a hard plastic case.  My 120V main power input does not have a grounding wire.  I am not sure where I would ground the 120V, perhaps to the green wire with the yellow stripe on the transformer? 

Rich, I am checking the Parallel cable as I write this so I will let you know if the cable is an issue or not.
Title: Re: RPM and counting ?
Post by: RICH on April 03, 2010, 07:52:07 PM
Ianober,
If the case was metal you would usualy put a lug on the case and the bare ground wire would be attached to it.  That would protect the user should he touch a hot box ( the circuit breaker would pop if there was a short to ground ). If GFI protected then if a small current was sensed the breaker would pop. The transformer is usualy bolted to the metal case so you have a path to the earth ground. The transformer may not have a ground wire, the green with yellow strip could be a tap for a lower voltage off the secondary windings of the transformer. The primary and secondary windings of the transformer are suported by the transformer frame so attaching the ground wire to one of the mounting bolts of the transfomer would be acceptable because to you are using a plastic box. Just remember that i am not an electrician and safety is your sole responsibility!

Let me know how you make out with the cable check.

FWIW.....I have been were you are.......so smile as today is just another learning day!  :)
RICH

Title: Re: RPM and counting ?
Post by: ianober on April 03, 2010, 08:08:01 PM
I cant thank you enough Rich for taking the time to troubleshoot with me.  I tired the Yahoo group with Dave Rigotti, the one who sells the driver board and he closed my thread for being "off topic" so your help has been invaluable!!
Title: Re: RPM and counting ?
Post by: ianober on April 03, 2010, 08:13:19 PM
Well I have GREAT news and bad news.  The GREAT news is that I found the problem.  You were right Rich.  In my haste and ignorance I grabbed a cable from my work thinking it was good and it turns out that it is not a straight through cable.  It must be some null modem or loopback cable.  I am now getting signal change in the diags, WOOOOOHOOOOOO.

Now for the bad news.  One of the other contributors was right and the regulator I am using is delaying that voltage change so when I turn up the speed on the spindle the diags does not blink rapidly.  Here is my question, can I go back to the 12V power supply and just feed the 10V or so left over straight from the sensor into the LPT port?  Or is that too much voltage?
Title: Re: RPM and counting ?
Post by: ianober on April 03, 2010, 08:25:53 PM
On second thought, I lied, the readout does work.  I cant tell how accurate it is but it seems pretty close.

Rich, I cant thank you enough my friend.  Simple fix but the guidance was great.  Top notch site with great people!!
Title: Re: RPM and counting ?
Post by: RICH on April 03, 2010, 08:44:28 PM
Realy glad you got it working.
The problem is, as now you can understand, there is no one answer and ya need a whole bunch of info
to track something down. Sometimes it's like having a tooth pulled!
Now you know what to look for and how to check the input out. I would suggest using the  lower feed voltage and
and limiting the current to the PP.
LOL,
RICH