Machsupport Forum

Mach Discussion => General Mach Discussion => Topic started by: guynamedbathgate on January 20, 2008, 11:17:43 AM

Title: setting up a reflective object sensor for dummy's
Post by: guynamedbathgate on January 20, 2008, 11:17:43 AM
hello everybody. I know many people have posted about this before but I cant seem to find all the info Im looking for in one place. Ifinally got my fairchild reflective object sensor hooked up and I can get a signal to the controller. but from there Im lost. first off my original idea to take a peice of foil tape, mask off a strip of it and paint the rest black and wrap it around the inside spindle shaft, doesnt seem to be yielding results. I cant get a stable signal meaning that in the diagnostic screen my index LED is always blinking rather than staying solid on. I can get it to stay off. when I get it as best I can and turn the spindle on Im getting severly fluctuating and crazy spindle speed numbers. The Mach PDF gives all of one paragraph on how to set this up. so my starter questions are as follows.
- what is every body else using for there reflective material and where are they mounting it?
- what adjustment settings are there in mach to set up the spindle once I get a steady signal?
- and what problems should I be looking out for?
I almost feel like someone should have written a catch all piece of literature to cover this topic by now so if it exist please point the way.
Chris
Title: Re: setting up a reflective object sensor for dummy's
Post by: Hood on January 20, 2008, 11:39:06 AM
You said you are wrapping the reflective tape around the spindle, is this correct? if so thats your problem, you only want a bit of tape there so the reflective tape is only seen on part of a revolution and as such the switch is triggered. If you have the tape right round then the switch will continually see it and thus not react properly.
Hood
Title: Re: setting up a reflective object sensor for dummy's
Post by: guynamedbathgate on January 20, 2008, 01:01:54 PM
no you misunderstood. I used a peice of foil tape all the way around the spindle, but I painted it all black with the exception of a thin strip. so only a small line is reflective. though I really cant seem to get the sensor to function properly at all. basicly it doesnt matter what I put in front of it, It will see it. I tried a black piece of mat board and everything. switch goes on when anything is in front of it switch goes off when nothing is in front of it. no matter how reflective or non reflective. also when the switch is on, say if I put a shiny piece of aluminum in front of it, on the diagnostic screen the index LED is not solidly on like It should be. It blinks irraticly. ( Ive also tried a diiferent sensor with same results)
can someone give me a run down of all the things I have to do, to set up the software for an index sensor because I feel like Im missing something. I set up the input under ports and pins.
I looked at the spindle set up screen but it wont even allow me to enter the number of pulses per revolution in the box. Also I have no idea what the other 3 values marked as P,I,D, are for. I assume they control the accel and deceleration but Im not sure, can anyone clear this up for me. Is there another setup screen  need to know about? I'm really in the weeds here.
Title: Re: setting up a reflective object sensor for dummy's
Post by: Hood on January 20, 2008, 01:23:16 PM
If you want to use these settings I think you will need to use the Timing Input rather than the Index one. However it sounds like your hardware is the problem, I dont have any experience with reflective switches as I just use optical ones, maybe Jim will chime in as I think he uses the same ones as you.
 One seting you could try is increasing the Index debounce.
Hood
Title: Re: setting up a reflective object sensor for dummy's
Post by: guynamedbathgate on January 20, 2008, 01:54:58 PM
well Im open to trying the optical switches. can you give me a link to where I cn buy one.
Chris
Title: Re: setting up a reflective object sensor for dummy's
Post by: Hood on January 20, 2008, 02:19:13 PM
You will need a slotted disc to use the optical switch, I also use them for limit switches on my mill, they are deadly accurate. I am in the UK and I got mine from R S Components, if you go to rswww.com then put 455-0919 in the search box you should come up with the switch I have. You will also need a 22Ohm resistor so you dont blow the switches LED but thats all you will need. Heres a pic of the setup on my mill.
(http://mysite.wanadoo-members.co.uk/hoodsmachiningpages/BOSScomplete/SpeedSensor.jpg)
Title: Re: setting up a reflective object sensor for dummy's
Post by: 01sporty on January 20, 2008, 05:27:24 PM
I used a sensor like that for the tach on my spindle.  It worked right off the bat for me.  I think it might be a focus thing.  I aimed mine at a hex nut that I had painted flat black then put a bit of aluminum tape on each of the flats.  It was very sensitive to the focal length.  Once I got it adjusted to the right distance, it worked fine.

I think your round shaft may be the problem.  Try putting your shiny bit on something raised so it has a different focal length.

I use optical switches for my home and limit switches as well.  They only have a .005 aperture but I've still never gotten better that plus or minus a thou on homing repeatability from day to day.  If I need it any closer than .002, I just use the homing to rough it in then indicate the part.

Cheers,
Walt
Title: Re: setting up a reflective object sensor for dummy's
Post by: Hood on January 20, 2008, 05:47:17 PM
Walt
 I find that strange regarding your limits, when I first set mine up it was on a manual Bridgeport that I converted, it still had a DRO on it. I did a test by homing and then zeroeing all axis on the DRO, I then moved off and homed again, I did this 100 times and there was only once or possibly twice (it was 3yrs ago so I cant remember) that the DRO didnt read 0.000 and out of the once or twice it was off it read 0.005 and that is mm not inches ;)

Hood
Title: Re: setting up a reflective object sensor for dummy's
Post by: 01sporty on January 20, 2008, 06:27:00 PM
Yup, I was totally shocked.  I thought that .0005 aperture would make them even more accurate than they usually are.
It's on a Taig so it's not like inertia is affecting it.  With the ball screws I have it it right now, the machine is accurate to .0002 over it's entire envelope and usually repeats to .0001.  But I don't count on those home positions.

 I don't keep it as clean as I should.  Doesn't take much dirt to put you off a couple thou so maybe that's it.  I don't worry about it, I just double check everything if I need the accuracy.

Cheers,
Walt
Title: Re: setting up a reflective object sensor for dummy's
Post by: Hood on January 20, 2008, 06:37:27 PM
Walt that could be it, the switches I used at first were ones from homeshopcnc.com. They are enclosed and have a plunger that actuates them by moving a flag out of the optical switch. I have since made up similar enclosed ones for the mill I have now as Home Shop dont seem to sell them any more.
Hood
Title: Re: setting up a reflective object sensor for dummy's
Post by: guynamedbathgate on January 21, 2008, 07:03:17 AM
Thanks i think Ill try the slotted wheel if I cant get this darn thing to work properly. Any idea where I can an optical switch in the states?
Title: Re: setting up a reflective object sensor for dummy's
Post by: Hood on January 21, 2008, 07:29:02 AM
Just did a quick google for that part number and Digikey and AlliedElec have them.
http://www.digikey.com/
http://www.alliedelec.com/

Hood
Title: Re: setting up a reflective object sensor for dummy's
Post by: guynamedbathgate on January 21, 2008, 07:40:43 AM
I cant seem to find the exact one that was posted, would this one work?
http://www.optekinc.com/pdf/OPB930W.pdf
Title: Re: setting up a reflective object sensor for dummy's
Post by: Hood on January 21, 2008, 07:48:26 AM
Sorry the part number I listed earlier was the RS Components number, what I did the google search on was the Optek part number OPB917B
Hood
Title: Re: setting up a reflective object sensor for dummy's
Post by: Hood on January 21, 2008, 07:52:11 AM
Also I have used the OPB916B its slightly shorter reach which may suit better.
Hood
Title: Re: setting up a reflective object sensor for dummy's
Post by: guynamedbathgate on January 21, 2008, 08:01:11 AM
well thanks for checking but Digikey and Allied both have minimum orders in the 100's because they do not stock them. Man this if frustrating work.
Chris
Title: Re: setting up a reflective object sensor for dummy's
Post by: guynamedbathgate on January 21, 2008, 08:11:41 AM
what about the OPB917BZ
they stock those, would that one work.
Chris
Title: Re: setting up a reflective object sensor for dummy's
Post by: guynamedbathgate on January 21, 2008, 08:46:24 AM
alright I found them at Newark.com
they charge a riidiculouse $15 handling fee to ship them direct from the UK but I went for it any way.
Hood, How do you have yours wired to the PC?
Im using bob campbells breakout board so I was just curiouse how the wiring would go on this switch.
Chris
Title: Re: setting up a reflective object sensor for dummy's
Post by: Hood on January 21, 2008, 10:01:36 AM
I just have it connected via my breakout (pmdx 122)
The Cathode and Ground (Black and Green) are connected together and taken to a ground on the breakout.
The Output (blue)  goes to the Input you choose on your breakout.
The Vcc (white)  is connected directly to a 5V supply from the breakout.
The Anode (red) is also connected to the 5V but has a 220 ohm resistor in line.

All thats left to do is configure the Index in Mach for the pin you connected to and you should be up and running.
I would advise to use shielded wire.

Hood
Title: Re: setting up a reflective object sensor for dummy's
Post by: guynamedbathgate on January 21, 2008, 12:00:26 PM
sounds easy enough. thanks.
Title: Re: setting up a reflective object sensor for dummy's
Post by: guynamedbathgate on January 21, 2008, 12:25:17 PM
Have you looked at the campbell designs breakout board? the jack for an input is a bit different than yours. Its got a ground, a signal, and a 12V supply. How different would the wiring be for that. I had to get a work around for similar type switches that are used as homing switches on my Mill. Here is the diagram I was given for that. Here is a link to the pdf for the breakout board.
http://campbelldesigns.net/files/breakout-user-guide.pdf
In previouse posts I was given a circuit for a work around for the reflective object sensor but never had any luck with it working. In the end I just used an external 5V DC power supply for the emitter and then just connected the ground and signal wire. I am aware that, that may be the source of my troubles but if there is a way around it, id like to try. I need my breakout board for the speed control function so Im stuck with it.
Chris
Title: Re: setting up a reflective object sensor for dummy's
Post by: jimpinder on January 21, 2008, 12:25:55 PM
I'm sorry to come to this so late - it just shows - miss a day, miss a lifetime.

What is your problem. If you have the Fairchild relective sensor giving a reading then you are there !! apart from a few adjustments.

The way I did mine was to coat the rim of the chuck mounting plate in matt black paint - note MATT black  since we are dealing with relection.
The chuck plate is about 6" diameter. The Fairchild relective sensor was mounted so that it shines down  on the matt black. From my grand-daughters "box of sticky things" I got a little sticky mirror, about 5 mm wide and maybe 10 mm long. I stuck this on the rim of the chuck mounting plate. I then started the chuck, and adjusted the DISTANCE the sensor was from the rim, until it gaye a reliable reading. Since it comes straight up on the screen this is fairly easy.

The distance is quite critical, though, too near or too far away and the reflection on the rim does not hit the sensor. The other thing is to ensure that the mirror part is clean.

The other thing to do is adjust the index debounce so that it is long enough to trigger only once while the reflector is over the mirror. This is easy - since the mirror is only 1/45th of the length of the rim.

There is a slight problem - and this will occur ( I think) with whatever system you use. My system does not reliably read from 0 to 1000+. I cannot abjust debounce for all speeds. Therefore at very low speeds I do sometimes get odd readings. I can live with that. It is accurate from about 150 rpm to over 1000 rpm ( it has no trouble with faster speeds)

Title: Re: setting up a reflective object sensor for dummy's
Post by: guynamedbathgate on January 21, 2008, 01:03:18 PM
thanks jim but I have messed with it and no matter what I do I cant get it to read anything but giberish. I can leave the lathe running and move it  all over with no change. also if I pull up the diagnostic screen I can get the signal light to come on with any object let alone a reflective one. its more of an object sensor than a reflective object sensor if you ask me. I didnt want to mount mine on the front of the lathe as i thought this was asking for dirt problems along the way. I mounted mine inside the headstock where there is a nice cavity. the chuck shaft in there is aproximately 1.75'' . what size would you recommend the reflective material be on a shaft that size. also what would be a recommended debounce setting. Im looking at a speed range of 100-1500 rpm.
 regardless I will continue to mess with it until the other optical switches come but Id rather use something a little more reliable so Im going with those. although ive been reading people have had a share of problems getting those to read accurately enough to do threading opperations. Id like to have a reliable tach first and formost. but Id also like the option to do some threading in the future too. But Ill start with getting the tach working first.
Chris
Title: Re: setting up a reflective object sensor for dummy's
Post by: guynamedbathgate on January 21, 2008, 01:04:48 PM
Hood,
 what diameter and thickness is the disk your using in that photo? size of slot?
Title: Re: setting up a reflective object sensor for dummy's
Post by: jimpinder on January 21, 2008, 01:39:11 PM
Chris - I'm sorry you are having so much bother. Here are a couple of pictures of mine to show how simple it is.

I take it you are now using a 5 volt feed to power it Ignore the "pull up" resistor on the output, it is not needed.
If you power up the transmitter side, you should, using a multimeter,between the output and 0 volts, be able to detect a sizeable drop in resistance, as soon as the detector picks up a signal from the transmitter. You can check this using a little mirror - and simply hold the chip in your hand and move it towards the mirror and away. If you connect these two leads between your 0v and your index input, this should give a reliable signal.

The only problem I can think of inside an enclosed space you are using is that the transmitter will be sending outputs all round the housing, and some could be bouncing back into the sensor.

Anyway - I really can't say any more - here are the photos. ( P.S. I dont have a problem with dirt - and if I do, it is readily available for the wipe of a cloth.)
Title: Re: setting up a reflective object sensor for dummy's
Post by: Overloaded on January 21, 2008, 02:42:47 PM
Chris,
I started to go the way you are going.
I ended up with - http://www.cnc4pc.com/Store/osc/product_info.php?cPath=25&products_id=129
                         http://cnc4pc.com/Tech_Docs/C3_5_WG.pdf
It's all together and works PERFECTLY.
Just a Thought
Title: Re: setting up a reflective object sensor for dummy's
Post by: guynamedbathgate on January 21, 2008, 03:34:04 PM
Overload
wish I had seen this before I bought the other sensors this morning. Look before you leap I guess. :-\ anyhow.

Jim. I did what you suggested already and It does exactly what you sya but when I hook it up Im not getting anything useful out of the DRO.
I will play with it again tonight.
Title: Re: setting up a reflective object sensor for dummy's
Post by: TonyP on January 22, 2008, 06:42:45 AM
There can be several problems with reflective sensors:
 Remember they work on Infra-red, so what you think of as reflective & non reflective may not be as good as you think.
The operating distance is far more critical if you use a shaft as opposed to a disc - the beam bounces off at odd angles, depending on the shaft diameter.
When using a shiny reflector the same thing applies - unless it's flat with no wrinkles, you may get multiple pulses.
I've used them as tacho's on small engine test beds but given up after a while & converted to the slotted switch type.

Tony
Title: Re: setting up a reflective object sensor for dummy's
Post by: jimpinder on January 22, 2008, 08:27:24 AM
Chris - If you have it all working that far, the only place you are loosing the signal is when you feed it back into the computer. It does not need any other pull up resistor, just connect the wire directly to the LPT1 input (mine is through a breakout board but is UNPOWERED).

Best of luck

Jim
Title: Re: setting up a reflective object sensor for dummy's
Post by: guynamedbathgate on February 02, 2008, 03:37:51 PM
ok well I just got my sensor and slotted wheel hooked up. Im using a four inch diameter disk with about a half inch wide slot in it. I have It wired just like hood said.
Black and green on ground
white and red on the positive terminal 12V on mine with a 220 Ohm resistor on the red lead
and the blue wire on my signal terminal.

The Index LED on my diagnostic screen comes solidly on when I turn the slot to the sensor and is solidly off when I turn the wheel to block the sensor. I am however still getting a useless tach reading. it jumps from the low hundreds to near 20,000 and never holds a reading for more than a second.
I played with the debounce and it seemed to have little effect.
where do I go from here.
do I try reinstalling mach to see if it is a software glitch or what. Have there been any versions with problems with the spindle speed dro.
Chris
Title: Re: setting up a reflective object sensor for dummy's
Post by: guynamedbathgate on February 02, 2008, 04:08:32 PM
just installed newest version of mach and no change.
anybody?
Chris
Title: Re: setting up a reflective object sensor for dummy's
Post by: Chip on February 02, 2008, 04:42:45 PM
Hi, Chris

Sound's like your slot isn't wide enough and not giving Mach enough time to see the pulses.

On my lathe, 5 inch dia. disk  3/4" to 7/8" slot work's up to 3000 rpm.

Hope this Helps, Chip
Title: Re: setting up a reflective object sensor for dummy's
Post by: TonyP on February 02, 2008, 05:08:16 PM
Chris,
I assume that you're using the index input as opposed to the timing input. I say this because I didn't realise for some time that there were two different inputs. With one slot use index, with two or more use timing. With more than one you need one slot 50% wider than the others. I would have thought your slot width would have worked ok, certainly at low speeds. It's only when you get fairly fast that the slot size gets critical. There is information on working it out in the Mach manual.
Have you payed with the active Hi/lo setting? I seem to remember it having an effect on my setup. I'll try & run the lathe up & try it.

Tony
Title: Re: setting up a reflective object sensor for dummy's
Post by: TonyP on February 02, 2008, 05:14:08 PM
Yup, that's it. If I set active lo (green tick in the box) on my index/timing input, I get no tacho.

Tony
Title: Re: setting up a reflective object sensor for dummy's
Post by: guynamedbathgate on February 02, 2008, 06:05:00 PM
yeah Im running it on index with the one slot. I thought the slot might need to be wider too so I slowed the spindle down to approx 300 rpm and I still get crazy readings. Im getting a signal to the controler but Im either getting noise or something else needs to be tweaked. Not sure though. everything else seems to be fine. Im curiouse if the opto isolation is part of the problem. does everyone out there use a breakout board too. If so any problems with that. This is really driving me nuts because I keep hearing everyone talk about how simple it is. Yet I've been working on this thing for over a month.
Chris :-\
Title: Re: setting up a reflective object sensor for dummy's
Post by: Hood on February 02, 2008, 07:03:36 PM
Thats a weird one, few things I can think of-
 Are you using screened cable and do you have it grounded properly?
 Have you tried using another pin, possible that you may have a bad Parallel cable or even the breakout of port is dodgy.
 Like you said maybe a reinstall of Mach could help.

Hood
Title: Re: setting up a reflective object sensor for dummy's
Post by: Chip on February 02, 2008, 07:35:42 PM
Hi, Chris

Strait to the printer port hear, If you go direct make sure it's no more than 5 volt's to the port.

With some BOB & some Encoder's you may need a pull-up or pull-down resistor, Around a 1000 ohm's on the optical pickup side.

Thanks, Chip 
Title: Re: setting up a reflective object sensor for dummy's
Post by: TonyP on February 03, 2008, 05:00:07 AM
Chris,
you didn't say whether you'd tried changing the active hi/lo. My test shows that it does matter, and can give the effect that you're seeing. The diagnostics still show the signal changing, but the tacho does not work or gives strange readings.
I'm using a bob with opto isolation.

Tony
Title: Re: setting up a reflective object sensor for dummy's
Post by: cjmerlin on February 03, 2008, 08:50:25 AM
Hi, Placing a capacitor of 0.1uf across the sensor/switch terminals will reduce any spurious interference to the signal.

The action of the capacitor is to provide a short path to ground for any AC component on a DC line.

If the value of the capacitor is chosen carefully, noise spikes and mains induced hum can be reduced whilst leaving the wanted switched DC signal (ie the pulses to determine spindle speed) still available.

If the chosen capacitor value is smaller (ie 0.01uf for instance) it will only reduce higher frequencys so you'll reduce some noise spikes but not mains hum.

If the chosen capacitor value is greater (ie 1uf for instance) it will reduce all of the above and will reduce some if not all of your wanted signal. It will also introduce a small time delay as the capacitor charges and discharges if you chose to large a value, basically it will be trying to turn the pulse speed signal into DC so at higher spindle speeds you'll start losing the signal.

The above explaination gives an idea of how it works but one must remember that this is a last resort thing.

If you have connected to a sensor using fully screened cable (with only one end of the screen connected to ground) and tried to keep signal wires away from high current wires (eg stepper/servo motor and VFD wires) and you are still getting noise spikes then the above option can help.



Title: Re: setting up a reflective object sensor for dummy's
Post by: guynamedbathgate on February 03, 2008, 11:40:24 AM
Yes i have tried the High low setting and it had no effect. I've looked for any sorces of noise that I can think of and the cables are shielded so I will try the capacitor filter. But In the spirit of keeping this post for dummies. where exactly in the circuit does one put the capacitor? Does it just go in line with the  input terminal? ( between the blue wire and signal terminal?) or across the the two wire's. for the sensor (Blue and white?). My terminology isnt so good so when someone says "Just bridge so and so with such and such" I tend to get confused.  "between red and purple" kind of directions or "slot A into tab B" kind of directions are what Im best at.
Chris :P
Oh yeah Im using Bob campbells break out board
Title: Re: setting up a reflective object sensor for dummy's
Post by: cjmerlin on February 03, 2008, 12:44:27 PM
Hi, The capacitor will need to be placed as follows, one wire of the capacitor connected to the signal wire and one wire of the capacitor to 0v wire/ground. It is best if the capacitor is connected as close to the sensor/switch as possible.

This is called parallel connection whereas "in-line" is called serial connection and will not work because the capacitor connected "in-line" would only pass AC signals which is not what is needed.
Title: Re: setting up a reflective object sensor for dummy's
Post by: guynamedbathgate on February 03, 2008, 01:07:10 PM
ok makes sense. now I take it the capacitor has a pos lead and neg lead. and Im assuming the neg lead goes to ground (green wire) and the pos lead goes to the signal wire ( blue wire).  and I will cut the leads as short as possible to get the capacitor right next to the switch. How close am I.
Chris.
Title: Re: setting up a reflective object sensor for dummy's
Post by: Chip on February 03, 2008, 01:34:43 PM
Hi, Chris

Capacitor's, Many flavor's, The one you have may work fine, But the type "Cjmerlin" was referring to, I think, Looks like a Dime or smaller with leads coming

out of the side/edge, Ceramic, Non polarity sensitive type.

Thanks, Chip

PS:  Were waiting for, "It work's !!!!"
Title: Re: setting up a reflective object sensor for dummy's
Post by: cjmerlin on February 03, 2008, 01:50:58 PM
Yep, Chris is nearly there, The capacitor I was referring to is a non polarity type (eg can be connected any way round). As to shortening the leads maybe I wasn't clear enough. It isn't necessary to do that, only to make the connection near the sensor/switch end of the cable and not near the end of the cable that connects to the breakout board.


Hope this helps.


PS: I've just read through this thread and I just wondered if you had use of an oscilloscope you could have tracked the problem down in 5 minutes.
I have one and found it invaluable just for problems like this. I looked on US Ebay and one could be had for less than $20 and learning the basics of how to use them is not that hard, it's just like using a multimeter.

Just a thought!
Title: Re: setting up a reflective object sensor for dummy's
Post by: guynamedbathgate on February 03, 2008, 02:46:02 PM
well Im not going to be able to mess with it till I can get down to the electronics store tomorrow and pick up a capacitor.

cjmerlin. Can you link me to the O scope on ebay you where refering too. I do think it will be in my interest to own one.

Chris

Title: Re: setting up a reflective object sensor for dummy's
Post by: cjmerlin on February 03, 2008, 03:15:29 PM
Hi, I just did a quick look on Ebay and there is a large difference in price but all you'll need is a simple one so try bidding for this one Ebay item no 130193806388. If not, be patient and a cheap one will come along eventually.


Title: Re: setting up a reflective object sensor for dummy's
Post by: Hood on February 03, 2008, 04:06:01 PM
I would advise you to try and get a dual trace scope, much more use especially as you progress. Not sure what the prices are like in the USA but I picked up an immaculate dual trace scope for about £30 ($60). I have seen them cheaper but this was an ex Post Office one so I knew it would be half decent ;)

Hood
Title: Re: setting up a reflective object sensor for dummy's
Post by: guynamedbathgate on February 03, 2008, 05:08:52 PM
Hey Chip, I took a quick moment to put a vltmeter on the signal input. Im getting about 12 volts when the signal is on and(correction .01) volt when it is off.
If that helps.
As for the scopes. what would be a use for a dual trace as aposed to s single trace scope??? just curious, all the dual trace seem to be a little pricy right now.
Chris
Title: Re: setting up a reflective object sensor for dummy's
Post by: Hood on February 03, 2008, 05:14:00 PM
you sure your meter is right? if yes then you have serious problems, should be 5v.
Dual trace are very handy especially if you have a servo system, it lets you look at the A nd B signals of the encoder, if you have differential encoders you can look at A+ and A-, also if you have AC servos and you need to align the Hall from the encoder to the motor windings you need a dual trace scope.
 If you cant get a dual trace at a decent price get the single trace and just keep an eye out and snap one up when it comes along at the right price.
Hood
Title: Re: setting up a reflective object sensor for dummy's
Post by: guynamedbathgate on February 03, 2008, 05:18:12 PM
why do i have a serious problem? I have a 12 volt supply on my break out board. why wouldnt the signal be 12 volts going back into the board.
Title: Re: setting up a reflective object sensor for dummy's
Post by: Hood on February 03, 2008, 05:19:38 PM
oh thought you were meaning the 12v on the Index Input, what s12signal are you meaning?
Hood
Title: Re: setting up a reflective object sensor for dummy's
Post by: Hood on February 03, 2008, 05:34:54 PM
Just read back and all I can see that you would be talking about with the 12V is indeed the Index signal. If this is correct then hopefully you have not done any damage as you should be feeding the optical switch with 5v.
Hood
Title: Re: setting up a reflective object sensor for dummy's
Post by: Chip on February 03, 2008, 05:38:13 PM
Hi, Chris

Look like the on / off is good, Must be a Noise issue,  The Capacitor may get it working.

Thanks, Chip
Title: Re: setting up a reflective object sensor for dummy's
Post by: Hood on February 03, 2008, 05:44:50 PM
Chip what are we talking about here? where is the 12V?
Hood
Title: Re: setting up a reflective object sensor for dummy's
Post by: guynamedbathgate on February 03, 2008, 05:46:20 PM
well I am feeding the switch 12v but I have a couple of other optical switches on my mill running off the same board. they handle the 12v alright with  no problems. The breakout board switches the voltage back to 5v before it goes into the parallel port. I really have no idea why they use 12v power on these boards but it is what it is I guess.
so yes the input signal is 12v but it is working just fine. I still have a 220 ohm resister in line with the LED and It hasnt burned out so I imagine it will be fine.
Im leaning toward noise as the problem. will get back to you guys tomorrow when I have a chance to put a capacitor on it to see if it quiets it down.
Chris
didnt win the O scope by the way. guess I will keep looking for one.
Title: Re: setting up a reflective object sensor for dummy's
Post by: Hood on February 03, 2008, 05:51:38 PM
Quite a few breakouts use 12V for power but the I/O is 5V, maybe your board is different I dont know. Anyway if you need to use 12V you may be better increasing the resistor to 500 Ohms.
Hood
Title: Re: setting up a reflective object sensor for dummy's
Post by: Chip on February 03, 2008, 05:56:31 PM
Hi, Hood

The 12 volt's is on the BoB input side, Printer port side opto isolated.

Hook your Skype back up and give me a call sometime.

Thanks, Chip
Title: Re: setting up a reflective object sensor for dummy's
Post by: guynamedbathgate on February 03, 2008, 06:06:48 PM
well I dont really think my board is anything special. perhaps I have it wired wrong but I dont see how I would end up with 5 volts if Im using a 12 v power supply to the switch. I will atach a drawing of how I have it wired up.
Chris
Title: Re: setting up a reflective object sensor for dummy's
Post by: Hood on February 03, 2008, 06:15:03 PM
No, seems OK, I didnt realise that Bobs breakout took 12V on the inputs, most just take 5V inputs.
Hood
Title: Re: setting up a reflective object sensor for dummy's
Post by: guynamedbathgate on February 04, 2008, 06:03:03 PM
ok, some success. I went out and got a capacitor and put it in between the signal wire and ground. turned it on and and I was getting the same jumbled mess of numbers all over the place but I notice that it wasnt so drastic as before. so I slowed the spindle way down and I started getting a semi stable reading from the tach. stable in that it held fairly steady around 200 rpm but about once a second it would flash a really high number and then return to the stable number. So I took the slotted disk off and widened the slot to about an inch wide and put it back on. now I was getting a fairly stable tach reading with the exception of the sporatic numbers every second or so up to 2000 rpm. which is about my max anyway. so I messed with the debounce and that did nothing. then I thought I might be getting extra pulses from the shiny edges of the aluminum wheel where I had cut it on the saw. so I masked them with electrical tape and that seemed to have a slight effect (or it could be in my head). so as It stands right now Im getting a reading that is in the ballpark but I'm either still getting a little noise or some stray light to the sensor perhaps.
anyone have any thoughts on how to tame this thing a little more. also how does one calibrate the tach. or am I just supposed to assume it is correct? and does anyone think that a slightly bigger cpacitor filter would help?
close but Im not celebrating yet.
Chris :-\
Title: Re: setting up a reflective object sensor for dummy's
Post by: guynamedbathgate on February 04, 2008, 08:22:27 PM
hmmmm went back down after dinner and it seems that most of my gains have evaporated without me doing anything. now its back all over the place. I just feel like Im getting noise somewhere but I just dont know why. even when I have the spindle at a dead stop Im still getting wacky tach readings so its gotta be picking up something right. Or is that just what it does for everybody when the spindle is off?
Chris
Title: Re: setting up a reflective object sensor for dummy's
Post by: guynamedbathgate on February 04, 2008, 08:58:13 PM
tried switching to a different input and Im back to where I was two posts ago. its almost readable but it still jumps around and it doesnt seem like its giving an entirely accurate reading but it is close. Im done for today though so hopefully Ill think of something while I sleep.
Title: Re: setting up a reflective object sensor for dummy's
Post by: Chip on February 04, 2008, 09:48:19 PM
Hi, Chris

Not sure what your Index De-bounce is set to, At this point it's time to Review/Get a fresh start,

In Config, General Configuration Page, Set the De-bounce interval and Index De-bounce to 1000 - 2000.

The 220 ohm resistor for the opto led may be to low (typically 220-330 ohm used for 5 volt setup) 500 ohm for 12 volt setup as Hood stated, Don't want to

burn out the light emitting diode

What opto device did you finally use hear, Jot a link to it ?

Have you shielded the opto from external light sources ?

Got a Big Hammer ?, Chip
Title: Re: setting up a reflective object sensor for dummy's
Post by: jimpinder on February 05, 2008, 03:54:09 AM
As far as debounce is concerned - if the spindle is rotating at 3000 rpm (which is above the speeds you mention) then the slot only comes round every 2/100 ths of a second - so to get rid of any spurious count - set the debounce at that - the switch only needs to be live as the slot is coming round again.

As far as noise is concerned - make sure your lead from the optics is shielded to stop it picking up noise from your driver boards and spindle driver if you have one.

You have chosen to go with a 12 volt system. This seems to me unescessarily complex, in that you are introducing additional chips and a voltage change for no reason, but all of which can contribute to delay. You could drive this lot from one of the 5 volt supplies, and feed the input signal direct to the computer, therefore cutting out a lot of ****

Paint your disc MATT black with a good quality paint, not with sticky tape - mine with the Fairchild sensor - is painted matt black - with a reflective piece of self adhesive mirror on - and works well.

You do not need a 1 inch gap in your disc. Your problem is not GETTING a reading, your problem is your are getting too many. A 1/8 or 1/16 slot will be enough - if you look at the rise time of your optical sensor. - work out at 3000 rpm how long the gap will be above the sensor. If it exceeds the rise time then you are OK.

In a simple system like this you will always get spurious readings. Mine occur near the bottom of the readings - say 100 rpm. Between that and full speed it seems to be fine.

Since I do not know what system you are then employing to drive the spindle, I cannot comment on the calibration - however if it is the PWM system put out by Mach3, calibration is relatively simple and fully automatic - but save the calibration then restart your computer. It seems to work better when it has digested the information.


Title: Re: setting up a reflective object sensor for dummy's
Post by: guynamedbathgate on February 05, 2008, 07:39:53 AM
Ok well glad to see everyone was thinking about this while I was sleeping.  first off this is the sensor I went with.
http://www.optekinc.com/pdf/OPB917.pdf
now as for the breakout board im using its the Bob Campbells combo board so it has the Digital to analog converter built in to the board to drive the spindle motor. Im using a 3hp DC motor with a KB Motor controler.
I put a 500 Ohlm resister onthe emitter yesterday as well when I was messing with it so that has already been changed. I will play with the debounce a little more today. I did happen to pick up a dual trace O scope off ebay for $60 last night and it will hopefully arrive by weeks end. then maybe we can get somewhere once I figure out how to use it.
anyhow I understand that I will always get a small amount of spurious readings, but right now im getting more of them than the real reading so  I continue on.
I did shield the sensor from outside light and the cables are fully shielded too. I will try painting the slotted disk.
Is the inch wide slot now too big? do i need to make a new one? man that would suck.
Chris
Oh yeah what would I set the debounce to in order to make it 2/100ths of a second?
Title: Re: setting up a reflective object sensor for dummy's
Post by: jimpinder on February 05, 2008, 07:57:27 AM
If my maths is right, each debounce is 40 usec, so 500 would give you 2/100 of a sec. Anybody confirm that, I only did it on the back of an envelope.

Seeing you are trying a load of things, I would leave the slot as it is for the time being. The debounce will nullify it anyway.

Next thing for you to try - I am just fitting a laser with some sensors on my table to get more accurate positioning - I don't know how well that will work. Always something to keep you busy!!!

Jim
Title: Re: setting up a reflective object sensor for dummy's
Post by: Overloaded on February 05, 2008, 08:23:04 AM
Hi Chris,
Reflection should not be a problem now that you are using a "through beam" sensor.
What is the "actual " part # on yours ?
It sounds to me like the signal is floating and requires a 10k ohm pull up resistor.
That would explain it reading a goofy rpm while the spindle is stationary.
I'm guessing, I've seen this before with microcontrollers.
Good luck
RC
Title: Re: setting up a reflective object sensor for dummy's
Post by: guynamedbathgate on February 05, 2008, 01:25:26 PM
Im using the OPB917B

this is the correct PDF
http://www.farnell.com/datasheets/81057.pdf

It does seem to call for a 10k pull up resistor. If i understand it right I would put the resistor between the white and blue wires coming off the switch?
Title: Re: setting up a reflective object sensor for dummy's
Post by: Chip on February 05, 2008, 01:43:43 PM
Hi, Chris

Yes the actual Part # is needed, As far as the pull-up resistor I was off on that value a bit, With the data sheet a !0K ohm's if it's a OPB917BZ or

OPB9167OCZ.

While the switch only needs a short/narrow window to change state/on-off, Mach needs more time to see the state of change, Your slot width is fine.

The Index Deb-ounce is there mostly for mechanical switches, Thy tend to bounce a little and gives Mach time to see a steady/Relible state on the Input pin

Hi or Low.

Yes, White & Blue

Thanks, Chip
Title: Re: setting up a reflective object sensor for dummy's
Post by: Overloaded on February 05, 2008, 02:11:47 PM
There may be some confusion here.
The first resistors mentioned by Chip and Hood are for "current limiting" and are most likely the proper value.
A "pull-up/dn" resistor serves a totally different purpose and is used to positively pull the signal high or low to eliminate any "floating" voltage.
You may need both.
RC

Title: Re: setting up a reflective object sensor for dummy's
Post by: guynamedbathgate on February 05, 2008, 02:41:30 PM
alright I put a pull up resistor as was discussed (between blue and white wires). and it got a little better.
where would I put a pull down resistor.( between blue and green?)
I removed the .1 uf capcitor and everything is still the same so I guess that wasnt helping things.
heh and they say it takes a village to raise a child, what about teaching a rooky to hook up a tach? ;)
Chris
Title: Re: setting up a reflective object sensor for dummy's
Post by: Hood on February 05, 2008, 03:17:18 PM
I am certainly no expert with electroncs but I thought the 10K was integral to the Opto switch and that is why it was suitable for this use.
Hood
Title: Re: setting up a reflective object sensor for dummy's
Post by: guynamedbathgate on February 05, 2008, 03:21:02 PM
umm? not really sure what you mean.
Title: Re: setting up a reflective object sensor for dummy's
Post by: Hood on February 05, 2008, 03:24:35 PM
Well the way I thought was that opto had the 10K pull up inside it so there was no need to add one. As I said I am clueless when it comes to electronics (and most other things ;) ) so I could well be wrong.
Hood
Title: Re: setting up a reflective object sensor for dummy's
Post by: guynamedbathgate on February 05, 2008, 03:27:23 PM
ahh well It isnt working either way so I dont see how it matters for me at the moment. any chance that the 12 volts circuit is the problem. would I need a different sized pull/down resistor?
Title: Re: setting up a reflective object sensor for dummy's
Post by: Hood on February 05, 2008, 03:30:07 PM
Is there any way you can connect with 5v and put it through a different input on your breakout? Does your breakout have any 5v inputs?
Another option would be to connect it direct to the parallel port but this would mean either using a second port or hacking into your cable to gain access to the wire for that pin. BTW if you do connect direct make sure you only have 5V.
Hood
Title: Re: setting up a reflective object sensor for dummy's
Post by: guynamedbathgate on February 05, 2008, 03:42:23 PM
well there was the suggestion somebody had about using a 5V regulator to drop the voltage. not sure if the input would still be able to see it if it was set up for 12v? I am really in uncharted waters here.
Im also not really thrilled about the idea if hacking apart my cable to get at the pin.
I guess as a last resort I could add a second parallel port just for the tach but that would seem to me to be a waste.
Title: Re: setting up a reflective object sensor for dummy's
Post by: Overloaded on February 05, 2008, 03:47:46 PM
Hood, I wasn't sure if the pullup was in the unit or not. I just thought that by adding one we would be sure that there was nothing floating.

Chris, you either use a pullup to pull the signal high or a pulldown to pull it low.... not both.
In an "active low" circuit, a pull "up" is used.
In an "active  high" circuit, a pull "down" is used.
I hope I'm not complicating matters here, just trying to help.
RC
Title: Re: setting up a reflective object sensor for dummy's
Post by: guynamedbathgate on February 05, 2008, 03:51:46 PM
here is the pdf for the break out board.
http://campbelldesigns.net/files/Combo-board-Mach3m-rev2.pdf
Chris
Title: Re: setting up a reflective object sensor for dummy's
Post by: guynamedbathgate on February 05, 2008, 03:52:43 PM
complicating, No. Either way, Im learning alot.
Chris
Title: Re: setting up a reflective object sensor for dummy's
Post by: Chip on February 05, 2008, 04:01:49 PM
Hi, Hood

I think your correct, The pull-up resistor is internal on this one.

Never had this mush trouble hooking up an opto switch.

Have always hooked them up direct to the port.

Chip
Title: Re: setting up a reflective object sensor for dummy's
Post by: Overloaded on February 05, 2008, 04:28:43 PM
Chip,
I overlooked this earlier.

You are right.....this is getting bazzar.  :-\
Title: Re: setting up a reflective object sensor for dummy's
Post by: guynamedbathgate on February 05, 2008, 05:01:44 PM
hmm just a shot but I did happen to buy 2 switches. perhaps there is a manufacturing flaw with the switch. I can try and wire up the other one later tonight.
guess Im just running out of things to try.
Chris
Title: Re: setting up a reflective object sensor for dummy's
Post by: guynamedbathgate on February 05, 2008, 07:30:05 PM
I decided to email Bob, over at Campbelldesigns to see what he had to say. He said he is going to ask Jim Cullins who designed the board to see if they can come up with a solution.
Fingers crossed. :-\
Title: Re: setting up a reflective object sensor for dummy's
Post by: guynamedbathgate on February 05, 2008, 09:24:29 PM
ok this is the reply I got from Bob. can someone help me to decifer this a little.

"Connect to J14 here is the pin out
1       +5v
2.      A
3.      B
4.     
5.      GND
 
They are labled on the board
It located near the power in screw terminal.
 
Connect either the A or the B with the open collector out of the interruptor.
These  pins go to pins 15, 13 on the parallel port so view on the diag screen to see what
you are on TO test it short pin  2 to 5 or 3 to 5.
I would use the one on pin 15. Make sure to set mach index to the pin you use, active low"

Im not really sure of everything he is refering to here.
Chris
 
Title: Re: setting up a reflective object sensor for dummy's
Post by: guynamedbathgate on February 05, 2008, 09:30:43 PM
oh never mind I see there is another screw terminal on the board that I was unaware of its use. They must bypass the optos or something. Well I will mess with this tomorrow and get back to you guys.
Title: Re: setting up a reflective object sensor for dummy's
Post by: Chip on February 05, 2008, 10:16:57 PM
Hi, Chris

Looks like there describing hooking up an A B encoder, What was the Question you ask them.

Chip
Title: Re: setting up a reflective object sensor for dummy's
Post by: Overloaded on February 05, 2008, 10:42:59 PM
That doesn't look like J14.
Looks more like J20 which is for a MPG and axis selector switch.
Appears that you use the 5v, ground and input from the photo switch and assign it to the "index" in Mach.
Title: Re: setting up a reflective object sensor for dummy's
Post by: Chip on February 05, 2008, 11:00:20 PM
Hi, Chris

In the brake-out board manual thy talk about npn & pnp sensors.

NPN Inductive Proximity Sensor

NOTE: The break-out board was designed to use either NPN inductive proximity sensors.

A PNP inductive proximity sensor can be made to work by placing a 1K resistor across the signal and ground screw terminals.

Might try this, Chip

RC, I agree with your comment above
Title: Re: setting up a reflective object sensor for dummy's
Post by: Overloaded on February 06, 2008, 12:09:50 AM
Chip, looks to me like everything is right there at J20.
Reply#84 makes perfect sense except that J14 is a 3 terminal block for a limit/home sensor and the pinout doesn't match the pdf.
You've got the 5v , gnd and input to either 13 or 15. Just use 1 channel and set it to the spindle index.
Read #84 closely, it makes sense to me. Shouldn't need any resistors.
RC
Title: Re: setting up a reflective object sensor for dummy's
Post by: guynamedbathgate on February 06, 2008, 08:48:55 AM
And the moment we have all been waiting for.  "IT WORKS". so I guess that terminal is used for an encoder of some kind. but regardless it must go directly to pin 15 without going through all the opto's. The discrepancy with the PDF is that there are 2 different versions of the board so if you look at the older pdf it doesn't match up to the newer board. Perhaps I should have asked Bob sooner. I guess It's something to keep in your back pocket for any future rookies who come through here with the same problem. Thanks for all your help. This has been a learning experience for all. But, Im sure Ill have another problem soon enough.  ;D
Chris
Title: Re: setting up a reflective object sensor for dummy's
Post by: guynamedbathgate on February 06, 2008, 09:16:05 AM
Here is what Jim Cullins said about why it wasn't working for all who are interested.

"the board  has a signal condition circuit.  The ourt put is connected directly to the port pin on opto isolatiion. You don't need isloation as the circuit is never connected to any other external circuit just be careful how you route the wiring, keep away from high noise wiring like the motor wires, or use a shielded cable. The opto isolators on the board are too slow to pass the signal they are designed to filter noise on the limit/home inputs."

Chris
Title: Re: setting up a reflective object sensor for dummy's
Post by: Hood on February 06, 2008, 11:21:16 AM
Thats great news :)
Maybe it would be a good idea for Bob/Jim to say that in theior manual?
Hood
Title: Re: setting up a reflective object sensor for dummy's
Post by: Chip on February 06, 2008, 02:54:11 PM
Hi, Chris

Glad you got it working.

Just make sure the input is not more than 5 volts to the port.

Thanks, Chip
Title: Re: setting up a reflective object sensor for dummy's
Post by: jimpinder on February 08, 2008, 11:59:05 AM
Have we finally got this working ???
Title: Re: setting up a reflective object sensor for dummy's
Post by: keithmech on February 12, 2008, 11:55:38 PM
Did you resolve this by using J20? Can you explain what you did as I,m sure
this might be what I am experiencing with my machine.My actual speed DRO
is going crazy .I have a bob campbell  board and a cnc4pc index pulse card.
My disk is about 3.5" and my slot is 1/2 in width.All my wires are sheilded.
The output on the scope shows a nice pulse right up to 3600 rpm , max speed.
Title: Re: setting up a reflective object sensor for dummy's
Post by: Chip on February 13, 2008, 02:33:28 AM
Hi, Glen

Yes, He got it working, This is the topic i was talking about on your original post.

Chip
Title: Re: setting up a reflective object sensor for dummy's
Post by: jimpinder on February 13, 2008, 03:51:36 AM
keithmech

I think the long and the short of this was that the various opto-isolation bits and pieces on the breakout board were destroying the signal from the speed sensor.

As I said fairly early on in this post, the signal from your speed sensor - providing it is NOT above 5 volts - and if you have a scope, you can check this - should be fed DIRECTLY back to your computer via one of the input pins. Mine is and works perfectly - but then I don't have this fancy Campbell break out board, all my signals go directly back to the computer.

Jim
Title: Re: setting up a reflective object sensor for dummy's
Post by: TetraLite on September 19, 2008, 09:11:52 PM
I know this is a slightly old thread, but I just wanted to mention a problem I had when I set up my spindle index. This was a fresh and clean Mach3 install and I used a typical optical interrupter switch (LED and phototransistor in slotted package - Fairchild H21A1 available from Digikey) and disc on my lathe spindle. When I first tried it out I would get good readings from very low rpm to around 1000rpm and then, while still increasing the spindle speed the rpm reading in Mach would suddenly drop by roughly (very roughly) one half. I eventually found the problem and it was this: The default debouce setting for the index pulse input in Mach (in General Configuration) was set to a rather large number (it was in hundreds) and this setting is multiplied by 40uS, so I set it down to 2 (making it 80uS) and the rpm readings are now true for my full range of up to about 2800 rpm.