Discover millions of audiobooks, ebooks, and so much more with a free trial

From $11.99/month after trial. Cancel anytime.

Build Your Own Autonomous NERF Blaster: Programming Mayhem with Processing and Arduino
Build Your Own Autonomous NERF Blaster: Programming Mayhem with Processing and Arduino
Build Your Own Autonomous NERF Blaster: Programming Mayhem with Processing and Arduino
Ebook341 pages1 hour

Build Your Own Autonomous NERF Blaster: Programming Mayhem with Processing and Arduino

Rating: 0 out of 5 stars

()

Read preview

About this ebook

Design and build your own robotic, Arduino-powered sentry blaster!

Break out the big daddy blaster--and teach it to act on its own! Build Your Own Autonomous NERF Blaster walks you through cool DIY projects, such as working with motion sensors, remote monitors, and facial detection software, all while building up to the ultimate goal: a robotic NERF weapon that finds and fires on its targets! Have some serious fun along the way as you learn about creative coding with Processing and Arduino.

Step-by-step instructions show you how to:

  • Construct and mount a servo, NERF blaster, and webcam in harmonious alignment
  • Program Processing to receive video, search it for a face, and then pass instructions to your Arduino board via USB cable
  • Configure Arduino to process the message and instruct the servo to move to a new position
  • Specify your target radius in Processing and, when met, send the message to Arduino that it's time to "open fire!"
LanguageEnglish
PublisherMcGraw-Hill Education
Release dateJul 6, 2013
ISBN9780071802765
Build Your Own Autonomous NERF Blaster: Programming Mayhem with Processing and Arduino

Related to Build Your Own Autonomous NERF Blaster

Related ebooks

Electrical Engineering & Electronics For You

View More

Reviews for Build Your Own Autonomous NERF Blaster

Rating: 0 out of 5 stars
0 ratings

0 ratings0 reviews

What did you think?

Tap to rate

Review must be at least 10 words

    Book preview

    Build Your Own Autonomous NERF Blaster - Bryce Bigger

    Copyright © 2013 by McGraw-Hill Education. All rights reserved. Except as permitted under the United States Copyright Act of 1976, no part of this publication may be reproduced or distributed in any form or by any means, or stored in a database or retrieval system, without the prior written permission of the publisher.

    ISBN: 978-0-07-180276-5

    MHID:       0-07-180276-2

    The material in this eBook also appears in the print version of this title: ISBN: 978-0-07-180275-8, MHID: 0-07-180275-4.

    E-book conversion by Codemantra

    Version 1.0

    All trademarks are trademarks of their respective owners. Rather than put a trademark symbol after every occurrence of a trademarked name, we use names in an editorial fashion only, and to the benefit of the trademark owner, with no intention of infringement of the trademark. Where such designations appear in this book, they have been printed with initial caps.

    McGraw-Hill Education eBooks are available at special quantity discounts to use as premiums and sales promotions or for use in corporate training programs. To contact a representative please visit the Contact Us page at www.mhprofessional.com.

    McGraw-Hill Education, the McGraw-Hill Education logo, TAB, and related trade dress are trademarks or registered trademarks of McGraw-Hill Education and/or its affiliates in the United States and other countries and may not be used without written permission. All other trademarks are the property of their respective owners. McGraw-Hill Education is not associated with any product or vendor mentioned in this book.

    Information contained in this work has been obtained by McGraw-Hill Education from sources believed to be reliable. However, neither McGraw-Hill Education nor its authors guarantee the accuracy or completeness of any information published herein, and neither McGraw-Hill Education nor its authors shall be responsible for any errors, omissions, or damages arising out of use of this information. This work is published with the understanding that McGraw-Hill Education and its authors are supplying information but are not attempting to render engineering or other professional services. If such services are required, the assistance of an appropriate professional should be sought.

    TERMS OF USE

    This is a copyrighted work and McGraw-Hill Education and its licensors reserve all rights in and to the work. Use of this work is subject to these terms. Except as permitted under the Copyright Act of 1976 and the right to store and retrieve one copy of the work, you may not decompile, disassemble, reverse engineer, reproduce, modify, create derivative works based upon, transmit, distribute, disseminate, sell, publish or sublicense the work or any part of it without McGraw-Hill Education’s prior consent. You may use the work for your own noncommercial and personal use; any other use of the work is strictly prohibited. Your right to use the work may be terminated if you fail to comply with these terms.

    THE WORK IS PROVIDED AS IS. McGRAW-HILL EDUCATION AND ITS LICENSORS MAKE NO GUARANTEES OR WARRANTIES AS TO THE ACCURACY, ADEQUACY OR COMPLETENESS OF OR RESULTS TO BE OBTAINED FROM USING THE WORK, INCLUDING ANY INFORMATION THAT CAN BE ACCESSED THROUGH THE WORK VIA HYPERLINK OR OTHERWISE, AND EXPRESSLY DISCLAIM ANY WARRANTY, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO IMPLIED WARRANTIES OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. McGraw-Hill Education and its licensors do not warrant or guarantee that the functions contained in the work will meet your requirements or that its operation will be uninterrupted or error free. Neither McGraw-Hill Education nor its licensors shall be liable to you or anyone else for any inaccuracy, error or omission, regardless of cause, in the work or for any damages resulting therefrom. McGraw-Hill Education has no responsibility for the content of any information accessed through the work. Under no circumstances shall McGraw-Hill Education and/or its licensors be liable for any indirect, incidental, special, punitive, consequential or similar damages that result from the use of or inability to use the work, even if any of them has been advised of the possibility of such damages. This limitation of liability shall apply to any claim or cause whatsoever whether such claim or cause arises in contract, tort or otherwise.

    With love in your toolbox, anything is possible.

    For my family, Beth, Jack, and Will

    About the Author

    Bryce Bigger is an interactive designer-developer. He is the founder and principal of The Bigger Design, an interactive company with roots in web design and development but extending to all things digital, including video, 3D, games, and, more recently, physical computing. Bryce has crafted interactive magic for many national brands, including the United States Navy, Oracle, Ping Golf, Lockheed Martin, Chef Boyardee, and the National Institutes of Health.

    He created the Sentinel Project, an open-source autonomous foam dart gun system shown at AdobeMAX 2010 to spotlight innovative use of Adobe AIR technology. Recently, Bryce has produced other sizzling foam dart weaponry for clients, including e-mail marketing leader MailChimp.

    Bryce holds a B.S. in Media Arts and Design from James Madison University in Harrisonburg, Virginia. He lives in Columbia, South Carolina, with his beloved wife and two sons.

    Contents

    Preface

    Acknowledgments

    1 Tinkering

    Tinkering Is Not a Waste of Time

    Tinkering with Game Boy Advance

    Tinkering with MAME Arcade

    Tinkering with 3D

    Tinkering with Arduino

    Tinkering Can Get You a Job

    2 Building a NERF Niche

    The Sentinel Project

    The Design

    The Blaster

    The Base

    The Code

    3 Processing Crash Course

    What’s Processing?

    Getting Processing

    Installing Processing on Mac OS X

    Installing Processing on Windows

    Hello, Circle!

    More Circles!

    Save the Ellipses!

    Don’t Skimp on Structure

    Let’s Draw

    4 Arduino Crash Course

    What’s a Microcontroller?

    So Use a Desktop or Laptop, Right?

    What Connects to Microcontrollers?

    Types of Arduino Boards

    Anatomy of an Arduino

    Dream, Create, Deploy

    Getting Started

    It’s Go Time!

    What You’ll Need

    Installing the Software

    Blinky Blink

    Wiring an Arcade Button

    What You’ll Need

    Making Things Move

    Awesometer

    What You’ll Need

    But Wait. There’s More!

    Awesome. We’re Done

    5 Motion Detection

    What You’ll Need

    Motion-Sensing Methodology

    PIR Sensors

    Image-Based Detection in Processing

    Computer Vision

    Facial Detection with OpenCV

    6 Tinkering Pays Off

    Project Blueprint: The MailChimp Feces Flinger

    The Concept

    Project Requirements

    Design and Build

    Software and Video Streaming

    Delivery

    The Takeaways

    The Feces Flinger—What Went Right

    The Feces Flinger—What Warranted Another Look

    The Feces Flinger—Lessons Learned

    7 Foam Dart Blaster Hackery

    Components

    Optional Upgrades

    Analog Tools

    Blaster Selection

    The Big Chart

    Weight Removal

    Option 1: Lithium-Ion Battery Modification

    Option 2: Make the Battery Tray External

    Option 3: Power-Adapter Modification

    Fire Control

    8 Blaster Brains and Eyes

    Autonomous Turret, Assemble!

    Pan as in Rotation System

    It’s Webcam Time

    Down to the Wiring

    Mouse Movement = Servo Movement

    Blaster Coding for Processing

    Blaster Coding for Arduino

    9 Autonomous Avenger Armed

    All Systems Enabled

    HUDs, GUIs, and FUIs

    Tips and Tricks

    10 Leveling Up

    Cutting the Cords

    Manual Control

    Death Blossom

    Even More Awesome

    A Parts List

    B The Sentinel Project Build

    Instructions for the Prototype Build

    Building the Base

    C Applied Warfare Tactics

    Flanking

    Diversion

    Choke Point

    D Tales from the Toolbox

    Save Time, Save Money

    Board Up Your Toolbox

    Upgrade to a Combo?

    Powering Your Project

    Blaster Augmentation

    Alternate Input

    Fancy Up

    Index

    Preface

    Tinkering is an art. While not a fine art, its importance in our society has never been greater. With all the technology available today, it would be easy to let other people figure everything out for us and to never question their information, judgments, or decisions. But that’s not smart for you or for the future of innovation.

    Is This Book for You?

    This book is a kick in the pants for anyone interested in (even remotely) information technology (IT), coding, design, or physical computing. These aren’t career paths in their infancy; these jobs are here today. This book can help you explore these critical fields using a fun, readily accessible toy that’s popular in many office settings and toy boxes: NERF foam dart blasters. So whether you’re in the fifth grade or a 55-year-old hobbyist, dig in and get ready to explore something new.

    Worried?

    Even if you don’t know UI from IT, you soon will. This book is written for beginners who want to learn a bit about coding and physical computing. The projects are easy to understand (and easy on the wallet). The code is all open source. The parts are easy to acquire. Many great companies began in a garage. Maybe yours is a launching pad, too.

    Go Ahead, Turn the Page

    If you’re ready, we can get started right now with a little history, although not the boring kind with dudes in white wigs. This project’s pedigree is arcade video games, handheld hacks, and odd mods. Let the fun begin!

    Bryce Bigger

    Acknowledgments

    This blaster book would not be in your hands without the help of this motley crew:

    • My friends and family, who supported me through this endeavor. I’m so glad I can finally say that the book’s complete and I won’t feel awful anymore when you ask if it’s done.

    • Julie Turner, who helped me wordsmith a story around a bunch of code and spell said words correctly. My series comma will never be the same.

    • Greg Hardin, fellow tinkerer and electrician extraordinaire. My projects wouldn’t have been a success without your guidance, although you don’t seem to remember that I keep my blasters loaded and you always end up shooting me by accident.

    • All of my officemates in the WECO building. Thanks for putting up with all the noise and constant foam dart pelting.

    • Roger Stewart, my editor, and the rest of the folks behind the scenes at McGraw-Hill. Thank you for thinking my story was this interesting. It is, isn’t it?

    • The folks at Adobe—Ben Forta, Kristine Jensen, and, formerly, Ted Patrick—who gave me national attention and my 15 seconds of fame, which I seem to have successfully parlayed into 30 seconds, thanks to Roger.

    • The guys at Cables and Connections, who always help when I’m in search of just the right adapter, converter, wire, whatchamacallit of the day.

    • Ben Chestnut and Zack Smith at MailChimp, who commissioned the Feces Flinger—my favorite project ever.

    • Doug Sumwalt, who got me my first NERF blaster—the Vulcan, the actual foam dart menace used all through the Sentinel Project. It’s retired from service, but it sits on a pedestal in my office and gave me more than you could’ve ever imagined.

    • And finally a big, sloppy thank-you kiss to the open source community for creating such wonderful tools— Casey Reas, Ben Fry, Andrés Colubri, Xavier Hinault, and Massimo Banzi.

    1

    Tinkering

    I know why you’re here. You want to make a fully automated NERF® blaster. We’ll get to that soon, but there’s something important we need to address first. Before we can even think about rolling up our sleeves and creating this sweet NERF cannon, you’re going to have to leave something behind.

    If you’re like me, and I suspect you are, your parents and maybe even a teacher or two told you on more than one occasion to quit wasting time messing with things—digging inside them, taking them apart, repairing them, or flat-out destroying them. A little something affectionately called tinkering.

    The process of tinkering is nowhere near a waste of time. Not even close. In fact, tinkering gave the world some of its greatest inventions—light bulbs, telephones, and that little thing we call the World Wide Web. Sure, some people may think that you’re wasting

    Enjoying the preview?
    Page 1 of 1