Micro Switch triggering stepper motors

For Adafruit customers who seek help with microcontrollers

Moderators: adafruit_support_bill, adafruit

Please be positive and constructive with your questions and comments.
User avatar
jbc
 
Posts: 159
Joined: Wed Aug 14, 2013 7:18 pm

Micro Switch triggering stepper motors

Post by jbc »

Is it possible to connect 17+ micro switches http://www.adafruit.com/products/819 to the Adafruit motor shield http://www.adafruit.com/products/1438 ?

I will have 17 or more micro switches in my project that when triggered will start a specific stepper motor's rotation.
I was hoping I could solder them onto the Adafruit motor shield or connect them somehow to the Arduino Uno, the motor shield is on top of.

User avatar
adafruit_support_bill
 
Posts: 88093
Joined: Sat Feb 07, 2009 10:11 am

Re: Micro Switch triggering stepper motors

Post by adafruit_support_bill »

The problem is going to be a shortage of pins on the Uno. You need 2 (A4 & A5) pins to control the motor shield and it's a good idea to keep pins 0 & 1 free for programming & debugging. That leaves 12 digital pins and 4 analog pins - or 16 total.

You could go to a Mega which has many more pins (54 digital, 16 analog). Or you could wire in a port expander: http://www.adafruit.com/products/732

User avatar
jbc
 
Posts: 159
Joined: Wed Aug 14, 2013 7:18 pm

Re: Micro Switch triggering stepper motors

Post by jbc »

The mega it is.
I got the mega with the Uno from Adafruit when I got your motor shields so I like solution.
The Uno will have all of the motor shields stacked on top.

I planned on using the Mega to handle other features so now it will also handle the sensors.
I am guessing the sketch I upload to the Mega will be looking for input from just one of the wires.

Do you have any links or tutorials that will help me hook up the switch and a link for the code which will wait for input from this 'three wire switch' ?

User avatar
adafruit_support_bill
 
Posts: 88093
Joined: Sat Feb 07, 2009 10:11 am

Re: Micro Switch triggering stepper motors

Post by adafruit_support_bill »

Lesson 6 explains how to connect and program switches to digital inputs: http://learn.adafruit.com/adafruit-ardu ... s/overview

User avatar
jbc
 
Posts: 159
Joined: Wed Aug 14, 2013 7:18 pm

Re: Micro Switch triggering stepper motors

Post by jbc »

You are the reason why I shop at Adafruit.

User avatar
jbc
 
Posts: 159
Joined: Wed Aug 14, 2013 7:18 pm

Re: Micro Switch triggering stepper motors

Post by jbc »

Ready for a facepalm?
Do I really need a breadboard?

User avatar
adafruit_support_bill
 
Posts: 88093
Joined: Sat Feb 07, 2009 10:11 am

Re: Micro Switch triggering stepper motors

Post by adafruit_support_bill »

Do I really need a breadboard?
Breadboards are real handy for prototyping. For a more permanent installation I usually solder things to a proto-shield. There is one for the mega here: http://www.adafruit.com/products/192

User avatar
jbc
 
Posts: 159
Joined: Wed Aug 14, 2013 7:18 pm

Re: Micro Switch triggering stepper motors

Post by jbc »

Perfect.
I now have that on order.

Thank you.

User avatar
jbc
 
Posts: 159
Joined: Wed Aug 14, 2013 7:18 pm

Re: Micro Switch triggering stepper motors

Post by jbc »

Is it possible to combine my two orders together to save some shipping costs?
I placed the orders separately through PayPal.

User avatar
adafruit_support_bill
 
Posts: 88093
Joined: Sat Feb 07, 2009 10:11 am

Re: Micro Switch triggering stepper motors

Post by adafruit_support_bill »

Unfortunately, no.

User avatar
jbc
 
Posts: 159
Joined: Wed Aug 14, 2013 7:18 pm

Re: Micro Switch triggering stepper motors

Post by jbc »

I'm embarrassed to ask but I can't find what I am looking for and I don't want to fry anything else.
Earlier I mentioned the need to connect 17 micro switches to my project.

Right now I would like to connect four micro switches to either:
1) Adrduino Uno (it has 10 adafruit motor shields stacked on top (motor shield V2)
2) the top motor shield (does not have stacking headers on it so those pins are soldered and sealed.
3) toss that soldered and sealed motor shield and attach the micro switches to available pins a stacking header attaches too.

The example bill linked in the earlier example showed a breadboard being used.
But..Who has two thumbs and wants to connect FOUR micro switches to one board and is afraid?
THIS GUY!

User avatar
adafruit_support_bill
 
Posts: 88093
Joined: Sat Feb 07, 2009 10:11 am

Re: Micro Switch triggering stepper motors

Post by adafruit_support_bill »

The V2 motor shield has a prototyping area (that big array of holes). You could solder the switches there and run jumpers to the breakout holes that run parallel to the headers.

Image

User avatar
jbc
 
Posts: 159
Joined: Wed Aug 14, 2013 7:18 pm

Re: Micro Switch triggering stepper motors

Post by jbc »

If there were 8 days in a week would you work that day too?
Bill you are like 'Adafruit's Siri.' Always ON.

Can I pick any hole in the prototyping area for one wire and attach another wire to a pin (0-13)? (I'm learning quickly but started from zero!)
(the micro switches I have on my 3D printer used only two wires-on a different board)

User avatar
adafruit_support_bill
 
Posts: 88093
Joined: Sat Feb 07, 2009 10:11 am

Re: Micro Switch triggering stepper motors

Post by adafruit_support_bill »

You will need to connect a jumper from one of the switch pins to ground, and one from the other pin to an Arduino pin. You can use any holes in the prototyping area, they are just there to give you convenient soldering points.

User avatar
jbc
 
Posts: 159
Joined: Wed Aug 14, 2013 7:18 pm

Re: Micro Switch triggering stepper motors

Post by jbc »

I think I get it.
Does this look right or does it induce involuntary vomiting?
Attachments
micro switch wiring.JPG
micro switch wiring.JPG (178.69 KiB) Viewed 1069 times

Locked
Please be positive and constructive with your questions and comments.

Return to “Microcontrollers”