Limit Switches

AtomSoft
Posts: 589
Joined: Mon Apr 09, 2012 9:15 pm
Location: Brooklyn NY
Contact:

Limit Switches

Post by AtomSoft » Sat Jun 23, 2012 1:15 am

Check it out... i only put X & Y... Ill add Z soon... maybe tomorrow :)



Just went to radioshack for some push buttons and drilled a 1/4" Hole then filed it down a little and installed the switches.
Blog / Store
Live to Love, Not to Hate.
You're not a failure because you don't make it, you're a success because you tried.
Do you like the help i give? Think i deserve a tip? DONATE

edwardrford
Posts: 1250
Joined: Mon Apr 09, 2012 5:40 pm
Location: Dixon, IL
Contact:

Re: Limit Switches

Post by edwardrford » Sat Jun 23, 2012 2:09 am

Good going. I love that solution. I remember @bxd did the same thing with his back in March, but never saw a video of it in action.
Shapeoko 1 #0 - a couple of upgrades.
Shapeoko 2 #0 - a couple of upgrades.
Shapeoko 3 #2 - Stock

potatotron
Posts: 135
Joined: Sun Apr 29, 2012 12:47 am
Location: Southern California
Contact:

Re: Limit Switches

Post by potatotron » Sat Jun 23, 2012 2:23 am

This is great. I've been going over layouts for limit switches for the last few days and your plan is much less complicated than anything I've come up with.

I still have to connect the motors to the electronics so that's my main goal this weekend, but as soon as I'm done with that I'm going to copy your switch idea.

Thanks!

AtomSoft
Posts: 589
Joined: Mon Apr 09, 2012 9:15 pm
Location: Brooklyn NY
Contact:

Re: Limit Switches

Post by AtomSoft » Sat Jun 23, 2012 2:28 am

Thanks Edward and Potatoron :) i tried to make it as simple as possible :)
Blog / Store
Live to Love, Not to Hate.
You're not a failure because you don't make it, you're a success because you tried.
Do you like the help i give? Think i deserve a tip? DONATE

Max Metz
Posts: 240
Joined: Sun May 20, 2012 11:55 am

Re: Limit Switches

Post by Max Metz » Sat Jun 23, 2012 1:52 pm

Good stuff Atom! :D

AtomSoft
Posts: 589
Joined: Mon Apr 09, 2012 9:15 pm
Location: Brooklyn NY
Contact:

Re: Limit Switches

Post by AtomSoft » Sat Jun 23, 2012 2:00 pm

Thanks, i should call these Homing Switches instead. Ill get 4 more switches today and do the Limit Portion and Z homing portion :)
Blog / Store
Live to Love, Not to Hate.
You're not a failure because you don't make it, you're a success because you tried.
Do you like the help i give? Think i deserve a tip? DONATE

Tom Smith
Posts: 297
Joined: Mon Apr 09, 2012 9:55 pm
Location: North Vancouver, British Columbia

Re: Limit Switches

Post by Tom Smith » Sat Jun 23, 2012 2:28 pm

That ooks like a nice elegant implementation. How will you wire these? Are they connected directly to the arduino, or are they acting as interrupts to stop the motors?

Tom
_______________
ShapeOko1 191

AtomSoft
Posts: 589
Joined: Mon Apr 09, 2012 9:15 pm
Location: Brooklyn NY
Contact:

Re: Limit Switches

Post by AtomSoft » Sat Jun 23, 2012 2:38 pm

They are connected to Arduino

Analog Pins 0,1,2

They are pulled high with a 1k and Connect to GND when pressed.
Attachments
buttons.jpg
buttons.jpg (13.57 KiB) Viewed 10577 times
Blog / Store
Live to Love, Not to Hate.
You're not a failure because you don't make it, you're a success because you tried.
Do you like the help i give? Think i deserve a tip? DONATE

vios
Posts: 46
Joined: Sun Apr 22, 2012 12:00 pm

Re: Limit Switches

Post by vios » Sat Jun 23, 2012 5:42 pm

AtomSoft,

Is it correct to connect the limit switch to the Arduino analog pin 0,1 and 2.
Is it stated in the wiki.

Thanks in advance.

AtomSoft
Posts: 589
Joined: Mon Apr 09, 2012 9:15 pm
Location: Brooklyn NY
Contact:

Re: Limit Switches

Post by AtomSoft » Sat Jun 23, 2012 5:57 pm

Well im not sure on the wiki... maybe you can point it out to me?

Im a huge micro controller fan and have experience in most MCUs like, ARM(ST, NXP, ATMEL), AVR, PIC (10F-24F) and many more... So with this experience it was easy to edit the GRBL config...

I altered original config Limit data to :

Code: Select all

#define LIMIT_DDR      DDRC
#define LIMIT_PIN     PINC
#define X_LIMIT_BIT          1
#define Y_LIMIT_BIT          0
#define Z_LIMIT_BIT          2
DDRC is the ANALOG PORT (Tells the code what register controls whether this is a INPUT or OUTPUT pin)
PINC is the ANALOG PORT (READ & WRITE register for the pins on that port.)

X_LIMIT_BIT, Y_LIMIT_BIT, Z_LIMIT_BIT are the BITS or PIN number .

The internal code does the rest. GRBL controlls the Direction Register by saying X,Y,Z LIMIT BITS are all input. Then it reads the current state of the pins... Hence why i used a PULLUP Resistor. This will tell the controller that the PINs are all HIGH... so it knows the default state is high. Next the controller checks each pin to tell if it changed (button pressed send a LOW signal... hence button to GND)

When its changed it knows to stop moving that motor and continue on the rest. When all are dont it stops everything and sets the internal X,Y,Z locations to 0,0,0 so it knows its home...

Hope that helps a little? or was it overkill ?
Blog / Store
Live to Love, Not to Hate.
You're not a failure because you don't make it, you're a success because you tried.
Do you like the help i give? Think i deserve a tip? DONATE

Post Reply