3 Simple Ways to
Share What You Make

With Instructables you can share what you make with the world — and tap into an ever-growing community of creative experts.

PhotosPhotos

Share one or more photos of a project, recipe, or whatever you've made, quickly and easily.

Step by StepStep-By-Step

Share your step-by-step photos with text instructions of what you made so others can do it too!

VideoVideo

Share your how-to video. You'll need your embed code from a video site such as YouTube.

The Arduino Mothbot

Step 5Integrating the On/Off Button

Integrating the On/Off Button
«
  • IMG_2743.JPG
  • IMG_2749.JPG
  • IMG_2748.JPG
  • IMG_2747.JPG
  • IMG_2746.JPG
  • IMG_2745.JPG
  • IMG_2744.JPG
Now you may be wanting to turn your robot on and off with the push of a button. The Arduino itself will run code in an endless loop until you unplug it, which can be quite frustrating when you plug in your robot on the table and it starts running away from you! Integrating the button is a great step in this process because you'll also learn how to use buttons for other things, like creating a bumper to detect when the robot hits a wall.

As a note, you'll notice I removed the servos from the solderless breadboard for most of my pictures. This just helps make the image more clear when I'm showing different steps.

1. To begin, disconnect power from the servo motors before doing any more work. Remember to do this every time you add something to this project.

2. Now you may want to be able to turn your robot on and off as opposed to having the robot immediately start moving when you connect the power.

3. Identify a strip on the opposite side of the solderless breadboard to be power for on/off button (and later the sensors).

4. Using a long jumper wire connect the power (+5V) from the Arduino to the strip you just identified.

5. Connect two jumper wires to the momentary switch and plug one end into the (+5V) power

6. Plug the other end of the momentary switch into a smaller strip in the middle of the solderless breadboard.

7. From that same strip connect a 10K ohm resistor to the strip and the other end into ground

8. Finally, connect a wire from the strip with the switch and the resistor on one end and place the other end in digital input 7 on the Arduino.

9. Now, with the code you should be able to use the button to turn on and off the robot. If you use the code with the LED (digital output 13) you will see the on-board LED turn on and off with the robot. This is a great way to test the Arduino code if you have the power to the motors disconnected.
« Previous StepDownload PDFView All StepsNext Step »

Pro

Get More Out of Instructables

Already have an Account?

close

All Steps Viewing
View all steps of an Instructable on the same page when you're a Pro Member.

Upgrade to Pro today!
51
Followers
7
Author:natantus(Chris Gilmer Project)
I'm a software and aerospace engineer. When I've got free time I like to work on robot projects and love to play with my Makerbot Cupcake and Eggbot. I would love to be involved in DIY prosthetics a...
more »