587,704 active members*
3,669 visitors online*
Register for free
Login
IndustryArena Forum > CNC Electronics > Gecko Drives > G540 and Mach 3 Spindle Index input not working
Results 1 to 19 of 19
  1. #1
    Join Date
    May 2013
    Posts
    455

    G540 and Mach 3 Spindle Index input not working

    Hey everyone,

    I am trying to get my spindle index working on my G0602 converted lathe.

    I have an optical digital switch that goes to 4.9v when it reads light, and 0v (actually reads 300mv) when it reads dark.

    I have the output of my switch going to Pin 1 on the G540, which is Pin 10 on the DB25.

    I have the ground powering my switch also connecting to the G540 Supply GND Pin 12.

    In Mach 3 I have my input for my index set to Port 1, Pin 10.

    I have confirmed with a multimeter that the pins on the G540 are receiving the desired voltages from my switch.

    Even when I turn by hand and go very slow, my index light in mach3 never lights up, saying that Mach3 is not receiving the signal from G540.

    Can anyone offer any suggestions?

  2. #2
    Join Date
    Jan 2013
    Posts
    119
    ARVnj


    You need to sink the signal from pin 1 of the G540.


    Mike

  3. #3
    Join Date
    May 2013
    Posts
    455
    Mike, thanks much for your reply.

    I am new to this stuff and I apologize but I don't know what you mean by sink the signal from pin 1 of the G540, would you be able to expand upon that?

  4. #4
    Join Date
    Jan 2013
    Posts
    119
    ARVnj


    Switching Pin 1 of the 540 to pin 12 is the trigger

    Look in the G540 manual

    Post Part number of the device that you are using.
    I think that where're going to find out that the input is rated at 1.7volt.
    This means that a current limiting resistor is needed.

    Mike

  5. #5
    Join Date
    May 2013
    Posts
    455
    Mike, thanks.

    I did read the G540 manual, but that was not clear to me.

    I am not using a specific part, what I am doing is taking an infared emitter, detector and detecting a white line instead of a black line.

    I am feeding the detector which is an analog signal into an ardunio, and reading the values.

    When I read the value that signals white, I set a digital pin to high, when I read black, I set the same digital pin to low.

    I than am taking the output of the digital pin and putting that in pin 1 of my G540, and ground from my arduino and putting that in pin 12, supply GND of the G540.

    My thought was the toggling of ~5v would trigger the index.

  6. #6
    Join Date
    Mar 2007
    Posts
    2083
    Hi AVRnj

    the ideal output from your index trigger will be an NPN open collector output that can only sink current to ground

    the G540 input terminal is connected to the cathode of a opto-isolator's LED
    the anode is connected , via a 2K2 resistor , to a +12V supply thats controlled by the G540's E-stop / fault detector circuit

    Attachment 221942


    a simple mechanical limit switch grounds the input when closed
    when the switch is open the input will be close to +12v


    with an electronic switch that switches between 0V and +5v

    you may find with the G540 input at +5V
    enough current will flow through the opto-isolator's LED for the photo transistor to be switched on !

    so the logic level seen by the the printer port input pin is always LOW !

    a simple fix to try is to use a NPN transistor and 10K to interface your indexer to the G540


    John

  7. #7
    Join Date
    May 2013
    Posts
    455
    John,

    Thanks, As you wrote this I was actually working on a switch with a 2N2222 transistor. I have it working on a breadboard.

    Thanks.

  8. #8
    Join Date
    Jan 2013
    Posts
    119
    ARVnj

    Looks like your going in the right direction.
    Be sure to post results when you actually have it working.

    Mike

  9. #9
    Join Date
    May 2013
    Posts
    455
    My hall effect switches came in the mail, and I built a circuit.

    Basically what I am doing is taking the output from the hall switch and going into a NPN transistor through a 10k resistor. The collector goes to the ground of the G540 which connects to pin 12, and the emitter is going to pin 1 (10) as an input on the G540, and I am using a 12V power supply to power the circuit and connecting ground to the G540 ground as well.

    I breadboarded the circuit and it was working as expected yesterday. As I moved the magnet past it, the index light in diagnosis toggled. As quickly or slowly as I moved the magnet past it, it seemed to respond.

    I than soldered the actual circuit today, hooked it up and not working. I spent two hours troubleshooting it with a multimeter, and it seems that my 10K resistor is not working properly. Ironically I tested the resistor before soldering, and it was working fine, so something happened to it while soldering. I can see that at the connection from the start of the resistor from my output of my hall switch, I am getting about 6V, when switched on at the other end of the resistor, I am getting nothing at all. When I use the ohmmeter function of the mulitmeter, I am getting no reading at all on that 10k resistor.

    So hopefully that is the problem, but I ran out of time to replace the resistor. I hope to be able to do that tomorrow morning and HOPEFULLY this thing will work.

  10. #10
    Join Date
    Jan 2013
    Posts
    119
    Basically what I am doing is taking the output from the hall switch and going into a NPN transistor through a 10k resistor. The collector goes to the ground of the G540 which connects to pin 12, and the emitter is going to pin 1 (10) as an input on the G540, and I am using a 12V power supply to power the circuit and connecting ground to the G540 ground as well.
    You have the emitter and collector connections are reversed.
    You appear to have a floating ttl signal also.
    Why are you using 12v to power this?


    Post schematic with all the devices' part numbers.



    Mike

  11. #11
    Join Date
    May 2013
    Posts
    455
    Quote Originally Posted by Mzones View Post
    You have the emitter and collector connections are reversed.
    You appear to have a floating ttl signal also.
    Why are you using 12v to power this?


    Post schematic with all the devices' part numbers.



    Mike
    Mike,

    Interesting, I will give it a shot and see if that does the trick. I could have sworn that this is the same way I set it up on my breadboard, but perhaps I accidentally made a good mistake I always thought that we want to pull the input pin to ground, so I thought the collector should take the G540 ground input, and pull that to the input pin, and I thought with a transistor current flows from collector to emitter.

    I am not sure what you mean by a floating ttl signal, I am not an electronics guy .

    12V just because the schematic I started with which used a push button and a 2N2222 transistor (which I had on hand) was using 12V.

    In your opinion, what should I use volts wise?

    I can draw up a schematic a bit later and post it.

    Thanks for your feedback, much appreciated!

  12. #12
    Join Date
    May 2013
    Posts
    455
    OK, Here is my schematic.

    Please excuse the amateur schematic I did in Eagle, I am not very good at this.

    I swapped the emitter and collector as you mentioned. I am now getting the index light to blink when I run a magnet across my hall sensor.

    However, it seems somewhat inconsistent, at times it seems to work perfectly, at times it does not seem to work at all.

    I am wondering if it is the floating ttl you mention?

    Or possibly I have a weak connection for my hall sensor. I am using 22 gauge wire for my hall sensor, and 20 for all else.

    Thanks for the help.Attachment 222520

  13. #13
    Join Date
    Jan 2013
    Posts
    119
    Install a pull down resistor from the base of the 2n2222 to ground
    This keeps the 2n2222 from turning on when no high signal is coming from the hall sensor.
    The 2n2222 is very sensitive .

    Also note that the hall sensor you have is a latching type.
    The magnetic field you use needs to match that particular type of hall sensor.

    12 v is really over kill but 5 v is more than adequate , Use which is most convenient
    Calculate resistor values to whatever voltage you use.
    .
    Or possibly I have a weak connection for my hall sensor. I am using 22 gauge wire for my hall sensor, and 20 for all else.
    No I don't believe that this is a factor.

    Take a closer look at the properties of the magnetic field.

    The orientation of the magnet as it passes by the hall sensor
    could explain a lot here.


    Mike
    .

  14. #14
    Join Date
    May 2013
    Posts
    455
    Mike, thanks a lot.

    yes, I did notice that this requires a south pole to set high and when passing a magnet by my hall I was making sure to keep the orientation consistent.

    I will give the pull down a shot. As a side note, I changed my source to a 4.5v source and it seemed to operate the same.

    Could you recommend a pull down resistor value? I suspect it would depend on my source Volts?

    I can use either 4.5, 6 or 12.

    Thanks much for your assistance.

  15. #15
    Join Date
    Mar 2007
    Posts
    2083
    Hi

    using a 12V supply to power the hall switch

    you should be able to connect the SS460P to the G540 input

    Attachment 222582

    John

  16. #16
    Join Date
    May 2013
    Posts
    455
    Quote Originally Posted by john_100 View Post
    Hi

    using a 12V supply to power the hall switch

    you should be able to connect the SS460P to the G540 input

    Attachment 222582

    John
    John, Really?

    Now I am really confused.

    I thought that the only way to do this was to connect the input pin with ground?

    At a voltage threshold you can just toggle the input pin high and low on the G540?

    I don't know if I am missing something, but I don't see that on the G540 documentation.

    Thanks!

  17. #17
    Join Date
    Mar 2007
    Posts
    2083
    yes !


    from the manual

    Attachment 222602

    the limit switch needs to either ground the input to the G540 terminal 12 ( ground & negative supply)

    or leave the input open circuit

    this is exactly what the current sinking output of the SS640 ( or SS441) can do

    Click image for larger version. 

Name:	SS460P hall switchwith current SINK output 2.jpg 
Views:	1 
Size:	48.7 KB 
ID:	222598

    the SS640 data sheet does not indicate if the current sinking device is a NPN transistor or a N channel FET
    the only thing stated it can sink 20 mA

    the G540 only needs the switch to sink about 4.5 mA

    Attachment 222604

    John
    Attached Thumbnails Attached Thumbnails G540 and SS460P.jpg  

  18. #18
    Join Date
    May 2013
    Posts
    455
    OK, thanks!

    I confirmed that i can trigger the index light in diag mode by going direct as John mentions.

    Thanks!

    Definitely makes for a much easier circuit.

    The bad news is no matter how I do this, either 12V high/Low or sink Supply Gnd from the 540 to an input pin, I am getting very odd results. It will work great for a few seconds, and then just flat out stop working. I am using a neodymium magnet, and paying very close attention to the polarity that works and sticking with it.

    No matter what I do, I just cannot get consistent results. very frustrating.

    The PC I am using is very, very old, bare minimum Mach3 requirements.

    Could that be contributing to this?

    I also tried changing debounce settings, and switching out for another hall, same part, just a different one that I had to see if the hall itself was bad, same results.

  19. #19
    Join Date
    Jan 2013
    Posts
    119
    ARVnj

    You might find this useful.







    Attachment 222750ARVnj


    Mike

Similar Threads

  1. Spindle Index Input Erratic.
    By Katoh in forum CNC Machine Related Electronics
    Replies: 0
    Last Post: 01-25-2013, 02:48 PM
  2. Cheap and easy spindle index sensor for G540 and Mach 3
    By grizzlymog in forum Gecko Drives
    Replies: 16
    Last Post: 06-10-2012, 01:16 AM
  3. Replies: 3
    Last Post: 11-03-2011, 02:25 AM
  4. G540 input 1 not working !
    By Action-KAT in forum Gecko Drives
    Replies: 0
    Last Post: 05-12-2011, 07:08 PM
  5. G540 input not working?
    By stoneyreef in forum Gecko Drives
    Replies: 1
    Last Post: 05-08-2009, 07:52 AM

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •