Augmented Reality JoyStick Part 2
Limit switches are very important for machine safety and longevity. The switches prevent the machine from moving past its mechanical limits. When the machine reaches the limit, the switch sends a message to the motion control system to disable the motor. This is especially critical when the stage is moving at high speeds. Without the switches, parts can fly off the machine and potentially injuring the operator. This project uses the Omron ee-sx671 which is an optical switch.
The Basic Circuit
The switch is just like any switch. The switch is connected to digital input on the Dynomotion Snap Amp with a pull up resistor. Here is a simplified version of switch.
The EE-SX671 is an optical limit switch
The ee-sx671 is an optical switch. The sensor operates by sending a beam of light between the slot. One side is the emitter the other is the receiver. When the light is blocked between the emitter and receiver the switch changes state. The advantage of an optical it is immune to electrical noise. The disadvantage is it is affected by external light.
Know the configuration of your switch PNP or NPN
Since the part number is EE-SX671 and there is no P or R after the number. The part is NPN. Its very important to know the difference. If the part is hooked up wrong it could damage the part.
Here is the PNP configure. We are not going to use it. We will keep this for future reference.
Some of the specifications of the switch
The important information to know is the voltage and the maximum current it can handle. The switch will operate from 5 to 24 VDC, and can handle 35 ma max.
Connecting the switch to the Snap Amp
The following circuit is the DIO signal to the Snap Amp. We connect the 5 volts of the switch to OPTO_PLUS signal. The 470 ohm resistor the switch will draw 10 ma. The current is well under the 35 ma limit.
Next we connect the OPTO_NEG signal to the OUT signal of the switch.
Each axis requires 2 switches; one for the min and one for max position. We only need one 5 Volt power supply for all of the limit switches.
The limit switches are connected to;
Axis |
Signal on Switch |
Signal on Snap Amp |
PIN | Bit (SnapAmp #0) |
X min | + 5V | OPTO_PLUS_0 | 32 | 72 |
OUT | OPTO_NEG_0 | 31 | ||
X max | + 5V | OPTO_PLUS_1 | 34 | 73 |
OUT | OPTO_NEG_1 | 33 | ||
Y min | + 5V | OPTO_PLUS_2 | 36 | 74 |
OUT | OPTO_NEG_2 | 35 | ||
Y max | + 5V | OPTO_PLUS_3 | 38 | 75 |
OUT | OPTO_NEG_3 | 37 | ||
Z min | + 5V | OPTO_PLUS_4 | 36 | 76 |
OUT | OPTO_NEG_4 | 35 | ||
Z max | + 5V | OPTO_PLUS_5 | 38 | 77 |
OUT | OPTO_NEG_5 |
37 |
Defining the Limit Switches in the KFLOP.
How do you use the information in the KFLOP. You came to the right place.
Step 1: Run KMotion.exe and Load the C Program for your setup.
You should see something like this dialog.
Step 2: Open the “Config & Flash”
This is where you set the limit switch parameters.
Step 3:
Open the “Digital IO” dialog for the Snap Amp. Make sure you connect the 5 volts to your limit switches. You should see the following dialog.
Place a piece of paper between the slot of the limit switch. You will see the state change in the check box from UNCHECKED to CHECKED. Initially, I was not sure if the “Unchecked” state was HIGH or LOW. The “Unchecked” state is low. You might want to verify this yourself.
The C program I am using seems to work. The KFLOP definitely stopped motion when I moved into the limits.
Best of Luck setting the limit switches. Don’t forget to export the settings and save your program.