Arduino Projects

March 19, 2018 | Author: João Francisco | Category: Computer Engineering, Electronic Engineering, Computer Hardware, Computing, Technology


Comments



Description

IntroductionThe Arduino micrcontroller has a nearly limitless array of innovative applications for everything from robotics and lighting to games and gardening! It's a fun way to automate everything, enabling you to control simple devices or manage complex Halloween displays. The Instructables editors have chosen some of our best do-it-yourself Arduino technology projects to educate and inspire you to make great things with easily-available tools. Instructables is the most popular project-sharing community on the Internet. Since August 2005, Instructables has provided easy publishing tools to enable passionate, creative people to share their most innovative projects, recipes, skills, and ideas. Instructables has over 40,000 projects covering all subjects, including crafts, art, electronics, kids, home improvement, pets, outdoors, reuse, bikes, cars, robotics, food, decorating, woodworking, costuming, games, and life in general. http://www.instructables.com/id/Arduino-Projects/ Table of Contents Introduction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1 Author and Copyright Notices . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 18 Disclaimer . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 21 Arduino animatronics- make your awesome costumes more awesome! . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 22 Intro: Arduino animatronics- make your awesome costumes more awesome! . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 22 Step 1: First you need an Arduino . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 23 File Downloads . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 24 Step 2: Building the controller . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 24 Step 3: Getting started . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 27 Step 4: Making connections- motors, LEDs and transistors . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 28 File Downloads . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 32 Step 5: Now let's have some fun! . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 32 Step 6: Using buttons . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 33 Step 7: Adding a servo . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 34 Step 8: Sound effects and bend sensors . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 36 File Downloads . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 38 Step 9: Controlling servos . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 38 Step 10: Nunchuck control . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 40 Step 11: Predator cannon . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 45 File Downloads . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 53 Step 12: War Machine cannon . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 53 Step 13: Going wireless with XBee . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 58 Step 14: Resources . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 62 Step 15: FAQs . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 62 Related Instructables . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 63 How to have fun with Arduino (and become a Geek in the process) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 64 Intro: How to have fun with Arduino (and become a Geek in the process) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 64 Step 1: Get yourself an Arduino . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 64 Step 2: Where does the cable go? Here is the A side and its home . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 65 Step 3: And here is the B side of the cable . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 65 Step 4: Powering your board . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 66 Step 5: External power using a wall wart . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 66 Step 6: You can add the optional prototype board . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 66 Step 7: Protoshield & prototype board on top of your Arduino . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 67 Step 8: What to do with a prototype board? Look at this. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 67 Step 9: There are pins & connectors on your Arduino too. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 67 Step 10: Next lets talk about the software . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 68 Step 11: So what is Physical Computing? . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 69 Step 12: Whats Next? . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 69 Related Instructables . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 69 Arduino R/C Lawnmower (painted) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 70 http://www.instructables.com/id/Arduino-Projects/ Intro: Arduino R/C Lawnmower (painted) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 70 Step 1: Setting up . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 75 Step 2: The Motor Driver . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 77 Step 3: The Wheels . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 80 Step 4: The Frame part A . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 82 Step 5: The Frame part B . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 84 Step 6: Mounting the motors . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 85 Step 7: Mounting the mower deck . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 87 Step 8: Select and Install the batteries . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 89 Step 9: Mount the electronics . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 90 Step 10: The Code . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 92 File Downloads . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 92 Step 11: More Videos . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 92 Related Instructables . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 94 The Word Clock - Arduino version . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 95 Intro: The Word Clock - Arduino version . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 95 THE BACKGROUND . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 95 POWER . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 95 REUSE YOUR ARDUINO FOR ANOTHER PROJECT . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 95 Step 1: The new hardware - Controller board schematic . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 96 BETTER DRIVERS . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 96 A NEW PCB . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 96 IS THIS JUST A NEW SHIELD? . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 96 File Downloads . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 96 Step 2: The hardware - Make the controller board . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 97 TONER TRANSFER IS EASY . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 97 BE SAFE . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 97 CLEAN UP . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 97 DRILL HOLES . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 97 File Downloads . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .104 Step 3: The hardware - Populate the controller board . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .104 POPULATE THE PARTS IN ORDER OF SIZE . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .104 Step 4: The display board . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .107 THINK FIRST . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .107 MOUNTING THE LEDs . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .107 MAKING IT (Hey thats a great name for a magazine :-) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .107 DRILL HOLES . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .107 MOUNTING LEDs . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .107 SOLDERING IT TOGETHER . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .107 DO I *REALLY* USE 360R AND 36R RESISTORS? . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .107 ADD A RIBBON CABLE . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .108 http://www.instructables.com/id/Arduino-Projects/ File Downloads . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .112 Step 5: Make the time changing buttons . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .112 Step 6: Program the Arduino and test the displays . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .114 File Downloads . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .114 Step 7: Make the word stencil and baffles . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .114 File Downloads . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .117 Step 8: Making a simple enclosure . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .117 Step 9: Bill of Materials . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .119 Bill Of Materials . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .119 Controller board . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .119 Display board . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .119 Button board . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .120 Stencil board . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .120 Power Supply . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .120 Step 10: Next Steps . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .120 Step 11: Whats been hapening these last few months.... . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .120 File Downloads . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .121 Related Instructables . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .122 Light for life: Glowing button cycling jacket . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .123 Intro: Light for life: Glowing button cycling jacket . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .123 Step 1: Gather stuff for the project . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .125 Step 2: Start our own sewing project! . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .126 Step 3: Sewing the jacket . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .126 Step 4: Exploring with electronics . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .127 Step 5: Make your own shining bright buttons . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .128 Step 6: Make your own interactive jacket . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .129 Step 7: Connecting the Arduino . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .130 Step 8: More on connecting the bits and pieces . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .131 Step 9: And there was light! . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .135 Related Instructables . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .137 A credit card sized Ethernet Arduino compatable controller board . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .138 Intro: A credit card sized Ethernet Arduino compatable controller board . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .138 Step 1: Here is the Schematic Diagram . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .138 File Downloads . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .139 Step 2: The PCB Layout . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .139 File Downloads . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .139 Step 3: Soldering the Components . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .140 Step 4: Programming the Firmware . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .141 File Downloads . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .141 Step 5: But what does it do???? . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .142 Step 6: Parts LIst . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .142 Step 7: KiCad Files . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .143 http://www.instructables.com/id/Arduino-Projects/ File Downloads . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .143 Related Instructables . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .143 Secret Knock Detecting Door Lock . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .144 Intro: Secret Knock Detecting Door Lock . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .144 Step 1: Tools, Supplies, And Skills . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .145 (If this all looks too challenging, you might consider signing up to the kit mailing list which, when available, will be much easier and a lot more simple.) Time : . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .145 Skills : . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .145 Tools: . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .145 Materials : . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .145 Electronics : . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .145 Case: . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .146 Step 2: Program The Arduino . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .146 File Downloads . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .147 Step 3: Lay Out And Test The Circuit . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .147 Step 4: Prepare The Case . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .149 Step 5: Make The Lock Turning Clamp . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .150 Step 6: Make The Knock Detector Spring . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .151 Step 7: Soldering The Circuits . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .152 Step 8: Assembling The Case . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .157 Step 9: Mounting, Testing, and Use . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .160 Step 10: Epilog: Changes And Improvements . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .160 Did you build this? . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .160 Masters of Secret Knocks: . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .160 Related Instructables . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .161 Wireless Altoids Display . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .162 Intro: Wireless Altoids Display . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .162 Step 1: Components & Tools . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .163 Step 2: Prepare the surface... . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .164 Step 3: Mark & drill holes . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .164 Step 4: Attach the Antenna Socket & Posts . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .165 Step 5: Insulate! . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .166 Step 6: Add Arduino . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .167 Step 7: Attaching the LCD . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .168 Step 8: Wiring up & adding Xbee Module . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .169 Step 9: Finished Construction... . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .170 Step 10: Upload Sketches & Testing . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .170 File Downloads . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .172 Step 11: Resources . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .172 Related Instructables . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .173 Temperature Control For Kitchen Appliances . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .174 Intro: Temperature Control For Kitchen Appliances . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .174 http://www.instructables.com/id/Arduino-Projects/ Step 1: Parts . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .174 Step 2: Sensing Temperature . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .176 Step 3: Intercept the Heater Control . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .179 Step 4: The Magic of Feedback . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .181 Step 5: Advanced Techniques . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .183 Related Instructables . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .183 Turn your Arduino into a Magnetic Card Reader! . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .184 Intro: Turn your Arduino into a Magnetic Card Reader! . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .184 Step 1: The Equipment List . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .184 Step 2: Self-clocking Magnetic Card Readers . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .185 Step 3: Magnetic Card Basics . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .186 Magnetic Card Standards . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .186 Card Formats . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .186 Step 4: Detect When a Card is Swiped . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .187 1. Detect when a card has been swiped . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .187 Step 5: Read the Stream of Data . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .188 Read the stream of data . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .188 Step 6: Detect the Card Leaving the Reader . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .188 Detect when a card has gone . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .188 Step 7: Process the Data . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .189 Process the data . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .189 Step 8: Display the Data . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .189 Display the data . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .189 Step 9: Code Download and Wrapup . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .190 File Downloads . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .190 Related Instructables . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .190 Twittering Laser Tripwire with Webcam Capture . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .191 Intro: Twittering Laser Tripwire with Webcam Capture . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .191 File Downloads . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .192 Step 1: Connecting The LDR . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .192 Step 2: Connecting the Laser Pointer . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .195 Step 3: Everything in place . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .196 Step 4: Processing . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .197 Step 5: Using open() in processing . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .198 Step 6: Now run it. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .199 Related Instructables . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .200 How To Smell Pollutants . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .201 Intro: How To Smell Pollutants . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .201 Step 1: Gather Your Supplies . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .202 File Downloads . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .204 Step 2: Set Up Your Arduino . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .204 Step 3: Create Your Circuit . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .205 http://www.instructables.com/id/Arduino-Projects/ File Downloads . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .205 Step 4: Test Your Newfound Sense of Smell . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .205 Step 5: Build Away! . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .206 File Downloads . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .206 Related Instructables . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .206 How to connect Arduino and RFID . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .207 Intro: How to connect Arduino and RFID . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .207 Step 1: What you gonna need? . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .207 Step 2: Plugging all together . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .208 Step 3: The code . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .209 File Downloads . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .209 Step 4: Results! . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .209 Related Instructables . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .209 Mushroom Environment Control - Arduino Powered . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .210 Intro: Mushroom Environment Control - Arduino Powered . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .210 Step 1: Items . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .210 Step 2: Thermistors . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .211 Step 3: Humidity Reader . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .211 File Downloads . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .212 Step 4: Co2 Sensor . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .212 File Downloads . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .212 Step 5: Connect the Arduino . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .212 Step 6: Mains Relays and connection to Powerboard . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .213 Step 7: The Code . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .215 File Downloads . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .216 Step 8: House the project . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .216 Step 9: The Humidifier . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .217 Step 10: Humidity Calibration . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .218 Step 11: Temperature Calibration . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .218 Step 12: C02 Calibration . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .219 Step 13: Test it out . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .220 Related Instructables . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .220 Arduino Watch Build Instructions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .221 Intro: Arduino Watch Build Instructions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .221 Step 1: The Materials . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .222 File Downloads . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .223 Step 2: The Software . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .223 Step 3: Preparing the materials . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .224 Step 4: Carving the Screen Case . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .224 Step 5: Parts Layout . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .225 Step 6: Cutting the watch band . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .225 Step 7: Soldering Connections Diagram . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .225 http://www.instructables.com/id/Arduino-Projects/ File Downloads . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .226 Step 8: Soldering the Trackball . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .226 Step 9: Soldering the Display Connector . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .226 Step 10: Soldering the Real-Time Clock . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .227 Step 11: Solder the Extensions Header . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .228 Step 12: Steampunking the watch . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .229 Step 13: Extensions: Range Finding . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .230 Step 14: Extensions: Temperature Sensing . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .231 Step 15: Wear and Enjoy! . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .231 Related Instructables . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .231 Digital Window Sticker (Arduino Controlled) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .232 Intro: Digital Window Sticker (Arduino Controlled) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .232 Step 1: Parts List . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .232 Digital Window Sticker Parts List . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .232 Step 2: Assemble the BBB Arduino and USB BUB... . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .235 Step 3: Program your Arduino... . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .236 File Downloads . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .239 Step 4: Assemble the SD-MMC Card Breakout Board . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .239 Step 5: Build the circuit . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .240 File Downloads . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .246 Step 6: The Enclosure . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .246 Step 7: Creating and Displaying Images . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .251 File Downloads . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .254 Related Instructables . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .255 Interface a rotary phone dial to an Arduino . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .256 Intro: Interface a rotary phone dial to an Arduino . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .256 Step 1: Remove the dial from the phone . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .256 Step 2: Identify the switch . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .257 Step 3: Make the circuit . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .258 Step 4: Develop the code . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .258 Step 5: Check it works! . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .259 Step 6: Hook it into something useful! . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .259 Related Instructables . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .260 Arduino Powered Binary Clock . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .261 Intro: Arduino Powered Binary Clock . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .261 Step 1: Component Shopping List . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .261 Step 2: 8421 Binary and 24 Hour Time . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .262 Step 3: Creating the Arduino Binary Clock PCB . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .263 Step 4: Clock Case . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .264 Step 5: Arduino Sketch . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .265 Related Instructables . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .267 http://www.instructables.com/id/Arduino-Projects/ Arduino All-in-One Getting Started Guide . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .268 Intro: Arduino All-in-One Getting Started Guide . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .268 Step 1: Testing Your Board / Getting Started . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .269 Step 2: Wiring the Blinky Lights . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .269 Step 3: Wiring the Pushbutton Switch . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .270 Step 4: Programming the Project . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .271 File Downloads . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .272 Step 5: Where to Go from Here . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .272 Related Instructables . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .272 The Arduino Weather Station / Thermostat . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .273 Intro: The Arduino Weather Station / Thermostat . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .273 Step 1: The Arduino . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .273 Step 2: The LCD Display . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .274 Step 3: Temperature & Humidity . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .275 Step 4: HVAC Control . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .276 Step 5: Current code with wiring instructions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .276 Step 6: Arduino Clock Module . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .278 Related Instructables . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .279 Control a Schlage electronic deadbolt with an arduino! . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .280 Intro: Control a Schlage electronic deadbolt with an arduino! . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .280 Step 1: Purchase the lock and unpack it . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .280 Step 2: Take the faceplate off of the lock . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .281 Step 3: Take the intermediary plate off . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .281 Step 4: Check out all of the neat stuff . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .282 Step 5: Wire it up! . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .283 Step 6: Reassemble the lock . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .284 Step 7: Create H bridge circuit . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .285 Related Instructables . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .285 Garduino: Gardening + Arduino . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .286 Intro: Garduino: Gardening + Arduino . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .286 Step 1: Obtain Your Materials . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .287 Step 2: Sprout Your Plants . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .288 Step 3: Build Your Relays . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .288 Step 4: Build Your Moisture Sensor . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .289 Step 5: Add temperature and light sensors . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .290 Step 6: Make and Populate Your Soil and Planters . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .290 Step 7: Test and Calibrate Your Sensors . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .291 Step 8: Make Your Sensors Control Your Relays . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .292 Step 9: Setup Your Lighting System . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .293 Step 10: Create A Self-Watering Setup . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .294 Step 11: Give Garduino Control . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .294 Step 12: Reap your harvest . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .296 http://www.instructables.com/id/Arduino-Projects/ Step 13: Share your results . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .297 Step 14: Improve away! . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .298 Related Instructables . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .298 Garduino Upgrade, Now with more Twitter! . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .299 Intro: Garduino Upgrade, Now with more Twitter! . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .299 Step 1: Gather your materials . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .299 Step 2: Build your Garduino . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .300 Step 3: Upgrade #1: Remote Sensors . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .300 File Downloads . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .301 Step 4: Update #2: Relay Boxes . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .302 Step 5: Upgrade #3: New Software . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .303 File Downloads . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .304 Step 6: Upgrade #4: Wireless Control . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .304 Step 7: Update #5: Twitter your Garden . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .305 Step 8: Useful project notes . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .306 Related Instructables . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .307 n: how to make a multi-layered acrylic and LED sculpture with variable lighting levels . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .308 Intro: N: how to make a multi-layered acrylic and LED sculpture with variable lighting levels . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .308 Step 1: Gathering parts . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .308 Step 2: Gathering tools . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .311 Step 3: Preparing artwork . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .312 File Downloads . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .313 Step 4: Laser cutting preparation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .313 Step 5: Laser cutting . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .314 Step 6: Electronics . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .316 Step 7: Arduino program . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .318 File Downloads . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .319 Step 8: Arduino board . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .319 Step 9: Assembly . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .321 Step 10: Hang on a wall . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .323 Step 11: Twiddle the knobs . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .324 Related Instructables . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .324 Ardu-pong! the Arduino based pong console . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .325 Intro: Ardu-pong! the Arduino based pong console . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .325 Step 1: Get the stuff. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .325 Step 2: Hack the enclosure. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .325 Step 3: Install the rca jack. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .326 Step 4: Wire the serial port . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .326 Step 5: Wire the rca jack . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .327 Step 6: Software . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .327 File Downloads . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .327 Step 7: Congratulations!!! your done (almost). . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .327 http://www.instructables.com/id/Arduino-Projects/ Step 8: UPDATE: . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .328 Related Instructables . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .329 Arduino Laser Tag - Duino Tag . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .330 Intro: Arduino Laser Tag - Duino Tag . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .330 Step 1: Overview . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .331 Step 2: Basics . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .332 Step 3: Modding the light gun . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .334 Step 4: Transmitter . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .335 Step 5: Receiver . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .335 Step 6: Sound Effects . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .337 Step 7: Visual effects / Lighting . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .338 Step 8: The Code . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .338 Step 9: Optional Extras . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .344 Step 10: Design Ideas . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .345 Step 11: Links . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .345 Related Instructables . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .345 The 4x4x4 LED cube (Arduino) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .346 Intro: The 4x4x4 LED cube (Arduino) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .346 Step 1: Get the materials . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .346 Step 2: Assemble the board(the LED cube base) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .347 Step 3: Defuse the LED . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .348 Step 4: Construct the cube . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .349 Step 5: PROGRAM . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .352 File Downloads . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .353 Step 6: ADD on . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .353 Related Instructables . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .353 Arduino and Touchpad Tic Tac Toe . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .354 Intro: Arduino and Touchpad Tic Tac Toe . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .355 Step 1: Wiring up the LED matrix . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .356 Step 2: LED matrix layout . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .356 Step 3: Addressing the LED Matrix . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .357 File Downloads . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .357 Step 4: Constructing the touch pad . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .357 Step 5: The touch pad - how it works . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .358 File Downloads . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .359 Step 6: Putting everything together . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .359 Step 7: Programming Tic Tac Toe . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .360 File Downloads . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .360 Step 8: Remarks and further improvements . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .360 Related Instructables . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .361 Make a Web Connected Robot (for about $500) (using an Arduino and Netbook) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .362 http://www.instructables.com/id/Arduino-Projects/ Intro: Make a Web Connected Robot (for about $500) (using an Arduino and Netbook) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .362 Step 1: Parts & Tools . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .363 Step 2: Cutting Pieces & Assembly . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .364 File Downloads . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .365 Step 3: Software - (Arduino) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .365 Step 4: Software - Robot Laptop (WebServer) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .366 File Downloads . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .367 Step 5: Software - (Webpage) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .367 File Downloads . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .369 Step 6: Finished . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .370 Related Instructables . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .370 The Lightning Simulator/Breathalyzer/Graphic Equalizer - Arduino Powered . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .371 Intro: The Lightning Simulator/Breathalyzer/Graphic Equalizer - Arduino Powered . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .371 Step 1: The Schematic & Audio Solution . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .372 Step 2: Digging the Trenches & Running the Power & Audio . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .373 Step 3: Mounting the LED strips . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .376 Step 4: Wiring the LED Strips and Sensors to the Arduino Mega . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .377 Step 5: The Outdoor Breathalyzer . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .380 Step 6: Arduino Code . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .382 File Downloads . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .383 Related Instructables . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .383 Arduino XMAS hitcounter . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .384 Intro: Arduino XMAS hitcounter . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .384 Step 1: Tools and Materials . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .384 Step 2: Hardware Assembly . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .385 Step 3: Schematics . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .387 Step 4: Programming the Arduino . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .388 File Downloads . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .389 Step 5: Make it a hitcounter . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .389 File Downloads . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .389 Step 6: Conclusion . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .390 Related Instructables . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .390 Arduino magnetic stripe decoder . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .391 Intro: Arduino magnetic stripe decoder . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .391 Step 1: Hardware . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .391 Step 2: Software . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .392 File Downloads . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .393 Step 3: Use it! . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .393 Step 4: Where do I go from here? . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .394 File Downloads . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .394 Related Instructables . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .394 Arduino EMF (Electromagnetic Field) Detector . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .395 http://www.instructables.com/id/Arduino-Projects/ Intro: Arduino EMF (Electromagnetic Field) Detector . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .395 Step 1: The Stuff: . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .395 Step 2: Wire the 7-Segment LED Display . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .396 Step 3: Add the Probe/Antenna . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .400 Step 4: The Code . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .401 File Downloads . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .402 Step 5: Play with it! . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .402 Related Instructables . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .402 Using a Dot Matrix LED with an Arduino and Shift Register . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .403 Intro: Using a Dot Matrix LED with an Arduino and Shift Register . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .403 File Downloads . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .405 Step 1: Get the Goods... . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .405 Step 2: Directly Connect to the LED Display . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .406 The Left Side . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .406 The Right Side . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .406 Step 3: Specifying a Character to be Displayed . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .408 File Downloads . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .409 Step 4: Conserve I/O Ports with a Shift Register . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .409 File Downloads . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .411 Step 5: Summary . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .411 Related Instructables . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .411 The 74HC164 Shift Register and your Arduino . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .412 Intro: The 74HC164 Shift Register and your Arduino . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .413 Step 1: So, what are shift registers? . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .413 Step 2: Basic wiring and operation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .414 Step 3: Projects . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .415 Step 4: Project 1[pt 1]: '2 Wire' bargraph LED display controller hardware . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .416 Step 5: Project 1[pt 2]: '2 Wire' bargraph LED display controller software . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .417 File Downloads . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .418 Step 6: Project 2: '2 Wire' 7 Segment display controller . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .418 File Downloads . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .419 Step 7: Project 3[pt 1]: '2 Wire' 4x4 led matrix display . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .420 Step 8: Project 3[pt 2]: '2 Wire' 4x4 led matrix display . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .420 File Downloads . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .422 Step 9: Conclusion . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .422 Related Instructables . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .423 turn signal biking jacket . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .424 Intro: Turn signal biking jacket . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .424 Step 1: Supplies . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .424 Step 2: Design . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .425 Step 3: Sew your power supply and LilyPad to your jacket . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .427 Step 4: Test your stitching . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .430 http://www.instructables.com/id/Arduino-Projects/ Step 5: Sew on your turn signal LEDs . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .431 Step 6: Sew in your control switches . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .433 Step 7: Sew in your indicator LEDs . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .436 Step 8: Program your jacket . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .437 Related Instructables . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .439 Android G1 Serial To Arduino Robot . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .440 Intro: Android G1 Serial To Arduino Robot . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .440 Step 1: Items needed . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .441 Step 2: Android G1 with serial output enabled . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .443 Step 3: Install the Android Scripting Environment (ASE) with Python . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .444 Step 4: Copy and run the cellbot.py script to launch the Python program . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .445 Step 5: Telnet into the G1 and test sending it commands . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .446 Step 6: Connect a 3.3v to 5v level shifter to the Arduino . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .446 Step 7: Load the Cellbots program on the Arduino . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .448 Step 8: Run the whole process . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .449 Related Instructables . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .450 Ard-e: The robot with an Arduino as a brain . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .451 Intro: Ard-e: The robot with an Arduino as a brain . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .452 Step 1: Build your Bulldozer . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .453 Step 2: Assemble the pan and tilt system . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .455 Step 3: Testing and making the remote controlled version of Ard-e . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .457 Step 4: Ard-e on Auto: Using the Ardunio to drive the DC motors . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .458 Step 5: Making Ard-e sense the world with junk . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .460 Step 6: Making Ard-e see, or at least go towards the brightest light . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .462 Step 7: Ard-e's sense of hearing and smell: interfacing an old speaker and a VOC sensor with an Arduino . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .463 Step 8: Ard-e's robot senses: tracking how far his wheels turn and seeing IR light . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .465 Step 9: The Future of Ard-e: What comes next . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .467 Related Instructables . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .467 Build Your Own BARBOT . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .468 Intro: Build Your Own BARBOT . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .468 Step 1: From Concept to Reality . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .468 Step 2: Building the Supporting Structure. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .469 Step 3: Working with Polycarbonate . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .470 Step 4: The Tray Arm . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .470 Step 5: Liquor Containment Modules . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .472 Step 6: Control Panel . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .473 Step 7: Interfacing with the Arduino . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .474 File Downloads . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .474 Step 8: Putting it all Together . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .474 Step 9: Afterthoughts . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .475 Related Instructables . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .475 http://www.instructables.com/id/Arduino-Projects/ Control a RepStrap with Processing . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .476 Intro: Control a RepStrap with Processing . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .476 Step 1: The Setup . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .477 Step 2: Build a pen holder . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .478 Step 3: Arduino Wiring: . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .479 Step 4: Arduino Code . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .480 Step 5: Processing Code . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .482 Step 6: Run the Processing Code . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .483 Step 7: Draw! . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .484 Step 8: Make changes . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .484 Step 9: Making it a little better . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .485 Step 10: Doing it with Firmata . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .487 Step 11: Correction to firmata.... . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .489 Step 12: Corrected and commented . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .490 Step 13: Follow the Bouncing Ball with Firmata! (this works good) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .492 Step 14: Working towards a 3D print . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .494 Step 15: Working towards a 3D print .... . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .497 Step 16: Pinch Wheel Extruder . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .500 Step 17: Extruder temp control and code . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .501 Step 18: Second round of extruder code . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .504 Step 19: Third Round of Extruder Code! . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .506 Step 20: 3D Bouncing Ball - Processing . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .508 Step 21: 3D - Follow the Bouncing Ball (this includes Firmata) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .510 Step 22: Doing to things at once . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .513 Step 23: Better mesh (in progress) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .514 Step 24: Continous mesh rotating 90deg each layer . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .515 Step 25: Prints using reprap Gcode interpreter and Host software . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .516 Related Instructables . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .517 A fully automatic coffee bean roaster (Arduino) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .518 Intro: A fully automatic coffee bean roaster (Arduino) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .518 Step 1: Materials used . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .519 Step 2: Adjusting the popcorn machine . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .520 Step 3: Connecting the Arduino . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .522 Step 4: The Arduino program code . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .524 File Downloads . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .524 Step 5: Testing..... and roasting your coffee beans . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .525 Related Instructables . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .525 Ghostbusters Proton Pack with Arduino and LASERS! . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .526 Intro: Ghostbusters Proton Pack with Arduino and LASERS! . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .526 Step 1: Make a Ghostbusters costume . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .527 Step 2: Wire the pack for Arduino control . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .527 Step 3: Program the Arduino . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .528 http://www.instructables.com/id/Arduino-Projects/ File Downloads . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .529 Step 4: Install the lasers! . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .529 Step 5: Make more junk you'll have to lug around with you! . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .530 Step 6: Marvel at your own awesomeness! . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .530 Step 7: Final thoughts . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .531 Related Instructables . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .531 Arduino controlled Silly String shooter . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .532 Intro: Arduino controlled Silly String shooter . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .532 Step 1: Materials Checklist . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .533 Step 2: Mark, Measure, and Cut . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .533 Step 3: Bendy / Twisty . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .533 Step 4: Mount Servo . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .534 Step 5: Example Code . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .535 File Downloads . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .535 Related Instructables . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .535 Arduino True Battery Capacity Tester (Li-Ion/NiMH/NiCD/Pb) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .536 Intro: Arduino True Battery Capacity Tester (Li-Ion/NiMH/NiCD/Pb) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .536 Step 1: This is what you can get at the end...(just to get you interested) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .536 Step 2: Lets start at the begining - Arduino . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .537 Step 3: Bread board Arduino . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .537 Step 4: FET with 2.2Ohm load . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .538 Step 5: The SW . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .538 Step 6: Auto Detect Battery tyoe . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .539 Step 7: Discharging... . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .539 Step 8: Discharge Circuit . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .539 Step 9: My SW (free for anyone to use) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .540 Step 10: The schematics ... . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .542 Step 11: Please support my work by voting for me ! . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .542 Related Instructables . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .542 Wii Nunchuck Adapter . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .543 Intro: Wii Nunchuck Adapter . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .543 Step 1: Supplies . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .543 Step 2: Printing our transfers . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .544 Step 3: Preping the transfer . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .546 Step 4: Cutting and preping the PCB . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .547 Step 5: Transfering the design . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .547 Step 6: Etching the PCB . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .549 Step 7: Drilling holes . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .551 Step 8: Soldering on the header pins . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .551 Step 9: Testing The adapter . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .552 Related Instructables . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .554 Addressable Milk Bottles (LED Lighting + Arduino) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .555 http://www.instructables.com/id/Arduino-Projects/ Intro: Addressable Milk Bottles (LED Lighting + Arduino) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .555 Step 1: Tools and Materials . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .556 Step 2: Cut and Drill Perspex . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .560 Step 3: Mount LEDs . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .561 Step 4: Solder Components . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .563 Step 5: Switches and Housings . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .564 Step 6: Microcontrol, Components, Scavenging . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .567 Step 7: Transistor Circuit . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .570 Step 8: Communication Cables . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .573 Step 9: Voltage Regulation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .574 Step 10: Programming . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .576 Step 11: Cabling and Switchbox . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .577 Step 12: Sequenced Light . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .582 File Downloads . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .583 Related Instructables . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .583 http://www.instructables.com/id/Arduino-Projects/ Author and Copyright Notices Instructable: Arduino animatronics- make your awesome costumes more awesome! Author: Honus License: Attribution-NonCommercial-ShareAlike (by-nc-sa) Instructable: How to have fun with Arduino (and become a Geek in the process) Author: john otto License: Attribution-NonCommercial-ShareAlike (by-nc-sa) Instructable: Arduino R/C Lawnmower (painted) Author: johndavid400 License: Attribution-NonCommercial-ShareAlike (by-nc-sa) Instructable: The Word Clock - Arduino version Author: drj113 License: Attribution-NonCommercial-ShareAlike (by-nc-sa) Instructable: Light for life: Glowing button cycling jacket Author: kempton License: Attribution-NonCommercial-ShareAlike (by-nc-sa) Instructable: A credit card sized Ethernet Arduino compatable controller board Author: drj113 License: Attribution-NonCommercial-ShareAlike (by-nc-sa) Instructable: Secret Knock Detecting Door Lock Author: Grathio License: Attribution-NonCommercial-ShareAlike (by-nc-sa) Instructable: Wireless Altoids Display Author: Alexdlp License: Attribution-NonCommercial-ShareAlike (by-nc-sa) Instructable: Temperature Control For Kitchen Appliances Author: timothy License: Attribution-NonCommercial-ShareAlike (by-nc-sa) Instructable: Turn your Arduino into a Magnetic Card Reader! Author: nevdull License: Attribution-ShareAlike (by-sa) Instructable: Twittering Laser Tripwire with Webcam Capture Author: action_owl License: Attribution-NonCommercial-ShareAlike (by-nc-sa) Instructable: How To Smell Pollutants Author: liseman License: Attribution-ShareAlike (by-sa) Instructable: How to connect Arduino and RFID Author: otaviousp License: Attribution-NonCommercial-ShareAlike (by-nc-sa) Instructable: Mushroom Environment Control - Arduino Powered Author: anthony_p1234 License: Attribution-NonCommercial-ShareAlike (by-nc-sa) Instructable: Arduino Watch Build Instructions Author: Matthew Garten License: Attribution-NonCommercial (by-nc) Instructable: Digital Window Sticker (Arduino Controlled) Author: als_liahona License: Attribution-NonCommercial-ShareAlike (by-nc-sa) Instructable: Interface a rotary phone dial to an Arduino Author: guidomax License: Attribution-NonCommercial-ShareAlike (by-nc-sa) Instructable: Arduino Powered Binary Clock Author: ArduinoFun License: Attribution-ShareAlike (by-sa) Instructable: Arduino All-in-One Getting Started Guide Author: gunnk License: Attribution-NonCommercial-ShareAlike (by-nc-sa) Instructable: The Arduino Weather Station / Thermostat Author: sspence License: Attribution-NonCommercial-ShareAlike (by-nc-sa) Instructable: Control a Schlage electronic deadbolt with an arduino! Author: quadmasta License: Attribution-NonCommercial-ShareAlike (by-nc-sa) Instructable: Garduino: Gardening + Arduino http://www.instructables.com/id/Arduino-Projects/ Author: liseman License: Attribution-ShareAlike (by-sa) Instructable: Garduino Upgrade, Now with more Twitter! Author: natantus License: Attribution-ShareAlike (by-sa) Instructable: N: how to make a multi-layered acrylic and LED sculpture with variable lighting levels Author: slight License: Attribution-NonCommercial-ShareAlike (by-nc-sa) Instructable: Ardu-pong! the Arduino based pong console Author: kyle brinkerhoff License: Attribution-NonCommercial-ShareAlike (by-nc-sa) Instructable: Arduino Laser Tag - Duino Tag Author: j44 License: Attribution-NonCommercial-ShareAlike (by-nc-sa) Instructable: The 4x4x4 LED cube (Arduino) Author: forte1994 License: Attribution-NonCommercial-ShareAlike (by-nc-sa) Instructable: Arduino and Touchpad Tic Tac Toe Author: origamiwolf License: Attribution-NonCommercial-ShareAlike (by-nc-sa) Instructable: Make a Web Connected Robot (for about $500) (using an Arduino and Netbook) Author: oomlout License: Attribution-ShareAlike (by-sa) Instructable: The Lightning Simulator/Breathalyzer/Graphic Equalizer - Arduino Powered Author: alinke License: Attribution-NonCommercial-ShareAlike (by-nc-sa) Instructable: Arduino XMAS hitcounter Author: alex_weber License: Attribution-NonCommercial-ShareAlike (by-nc-sa) Instructable: Arduino magnetic stripe decoder Author: powerpants License: Attribution-NonCommercial-ShareAlike (by-nc-sa) Instructable: Arduino EMF (Electromagnetic Field) Detector Author: computergeek License: Attribution-NonCommercial-ShareAlike (by-nc-sa) Instructable: Using a Dot Matrix LED with an Arduino and Shift Register Author: nevdull License: Attribution-ShareAlike (by-sa) Instructable: The 74HC164 Shift Register and your Arduino Author: osgeld License: Attribution-NonCommercial-ShareAlike (by-nc-sa) Instructable: Turn signal biking jacket Author: leahbuechley License: Attribution-NonCommercial-ShareAlike (by-nc-sa) Instructable: Android G1 Serial To Arduino Robot Author: mranalytical License: Attribution-NonCommercial-ShareAlike (by-nc-sa) Instructable: Ard-e: The robot with an Arduino as a brain Author: imadami License: Attribution-NonCommercial-ShareAlike (by-nc-sa) Instructable: Build Your Own BARBOT Author: techball License: Attribution-NonCommercial-ShareAlike (by-nc-sa) Instructable: Control a RepStrap with Processing Author: marc.cryan License: Attribution-NonCommercial-ShareAlike (by-nc-sa) Instructable: A fully automatic coffee bean roaster (Arduino) Author: nightlife31 License: Attribution-NonCommercial-ShareAlike (by-nc-sa) Instructable: Ghostbusters Proton Pack with Arduino and LASERS! Author: depotdevoid License: Attribution-NonCommercial-ShareAlike (by-nc-sa) Instructable: Arduino controlled Silly String shooter Author: erickingston License: Attribution-NonCommercial-ShareAlike (by-nc-sa) http://www.instructables.com/id/Arduino-Projects/ Instructable: Arduino True Battery Capacity Tester (Li-Ion/NiMH/NiCD/Pb) Author: moris_zen License: Attribution-NonCommercial-ShareAlike (by-nc-sa) Instructable: Wii Nunchuck Adapter Author: dany32412 License: Attribution-NonCommercial-ShareAlike (by-nc-sa) Instructable: Addressable Milk Bottles (LED Lighting + Arduino) Author: Nachimir License: Attribution-NonCommercial-ShareAlike (by-nc-sa) http://www.instructables.com/id/Arduino-Projects/ Disclaimer All do-it-yourself activities involve risk, and your safety is your own responsibility, including proper use of equipment and safety gear, and determining whether you have adequate skill and experience. Some of the resources used for these projects are dangerous unless used properly and with adequate precautions, including safety gear. Some illustrative photos do not depict safety precautions or equipment, in order to show the project steps more clearly. The projects are not intended for use by children. Many projects on Instructables are user-submitted, and appearance of a project in this format does not indicate it has been checked for safety or functionality. Use of the instructions and suggestions is at your own risk. Instructables, Inc. disclaims all responsibility for any resulting damage, injury, or expense. It is your responsibility to make sure that your activities comply with all applicable laws. http://www.instructables.com/id/Arduino-Projects/ Arduino animatronics- make your awesome costumes more awesome! by Honus on October 10, 2010 Author:Honus Multi-Bot I'm a former bicycle industry designer turned professional jeweler. Intro: Arduino animatronics- make your awesome costumes more awesome! Here's how to add lights, sound and action to your favorite Halloween project using the open source Arduino microcontroller. Arduino is easy to learn to use and it opens up a whole new world for costume builders and creature creators. If you want to learn how to connect wires, servos, LEDs and use sound effects to add that something special to your latest project then this is for you. I'll show you how to make a neat little compact Arduino servo controller board with built in servo connectors that is perfect for costuming and haunted house applications. There are multiple code examples, wiring diagrams and I'll show you how to connect sensors and even how to connect two controllers using wireless radios. Here's a little movie clip of what is easily possible- an animatronic Predator cannon with laser sight, cannon firing sound and head tracking motion control. Here's an Iron Man hand repulsor with servo to open the forearm missile compartment. Follow along and find out how to make your awesome costumes more awesome... Note- While this instructable is written for the beginner, this tutorial assumes you know how to use a soldering iron and other assorted tools like wire strippers and wire cutters. Please be sure to take proper safety precautions, wear safety glasses when using cutting tools and have adequate ventilation when soldering. If you aren't yet comfortable soldering small surface mount components don't fret- I've posted links in the reference section that will help you become a soldering champ in no time. http://www.instructables.com/id/Arduino-Projects/ Image Notes 1. 900mAh 3.7V LiPo battery 2. Adafruit XBee wireless radio adapter Image Notes 1. JST LiPo battery connector 2. USB mini-B connector for charging battery 3. servo connectors/digital out pins 4. digital out pins- I use these to connect the small transistor board These pins were labeled backwards- oops! They should read right to left 10, 11,12,13 5. analog input pins 6. Adafruit XBee radio adapter socket 7. Programming header for FTDI USB to serial adapter Step 1: First you need an Arduino Arduino? What exactly is Arduino? Arduino is an open source microcontroller- essentially it is a small computer with an easy to use cross platform programming language. It allows you to create interactive objects based on sensory inputs (physical computing.) You can use it to do something simple like make an LED fade or have a servo move when you push a button or have it do something very complex like control a robot by processing sensor inputs, send the inputs to a computer over a wireless network and then send commands back to the robot. The applications are really limited only by your imagination and there are thousands of examples of cool projects all over the Web. There are several books about Arduino and its capabilities and I've listed a few in the reference section. Which Arduino to use? There are several variations of the Arduino controller available so which one do you use? It depends on your application. Some have more input pins than others if you need a lot of sensor inputs. For the purposes of this instructable you really can use any Arduino you like as the information presented applies to most every version. Here is a spreadsheet that shows most of the current variations availablehttps://spreadsheets.google.com/ccc?key=0AsCUiP6WbJIvcG8xalA3QVdmb3JVT0ptWE9VNC02WEE&hl=en#gid=0 If you are going to use an Arduino Uno or Mega or any Arduino that has built in USB then you can skip to the getting started section. Building a servo board Since my focus is mainly on costume building I decided to use the Sparkfun Arduino Pro Mini and then build a compact servo application board for it that has multiple servo outputs, analog inputs and digital outputs. I also added a socket for an Adafruit Xbee wireless radio adapter as well as a charging circuit for a single cell LiPo battery to power the controller. The reasons I really like the Pro Mini are its very small form factor, low cost and low power requirements. It operates on 3.3V, which means it can be powered by a single LiPo cell and that makes it easy when connecting sensors that run on 3.3V. The latest version servo board has eight servo outputs, four digital outputs and six analog inputs. The servo outputs are also digital outputs- they're just configured to make it really easy to connect hobby servos. The earlier version seen in the photos has six servo outputs. Each servo output has three pins- ground, power and signal. The analog inputs are configured the same way- each input has three pins- ground, power and signal. This configuration makes it super easy to connect individual sensors. The board measures 1.75" x 2.30" so it's pretty small. The board has a circuit for charging the LiPo cell that powers the controller. There is a mini USB port for 5v input power. Simply connect the battery and then plug in a USB cable and the battery will automatically charge. There is a charging indicator- the LED is on when the battery is charging and then it will automatically turn off when the battery is fully charged. The mini USB port will also power the controller, even without a battery connected. The mini USB port is only used as a power source connector while charging or during times when a LiPo battery is not available- there is no data transmission using the mini USB port and you are limited by the amount of power a USB port can provide. Code is uploaded to the controller using a USB to serial adapter (more on this later.) This adapter can also power the controller over USB without the need to connect the battery. This comes in really handy when you're testing code and you want to power the controller without having to connect the LiPo battery. http://www.instructables.com/id/Arduino-Projects/ I'm providing all the necessary EAGLE files so people can modify the design to suit their own needs. EAGLE can be downloaded here- http://www.cadsoftusa.com/ File Downloads ServoBoard.zip (28 KB) [NOTE: When saving, if you see .tmp as the file ext, rename it to 'ServoBoard.zip'] Step 2: Building the controller Tools and materials Soldering iron- A good quality soldering iron is a must. I received an Aoyue 2900 soldering station a couple years ago for Christmas and it's been great. You won't believe the difference once you start using a good soldering iron. http://sra-solder.com/product.php/6363/22 I also use a small tip for soldering small surface mount componentshttp://sra-solder.com/product.php/6397/0 Wire cutters/wire strippers- Small flush cutters are the best. If you don't have wire strippers or cutters then these will work wellhttp://www.adafruit.com/index.php?main_page=product_info&cPath=8&products_id=152 http://www.adafruit.com/index.php?main_page=product_info&cPath=8&products_id=147 Tweezers- Get some small tweezers to work with surface mount components. Here's an inexpensive set-http://sra-solder.com/product.php/6409/79 Magnifiers- Being able to see what you're working on makes a world of difference. http://www.adafruit.com/index.php?main_page=product_info&cPath=8&products_id=291 Multimeter- Most any multimeter will work. You don't need to spend big $$$. I personally own a Wavetek Meterman 16XL and it's great. If you don't already own a multimeter and are really getting into hobby electronics then this meter will probably do everything you could ever wanthttp://www.adafruit.com/index.php?main_page=product_info&cPath=8&products_id=308 Servo board PCBhttp://batchpcb.com/index.php/Products/47581 Arduino Pro Mini- http://www.sparkfun.com/products/9220 USB mini-B connector- http://www.sparkfun.com/products/587 capacitors- 2 ea 1210 package 1uF SMD ceramic capacitors http://us.element-14.com/kemet/c1210x105k5ractu/capacitor-ceramic-1uf-50v-x7r-1210/dp/94M5711 resistor- 1ea 1206 package 1K Ohm SMD resistor http://us.element-14.com/welwyn/wcr1206-1k0fi/resistor-thick-film-1kohm-250mw/dp/98K2656 LED- 1 ea 1206 package SMD LED http://www.instructables.com/id/Arduino-Projects/ http://us.element-14.com/vcc-visual-communications-company/vaol-s12rp4/led-2x1-5mm-red-133mcd-624nm/dp/27R0088 JST connector- 1 ea http://www.sparkfun.com/products/8612 MAX1555 IC- 1 ea http://www.sparkfun.com/products/674 http://us.element-14.com/maxim-integrated-products/max1555ezk-t/ic-battery-charger-li-ion-340ma/dp/59J2761?Ntt=MAX1555 Straight break away header pins - 2ea 40 pin row These come in really handy so it's always good to get extras to have on hand http://www.sparkfun.com/products/116 Female break away header pins- 2 ea 40 hole row These also are super handy to have around http://www.sparkfun.com/products/115 Single cell LiPo battery- 1ea (you can use any capacity you like.) http://www.sparkfun.com/products/339 USB mini-B cable- 1 ea Odds are you've already got one but if you don't here you gohttp://www.sparkfun.com/products/598 Assembling the servo board The first thing to do is build the charging circuit. I usually start with the smallest components first. I've found the easiest way to solder SMD parts is to get a tiny bit of solder on your soldering tip and touch it to one of the component pads on the PCB. Then hold the component in place using tweezers and heat up the pad and component pin- this allows you to get the part attached to the board so you can check its alignment for the rest of the pads. Then simply solder each of the remaining pads. There is a great series of SMD soldering tutorials here- http://www.sparkfun.com/tutorials/36 Begin by soldering on the MAX1555 IC (labeled U1) -this can only go on one way. Next comes the LED- make sure to check the polarity as it is labeled on the PCB (the LED cathode is connected to one end of R1.) Then solder resistor R1 followed by the capacitors C1 and C2. These can be soldered on either direction. Next comes the mini USB connector- this one is a bit tricky as the pins are positioned nearly underneath the connector. Now solder on the JST connector. Make sure to double check your soldering job for these connectors as they receive a fair bit of mechanical stress. Now test your charging circuit. Plug in a USB cable and check the voltage at the JST battery connector. It should read about 4.2-4.3V. Now connect the LiPo battery. If everything is OK the small LED should turn on, indicating the battery is charging. Disconnect the battery. Now solder on the pins to connect the Pro Mini board. This is done by soldering on the break away straight header pins. First insert the long pin ends into the PCB, flip the board over and solder them in place. Double check your solder joints. Now flip the board over and place the Pro Mini board in place on top of the exposed pins and solder all the pins in place. Next solder the remaining straight pins into place in the digital out positions and the 3.3v port along the bottom of the board. To finish the board solder all the female headers in place. The best way I've found to cut the female headers is to remove a pin where you want to make a cut- just yank the pin out the bottom using a pair of pliers. Then take wire cutters and cut through the opening left by the pin. Now take a file (or sandpaper) and smooth out the cut edge. Make sure your board is getting power by plugging a USB cable into the mini USB port on the controller board. The red LED on the Arduino Pro Mini should light up. That's it- your controller is ready to go! http://www.instructables.com/id/Arduino-Projects/ http://www.instructables.com/id/Arduino-Projects/ Step 3: Getting started To upload code to your Arduino servo board you need a USB to serial adapter. I use the Sparkfun FTDI Basic 3.3V breakout. You can also use the Adafruit FTDI friend (make sure to set it to 3.3V.) Either adapter will work great (you do have to solder a connector to the bottom of the Sparkfun adapter- you can use either straight or 90 degree pins.) I really like these boards because you can see the LEDs light up when they are transmitting. You also need to make sure you have the latest FTDI drivers on your computer (you can get the most current drivers on the product web pages.) Sparkfun FTDI Basic 3.3V breakout http://www.sparkfun.com/products/10009 Adafruit FTDI friend http://www.adafruit.com/index.php?main_page=product_info&cPath=18&products_id=284 You simply plug the FTDI Basic breakout into the programming socket on the controller board and connect it to a computer using a USB mini-B cable. Make sure to line up the GRN and BLK indicators. If you're using an Arduino with built in USB then you don't need a USB to serial adapter- it's built into the Arduino board. Just connect it to a computer using a USB cable and you're good to go. Programming environment Now you need to download the Arduino software which is located here:http://arduino.cc/en/Main/Software At the time of this writing I am using Arduino 0018. If you want to use the newer Arduino Uno or Mega2560 then you should use the latest release (0021 at this time) as the Uno and Mega2560 use a different type of USB to serial connection that is not supported by previous versions. I also highly recommend reading the Arduino environment guide here:http://arduino.cc/en/Guide/Environment The code you will use has several parts: 1. Program description/commentsThis is where you say what the program does 2. Variable declaration sectionThis is where you assign input/output pins, etc. 3. Setup sectionThis is where you set pins as inputs or outputs, etc. 4. Loop sectionThis is the program that will run based on the conditions of your variables and setup sections. When your program runs it will first define your variables, then execute the setup section once and will then execute the loop section over and over. So what you do is open the Arduino software, add (or write) your code (called a sketch), verify (compile) your code, connect your Arduino to your computer, select the USB/serial connection, select the type of Arduino you're using then upload your code to the Arduino. Here's the process1. Open Arduino window and add/write codeJust open the Arduino program and paste the code example you want to use into the window (or write your own code.) 2. VerifyHit the verify button to compile your code. It will inform you if there are any errors with your code. 3. Connect boardConnect the servo board to your computer using the USB to serial adapter- if you are using an Arduino with built in USB then just plug the Arduino directly into your computer. 4. Select connection- http://www.instructables.com/id/Arduino-Projects/ This tells the USB to serial adapter which serial port you are going to use. The one to select is labeled beginning /dev/tty.usbserial so from the top menu go to Tools>Serial Port>/dev/tty.usbserial-(insert port name here) 5. Select boardThis tells the Arduino program which version board you are using. From the top menu go to Tools>Board>Arduino Pro or Pro Mini (3.3V, 8Mhz) w/ ATmega328 if you are using the Pro Mini servo board or choose the correct model Arduino. 6. Upload codeHit the upload button to send the code to your Arduino. That's it! Step 4: Making connections- motors, LEDs and transistors Inputs and outputs Now we need to connect a few devices like servos, sensors and LEDs to our controller. The controller has inputs and outputs. Things like sensors and switches are input devices, while servos, LEDs and motors are output devices. The inputs and outputs are both analog and digital- a digital input is like a switch, so it's either on or off. Analog inputs are variable- it's more like a dimmer switch that gives you a range of values. Digital outputs are similar- if the controller output pin is set HIGH then it's on. If it's set LOW, then it's off. This is great if you want to turn on a motor or LED. If you want to change the brightness of an LED or make a servo motor move then you want to make the controller output pin an analog output. This is done using PWM (pulsewidth modulation.) PWM simply allows the controller to fake an analog voltage output by setting the output pin HIGH and then setting the output pin LOW within a few microseconds or milliseconds of each other. If you pulse the pin HIGH for the same length of time you pulse it LOW you would get an average voltage of half the total voltage so the output pin would give you 1.6V instead of 3.3V. The amount of time the pin stays HIGH is called pulsewidth. The ratio of time for the pin to go from LOW to HIGH to LOW is called duty cycle. If you shorten the amount of time the pin stays HIGH relative to the amount of time it stays LOW you will effectively lower the output pin voltage. It really sounds more complicated than it is but this will come in really handy later on when you want make LEDs dim or make a servo move. Fortunately most of this complex stuff is done for you in the Arduino code libraries but it's still really good to know. Sensors There are all kinds of sensors- bend sensors, force sensitive resistors, accelerometers, potentiometers, joysticks, etc. These analog sensors change their output voltage according to how you use them. In the examples we'll use button switches to turn things on and off and we'll use joysticks (potentiometers), bend sensors and accelerometers to make servos move. When designing an animatronic system for costuming I try to match the type of sensor used with a specific body motion. Think about how the person wearing the costume is going to use it. Bend sensors are great if you want to make a LED dim or servo move by bending your finger. For even more control I can place a small joystick on a fingertip and use that to make a servo move. For a head tracking system that makes servos follow your head movement I use an accelerometer (from a Wii nunchuck) and I use fingertip switches to trigger sound effects. You'll see how these work in the examples. Sparkfun has a good size momentary push button switch that is breadboard friendly- http://www.instructables.com/id/Arduino-Projects/ http://www.sparkfun.com/products/9190 Here's the smaller versionhttp://www.sparkfun.com/products/97 All of the sensors we'll use are connected to the Arduino input pins. A potentiometer is a device commonly used in an application like a stereo volume knob- it's a type of variable resistor. If you supply the potentiometer with 3.3V when you turn the knob the output voltage will range from 0 to 3.3V. A joystick is simply two potentiometers in a common housing- one for the X axis and one for the Y axis. Sparkfun has a 10K potentiometerhttp://www.sparkfun.com/products/9939 They also have a couple of small joystickshttp://www.sparkfun.com/products/9032 http://www.sparkfun.com/products/9426 A bend sensor is a resistor that changes its resistance value according to how much you bend it. By adding another resistor and creating a voltage divider, we can change the output voltage of the bend sensor to match the degree of bend. The only real drawback to bend sensors is that they don't have the wide range that a potentiometer has. Sparkfun sells a bend sensor herehttp://www.sparkfun.com/products/8606 Accelerometers work by sensing a change in acceleration and then they alter their output relative to the change in acceleration. When you tilt an accelerometer it measures acceleration due to gravity- the more you tilt it the greater the change in output. Accelerometers are commonly used in video game controllers and cell phones. A Wii nunchuck has a 3 axis accelerometer, joystick and two pushbuttons for $20. Motors Servos Hobby servos are small geared motors that have a circuit board and potentiometer to control their rotation. This allows them to be able to move to an exact position relative to your input sensor signal. Most servos can move nearly 180 degrees and some can even do multiple rotations as well as continuous rotation. Servos have three wires- ground, power and signal. The signal wire (usually yellow or white) is connected to the Arduino output pin. The power and ground wires are connected to a separate power source, usually ranging anywhere from 4.8V to 6V. The reason for connecting servos to their own power supply is that motors generate a fair bit of electrical noise, which can cause glitches or a stuttering effect in their movement. If you have an input sensor that generates an input voltage from 0-3.3V the Arduino takes that analog voltage and assigns it a value from 0-1023 using an analog to digital converter (ADC.) The code on the Arduino then tells the servo how far to move based upon the converted value. So if your sensor outputs 1.65V then you would get a reading of 511 and your servo would move half of its rotation. Many Arduino boards operate on 5V so the same sensor at the same position would read 2.5V and the servo would still rotate half way. A continuous rotation servo would rotate in one direction, stop as the sensor gave a 1.65V reading and then reverse direction as you caused to sensor to raise the input voltage. Controlling a servo is done by PWM. You send a send a pulse to the servo on the servo signal line every 20 milliseconds. The pulsewidth tells the servo what position to move to. Most servos operate within a 1 to 2 millisecond pulse range so a 1 millisecond pulse tells the servo to move to the 0 degree position and a 2 millisecond pulse tells the servo to move to the 180 degree position. Any pulse between 1 and 2 milliseconds tells the servo to move to a position that is proportionate between 0 and 180 degrees. I get all my servos herehttp://www.servocity.com DC motors Unlike most servo motors DC motors are best used when you need continuous rotation, especially when you want high RPM. Since DC motors can draw a fair amount of power they are connected to the Arduino output pin using a transistor or a PWM speed controller. Pololu sells a large variety of small DC motorshttp://www.pololu.com/catalog/category/22 Stepper motors I don't usually use stepper motors in my animatronic projects (at least not yet!) but I felt they are worth mentioning. Stepper motors allow for precise positioning as well as continuous rotation and speed control. The drawback to them is that they require a fair bit of electrical power and they're usually significantly larger and heavier than a servo of equal torque rating. Small stepper motors can be salvaged from old printers and scanners. Unlike DC motors stepper motors have multiple individual coils inside that must be activated in a proper sequence in order to get the motor to move. The Arduino controller is able to drive stepper motors using a specific driver chip or transistor array that is capable of energizing each individual coil in the motor. For more information about steppers have a look in the reference section. LEDs Small LEDs are pretty simple to connect to the Arduino- just remember to use a resistor between the Arduino output pin and the resistor cathode to limit the current flow. You can put a resistor on either the anode or cathode of the LED- either way will work. Most of the small 3.3v LEDs will have a forward current of around 20mA so a resistor value around 100 Ohms works pretty well. For accurate resistor value calculations have a look herehttp://led.linear1.org/1led.wiz For my Iron Man repulsor I made a small 2" diameter LED board that has 24 PLCC-2 LEDs. You can get the bare PCB herehttp://www.batchpcb.com/index.php/Products/41872 The board uses 24 1206 package SMD 100 Ohm resistorshttp://us.element-14.com/vishay-dale/crcw1206100rjnea/resistor-thick-film-100ohm-250mw/dp/59M6948 I frequently buy PLCC-2 super bright LEDs on eBay at good priceshttp://stores.ebay.com/bestshop2008hk High power Luxeon LEDs have a much higher current rating and will work best using some type of constant current source to drive them (there are several instructables http://www.instructables.com/id/Arduino-Projects/ on this.) A 1 Watt Luxeon LED will have a forward current of 350mA so you cannot connect it directly to an Arduino output pin. Much like a DC motor you will need to connect it to the output pin using a transistor. Sparkfun sells Luxeon LEDs and a constant current driverhttp://www.sparkfun.com/search/results?term=Luxeon&what=products http://www.sparkfun.com/products/9642 Transistors A transistor is basically just an electronic switch. Each Arduino output pin is limited to 40mA output current so we'll use a particular type of transistor known as an NPN Darlington transistor to turn on high current devices. These transistors have three pins- the collector, emitter and base. The base pin is connected to the Arduino output pin using a 1K Ohm resistor. The collector pin is attached to the high power device and the emitter pin is connected to ground. When the Arduino output pin is set HIGH the transistor turns on and allows electricity to complete a circuit. For applications that do not have power requirements over 1 Amp I designed a small transistor board that connects to digital out pins 10-13 using ribbon cable and two eight pin IDC connectors. This uses four SOT-23 package SMD transistors and four 1206 package 1k Ohm SMD resistors. The board is really easy to solder. Transistor board PCBhttp://batchpcb.com/index.php/Products/41936 SOT-23 NPN Darlington transistors 4 eahttp://us.element-14.com/fairchild-semiconductor/mmbt6427/bipolar-transistor-npn-40v/dp/58K1891 1206 SMD 1K Ohm resistors 4 eahttp://us.element-14.com/yageo/rc1206jr-071kl/resistor-thick-film-1kohm-250mw/dp/68R0298 2x4 pin IDC connector 2eahttp://www.surplusgizmos.com/8-Pin-2x4-IDC-Ribbon-Cable-COnnector_p_1879.html For loads up to 5A I use a TIP 120 transistor in the TO-220 package. These are great for small DC motors and servos. Use a 1K Ohm resistor to connect the transistor base pin to the Arduino output pin. I usually buy TIP 120 transistors from my local Radio Shack. They're very easy to get online as well. Power supply To power the Arduino servo board and servos you need two separate power sources- one single cell LiPo battery for the controller and a small 4.8V- 6V battery pack (4AA batteries work just fine) to power servos. The servo board has an additional socket that provides power from the LiPo cell to power low voltage devices like LEDs. Image Notes 1. straight pins 2. 1206 SMD 1K Ohm resistors 3. SOT-23 SMD Darlington transistors Image Notes 1. 2x4 pin IDC connector http://www.instructables.com/id/Arduino-Projects/ Image Notes 1. bend sensor http://www.instructables.com/id/Arduino-Projects/ Image Notes 1. Luxeon 1 Watt LED File Downloads TransistorBoard.zip (12 KB) [NOTE: When saving, if you see .tmp as the file ext, rename it to 'TransistorBoard.zip'] Step 5: Now let's have some fun! Example 1- LEDs This is really simple- we're going to make two LEDs blink and another LED fade. The code will run over and over as soon as you apply power. It's really easy to set up circuits like this using a breadboard. With each example I'll show how to wire everything up using either the servo board or an Arduino. Copy and paste this sketch into your Arduino window/* * Example 1 * LED Control * This example will blink two LEDs and then fade another LED * Honus 2010 * Fading code created 1 Nov 2008 by David A. Mellis, modified 17 June 2009 by Tom Igoe */ int ledPin1 = 13; // control pin for LED int ledPin2 = 12; int ledPin3 = 11; void setup() { pinMode(ledPin1, OUTPUT); // sets the LED pin as output pinMode(ledPin2, OUTPUT); digitalWrite(ledPin1, LOW); // sets the LED pin LOW (turns it off) digitalWrite(ledPin2, LOW); } void loop() { digitalWrite(ledPin1, HIGH); // sets the LED pin HIGH (turns it on) delay(500); // waits 500 milliseconds digitalWrite(ledPin2, HIGH); delay(500); digitalWrite(ledPin1, LOW); // sets the LED pin LOW (turns it off) delay(500); digitalWrite(ledPin2, LOW); delay(500); // fade in from min to max in increments of 5 points: for(int fadeValue = 0 ; fadeValue <= 255; fadeValue +=5) { // sets the value (range from 0 to 255): analogWrite(ledPin3, fadeValue); // wait for 30 milliseconds to see the dimming effect delay(40); http://www.instructables.com/id/Arduino-Projects/ } // fade out from max to min in increments of 5 points: for(int fadeValue = 255 ; fadeValue >= 0; fadeValue -=5) { // sets the value (range from 0 to 255): analogWrite(ledPin3, fadeValue); // wait for 30 milliseconds to see the dimming effect delay(40); } delay (2000); // wait two seconds } Step 6: Using buttons Example 2- Using a button input This is just like the previous example but now the code runs only once after pushing a button. The push button uses a pull down resistor so when the button is pushed the input pin reads HIGH, otherwise it always reads LOW. Copy and paste this sketch into your Arduino window/* * Example 2 * LED Control using button input * This example will blink two LEDs and fade another LED when a button is pressed and released * Honus 2010 * Modified from Adafruit alternating switch code, http://www.adafruit.com */ int ledPin1 = 13; // control pin for LED int ledPin2 = 12; int ledPin3 = 11; int buttonPin = 14; // button is connected to pin 14 (analog in pin 0) int val; // variable for reading the pin status int buttonState; // variable to hold the last button state void setup() { pinMode(buttonPin, INPUT); // set the button pin as input Serial.begin(9600); // set up serial communication at 9600bps buttonState = digitalRead(buttonPin); // read the initial state pinMode(ledPin1, OUTPUT); // sets the LED pin as output pinMode(ledPin2, OUTPUT); } void loop(){ val = digitalRead(buttonPin); // read input value and store it in val if (val != buttonState) { // the button state has changed! if (val == LOW) { // check if the button is pressed Serial.println("button pressed"); digitalWrite(ledPin1, HIGH); // sets the LED pin HIGH (turns it on) delay(500); // waits 500 milliseconds digitalWrite(ledPin2, HIGH); delay(500); digitalWrite(ledPin1, LOW); // sets the LED pin LOW (turns it off) delay(500); digitalWrite(ledPin2, LOW); http://www.instructables.com/id/Arduino-Projects/ delay(500); // fade in from min to max in increments of 5 points: for(int fadeValue = 0 ; fadeValue <= 255; fadeValue +=5) { // sets the value (range from 0 to 255): analogWrite(ledPin3, fadeValue); // wait for 30 milliseconds to see the dimming effect delay(40); } // fade out from max to min in increments of 5 points: for(int fadeValue = 255 ; fadeValue >= 0; fadeValue -=5) { // sets the value (range from 0 to 255): analogWrite(ledPin3, fadeValue); // wait for 30 milliseconds to see the dimming effect delay(40); } } else { // the button is -not- pressed... Serial.println("button released"); digitalWrite(ledPin1, LOW); // turn the LED off digitalWrite(ledPin2, LOW); } } buttonState = val; // save the new state in our variable } Step 7: Adding a servo Example 3- Adding a servo controlled by another button Building on the previous example now we'll add a servo that is tied to a second push button. This uses the Arduino Servo library to control the servo position. By changing the value in parentheses after the servo1.write code you can control how far the servo moves. Copy and paste this sketch into your Arduino window/* * Example 3 * This example will blink two LEDs and then fade another LED when button1 is pressed and released * and a servo will move after button2 is pressed and released * Honus 2010 * Modified from Adafruit alternating switch code, http://www.adafruit.com */ #include "Servo.h" // include the servo library Servo servo1; // creates an instance of the servo object to control a servo int servoPin1 = 9; // control pin for servo int ledPin1 = 8; // control pin for LED int ledPin2 = 7; int ledPin3 = 11; int buttonPin1 = 14; // button is connected to pin 14 (analog 0 pin) int buttonPin2 = 15; // button is connected to pin 15 (analog 1 pin) int val1; // variable for reading the pin status int val2; int buttonState1; // variable to hold the last button state int buttonState2; void setup() { servo1.attach(servoPin1); // attaches the servo on pin 9 to the servo object http://www.instructables.com/id/Arduino-Projects/ pinMode(buttonPin1, INPUT); // set the button pin as input pinMode(buttonPin2, INPUT); buttonState1 = digitalRead(buttonPin1); // read the initial state buttonState2 = digitalRead(buttonPin2); // read the initial state pinMode(ledPin1, OUTPUT); // sets the LED pin as output pinMode(ledPin2, OUTPUT); } void loop(){ servo1.write(20); val1 = digitalRead(buttonPin1); // read input value and store it in val if (val1 != buttonState1) { // the button state has changed! if (val1 == LOW) { // check if the button is pressed Serial.println("button just pressed"); digitalWrite(ledPin1, HIGH); // sets the LED pin HIGH (turns it on) delay(500); // wait 500 milliseconds digitalWrite(ledPin2, HIGH); delay(500); digitalWrite(ledPin1, LOW); // sets the LED pin LOW (turns it off) delay(500); digitalWrite(ledPin2, LOW); delay(500); // fade in from min to max in increments of 5 points: for(int fadeValue = 0 ; fadeValue <= 255; fadeValue +=5) { // sets the value (range from 0 to 255): analogWrite(ledPin3, fadeValue); // wait for 30 milliseconds to see the dimming effect delay(40); } // fade out from max to min in increments of 5 points: for(int fadeValue = 255 ; fadeValue >= 0; fadeValue -=5) { // sets the value (range from 0 to 255): analogWrite(ledPin3, fadeValue); // wait for 30 milliseconds to see the dimming effect delay(40); } } else { // the button is -not- pressed... digitalWrite(ledPin1, LOW); // turn off the LED digitalWrite(ledPin2, LOW); } } val2 = digitalRead(buttonPin2); if (val2 != buttonState2) { if (val2 == LOW) { // read input value and store it in val 2 // the button state has changed! // check if the button is pressed servo1.write(160); // rotate the servo to 160 degrees delay(3000); // wait 3 seconds servo1.write(20); // rotate to 20 degrees } else { servo1.write(20); } } buttonState1 = val1; buttonState2 = val2; } // save the new state in our variable // the button is -not- pressed... http://www.instructables.com/id/Arduino-Projects/ Step 8: Sound effects and bend sensors Example 4- adding sound and using a bend sensor to make an Iron Man hand repulsor The bend sensor in this example is used as a trigger- once its output value reaches a certain level it causes the Arduino to run the specified code. You can change the threshold value to alter the point at which the sensor acts as a trigger. If you open the Arduino serial monitor window while the servo board is connected to your computer you can see when the bend sensor triggers. The bend sensor is set up using a voltage divider to provide an analog input value on input pin 1. This example uses the Adafruit Wave Shield to provide sound effects. The instructions for building and setting up the Wave Shield can be found on the Wave Shield web page at http://www.ladyada.net/make/waveshield/ There are several code examples on the Wave Shield page for playing back audio files. The example I used is the play6_hc.pde example located at http://www.ladyada.net/make/waveshield/libraryhcplay6.html Just download the sound file to a SD memory card and place it in your Wave Shield and you're good to go. For the wiring schematic I did it two ways. The first version uses a small surface mount transistor board to activate the LED board and the Wave Shield. The second version uses two TIP 120 transistors instead- they are functionally identical. The big difference is the TIP 120 transistors can handle much larger current loads than the small surface mount transistors- but the TIP 120s take up a lot more space. The transistors are needed because the Wave Shield needs a switch to tell it when to play the audio file (the transistor grounds the Wave Shield input pin when activated) and multiple LEDs use far more current than a single Arduino output pin can provide. When the bend sensor is bent far enough the LEDs will fade, the sound file will play and then a servo will move. The servo would be used to open a forearm missile compartment. For more Iron Man costuming fun check out the SIWDAT sitehttp://www.siwdat.com/index.html Copy and paste this sketch into your Arduino window/* * Example 4 * Bend Sensor/Wave shield * This example uses a bend sensor as a trigger to fade a LED with sound effect * using a Wave shield and then activate a servo * Honus 2010 * Modified from Knock Sensor code created 25 Mar 2007 by David Cuartielles * and modified 4 Sep 2010 by Tom Igoe */ #include "Servo.h" // include the servo library Servo servo1; // creates an instance of the servo object to control a servo // these constants won't change: const int servoPin1 = 9; // control pin for servo const int triggerSensor = 1; // the sensor is connected to analog pin 1 const int threshold = 400; // threshold value to decide when the sensor input triggers http://www.instructables.com/id/Arduino-Projects/ const int ledPin = 11; int soundPin1 = 10; // control pin for sound board // these variables will change: int sensorReading = 0; // variable to store the value read from the sensor pin int ledState = LOW; // variable used to store the last LED status, to toggle the light void setup() { Serial.begin(9600); // use the serial port servo1.attach(servoPin1); // attaches the servo on pin 9 to the servo object pinMode(soundPin1, OUTPUT); // sets the sound pin as output digitalWrite(soundPin1, LOW); } void loop() { servo1.write(20); // move the servo to 20 degree position // read the sensor and store it in the variable sensorReading: sensorReading = analogRead(triggerSensor); // if the sensor reading is greater than the threshold: if (sensorReading >= threshold) { digitalWrite(soundPin1, HIGH); // turn the sound on delay(10); // wait ten milliseconds digitalWrite(soundPin1, LOW); // turn the sound off // fade in from min to max in increments of 5 points: for(int fadeValue = 0 ; fadeValue <= 255; fadeValue +=5) { // sets the value (range from 0 to 255): analogWrite(ledPin, fadeValue); // wait for 30 milliseconds to see the dimming effect delay(40); } // fade out from max to min in increments of 5 points: for(int fadeValue = 255 ; fadeValue >= 0; fadeValue -=5) { // sets the value (range from 0 to 255): analogWrite(ledPin, fadeValue); // wait for 30 milliseconds to see the dimming effect delay(40); // send the string "trigger!" back to the computer, followed by newline Serial.println("trigger!"); } servo1.write(160); // move the servo to 160 degree position delay(3000); // wait 3 seconds servo1.write(20); // move the servo to 20 degree position } delay (3000); // three second delay to avoid overloading the serial port buffer } http://www.instructables.com/id/Arduino-Projects/ Image Notes 1. Adafruit Wave Shield- This is THE device to have to add sound to any Arduino project Image Notes 1. 24 ea PLCC-2 white LEDs 2. 24 ea 1206 SMD 100 Ohm resistors File Downloads HandRepulsorSound.wav (689 KB) [NOTE: When saving, if you see .tmp as the file ext, rename it to 'HandRepulsorSound.wav'] Step 9: Controlling servos Example 5- controlling a servo using analog input These two examples show how easy it is to control servos using an analog input. You can use any analog input device you want- I'll use a 10k Ohm potentiometer for the example wiring diagram. As you turn the pot (and change its value) the servo moves proportionally. The second code example simply extends the first example to control six servos from six inputs. This kind of control comes in really handy if you want to control several servos using bend sensors attached to a glove. This would work really well for controlling an animatronic mask. /* * Example 5 * Servo Control * This example uses a servos and analog input to move the servo according to the sensor input value * Honus 2010 */ #include "Servo.h" // include the servo library Servo servo1; // creates an instance of the servo object to control a servo int analogPin = 0; // the analog pin that the sensor is on int analogValue = 0; // the value returned from the analog sensor int servoPin = 4; // Control pin for servo motor void setup() { servo1.attach(servoPin); // attaches the servo on pin 9 to the servo object } void loop() { analogValue = analogRead(analogPin); // read the analog input (value between 0 and 1023) analogValue = map(analogValue, 0, 1023, 0, 179); // map the analog value (0 - 1023) to the angle of the servo (0 - 179) servo1.write(analogValue); // write the new mapped analog value to set the position of the servo delay(15); // waits for the servo to get there } Example 5a- Controlling 6 servos using multiple inputs /* * Example 5a http://www.instructables.com/id/Arduino-Projects/ * Servo Control6 * This example uses 6 servos and analog inputs to move the servos according to the sensor input values * Honus 2010 */ #include // include the servo library // creates an instance of the servo object to control a servo Servo servoMotor1; Servo servoMotor2; Servo servoMotor3; Servo servoMotor4; Servo servoMotor5; Servo servoMotor6; int analogPin1 = 0; int analogPin2 = 1; int analogPin3 = 2; int analogPin4 = 3; int analogPin5 = 4; int analogPin6 = 5; int analogValue1 = 0; int analogValue2 = 0; int analogValue3 = 0; int analogValue4 = 0; int analogValue5 = 0; int analogValue6 = 0; int servoPin1 = 4; int servoPin2 = 5; int servoPin3 = 6; int servoPin4 = 7; int servoPin5 = 8; int servoPin6 = 9; // the analog pin that the sensor is on // the value returned from the analog sensor // Control pin for servo motor void setup() { servoMotor1.attach(servoPin1); servoMotor2.attach(servoPin2); servoMotor3.attach(servoPin3); servoMotor4.attach(servoPin4); servoMotor5.attach(servoPin5); servoMotor6.attach(servoPin6); } // attaches the servo on pin 4 to the servo object // attaches the servo on pin 5 to the servo object // attaches the servo on pin 6 to the servo object // attaches the servo on pin 7 to the servo object // attaches the servo on pin 8 to the servo object // attaches the servo on pin 9 to the servo object void loop() { analogValue1 = analogRead(analogPin1); // read the analog input (value between 0 and 1023) analogValue1 = map(analogValue1, 0, 1023, 0, 179); // map the analog value (0 - 1023) to the angle of the servo (0 - 179) servoMotor1.write(analogValue1); // write the new mapped analog value to set the position of the servo analogValue2 = analogRead(analogPin2); analogValue2 = map(analogValue2, 0, 1023, 0, 179); servoMotor2.write(analogValue2); analogValue3 = analogRead(analogPin3); analogValue3 = map(analogValue3, 0, 1023, 0, 179); servoMotor3.write(analogValue3); analogValue4 = analogRead(analogPin4); analogValue4 = map(analogValue4, 0, 1023, 0, 179); servoMotor4.write(analogValue4); analogValue5 = analogRead(analogPin5); analogValue5 = map(analogValue5, 0, 1023, 0, 179); servoMotor5.write(analogValue5); analogValue6 = analogRead(analogPin6); analogValue6 = map(analogValue6, 0, 1023, 0, 179); servoMotor6.write(analogValue6); delay(15); } // waits for the servo to get there http://www.instructables.com/id/Arduino-Projects/ Step 10: Nunchuck control Example 6- Using a Wii nunchuck as an input device I wrote this bit of code back in 2007 to use a Wii nunchuck as an input device for an animatronic Predator cannon (see example 7.) The Wii nunchuck communicates to an Arduino over four wires (power, ground, data and clock) using an I²C interface (Inter-Integrated Circuit aka two-wire interface or TWI.) The Wii nunchuck has a three axis accelerometer, joystick and two push buttons- for $20 it's an awesome input device for Arduino projects. The code presented here is a further modification of the code by Tod Kurt that was presented in his Bionic Arduino class- I simply extended it to control everything but the accelerometer Z axis, which I found I rarely used. Using this code you can control four servos using the accelerometer and joystick functions and use the two push buttons to turn on LEDs (or transistors or even run a bit of code.) /* * Example 6 * Nunchuck control for four servos and two button inputs * Honus 2007 * This allows the use of a Wii nunchuck as an input device and is modified/extended from the original code * by Tod E. Kurt and Windmeadow Labs *2007 Tod E. Kurt, http://todbot.com/blog/ *The Wii Nunchuck reading code is taken from Windmeadow Labs, http://www.windmeadow.com/node/42 */ #include "Wire.h" int ledPin1 = 13; int ledPin2 = 12; int servoPin1 = 9; int servoPin2 = 8; int servoPin3 = 7; int servoPin4 = 6; int pulseWidth1 = 0; int pulseWidth2 = 0; int pulseWidth3 = 0; int pulseWidth4 = 0; // Control pin for LED 1 // Control pin for LED 2 // Control pin for servo motor // Control pin for servo motor // Control pin for servo motor // Control pin for servo motor // Amount to pulse the servo 1 // Amount to pulse the servo 2 // Amount to pulse the servo 3 // Amount to pulse the servo 4 int refreshTime = 20; // the time in millisecs needed in between pulses long lastPulse1; long lastPulse2; long lastPulse3; long lastPulse4; int minPulse = 700; // minimum pulse width int loop_cnt=0; void setup() { Serial.begin(19200); pinMode(servoPin1, OUTPUT); pinMode(servoPin2, OUTPUT); pinMode(servoPin3, OUTPUT); pinMode(servoPin4, OUTPUT); pulseWidth1 = minPulse; pulseWidth2 = minPulse; pulseWidth3 = minPulse; pulseWidth4 = minPulse; // Set servo pin as an output pin // Set servo pin as an output pin // Set servo pin as an output pin // Set servo pin as an output pin // Set the motor position to the minimum // Set the motor position to the minimum // Set the motor position to the minimum // Set the motor position to the minimum nunchuck_init(); // send the initilization handshake Serial.print("NunchuckServo ready\n"); } http://www.instructables.com/id/Arduino-Projects/ void loop() { checkNunchuck1(); updateServo1(); // update servo 1 position checkNunchuck2(); updateServo2(); // update servo 2 position checkNunchuck3(); updateServo3(); // update servo 3 position checkNunchuck4(); updateServo4(); // update servo 4 position if( nunchuck_zbutton() ) // light the LED if z button is pressed digitalWrite(ledPin1, HIGH); else digitalWrite(ledPin1,LOW); if( nunchuck_cbutton() ) // light the LED if c button is pressed digitalWrite(ledPin2, HIGH); else digitalWrite(ledPin2,LOW); delay(1); } void checkNunchuck1() { if( loop_cnt > 100 ) { // loop()s is every 1msec, this is every 100msec nunchuck_get_data(); nunchuck_print_data(); float tilt = nunchuck_accelx(); // x-axis, in this case ranges from ~70 - ~185 tilt = (tilt - 70) * 1.5; // convert to angle in degrees, roughly pulseWidth1 = (tilt * 9) + minPulse; // convert angle to microseconds loop_cnt = 0; // reset for } loop_cnt++; } // called every loop(). // uses global variables servoPin, pulsewidth, lastPulse, & refreshTime void updateServo1() { // pulse the servo again if rhe refresh time (20 ms) have passed: if (millis() - lastPulse1 >= refreshTime) { digitalWrite(servoPin1, HIGH); // Turn the motor on delayMicroseconds(pulseWidth1); // Length of the pulse sets the motor position digitalWrite(servoPin1, LOW); // Turn the motor off lastPulse1 = millis(); // save the time of the last pulse } } void checkNunchuck2() { if( loop_cnt > 100 ) { // loop()s is every 1msec, this is every 100msec nunchuck_get_data(); nunchuck_print_data(); float tilt = nunchuck_accely(); // y-axis, in this case ranges from ~70 - ~185 tilt = (tilt - 70) * 1.5; // convert to angle in degrees, roughly pulseWidth2 = (tilt * 9) + minPulse; // convert angle to microseconds loop_cnt = 0; // reset for } loop_cnt++; } // called every loop(). // uses global variables servoPin, pulsewidth, lastPulse, & refreshTime void updateServo2() { // pulse the servo again if rhe refresh time (20 ms) have passed: if (millis() - lastPulse2 >= refreshTime) { digitalWrite(servoPin2, HIGH); // Turn the motor on delayMicroseconds(pulseWidth2); // Length of the pulse sets the motor position digitalWrite(servoPin2, LOW); // Turn the motor off lastPulse2 = millis(); // save the time of the last pulse } } // this is here to give a known time per loop http://www.instructables.com/id/Arduino-Projects/ void checkNunchuck3() { if( loop_cnt > 100 ) { // loop()s is every 1msec, this is every 100msec nunchuck_get_data(); nunchuck_print_data(); float tilt = nunchuck_joyx(); // x-axis, in this case ranges from ~70 - ~185 tilt = (tilt - 70) * 1.5; // convert to angle in degrees, roughly pulseWidth3 = (tilt * 9) + minPulse; // convert angle to microseconds loop_cnt = 0; // reset for } loop_cnt++; } // called every loop(). // uses global variables servoPin, pulsewidth, lastPulse, & refreshTime void updateServo3() { // pulse the servo again if rhe refresh time (20 ms) have passed: if (millis() - lastPulse3 >= refreshTime) { digitalWrite(servoPin3, HIGH); // Turn the motor on delayMicroseconds(pulseWidth3); // Length of the pulse sets the motor position digitalWrite(servoPin3, LOW); // Turn the motor off lastPulse3 = millis(); // save the time of the last pulse } } void checkNunchuck4() { if( loop_cnt > 100 ) { // loop()s is every 1msec, this is every 100msec nunchuck_get_data(); nunchuck_print_data(); float tilt = nunchuck_joyy(); // y-axis, in this case ranges from ~70 - ~185 tilt = (tilt - 70) * 1.5; // convert to angle in degrees, roughly pulseWidth4 = (tilt * 9) + minPulse; // convert angle to microseconds loop_cnt = 0; // reset for } loop_cnt++; } // called every loop(). // uses global variables servoPin, pulsewidth, lastPulse, & refreshTime void updateServo4() { // pulse the servo again if rhe refresh time (20 ms) have passed: if (millis() - lastPulse4 >= refreshTime) { digitalWrite(servoPin4, HIGH); // Turn the motor on delayMicroseconds(pulseWidth4); // Length of the pulse sets the motor position digitalWrite(servoPin4, LOW); // Turn the motor off lastPulse4 = millis(); // save the time of the last pulse } } // // Nunchuck functions // static uint8_t nunchuck_buf[6]; // array to store nunchuck data, // initialize the I2C system, join the I2C bus, // and tell the nunchuck we're talking to it void nunchuck_init() { Wire.begin(); // join i2c bus as master Wire.beginTransmission(0x52); // transmit to device 0x52 Wire.send(0x40); // sends memory address Wire.send(0x00); // sends sent a zero. Wire.endTransmission(); // stop transmitting } // Send a request for data to the nunchuck // was "send_zero()" void nunchuck_send_request() { Wire.beginTransmission(0x52); // transmit to device 0x52 Wire.send(0x00); // sends one byte http://www.instructables.com/id/Arduino-Projects/ Wire.endTransmission(); } // stop transmitting // Receive data back from the nunchuck, // returns 1 on successful read. returns 0 on failure int nunchuck_get_data() { int cnt=0; Wire.requestFrom (0x52, 6); // request data from nunchuck while (Wire.available ()) { // receive byte as an integer nunchuck_buf[cnt] = nunchuk_decode_byte(Wire.receive()); cnt++; } nunchuck_send_request(); // send request for next data payload // If we recieved the 6 bytes, then go print them if (cnt >= 5) { return 1; // success } return 0; //failure } // Print the input data we have recieved // accel data is 10 bits long // so we read 8 bits, then we have to add // on the last 2 bits. That is why I // multiply them by 2 * 2 void nunchuck_print_data() { static int i=0; int joy_x_axis = nunchuck_buf[0]; int joy_y_axis = nunchuck_buf[1]; int accel_x_axis = nunchuck_buf[2]; // * 2 * 2; int accel_y_axis = nunchuck_buf[3]; // * 2 * 2; int accel_z_axis = nunchuck_buf[4]; // * 2 * 2; int z_button = 0; int c_button = 0; // byte nunchuck_buf[5] contains bits for z and c buttons // it also contains the least significant bits for the accelerometer data // so we have to check each bit of byte outbuf[5] if ((nunchuck_buf[5] >> 0) & 1) z_button = 1; if ((nunchuck_buf[5] >> 1) & 1) c_button = 1; if ((nunchuck_buf[5] >> 2) & 1) accel_x_axis += 2; if ((nunchuck_buf[5] >> 3) & 1) accel_x_axis += 1; if ((nunchuck_buf[5] >> 4) & 1) accel_y_axis += 2; if ((nunchuck_buf[5] >> 5) & 1) accel_y_axis += 1; if ((nunchuck_buf[5] >> 6) & 1) accel_z_axis += 2; if ((nunchuck_buf[5] >> 7) & 1) accel_z_axis += 1; Serial.print(i,DEC); Serial.print("\t"); Serial.print("joy:"); Serial.print(joy_x_axis,DEC); Serial.print(","); Serial.print(joy_y_axis, DEC); Serial.print(" \t"); Serial.print("acc:"); Serial.print(accel_x_axis, DEC); Serial.print(","); Serial.print(accel_y_axis, DEC); Serial.print(","); Serial.print(accel_z_axis, DEC); Serial.print("\t"); Serial.print("but:"); Serial.print(z_button, DEC); Serial.print(","); Serial.print(c_button, DEC); Serial.print("\r\n"); // newline http://www.instructables.com/id/Arduino-Projects/ i++; } // Encode data to format that most wiimote drivers except // only needed if you use one of the regular wiimote drivers char nunchuk_decode_byte (char x) { x = (x ^ 0x17) + 0x17; return x; } // returns zbutton state: 1=pressed, 0=notpressed int nunchuck_zbutton() { return ((nunchuck_buf[5] >> 0) & 1) ? 0 : 1; // voodoo } // returns zbutton state: 1=pressed, 0=notpressed int nunchuck_cbutton() { return ((nunchuck_buf[5] >> 1) & 1) ? 0 : 1; // voodoo } // returns value of x-axis joystick int nunchuck_joyx() { return nunchuck_buf[0]; } // returns value of y-axis joystick int nunchuck_joyy() { return nunchuck_buf[1]; } // returns value of x-axis accelerometer int nunchuck_accelx() { return nunchuck_buf[2]; // FIXME: this leaves out 2-bits of the data } // returns value of y-axis accelerometer int nunchuck_accely() { return nunchuck_buf[3]; // FIXME: this leaves out 2-bits of the data } // returns value of z-axis accelerometer int nunchuck_accelz() { return nunchuck_buf[4]; // FIXME: this leaves out 2-bits of the data } http://www.instructables.com/id/Arduino-Projects/ Step 11: Predator cannon Example 7- Predator cannon Using a modified Wii nunchuck board we can make a "head tracking" system to control an animatronic Predator cannon. This system was designed to look like the cannon mechanism in the first Predator movie. The nunchuck board is removed from its case, the joystick is removed and the board is placed level in the top of the Predator Bio helmet. The wires are extended for the buttons so they can be used as fingertip buttons to activate the cannon and trigger the firing sequence. To remove the circuit board from the Wii nunchuck case you'll need a tri-wing screwdriverhttp://www.play-asia.com/paOS-13-71-1e-49-en-70-1fe.html The sound effect is handled just like the Iron Man repulsor in example 4 using the Adafruit Wave Shield. Since the Wave Shield code used can support six individual sounds you can add five other Predator sounds and activate them using fingertip switches- neat! There is one servo that is geared 4:1 that raises the cannon arm- in the code you can see this as the servo rotating 180 degrees, thereby raising the cannon arm 45 degrees. The other two servos aim the cannon using the accelerometer inputs. There are transistors that turn on the aiming servos and laser sight when one button is pressed. If the aiming servos were always on then the cannon would rotate even when it was in the lowered position, so they need a way of being turned off when the cannon is lowered. So push one one button and the cannon raises up, the aiming servos turn on and the laser sight turns on. Push the second button and the cannon fires- two transistors turn on the cannon LED and activate the firing sound. Three red LEDs can be used in place of the laser sight. The cannon LED can be anything from several small LEDs to a high power Luxeon LED. When using a high power Luxeon LED be sure to use a constant current driver to power it. Servos can draw a fair bit of power so I use a TIP 120 transistor to turn on the aiming servos. The prototype cannon mechanism was built using Delrin plastic scraps and timing belts and gears from old desktop printers and photocopiers I found in the trash. When I build the final version for the Predator costume it will probably be entirely gear driven to make it more compact and cleaner. For Predator costuming info check out http://www.thehunterslair.com Those individuals interested in obtaining a resin cannon casting should contact my friend Carl here- http://www.accurizedhunterparts.com/ Carl's work is absolutely brilliant- check out the photos below of the Predator backpack clay sculpt that he created for this project. That's a lot of clay! When contacting Carl please be patient as he's extremely busy and he has a large backlog of work. Here's the code/* * Example 7 * Predator Cannon * This uses a modified Wii nunchuck as a head tracking input device to control an animatronic Predator cannon * Adafruit Wave shield is used for sound effects * Honus 2007, updated 2010 * Wii nunchuck reading code modified/extended from nunchuck code by Tod E. Kurt and Windmeadow Labs * 2007 Tod E. Kurt, http://todbot.com/blog/ * The Wii Nunchuck reading code is taken from Windmeadow Labs, http://www.windmeadow.com/node/42 */ #include "Wire.h" // include the Wire library #include "Servo.h" // include the servo library Servo servo3; // creates an instance of the servo object to control a servo int controlPin1 = 6; // Control pin for sound effects board using z button int transistorPin1 = 13; // Control pin for LED using z button int transistorPin2 = 12; // Control pin for laser sight using c button int transistorPin3 = 11; // Control pin for servo 1 using c button int transistorPin4 = 10; // Control pin for servo 2 using c button int servoPin1 = 7; // Control pin for servo 1 using accelerometer x axis int servoPin2 = 8; // Control pin for servo 2 using accelerometer y axis int servoPin3 = 9; // control pin for arm servo int pulseWidth1 = 0; // Amount to pulse the servo 1 int pulseWidth2 = 0; // Amount to pulse the servo 2 http://www.instructables.com/id/Arduino-Projects/ int refreshTime = 20; // the time in millisecs needed in between servo pulses long lastPulse1; long lastPulse2; int minPulse = 700; // minimum servo pulse width int loop_cnt=0; boolean button_down = false; unsigned long start; void setup() { Serial.begin(19200); servo3.attach(servoPin3); // attaches the servo on pin 9 to the servo object pinMode(controlPin1, OUTPUT); // Set control pin 1 as output pinMode(transistorPin1, OUTPUT); // Set transistor pin 1 as output pinMode(transistorPin2, OUTPUT); // Set transistor pin 2 as output pinMode(transistorPin3, OUTPUT); // Set transistor pin 3 as output pinMode(transistorPin4, OUTPUT); // Set transistor pin 4 as output pinMode(servoPin1, OUTPUT); // Set servo pin 1 as output pinMode(servoPin2, OUTPUT); // Set servo pin 2 as output pulseWidth1 = minPulse; // Set the servo position to the minimum pulseWidth2 = minPulse; // Set the servo position to the minimum nunchuck_init(); // send the initilization handshake Serial.print("NunchuckServo ready\n"); } void loop() { checkNunchuck1(); updateServo1(); // update servo 1 position checkNunchuck2(); updateServo2(); // update servo 2 position if( nunchuck_cbutton() ) { digitalWrite(transistorPin2, HIGH); // turn on transistor pin 2 if c button is pressed digitalWrite(transistorPin3, HIGH); // turn on transistor pin 3 if c button is pressed digitalWrite(transistorPin4, HIGH); // turn on transistor pin 4 if c button is pressed servo3.write(180); } else { digitalWrite(transistorPin2, LOW); digitalWrite(transistorPin3, LOW); digitalWrite(transistorPin4, LOW); servo3.write(0); } if ( nunchuck_zbutton() ) { if (!button_down) // if button was just pressed do this { digitalWrite(controlPin1, HIGH); button_down = true; start = millis(); } else if (millis() - start > 1200) // if timer has elapsed do this { digitalWrite(transistorPin1, HIGH); } } else // if button is up do this { button_down = false; digitalWrite(controlPin1, LOW); digitalWrite(transistorPin1, LOW); } delay(1); // this is here to give a known time per loop } void checkNunchuck1() { if( loop_cnt > 100 ) { // loop()s is every 1msec, this is every 100msec nunchuck_get_data(); nunchuck_print_data(); http://www.instructables.com/id/Arduino-Projects/ float tilt = nunchuck_accelx(); // x-axis, in this case ranges from ~70 - ~185 tilt = (tilt - 70) * 1.5; // convert to angle in degrees, roughly pulseWidth1 = (tilt * 9) + minPulse; // convert angle to microseconds loop_cnt = 0; // reset for } loop_cnt++; } // called every loop(). // uses global variables servoPin, pulsewidth, lastPulse, & refreshTime void updateServo1() { // pulse the servo again if rhe refresh time (20 ms) have passed: if (millis() - lastPulse1 >= refreshTime) { digitalWrite(servoPin1, HIGH); // Turn the servo on delayMicroseconds(pulseWidth1); // Length of the pulse sets the servo position digitalWrite(servoPin1, LOW); // Turn the servo off lastPulse1 = millis(); // save the time of the last pulse } } void checkNunchuck2() { if( loop_cnt > 100 ) { // loop()s is every 1msec, this is every 100msec nunchuck_get_data(); nunchuck_print_data(); float tilt = nunchuck_accely(); // y-axis, in this case ranges from ~70 - ~185 tilt = (tilt - 70) * 1.5; // convert to angle in degrees, roughly pulseWidth2 = (tilt * 9) + minPulse; // convert angle to microseconds loop_cnt = 0; // reset for } loop_cnt++; } // called every loop(). // uses global variables servoPin, pulsewidth, lastPulse, & refreshTime void updateServo2() { // pulse the servo again if rhe refresh time (20 ms) have passed: if (millis() - lastPulse2 >= refreshTime) { digitalWrite(servoPin2, HIGH); // Turn the servo on delayMicroseconds(pulseWidth2); // Length of the pulse sets the servo position digitalWrite(servoPin2, LOW); // Turn the servo off lastPulse2 = millis(); // save the time of the last pulse } } // // Nunchuck functions // static uint8_t nunchuck_buf[6]; // array to store nunchuck data, // initialize the I2C system, join the I2C bus, // and tell the nunchuck we're talking to it void nunchuck_init() { Wire.begin(); // join i2c bus as master Wire.beginTransmission(0x52); // transmit to device 0x52 Wire.send(0x40); // sends memory address Wire.send(0x00); // sends sent a zero. Wire.endTransmission(); // stop transmitting } // Send a request for data to the nunchuck // was "send_zero()" void nunchuck_send_request() { Wire.beginTransmission(0x52); // transmit to device 0x52 Wire.send(0x00); // sends one byte Wire.endTransmission(); // stop transmitting } // Receive data back from the nunchuck, // returns 1 on successful read. returns 0 on failure int nunchuck_get_data() { int cnt=0; http://www.instructables.com/id/Arduino-Projects/ Wire.requestFrom (0x52, 6); // request data from nunchuck while (Wire.available ()) { // receive byte as an integer nunchuck_buf[cnt] = nunchuk_decode_byte(Wire.receive()); cnt++; } nunchuck_send_request(); // send request for next data payload // If we recieved the 6 bytes, then go print them if (cnt >= 5) { return 1; // success } return 0; //failure } // Print the input data we have recieved // accel data is 10 bits long // so we read 8 bits, then we have to add // on the last 2 bits. That is why I // multiply them by 2 * 2 void nunchuck_print_data() { static int i=0; int joy_x_axis = nunchuck_buf[0]; int joy_y_axis = nunchuck_buf[1]; int accel_x_axis = nunchuck_buf[2]; // * 2 * 2; int accel_y_axis = nunchuck_buf[3]; // * 2 * 2; int accel_z_axis = nunchuck_buf[4]; // * 2 * 2; int z_button = 0; int c_button = 0; // byte nunchuck_buf[5] contains bits for z and c buttons // it also contains the least significant bits for the accelerometer data // so we have to check each bit of byte outbuf[5] if ((nunchuck_buf[5] >> 0) & 1) z_button = 1; if ((nunchuck_buf[5] >> 1) & 1) c_button = 1; if ((nunchuck_buf[5] >> 2) & 1) accel_x_axis += 2; if ((nunchuck_buf[5] >> 3) & 1) accel_x_axis += 1; if ((nunchuck_buf[5] >> 4) & 1) accel_y_axis += 2; if ((nunchuck_buf[5] >> 5) & 1) accel_y_axis += 1; if ((nunchuck_buf[5] >> 6) & 1) accel_z_axis += 2; if ((nunchuck_buf[5] >> 7) & 1) accel_z_axis += 1; Serial.print(i,DEC); Serial.print("\t"); Serial.print("joy:"); Serial.print(joy_x_axis,DEC); Serial.print(","); Serial.print(joy_y_axis, DEC); Serial.print(" \t"); Serial.print("acc:"); Serial.print(accel_x_axis, DEC); Serial.print(","); Serial.print(accel_y_axis, DEC); Serial.print(","); Serial.print(accel_z_axis, DEC); Serial.print("\t"); Serial.print("but:"); Serial.print(z_button, DEC); Serial.print(","); Serial.print(c_button, DEC); Serial.print("\r\n"); // newline i++; } // Encode data to format that most wiimote drivers except // only needed if you use one of the regular wiimote drivers char nunchuk_decode_byte (char x) { x = (x ^ 0x17) + 0x17; http://www.instructables.com/id/Arduino-Projects/ return x; } // returns zbutton state: 1=pressed, 0=notpressed int nunchuck_zbutton() { return ((nunchuck_buf[5] >> 0) & 1) ? 0 : 1; // voodoo } // returns zbutton state: 1=pressed, 0=notpressed int nunchuck_cbutton() { return ((nunchuck_buf[5] >> 1) & 1) ? 0 : 1; // voodoo } // returns value of x-axis joystick int nunchuck_joyx() { return nunchuck_buf[0]; } // returns value of y-axis joystick int nunchuck_joyy() { return nunchuck_buf[1]; } // returns value of x-axis accelerometer int nunchuck_accelx() { return nunchuck_buf[2]; // FIXME: this leaves out 2-bits of the data } // returns value of y-axis accelerometer int nunchuck_accely() { return nunchuck_buf[3]; // FIXME: this leaves out 2-bits of the data } // returns value of z-axis accelerometer int nunchuck_accelz() { return nunchuck_buf[4]; // FIXME: this leaves out 2-bits of the data } Image Notes 1. resin cast Predator cannon http://www.instructables.com/id/Arduino-Projects/ Image Notes 1. This is the folded down position Image Notes 1. rotation servo Hitec HS80 2. Luxeon LED 3. Delrin arm Image Notes 1. Arm servo geared 4:1 Servo is Hitec HS645MG 2. Servo to control cannon pitch movement Servo is Hitec HS605BB Image Notes 1. Wii nunchuck guts top view http://www.instructables.com/id/Arduino-Projects/ Image Notes 1. Wii nunchuck guts bottom view Image Notes 1. Nunchuck board top with joystick removed This is necessary to get it to fit in the Predator Bio helmet Image Notes 1. nunchuck finger buttons with extended wires Image Notes 1. Wii nunchuck board bottom with joystick removed The joystick can be a real pain to remove http://www.instructables.com/id/Arduino-Projects/ Image Notes 1. nunchuck wires with straight pin connector soldered on Image Notes 1. Adafruit Wave Shield- This is THE device to have to add sound to any Arduino project http://www.instructables.com/id/Arduino-Projects/ File Downloads CannonSound.WAV (199 KB) [NOTE: When saving, if you see .tmp as the file ext, rename it to 'CannonSound.WAV'] Step 12: War Machine cannon Example 8- War Machine cannon You want to be the War Machine? This example is based on the Predator cannon but uses a motor connected to a transistor to spin the cannon barrels. When you push the fire button the motor turns on. There is a 1N4004 diode to prevent back voltage from the motor damaging the controller output pin. A War Machine cannon is substantially larger than a Predator cannon and would require larger, more powerful servos so I have individual TIP 120 transistors shown on the wiring diagram. For mounting the cannon Servocity sells pan/tilt mechanisms that would be perfect for this applicationhttp://www.servocity.com/html/spt200_pan___tilt_system.html /* * Example 8 * Iron Man War Machine Cannon * This uses a modified Wii nunchuck as a head tracking input device to control an animatronic Iron Man War Machine cannon * Adafruit Wave shield is used for sound effects * Honus 2010 * Wii nunchuck reading code modified/extended from nunchuck code by Tod E. Kurt and Windmeadow Labs * 2007 Tod E. Kurt, http://todbot.com/blog/ * The Wii Nunchuck reading code is taken from Windmeadow Labs, http://www.windmeadow.com/node/42 */ #include "Wire.h" // include the Wire library int controlPin1 = 7; // Control pin for sound effects board using z button int transistorPin1 = 13; // Control pin for cannon LED using z button http://www.instructables.com/id/Arduino-Projects/ int transistorPin2 = 12; // Control pin for servo 1 using c button int transistorPin3 = 11; // Control pin for servo 2 using c button int transistorPin4 = 10; // Control pin for cannon motor using z button int servoPin1 = 9; // Control pin for servo 1 using accelerometer x axis int servoPin2 = 8; // Control pin for servo 2 using accelerometer y axis int pulseWidth1 = 0; // Amount to pulse the servo 1 int pulseWidth2 = 0; // Amount to pulse the servo 2 int refreshTime = 20; // the time in millisecs needed in between servo pulses long lastPulse1; long lastPulse2; int minPulse = 700; // minimum servo pulse width int loop_cnt=0; boolean button_down = false; unsigned long start; void setup() { Serial.begin(19200); pinMode(controlPin1, OUTPUT); // Set control pin 1 as output pinMode(transistorPin1, OUTPUT); // Set transistor pin 1 as output pinMode(transistorPin2, OUTPUT); // Set transistor pin 2 as output pinMode(transistorPin3, OUTPUT); // Set transistor pin 3 as output pinMode(transistorPin4, OUTPUT); // Set transistor pin 4 as output pinMode(servoPin1, OUTPUT); // Set servo pin 1 as output pinMode(servoPin2, OUTPUT); // Set servo pin 2 as output pulseWidth1 = minPulse; // Set the servo position to the minimum pulseWidth2 = minPulse; // Set the servo position to the minimum nunchuck_init(); // send the initilization handshake Serial.print("NunchuckServo ready\n"); } void loop() { checkNunchuck1(); updateServo1(); // update servo 1 position checkNunchuck2(); updateServo2(); // update servo 2 position if( nunchuck_cbutton() ) { digitalWrite(transistorPin2, HIGH); // turn on transistor pin 2 if c button is pressed digitalWrite(transistorPin3, HIGH); // turn on transistor pin 3 if c button is pressed } else { digitalWrite(transistorPin2, LOW); // turn off transistor pin 2 digitalWrite(transistorPin3, LOW); } if ( nunchuck_zbutton() ) { if (!button_down) // if button was just pressed do this { digitalWrite(controlPin1, HIGH); // turn on sound effect button_down = true; start = millis(); } else if (millis() - start > 1200) // if timer has elapsed do this { digitalWrite(transistorPin1, HIGH); // turn on cannon LED digitalWrite(transistorPin4, HIGH); // turn on cannon motor } } else // if button is up do this { button_down = false; digitalWrite(controlPin1, LOW); // turn off sound effect digitalWrite(transistorPin1, LOW); // turn off cannon LED digitalWrite(transistorPin4, LOW); // turn off cannon motor } delay(1); // this is here to give a known time per loop } void checkNunchuck1() { http://www.instructables.com/id/Arduino-Projects/ if( loop_cnt > 100 ) { // loop()s is every 1msec, this is every 100msec nunchuck_get_data(); nunchuck_print_data(); float tilt = nunchuck_accelx(); // x-axis, in this case ranges from ~70 - ~185 tilt = (tilt - 70) * 1.5; // convert to angle in degrees, roughly pulseWidth1 = (tilt * 9) + minPulse; // convert angle to microseconds loop_cnt = 0; // reset for } loop_cnt++; } // called every loop(). // uses global variables servoPin, pulsewidth, lastPulse, & refreshTime void updateServo1() { // pulse the servo again if rhe refresh time (20 ms) have passed: if (millis() - lastPulse1 >= refreshTime) { digitalWrite(servoPin1, HIGH); // Turn the servo on delayMicroseconds(pulseWidth1); // Length of the pulse sets the servo position digitalWrite(servoPin1, LOW); // Turn the servo off lastPulse1 = millis(); // save the time of the last pulse } } void checkNunchuck2() { if( loop_cnt > 100 ) { // loop()s is every 1msec, this is every 100msec nunchuck_get_data(); nunchuck_print_data(); float tilt = nunchuck_accely(); // y-axis, in this case ranges from ~70 - ~185 tilt = (tilt - 70) * 1.5; // convert to angle in degrees, roughly pulseWidth2 = (tilt * 9) + minPulse; // convert angle to microseconds loop_cnt = 0; // reset for } loop_cnt++; } // called every loop(). // uses global variables servoPin, pulsewidth, lastPulse, & refreshTime void updateServo2() { // pulse the servo again if rhe refresh time (20 ms) have passed: if (millis() - lastPulse2 >= refreshTime) { digitalWrite(servoPin2, HIGH); // Turn the servo on delayMicroseconds(pulseWidth2); // Length of the pulse sets the servo position digitalWrite(servoPin2, LOW); // Turn the servo off lastPulse2 = millis(); // save the time of the last pulse } } // // Nunchuck functions // static uint8_t nunchuck_buf[6]; // array to store nunchuck data, // initialize the I2C system, join the I2C bus, // and tell the nunchuck we're talking to it void nunchuck_init() { Wire.begin(); // join i2c bus as master Wire.beginTransmission(0x52); // transmit to device 0x52 Wire.send(0x40); // sends memory address Wire.send(0x00); // sends sent a zero. Wire.endTransmission(); // stop transmitting } // Send a request for data to the nunchuck // was "send_zero()" void nunchuck_send_request() { Wire.beginTransmission(0x52); // transmit to device 0x52 Wire.send(0x00); // sends one byte Wire.endTransmission(); // stop transmitting } // Receive data back from the nunchuck, // returns 1 on successful read. returns 0 on failure http://www.instructables.com/id/Arduino-Projects/ int nunchuck_get_data() { int cnt=0; Wire.requestFrom (0x52, 6); // request data from nunchuck while (Wire.available ()) { // receive byte as an integer nunchuck_buf[cnt] = nunchuk_decode_byte(Wire.receive()); cnt++; } nunchuck_send_request(); // send request for next data payload // If we recieved the 6 bytes, then go print them if (cnt >= 5) { return 1; // success } return 0; //failure } // Print the input data we have recieved // accel data is 10 bits long // so we read 8 bits, then we have to add // on the last 2 bits. That is why I // multiply them by 2 * 2 void nunchuck_print_data() { static int i=0; int joy_x_axis = nunchuck_buf[0]; int joy_y_axis = nunchuck_buf[1]; int accel_x_axis = nunchuck_buf[2]; // * 2 * 2; int accel_y_axis = nunchuck_buf[3]; // * 2 * 2; int accel_z_axis = nunchuck_buf[4]; // * 2 * 2; int z_button = 0; int c_button = 0; // byte nunchuck_buf[5] contains bits for z and c buttons // it also contains the least significant bits for the accelerometer data // so we have to check each bit of byte outbuf[5] if ((nunchuck_buf[5] >> 0) & 1) z_button = 1; if ((nunchuck_buf[5] >> 1) & 1) c_button = 1; if ((nunchuck_buf[5] >> 2) & 1) accel_x_axis += 2; if ((nunchuck_buf[5] >> 3) & 1) accel_x_axis += 1; if ((nunchuck_buf[5] >> 4) & 1) accel_y_axis += 2; if ((nunchuck_buf[5] >> 5) & 1) accel_y_axis += 1; if ((nunchuck_buf[5] >> 6) & 1) accel_z_axis += 2; if ((nunchuck_buf[5] >> 7) & 1) accel_z_axis += 1; Serial.print(i,DEC); Serial.print("\t"); Serial.print("joy:"); Serial.print(joy_x_axis,DEC); Serial.print(","); Serial.print(joy_y_axis, DEC); Serial.print(" \t"); Serial.print("acc:"); Serial.print(accel_x_axis, DEC); Serial.print(","); Serial.print(accel_y_axis, DEC); Serial.print(","); Serial.print(accel_z_axis, DEC); Serial.print("\t"); Serial.print("but:"); Serial.print(z_button, DEC); Serial.print(","); Serial.print(c_button, DEC); Serial.print("\r\n"); // newline i++; } // Encode data to format that most wiimote drivers except // only needed if you use one of the regular wiimote drivers http://www.instructables.com/id/Arduino-Projects/ char nunchuk_decode_byte (char x) { x = (x ^ 0x17) + 0x17; return x; } // returns zbutton state: 1=pressed, 0=notpressed int nunchuck_zbutton() { return ((nunchuck_buf[5] >> 0) & 1) ? 0 : 1; // voodoo } // returns zbutton state: 1=pressed, 0=notpressed int nunchuck_cbutton() { return ((nunchuck_buf[5] >> 1) & 1) ? 0 : 1; // voodoo } // returns value of x-axis joystick int nunchuck_joyx() { return nunchuck_buf[0]; } // returns value of y-axis joystick int nunchuck_joyy() { return nunchuck_buf[1]; } // returns value of x-axis accelerometer int nunchuck_accelx() { return nunchuck_buf[2]; // FIXME: this leaves out 2-bits of the data } // returns value of y-axis accelerometer int nunchuck_accely() { return nunchuck_buf[3]; // FIXME: this leaves out 2-bits of the data } // returns value of z-axis accelerometer int nunchuck_accelz() { return nunchuck_buf[4]; // FIXME: this leaves out 2-bits of the data } http://www.instructables.com/id/Arduino-Projects/ Step 13: Going wireless with XBee Example 9- Wireless XBee radios This allows you to use the Nunchuck control but does it by setting up one controller as a transmitter and another controller as the receiver. I use the Adafruit XBee wireless adapter because it's super easy to use and can work on both 3V and 5V so it's great for most any Arduino wireless project. The servo board is set up for point to point communication and the XBee adapter plugs directly into a socket at the top of the board. This setup would really well for controlling haunted house attractions. You can get the XBee adapter and radios herehttp://www.adafruit.com/index.php?main_page=product_info&cPath=29&products_id=126 There is a complete XBee tutorial for building the XBee adapter and configuring it herehttp://www.ladyada.net/make/xbee/ Unlike the previous nuchuck control code, this code uses a new nunchuck library that cleans up the code considerably. It is called nunchuck_funcs.h You can get it herehttp://todbot.com/blog/2008/02/18/wiichuck-wii-nunchuck-adapter-available/comment-page-3/ Simply place the nunchuck_funcs.h library into your Arduino libraries folder and you're good to go. The wiring for this is exactly like the wiring for example 6 except the nunchuck is connected to the transmitter and the servos and LEDs are connected to the receiver. Note- you cannot connect the USB to serial adapter while the XBee adapter is plugged into its socket as they use the same data transmission lines. You must program the controller first and then plug in the XBee adapter. If you need to be able to monitor the serial port while using the XBee you can use a couple of wires to connect the XBee RX and TX to digital out pins 2 and 3 as shown in the Adafruit point-to-point tutorial. Here's the code for the transmitter/* * Example 9a * Nunchuck XBee transmitter * This code uses the nunchuck functions library and an XBee radio (w/ Adafruit XBee adapter) * to make a Wii nunchuck a wireless input device * Honus 2010 * Nunchuck functions library from Tod E. Kurt, http://todbot.com/blog */ #include "Wire.h" // include the Wire library #include "nunchuck_funcs.h" // include the nunchuck functions library int loop_cnt=0; byte accx,accy,zbut,cbut,joyy,joyx; int ledPin = 13; void setup() { Serial.begin(9600); nunchuck_setpowerpins(); nunchuck_init(); // send the initilization handshake pinMode(ledPin, OUTPUT); } void loop() { digitalWrite(ledPin, HIGH); // set the LED on if( loop_cnt > 100 ) { // every 100 msecs get new data loop_cnt = 0; nunchuck_get_data(); accx = nunchuck_accelx(); // ranges from approx 70 - 182 accy = nunchuck_accely(); // ranges from approx 65 - 173 zbut = nunchuck_zbutton(); cbut = nunchuck_cbutton(); joyx = nunchuck_joyx(); joyy = nunchuck_joyy(); Serial.print("joyx:"); Serial.print((byte)joyx,DEC); Serial.print("joyy:"); Serial.print((byte)joyy,DEC); Serial.print("accx:"); Serial.print((byte)accx,DEC); Serial.print("accy:"); Serial.print((byte)accy,DEC); Serial.print("\tzbut:"); Serial.print((byte)zbut,DEC); Serial.print("\tcbut:"); Serial.println((byte)cbut,DEC); } loop_cnt++; delay(1); http://www.instructables.com/id/Arduino-Projects/ } Here's the code for the receiver/* * Example 9b * Nunchuck XBee receiver * This code receives input from a Wii nunchuck using an XBee radio (w/ Adafruit XBee adapter) * and controls four servos and two digital pins to turn on LEDs * Honus 2010 */ #include "Servo.h" // include the Servo library int joyx,joyy = 135; int accx,accy = 135; int zbut,cbut = 0; int ledPin1 = 13; int ledPin2 = 12; int lightvalue1 = 255; int lightvalue2 = 255; char nunchuckData; int val = 0; int tempval = 0; int servo1Pos; int servo2Pos; int servo3Pos; int servo4Pos; int buttonState1 = 0; int buttonState2 = 0; int lightMode1 = 0; int lightMode2 = 0; Servo servo1; Servo servo2; Servo servo3; Servo servo4; int servoPin1 = 9; int servoPin2 = 8; int servoPin3 = 7; int servoPin4 = 6; void setup() { // Serial.begin(9600); // Serial.print("Nunchuck ready\n"); Serial.begin(9600); servo1.attach(servoPin1); servo2.attach(servoPin2); servo3.attach(servoPin3); servo4.attach(servoPin4); pinMode(ledPin1, OUTPUT); pinMode(ledPin2, OUTPUT); } void loop() { if (accy > 125) { servo1Pos = 90-(accy-125); if (servo2Pos < 45) servo1Pos = 45; servo1.write(servo1Pos); } if (accy < 125) { servo1Pos = 90+(125-accy); if (servo1Pos > 135) servo1Pos = 135; servo1.write(servo1Pos); } if (accx > 125) { servo2Pos = 90-(accx-125); if (servo2Pos < 45) servo2Pos = 45; servo2.write(servo2Pos); } if (accx < 125) { servo2Pos = 90+(125-accx); if (servo2Pos > 135) http://www.instructables.com/id/Arduino-Projects/ servo2Pos = 135; servo2.write(servo2Pos); } if (joyy > 125) { servo3Pos = 90-(joyy-125); if (servo3Pos < 45) servo3Pos = 45; servo3.write(servo3Pos); } if (joyy < 125) { servo3Pos = 90+(125-joyy); if (servo3Pos > 135) servo3Pos = 135; servo3.write(servo3Pos); } if (joyx > 125) { servo4Pos = 90-(joyx-125); if (servo4Pos < 45) servo4Pos = 45; servo4.write(servo4Pos); } if (joyx < 125) { servo4Pos = 90+(125-joyx); if (servo4Pos > 135) servo4Pos = 135; servo4.write(servo4Pos); } if (cbut != buttonState1) { // the button state has changed! if (cbut == 1) { // check if the button is pressed if (lightMode1 == 0) { // light is off lightMode1 = 1; // light is on! digitalWrite(ledPin1, HIGH); } else { lightMode1 = 0; // light is on! digitalWrite(ledPin1, LOW); } } } if (zbut != buttonState2) { // the button state has changed! if (zbut == 1) { // check if the button is pressed if (lightMode2 == 0) { // light is off lightMode2 = 1; // light is on! digitalWrite(ledPin2, HIGH); } else { lightMode2 = 0; // light is on! digitalWrite(ledPin2, LOW); } } } buttonState1 = cbut; // save the new state in our variable buttonState2 = zbut; // save the new state in our variable while(Serial.available()) { tempval = Serial.read(); if (tempval=='x') { nunchuckData='x'; val=0; } else if (tempval=='y') { nunchuckData='y'; val=0; } else if (tempval=='X') { nunchuckData='X'; val=0; } else if (tempval=='Y') { nunchuckData='Y'; val=0; } else if (tempval=='Z') { nunchuckData='Z'; val=0; } else if (tempval=='C') { nunchuckData='C'; http://www.instructables.com/id/Arduino-Projects/ val=0; } else if (tempval >='0' && tempval <= '9') { val=val * 10; val=val + (tempval - '0'); if (nunchuckData=='x'){ joyx=val; } else if (nunchuckData=='y'){ joyy=val; } else if (nunchuckData=='X'){ accx=val; } else if (nunchuckData=='Y'){ accy=val; } else if (nunchuckData=='Z'){ zbut=val; } else if (nunchuckData=='C'){ cbut=val; } } } //end of input in serial buffer } Image Notes 1. Adafruit XBee adapter plugs directly into the controller board http://www.instructables.com/id/Arduino-Projects/ Step 14: Resources So that's it for now- I'll be adding more code examples and mechanisms as time goes on. Here's some additional material to check out: AnimatronicsHere's an awesome show reel that displays the capabilities of animatronicshttp://www.johnnolanfilms.com/animatronics/showreel-flash-2010.php Soldering tutorialsThis is the first in a great series of SMD soldering tutorialshttp://www.sparkfun.com/tutorials/36 Basic soldering skillshttp://www.sparkfun.com/tutorials/106 Arduino tutorialshttp://www.ladyada.net/learn/arduino/index.html http://www.arduino.cc/playground/ Using Eagle to make PCBshttp://www.sparkfun.com/tutorials/108 BooksMAKE: Electronics- If you're just getting into electronics or need a refresher this is a great book http://www.amazon.com/MAKE-Electronics-Learning-Through-Discovery/dp/0596153740/ref=sr_1_1?s=books&ie=UTF8&qid=1291095250&sr=1-1 Making Things Talk- everything you ever wanted to know about Arduino and communication techniques http://www.amazon.com/Making-Things-Talk-Practical-Connecting/dp/0596510519/ref=sr_1_1?ie=UTF8&s=books&qid=1291014224&sr=1-1 Practical Arduino- A great book with awesome Arduino projects http://www.amazon.com/Practical-Arduino-Projects-Hardware-Technology/dp/1430224770/ref=sr_1_2?ie=UTF8&s=books&qid=1250109738&sr=8-2 Physical Computing- It's not Arduino specific as it predates it but it's THE book to have regarding physical computing; everything from servos and stepper motors to LEDs and sensors- it's all in there http://www.amazon.com/Physical-Computing-Sensing-Controlling-Computers/dp/159200346X/ref=sr_1_1?s=books&ie=UTF8&qid=1291014345&sr=1-1 Making Things Move- Looks like a great book for learning how to design all kinds of mechanisms. http://www.makingthingsmove.com/ http://www.amazon.com/dp/0071741674?tag=makingthingsm20&camp=14573&creative=327641&linkCode=as1&creativeASIN=0071741674&adid=1RG5X8SW1YZDQ0MMAXDR& No Strings Attached- A great book about the Jim Henson Creature shop http://www.amazon.com/No-Strings-Attached-Hensons-Creature/dp/185227669X/ref=sr_1_2?s=books&ie=UTF8&qid=1291014513&sr=1-2 The Winston Effect- Amazing photos and information about all kinds of animatronic creations http://www.amazon.com/Winston-Effect-History-Stan-Studio/dp/1845761502/ref=sr_1_1?ie=UTF8&s=books&qid=1291014636&sr=1-1 Step 15: FAQs Frequently asked questionsDo you offer a servo board kit? Nope- at least not yet. I might be coaxed into making a fully assembled board though... Will you do custom work? On occasion- message me to discuss your project. I need help with my own code/project- is there a forum for help? The Arduino forum is the place to gohttp://arduino.cc/cgi-bin/yabb2/YaBB.pl The Predator setup isn't really a true head tracking system- why? When I first started looking at this I had just envisioned a simple system that was controlled using bend sensors on your fingers and it wouldn't be able to look up and down. That really was a bit cumbersome to operate and wasn't very natural. Next I looked at keeping the bend sensor that would raise the cannon, but I figured out a system that had a cable mounted under the mask that turned a pulley/spring loaded potentiometer (mounted under the cannon mechanism) that would allow the cannon to follow your head rotation. It still wasn't able to look up/down. Now I got a natural (and smooth) rotation but fixing/routing the cable was difficult and cumbersome. Mask removal could also be a real problem. Then I started looking at different kinds of sensors. Gyroscopic, compass and accelerometers. Combo boards, IMUs (inertial measurement units), etc. I have a friend that is a data acquisition engineer as well as a friend that is a programmer and I spoke to several electrical engineers for help. Compasses are affected by tilt, so you have to compensate for that and then they don't work when you rotate your whole body vs. just your head, so dual compasses would be necessary and you would have to write code to differentiate between the two. The problem with gyros is that you need two of them, preferably with an accelerometer to account for drift as well as front/rear tilt (pitch). One gyro really won't work well because it will respond to whole body rotation as well as just head rotation, so you would need one IMU at the head and another at the cannon base and then you have to write some code to differentiate between the two. Gyros really only sense change in angular velocity so its output only changes with respect to movement and it will reset itself once you stop rotating your body- the cannon will quickly become out of sync with your movements. That's why to really do it right you need a multiple DOF (degree of freedom) IMU and you need two of them for true head tracking. Most of the systems I've seen that people post online as a head tracking system for R/C or video control that use these types of sensors have pretty poor yaw control and I think this is why. And they don't even have to deal with the body vs. head rotation issue http://www.instructables.com/id/Arduino-Projects/ as they can sit in a chair- not an option for costuming. There are IMUs and digital compasses available now that have on board processing and are programmed to account for drift and tilt so some of the hard work is done for you but you would still have to factor in the difference output of two of them and then generate your necessary servo movement values from that. It can be done but it's pretty darn expensive. Most of the solutions I found were pretty complex in terms of programming requiring sophisticated algorithms and/or extremely expensive on the hardware side. There are also pretty severe space restrictions for fitting sensors inside the Predator Bio helmet as some of the IMUs available are pretty large physically. Then I found that I could modify the sensor board out of a Wii nunchuck controller and interface it with a microcontroller over its I²C bus. This provided me with an inexpensive and reliable multi axis accelerometer and two finger pushbuttons with an easy to use interface. I ended up writing code that would allow me to access all of the nunchuck's functions- the accelerometer outputs, the joystick and the two pushbuttons. When it was all said and done the rotation was still a bit of a problem as the accelerometer only really gives you a stable output with respect to gravity so you have to tilt it to get the rotation. What I found was that if I mounted it as level as possible in Predator helmet it really didn't need much tilt at all to get a stable rotation. The beauty of this system is that there are only only two finger buttons to control everything- it's also pretty easy for me to modify the code. I haven't yet taken apart a Wii Motion Plus to combine it with a nunchuck to create an inexpensive IMU but I'll post the results when I do. What I did was to basically fake it by strictly using the accelerometer inputs- when looking sideways you just need to tilt your head to the side like a bird for yaw (rotation) control. The accelerometer reads the tilt and moves everything accordingly- the pitch function is normal. It does take a bit of getting used to but after a while it becomes more natural and it's very convincing. For costuming all you need to do is provide the illusion. When I started the project with a friend three years ago (he's sculpting the Pedator backpack) we wanted something that anyone could build from readily available building blocks to add some cool animatronics to their Predator costume without spending a ton of cash. Whew... I want to power my project and I only want to use one battery to supply different voltages- what do I do? I would use a switching step down voltage regulator like this onehttp://www.pololu.com/catalog/product/2110 It's far more efficient than using a traditional voltage regulator, especially if you need to use something like a 12V battery and drop it down to 5V for servo power. If you need to drop 5V to 3.3V then a traditional voltage regulator is fine. Just don't plug it into the JST connector on the controller board and then plug in a USB cable into the USB mini-B port for the charging circuit- that would be bad. Related Instructables How to create simple animatronicspart one: using the MAKE controller by Honus Robotic Talking Turret by RazorConcepts Animatronic Fawkes the Phoenix by makermike BONES NETMF halloween reaper prop (video) by Foekie Simple Animatronics with Servos by gzip Halloween Animatronics by mik3 Arduino Wireless Animatronic Hand by njkl44 Power Lacesthe Auto lacing shoe by blakebevin http://www.instructables.com/id/Arduino-Projects/ How to have fun with Arduino (and become a Geek in the process) by john otto on June 25, 2007 Author:john otto Hardworking demonoid engineer, struggling to reconcile my hobbies with a desire to conquer the universe. Intro: How to have fun with Arduino (and become a Geek in the process) Do you wish to earn your geek card - pronto? Lets get started! This guide will start you on the path to the dark side using the open source Arduino development and prototyping platform. It will introduce you to microcontrollers, get you started with a platform for physical computing and give you the confidence to create technological marvels. It is open source, inexpensive and a blast to learn. Image Notes 1. Isn't it cute. 2" X 3" of geek power. Step 1: Get yourself an Arduino The first step is to acquire an Arduino board. I highly recommend the USB version. You will need the USB A-B cable as well. Here is a link to the board: ArduinoBoard . Here is a link to the cable: USB Cable . Shopping online is fun, and it gets better when your toys come in the mail. http://www.instructables.com/id/Arduino-Projects/ Step 2: Where does the cable go? Here is the A side and its home This is the A side of the cable. You can plug it into any USB port. Image Notes 1. Plug me in for 5 volts of power! Step 3: And here is the B side of the cable The B side of the cable connects to the Arduino. Isn't this easy? Image Notes 1. This is the B connector on the Arduino. It acts as the communication link between your PC and the Arduino. The PC provides 5 volts to the Arduino through this cable. 2. This is the 9 volt power supply connector. Use this instead of the USB power for advanced projects like running motors that take more juice! http://www.instructables.com/id/Arduino-Projects/ Step 4: Powering your board There are 3 power pins with a jumper over two of them. The power jumper goes over the last two pins if you are using usb power (just like shown here). Lift off the jumper and push down over the first two if you are connecting 9 volts from a wall wart. Image Notes 1. Place the jumper over these two pins if you use the 9 volt connector 2. When the jumper is in this position your board is ready to accept 5 volt power from the usb cable, Step 5: External power using a wall wart If you move the jumper pins to the EXT position you can use a 9 volt wall wart to power your board. Want one? Go here: Wall Wart . Image Notes 1. Wallwart. Note this one has adjustable voltages and is set at 9V. Step 6: You can add the optional prototype board There is a prototype shield kit and breadboard available to add utility to your Arduino. Please see an excellent tutorial by Bob Gallup on how to assemble this here: ProtoshieldAssembly . Don't be afraid the linked tutorial will walk you through putting it together in a logical step by step procedure. Very well done! This prototype board is by no means necessary but it does add utility to your Arduino. You can get a prototype shield here: Protoshield . You can get the prototyping breadboard to mount to it here: Breadboard . http://www.instructables.com/id/Arduino-Projects/ Image Notes 1. This prototyping board is additional and does not come with the kit. Don't worry - its very inexpensive! Step 7: Protoshield & prototype board on top of your Arduino This is what the protoshield and prototype board will look like when you get it mounted. in this view I have not soldered all the components, but have just placed the parts together. Please see this link if you need help on how to solder (again thanks to the Sparkfun team!): Soldering . Image Notes 1. This dime is not included. 2. the 170 holes are spaced .100" apart. This is an electronics industry standard spacing so most components just plug right in. Step 8: What to do with a prototype board? Look at this. The prototype board will allow you to wire any circuit you can dream of. There are pre-cut & pre-bent wire kits available for this. I recommend you buy one as they are very handy and add to your geek image when seen on your work desk. Sparkfun sells one here: WireKit There are also other suppliers of these kits. Here is a link to a a wiki on prototype boards. You will see many circuits loaded on breadboards: http://en.wikipedia.org/wiki/Breadboard . Your circuits can be very simple or complex -you decide! Image Notes 1. Resistor plugged in and ready to resist. Step 9: There are pins & connectors on your Arduino too. If you choose not to get the protoshield & breadboard - no problem. The Arduino has digital input/output pins and analog input pins built right in. The Arduino has the sockets and is ready to go. http://www.instructables.com/id/Arduino-Projects/ Image Notes 1. Same .100" spacing here! Step 10: Next lets talk about the software The Arduino programming environment is free. That is what open-source is all about. It will work with Windows, Mac OS X, and Linux. and can be downloaded here: Software . Load the software and then the drivers. Don't worry they have an excellent description of this right here: Software Installation Guide . The picture shows a basic program to blink an LED (light emitting diode). All you need is one LED and it is attached to the pins as noted in the link above. The program is included with the software (along with so much more). Follow the instructions and soon you will have brought your board to life! Is your board is blinking after you have completed the instructions? Yes? Well you are, in my humble opinion, a GEEK like me. Congratulations! http://www.instructables.com/id/Arduino-Projects/ Step 11: So what is Physical Computing? Physical computing is using our own physical inputs and using microcontollers or computers to control outputs. Sure you can build a wild robot with the Arduino as Landon Cox has done: Landon Cox's Bot . But you can also wire sensors, LED's servos, displays and make art, express yourself, interpret our own physical inputs, or create a masterful adaptive device to help the disabled. Tom Igoe is much more eloquent at describing Physical Computing: Tom Igoe . Be creative, experiment, explore, solve a problem, and have fun doing it! Step 12: Whats Next? There are numerous tutorials available to help you master the Arduino. These will all teach you electronics along the way, and provide you the confidence to further your skills. This page on the Arduino website has a list of tutorials: Tutorials . I would recommend a look at the Spooky Arduino by Todbot tutorials (bottom right hand corner of page). Some of the things you will easily learn to do are: Read a tilt sensor, use a joystick to control lights, detect sounds, play melodies, drive motors, interface to LCD displays, read a digital compass, read a gps device, etc. Based on all my links, do you see how easy this is to acquire information? The Arduino site is loaded with information, and there is a forum to ask questions, learn what others are doing and get support: Forum . It doesn't get any better than this! Ok - if you have actually read all that I have submitted here you are now entitled to print this card below and carry it around. Better yet, get an Arduino and create! Don't forget, whatever you make - its all good, and its fun! Related Instructables Arduino Examples #2 Use an Arduino as a FTDI Programmer by qazwsx755 Make a one chip Arduino Five RAM (random Pin LED Matrix access memory) Dice by simonfrfr by yaly Ceiling Fan LED Display by UncleBone Arduino Basics: RCtime by randofo TRUCKBOT (Photos) by anottingham Time-Lapse Photography by randofo Digital LED Flower by Gravity Boy http://www.instructables.com/id/Arduino-Projects/ Arduino R/C Lawnmower (painted) by johndavid400 on May 19, 2009 Author:johndavid400 author's website I have always been one to take things apart to figure out how they work, so most of what I own has been dismantled. If it can't be taken apart or hacked, i'd rather not have it. And I like to do things the cheapest way possible, because I like to do a lot of things and I don't have a lot of money. Intro: Arduino R/C Lawnmower (painted) What this is: This instructable will show you how to make your Arduino into an R/C interface that you can use for just about anything requiring remote control. I will also show you how I built an R/C lawnmower using my Arduino, a cheap R/C transmitter and receiver pair, and a couple of electric-wheelchair motors from Ebay. I have used this interface to control anything from basic LED's to Bipolar stepper motors, mini-robots, lifeless R/C cars from the thrift store, and even a 100lb lawnmower (all with appropriate motor controllers). It is very flexible and easy to change and very simple to set up. See a slightly different version of the Lawnbot400 in my new book "Arduino Robotics" , as well as a DIY Segway and several other bots. Check it out in MAKE magazine in the April 2010 issue (#22) or here: UPDATE 3-24-10 New wheel-barrow bucket mounted on top with hinges so it can dump its contents. UPDATE 3-10-10: NEW CODE And new video of the Lawnbot400 moving a bunch of dirt from my truck to the flower beds across the yard, also I updated the code again. . I added some new code to the project that is safer, including a manual kill-switch and a Failsafe switch. To implement the Failsafe, I used another Atmega168 (or an Arduino), to control a normally-open 60amp power relay. The relay disconnects the power to the motorcontroller unless receiving a "good" signal from the 2nd microcontroller. This signal is updated 2 times every second and is either ON or OFF. If the bot gets out of range, it loses power to the motors. If I flip the kill-switch on the Transmitter, it loses power to the motors. This is also a handy way to disable it remotely if anything were to go near it that wasn't supposed to. The updated code for both microcontrollers is on the CODE page. In addition to the failsafe, I changed the way the code reads the PPM signals to make it more reliable. Also, I realized that I was only able to run the bot at 80% speed with the old code, so now it is quite a bit faster and has more power (it can carry me across the yard @ 155lb). Check out this new video of me riding the Lawnbot400, my wife driving it over a bunch of branches, then me making do some wheelies. Don't worry, the mower was turned off this time since the grass didn't need cutting, we were just having fun. Disclaimer: http://www.instructables.com/id/Arduino-Projects/ DANGER!!! This is a VERY dangerous piece of equipment if not handled appropriately. Since all the electronics have been home-built and the Arduino code is new, you MUST be very careful while operating anything heavy with this code. I have had 1 or 2 times during testing - and before adding a secondary failsafe - that the main Arduino jammed up and I temporarily lost control of the mower for a few seconds!!!! Though I have added several filters to discard unwanted signals and I rarely have any issues, an un-manned lawnmower IS STILL A POTENTIAL DEATH TRAP and I assume no responsibility for anything that happens as a result of your use of this code or this tutorial. This is meant as a guide for people who not only have the ability to build such a contraption, but the responsibiltity to operate it safely as well. Any suggestions or ideas on how to make this a safer project is always gladly accepted. Having said that, it's also awesome. Background: Most R/C equipment comes packaged for a single specific use, which makes it easy to use but is very limited in what you can do with it. So using the Arduino as an interpreter between the R/C system and the motor driver, I can use any motor controller that I want (depending on the size of the motor and power required), reprogramming the Arduino to supply the required signals. What I ended up with: After successfully hacking a few R/C cars from the thrift store, I got bored driving them around the driveway and I was having a hard time convincing my wife that there was any usefulness in the revived toy car. So I decided it was time to make my biggest chore at home, a whole lot easier and actually put my Arduino to work, and thats how I ended up building an R/C lawnmower. While designing the lawnmower, I thought it would be cool to learn about the electronics that made it move, so I designed and built my own motor speed controller (or Hbridge) to power the lawnmower. I looked around at every H-bridge design I could find before deciding to go with a Mosfet h-bridge that uses both N-channel and Pchannel Mosfets. I built several different motor driver boards for this project, the first two were on Radio-Shack perf-board and the next 4 were designed using EagleCad and etched to a piece of copper-clad PCB, using the toner-transfer method. The most recent board is the one I use to mow the lawn as it has the ability to stay cool even while operating for long periods of time (30-40 mins straight) at 10-20amps and 24vdc. FWIW, I had to burn up a lot of Mosfets to find this out. If you want to see any of my other motor controllers, go to www.rediculouslygoodlooking.com and check out the Mosfet shield. Here is what I bought already assembled: FM R/C transmitter and receiver pair from ebay = $40 Arduino = $30 I already had a used push-mower = $60 Here is what I bought and assembled into the Lawnbot400 (as I call it): (2) electric-wheelchair motors from ebay = $40 ea (2) 12v marine deep cycle batteries - Walmart - $60 ea new (used batteries might work) 36" pieces of 2" angle-iron (2) and 1" square-tubing (2) from Home Depot = $8 ea 36" pieces of 1" angle-iron (2) and 1" flat steel bar (2) from Home Depot = $5 ea (a lot) of nuts, bolts, washers, lock washers 3/8" or 1/2" with drill bit = $20 (2) caster wheels from Harbor Freight Tools = $14 ea (2) drive wheels from Harbor Freight Tools = $8 ea (36") 5/8" threaded rod with several 5/8" nuts and washers from Home Depot = $8 (2) sprockets from Allelectronics = $5 ea #25 roller chain and a few universal links from Allelectronics = $10 for 3' sprockets from Electronics Goldmine = $1.50 ea (24) mosfets from Digikey = $1 ea (there were quite a few small parts for building the H-bridge, they are listed later on) http://www.instructables.com/id/Arduino-Projects/ http://www.instructables.com/id/Arduino-Projects/ Image Notes 1. the front left mower deck hanger 2. the rear left mower deck hanger http://www.instructables.com/id/Arduino-Projects/ Image Notes 1. the Triple8 motor controller with 24 mosfets, each set of 3 is bolted together and each mosfet is heatsinked. It has 3x as many Mosfets as it's little brother, but essentially the same circuit. 2. the predecessor to the Triple8, only 8 mosfets total (just enough to complete a dual h-bridge). Though it would run the Lawnbot400 around for about 10 minutes, it would end up getting hot after some use. Image Notes 1. the 2 neutral indicator LED's (1 red and 1 yellow) hard-wired to digital pins 12 and 13. Anytime I center one of the control sticks on the lawnbot400, one of these lights turns on. 2. the female headers used to plug my R/C receiver directly onto (they use standard .1" spacing like perfboard you can buy at Radio Shack) 3. these are the breakout screw-terminals used to route the R/C receiver signals to the Atmega168. I am only using 2 of the 6 R/C channels right now, so the other 4 can be used for extra servo's or whatever else. 4. digital pins 2 and 3 of the Atmega168, used for the External Interrupts on those pins to capture the R/C signals from the receiver. 5. These are the screw-terminals for the signal wires leading to the H-bridge motor controller. I only need 4 wires to run my motor controller, but there are 3 extra digital pins that are unused by the current code.... Any ideas for their use? 6. all 6 analog pins are unused! I might add some sensors to automate the Lawnbot400 one day. 7. the Atmega168, it's reset button, and a kind-of hidden 16mHz crystal oscillator (together make a bare-bones Arduino). 8. 5-35v power terminal and onboard 5v regulator for powering the Atmega and R/C receiver. Plus a bunch of capacitors and a reverse polarity protection diode. http://www.instructables.com/id/Arduino-Projects/ Image Notes 1. this is the 2nd H-bridge, notice that the motor screw-terminals for each motor will be on opposite sides of the board. 2. This is the 1st H-bridge Step 1: Setting up 1. Get R/C transmitter and receiver (I have tested FM and AM systems and they both work) 2. Upload code to Arduino (it is on the last page) 3. Make sure you are getting a good signal You will need an R/C radio transmitter(Tx) and receiver(Rx) pair, which is the most expensive part of the project, but can be used for every future project you might have involving R/C. I went with a 6-channel FM system, but I have tested a 27mHz AM transmitter/receiver and it works just as well. The beauty of the Arduino is that if you want to adjust the deadband or the motor-speed at turn-on, (unlike commercial ESC's) it is all easy changed in the Arduino IDE. Once you have your radio, all you need to do is upload the code to your Arduino, plug in the 2 channels that you want to use from your radio receiver into Digital pins 2 and 3 of the Arduino (these are the 2 external interrupt pins on the Arduino) and you are ready to control whatever you want. If you don't have a batter pack for the receiver, you can run jumper wires from the Arduino +5v and GND to the R/C receiever for power, you only need to supply a single channel with GND and +5v (it is not necessary to power every channel). Upload the code using the Aruino IDE (I am using version 0016 on Ubuntu). I started by controlling 3 LED's with 1 channel on a breadboard. I wired a red LED to be Forward (digital pin 9), a yellow LED for Reverse(digital pin 5), and a green LED for Neutral (digital pin 12). This allows you to adjust the code to fit the needs of your radio system. You will have smooth 0-100% PWM control of both LED's and the neutral light will turn on when the control stick is centered. If needed, you can widen the deadband for Neutral, but doing so will increase the speed at turn-on (which starts at 0%, so that would likely be desirable). See pictures. ---------------------------------------The code has 4 PWM outputs for motor control: channel 1 Forward = Arduino digital pin 9 channel 1 Reverse = Arduino digital pin 5 channel 2 Forward = Arduino digital pin 10 channel 2 Reverse = Arduino digital pin 6 http://www.instructables.com/id/Arduino-Projects/ 2 outputs for Neutral indicator lights: channel 1 = digital pin 12 channel 2 = digital pin 13 The 2 INPUTS from the R/C receiver should go to: channel 1 = digital pin 2 channel 2 = digital pin 3 --------------------------------------If you are interested to see your readings, turn on your Serial Monitor in the Arduino IDE (set to 9600bps) and you can see the actual real-time pulse readings for each channel, they should read: full forward = 2000 (2 milliseconds) center = 1500 (1.5 ms) full reverse = 1000 (1 ms) These readings reflect the number of microseconds that the pulse signal from the R/C receiver stays HIGH (or at 5v). The typical Servo signal that comes from an R/C receiver is a pulse whose length varies from approximately 1 ms to 2 ms with 1.5 ms being Neutral (which should also be the position that the control stick returns to when you let it go). The transmitter reads the position of the control stick and sends that pulse length about once every 20milliseconds. So it is constantly updating for precise control (for more info, look up PPM on wikipedia). If you push the transmitter control stick forward, the reading should go up to 2000, if you push it backward it should go down to 1000. You can also use a voltage meter at this point to see that Digital Pins 5, 6, 9, & 10 will be changing from 0-5v depending on the position of the control sticks on the R/C transmitter. If you care to know, the code uses the Arduino's 2 external interrupts to capture when the Rx signal pin changes states (goes from HIGH to LOW or vice versa), when it does at the beginning of each signal, it calls the interrupt function which reads the digital state of the pin and if HIGH, it records the microseconds value on the Arduino system timer0. It then returns to the loop until the pin goes LOW, at which point it subtracts the previously recorded microsecond value from the new current microsecond value to determine how long the pulse stayed HIGH (which tells us the position of the Transmitter control stick). It then does that over and over really fast. I have the values constrained from 600-2400 in the Arduino code to keep things simple. Once it receives the signal and constrains it, it maps that value to be proportionally between 0 and 511, where 255 will be Neutral. The code then determines when the value changes and uses a function to determine the appropriate 0-255 PWM value in the appropriate direction and each direction has it's own PWM output pin to control the H-bridge. On a side note: To make things easier, I built an Arduino-based breakout board using Radio-Shack perf-board, a 28pin DIP socket, a 16mhz oscillator, and a bit of wire. I also added a set of female-headers in such a way that I can plug my R/C receiver directly onto the breakout board. For secure connections while mowing grass, I added screwterminals on each Output pin and each of the 6 channels from the receiver. It also has a built in 5v regulator to power both the Atmega168 from the Arduino and the R/C receiver (which gets power when you plug it onto the breakout board). So you just route jumper wires from the channels you want to use on the receiver, to the Atmega digital pins 2 and 3. I also added 2 LED lights that are hard wired to the digital pins 12 and 13 for the Neutral lights for each channel so I can easily see when I am in neutral. Since this bot is a Tank steer setup with 1 drive motor on each wheel, the coding is very straightforward where the left stick controls the left motor and the right stick controls the right motor. Both sticks forward means lawnmower goes straight forward, both backward and it goes in reverse. If you push the left forward and the right backward, it does a zero-turn circle. As you can imagine, mowing the grass is really fun now. Image Notes 1. this is my receiver plugged into a breakout board I made for it using perfboard. 2. the Arduino receiving R/C servo signals and translating them into forward/reverse PWM values. 3. each set of LED's is controlled by it's own channel from the R/C receiver. Forward will turn on the green light, reverse the Red light, and neutral will light up the Yellow light. This is the easiest way to test the setup. Image Notes 1. this is a typical R/C transmitter with 4 channels, the one I got is a knockoff of this one, but looks very similar. 2. this is a typical R/C receiver. Mine has it's connector pins on the end of the unit instead of the top, enabling me to plug my receiver directly onto the control board. 3. these are typical servo motors. They can be controlled directly by the R/C receiver and are useful for many things. http://www.instructables.com/id/Arduino-Projects/ Image Notes 1. the Atmega168 from my Arduino (I bought a few extras to use for projects like this). I remove it when I need to re-program it in the Arduino. 2. my R/C receiver plugged into the control board. Notice the green antenna coming out. Step 2: The Motor Driver I built several motor drivers before finding a design that worked for my needs. For what it's worth, there are several nice products already out there that are fully assembled and require a lot less work if you are not interested in building your own electronics. The Open Source Motor Controller is an open source design that has been under constant community improvement for several years now and can handle up to 160amps at 36vdc! But they are over $100 and only control 1 motor. The Sabertooth 2x25amp motor controller is nice and controls 2 motors, but it is $125. So I thought I would just make an extremely simple dual h-bridge that could handle at least 25 amps at 24vdc continuous and handle surges of up to 100amps for a few seconds. Once I found out that you can parallel Mosfets and multiply their current carrying capacity accordingly, I thought I would come up with a simple design and slightly complicate it by adding more mosfets until I had enough to handle the current that I needed. Digikey has a good selection of Mosfets to choose from and good filters to narrow it down by what you need, so I spent a lot of time looking for Mosfets that were rated for around 50amp and could handle over 30 volts. Also, they have to be cheap because my plan is to use a bunch of them. I decided on the FQP47P06 p-channel and the FQP50N06L n-channel Mosfets from Fairchild Semiconductor, which I bought from Digikey. If you are wondering what an H-bridge is, find out here: en.wikipedia.org/wiki/H-bridge and this will all make more sense to you. The design is simple: 2 P-channel mosfets control the high-side switches and 2 N-channel mosfets for the low-side switches. But instead of using 1 mosfet for each switch, lets use 3. Now we have 12 mosfets per H-bridge (3 mosfets x 4 switches) and theoretically the ability to carry 150 amps (that is not accurate though). The board is as small as I could make it with nothing touching. Each set of 3 mosfets have heatsinks and are bolted together to help dissipate heat. Also, there is an 80mm cooling fan mounted directly above mosfets to further keep them cool. The mosfets are very good at handling sudden changes in direction and speed changes. Since there are 24 mosfets in total (8 groups of 3) I dubbed it the Triple-8. It is running at the Arduino default PWM frequency of 1kHz (I plan on playing with that to get the frequency higher). The board has 4 inputs, 2 for each bridge. If you bring an input HIGH, that side of the bridge goes HIGH. Ideally, you would control the board by holding 1 input LOW and applying a PWM signal to the other input. This allows for easy speed control. I have written into the code that if you bring digital pin 7 HIGH, the code switches to Relay mode and either turns the mosfets all the way ON or all the way OFF. This is far more difficult to control, but is useful sometimes. If you are interested in building your own H-bridge you can download the eagle file to etch a pcb and the schematic to show where everything goes. You can get everything to make this dual h-bridge at Radio-shack (including the copper clad), except the Mosfets and a special resistor network I used to save space. I bought most of the parts from Digikey though because it was cheaper and arrives to my house in 2 days. Here are the parts needed for this motor driver: (12) FQP47P06 - P-channel mosfet 47a 60v - Digikey - $1.73 ea (12) FQP50N06L - Logic level N-channel mosfet 52a 60v - Digikey - $1.04 ea (4) 2n7000 - Logic level N-channel mosfet 200ma 60v - Digikey - $0.26 ea (8) 4606X-1-470LF-ND - 47ohm bussed resistor network - Digikey - $0.25 ea (6) ED1609-ND - 2 position screw terminal - Digikey or Radio Shack- $0.46 ea (24) CF1/84.7KJRCT-ND - 4.7k 1/8w resistor - Digikey or Radio Shack - $1.78 (for 50pk) (1) PC9-ND - 3"x4.5" 1-sided copper-clad .064" 2oz copper - Digikey or Radio Shack- $4.66 (4) P5575-ND - 1000uf Capacitor or similar - Digikey - $1.19 ea (1) 330ohm - 1kohm resistor 1/4w - for power LED, doesn't have to be exact (1) power LED any color you like, I use the 3mm size to save space Maybe something smaller? If you are going to use this for something smaller than a 100lb lawnmower, you can look up one of the many H-bridge circuits and build your own smaller motor controller with as few as 4 mosfets (or BJT transistors) or even use a packaged IC H-bridge like the l293d (dual 1 amp) or the l298n (dual 2 amp). Or if anyone is interested, I will post a schematic and Eagle .brd file for a smaller version of this H-bridge that only requires 8 mosfets total (everything else is the same), and it can handle about 10amps at 24vdc. Etching: I am not going to go into all the details of PCB etching, because there are already many excellent instructables on that topic. So once you download my .BRD file of my http://www.instructables.com/id/Arduino-Projects/ motor controller, all you need to do is print the .brd file onto some magazine paper using a laser printer, and iron that onto a piece of clean copper-clad. Then etch it with your favorite etchant solution (I use 2 parts Hydrogen Peroxide to 1 part Muriatic Acid and it works perfectly). And remove the toner with Acetone when done etching. For ease of assembly I designed this board to be Single-sided and to use only through-hole components, no surface-mount stuff to mess with! Yay for you. You can get the .brd files for the various h-bridges at www.rediculouslygoodlooking.com Image Notes 1. this is the 2nd H-bridge, notice that the motor screw-terminals for each motor will be on opposite sides of the board. 2. This is the 1st H-bridge Image Notes 1. bussed resistor networks 47ohm. They have 1 input and 5 outputs, this board only uses 3 of the outputs. 2. pull up/down resistors 4.7k ohm, these keep the Mosfets turned off when not being used. 3. capacitors, I used (4) 680uF 50v, but you can substitute others that fit. 4. screw terminal connectors for motor terminals and power http://www.instructables.com/id/Arduino-Projects/ Image Notes 1. this is 1 complete h-bridge to control 1 DC motor. The 2 smaller mosfets toward the bottom are used as signal-inverters to control the High-side pchannel mosfets. 2. each h-bridge has it's own set of direction lights to determine the direction of the current. Image Notes 1. the Triple8 motor controller with 24 mosfets, each set of 3 is bolted together and each mosfet is heatsinked. It has 3x as many Mosfets as it's little brother, but essentially the same circuit. 2. the predecessor to the Triple8, only 8 mosfets total (just enough to complete a dual h-bridge). Though it would run the Lawnbot400 around for about 10 minutes, it would end up getting hot after some use. Image Notes 1. R/C receiver plugged into Arduino breakout board 2. cooling fan for motor controller (h-bridge) http://www.instructables.com/id/Arduino-Projects/ Image Notes 1. Atmega168 microcontroller programmed in the Arduino, then transferred to this home-made breakout board for permanent use. 2. The R/C receiver is plugged directly onto my home-made breakout board which supplies the +5v and GND needed for power as well as a breakout screwterminal for each channel. This receives the signals from the remote-control (R/C transmitter) and sends them into the Atmega168 for processing. Step 3: The Wheels First you need to mount the drive sprockets to the wheels. The EASY way: If you are smart and have more money, you can find a set of wheelchair motors that have the wheels mounted to them. The CHEAP way: I could not find any in my price range, so I went with just the motors, then bought wheels, then sprockets. Believing it would not be strong enough to mount the wheels directly to the motors, I opted to mount the drive wheels on an axle, then the motors to the frame, and use chain to transmit the power. A picture is worth 1000 words, so look at them carefully. Mount the sprockets to the wheels: I had to place the sprocket on the center of the wheel and drill 3 holes through the sprocket and then through the wheel itself. Once the sprocket is lined up and properly centered, I placed the 3 bolts through the sprocket and wheel and tightened them up as much as possible. I then welded the sprocket to the wheel hub to keep it centered. The wheels from Harbor Freight Tools have built in bearings for a 5/8" shaft, hence the 5/8" threaded-rod we are going to use as an axle. Repeat this process for both wheels. There is more detailed info tagged in the pictures. http://www.instructables.com/id/Arduino-Projects/ Image Notes 1. The bolts coming from around the axle are the 3 bolts that hold the sprocket onto the other side. Image Notes 1. The drive sprockets are about 6.5" in diameter and had no holes to mount them. I had to drill 3 holes and mount bolts through the sprocket into the wheel. I then added a small bead of weld to keep it centered around the axle. Image Notes 1. save a bolt on each side by using the same one that you used to bolt the frame riser brace into the frame. http://www.instructables.com/id/Arduino-Projects/ Step 4: The Frame part A This is the difficult part to explain. You will likely have to have some mechanical ability and a good set of tools to build a large metal frame from scratch. And since this was a prototype, the dimensions are not all perfect, but luckily they don't need to be. The frame will be custom measured for your particular lawnmower, so I won't be giving you exact measurements. Tools needed to build a frame: measuring tape angle-grinder ratchet set crescent-wrench a level electric drill bolts, nuts, washers, and lock washers of either 3/8" or 1/2" diameter and 3/4"- 2" long drill bits the size of the bolts you are using 1" and 2" angle-iron (36" long pieces) you'll need both 1" square tubing (36" pieces, steel) 1" flat steel bar (36" long pieces) the 4 wheels you got from Harbor Freight Tools (2 drive wheels and 2 caster wheels) 5/8" threaded rod (36" long) and several 5/8" nuts/washers First you need to plan out the frame of your bot. Since I was attaching a lawnmower, I started by measuring the height that the lawnmower stood off the ground and took some basic measurements to see how big the frame needed to be. My frame turned out to be about 24" wide (this distance must match the width from the center of the rear lawnmower wheels) and 48" long (long enough for the front caster wheels to swing 360 degrees without hitting the front of the mower deck) and about 18" tall. Since we want the height of the mower-deck to be adjustable, we are going to attach the mower to the frame by removing the lawnmower wheels and using angle-iron to suspend the mower-deck from the frame of the bot. 1. I started out by using 2 of the 36" pieces of angle-iron (2" wide) for the main part of the frame running long-ways. 2. Cut the rear-piece of angle-iron the width of the rear of the mower (this measurement will be from the center of the left-rear wheel to the center of the right-rear wheel). 3. Drill holes in the ends of the angle-iron and bolt the rear-piece to the adjacent pieces from step 1, making sure they are straight. 4. Cut two front-pieces using 1" square steel tubing, the same length as the rear. We need 2 in the front to bolt the caster wheels to. 5. Drill holes and bolt these 2 pieces to the front of the angle-iron from step 1. You have to measure the holes from the 2 front caster wheel's mounting plates and drill the pattern into the front square tubing bars. Then bolt the wheels through those holes onto the front of the frame. I later added another set of 2" angle-iron bars to the front caster wheel assembly to make the length of the bot adjustable at the front (see pics) Now we should have a rectangular frame with the front wheels attached. Image Notes 1. the front 1" steel square tubing that the front caster wheels attach to. http://www.instructables.com/id/Arduino-Projects/ Image Notes 1. Motor controller and Arduino 2. push mower 3. (2) 12v batteries (deep cycle marine is the best) 4. electric wheel-chair motors Image Notes 1. you need 1 nut on the inside of the frame riser bar to, and 1 on the outside to hold it securely to the axle. 2. I bolted the support bar in with the rear lawnmower-deck hangers to save a bolt on each side. Image Notes 1. the rear bar should be the same width as the center of the rear wheels on your push-mower (must be measured before you remove the wheels). 2. the main frame bars. 3. the support brace http://www.instructables.com/id/Arduino-Projects/ Image Notes 1. one of the main frame bars from step 1, which is 2" angle-iron. 2. the other main frame bar from step 1 Image Notes 1. the front left mower deck hanger 2. the rear left mower deck hanger Step 5: The Frame part B We now need to see how far down to mount the drive axle to make the frame level. So raise the rear of the frame up until the top of the frame is level with the ground (use your level). Now measure the distance from the top-rear of the frame to the ground, this is the frame height. Now we need to take into account the height that the wheels will raise the axle off the ground. So measure the distance from the center of the rear drive wheel to the ground (the wheel's radius). Subtract the wheel radius from the frame height and we will have the correct distance from the top of the frame to the drive axle, which we will call the frame-riser height (we need to cut these pieces next). They are going to connect the rear of the frame down to the axle which the wheels will be mounted on. 6. We are going to add 2" to the frame-riser measurement (so we have a little to work with) and cut the 2 frame risers (mine were about 10-12" long). 7. Now drill (2) 5/8" holes, 1 at the bottom of each frame riser (about 1" from the bottom), this is where the drive axle will go through. 8. Drill 2 holes at the top and bolt the frame risers to the rear of the main-rectangular frame with the frame-risers pointed down. 9. Now feed the threaded-rod through the bottom holes of the frame risers and use 4 nuts to secure the frame risers to the drive axle (1 nut on each side of each frame riser, tightened down). 10. put the rear wheels on the axle and use 1 more nut on each wheel to secure them to the axle (these wheels have built in bearings). The sprockets should face inward toward the frame. Now we should have a frame that stands on it's own with 4 wheels. However, the rear axle is not completely secure yet. We will need to add 2 braces from the bottom of the frame risers (near the axle) to the main part of the frame in order to keep the frame risers positioned properly. These braces can be flat steel and do not need to be very thick, they are just keeping the frame risers from moving. Measure about 2" above each axle and drill a hole, then measure how far down that hole is from the top-rear of the frame and measure the same distance from the rear of the frame toward the front. Drill another hole on each side at this measurement. The support braces will need to be measured to be bolted in through these holes on each side (see pictures). The placement of the support braces is less important, meaning you can bolt them in wherever is convenient, as long as they are present. Image Notes 1. the rear bar should be the same width as the center of the rear wheels on your push-mower (must be measured before you remove the wheels). 2. the main frame bars. 3. the support brace Image Notes 1. The drive sprockets are about 6.5" in diameter and had no holes to mount them. I had to drill 3 holes and mount bolts through the sprocket into the wheel. I then added a small bead of weld to keep it centered around the axle. http://www.instructables.com/id/Arduino-Projects/ Image Notes 1. The bolts coming from around the axle are the 3 bolts that hold the sprocket onto the other side. Image Notes 1. one of the main frame bars from step 1, which is 2" angle-iron. 2. the other main frame bar from step 1 Image Notes 1. you need 1 nut on the inside of the frame riser bar to, and 1 on the outside to hold it securely to the axle. 2. I bolted the support bar in with the rear lawnmower-deck hangers to save a bolt on each side. Step 6: Mounting the motors This was the most difficult part to plan out on the frame. We need the motors to be adjustable so we can adjust the tension of the chain, however they just have 4 holes in the bottom of each motor and nobody makes a mounting plate that I could find. The simplest way I could come up with was to mount the motors to an 8" long piece of 2" angle-iron, and then mount that piece of angle iron to the frame through some specially cut holes that allow the motor mount to travel forward and backward (but not side to side) along the frame. Make the motor mount plate: Cut an 8-10" section of 2" angle-iron, depending on how much room your motors need to mount. Mine only needed about 4", so I made it 8" to have plenty of room for the mounting bolts. Drill a hole about 1.5" from each end of the top of this bar, this is where the mounting bolts will go through the frame. Mount the motor to the motor mounting plate: Now you have to find the center of your motor mount plate (the 8" long piece of 2" angle iron) and measure the mounting holes on your DC motors. Use a sharpie marker to plot the hole pattern from the motor, centered onto the motor mount plate. My motors have (4) 1/4" diameter tapped holes in a rectangular pattern on the bottom of the gear box. Drilling and cutting the adjustment holes on the frame: Next you need to drill and cut the holes in the frame to let the motor mounting plate become adjustable. I cut these holes using a dremel tool and a cutoff wheel. You have to line up the motor mounting plate (with motor mounted preferrably) onto the frame rail and use a sharpie marker to mark where the holes will need to be on the frame rails. Start as far back as you can (without hitting any other bolts underneath the frame), and mark the center of each hole. Then move the motors forward 2" and mark the holes again. You want to cut the holes out of the frame so that the motor mount plate (with bolts going through the frame), can move forward or backward about 2". The holes in the frame are the width of the bolt and about 2" long. I drilled 1 hole at each end and used the dremel to cut out the rest. http://www.instructables.com/id/Arduino-Projects/ The holes drilled in the motor mount plate are just single holes for the bolt to fit through, the holes through the frame were cut with a Dremel tool with a cutoff wheel to make channels for the motor mount bolts to travel forward/backward through. You want the 2" angle-iron motor mount bracket to set as much on top of the main frame rails as possible, the bolts (which you can't see with the motors mounted) that hold the motors to the motor mount plates will keep the motor mount plate from laying flat against the frame bars. Go ahead and mount the motors loosely to the frame using 2 bolts on each. Cutting and connecting the chain: Now get your 10' of #25 chain and wrap it around the main drive sprocket on the wheel. With the motors pushed all the way toward the back of the frame (closest to the drive wheel sprockets), wrap the chain around the motor drive sprocket and mark where they overlap. You need 2 of the universal chain links from to connect the 2 loose ends. Cut the 2 pieces of chain and connect them to each side with the universal links to connect them. Tensioning the chain: Push the motor mounts forward until there is good tension with the chain, and tighten up the bolts that hold the motor mount plates to the main frame. Now you can generate electricity. Connect a voltage meter to 1 set of motor terminals and push the bot around. Image Notes 1. notice the motor is mounted to this piece of 2" angle-iron and that is mounted to the frame with these bolts. They allow the motor to slide forward/backwards on the frame when loosened. Image Notes 1. notice the gap between the motor mount plate and the main frame bar. This is caused by the bolts that hold the motor to the motor mount plate. 2. These are 2 unfinished holes for a 3rd mounting hole which I later deemed unnecessary. http://www.instructables.com/id/Arduino-Projects/ Image Notes 1. This is how to make the motor mount slide holes. Drill 2 holes where you want the ends of the track to be. Then use a Dremel with a cutoff wheel to cut a straight line between the tops and bottoms of each hole. They should end up looking like the ones above with bolts in them. 2. Tighten up these bolts when you get proper tension with the chain. Step 7: Mounting the mower deck Next we need to mount the mower deck to the frame. Remember we made the frame wide enough that the edges of the frame would be centered on the lawnmower wheel shafts. All we have to do is cut 4 pieces of 1" angle-iron equal lengths so that the mower deck hangs evenly from the frame. So measure the height of the frame from the top to the ground. Now measure how high the mower sits off the ground from the center of the wheel shafts (when the original wheels are on the lawnmower and all the height adjusters for each wheel are in the middle position). Now subtract the height the mower sits of the ground from the frame height, and cut 4 pieces of 1" angle iron to that length. Now drill 1 hole in the end of each piece of angle-iron, about 1/2" from each end. The holes at the bottom will need to be the diameter of the lawnmower wheel shafts and the holes at the top will need to be bolted into the frame (hung at equal distances from the top of the frame). Once you have all 4 hangers installed, you can install the mower deck and tighten up the bolts. Make sure you have at least 1/2" of clearance or more between the drive tires and the lawnmower wheel shafts. You are almost ready to go. http://www.instructables.com/id/Arduino-Projects/ Image Notes 1. the front left mower deck hanger 2. the rear left mower deck hanger Image Notes 1. make sure to keep the old wheel shafts from touching the drive tires (leave 1/2" or so) Image Notes 1. save a bolt on each side by using the same one that you used to bolt the frame riser brace into the frame. Image Notes 1. adjustable total length (for different model push mowers) 2. caster wheels with 360 degree turning 3. leave a gap or the front wheels will hit the mower deck!!! Image Notes 1. by mounting the lawn mower deck-hangers to the old wheel shafts, you can still Image Notes 1. these are the 1" angle-iron lawnmower-deck hangers, they hold the mower- http://www.instructables.com/id/Arduino-Projects/ adjust the mowing height of the mower deck without taking anything apart. deck to the main frame Image Notes 1. make sure the front caster wheels won't hit the mower deck when they swing around (leave at least 1/2" clearance) Image Notes 1. I only installed 3 of the 4 bolts on each front caster wheel. 2. these 2 bolts on each side go through the caster wheel mounting plate AND the frame Step 8: Select and Install the batteries This is the simple part. Go BIG. I only bought 1.. which I got at Walmart for $62. I got 2 car batteries (actually 1 marine deep cycle and 1 gel-cell car battery) both 12vdc. They together keep my lawnmower running strong for the duration of my front and back yard (I have about 1/2 acre of grass to cut and it is somewhat hilly). I slacked while trying to learn about batteries and just went with the biggest ones I could find for the price (the gel cell is actually used). I initially thought 12vdc would work, but the added weight of the mower deck made it travel so slowly at 12vdc, that it would not quite make it up some larger hills, so 24volts was necessary. The 2 batteries are connected in series with each other. The microcontroller is also powered by these batteries. I have never had any problems with the electronics not getting enough power, so I didn't see the need to have a separate power supply. The batteries (due to their weight) are mounted behind the rear wheels. This GREATLY improves control of the bot because it counters the weight of the mower deck in front. Zero-turns are very easy now. I needed a place to hold the 2 big batteries that were going to power the lawnbot, so I measured the 2 batteries and welded a small 1" angle-iron frame to hold them. It is welded to the rear of the frame behind the drive axle to maintain even weight distribution. You can use bolts and 1" angle-iron to make a battery holding cage that is bolted to the rear of the bot, or you can use smaller batteries and secure them to the top of the bot. 12v 20ah Sealed Lead Acid batteries can be found online for around $35-45 each. Any battery rack that you can whip up will likely be just fine, as long as it can support the weight of the batteries it is carrying. I used a welder to speed up the process. http://www.instructables.com/id/Arduino-Projects/ Image Notes 1. Motor controller and Arduino 2. push mower 3. (2) 12v batteries (deep cycle marine is the best) 4. electric wheel-chair motors Step 9: Mount the electronics Connect the electronics to the motors and batteries. The motor drive board has 1 connector for the main battery power and 1 power connector for the 80mm cooling fan that I would highly recommend you install directly above the mosfets. There is spacing for some long skinny bolts to hold a cooling fan. I bolted the motor driver above the Arduino breakout board to save space. Also, you might want to use some smaller wire coming from the batteries to power the Arduino board, as the 10ga wire I used for main power and motors is a bit overkill for the microcontroller. I installed a 30a 120v toggle switch from Radio Shack to switch the main power ON/OFF, this is my kill-switch. I also found a terminal-block for power distribution at Radio Shack for a few bucks. It is the white thing that all the wires go into in the pictures. This makes removing the electronics a whole lot easier. It is very important that you wire everything up correctly. Otherwise you might blow up the motor controller. So make sure that you check the code before connecting anything to verify that you haven't mixed any wires up. http://www.instructables.com/id/Arduino-Projects/ Image Notes 1. Atmega168 microcontroller programmed in the Arduino, then transferred to this home-made breakout board for permanent use. 2. The R/C receiver is plugged directly onto my home-made breakout board which supplies the +5v and GND needed for power as well as a breakout screw-terminal for each channel. This receives the signals from the remote-control (R/C transmitter) and sends them into the Atmega168 for processing. Image Notes 1. R/C receiver plugged into Arduino breakout board 2. cooling fan for motor controller (h-bridge) http://www.instructables.com/id/Arduino-Projects/ Step 10: The Code I changed the code so that the Interrupt Service Routines (ISR) would run more quickly and the sketch would spend less time in the ISR. This means less overhead which means more signals are processed and smoother operation of the bot. I also added a 2nd sketch for the 2nd microcontroller to process 2 signals (you can add as many more as you want) using the pulseIn method instead of using interrupts. This only processes about 1/5th of the available signals from the R/C Receiver, but also severely decreases the chance of receiving a "BAD" signal. Also, since the power relay is setup to only be ON if the signal is "GOOD", when you go out of range, it automatically shuts off the power to the motors only. The 2nd Atmega by default should have digital pin 4 used as the R/C servo signal input from the R/C receiver, digital pin 6 should control a 5v relay or N-channel mosfet that is used to switch the 60amp power relay ON/OFF. That is all that is needed, you can also use an LED on pins 12 and 13 to indicate whether the relay is ON or OFF. You can also add 2 12v running lights from Walmart for a car... I use an N-channel mosfet directly tied to pin 9 of the 2nd Arduino to control the brightness of the lights using a hacked channel on my transmitter. This input from the receiver would go to digital pin 2. Check the code. Download the .zip file on this page and upload the sketches. If you don't plan on adding the 2nd Atmega with the failsafe and killswitch, that is fine. You can still update the new code for just the main Atmega and it should run more smoothly. File Downloads Lawnbot400_code.zip (152 KB) [NOTE: When saving, if you see .tmp as the file ext, rename it to 'Lawnbot400_code.zip'] Step 11: More Videos here are a few more videos in case anyone wanted to see... #2 #3 http://www.instructables.com/id/Arduino-Projects/ #4 #5 http://www.instructables.com/id/Arduino-Projects/ Related Instructables How To Change Lawn Mower Oil by toolrepair How To Replace a Lawn Mower Blade by toolrepair Electric Lawn Mower by susanta Robocam Homemade Video Robot (Photos) by talk2bruce remote start system for car truck and suv by Lawn Care Grub control by lonemeno Ace Fix it Use a PS3 Controller to Solar Lawn control an Mower! by Marsh Arduino NXT Bot by nahamancygig http://www.instructables.com/id/Arduino-Projects/ The Word Clock - Arduino version by drj113 on October 26, 2009 Author:drj113 I have a background in digital electronics, and am very interested in computers. I love things that blink, and am in awe of the physics associated with making blue LEDs. Intro: The Word Clock - Arduino version ************************************************************************** Major updates - A much better enclosure for this clock has been designed - check out http://www.instructables.com/id/The-Wordclock-Grew-Up/ ************************************************************************** Last month I wanted to build a special gift for my beautiful wife, Megan. She has a teaching background in English, so what better present to make for her than a clock that uses language to tell the time for her desk at work. THE BACKGROUND The original project that I created used a Microchip PIC microcontroller (16F877), because that's what I had in the garage. Since I published it (http://www.instructables.com/id/A-Word-Clock/), quite a few people, including my next door neighbor (Thanks Mikal) have asked me why I didn't use an Arduino. Having never used one, my automatic reaction to Mikal was 'Whats a one of those??" So, I did some research and found out what an Arduino was. Wow - they are so cool - so simple to develop for, and the barrier to entry is so low!. I ordered one from eBay, and re-designed the clock to use the Arduino Duemilanove as the controller. I have to admit right from the start that the Arduino is a beautifully engineered piece of work - While I am used to the PICs, because I have been playing with them for years, I do admit that there is a certain level of 'unreachability' for the beginner because of the requirement that specialised programmers be purchased or built. The Arduino is equally powerful, comes on it's own little self contained board, and best of all is self programmable using a USB cable. POWER I have also listened to people who have constructed the original clock, and done away with the need to run off AC power. This clock simply uses a DC supply of 12 Volts, so you can run it off a wall wart, or off a set of batteries. If you are using batteries, may I suggest 'D' cells, as they run forever, or a couple of 6V 'Lantern' batteries. REUSE YOUR ARDUINO FOR ANOTHER PROJECT Finally, I have designed the controller board so that you can construct the project with your Arduino Duemilanove board just by plugging it in. But, if you want to recover your Arduino for something else, you can install the optional support components along with an appropriately programmed ATMega168 and a handful of support components and your project will still operate. People on eBay will sell you a ATMega168 with a boot loader that you can simply pop back into your Arduino board. So, here it is - The word clock - constructed using an Arduino! I am now able to sell all sorts of components, ranging from complete clocks, through to kits, through to individual modules and components. Please visit my web site www.dougswordclock.com for further information. Image Notes 1. Final clock - YAY The exposure shows way more bleed through than I see with my eyes. But it works! http://www.instructables.com/id/Arduino-Projects/ Step 1: The new hardware - Controller board schematic BETTER DRIVERS My original clock used discrete transistors to drive the array of LEDs. I have realised that while that approach works fine for a project that I have built for myself, it makes it more complex for others to build, so this new clock uses ULN2003A Driver ICs. The ULN2003A contains a set of darlington transistors in a convenient DIP package, so there is MUCH less soldering to do. A NEW PCB I have also re-designed the PCB to make construction much simpler - The Arduino controller simply plugs into the new PCB. If you want, once you have constructed the clock, you can recover your Arduino board by purchasing an ATMega168 with a boot loader, and populate the PCB with just the new Microcontroller and a crystal. IS THIS JUST A NEW SHIELD? In the spirit of Arduino development, it would be fair to say that the controller board was a 24 output LED (or relay) driver shield. It is just as happy to turn on a big set of 24, 12 volt relay coils as it is turning on a bank of LEDs. Below you will find the new schematic diagram for the controller board as a PDF file. Note that you should look at step 4 to understand what resistors to use. Don't simply use 360R and 36R with supply voltages above 10v. You will need to use 680R and 270R instead. File Downloads WordClock-Arduino-Schematic-V1.0.pdf ((595x842) 64 KB) [NOTE: When saving, if you see .tmp as the file ext, rename it to 'WordClock-Arduino-Schematic-V1.0.pdf'] http://www.instructables.com/id/Arduino-Projects/ Step 2: The hardware - Make the controller board Enough talk - lets start by making the controller board. If you want to etch your own board, you can download the attached a PDF file and follow the steps I used. TONER TRANSFER IS EASY When I made the board, I photocopied the page onto Toner Transfer paper (Press-n-Peel Blue), then I used an old laminator to transfer the image onto a piece of very clean PCB stock. I etched the board in a mixture of Hydrochloric Acid and Hydrogen Peroxide etchant. There is a brilliant Instructable that describes the process at www.instructables.com/id/Stop-using-Ferric-Chloride-etchant!--A-better-etc/ BE SAFE When you etch ANYTHING - make sure you are wearing safety goggles, and old clothing. CLEAN UP When the etch process is complete, everything was rinsed very well under running water to remove all traces of etchant. Just before I rinsed everything, the etchant was collected for use with the next project. DRILL HOLES Once the board had been rinsed and dried, I used a Dremmel to drill the holes, and removed the Press-n-Peel film using some steel wool, detergent anf good old elbow grease. This time, I took buckets of photos of the process - It is very pretty! I personally really enjoy making printed circuit boards, and I am sure that you can make them yourself. However, if you would like your own controller PCB, I am able to supply blank, or pre-assembled boards. Have a look at the last step for further information. Image Notes 1. The finished controller PCB - Just follow the steps on this page to make this yourself! 2. In this version of the clock controller, I wired the resistors incorrectly - The attached PDF has the correct layout Image Notes 1. We start with the printed page. I print my circuits on my inkjet printer Image Notes 1. A piece of PCB stock. This one is the correct sixe, but it needs a GOOD clean before we can use it. Image Notes 1. Then I take the printout to a real photocopier. I stick a cut piece of Press-nPeel (Blue) to a sheet of paper, and photocopy the image onto the film. I use http://www.instructables.com/id/Arduino-Projects/ Laserjet labels to attach the film to the a4 paper, so it will feed through the photocopier mechanism. Image Notes 1. The same piece of copper after I have scrubbed the daylights out of it with an abrasive cleaner, and steel wool - It is very shiny, and has lots of micro scratches to help the Press-n-Peel blue film adhere. Image Notes 1. I place the Press-n-Peel film onto the clean PBC, and feed it into my laminator. Image Notes 1. This laminator was a $10 find at the local recycling centre - the rollers don't touch any more - which is how I like it for my 1/16" PCB material! I have found the 4 passes at 170 degrees C creates great adhesion. Image Notes 1. After 4 passes, I quench the board under running water to assist in seperating the film from the backing plastic. http://www.instructables.com/id/Arduino-Projects/ Image Notes 1. Once cool - I peel the film gently - and presto - the traces I want stay on the PCB! Image Notes 1. Sometimes I don't make the PCB clean enough - in this case, the blotches left behind do not affect any traces. Image Notes 1. The board - with the film attached beautifully - just need to etch now! Image Notes 1. A plastic bowl to etch the board in 2. I piece of old board trimmings - for testing the etchant 3. Plastic tools to move the board around the etchant 4. My re-used etchant mic - this is so cool - it is so re-usable! It is also VERY poisonous, and etches stainless steel, so don't spill any of it.... http://www.instructables.com/id/Arduino-Projects/ Image Notes 1. I start by dunking the test stick in the etchant for a minute - this verifies that the etchant is operating fine. Image Notes 1. Yes, massive amount of copper etched off (Not all - just testing) - So I can etch the board. If I discover that the etchant isn't very reactive, I can add more Hydrochloric Acid or Hydrogen Peroxide to refresh it. Image Notes 1. The board is sitting inthe etchant now - bubbles are forming onthe surface of the resist. and the exposed copper is changing color as it is being etched. Image Notes 1. Lifting the board up - I see two things. Firstly, the exposed copper is a uniform pink-red color - thats normal , and secondly, the very edge of the PCB is starting to be etched - Whoot! http://www.instructables.com/id/Arduino-Projects/ Image Notes 1. The entire usable area of the PCB is etched now - remove it from the bath, and rinse it. Image Notes 1. The etching process is moving along well - I use an old toothbrush to agitate the surface of the board in areas that are being slow - that speeds things up. Did I mention the I have safety goggles on to protect me from small splashes. 2. This area is well etched. - almost finished! Image Notes 1. Saved etchant - for next time 2. Everything else (including the PCB) being rinsed. Image Notes 1. This blotchyness is normal. 2. PCB ready for drilling. 3. Trusty arlec supertool - 20 years old - and still running fine! http://www.instructables.com/id/Arduino-Projects/ Image Notes 1. Finished drilling - Note that I had a blunt drill, that removed a couple of pads from areas that were not connected. This is not a problem. 2. Note that the board is a bit bigger than I need - we will fix that next Image Notes 1. Drilling holes 2. My old piece of 'drilling wood' NOT THE KITCHEN BENCH!! Image Notes 1. An old Vice 2. Place the board into an old vice, along the lint that you want to shear, and GENTLY lean. Image Notes 1. A scribing tool 2. A deep scribe line where I want to shear the board http://www.instructables.com/id/Arduino-Projects/ Image Notes 1. Shear along the other half of the line - Gentle pressure. Image Notes 1. Sheared lines - need to clean these up Image Notes 1. File the edges of the board nice and clean and straight Image Notes 1. Top side of PCB http://www.instructables.com/id/Arduino-Projects/ Image Notes 1. Foaming - kitchen degreaser 2. Stainless Steel Wool Pad 3. This resist comes off when you apply the 2 materials mentioned here - with ELBOY GREASE! Image Notes 1. See - it does come off..... Just keep scrubbing. When you are finised - the PCB will look like the board inthe start of this page! File Downloads WordClock-Arduino-PCB-V1.0.pdf ((595x842) 37 KB) [NOTE: When saving, if you see .tmp as the file ext, rename it to 'WordClock-Arduino-PCB-V1.0.pdf'] Step 3: The hardware - Populate the controller board Now that we have an etched, sized, drilled and cleaned PCB, we need to start mounting components. POPULATE THE PARTS IN ORDER OF SIZE I soldered all of the components, using the stencil layout as a reference. I started by mounting the six jumpers that I needed to place because I used a single sided board. Then I soldered the header pins and the IC sockets, Then the resistors, diodes and off board connectors. Finally, I plugged in the Integrated Circuits and the Arduino Board, and that step was done. Note there there was a small change with the final board version - the two resistors (R2 and R3) are actually mounted below where the photos show them, and jumpers are installed in the corresponding space. Just follow the parts layout for the exact placement. It was a very restful 30 minutes to do the soldering. Make sure that you use some sort of fume extraction when you solder. To many fumes can end up being bad for you. Here are heaps of photos, showing the steps I used to populate the board. Image Notes 1. ULN2003A Drivers x4 2. You have to guess what this part is ;-) 3. Power Connector 4. Time Set Buttons Connector http://www.instructables.com/id/Arduino-Projects/ 5. Digital 13 LED 6. Power LED 7. 4094 Shift registers x3 Image Notes 1. These are the jumpers poking through the board ready to solder. Image Notes 1. Jumpers added to top side of PCB 2. These are actually jumpers as well in the final board version http://www.instructables.com/id/Arduino-Projects/ Image Notes 1. 16 Pin Machine Pin IC Sockets Dont use the cheap sockets, they will cause trouble in years to come Image Notes 1. Header pins for Arduino Module 2. This header is not mounted - there are no connections to it anyway. It was placed on the board for potential future expansion. 3. 26 way header to Display Image Notes 1. Resistors - all 1K0 2. These resistors are mounted just below the jumpers that are in these spots in the final board version. Image Notes 1. Red Leds 2. Diode http://www.instructables.com/id/Arduino-Projects/ Image Notes 1. Off Board Connectors - Green is DC Power and Blue is to the time setting buttons. They are diferent colors because thats what was in the garage. 2. This is where the ATMega168 Chip goes if you are not using a module. Remember to program the chip in an Arduino board before you try to use it in this project. 3. 16Mhz Crystal if you are not using a module 4. 20pF Cap if not using a module 5. 20pF Cap if not using a module 6. 7805 if not using a module 7. 100uF Cap if not using a module 8. 100uF Cap if not using a module 9. 10K resistor if not using a module 10. 1k Resistor if not using a module Step 4: The display board THINK FIRST Before you do anything, have a think about the size you would like the project to be. In this version, I used high intensity LEDs. they have a beamwidth of about 10 degrees, which means that I had to mount the stencil about 30mm from the LEDs to get an even illumination. If you purchase 'Flat Top' LEDs, then you can make the clock much thinner. MOUNTING THE LEDs I decided to make the display board using a piece of fiberglass material, with the LEDs mounted into a series of holes that I pre-drilled. This is a different mounting system than the original, but I feel that it is probably more accessible, as it doesn't rely on another expensive PCB. The LEDs are soldered on the back of the board to a piece of 26 way ribbon cable that is terminated with a 26 way IDC socket. You can use a piece of thin plywood, or acrylic if you like - Just use whatever material you can that will hold the LEDs stable. MAKING IT (Hey thats a great name for a magazine :-) I started with a square of fibergless sheet, upon which I measured a 12cmx12cm square. I divided that into a grid that was 13 dots x 9 dots (which turned out to have a spacing of 1cm x 1.5cm), and drilled starter holes using a small drill. DRILL HOLES Then I measured the LEDs, and they were indeed 5mm diameter, so I drilled LOTS of 5mm holes.....Before I started drilling, I was aware that there was going to be a very big mess. There was board material everywhere. I did the drilling outside, and made sure I wore a dust mask. So many little holes.... MOUNTING LEDs Once that was done, I slid each led into a hole, being careful to make sure that they were all oriented the same way. A drizzle of hot melt glue was useful in holding the leds in place. When assembling, I mounted every second row on the board, and gently folded the leads down as time came to mount the final sets of rows. SOLDERING IT TOGETHER Then I trimmed the leads, and soldered in the current limiting resistors, and soldered the LEDs together, following the layout diagram exactly. When you are following the diagram, remember that you are working on the BACK of the board, so you need to mentally reverse the layout. Also - don't forget to use 36R resitors (see below) when you are connected to a set of 3 LEDs and 360R (see below) resistors when you are connecting to a set of 2 - It alters the current flow to make the LEDs a uniform brightness. DO I *REALLY* USE 360R AND 36R RESISTORS? As an update, I have been using Blue Flat Top LEDs, with a forward voltage drop of about 3.3v @ 20mA. The supply that I was using was about 10.5VDC. With the http://www.instructables.com/id/Arduino-Projects/ original design, with 2 LEDs, the voltage drop across the LEDs was 6.6v, meaning that 3.9v was being dropped across the resistor (11-6.6). With a 360R resistor, this limited the current to 10.8mA, and with 3 LEDs, the voltage drop across the LEDs was 9.9v, meaning that 0.6v was being dropped across the resistor (11-6.6). With a 36R resistor, this limited the current to 16mA. What I have subsequently discovered is that with supply voltages of 12V, the current through the leds ends up being way too high (15 & 58mA), which is a problem. In my most recent versions, I have setled on 680R for the 2 Leds and 360R for the 3 Leds, providing 7.9 and 7.8 mA respectively. Much lower current, and still ample illumination. ADD A RIBBON CABLE When everything is finished, prepare and solder on the ribbon cable with the 26 way connector. The connector plugs into the controller board. (But I guess you figured that out!) The photos below should show the process that was used. To be completely honest, I think next time I will simply use the display board from the first WordClock that I built. Yes, it would mean making another circuit board, but it was so much simpler to make, and the result looks much nicer. Image Notes 1. Rows and Rows of LEDs 2. For some reason, there was a little bit of wandering (Probable as I measured, given its uniformity). That should not affect the final project, as it is behind the stencil. Image Notes 1. I started with a piece of fiberglass board http://www.instructables.com/id/Arduino-Projects/ Image Notes 1. start with a 12 x 12 square Image Notes 1. a grid 13 dots LEDs wide by 9 LEDs down Image Notes 1. Drilling pilot holes Image Notes 1. Wow - The LEDs are actually 5mm diameter Image Notes 1. So many holes - in the process of being drilled. Image Notes 1. Fiberglass dust from the drilling process. I did this work outside, so it didn't go everywhere http://www.instructables.com/id/Arduino-Projects/ Image Notes 1. Start with a row of LEDs, mounted into the board. Image Notes 1. Hot Melt Glue holds the LEDS in place 2. I brought a pack of 500 LEDS from eBay - This is an example of why they were so inexpensive. Image Notes 1. Ready for trimming and soldering. Image Notes 1. I had to lie down every second row to get access into the final rows for glueing Image Notes 1. I found that bending the pins down made it easier to cut them ready for soldering. Look at the next couple of photos before you start to get the idea. Image Notes 1. Define the top of the board as the side where all of the ANODEs point. Mark it using a marker pen - that way you wont get confused. 2. Each anode is pointing towards the next cathode - ready for soldering. DONT solder them all together, as not all of them ae linked. Have a look at the next http://www.instructables.com/id/Arduino-Projects/ photo. Image Notes 1. The top row completed... 8 more to go. Note that the anodes are connected to the resistors. Notealso the cathodes linked to the next anode. Just follow the schematic. Remember to be patient, and test your work as you go with a 9V battery. Image Notes 1. Resistors from Anodes to common+ 2. Cathode linked to the next Anode 3. Cathodes of the pair linked. this will be connected to the ribon cable line calles 'ITIS' Image Notes 1. Hopefully this cluseup photo will help you to see the technique used to wire up the board. 2. Cathode link, waiting to be connected to a ribon cable connection 3. Individual Cathode, waiting for a ribbon cable connection 4. Common + Waiting for the ribbon cable connection Image Notes 1. This wire links all of the common + links of each row 2. All wiring to the LEDS Completed. YAY! http://www.instructables.com/id/Arduino-Projects/ Image Notes 1. The 26 way ribon cable, ends separated, Just need to strip the ends, tin them, and they will be ready for connecting to the Display board 2. Grumble, grumble--- Drilling all of those holes put holes into my piece of wood..... Have to get another one... This one had done so many projects :-) File Downloads WordClock-Arduino-LED-WIRING.pdf ((595x842) 34 KB) [NOTE: When saving, if you see .tmp as the file ext, rename it to 'WordClock-Arduino-LED-WIRING.pdf'] Step 5: Make the time changing buttons Next, we need to mount a couple of push buttons onto a piece of board material. I wired some short lengths of wire to the buttons, ready for connectint to the terminal block on the controller board. In my case, I used a red and a black button. I found some ribbon cable that had red and black wires, so I used red for the forward button, and black for the backwards, with grey as the common. Have a look at the photos to show you how the buttons were connected. http://www.instructables.com/id/Arduino-Projects/ Image Notes 1. Foward and Reverse Button Image Notes 1. Small piece of VeroBoard Image Notes 1. One Button Image Notes 1. Strip and tin the ends of some wire Image Notes 1. Black wire - black button 2. Red Wire - Red Button 3. Grey Wire - Common Image Notes 1. The button board connected to the Controller http://www.instructables.com/id/Arduino-Projects/ Step 6: Program the Arduino and test the displays Next, we need to use the Arduino sketch editor to program the controller. Open the attached sketch file in the editor, connect the controller using a USB cable, and press the 'Upload' button. This is the cool bit about using an Arduino everything works just by itself! The sketch will be transfered, and it should start executing immediately. In this step is a startup animation as a Gif image. This is what the startup should look like. You may notice that there are a few dark LEDS in the picture where all of the LEDs are lit. These are the LEDs that are not connected. I have included a debug function in the software that prints the time out every time that it is updated via the Arduino serial port, as well as flashing the Digital13 Pin every second. Simply use the Arduino serial monitor to see the time being displayed. It is important to note that you will not see LEDs lighting up when the controller is being powered by the USB cable, as the LEDs are powered by the external power connection. So to test the unit, lets connect the device to a DC power supply. When the unit is plugged in, every word should light up in sequence, and the clock should start running. If one of the words fails to light up, or part of a word doesn't light, check the orientation of the LEDs, and their wiring. I brought a set of 500 LEDs from eBay, and was disappointed with an 8% failure rate when I used them. Some vendors are awesome, and others are not. But - they were cheap! File Downloads WordClock-v1.0.pde (12 KB) [NOTE: When saving, if you see .tmp as the file ext, rename it to 'WordClock-v1.0.pde'] Step 7: Make the word stencil and baffles Finally, we need to make the word stencil for the front of the clock. I used a piece of PCB material, which I etched using the pattern shown below. I simply followed the same press-n-peel process that I used to make the controller board. This time, I intended to use the copper layer on the side closest to the LEDs, but created the stencil the mirror image to what it needed to be - so for this one, the copper is on the outside. I have on order some 1/32" PCB material which I intend to use. I will be careful to get the stencil the correct way around, (with the copper towards the LEDs), and I expect to have a bright, clear display, and I should end up with much less bleed through than I experienced with the original project, because I will make sure that the copper is on the inside of the display.. Prior to using the display, I cut up some more PCB stock to use as 30 mm baffles, and glued the baffles in place with hot melt glue. If you have used 'FLAT TOP' Leds, then you won't need 30mm high baffles, you can probably get away with 10mm or so. Just hold the stencil over the lit display and move it up and down till you are happy with the illumination, measure the height, and make the baffles that height :-) Others who have built my previous clock have used acrylic as a display material with cut vinyl as the lettering. That probably looks awesome! In one case, they have used glass! http://www.instructables.com/id/Arduino-Projects/ Image Not 1. Stencil P Image Notes 1. All done - Whoot! Image Notes 1. Through the laminator Image Notes 1. A sheet of PCB material about to be cut into 30mm strips http://www.instructables.com/id/Arduino-Projects/ Image Notes 1. Just prior to etching. An irrating feature of the Transfer method is that large areas sometimes end up with pinholes in them. I use Permanent marker to cover the holes up prior to etching. 2. Missed this hole..... Image Notes 1. A stack of 30mm Strips about to be used as baffles. Image Notes 1. The first strip hot melt glued into place between lines. http://www.instructables.com/id/Arduino-Projects/ Image Notes 1. 2 strips. They are not very stable at the moment - that will improve when we have some word spacers in place Image Notes 1. Most line baffles in place Image Notes 1. A small vertical baffle for use between words. I make these by cutting up some line baffles into small lengths Image Notes 1. The first couple of word baffles in place - things are starting to get stronger Image Notes 1. Another view - hopefully you can see how it is constructed. Image Notes 1. A final view. Should be clear now! 2. A 2 line LCD display for another project File Downloads Wordclock-Arduino-Stencil.pdf ((595x842) 23 KB) [NOTE: When saving, if you see .tmp as the file ext, rename it to 'Wordclock-Arduino-Stencil.pdf'] Step 8: Making a simple enclosure I had some spare time before I had to be somewhere else, so I decided that while the saw was out for cutting baffles, I would make a simple enclosure. Before you do anything, remember the basic workshop safety rules - wear safety goggles, keep fingers clear of rotating saw blades, and generally don't be stupid. I used chipboard, because (you guessed it) there was some in the garrage. I trimmed the board to a uniform width for the top, bottom and sides. Next I cut the bottom and top to length. Once I was happy with the size of the bottom, I cut a couple of grooves for the display and stencil PCBs to sit in. Then I measured and cut the sides. I glues the bottom and sides together and used chipboard screws to hold them together. Note that I didn't glue the top - you need to be able to remove the top if you want to extract the display or stencil PCBs. Next, I cut a piece of thin ply as the back. Then I mounted some back supports into the box soI had something to screw the back into. Next, I mounted the Controller PCB, being careful to use washers between the back of the board and the wood, so I didn't put stress on the solder connections. Finally, I routed the cables through holes I had previously cut in the back, mounted the button board on the back of the case, and closed it up. WHOOT - It works, and looks great. http://www.instructables.com/id/Arduino-Projects/ Image Notes 1. The top and bottom just cut to size. Image Notes 1. Grooves for the stencil and display boards to sit in. 2. stencil and baffle board 3. display PCB 4. bottom of case. Image Notes 1. checking the fit of the top and bottom. Looking good! Image Notes 1. sides cut to length - fits beautifully Image Notes 1. Back cut from thin ply - also fits fine Image Notes 1. display PCB in place 2. supports added to hold the plywood back http://www.instructables.com/id/Arduino-Projects/ Image Notes 1. Controller PCB added. Make sure you use washers or some sort of spacer when you mount the board to prevent pressure being applied to the solder connections under the PCB. Image Notes 1. Button board is mounted on rear - hole is there for the cable 2. My wallwart just plugs into the arduino Image Notes 1. Final clock - YAY The exposure shows way more bleed through than I see with my eyes. But it works! Step 9: Bill of Materials Here you will find the complete parts list you need to create the project yourself. Bill Of Materials Controller board Arduino Duemilanove module ULN2003A Driver IC * 4 4094 Shift Register * 3 5mm red Led * 2 1K Resistor * 4 1N4004 Diode 2 Pin PCB Mount Screw Connector 3 Pin PCB Mount Screw Connector 26 way header 8 way header * 2 6 way Header * 2 16 Pin IC Socket * 7 Controller PCB Display board 5mm blue LED * 117 360R resistor * 25 (can be 680R - see step 4) 36R resistor * 25 (can be 270R - see step 4) http://www.instructables.com/id/Arduino-Projects/ 26 way ribbon cable * 30cm 26 way IDC Connector 150mmx150mm fiberglass / perspex mounting board - or Display PCB Button board Red Pushbutton Black Pushbutton Veroboard - 3cm x 2 cm wire (3 strand) - 30cm Stencil board 150mm x 150mm single sided fiberglass PCB material 150mm x 30mm fiberglass PCB strip horizontal baffle * 10 14mm x 30mm fiberglass PCB strip - vertical baffle * 10 Hot Melt Glue Power Supply 12V DC, 500mA Wall Wart Plug Pack. Step 10: Next Steps Where to next? Well, I will continue to be working on the following things in the ensuing months; 1. I have ordered some ATMega168 with bootloader chips from eBay. When they arrive, I will program and install the chip, and recover my Arduino for another project. 2. I will continue experimenting with better display options. The secret is in getting a diffused light to light the back of the letters. Some suggestions have been vinyl cut letters on a sheet of white acrylic or glass. That should be fun. 3. Ideally there should be some way to add battery backup. I would like to add that. 4. Automatically setting the clock. WOW - Here in Australia, we don't have any useful time sources that can be used for automatic clock setting. In the USA and Europe, there are VLF time sources that can be used, but here in OZ, we just have to rely on GPS. That would be a cool addition, a GPS receiver that could get the current time to keep it accurate. So Many Options! But then, that's what Arduino is about! Step 11: Whats been hapening these last few months.... Update: As an update, I have redesigned the Arduino clock controller board - I decided that in reality all I needed was the ATMega Chip itself, and that placing an entire module was a waste of PCB space. I have further updated it to version 3 - supporting a RTC chip, and reducing the size of the PCB. Here is a photo of the v2 and v3 boards, and an assembly manual, (which I have been sending out with my kits) - That should make assembly easier for anybody who wants to make one themselves. The new PCB The new PCB that I designed has larger tracks, and larger pads, making assembly easier. When you look at the PDF, you will see that there are large copper masses 'directly over' existing tracks. Please don't worry - that is normal - it is a ground plane, and the track that it is over is the ground track. All of my boards try to use ground planes so that I have to etch less copper from the board. Programming the new board: One Idea I got from EvilMadScience.com, was to use one of their programming cables, instead of using an entire Duemilanove module. It is really cool - you pay $20, and you can use the cable for many many projects - all you have to do is include a trivial programming header on the PCB. The cable is available from: evilmadscience.com/partsmenu/130-usbttl A New Display PCB I have been designing a new display PCB - I can etch it on 2 6x6 inch pieces of single sided PCB stock - the neat thing about the new display, is that it gets cut into a set of "LED Strips", with each strip being used to illuminate a word. the spacing between LEDs is about 23mm, so I can use these strips to make BIG WORDS (Much larger than the 6 inch displays i have been making). The clock size that I am making currently will be about 240mm x 240mm for the word plane, set into a total display that is about 320x320, making a really nice wall clock - It will take a couple of weeks, but as soon as I have something more tangible to display, I will put it up here. I etched the PCB over the Easter weekend, and am looking forward to making a bigger display. Another side effect of the LED strips, is that you are not limited to English words - we can modify the software for any language, and you can use whatever size strips you need behind words to make the clock work!!! Updated Software to allow the brightness to be reduced at night I have modified the software to allow the brightness of the clock to be automatically adjusted based on the time - At 7pm, it will reduce the brightness, and at 7am, it will increase it again - This was to allow the clock to be less intrusive in my daughters bedroom. Attached is the software that allows that to happen, and Matt Sparks DS1302 library. It is in the file Wordclock-reduced-brightness.zip attached to this step. http://www.instructables.com/id/Arduino-Projects/ Image Notes 1. v2 controller - No space for an Arduino board any more - I just use the AtMega168 chip directly! Image Notes 1. Arduino Compatable v3 controller 2. DS1302 RTC 3. AtMega168 CPU 4. Programming header for the FTDI USB-232 cable 5. Extra minute LED connections 6. 26 way cable to the LED array - Supports 24 seperate outputs 7. Battery Backup - 3V 8. Time setting button connections 9. 12V DC - 400mA Power input File Downloads Arduino-Controller-Assembly Manual-email.pdf ((595x842) 695 KB) [NOTE: When saving, if you see .tmp as the file ext, rename it to 'Arduino-Controller-Assembly Manual-email.pdf'] Wordclock-Arduino-V2-Overlay.pdf ((595x842) 24 KB) [NOTE: When saving, if you see .tmp as the file ext, rename it to 'Wordclock-Arduino-V2-Overlay.pdf'] Wordclock-Arduino-V2-PCB.pdf ((595x842) 61 KB) [NOTE: When saving, if you see .tmp as the file ext, rename it to 'Wordclock-Arduino-V2-PCB.pdf'] Wordclock-Arduino-V2-Jumpers.pdf ((595x842) 20 KB) [NOTE: When saving, if you see .tmp as the file ext, rename it to 'Wordclock-Arduino-V2-Jumpers.pdf'] http://www.instructables.com/id/Arduino-Projects/ Wordclock-reduced-brightness.ZIP (10 KB) [NOTE: When saving, if you see .tmp as the file ext, rename it to 'Wordclock-reduced-brightness.ZIP'] Related Instructables A Word Clock by drj113 The Wordclock Grew Up! by drj113 Pong Clock by mrnick1234567 Sleek word clock by scottbez1 A credit card sized Ethernet Arduino compatable controller board by drj113 Interfacing Electronic Circuits to Arduinos by maewert TimeDuino- 7 Segment Arduino Clock (No shift registers needed!) by astroboy907 How to build C3Jr, a sophisticated word clock by florinc http://www.instructables.com/id/Arduino-Projects/ Light for life: Glowing button cycling jacket by kempton on May 17, 2009 Intro: Light for life: Glowing button cycling jacket Not everyone wants to look like an athlete while cycling to work or school. This cycling-jacket, made of hemp and wool, is equipped with lots of shining bright LEDs. It looks just as good during the day as it does during the night. Embedding the Arduino Lilypad electronics in the jacket, makes it at practical as it is nice to look at! http://www.instructables.com/id/Arduino-Projects/ http://www.instructables.com/id/Arduino-Projects/ Step 1: Gather stuff for the project This project includes working with textile and a bit of electronics. To make the jacket I used the following tools: - sewing machine - sewing needles - seam ripper - enough cloth to make a jacket - tape measure - pins - sewing thread in different colours - 16 semitransparent buttons electric tools/equipment: - multimeter - conductive sewing thread - Lilypad Arduino - 2 Lilypad pushbuttons - Lilypad batterypack - 6 red 3mm LED - 6 orange 3mm LED - 2 white 3mm LED - puffy fabric paint http://www.instructables.com/id/Arduino-Projects/ Step 2: Start our own sewing project! The project starts pretty simple; acquire a jacket you like, I am using a sporty running-jacket. You can either use the jacket as it is, or you can take it apart with a seam ripper. When the jacket is taken apart, quickly iron out the parts, especially the seams, to make it easier to transfer the pattern to the textile. For my jacket I use 3 different textiles, Hemp Denim (500gsm), Hemp canvas (300gsm) and wool jersey (200gsm). Denim for the front and back, canvas for arms and wool underneath the arms. Open up seams and lay the parts on your textile. Outline the parts with tailors chalk or a coloured pencil, and cut out the pattern with a pair of sharp scissors. Make sure to lay the textile in double layers, to get two mirrored identical parts (for the ones that are identical). Step 3: Sewing the jacket For complete instructions on how to assemble and sew a piece of clothing, I will recommend another tutorial on this site. This is on of my first sewing projects, and I have limited skills. I have assembled the jacket inside out. I have mostly used a jeans seam, with a strong polyester thread. This makes it a solid piece of clothing. The original jacket, being a running-jacket, has a thin netting fabric underneath both arms to keeps your body cooler under sweaty conditions. I have replaced this with a comfortable thin wool fabric. When sewing this thin wool together with a thick hemp denim, make sure not to stretch the cloth. I was forced to undo the seams more than once, and I assure you, opening up a seam on thin wool is a bit of a task! http://www.instructables.com/id/Arduino-Projects/ Step 4: Exploring with electronics The jacket is now sewn together, zipper not included, and it is time to start planning the electronics, which basically makes the jacket one large ciruit-board. I advise you to draw a simple semantics for the placement of electric components on your jacket. I have decided to place 12 coloured lights on the back, in pairs of 3, and 2 white lights on the front. A push-button on each arm to activate the lights. It is important to remember that the conductive thread, usually made of polyester and stainless steel, does have a lot of resistance. I measured 14 ohms pr. 30cm (or 1' foot) on my 4-ply thead, as opposed to standard 1mm wire, which is less than 0.5 ohm. The Arduino Lilypad carries a 5v output with 40mA. Placing the LEDs at right distance from the mainboard, you eliminate the need for resistors. Here is a simple LED calculator http://www.instructables.com/id/Arduino-Projects/ Step 5: Make your own shining bright buttons The standard 3mm LEDs come equipped with an epoxy lens to direct the light in one way. With some sandpaper, rub down the lens, so you are left with only the metal core. Caution! if you look closely, you will se that there is a small metal wire right above the light source, do not rub this away! At a local store I found some simple semitransparent buttons, 14 for the lights and 2 for the pushbuttons. Using a mounted or handheld powertool, make a small hole where it makes most sense to place the LED. My hole measures 6mm in diameter, 2mm deep. I have placed the hole below the button-holes. Bending the legs on the LED so they are pointing in the same direction as the light, the legs are put where the button-holes are. To make it look better, cut two small grooves from the LED hole to the button-holes, one for each leg. The reason for this is that you will later sew the buttons to the jacket with conductive thread. The conductive thread will connect with the led LED legs, + and -, and make them shine! Remember: on normal LED lights, the longest leg is +. place all the LEDs the same way, and it will be easier for you! http://www.instructables.com/id/Arduino-Projects/ Step 6: Make your own interactive jacket With all the LED buttons ready and the schematics at hand, it is time to start sewing with conductive thread. The 4-ply conductive thread is placed in the bottom thread, with a cotton or polyester thread on top of the sewing machine. I have measured up all the lengths, with approximately 20cm excess on each end. I have decided to place the mainboard and battery at the inside on the front of my jacket. All the lights at the back of the jacket are in pairs of three. This means that each section has to have 4 connections, one for each light(+), and a ground(-). Make sure no conductive thread is overlapping without placing something in between. This is where the ground(-) for each button have to overlap the other threads. This for my part is the most time consuming, but keep in mind, this is where you can experiment with ornaments and coloured threads! When all the theads are in place, it is time to start sewing the buttons together. Caution: when sewing the button, + and -, make sure they don't touch each other, this will cause a short. With a small needle, I sew each thread 3 times, making sure there is a firm connection with the LED legs. Do the same with the pushputtons, placed on each arm. On top of the pushbuttons I have simply sewn a button on top, to make it look better, and making it a larger button. As well as tying a knot to fasten the button, use a soldering-iron to melt the end thread to its self. This reduces risk of the two threads touching and creating a short! http://www.instructables.com/id/Arduino-Projects/ Step 7: Connecting the Arduino In my project I have linked up all the lights to an Arduino Lilypad prototyping board. This is a small round circuit-board that you can connect to any USB, and enables you to create an infinite number of light sequences and fuctions. It is reasonably simple to use, though some programming needed. Check out the Arduino homepage for more info and where to buy. It is also possible to just connect it all to a simple battery. In fact, this would be a whole lot easier. I want my lights to act as turning signals, so I have used the Arduino. http://www.instructables.com/id/Arduino-Projects/ Step 8: More on connecting the bits and pieces To make it easier(or more difficult), I have soldiered all the electronics, the Arduino and its 5v battery, to a copper circuit-board. The circuit-board has a connector soldiered to it. The opposite connector is placed on the jacket, with each thread connected on a seperate pin. The connector is a 34-pin floppy connector I found in an old computer, and is perfect for my project. It is also possible to sew the Arduino Lilypad and its batterypack directly to jacket. The board should be waterproof, are we to believe the creator Leah Buechley. Check out her webpage for more info . All the ground(-) theads are put together. Remember where you place the - on the connector, as it has to be placed at the same place on Arduino board. As the Arduino Lilypad only has 14 seperate programmable connections, I have connected the light on the front of the jacket to the + on the battery. The 12 light and the 2 pushbuttons are put on the programmable connections. On the programming part, I have basically borrowed Leah Buechley's code for her cycling-jacket, and given some more fancy light sequences, as I am very novice in Arduino programming. At the bottom of this page i have pasted in my code. Check out Leah's homepage for more detailed info on how to connect the electronic components together, particularly her jacket! To insulate the conductive thread is advisable. This helps the threads touching eachother. Paint all the threads with puffy textile paint. int BL1 = 10; int BL2 = 9; int BL3 = 8; int TL1 = 6; int TL2 = 5; int TL3 = 4; int BR1 = 11; int BR2 = 12; int BR3 = 13; int TR3 = 3; int TR2 = 2; int TR1 = 1; int leftSwitch = 7; int rightSwitch = 0; int x, y; int mode = 0; http://www.instructables.com/id/Arduino-Projects/ int DAY = 0; int NIGHT = 1; int d; void setup() // run once, when the sketch starts { d = 100; pinMode(BL1, OUTPUT); pinMode(BL2, OUTPUT); pinMode(BL3, OUTPUT); pinMode(TL1, OUTPUT); pinMode(TL2, OUTPUT); pinMode(TL3, OUTPUT); pinMode(leftSwitch, INPUT); digitalWrite(leftSwitch, HIGH); pinMode(rightSwitch, INPUT); digitalWrite(rightSwitch, HIGH); pinMode(TR1, OUTPUT); pinMode(TR2, OUTPUT); pinMode(TR3, OUTPUT); pinMode(BR1, OUTPUT); pinMode(BR2, OUTPUT); pinMode(BR3, OUTPUT); } void loop() // run over and over again { checkLeft(); checkRight(); if (mode == NIGHT) night(); else day(); } void checkLeft() { if (digitalRead(leftSwitch) == LOW) { while (digitalRead(leftSwitch) == LOW) { if (digitalRead(rightSwitch) == LOW) { while (digitalRead(rightSwitch) == LOW | digitalRead(leftSwitch) == LOW); mode = 1-mode; return; } } leftTurn(); } } void checkRight() { if (digitalRead(rightSwitch) == LOW) { while (digitalRead(rightSwitch) == LOW) { if (digitalRead(leftSwitch) == LOW) { while (digitalRead(leftSwitch) == LOW | digitalRead(rightSwitch) == LOW); mode = 1-mode; return; } } rightTurn(); } } void leftTurn() { for (x=0;x<10;x++) { digitalWrite(TL1, HIGH); digitalWrite(BL1, LOW); for(y=0;y<10;y++) http://www.instructables.com/id/Arduino-Projects/ { delay(30); if (digitalRead(leftSwitch) == LOW) { while (digitalRead(leftSwitch) == LOW); digitalWrite(TL1, LOW); digitalWrite(BL1, LOW); return; } } digitalWrite(TL1, LOW); digitalWrite(BL1, HIGH); for(y=0;y<10;y++) { delay(30); if (digitalRead(leftSwitch) == LOW) { while (digitalRead(leftSwitch) == LOW); digitalWrite(TL1, LOW); digitalWrite(BL1, LOW); return; } } digitalWrite(BL1, LOW); } } void rightTurn() { for (x=0;x<10;x++) { digitalWrite(TR1, HIGH); delay(d); digitalWrite(TR2, HIGH); delay(d); digitalWrite(TR3, HIGH); delay(d); digitalWrite(BR1, LOW); delay(50); digitalWrite(BR2, LOW); delay(50); digitalWrite(BR3, LOW); delay(50); digitalWrite(TL1, LOW); digitalWrite(BL1, LOW); for(y=0;y<10;y++) { delay(30); if (digitalRead(rightSwitch) == LOW) { while (digitalRead(rightSwitch) == LOW); digitalWrite(TR1, LOW); delay(d); digitalWrite(TR2, LOW); delay(d); digitalWrite(TR3, LOW); delay(d); digitalWrite(BR1, LOW); delay(d); digitalWrite(BR2, LOW); delay(d); digitalWrite(BR3, LOW); delay(d); return; } } digitalWrite(TR1, LOW); delay(d); digitalWrite(TR2, LOW); delay(d); digitalWrite(TR3, LOW); delay(d); digitalWrite(BR1, HIGH); delay(d); digitalWrite(BR2, HIGH); delay(d); digitalWrite(BR3, HIGH); delay(d); for(y=0;y<10;y++) { delay(30); if (digitalRead(rightSwitch) == LOW) { http://www.instructables.com/id/Arduino-Projects/ while (digitalRead(rightSwitch) == LOW); digitalWrite(TR1, LOW); delay(d); digitalWrite(TR2, LOW); delay(d); digitalWrite(TR3, LOW); delay(d); digitalWrite(BR1, LOW); delay(d); digitalWrite(BR2, LOW); delay(d); digitalWrite(BR3, LOW); delay(d); return; } } //digitalWrite(BR1, LOW); digitalWrite(TR1, LOW); digitalWrite(TR2, LOW); digitalWrite(TR3, LOW); digitalWrite(BR1, LOW); digitalWrite(BR2, LOW); digitalWrite(BR3, LOW); } } void night() { digitalWrite(TR1, HIGH); digitalWrite(TR2, HIGH); digitalWrite(TR3, HIGH); digitalWrite(BR1, HIGH); digitalWrite(BR2, HIGH); digitalWrite(BR3, HIGH); digitalWrite(TL1, HIGH); digitalWrite(TL2, HIGH); digitalWrite(TL3, HIGH); digitalWrite(BL1, HIGH); digitalWrite(BL2, HIGH); digitalWrite(BL3, HIGH); } void day() { digitalWrite(TL1, HIGH); digitalWrite(TR1, HIGH); digitalWrite(BR1, HIGH); digitalWrite(BL1, HIGH); } http://www.instructables.com/id/Arduino-Projects/ Step 9: And there was light! And there was light! The jacket works well, and my mother is now a whole lot safer cycling at dark. And mum, if you read this, remember to wear a helmet! http://www.instructables.com/id/Arduino-Projects/ http://www.instructables.com/id/Arduino-Projects/ Related Instructables LED Array Jacket by openfly Halloween fading eyes garden creature by circuitmania Transform a frumpy, old denim jacket into a cute NOSEW Bolero by brittanymarie turn signal biking jacket by leahbuechley Latch-Modified Turn-Signal Jacket by quasiben Make an Atom Synchronised Clock from a 1950's Slave Dial by LinusDillon How to make an Emoticon Jacket with LCD screen by kstran07 EL Wire Jacket (Photos) by noahh http://www.instructables.com/id/Arduino-Projects/ A credit card sized Ethernet Arduino compatable controller board by drj113 on July 4, 2010 Author:drj113 I have a background in digital electronics, and am very interested in computers. I love things that blink, and am in awe of the physics associated with making blue LEDs. Intro: A credit card sized Ethernet Arduino compatable controller board I love the Arduino as a simple and accessible controller platform for many varied projects. A few months ago, a purchased an Ethernet shield for my Arduino controller to work on some projects with a mate of mine - it was a massive hit - for the first time, I could control my projects remotely using simple software. That got me thinking - The Arduino costs about $30AUD, and the Ethernet board cost about $30AUD as well. That is a lot of money - Could I make a simple, dedicated remote controller for much cheaper? Why Yes I could. Could I make it the size of a credit card? Why Yes - I could!! This project is my simple Arduino compatible controller that has embedded Ethernet, and the capacity to drive some extra I/O lines for projects, such as a Remote thermometer, a Remotely accessible Fridge controller, and a Remote Humidity sensor. I have to say from the start that I didn't write all of the software, my mate Mikal did that - but this instructable is about making your own controller board! Lets start! Step 1: Here is the Schematic Diagram For the curious, this is the schematic diagram of my simple Ethernet board. As you can see, there are a number of exposed header connectors that can be used to connect peripheral devices to. The board is powered with a supply of between 7 and 12v. It contains voltage regulators to provide +5v and +3.3v for the Ethernet controller. There is also a 4 position DIP switch that can be used to allow programmed functions to be modified. A failing of the standard Arduino Ethernet library is that the IP address for the board has to be set in code. Using the DIP switch, a block of addresses can be selected from as required. You can make 16 boards, and have each board automatically select a different address based on the switch setting. This is *really* handy when you have deployed 10 sensors around the house. All you need to do is set a switch and then they are configured. The pinouts of the I/O connectors are; I/O1 - 1 - PD5 (Arduino Pin 5) I/O1 - 2 - PD6 (Arduino Pin 6 +pullup to +5v) - Used to connect a DS1820 Temperature sensor. I/O1 - 3 - PD7 (Arduino Pin 7) I/O1 - 4 - PD8 (Arduino Pin 8) I/O1 - 5 - GND I/O2 - 1 - +5v I/O2 - 2 - GND I/O2 - 3 - PD4 (Arduino Pin 4) I/O2 - 4 - PC0 (Arduino Analog 0) I/O2 - 5 - PD3 (Arduino Pin 5) I/O2 - 6 - PC1 (Arduino Analog 1) I/O2 - 7 - PC2 (Arduino Analog 2) I/O2 - 8 - PC3 (Arduino Analog 3) I/O2 - 9 - PC4 (Arduino Analog 4) I/O2 - 10 - PC5 (Arduino Analog 5) http://www.instructables.com/id/Arduino-Projects/ File Downloads Arduino-Ethernet-schematic.pdf ((595x842) 59 KB) [NOTE: When saving, if you see .tmp as the file ext, rename it to 'Arduino-Ethernet-schematic.pdf'] Step 2: The PCB Layout Here is the PCB layout. As with all of my projects, I make the circuit boards using press-n-peel blue as a toner transfer, and cuperic chloride as the etchant. This layout can be printed onto a laser printer directly and used as artwork. I wrote detailed instructions in my Arduino Wordclock writeup that you can follow to etch your own board. Check out http://www.instructables.com/id/The-Word-ClockArduino-version/step2/The-hardware-Make-the-controller-board/ for details. One thing with this layout - I had to use a surface mount IC (a 74HC08) - Please do not be too scared by the surface mount technology - it is extremely simple to solder as we will see in the next step. Anyway - Go on - make a PCB, and check out the next step for how to assemble the board. Remember - download the PDF file as the master - not the PNG picture - the PNG is just there so that you can see what it will look like - it is almost certainly not to scale! If you print the PDF full size (without scaling) then it is the exact correct size for Toner Transfer. *Upate* - I just made another controller and realised that the pin spacing on the Ethernet jack was slightly off.... It has been fixed in the attached PDF layout. File Downloads Arduino-Ethernet.pdf ((595x842) 47 KB) [NOTE: When saving, if you see .tmp as the file ext, rename it to 'Arduino-Ethernet.pdf'] http://www.instructables.com/id/Arduino-Projects/ Step 3: Soldering the Components Now that we have a PCB, it is time to solder the components onto the board. Download the attached top and bottom pictures of the board to let you know where the various parts are placed. Also download the file to let you know where the 3 jumpers have to be installed on the top side of the PCB. Lets start by getting the surface mount 74HC08 onto the board. I promise that it is not as hard as it looks. Firstly - clean your work surface - there is nothing more frustrating that working in a mound of junk, when you have to do something carefully. Continue by tinning the pads where the IC will be mounted - just apply a little bit of solder, not a great mound. Once the pads of the PCB have been tinned, get the part, place it onto the tinned pads, double check it is oriented correctly - The PCB has a dot where pin 1 should be - make sure that the part is facing that direction. Then using a fine tipped soldering iron, touch one pad on a corner of the chip to heat it. Let the solder melt, and then let it cool. Look closely at the part to verify that it is still oriented correctly, and aligned with all the pads. Then solder the opposite corner. Now, under a decent light, using a magnifying lamp, spend a minute double checking that the device is sitting correctly on the pads - if it isn't, just re-heat a pin, and fix it up. Once you are happy that the alignment is correct, heat the rest of the pads to melt the solder and connect the device. If necessary, add just a tiny bit of solder. Again double check that your work is neat and clean - If you end up shorting pins together, don't panic - just use a little bit of Solder Wick to remove the excess solder. Once you have the 74HC08 soldered, pat yourself on the back, and go and show your fine work to a significant person in your life!! - You did it! You can now solder Surface Mount parts! A whole new world awaits you! Next solder down the surface mount capacitors on the back of the board - they are *simple*, just use a similar process to what youhave already used - and do not be afraid to add a little bit of solder to keep the joints neat. Next, turn the board over and install the jumpers on the top side. Continue assembly by mounting all of the resistors, capacitors, the ferrite bead, IC sockets, LEDs and connectors. Finish off by plugging the Micro controller into the socket, and the Ethernet controller into its socket. Finally - spend a couple of minutes under a strong light double checking your work - If I had a dollar for every stupid time I forgot to solder a pin, and spent a night debugging something silly - I would be able to spend the rest of my life writing Instructables projects.... Sadly..... Anyway, where was I? Ahhh. There - You have done it - you now own your first Ethernet micro board! Now we just have to load up some software. Image Notes 1. Tinned Traces http://www.instructables.com/id/Arduino-Projects/ Image Notes 1. If you short some pins don't panic - just use a little bit of solderwick, and it will be better! Image Notes 1. Pins gently soldered in place 2. Don't worry about these extra pads in this photo - this board is actually a full surface mount version of the controller that I am working on.... Image Notes 1. Completely soldered - Easy! Step 4: Programming the Firmware Now - we can load up the firmware. Attached is a sample project - in this case, it is the trivial web server example from the Arduino library - it uses a DS1820 chip connected to Pin 2 of I/O 1. I have to say that I did not write the web temperature project - it is the sample one from the Ethernet library - It works beautifully on this board! Use a FTDI-TTL cable to download the code - you can get one of the cables from http://evilmadscience.com/partsmenu/130-usbttl They only cost $20, and I can guarantee that every project you make in the future will have that magic 6 pin interface.... File Downloads etherShield_web_temperature.pde (9 KB) [NOTE: When saving, if you see .tmp as the file ext, rename it to 'etherShield_web_temperature.pde'] http://www.instructables.com/id/Arduino-Projects/ Step 5: But what does it do???? Ahhh - I was wondering when you would ask this question. I have these boards strewn all around Mikals house - they are doing things ranging from measuring temperature, to measuring humidity, to controlling the temperature of the beer fridge. Here is a photo of one of them in situ - in this case it is measuring the humidity near Mikal's books. This is an old version of the board - but it has been doing sterling service. If you want a copy of Mikals code from any of his systems, check out Mikals blog at http://www.stillhq.com The old version of the Beer controller is at: http://www.stillhq.com/arduino/000003.html and the Hygrometer is at: http://www.stillhq.com/arduino/000007.html Image Notes 1. Arduino Ethernet Board 2. Hygrometer 3. An old Microsoft DVD - Good as an extra 12mm of shelf padding! Step 6: Parts LIst Here is the parts list: Semiconductors: Micro - ATMega168 or ATMega328 - DIP (the 328 provides extra code space) Ethernet - Microchip ENC 28J60 - DIP 74HC08 - Surface Mount 3mm LED X2 5mm LED 1N4004 Diode 78L05 Regulator 78L33 Regulator 16 Mhz Crystal 25 Mhz Crystal Resistors 50R x 4 270R x 5 2k7 x 2 10K x 3 Caps: 18pF x4 - Surface Mount 100nF x 4 - Surface Mount 10uF x 3 - Surface Mount Hardware: 28 pin socket x 2 4 pin dip switch RJ45 MAGJACK - Has to be a MagJack, as that has the ethernet isolation transformer inside it http://www.sparkfun.com/commerce/product_info.php?products_id=8534 10 pin header 6 pin header 5 pin header 2 pin header Small Pushbutton switch Arduino Ethernet PCB http://www.instructables.com/id/Arduino-Projects/ Step 7: KiCad Files Many people have been asking for the source files for this project. Here they are. They are in KiCad format. KiCad is Open Source, Free, Accessible, and does not apply arbitrary license restrictions. As a community, I feel that we should be supporting open source software. I appreciate that some people would like to see Eagle versions, but I simply can not condone Eagle's licensing model. I am a private user, but the size limitation of the boards in Eagle means that I can not use that product to make trivial 150mm x 150mm PCBs for my clocks. So I simply do not support their product. Anyway - here is an archive of the project tree from my system - I hope you find it useful! Please keep in mind the CC attribution license for my projects. *update* I had received some feedback that the custom libraries that I made for the MagJack and the enc28J60 were missing - I have added them to the download - it *should* work - but these things are always hit ans miss if you haven't tried them on another machine... (You do build up a collection of useful libraries that you don't even realise you use...) I also removed the LCD module library reference, as there is no LCD module installed.... It was just the default, as manu of the projects that I make have LCD screens on them. File Downloads ArduinoEthernetController-1.zip (678 KB) [NOTE: When saving, if you see .tmp as the file ext, rename it to 'ArduinoEthernetController-1.zip'] Related Instructables A Remotely Programable Relay Controller (Christmas Lights or Home Automation Controller) by drj113 A watering controller that can be home networked by drj113 Arduino HVAC Displaying Servo Twitter feed Thermostat/Controller without a PC! by by tikka308 fabrizio.granelli PS1 Controller Joysticks with Arduino by Finnio The Arduino AA Undershield by Artificial Intelligence The Best Arduino by msuzuki777 Make your own programmable thermostat for $66 with Arduino by dustinandrews http://www.instructables.com/id/Arduino-Projects/ Secret Knock Detecting Door Lock by Grathio on October 12, 2009 Author:Grathio Grathio Labs Creative swashbuckler. Writer for MAKE Magazine, presenter of inventions on TV, radio, magazines and newspapers. Professional problem solver. Annoyingly curious. Hacker of all things from computers to clothes to cuisine. Intro: Secret Knock Detecting Door Lock Protect your secret hideout from intruders with a lock that will only open when it hears the secret knock. This started out as a bit of a joke project, but turned out to be surprisingly accurate at judging knocks. If the precision is turned all the way up it can even detect people apart, even if they give the same knock! (Though this does trigger a lot of false negatives, which is no fun if you're in a hurry.) It's also programmable. Press the programming button and knock a new knock and it will now only open with your new knock. By default the knock is "Shave and a Haircut" but you can program it with anything, up to 20 knocks long. Use your favorite song, Morse code, whatever. Maybe a video will explain it better: Important Notes: (I hate to even have to say this, but since someone's going to say it, I'll say it first:) 1) This is for entertainment purposes only. Really. This decreases the security of your door by adding another way to unlock it, and it makes your unlock code known to anyone who can hear. If you put this on your door, be sure to carry your key too. The batteries might die, the suction cups might fail or you might forget your knock. Don't complain to me if someone imitates your knock and steals all your stuff, you've been warned. For obvious improvements to safety, security and whatever, see the final page of the Instructable. 2) This is not a project for a beginner! Read through it carefully and be sure you understand it before you start! I will not take time to answer questions that are already in the instructions or from people who have gotten in over their head. (If you think this project is too complex you might go here and sign up for the kit mailing list. The kits will be much more simple than this.) Sorry about that. Now that that's out of the way, lets get to work. http://www.instructables.com/id/Arduino-Projects/ Step 1: Tools, Supplies, And Skills (If this all looks too challenging, you might consider signing up to the kit mailing list which, when available, will be much easier and a lot more simple.) Time: This project will take several hours to complete. Skills: To complete this project you should be able to do the following: These are important! If you're not sure if you have these skills, read through the entire Instructable and make sure you understand it before starting anything! Basic soldering. Read a basic schematic. Basic knowledge of microcontrollers (I'll be using the Arduino.) This means you know what one is, how to upload data to it, and how to make minor changes to code. Improvisation. There are many ways to do this project, and you will have to make changes based on how your door and lock works. Tools: Drill (ideally a drill press) and an assortment of drill bits. Saw capable of cutting PVC pipe. (ie: Pretty mcuh any saw.) Soldering iron and solder. Pliers. Screw drivers. Heat-shrink tubing and/or electrical tape. Wire stripper. Vice. Safety glasses. Gloves. Other things you might find handy: a ruler/tape measure, a multimeter, a breadboard, some tape, a magic marker, sand paper, files, hot glue. And if you're like me a well stocked first aid kit. Materials: (The links are for example only, I don't necessarily recommend or have experience with any of these vendors. Feel free to suggest other sources in the comments.) Electronics: 1 Arduino Duemilanove (Or compatible. Or really any microcontroller with at least 1 analog input and 3 digital outputs.) Buy from here, here, or here. And other places. 1 5v Gear reduction motor. The higher torque the better. Here's a good one. (14-16mm diameter is ideal because it fits inside of 1/2" PVC pipe.) I recommend one with at least 15oz/in (11 N-cm) of torque at 5v to turn a basic lock. 1 1 Piezo speaker. (30mm) similar to this. You can use larger or smaller ones, smaller will be less sensitive. 1 SPST momentary pushbutton. (normally "off") 1 Red LED 1 Green LED 1 NPN Transistor P2N2222A like these or these (or similar). 1 Rectifier Diode (1N4001 or similar) this or this will do. 1 2.2k ohm resistor (1/4 watt) 1 10k ohm resistor (1/4 watt) 1 1M ohm resistor (1/4 watt) 2 560 ohm resistor (Or whatever will run your red and green LED's at 5v. How to tell.) 1 small piece of perf board. 5x15 holes or longer. (example) 1 9 volt battery clip and 9v battery. (Or any other way you can think of to get 7-12v to the Arduino. A wall adapter like this is a great option so you don't have to worry about batteries running out. 6 AA's would be another option for longer lasting power, but it will bring down the suction cups.) Connector wire. 20 gauge or narrower flexible wire in a number of colors for connecting the electronics together. It's also a good idea to have a breadboard for setting up and testing the circuit before you solder it. We'll be doing this in step 3. http://www.instructables.com/id/Arduino-Projects/ Case: (These items are to make the project as pictured. Feel free to build a completely different and more functional case.) 20" PVC Pipe 1/2". 3 right angle 1/2" PVC connectors. 1 5-way 1/2" PVC connector. (example) 2 1/2" PVC end plug. 3 1 1/2" suction cups. (Available at hardware stores and craft centers.) NOTE: If your door is unsuitable for suction cups then replace these with three end caps and you can use adhesive strips or screws to mount the lock. 6" of 1/2" wide by 1/64" thick metal strip (steel, tin, copper, etc.) (available at hardware, craft, and art supply stores.) 4.5" of 1" wide metal sheet, 1/32" thick (steel, tin, copper, etc.) (available at hardware, craft, and art supply stores.) 2 3/32" x 3/8" screws with nuts. (1/8" will work too if you can't find the smaller ones.) 2 1.6M (metric) 16mm screws. Ideally with countersunk heads if you can find them. (For securing the motor. Check your motor specs to see what screws it needs. One motor I tried used 1.6M, the other 2M. You'll probably have to buy long ones and cut them to length.) 1 If you have a torque meter or a torque wrench, apply it to your door lock to get an idea of what torque it will take to open your lock. Use a online conversion tool to convert between foot/pounds, N/m, etc. Image Notes 1. Arduino microcontroller. 2. Momentary pushbutton 3. 10K ohm resistor (brown, black, orange) 4. Green LED 5. Red LED 6. 560 ohm resistors. (Green Blue Brown) 7. Gear motor 8. 2.2K ohm resistor (red red red) 9. 2n2222 Transistor (NPN type) 10. Rectifier diode (1N4001) 11. Perf board 5x15 holes. 12. 1M ohm resistor (brown, black, green) 13. Piezo speaker 14. Some wire, 20-22 gauge. The more colors the better. 15. 9v battery connector 16. 9v battery. You can also run this project from the appropriate wall plug. Image Notes 1. 20 inches of PVC, 1/2" 2. 1 1/2" diameter suction cups. 3. 5-way PVC connector. (Can be a little tricky to find.) 4. PVC end plugs 5. PVC right angle (90 degree) connectors 6. 1/2" wide metal strip used for a spring to press the detector to the door. 7. This metal strip will be made into the widget that connects our motor to the lock. 8. Screws and matching nuts. (Turns out you only need 2 pairs, not 4.) Step 2: Program The Arduino This section assumes that you know how to connect your Arduino microcontroller to you computer, compile and upload a sketch. If you don't know how to do that you probably shouldn't be doing this Instructable. But spending some time on this page and doing some of the examples and tutorials there might bring you up to speed. We're going to upload our sketch before doing any of the electronics so we can test the electronics as we go. #1: Download Download the file secret_knock_detector.pde at the bottom of this section and copy it to your sketchbook. (Or view the text and cut and paste it into a new sketch.) (Tip: If the name of the downloaded file is something like "BARS5HS13H8SW.tmp" simply rename it to secret_knock_detector.pde. and you're good to go.) #2: Open the sketch and compile it. It should compile properly the first go, but it's good to be sure. #3: Connect your Arduino and upload the sketch. If you have any trouble, check the troubleshooting section at the Arduino site. Code overview: For the curious, here's a look at a few bits of code if you're interested in tinkering: (If you're not curious, go to the next section) about Line 28: const int threshold = 4; http://www.instructables.com/id/Arduino-Projects/ This is the sensitivity of the knock detector. If you get a lot of noise, raise this (up to 1023), if you're having a hard time hearing knocks you can lower it (as low as 1). about Line 29: const int rejectValue = 25; about Line 30: const int averageRejectValue = 15; Both of these are used to determine how accurately someone has to knock. They are percentages and should be in the range of 0-100. Lowering these means someone must have more precise timing, higher is more forgiving. averageRejectValue should always be lower than rejectValue. Settings of about 10 and 7 make it hard for two people to knock the same knock even if they know the rhythm. But it also increases the number of false negatives. (ie: You knock correctly and it still doesn't open.) about Line 31: const int knockFadeTime = 150; This is a crude debounce timer for the knock sensor. After it hears a knock it stops listening for this many milliseconds so it doesn't count the same knock more than once. If you get a single knock counted as two then increase this timer. If it doesn't register two rapid knocks then decrease it. about Line 32: const int lockTurnTime = 650; This is now many milliseconds we run the motor to unlock the door. How long this should be depends on the design of your motor and your lock. It's okay if it runs a little bit long since I've designed a simple slip clutch into the design, but it's better for all the parts if it doesn't run too much. about Line 34: const int maximumKnocks = 20; How many knocks we record. 20 is a lot. You can increase this if your secret hideout is protected by devious drummers with good memories. Increase it too much and you'll run out of memory. about Line 35: const int knockComplete = 1200; Also known as the maximum number of milliseconds it will wait for a knock. If it doesn't hear a knock for this long it will assume it's done and check to see if the knock is any good. Increase this if you're a slow knocker. Decrease it if you're a fast knocker and are impatient to wait 1.2 seconds for your door to unlock. about Line 39: int secretCode[maximumKnocks] = {50, 25, 25, 50, 100, 5..... This is the default knock that it recognizes when you turn it on. This is weird rhythmic notation since every value is a percentage of the longest knock. If you're having a hard time getting it to recognize "shave and a hair cut" change this to {100,100,100,0,0,0... and a simple sequence of 3 knocks will open it. Debugging: about Line 51: Serial.begin(9600); about Line 52: Serial.println("Program start."); Uncomment these lines to see some debug info on the serial port. There are a few other lines of debugging code set throughout the rest of code that you can uncomment to see what's going on internally. Be sure to set your serial port to the right speed. The rest of the code is commented so you can see how it works but you probably won't need to change it if you aren't changing the design. File Downloads secret_knock_detector.pde (9 KB) [NOTE: When saving, if you see .tmp as the file ext, rename it to 'secret_knock_detector.pde'] Step 3: Lay Out And Test The Circuit We're going to breadboard the electronics to make sure everything works. If you never make mistakes you can skip this step. I've provided both a schematic and a layout diagram for the breadboard. Follow whichever one you're the most comfortable with. We're going to go slowly and check as we go. #1: Wire the Piezo Sensor Solder a pair of 12" (30cm) leads to the Piezo speaker. Connect it between Analog pin 0 and the ground. Also attach the 1M ohm resistor between Analog pin 0 and the ground. Test: With your Arduino plugged into your computer (via USB or Serial cable) and open the Serial Montor window. (That's the button furthest to the right at the top of the Arduino development environment.) With the Arduino powered on you should see the text "Program start." Tap the piezo speaker and you should see the text "knock starting" and "knock" each time you tap it. Stop for a second or two and you'll probably see "Secret knock failed" or "Door unlocked!" If you don't see anything or see junk, make sure your serial port is set to 9600 baud and reset the power on the Arduino. If you're sure it's right, then try tapping Shave and a Haircut (Don't forget the two bits. See the video if you don't know it.) and see if you can get the "Door unlocked!" message. If you get knock messages without tapping it may be too sensitive. If so you'll need to edit the sketch. Around line 27 raise the value of threshold. This can be raised as high as 1032 if you have a very sensitive detector. const int threshold = 3; // Minimum signal from the piezo to register as a knock Once you have it working the way you want it you can comment out (or delete) the lines that start with Serial... We shouldn't need them any more. #2: Wire up the LEDs Lets wire up some LEDs so we don't have to use a serial cable to see what's going on. Connect the red LED to digital pin 4 and green LED to digital pin 5 with their corresponding 560* ohm resistors in line. Test: If you power the circuit the green LED should light. If not, check your connections and make sure the LED is the right way around. Every time you tap the green led should dim. After tapping the correct sequence the green led should blink a few times. Tapping the wrong sequence should blink the red one. http://www.instructables.com/id/Arduino-Projects/ If none of this happens, check the polarity on your LEDs and all of your connections. * Your LEDs might require different resistance. #3: Wire the programming button Solder 8" leads to the button. Connect one side of the button to +5v. The other pin on the button connect to digital pin 2 and, with a 10K resistor to the Ground. Test: Apply power. When you press the button the red light should come on. Hold down the button and tap a simple sequence. When tapping while programming both LEDs should blink. When you're done the pattern you just tapped should repeat on both lights. After playback is complete, the new knock code is saved and the lights wil alternate red and green to tell you so. #4: Wire in the motor Solder 8" of leads to the motor and follow the design/schematic. Be sure to get the diode going the right way and you might want to check the pins on the transistor to be sure they match the diagram. (Some transistors might have the pins in different order.) Test: Power the circuit. Tap the default "Shave and a Haircut" knock. The motor should run for about half a second. If not, check your connections as well as the polarity of the diode. Extra Troubleshooting tips: 1) If the motor turns very weakly the diode might be reversed. 2) If you need more power on your motor make the following circuit change: Move the wire that goes from the motor to +5v to the Vin pin on the Arduino. This will supply the motor with 9v (or whatever voltage you're supplying to it.) Tip: Check which way the motor turns. It should turn the same way as you turn your deadbolt lock to unlock it. If not, switch the motor's leads which should reverse the motor. Congratulations! You have a working secret knock detector! Now we have to put it into something more permanent that we can stick on our door. http://www.instructables.com/id/Arduino-Projects/ Step 4: Prepare The Case If you're making your own case you can skip this step. Otherwise grab your PVC and saw and lets get cracking. Important! We're just testing for fit here. Don't glue or fasten anything yet! #1: The Button mount Take one of the PVC end caps and drill a hole through the center appropriate for your push button. For my button that was 3/8". Secure the button in the hole. Plug this into one of the 4 radial holes in the 5-way connector. (ie: not the one that points down.) #2: The Motor mount Take the other PVC end cap and drill a hole big enough for the shaft of your motor to pass through. You might also need to make it even bigger if your motor has a bearing that sticks out. Depending on the design of your motor you may want to sand down the thickness of the plug so that you have more of the motor shaft to work with. Test the fit by placing the motor through the back of the plug. If it's too tight you might have to sand/file/grind the inside of the plug so it will fit. Use a paper template to place the holes for the fastening screws, drill the holes and attach the motor to the plug. (In my case using the two 2M screws.) Countersink the screws if possible. Plug this into the "down" facing hole on the 5-way connector. #3: The 'arms' Cut one piece of PVC pipe 5 inches long. We're going to call this the "long arm". Put a right angle connector on one end. Plug the other end into the 5-way connector opposite the button. Cut two pieces of PVC pipe two inches long. We'll call these the "short arms". Half way along their length drill a 1/4" hole through one side. Put right angle connectors on one end of each arm. Plug these into the two remaining holes on the 5-way connector. You should really start to see it take shape. #3b: A Few Extra Holes with a pencil or marker draw a line down the center of the top and the bottom of the long arm. On the top side, make marks for two holes, one 3/4" from the 5-way, and another 1 1/2" from the 5-way. Drill a 3/16 (5mm) hole at each of these places. This is where our LEDs are going. Also make a line along the bottom where the long arm connects to the 5-way. Using a saw, cut a short way through the pipe, from the bottom up, until there is about a 1/2" hole into the pipe. (this is where the spring for our detector will attach. Also on the bottom, drill a 1/8" hole 1/4" further along the pipe (Away from the 5-way). We will thread the sensor's wires through here. #4: The 'legs' These are the parts that attach to the door. You may not want to cut these yet, The length depends on the design of your door lock, the length of the shaft on your motor and the final design of the Lock Turning Clamp in the next step. All three of mine were 2 5/16" long, but you're better off cutting them long and trimming them down to size later If they're too long the motor won't reach the lock to turn it. If they're too short the suction cups won't reach the door. When you do cut these, hot glue the suction cups in one end and stick the other ends in the right angle connectors on the ends of our legs. Image Notes 1. Button mount. End plug with hole drilled for the panel mount button. 2. 5-way connector. The motor goes in the center of this. 3. This is an exploded view with all of the parts laid out how they attach (though the angles are wrong on some parts. 4. Top arm. Hole drilled to let wires through. 5. The "Board Arm" This is the arm we're putting the circuit board into. Hole drilled to allow wires through. 6. Motor mount. Will go in the bottom hole on the 5-way. 7. Ignore this hole. Not sure what I was thinking. Image Notes 1. Two sample motor mounts for two different motors. The one on the left is smaller but actually more powerful. The one on the right has a larger hole to allow clearance for the bearing. The facing surface on both of these have been ground down so more of the shaft can stick out. http://www.instructables.com/id/Arduino-Projects/ 8. holes for LEDs. 9. The "Long Arm". (It's longer because it provides more holding power against the torque of the turning lock.) Step 5: Make The Lock Turning Clamp In this section we make the all important part that connects the motor to the lock. (This is a reasonably clunky way to do this, but it's simple and cheap. If you think of a better way, please mention it in comments.) What we're making is a clamp that attaches to the D-shaft of our motor and fits easily over the lock latch so that it can turn the lock. It attaches securely to the motor, but there is some give in it so that it can slip if it finds its self between a rock and a hard place. (Which we prefer to wrenching the project to pieces.) Drilling the holes: First take the piece of metal that's 4 1/2" long and 1 1/4" tall. and cut it in half so you get two 2 1/4" pieces. Tape them together, mark each side so you know which side is "out", and mark one of the long edges as "up". This will all help you keep everything lined up as you go. Measure and mark the center line from top to bottom. 1/2" each side of this center line and 1/4" from the top mark holes for drilling. Drill 1/8" holes at these marks. Marking the points with a punch, or giving it a whack with a hammer and nail will make your drilling more accurate. The edge with the holes is the side that attaches to the motor. Bending the metal Measure the width of your lock latch (the narrow way) and divide by 2. This distance is how much zig we're going to bend into each piece of metal. Mark this zig distance along each strip. Bend one piece so it zigs to the left, the other so it zigs to the right. Make sure that the screw holes at the top of the pieces stay lined up and the bends don't keep the pieces from meeting at the top. Finishing and sizing For this part you'll need your motor, the two 1/8" screws and a couple matching nuts. Put the screws through the holes in the top of the plates so it makes an upside down "Y" (sort of) and place the motor shaft in the top between the screws. Screw nuts on each side and tighten until it's firmly (but not really firmly) attached. The small amount of give between the metal and the shaft will let the motor spin if it meets too much resistance. (Rather than breaking something important.) Check the other end for fit over the lock. It should fit a little loosely over the lock latch. Not so firmly that it's clamped tight, but not so loose that it can turn without turning the lock. Adjust the bend of the flanges if you need to. After you've got the adjustments right, tighten another nut onto the end of the screws and tighten them up against the first ones. This will help lock them in place. Image Notes 1. A few markings will help keep them straight when you put them back together. 2. Two pieces taped together so we get the holes lined up. Image Notes 1. It's not a bad idea to file down the sharp corners. http://www.instructables.com/id/Arduino-Projects/ Image Notes 1. In position over the lock. 2. 1/2 of the thickness of the lock handle. This is how much we "zig" each flange. 3. Tighten the screws so they clamp down on the D-shaft. 4. Having a little bit of space is fine and will make it easier to put on. Image Notes 1. Edge view. Your lock will slot in here. Step 6: Make The Knock Detector Spring In this section we're going to put our knock detector on the end of a little springy bit so it presses securely up against the door. You could just use a piece of tape or even glue or screw it straight to your door, but doing it this way keeps it portable. #1: The parts: You'll need Your strip of thin metal (which is 6" of thin 1/2"). The piezo sensor (which should have about a foot of leads soldered on. The piece of PVC I've been calling the "long arm". The PVC pipe segment, on the bottom side, should have a slot cut 3/4" from the end and a 1/8" hole just inside of it. #2: Attach the sensor to the metal strip. Using glue, hot glue, tape, etc and fasten the piezo sensor to one end of the metal strip. Wrap some of the remaining wire around the strip so that it stays out of the way. (If your piezo sensor has its leads on the back then drill a hole through the strip. be sure to cover the leads with insulating tape or heat-shrink. #3: Attach the metal strip to the PVC. Thread the free end of the wire through the bottom hole on the PVC and then insert the free end of the metal strip in the slot. Bend the strip as shown so that the sensor faces out and down and will lay flat on the door. The strip should stick in the slot with friction, but if not, take some pliers and bend over the end of ths strip that's inside the pipe. Image Notes 1. Hot glue (or otherwise attach) the sensor to the end of the metal strip. Make http://www.instructables.com/id/Arduino-Projects/ Image Notes 1. The bottom side of the Long Arm with the 1/2" slot for the metal strip and a hole for the wire. 2. 4-6" flexible metal strip. 3. Piezo sensor with about a foot of wire attached. sure the "open" end is facing out. 2. Wrap some of the remaining wire around the strap to keep it out of the way. Image Notes 1. Thread the wire through the round hole and slide the free end of the metal strip into the slot. 2. The free end of our wires. 3. Bend the strip more or less like this. 4. This area is where the door will be, Try to bend it so the sensor lies more or less flat against the door. Step 7: Soldering The Circuits Due to the needlessly complex nature of my case, soldering and case mounting are somewhat intertwined, but I'll try to break it down so it makes sense. I recommend that after each step you plug in and test the circuit to make sure you didn't make a mistake, moving each bit from the breadboard one at a time. Having to desolder components is no fun. Tip: Use wires in as many colors as you can get so you can keep things straight. I also usually put labeled bits of tape on the ends of the wires to help me remember. Tip: If you're using stranded core wire, be sure to tin the ends. It will help with your joints and make it easier to stick them into the breadboard for testing. #1 Solder leads to the LEDs. (Hey, that almost rhymes!) About 10" or so should work. Okay, so much for the easy steps. After this it gets more complex because most of the components need to be threaded through various holes in our case before they're soldered. Of course if you made a different case then you don't need to worry about most of the tedium and can get right to soldering the components to the perfboard. Tip: Mount the components as closely as possible to the perfboard. There isn't much clearance inside the pipe. #2 Prepare the perfboard. We're using a perfboard with 0.10" spacing where each hole has an individual copper pad. Cut the perf board to size (5x15 holes) and then sand/file/grind off some of the edges so it fits easily into the 1/2" PCV pipe. For future reference we're calling the side with the copper "back" and the side with the components the "front". #3: The ground line Since the ground is the most common terminal in the project we're going to run a ground line across the back for the components to connect to. To make this I too a 9 inch piece of solid core wire that I'm using as my ground wire and stripped about an inch off one end. The soldered between hole 1 and hole 10 (see the attached diagram). Then I'll tack the other gronded components to it as the come through the board. (You can also just bridge the connections with solder, but I hate doing that because it can get messy. My soldering is messy enough.) The other end of this wire will go to a Ground pin on the Arduino. (This is a good time to label the other end with a piece of tape.) #4: The +5v line. There are also a couple points where we want to supply +5v. This is the same idea as the ground line but we only need about half an inch stripped. The other end of this will connect to the +5v pin on the Arduino. #5: The LEDs. Solder the LED's resistors (560 ohm by default) in place as shown. You have two choices of how to deal with the LED's. You can mount them on top (the easy way) or you can mount them from the bottom, which looks better, but is a pain because 1/2" PVC doesn't give you much room to work. If you mount them from the top, be sure to thread the leads through the holes before soldering. Thread all 4 leads from the leds out through the near end of the 'long arm' through the 5-way and through the 'board arm". Solder the cathode (-) lead (the short one) from each LED as indicated. The anode will connect to digital pin 4 (red) and 5 (green) on the Arduino. (Thread the Ardunio leads through the "short arm" of the 5-way.) http://www.instructables.com/id/Arduino-Projects/ #7: The knock sensor. Solder the speaker's 1M ohm resistor in place on the board. Make sure you have the speaker mounted firmly at the end of the spring and the wire is wound a few times around it to keep it out of the way. Thread the wire through the long leg, through the 5-way and into the short arm that we're keeping the circuit board. Solder one end of these leads to each side of the 1M resistor. Then solder a 8" lead from the ungrounded end of the resistor. This will go to Analog pin 0. #6: The button. Solder the 10K ohm resistor in place as shown. Fasten the button through the hole on the end plug, then put the plug on the 5-way connector and thread both wires through to the 'board arm' hole. Solder one lead from the switch to the resistor. The other end to the +5v wire. Solder a length of wire from the resistor according to the diagram and label it "Digital 2". #8: The motor. Nearly done. Solder the diode, transistor and resistor in place. (Make sure you get the direction right on the diode. And the transistor for that matter.) To the free end of the 2.2k ohm resistor solder a 8" lead that will go to digital pin 3. Put the motor in place in the bottom hole of the 5-way connector, thread the leads trough and solder them in place on either side of the diode, making sure you've got the motor wires in the right order so when it runs it will turn to unlock. #9: The Arduino pins Connect the labeled wires to their appropriate places on the Arduino. Test: Wait, you don't need to do this, right? You've been testing as we go, haven't you? Plug some power into the Arduino and make everything works. Especially make sure that the motor spins in the right direction to unlock your lock. Image Notes 1. Check the pin order on your transistor. Some times they're reversed. Image Notes 1. Tape labels are a good idea for this project if you're making the PVC pipe case. Misrouting wires is a real possibility. 2. The ground wire. We'll tack other components to this as we add them to the board. 3. The +5v wire. We'll tack other wires to this as we add them to the board. 4. In the soldering diagram this hole is hole #1,1 5. On the soldering diagram this hole is #5,15. 6. This is the bottom of the board, compared to the soldering diagram. http://www.instructables.com/id/Arduino-Projects/ Image Notes 1. #5: The solder the resistors in place to the ground line, and the short leads of the LEDs to the resistors. Pass the leads through the Board Arm hole of the 5way. 2. While we're threading wires we have threaded both the Piezo sensor wires through for the next step. 3. The + leads for the LEDs come out up here. And we mark them with tape so we don't confuse them later. Image Notes 1. The1M resistor soldered in with the piezo sensor attached either side. 2. A lead attached that will go to Analog 0. (We don't need to thread this anywhere for right now. Image Notes 1. Closer look at the resistors and their connections. This is what it should look like after #7, above. http://www.instructables.com/id/Arduino-Projects/ Image Notes 1. The button in place with the wires fed through the 5-way. 2. The resistor and button connections. http://www.instructables.com/id/Arduino-Projects/ Image Notes 1. The motor in place. 2. The final circuit with the wires fed through. 3. All the connections that will go to the Digital side of the Arduino we thread through to the Short Arm side. Image Notes 1. Close up of the completed board. 2. Embarrassing note: the motor connection (the green connection on the left) is not in the same hole as the diagram. It's connected the same, just in the wrong hole. http://www.instructables.com/id/Arduino-Projects/ Image Notes 1. Here's the back of the board so you can see the bridged connections. And a lot of messy soldering. Step 8: Assembling The Case All of your components should be in place and the circuit should be working. We're almost there, all we have to do is cram all that wire and the circuits into the pipe. #1 Getting the wires to the correct side. If you had the wires connected to the Arduino, unplug them. The wire to Analog 0 and to Ground and +5v will come out of the Board Arm, so we don't do anything with those yet. The other wires to Digital 2,3,4 and 5 thread through the 5-way to where the Short Arm will go. #2: The Short Arm Speaking of the short arm... Pull the wires for Digital 2,3,4 and 5 through the hole in the middle of the Short Arm pipe. #3: The Long Arm. The long arm has the LEDs and the sensor in it. Using needle nose pliers, (or a bit of coat hanger with a small hook on the end, or a crochet hook) pull up the slack on these wires as you plug it into the 5-way. #4 The circuit board. The circuit board should be the first part put in place inside the pipe for the Board Arm. Thread the wires for Ground, +5v and, Analog 0 through the small hole on top of the arm. Now make a tight bundle of the wires around the circuit board putting even pressure on it, being careful not to bend, break or spindle the thing. Gently slide it into the Board Arm. If you have a lot of extra wire lengths you might want to push it out the far side about half an inch so there's more room for wire on the inside. When it's in place, plug this short arm into the 5-way. #5 The Motor. The motor should already be in place in the bottom of the 5-way. But if it's not nows the time to put it there. #6: The Button. The button should also be in place, but if not, put it in. If you have a bunch of extra wire getting jammed up inside the 5-way, you can try pulling some of it (gently!) to the button side of the 5-way since it doesn't take up much space. #7: The legs and suction cups. The arms should all be plugged in. Attach 90" turns to the ends of the 3 arms, and plug the legs in to the other end. Suction cups should fit snug into the bottom of the legs. If not, some hot glue will get them into shape. (If you're not using suction cups then this is where you use your alternate solution.) http://www.instructables.com/id/Arduino-Projects/ #8: The Arduino and battery Yes, this is ugly as sin. I works, but... yeah. If you come up with anything better, you're welcome to it. Stick the Arduino onto the top of the frame. I used lengths of insulated wire. It worked... Attach the battery in a similar way somewhere where it can power the Arduino. Again, I used insulated solid core wires. At one point I used rubber bands which also worked just fine. Tape? Yes, that would work too. Plug in the wires in where they labels say they should go. Might as well test again it since it's all hooked up. Whew! Now we're ready to attach it to the door! Image Notes 1. The digital pin wires threaded through the Short Arm Image Notes 1. Circuit board getting ready to be crammed into the Board Arm. 2. The wires for Analog 0, Ground and +5v threaded through the hole in the Board Arm. Image Notes 1. Short Arm plugged in. 2. Board Arm plugged in. 3. Button plugged in. 4. Once again, ignore this hole. Image Notes 1. The circuit board has been pushed into the Board Arm. Having a little sticking out the far side is fine, it'll be hidden in the right angle adapter. http://www.instructables.com/id/Arduino-Projects/ Image Notes 1. Side view. We haven't attached the lock clamp yet. Image Notes 1. Legs and suction cups in place. at the end of the arms. Image Notes 1. The knock sensor is arranged so it will press flatly against the door. 2. Battery attached. 3. Arduino attached and wires plugged. 4. Here is where a neat person would shorten the leads. Image Notes 1. Side view. We've attached the lock clamp. Now we're ready to test it on the door! 2. Shortening the wires and removing the labels would make it look nicer, but you'll have to do that on your own time. I have an Instructable to finish! http://www.instructables.com/id/Arduino-Projects/ Step 9: Mounting, Testing, and Use First lets make sure our legs are the right length. Be sure the lock clamp is attached to your motor and the legs are in place. Attempt to fasten it to the door so the clamp fits over your lock. If you're lucky the legs will be the right length and you're ready to go! If you're unlucky the legs are too short and you'll have to cut new ones. But chances are your legs will be too long. Either grind/file/sand/cut them to the right length so the clamp fits right over the deadbolt lock handle. You don't have to use suction cups and in fact may doors are immune to their sucking. Two other options are to put PVC end caps on the legs and then secure them to the door with double sided foam tape (like this) or with screws through the caps, if you don't mind putting holes in your door. Now that's its on you can give it a test. Do the first test from the inside. Lock your door and power it up. When the green light is on give it the old Shave and a Haircut and it should unlock! Now program in a less obvious knock (or not) and your tree house will finally be safe from that smelly kid! If the motor doesn't turn far enough to unlock your door you'll need to update the sketch to run the motor longer. (See Step 2!) For additional Troubleshooting: See the bottom of Step 2. It also includes a bunch of other tweaks that might help you. Step 10: Epilog: Changes And Improvements There are many ways to improve or change this project if you're feeling ambitious. Here are a few to get you started, feel free to add more in the comments. Add an H-Bridge to the circuit so it can lock and unlock the door. Make it work in silent mode by removing the knock sensor and attach a capacitance (touch) sensor to the doorknob and record sequences of touches. Use a servo to unlock the door rather than this hacked together gear-motor+slip transmission. Add a potentiometer to adjust the knock sensitivity and other values. Build it into an actual door knocker. Use a more economical microcontroller and enable sleep mode for better battery life. Make the whole package small enough to fit inside the door. Store several knocks so several people can have their own 'private' knocks. Add a real-time clock and using different knocks for different days of the week. Add a knocker to provide feedback through the door. It could then offer a challenge-response security where the door starts a knock sequence and the user has to finish it correctly. Remove the knock sensor and record pushes of the doorbell or other hidden button. Remove the knock sensor and put a photosensor in the peephole, send the open code through the peephole with a keychain flashlight. And here's a zero-technology solution to the "Yeah, but someone'll overhear your secret knocks!" problem: Scream while knocking. No one will overhear the knock over the racket you're making. Did you build this? Post a photo (or better yet a video!) photo of it mounted on a door will earn a Master Of Secret Knocks patch*! *As long as I have patches left to hand out. Which I do. Masters of Secret Knocks: josiasfilho added a servo and locking ability. Jorad unlatches his door and added feedback in the peephole. Crimson-Deity added a pushbutton. bserrato added unlocking and a bluetooth camera to photograph people who give an incorrect knock. http://www.instructables.com/id/Arduino-Projects/ Image Notes 1. Post a picture (or video!) of your secret knock detector in comments and get this fancy Master of Secret Knocks patch Related Instructables Secret Knock Detecting Door Lock (Photos) by vinny03 How to Break Down a Door by drums787 Nintendo Keyless Entry System by action_owl A bit of safe cracking... by killerjackalope Arduino RFID Door Lock by pcmofo Knock Block by jkestner How to make Keychain Cutaway Padlock by amaze Very Simple Arduino Electric Lock by RKlenka http://www.instructables.com/id/Arduino-Projects/ Wireless Altoids Display by Alexdlp on July 25, 2010 Intro: Wireless Altoids Display This Instructable will show you how to modify an Altoids tin for a wireless 2x16 character display. Using an Altoids tin was inspired by the need to have a small yet protective enclosure for a pair of Xbee modules recently bought from Sparkfun. I purchased the Xbee Pro modules with external antenna for the extended range the setup provides (useful for future projects). Then I realised I would need to mount the antenna socket and have a box to house the circuits. ALTOIDS! Overall Configuration There will be a 'remote' Altoids tin containing Arduino, LCD and Xbee module. A second Altoids tin containing an Xbee module only. This connects to the PC with a USB to FTDI serial cable. Data is sent from the PC using a terminal program such as the Arduino 'Serial Monitor' and appears on the Altoids display. So here are some possible ideas for use with this setup: (Data flow PC to Wireless Display) - Email Notifier - RSS Feeds - Facebook/Twitter Updates - Realtime Clock (Data flow Wireless Display to PC) - Weather Station - Speedometer - Engine Monitoring - Heart Rate Monitor - Other realtime data logging Let's get started! http://www.instructables.com/id/Arduino-Projects/ Step 1: Components & Tools So here's a list of what you're going to need for this project: ------------------------------------A) Featured P2P Wireless Setup - (2x) ALTOIDS TIN - (1x) Arduino Duemilanove - (1x) 2x16 LCD HD44780 - (4x) Hex Posts/Spacers - (4x) Matching Screws - Form of sheet insulation (Card / Foam etc.) - (2x) Xbee Modules (U.FL antenna connector) - (2x) U.FL to RP-SMA cable connector - (2x) Adafruit Industries Xbee Adapter Kit - (2x) RP-SMA 2.4Ghz Duck Antenna - (1x) USB type A to type B - (1x) USB to serial FTDI - Cat5 Cable ------------------------------------I realise that the Xbee modules can be quite costly. If you still want wireless and you're content with one-way communication then there are alternative radio modules such as these from HopeRF: http://shop.jeelabs.com/products/rfm12b I think it's worth mentioning that this project can still be effective without wireless communication so why not create a neat USB desktop widget? B) USB Version Only If you just want to create a USB Altoids Message Display you're going to need: - (1x) ALTOIDS TIN - (1x) Arduino Duemilanove - (1x) 2x16 LCD HD44780 - (4x) Hex Posts - (4x) Matching screws - (1x) USB type A to type B - Cat5 Cable - Form of sheet insulation (Card / Foam etc.) ------------------------------------Tools Needed - Soldering iron & solder - Needle-nose pliers - Scissors - Tin snips - Marker pen - Wire strippers - Cross head screwdriver - Fine grade sandpaper - Drill & bits 3mm + 6.5mm Image Notes 1. ALTOIDS! 2. 2.4Ghz RP-SMA Antenna Image Notes 1. Variable Soldering Iron 2. Lead-free Solder http://www.instructables.com/id/Arduino-Projects/ 3. Arduino Duemilanove 4. 2x16 LCD HD47780 5. Sheet Insulation e.g. Card/Foam 6. XBeePro 60mW U.FL 7. Female/Male Jumper wires 8. U.FL to RP-SMA 9. USB type A to type B 10. USB serial FTDI 11. Xbee Adapter Kit from Adafruit Industries 12. 4x Hex Posts 13. Matching Screws for posts 3. Drill bits 3mm & 6.5mm needed 4. Fine grade sandpaper 5. Desktop clamp 6. Wire strippers Step 2: Prepare the surface... As iconic as the Altoids graphics are, I found that I quite liked the 'brushed' metal look. Take some sandpaper and begin wearing away the top layer of paint. (The finer the grade of sandpaper, the smoother the finish) Step 3: Mark & drill holes You will need to mark out and drill 6x holes in total. 1. Place the the LCD over the top surface and mark 4x holes (3mm) Alternatively you could create a cardboard template to be more accurate. 2. Use a larger, 6mm drill for the antenna socket. I chose to mount the socket on the back left on the tin as this would allow the antenna to be folded down parallel to the case for storage. 3. The final 6mm hole (underneath display) will allow the wires from the LCD to pass through to the inside. NOTE: Be patient when drilling these holes through the metal. I found that the best solution was to use a combination of a high speed setting and slow movement into the material. If you're too quick, you can easily deform the metal. http://www.instructables.com/id/Arduino-Projects/ Step 4: Attach the Antenna Socket & Posts This is fairly straight forward stuff... 1. Push the RP-SMA antenna socket through the case to the outside. Leave the locking washer on the inside so that it bites into the metal when tightened. 2. Screw in the 4x hex posts. You may wish to add matching nuts and locking washers if the posts are too loose. http://www.instructables.com/id/Arduino-Projects/ Step 5: Insulate! Now, you don't want to short out any of your Arduino + Xbee circuits. Make sure the inside of your case is well insulated. I just used some black card and cut it to the outline profile of the Altoids tin. You will need three main insulating panels: 1. Bottom of tin 2. Underside of lid 3. Wrap around panel for Xbee module (see page about adding Xbee) http://www.instructables.com/id/Arduino-Projects/ Step 6: Add Arduino The Arduino Duemilanove conveniently fits within the Altoids tin. Of course this takes up quite a bit of space in your case. If you want that extra room for other circuits then you might be better building a 'Boarduino' available here from Oomlout. Using tin snips, cut away entry points on the right hand side for the USB and DC power sockets. I found that it was best to make two vertical cuts and then fold excess material on the inside. This can then be hidden underneath the insulating material we put in earlier. http://www.instructables.com/id/Arduino-Projects/ Step 7: Attaching the LCD After many failed attempts using ribbon cable, I found Cat5 to be the best solution for wiring the display. Advantages of Cat5 - Colour coded - Not too bulky + - Flexible for closing the lid - High quality copper great for soldering! 1. Cut 7x pieces of Cat5 about 120mm in length. These will provide communication from the Arduino to the LCD. For the power and ground, I actually used slightly thicker grade black and red wire. 2. Start by soldering to the pads on the display. (Datasheet) 3. Feed the wires through the lid to the inside. 4. Fix the display in place with 4x screws into the hex posts. In the next step, we'll complete the wiring to the Arudino. http://www.instructables.com/id/Arduino-Projects/ Step 8: Wiring up & adding Xbee Module For information about how to wire the popular HD47780 display to the Arduino follow the links below... Datasheet http://www.sparkfun.com/datasheets/LCD/GDM1602K.pdf Tutorial http://www.ladyada.net/learn/lcd/charlcd.html Now to add the Xbee I found that both the Adafruit adapter and Xbee module fit snugly just behind the USB socket on the arduino. In the picture, hopefully you can see the folded card insert insulating the module from other components. The Xbee adapter makes it easy to connect to the Duemilanove with a 5v supply as the Xbees themselves require 3.3v. Note: If you haven't yet built the Xbee Adapter kit and you're using XbeePro modules, be aware that the capacitor on the adapter board should lay down flat against the PCB. Otherwise the Xbee doesn't quite fit into the adapter headers. Image Notes 1. Insulate this please! :P 2. Cardboard wrap around insert for Xbee to insulate from other components. http://www.instructables.com/id/Arduino-Projects/ Step 9: Finished Construction... The Altoids tin attached to the PC is much easier to construct than that with the display. 1. Strip the paint from the top surface as in Step 2. 2. Attach the antenna socket as in Step 4. 3. Insulate as in Step 5 4. Add Xbee and attach FTDI cable (see Xbee tutorials) Congratulations, we've finished the making part! Now for the testing and code examples! Step 10: Upload Sketches & Testing Here are some simple sketches. I suggest that you upload them directly over USB cable to the Arduino. Although I believe it is possible to upload wirelessly, I haven't yet been able to establish this with the XbeePro modules. Arduino Wiring configuration: 0 / RX (leave) 1 / TX (leave) 2 - LCD D7 3 - LCD D6 4 - LCD D5 5 - LCD D4 11 - LCD Enable Pin 12 - LCD RS Pin 14/ A0 used as NewSoftSerial RX - connects to Xbee TX 15/ A1 - used as NewSoftSerial TX - connects to Xbee RX ---------------------------------------------------------We will be using the LiquidCrystal library to communicate with the display. http://www.instructables.com/id/Arduino-Projects/ As well as the NewSoftSerial library for the Xbee. You can download it here: NewSoftSerial It allows you to connect the Xbees TX/RX to other digital pins on the Arduino. This means that the Arduino's serial pins are kept free for use by the USB when uploading. ---------------------------------------------------------(You can download the pde. files below) Sketch One (InstructablesDisplay.pde) This example will test the display without using wireless communication. The code will print ' Instructables! ' on the top line of the display! // include the library code: #include <LiquidCrystal.h> // initialize the library with the numbers of the interface pins LiquidCrystal lcd(12, 11, 5, 4, 3, 2); void setup() { // set up the LCD's number of rows and columns: lcd.begin(16, 2); // Print a message to the LCD. lcd.print(" Instructables! "); } void loop() {} Sketch Two (mySerialDisplay.pde) This sketch displays text on the Altoids LCD via Xbee wireless from the PC serial monitor. The initial startup screen shows 1. 'Instructables, altoids display' 2. (delay of 5 seconds) 3. 'Waiting for serial input...' /* -----------------------------------------------------------This sketch displays text sent over soft-serial (digital pins) using the NewSoftSerial library. (RX - 14/A0, TX - 15/A1) Modified SerialDisplay example to include soft-serial for Xbee A.dlp 28th July 2010 for Wireless Altoids Display Instructable www.instructables.com ------------------------------------------------------------ */ // include the library code: #include <LiquidCrystal.h> #include <NewSoftSerial.h> // initialize LiquidCrystal // initialize NewSoftSerial the LiquidCrystal library with the numbers of the interface pins lcd(12, 11, 5, 4, 3, 2); the NewSoftSerial library RX-14/A0 TX-15/A1 mySerial(14, 15); void setup(){ // set up the LCD's number of rows and columns: lcd.begin(16, 2); // initialize the serial communications: mySerial.begin(9600); // print text 1st line lcd.print("Instructables"); // set cursor to 2nd line lcd.setCursor(0, 1); // print text on 2nd line lcd.print("Altoids Display"); // wait 5 seconds till next message delay(5000); // clear the screen lcd.clear(); lcd.print("Waiting for"); lcd.setCursor(0, 1); lcd.print("serial input ..."); } void loop() { // when characters arrive over the serial port... if (mySerial.available()) { // wait a bit for the entire message to arrive delay(100); // clear the screen lcd.clear(); // read all the available characters while (mySerial.available() > 0) { // display each character to the LCD lcd.write(mySerial.read()); } } } http://www.instructables.com/id/Arduino-Projects/ File Downloads mySerialDisplay.pde (1 KB) [NOTE: When saving, if you see .tmp as the file ext, rename it to 'mySerialDisplay.pde'] InstructablesDisplay.pde (1 KB) [NOTE: When saving, if you see .tmp as the file ext, rename it to 'InstructablesDisplay.pde'] Step 11: Resources Here's a list of all of the resources I found useful when making this project: Datasheet for HD47780 http://www.sparkfun.com/datasheets/LCD/GDM1602K.pdf Arduino LCD Tutorial http://www.ladyada.net/learn/lcd/charlcd.html Xbee Adapter Kit http://www.ladyada.net/make/xbee/solder.html Arduino Xbee Point to Point http://www.ladyada.net/make/xbee/point2point.html Custom Character Creator http://icontexto.com/charactercreator/ Hope this project inspires some people! http://www.instructables.com/id/Arduino-Projects/ Related Instructables Wireless Altoids Cycle Computer by Alexdlp Arduino Controlled Motion Sensor by LemonSlice A Wirelessly Controlled, ArduinoPowered Message Board by uhclem Wiimote Wireless Modification for Persons with Disabilities by CATEA Configuring XBees for API Mode by quasiben XBee adapter by adafruit Use a PS3 Controller to control an Arduino NXT Bot by nahamancygig Arduino Wireless Animatronic Hand by njkl44 http://www.instructables.com/id/Arduino-Projects/ Temperature Control For Kitchen Appliances by timothy on October 20, 2008 Author:timothy author's website Here is a site from when I Lived aboard and cruised in a wooden boat: www.slowtimes.com Current blog of randomness: growdown.blogspot.com I am trying to concentrate my dwindling hobby time only on boats as it seems to allow for the most rewarding experiences. Intro: Temperature Control For Kitchen Appliances In this Instructable, I will step through controlling the temperature of most kitchen appliances. As an example, I will use an old Westbend Poppery popcorn maker (aka. coffee roaster), but these same techniques will be applicable to most hot plates, coffee makers, and waffle irons. This instructable puts you at risk of electrocuting or burning yourself. I will do my best to point out potential pitfalls, but you must use common sense. If you are comfortable with household AC electricity, this poses similar dangers plus potential burnination. This probably isn't a good first Arduino project, but it might work as a second once you are comfortable with the general principles. You will need either a soldering iron or a breadboard. The total cost can be as little as $30, but probably will run between $60 and $90 after shipping. Step 1: Parts There are just a few parts to add, but for each has options. 1. Arduino or any other *duino. There are a number of choices for Arduino these days. I will use a standard USB version, but any should work. 1a. USB Cable 1b. (optional) power supply for Arduino if you want this to run untethered from your computer. What? You don't want to have a computer permanently attached to your kitchen appliance? You can buy a lone Arduino or a nice starter kit from adafruit . 2. Temperature Sensor There are many options for sensing temperature with your arduino. I'll describe two different techniques, both providing a voltage that correlates to temperature. This voltage is easily read by the analog inputs of the Arduino. Quick answer For this tutorial, I'm going with the pricier but a slightly easier solution of a thermocouple and amplifier. This is because there is no soldering required as most thermocouple come with leads already attached. In practice, I've used the LM34 option the most (see below), as it's cheaper and a more accurate. To follow along exactly, order: 1x AD595CQ Datasheet 1x T-29 See below for more Temperature sensing options. 3. Solid State Relay This part will allow the Arduino's 5v DC output to control the AC power that used in the heaters of your appliance. The world of solid state relays (SSRs) can be pretty overwhelming, and there are many places to go astray. The good news is that digikey just started carrying a line of affordable SSRs. These particular SSRs have a few key features we need. As you can read on their datasheet they take 5V DC input, provide 50 to 250 Volts AC output, have built in heat sinks, screw terminals, and provide an LED light that shows when they are switched on (super helpful). These are also very affordable for SSRs at $12 - $16. The only question you need to ask is about the wattage of our appliance, and your household voltage. In the US, most heaters and appliances are 1500 watts and under, and use 110 volts. From Ohm's Law we know that Watts / Volts = Amperes thus 1500 watts / 110 volts = 13.6 Amps http://www.instructables.com/id/Arduino-Projects/ A 1500 watt appliance using USA household 110 volt AC power, uses about 13.6 amps. what you need to make sure is that the current used by your appliance is under the rated current of your SSR. From the above calculation, a 15 Amp SSR will suffice. This 15 Amp Optek SSR will do nicely and can be ordered with your temperature sensing parts. If you are in Europe, or anywhere with 220 ac power, you require only half the current as in the US, so 10 or 15 amps will cover all but the beefiest heaters. Here are a couple more amperage options in case you need. 10 Amp 25 Amp 40 Amp 4. Wires and possibly some crimp connectors and breadboard Except for the wires connecting the relay to the appliance, standard 20 or 22 AWG hookup wire is fine. For the higher voltage, you might be able to just use wires from inside the appliance, from an extension cord, or household wire from the hardware store. Probably you don't want to use the tiny map wire on any substantial heating element. Look at what's in the appliance already, and don't go smaller than that. Also, feel the wire (where its insulated!) with our hand and if its getting warm, think about getting a lower gauge wire with more girth. Depending on the types connectors used inside your appliance, some crimp-on connectors can be very helpful, such as eyes or spades. Also, there are simple crimp tubes that splice two wires together. You want to get the right size crimp piece for the wire gauge you have so it makes good contact to the wire when you squeeze it. While soldering heavy wire is possibly, depending on your soldering iron, it can be between frustrating and impossibly. Crimp ends are often total sweetness. If you are using the AD595, you'll need a breadboard to hook it up. More Temperature Sensing Options - (you can safely ignore this if you choose) Option a) LM34 or LM35 This is a single 3 wire part with from National. The LM34 correlates best to Fahrenheit, the LM35 to Celsius. Since we are attaching this to an Arduino, it doesn't really matter as you can do the conversion in software. The LM35 is more expensive for some reason. For either of these, you have yet another choice (there are actually more choices, but probably not worth considering) of the package, metal or plastic. This part will require soldering 3 insulated wires that can handle whatever temperatures they might be exposed to. Not that this sensor cant be submerged, and shouldn't be in direct contact with your food as some thermocouples allow. I've stuck it in boiling water, and it throws off the sensor pretty good. If you were to dip the whole thing or the exposed wires in epoxy or similar, it could possibly get wet. As with any option, if its going to be actually touching something you eat, make sure it's not poisoning you (ie. lots of wire still has lead in it). The parts ending in AH are the metal version, a TO-46 little metal can package. These cost more and provide a larger temperature range. LM34AH - $13.86 from Digikey -50F ~ 300F LM35AH $16.90 from Digikey -55C ~ 150C The parts ending in CAZ are in the plastic TO-92 package. They are cheaper (even can be sampled for free!), but they have a smaller temperature range. They are fine as long the temperature range is okay for your use case, for example the perfect temperature for brewing coffee, or any kind of water bath up to and including boiling point. LM34CAZ $7.14 from Digikey -40 to +230F LM35CAZ $5.50 from Digikey -40 to +110C I will use the LM34AH in this example as I have one already. Other than option b) Thermocouple Thermocouples are a common way to measure temperature. They come in many shapes and types. We will use type K because they are common and have a monster range of 200 C to +1350C. You can buy your thermocouple from Sparkfun ($13.95) or a nice bolt-on variety from Omega (~$8.00) if that works for your application. Thermocouples are nice because they come prewired in a variety of lengths. If you are buying the amplifier (below) from digikey, they have a couple of K -types in stock, including this T-29 bead type. The trick with these thermocouples is that you need a thermocouple amplifier to translate their output into a voltage that is linearly correlated to temperature. This makes it very easy to interface to the Arduino. Enter the AD595. The AD595AQ has a +-3 degree accuracy and is available at Sparkfun ($17.95). The AD494CQ has +- 1 degree accuracy and is available from Digikey . Digikey also has both versions in ROHS (lead free package) versions for 10 - 20 bucks more each if you would like. These are 14 pin DIP (will fit in a breadboard) packages. Even though they are 14 pins, you can breadboard one without a lot of effort. There are many many more types of thermocouples, as well as numerous other techniques for sensing temperature you could use with the strategy presented here. http://www.instructables.com/id/Arduino-Projects/ Image Notes 1. Solid State Relay 2. T-29 K-Type Thermocouple 3. AD595 thermocouple amplifier on a breadboard 4. Arduino Image Notes 1. Hack me Step 2: Sensing Temperature Now you want to hook up your breadboard and AD595 as shown in the picture. The attached schematic is from the datasheet for the AD595. All the Sensors presented here translate temperature into voltage. In particular, 10 mV per degree, so 0 Volt = 0 degrees, and 2.5 V = 250 degrees (except for the LM34, degrees are in Celsius). We connect the output of the sensor to one the Arduino's analog inputs. We'll do this now, and write a temperature sensing program (aka: thermometer) that will send the current temperature back to your computer. The code below goes with the wiring in the image to make a simple thermometer. If you've never messed with an Arduino before, here is a great tutorial to get you started. // Define which analog input pin we have connected to the temperature sensor #define TEMP_SENSOR_PIN 0 // if you tie the Arduino's vRef to the 3.3 volt supply, change this to 3.3 #define ANALOG_VOTLAGE_REFERENCE 5 void setup() { Serial.begin(115200); } void loop() { // prints the currrent temperature with 1 place after the decimal point printFloat(getTemperature(), 1); // print a carriage return Serial.println(); // rest 100 milliseconds delay(100); } float CtoF(float c) { // optionally convert from Celsius to Farenheit if you are into that sorta thing return c * 9.0 / 5.0 + 32.0; } float analogInToDegreesC(int inputValue) { // divide by 1023, the maximum possible input value, that scales the input between 0 - 1 // then multiply by the reference voltage, which scales 0-1 to 0-vREF (default is 5V) // lastly, multiply by 100 to scale it to 10s of millivolts or degrees return inputValue / 1023.0 * ANALOG_VOTLAGE_REFERENCE * 100.0; } http://www.instructables.com/id/Arduino-Projects/ float getTemperature() { // read the analog input, convert to degrees C, and covert to F return CtoF(analogInToDegreesC(analogRead(TEMP_SENSOR_PIN))); } // ---- This last function, printFloat isn't necessary to understand unless you want to // ---- feel free to ignore it for now, and treat it as a built-in utility, // ---- it prints out floating point point values // printFloat prints out the float 'value' rounded to 'places' places after the decimal point void printFloat(float value, int places) { // this is used to cast digits int digit; float tens = 0.1; int tenscount = 0; int i; float tempfloat = value; // make sure we round properly. this could use pow from <math.h>, but doesn't seem worth the import // if this rounding step isn't here, the value 54.321 prints as 54.3209 // calculate rounding term d: 0.5/pow(10,places) float d = 0.5; if (value < 0) d *= -1.0; // divide by ten for each decimal place for (i = 0; i < places; i++) d/= 10.0; // this small addition, combined with truncation will round our values properly tempfloat += d; // first get value tens to be the large power of ten less than value // tenscount isn't necessary but it would be useful if you wanted to know after this how many chars the number will take if (value < 0) tempfloat *= -1.0; while ((tens * 10.0) <= tempfloat) { tens *= 10.0; tenscount += 1; } // write out the negative if needed if (value < 0) Serial.print('-'); if (tenscount == 0) Serial.print(0, DEC); for (i=0; i< tenscount; i++) { digit = (int) (tempfloat/tens); Serial.print(digit, DEC); tempfloat = tempfloat - ((float)digit * tens); tens /= 10.0; } // if no places after decimal, stop now and return if (places <= 0) return; // otherwise, write the point and continue on Serial.print('.'); // now write out each decimal place by shifting digits one by one into the ones place and writing the truncated value for (i = 0; i < places; i++) { tempfloat *= 10.0; digit = (int) tempfloat; Serial.print(digit,DEC); // once written, subtract off that digit tempfloat = tempfloat - (float) digit; } } http://www.instructables.com/id/Arduino-Projects/ Image Notes 1. 5v pin 2. Black to GND pin 3. Green to Analog in 0 4. All black are the GND plane 5. 5V power to the amplifier 6. See schematic image 7. White wire connecting to the + side of the thermocouple 8. Yellow wire connecting to the minus side of the thermocouple connector 9. See the next image for a picture of the cut breadboard to fit a standard thermocouple plug. Image Notes 1. Use an knife to cut the seperations between the inner columns of pins on the breadboard. This will create a place to plug in the thermocouple. You will need to scrape a away a little of the inside edge as well to allow the plug to fit. Image Notes 1. Don't forget to connect the Chromel (which is marked + on mine) side of the thermocouple to GND 2. This is marked - (minus) on my connector 3. This is where the little notch is the part. 4. Green wires in picture 5. Black wires in picture 6. Red wire in picture http://www.instructables.com/id/Arduino-Projects/ Step 3: Intercept the Heater Control Here is where things get a little more creative. The goal is to find the pair of wires that feed your heater. This is also where it helps to have an older or simpler appliance. - If there is no temperature control at all, such as with this popcorn maker or most hair dryers, all you have to do it insert the SSR into one side of the heater power. - If your appliance already has a thermostat in it, such as in a hot plate or coffee maker, you want to bypass that thermostat. It has two connections and you will want to move to those over to your SSR as it will acting as the new heater switch instead of the thermostat. - If you have an adjustable thermostat, such as a hot plate with a dial or an older waffle iron, you can effectively bypass that thermostat by turning it to its maximum setting, and leaving it in the circuit. In this case, you get the added benefit that the thermostat will act as a safety to your electronic control. If it gets to the maximum temperature of the machine, the original thermostat will switch off power to the heater. - If the setup is very simple, such as hot plate or toaster, you could possibly not hack the appliance at all, but instead, an extension cord, and plug the appliance into a hacked extension cord with the SSR in line. This cord would be switching power to appliance according to the temperature. For this to work, you definitely need an appliance without out any smarts, so its not reseting or similar when you power off the entire thing. In the case of the popcorn maker, its almost that simple, but we have to go inside it and switch only heat, leaving the fan power intact. SAFETY If you don't have a little cover for your SSR (and perhaps even if you do), be sure to wrap the AC terminals in electrical tape to avoid accidently electrocuting yourself or sensitive electronics. I once had a usb cable whose other end was attached to my arduino touch a live SSR. Blamo, instant death to the Arduino and everything part it was connected to (it was an expensive millisecond). This is a good time to remind you that besides electric shock, there are many possibly routes towards causing a serious fire (like burn your house down fire) with these modifications. Be sure to always always always stay with your appliance when it is running, and watch it. Be mindful of bad burning smells, smoke, and anything out of the ordinary. Do not under any circumstances leave it unattended, even after its been working flawlessly for months. Image Notes 1. Power to the heater 2. This wire will be replaced by two long wires with terminal ends. These will attach to the SSR, inserting it at this place in the circuit. 3. Tell tale bare wires heading off to the heater. 4. Main power coming in Image Notes 1. Crimp ends are great if not essential here. http://www.instructables.com/id/Arduino-Projects/ Image Notes 1. Swap this new wire for the one currently attached to the heater terminal. The other end of this wire will attach to one side of the SSR. 2. Heater terminal that we are switching power to Image Notes 1. One goes to the heater terminal, the other to the wire that used to connect to the heater terminal. Image Notes 1. Solid State Relay. Notice the nice clear cover that comes with this SSR (link to digikey in step 1). That is an important safety feature. If you don't have one, wrap those AC terminals in electrical tape! Image Notes 1. A nice vent hole allowed my long wires to feed out the side of the machine. http://www.instructables.com/id/Arduino-Projects/ Step 4: The Magic of Feedback With an SSR controlling the heater of your appliance, one control wire goes to ground, and the other to a digital output on the Arduino. Now the Arduino can switch the heater power. By switching the heater power according to the input from the thermocouple, you invoke the magic of feedback! Feedback is powerful and can be mysterious, sometimes seemingly with a mind of its own. The attached movie will show you the feedback in action. Watch as the LED light on the SSR blinks on and off. You can also heat the fan speed responding to the electrical load as the heater turns on. // With the AD 595, this process is just a matter of doing some math on an // analog input // // Thanks to Karl Gruenewald for the conversion formula // All code released under // Creative Commons Attribution-Noncommercial-Share Alike 3.0 // This current version is based on sensing temperature with // an AD595 and thermocouple through an A/D pin. Any other // sensor could be used by replacing this one function. // feel free to use degrees C as well, it will just give a different // PID tuning than those from F. // #define TEMP_SENSOR_PIN 0 #define SSD_PIN 2 // if you tie the Arduino's vRef to the 3.3 volt supply, change this to 3.3 #define ANALOG_VOTLAGE_REFERENCE 5 float currentTemperature; float highTargetTemperature = 100; float lowTargetTemperature = 95; void setup() { Serial.begin(115200); pinMode(SSD_PIN, OUTPUT); } void loop() { // prints the currrent temperature with 1 place after the decimal point currentTemperature = getTemperature(); printFloat(currentTemperature, 1); // print a carriage return Serial.println(); if (currentTemperature < lowTargetTemperature) { digitalWrite(SSD_PIN, HIGH); } if (currentTemperature > highTargetTemperature) { digitalWrite(SSD_PIN, LOW); } // rest 100 milliseconds delay(100); } float CtoF(float c) { // optionally convert from Celsius to Farenheit if you are into that sorta thing return c * 9.0 / 5.0 + 32.0; } float analogInToDegreesC(int inputValue) { // divide by 1023, the maximum possible input value, that scales the input between 0 - 1 // then multiply by the reference voltage, which scales 0-1 to 0-vREF (default is 5V) // lastly, multiply by 100 to scale it to 10s of millivolts or degrees return inputValue / 1023.0 * ANALOG_VOTLAGE_REFERENCE * 100.0; } float getTemperature() { // read the analog input, convert to degrees C, and covert to F return CtoF(analogInToDegreesC(analogRead(TEMP_SENSOR_PIN))); } // END Temperature Sensor // printFloat prints out the float 'value' rounded to 'places' places after the decimal point void printFloat(float value, int places) { // this is used to cast digits int digit; float tens = 0.1; int tenscount = 0; int i; float tempfloat = value; // make sure we round properly. this could use pow from <math.h>, but doesn't seem worth the import http://www.instructables.com/id/Arduino-Projects/ // if this rounding step isn't here, the value 54.321 prints as 54.3209 // calculate rounding term d: 0.5/pow(10,places) float d = 0.5; if (value < 0) d *= -1.0; // divide by ten for each decimal place for (i = 0; i < places; i++) d/= 10.0; // this small addition, combined with truncation will round our values properly tempfloat += d; // first get value tens to be the large power of ten less than value // tenscount isn't necessary but it would be useful if you wanted to know after this how many chars the number will take if (value < 0) tempfloat *= -1.0; while ((tens * 10.0) <= tempfloat) { tens *= 10.0; tenscount += 1; } // write out the negative if needed if (value < 0) Serial.print('-'); if (tenscount == 0) Serial.print(0, DEC); for (i=0; i< tenscount; i++) { digit = (int) (tempfloat/tens); Serial.print(digit, DEC); tempfloat = tempfloat - ((float)digit * tens); tens /= 10.0; } // if no places after decimal, stop now and return if (places <= 0) return; // otherwise, write the point and continue on Serial.print('.'); // now write out each decimal place by shifting digits one by one into the ones place and writing the truncated value for (i = 0; i < places; i++) { tempfloat *= 10.0; digit = (int) tempfloat; Serial.print(digit,DEC); // once written, subtract off that digit tempfloat = tempfloat - (float) digit; } } Image Notes 1. Digital Out Pin 2 2. + side of SSR input 3. minus side of SSR input goes to ground plane (black wire) 4. All just as we left it in the last step 5. This thermocouple lead is now going up into the top of the popcorn maker. http://www.instructables.com/id/Arduino-Projects/ Step 5: Advanced Techniques In this first installment, we've covered the electronics and the most basic temperature control algorithm, the equivalent of a thermostat. Now that the hardware is setup, it will be time to concentrate on software. In the next installments, I will be covering the following techniques, but you might want to start playing with it now. - Signal smoothing. If you keep a running average of your recorded temperature, you can stabilize your temperature sensor and remove a lot of noise from the signal. - Adjustable temperature set point. Enter your temperature set point from a laptop. - PID. This temperature algorithm made famous amongst coffee people by espresso hackers is now at your finger tips. I will cover the installation of this algorithm to your Arduino as well as tuning it for your application. If you cant wait, there is PID code for your Arduino here . - Fancier code on your host computer. Right now, the Arduino host software just prints the incoming temperature data to the screen. Once we start messing around with PID, we want graphing and an easy way to tune the algorithm. Luckily, Arduino's parent application, Processing, allows us to write a great cross-platform host application to provide a fancy graphing front end to this system. If you cant wait for the instructable, head here for some code . - Temperature Profiles. Once you have ultimate control of your temperature, one way to take it further is to write code to automatically adjust the target temperature over time. In the world of coffee roasting, this has proven to have a significant impact on coffee flavor. What happens to bread if you toast it with high heat and then ramp it down over 5 minutes? I don't know, but it's conceivable that the temperature over time profile could have a significant impact on the quality and texture of your food. fun! - More parts. Add in an LCD display, or buttons to adjust your set point. Tack on an ethernet shield and get your temperature plots on a web page. Image Notes 1. PID feedback hotness in a Processing plotter app connected to a coffee machine. 2. These three values will tune the performance of the PID algorithm. Related Instructables How To Create the Perfect Custom Kitchen (video) by Info4YourLife Mr. Compost: How to make an in-kitchen compost turbocharger! by eecharlie Carlitos' Projects: Wireless SpeechControlled Arduino Robot by RobotShop The Arduino Weather Station / Thermostat by sspence Arduino Controlled Line Following Robot (video) by earthshine Super Nintendo on Android with original controller (video) by bsoares Arduino + Temperature + Humidity by devillived Arduino thermometer, LCD Display, Thermistor (Photos) by Blueray03 http://www.instructables.com/id/Arduino-Projects/ Turn your Arduino into a Magnetic Card Reader! by nevdull on July 27, 2009 Author:nevdull AVR-based Network Combat Gian is a microbial biochemist by education but an avid computer science flunky and wishes this hobby could be self-sustaining.. He has a collection of 8-bit microcontrollers and a room full of computer junk that he believes talks to him. He is a sympathizer with the Robot Overlords and is adroitly maneuvering himself to be in a comfortable position when the AVR global domination begins. He is also scared of zombies. Intro: Turn your Arduino into a Magnetic Card Reader! Everyone has used a magnetic card reader, I believe. I mean, who carries cash these days? They're not difficult to get your hands on, either, and during a trip to my favorite local electronics shop, I found a bin full of these guys. So....of course, I picked one up and brought it home to see what sort of stuff I could do with it and an AVR. This instructable will show you how to connect a Magtek magnetic card reader to an AVR or Arduino/clone and read data from the first track of card. Buckle your seats; magnetic card readers have a high bit rate! Step 1: The Equipment List Here are a few things you'll need to get started. Magnetic card reader (Mine is a Magetk 90mm dual-head reader. $5.00) AVR, Arduino, or clone (ATmega328p ~ $4.30 from Mouser.com solderless breadboard some wire maybe a header if you like that sorta thing. something to read your serial port. I use AVR Terminal from BattleDroids.net That's all you should need to get started. Depending on the magcard reader you end up getting, you may have to modify these instructions, and most assuredly the code, to work with your specific reader. However, the code I've written should get you pretty far, I hope. http://www.instructables.com/id/Arduino-Projects/ Step 2: Self-clocking Magnetic Card Readers Magnetic card readers are "self-clocking," meaning that they provide a clock called a strobe, against which the connected microcontroller can sync. This is a boon. It means you don't have to worry about looking for a clocking signal and timing the signal to center directly on the clock pulse, and no bothersome oscillating into the sweet spot of the clock signal. This make sense when you think about card swipes: everyone swipes at a different pace, some slower, some faster than others. Self-clocking allows even my sweet grandma the ability to use her card without breaking her wrist. Reminds me of having to change the setting for her that determines how much time is valid between clicks to register a double-click.... This card reader's data is valid 1.0 us before the strobe is put onto the line, so there's no worry about delaying to get yourself into the "bit time." For a dual head reader such as the one I'm using, there are two data tracks available to read. In this 'ible, I'm going to show reading from the primary first track to get you started. There are five connections you will need to make (four if you don't mind giving up more fine tuned control for fewer I/O ports being used). Check out the picture below. The red wire goes to +5V while the black wire goes to ground. The green wire is /CARD_PRESENT; the yellow wire is /STROBE, and the white wire is /DATA1. The forward slash ( / ) means that the data is inverted. A low signal (ie 0) is read as a one, or high. The other connectors are brown for /STROBE2 and orange for /DATA2. We won't be using these. If you want, you can forget about /CARD_PRESENT. This data line goes low after about 17 head flux rotations to indicate that a card is present (instead of, say, random noise causing your reader to send bogus data) and is used to validate that the data you're getting is card data and not junk. You can skip this connection if you check for the start sentinel on the data stream. More on that later. As you can see below, I used a right angle male header connected to a bread board and connected my reader to that. I connected /STROBE to PIND2 (digital pin 2 on an Arduino), /CARD_PRESENT to PIND3 (for illustration purposes), and /DATA1 to PIND4. Make sure you enable pullups on these pins so your pins don't float. I also traded out my Arduino for a Bare Bones AVR because I like the way it fits into the breadboard. Image Notes 1. Vcc +5V 2. Ground 3. /DATA1 http://www.instructables.com/id/Arduino-Projects/ 4. /STROBE1 5. /CARD_PRESENT Step 3: Magnetic Card Basics The primary functions that you'll need to do to read a magnetic card are: 1. Detect when the card has been swiped 2. Read the stream of data 3. Detect when the card has gone 4. Process the data 5. Display the data First, I'll introduce you to some magnetic card basics that you'll need to know when you start writing your own code. Magnetic Card Standards Magnetic cards are standardized by the ISO in the following documents: 7810 Physical characteristics of credit card size document 7811-1 Embossing 7811-2 Magnetic stripe - low coercivity 7811-3 Location of embossed characters 7811-4 Location of tracks 1 & 2 7811-5 Location of track 3 7811-6 Magnetic stripe - high coercivity 7813 Financial transaction cards As you can see, financial cards are specified in a separate document and often have different formats than, say, your grocery card or international calling card. You will have to program for these differences. I just had a credit card and insurance card handy, so I programmed for these types (which both happen to be format B). Card Formats There are several different formats for magnetic cards. Format A and B are common, with B being the most common I've seen, and which is supported in this code. Formats C through M are reserved by the ISO, I believe, while N through ?? are reserved for institutional custom use. Track 1 For financial cards, the first track is recorded at 210 bits per inch and is the first 0.110" of the card from the top. The data is encoded as "card data" as 7-bits per character. That's 6-bits for the character and a bit for parity. There are ~ 79 alphanumeric characters on track 1. The physical ordering is backwards. That is, data is but it's written backwards on the card (and hence, will be read by your firmware) as . The parity is odd. The card data format looks like this: [SS] [FC] [Primary Account #] [FS] [Name] [FS] [Additional data] [FS][ES][LRC]where: SS Start sentinel FC Format code FS Field separator ES End sentinel LRC Longitudinal Redundancy Check character Track one SS = '%', FC = one of the formats (going to be B a lot of times), FS is often '', ES is '?' and the LRC character is commonly '<' although it's not specified in the standards. Besides being written on the card backward, the data has an odd parity bit and is 0x20 from ASCII. We'll handle this when we process the data. Track 2 Track two is 0.110" wide and starts 0.110 from the top of the card. It's recording density is 75 bits per inch. The data is 5-bits per character and consists of around 40 numeric symbols only. You shouldn't encounter any letters on this track. The card data format should follow this structure: [SS] [primary account #] [FS] [additional data | discretionary data] [ES] [LRC]The SS for track two is the semicolon: ';' and the FS is '=' With this holy knowledge under your belt, continue on to the next steps to see code implementing the procedure outlined above. http://www.instructables.com/id/Arduino-Projects/ Step 4: Detect When a Card is Swiped 1. Detect when a card has been swiped Formally, one would check the /CARD_PRESENT pin to see if it's dropped low. Fortunately, this isn't really necessary. We'll check for valid card later. Alternately, you could read your strobe pin to see when strobes have been put onto the pin, however, this will net you lots of clocking zero's. The reader will send about 60-70 leading zero's to let you know that data is about to be presented. However, we're going to use the nature of binary data to determine when to start recording bits. The start sentinel (SS) for track one is the percentage sign (%). It's binary value is 0010 0101 which means it will be stored (and read) as 1010 001 (it's 7-bits so the 8th bit isn't transmitted). Now, the astute reader will notice that even though the data is backwards it doesn't match the binary ASCII value. That's because it's 0x20 off of hex. The % symbol is 0x25 and 0100 0101 is 0x05. Card data has 0x20 subtracted from the value. That one hanging out there in the high nibble is the odd parity bit. It's put there so that there are an odd number of "1"s in the value. So because we know that a valid card will always start with this start sentinel, and because the parity bit is a 1, then when we detect the first HIGH to LOW transition on the data pin, then we know we have just started to receive the start sentinel from a card. Now, this isn't always going to be true, and a foolproof plan would be to check the /CARD_PRESENT card to see if it's gone LOW in addition. The simplest way to detect the start of the SS, is to create an external interrupt triggered on the falling edge of the /STROBE. The data is valid 1.0 us before the falling edge, so when you've sampled the falling edge, then you know you can read the /DATA1 pin and get a valid value. Here's the code to create your external interrupt triggered on a falling edge. voidInitInterrupt(void){ // Setup interrupt BSET(EIMSK,INT0); // external interrupt mask BSET(EICRA,ISC01); // falling edge BCLR(EICRA,ISC In my common.h that I include in all my programs, the definitions of BSET and BCLR can be found. Refer to that file should you have any questions about how to set bits. Now, when the interrupt is triggered, we want to sample the /DATA1 (in my code defined as CARD_DATA) and set a bit in a general purpose IO register. If we're on the 7th bit, save off the register as a character in our global buffer. I use a GPIOR0 register because it's spiffy fast access. The pseudo code is something like this: Stop 16-bit timer Clear timer If DATA is LOW Set BIT=1 in REGISTER Decrement BIT Set flag so we don't skip any more 0's else DA If you are asking yourself why decrement instead of increment, remember that the data is backwards, so instead of recording the bits as we get them from LSB to MSB, we save them from MSB to LSB so we don't have to reverse the bits later when processing the data. If you really wanted, you could also add 0x20 hex here, but since it's about 5us on these strobes, I'm keeping the processing in this interrupt service routine to a minimum. ISR(INT0_vect){ StopTimer(); ClearTimer(); if ( !BCHK(PIND,CARD_DATA1) ) // inverse low = 1 { BSET(GPIOR0,bit); --bit; bDataPresent = 1; } else if (bDataP If you're wondering what the timing business is about, that's covered in the step in determining when the card has left the reader. http://www.instructables.com/id/Arduino-Projects/ Step 5: Read the Stream of Data Read the stream of data Well, I've already shown you how to read the data, as it's part of the Interrupt Service Routine for our falling edge external interrupt. An alternative method would be to set a flag in the ISR, and in the main loop poll the flag and read the data that way, but I believe the way I've presented it is cleaner. Be your own judge and write yours however your MCU will allow it. That being said, let's move on to finding out how to detect when the card pulls an Elvis and has left the building. Step 6: Detect the Card Leaving the Reader Detect when a card has gone Formally, one would sample the /CARD_PRESENT pin to see if it's gone HIGH again, but we don't need no steenkin' /CARD_PRESENT taking up another I/O port. This is where those timers come in. Every time the interrupt is called because we've detected a falling edge on /STROBE, we stop a timer, clear the timer value and start reading. When we've finished reading we start the timer again. Repeat ad nauseum, or until the timer reaches a certain value. That means that the last interrupt has been called and no more data has come in, so we assume that's it and start processing the data we've collected. For timers, we use TIMER1, ie the 16-bit timer. I'm using a 16 Mhz resonator externally to my AVR. If you're using an arduino, then you probably are, too. So, I've chosen a prescaler value of 1024 which means every (16,000,000 / 1024) times the timer will increment. That is to say, it will 'tick' 15,625 times a second. The /CARD_PRESENT will go HIGH indicating the card has left the reader about 150ms after the last data bit. Knowing this, I just decided to check about every 1/4 of a second. That would look something like this: ( ((F_CPU) / PRESCALER) / 4 ) which turns out to be around 3900. So, when the timer counter TCNT1 reaches 3900, then I know it's been about 300ms and I can pretty safely conclude that the card has left the reader. Easy. #define PRESCALER 1024#define CHECK_TIME ( (F_CPU / PRESCALER) / 4 ) // 250 ms#define StartTimer() BSET(TCCR1B,CS10), BSET(TCCR1B,CS12) // 1024 You've seen in the ISR where the timer is started, stopped, and cleared on each interrupt. Now, in the main loop we just check to see if the timer counter has reached our target value, and if so, start the data processing. for (;;){ if( TCNT1 >= CHECK_TIME) { StopTimer(); ClearTimer(); ProcessData(); ReadData(); idx = 0; bit = 6; bDataPresent = 0; memset(&buff,0,MAX_BUFF_SZ1); } } Now it's safe to process the data. http://www.instructables.com/id/Arduino-Projects/ Step 7: Process the Data Process the data The processing phase consists of: checking for a valid SS checking parity converting to ASCII checking for a valid ES checking LRC Here, I don't bother with checking parity, as I just set that bit to zero. I also don't calculate the LRC for this little tutorial. That would be something that a more fully realized firmware might want to do. Here's the code to process the data doing the above steps (sans the previously mentioned). Find it in the image below. It's commented and pretty self-explanatory. A special note on parity and ASCII: I simply clear the parity bit (7th bit...ie a 1 with 6 zeros behind it) and to convert from "card data" you must add 0x20 to the value. That's about it. Step 8: Display the Data Display the data The display goes to a terminal program I wrote specifically for connecting to an AVR via RS232 or USB. The program is called AVR Terminal. The ReadData() method is pretty ugly and you're encouraged to find a cleaner solution than the one I came up with. There's also an output of the function in AVR Terminal. The output is first of a health insurance card, and the second is of a VISA card. Click the [i] in the upper left corner of the picture and choose original or large image to see it better. http://www.instructables.com/id/Arduino-Projects/ Step 9: Code Download and Wrapup In this instructable I've discussed some basics of magnetic card readers and shown you some code to get you started in the right direction in reading data from magnetic cards. There's plenty more work that could be done, such as reading and decoding the 2nd track, calculating the LRC and calculating the odd parity on each byte. The full source code is available for download below. It was written in AVR Studio 4.17. I hope you enjoyed this instructable and, as always, I look forward to any comments or suggestions that you may have. Happy coding and AVR'ing! File Downloads MagCardReader.zip (34 KB) [NOTE: When saving, if you see .tmp as the file ext, rename it to 'MagCardReader.zip'] Related Instructables Arduino magnetic stripe decoder by powerpants Adding ICSP header to your Arduino/AVR board by barttech Help: An Absolute Beginner's Guide to 8-Bit AVR ProgrammingAVR Dragon by PopSci Turn Your Arduino Into an ISP by mr_mac3 Power your Arduino/AVR with a HandCranked Battery by nevdull Telnet to your Arduino/AVR! by nevdull Door Activated LED Lighting using Hall Effect Sensors by woody1189 Stupid Simple Arduino LF RFID Tag Spoofer by sketchsk3tch http://www.instructables.com/id/Arduino-Projects/ Twittering Laser Tripwire with Webcam Capture by action_owl on January 1, 2010 Intro: Twittering Laser Tripwire with Webcam Capture This instructable will show you how to construct a laser tripwire that can twitter and grab an image from a webcam, as well as execute any command you can put in a bash script. This instructable is actually quite simple and is even suitable as a beginner arduino project. It requires a GNU/linux (or possibly Mac) operating system with the arduino IDE and Processing IDE working properly. This project could also be implemented in Windows if you created a more complex processing application. Hardware Requirements Arduino Board Laser pointer/pen Light Dependant Resistor 100Kohm Resistor Optional: Webcam Breadboard Software Requirements Arduino IDE Processing IDE Linux OS (I'm using Arch Linux for this project) Curl Webcam (part of xawtv) Other Stuff: Mirror Solder and Soldering Iron Wire Hot Glue Gun Hacksaw/Knife Straw or Ballpoint Pen Image Notes 1. Laser Pointer http://www.instructables.com/id/Arduino-Projects/ 2. Arduino 3. Some Wire 4. LDR (Light Dependant Resistor) 5. 100Kohm Resistor File Downloads arduino.pde (359 bytes) [NOTE: When saving, if you see .tmp as the file ext, rename it to 'arduino.pde'] processing.pde (688 bytes) [NOTE: When saving, if you see .tmp as the file ext, rename it to 'processing.pde'] twitter.trip (270 bytes) [NOTE: When saving, if you see .tmp as the file ext, rename it to 'twitter.trip'] Step 1: Connecting The LDR I needed the LDR and the laser to be in a position where they would not move around so I connected my LDR and resistor directly to the Arduino without a breadboard, but you can do it however you like, below are the photos for soldering and bending them into shape I also included a simple diagram. I cut the end off of a ballpoint pen so that I could slip it over the LDR to prevent ambient light from affecting the reading, you could also use a straw. http://www.instructables.com/id/Arduino-Projects/ http://www.instructables.com/id/Arduino-Projects/ http://www.instructables.com/id/Arduino-Projects/ Step 2: Connecting the Laser Pointer You can find these really cheap at some retail stores, I know that mine was under $3. Unscrew the end and remove the batteries. Use a hacksaw or sharp seraded knife to cut off 1 to 1/2 inch of the laser pointer, so that you can access the spring. You may not need to do this depending of what kind of laser pointer you found. Connect and solder a wire to the spring ( I bent mine out to make it easier ) then rough up a small part of the outside of the laserpointer with a knife/sandpaper/pliers ect so that you can solder it to the outer casing. Then tape the button that activates the laser. On my laser pointer the spring is + and the casing is - yours might be reversed. The best way to check is to take note of what position the batteries go in, the coin cells will have + marked on one side, if that side touches the spring then the spring is +. Connect your + wire (Casing) to digital pin 13 on your arduino and you - wire (spring) to GND. Now upload the arduino sketch and ensure that you are getting readings from the LDR and that the laser is on. To accomplish this you must uncomment this line: //Serial.println(ldrVal); and comment out this one: Serial.print("1"); If all is well you can position your Laser and LDR in a fixed position, bounce the laser to the LDR with a mirror to see that its registering. When the laser is detected it should print a "1". You may need to adjust the threshold values depending on your LDR. Image Notes 1. Goes to GND 2. Goes to +5V http://www.instructables.com/id/Arduino-Projects/ Image Notes 1. Tape to hold the button in the ON position 2. It's really a pain to solder onto this casing Step 3: Everything in place Now you are going to need to make sure that your LDR and laser are not going to be moving around while you're testing the rest of the software. I used a hot glue gun and used a small amount of hot glue on each edge of my arduino board to secure it to a plastic cassette case, (a piece of wood and some screws would be ideal but I didn't have any) The hot glue should be removed easy and if it doesn't it's in an unimportant location. I then hot glued my laserpointer onto the platic cassette case and rested it against the arduino's digital headers. The LDR doesn't move around so I didn't have to worry about it moving. Your set up may vary but you get the idea. You'll then want to make sure the whole thing won't move around, I used sticky tack on the bottom of the cassette case and put a jar of change on top of the USB cable so that it would not move around while testing. You'll also want to affix your mirror to something, it's up to you to figure this one out I used sticky tack to adhere the mirror to an old and heavy Kodak brownie camera and set it on a stool with a few books on top while testing everything out. Later I just affixed the mirror to my camera tripod. Image Notes 1. Mirror 2. Protip: I scrapped this for a camera tripod, much better. Image Notes 1. My black cover fell of at some point and I couldn't find it. 2. Plastic Cassette case http://www.instructables.com/id/Arduino-Projects/ Step 4: Processing Load the Processing sketch and leave this line commented out: //open("/home/your_usename/twitter.trip"); Make sure that your laser is pointed at the LDR and run the sketch. The screen area should be green and when you block the laser it should turn red, then after 10 seconds it should turn back to green. The 10 second hold is to ensure that you're not twittering the same message multiple times, you can change this value by modifying the "int threshold=10000" variable. Now that everything is working it's time to get your scripts in place put twitter.trip into: /home/your_username/ Change these to your twitter username and password user="name" pass="password" open up a terminal and type: chmod a+x /home/your_username/twitter.trip then run it ./twitter.trip go to your twitter page and you should see "laser tripped on..." as your last tweet. Now time to get the webcam working, you can skip this step if you don't want to use a webcam or if you know how to grab a frame from a webcam in linux via script. First you want to make sure that the program called "webcam" is installed, it's a part of xawtv. Arch Linux: pacman -S xawtv Fedora: yum install xawtv Debian/Ubuntu: apt-get install xawtv Then configure .webcamrc however you need, mine is below. The best part about webcam is that it has ftp support so that the image can be uploaded to a webserver, if you don;t want FTP comment that part out. .webcamrc in /home/your_username/ [grab] device = /dev/video0 text="%Y-%m-%d %H:%M:%S" #infofile = filename fg_red = 0 fg_green = 0 fg_blue = 0 fg_red = 255 fg_green = 255 fg_blue = 255 width = 320 height = 240 delay = 0 wait = 0 input = pac207 #norm = pal rotate = 0 top = 0 left = 0 bottom = -1 right = -1 quality = 75 trigger = 0 once = 1 archive = /home/action-owl/webcam/%Y-%m-%d--%H:%M:%S.jpg [ftp] host = ftp.yourwebsite.com user = username pass = password dir = public_html/img/webcam file = webcam.jpg tmp = uploading.jpg passive = 1 debug = 1 auto = 0 local = 0 ssh = 0 http://www.instructables.com/id/Arduino-Projects/ Step 5: Using open() in processing The "open()" function works a little differently depending on your environment so you may need to find out what works for you, the method below should work. Uncomment: //open("/home/your_username/twitter.trip"); If you are using Nautilus or Thunar File Managers(XFCE and Gnome): Navigate to twitter.trip and right-click it. Select "Open with other application" select "Use a custom command" and type in "bash" Processing is supposed to send executables to the shell to be run but after trying many methods this was the one that worked. This is also why the sketch has a .trip extension. http://www.instructables.com/id/Arduino-Projects/ Step 6: Now run it. Now everything should be ready to go! Run the processing sketch and check your twitter and webcam archive location for the result. Something is up with the file downloads. So here's the code, again. #-----------------------# twitter.trip #-----------------------#!/bin/bash user="username" pass="password" trip=$( date +'%A %b %d, %l:%M%p' ) stat="laser tripped: "$trip url=http://twitter.com/statuses/update.xml result=`curl -u $user:$pass -d status="$stat" $url` #save webcam pic webcam date +'%A %b %d, %l:%M%p' > /home/username/someplace //-----------------------// processing code //-----------------------import processing.serial.*; Serial myPort; char inBuffer; int wait, now, timeout = 10000; boolean hold = false; void setup() { size(200,200); println(Serial.list()); myPort = new Serial(this, Serial.list()[0], 9600); fill(#36ff00); } void draw() { while (myPort.available() > 0) { inBuffer = myPort.readChar(); if(inBuffer=='1') { if ( !hold ) { fill(#ff0000); println("Tripped"); open("/home/username/someplace/twitter.trip"); wait = millis(); hold = true; } } } now = millis(); if (now > (wait + timeout)) { hold = false; fill(#36ff00); } rect(0,0,200,200); } //-----------------------// arduino code //-----------------------int ledPin = 13; int analogPin = 0; int ldrVal = 0; int threshold = 500; void setup() { Serial.begin(9600); pinMode(ledPin, OUTPUT); http://www.instructables.com/id/Arduino-Projects/ digitalWrite(ledPin, HIGH); } void loop() { ldrVal = analogRead(analogPin); if ( ldrVal > threshold ) { Serial.print("1"); delay(200); } } Related Instructables Do not Enter(Twitterupdates) (Without Ethernet Sheild) (Photos) by vishalapar TwitMap: Topographical Colorado Twitter Map by ianisborn Home surveillance via Twitter and YouTube by maskedavengers Twitter controlled Arduino Outputs - no PC - LCD Display + Sensor data to Twitter by XenonJohn Give Your Cat Twitter Powers by bpunkt Twitter Mention Mood Light by pdxnat simpleTweet_00 processing by pdxnat The Twittering Office Chair by randofo http://www.instructables.com/id/Arduino-Projects/ How To Smell Pollutants by liseman on April 5, 2008 Author:liseman author's website bicycles, gardening, and other important stuff Intro: How To Smell Pollutants This Instructable explains how to use a gas sensor with your Arduino. This lets your Arduino smell (and hence you program responses to) overall gas levels for a variety of nasties, including ethanol, methane, formaldehyde, and a bunch of other volatile organic compounds. My cost to make this actual device was under $100, including the full Arduino kit. Here's a video: . And no, I won't put a shirt on:-) I've got kits / finished versions of this and some other projectsfor sale @ my website The closest comparable commercial products I can find are: -a commercial-quality detector: $2500+ -a lab monitor: $295 -a one-off test kit for volatile organic compounds: $234 I learned about this after hearing about some guys who added VOC sensors to toy dogs. Not sure where/if the docs on that project are, but here's the guide that I followed. Links explaining what VOCs are and why you might want to care: -Some symptoms of overexposure to VOCs -an OSHA regulation on formaldehyde levels -information on sick building syndrome: 'A 1984 World Health Organization Committee report suggested that up to 30 percent of new and remodeled buildings worldwide may be the subject of excessive complaints related to indoor air quality (IAQ).' -The Inside Story: A Guide to Indoor Air Quality: "For pollutants other than radon, measurements are most appropriate when there are either health symptoms or signs of poor ventilation and specific sources or pollutants have been identified as possible causes of indoor air quality problems. Testing for many pollutants can be expensive. Before monitoring your home for pollutants besides radon, consult your state or local health department or professionals who have experience in solving indoor air quality problems in non-industrial buildings." http://www.instructables.com/id/Arduino-Projects/ Image Notes 1. 1k potentiometer 2. voc sensor: figaro sensors 2620 3. arduino (from ladyada.net kit) Step 1: Gather Your Supplies You'll need: -an Arduino (or equivalent) -a cable to hook the Arduino up to your computer / provide power -a computer to read values -a potentiometer or resistor of known value. anywhere from 500-1k ohms should work -the gas sensor: a pain to buy in small quantities. i bought 2 and they cost like $22 each, but volume orders get way cheaper... the specific sensor i used was figaro sensors's 2620. Here's what I used: -the arduino kit I used -the different sensors available from Figaro (use different sensors to 'smell' different things) It' useful but not necessary to have a multimeter and wire stripper handy... The pdf included with this step is the price list from the sensor manufacturer as of March 2008. Image Notes 1. tgs2620 voc sensor. careful w/ these: they're not cheap and don't seem particularly hardy:) http://www.instructables.com/id/Arduino-Projects/ Image Notes 1. 1k potentiometer 2. ground (either one of 2 outer pins) 3. variable resistance 4. incoming resistance (either one of 2 outer pins) http://www.instructables.com/id/Arduino-Projects/ File Downloads Price 01_08 USA.pdf ((612x792) 191 KB) [NOTE: When saving, if you see .tmp as the file ext, rename it to 'Price 01_08 USA.pdf'] Step 2: Set Up Your Arduino 1. Get your Arduino connected to your computer and functional This should be pretty straightforward, especially with any newer Arduino. This guide worked for me. 2. Program your Arduino to read the value from an analog input and display this on-screen. I used -this guide for using a potentiometer with an arduino and basically just modified the frequency with which it reads input value (delay(100) = read 10 times per second) to get the following code, which works for me: //this outputs pot value to screen in ohms int gasSensor = 0; // select input pin for gasSensor int val = 0; // variable to store the value coming from the sensor void setup() { Serial.begin(9600); } void loop() { val = analogRead(gasSensor); // read the value from the pot Serial.println( val ); delay(100); } If you're using this as your first excuse to play with an Arduino, you might want to try just wiring up the potentiometer and reading the value from it before adding the sensor. http://www.instructables.com/id/Arduino-Projects/ Step 3: Create Your Circuit The picture attached is an image of the circuit from above (meaning that the sensor's leads are pointing towards the ground; there's a little metal tab protruding from the sensor to let you understand which pin is which. Also, check out the figaro guide for the specific sensor you choose. Attached is the datasheet, with some example circuits, for the 2620. For the 2620, the datasheet specifies at least 450 ohms resistance needed. I tuned my potentiometer to ~right around 450 ohms. In plain english, here are the connections you'll want to make: -sensor pin 1 to an outer pin of potentiometer and ground (arduino ground) -sensor pin 2 to other outer pin of potentiometer -sensor pin 3 to arduino +5 v and sensor pin 4 -middle pin of potentiometer to arduino analog 0 input You can solder this (read Figaro note on which type of solder and temperature exposure of sensors), but a breadboard is good enough for my purposes. Image Notes 1. potentiometer 2. view of sensor from above Image Notes 1. pin2: sensor 2. pin3: sensor + 3. protruding metal thing letting you see which pin is which 4. pin4: heater + 5. pin1: heater - File Downloads 2620pdf.pdf ((612x792) 109 KB) [NOTE: When saving, if you see .tmp as the file ext, rename it to '2620pdf.pdf'] Step 4: Test Your Newfound Sense of Smell With everything connected, you're ready to hook the arduino up to your computer, fire up the arduino environment, and start reading values. Don't forget (like I initially did:)) to hit the 'monitor serial input' button in the arduino software. You'll then begin to see values scrolling in the black space at the bottom of the arduino program. These values are the resistance, in ohms, being read from the circuit. To test, blow slowly for at least a few seconds over the top of the sensor. The numbers on the screen should change. Also try holding the sensor over a highconcentration chemical that it should detect: my value jumped quite a bit doing this. With ~4 days burn-in and ambient temperature of 63F, the values I read in my house were (which is reasonably free of chemical use): -sitting in the open air, after sensor warms up for ~1 minute: 52 -breathing slowly over the sensor for several seconds: 73 -holding sensor directly over an open bottle of grain alcohol: 235 http://www.instructables.com/id/Arduino-Projects/ Image Notes 1. holding the sensor over the grain alcohol. don't get it wet (or drink this stuff: it's pretty nasty!) Image Notes 1. readings while over the alcohol: lotsa vocs! 2. don't forget to hit this button to start outputting the readings in the black box below:) Step 5: Build Away! Without burning in this circuit for a week and adding a thermistor, this is really only good for reading relative concentrations of chemicals: eg, if you want a 'lower-VOC' paint, you could hold this over different open bottles of paint (in a room of constant temperature) and reasonably feel a bit safer using the paint that registers the lowest value. Obviously, there are nasties (and probably some VOCs: I don't know) that this doesn't detect, but it's definitely a bit better than nothing:-) Attached is a pdf Figaro Sensors provided, detailing the response of thermistors at different temperatures. Definitely not the only thermistor you can use, but may be useful as you explore your own, better version of this project. A cool expansion I want to see is to display the approximate level in parts per million (ppm) of air pollution on my back as I ride my bike through traffic, maybe with an LED 'Mr. Yuck' sign that turns on above a certain concentration as well. Let me know what you build, and have fun! File Downloads Semitec D Thermistors.pdf ((613x842) 638 KB) [NOTE: When saving, if you see .tmp as the file ext, rename it to 'Semitec D Thermistors.pdf'] Related Instructables Air quality balloons by staceyk Make a basic electromagnet by sacred Ard-e: The robot with an Arduino as a brain by imadami Arduino Basics: PIR Sensors by frenzy coin slot detector by semiotech K'nex AK-47 Model (Photos) by TwistedParadox Convert your Honda Accord to run on trash by jimmason Urban Prospecting Detector by splnlss http://www.instructables.com/id/Arduino-Projects/ How to connect Arduino and RFID by otaviousp on September 13, 2009 Intro: How to connect Arduino and RFID On this instructable I will try to show how to interface a RFID sensor with the Arduino. I am using the RFID sensor from seeedstudio the serial version of it. There are a few parts you will gonna need. I also bought some RFID keys. UPDATE: Now it works with IDE 021 Step 1: What you gonna need? - Arduino Board - RFID Sensor from seeedstudios - Wires - Protoboard - RFID tags (125kHz) from seeedstudios Image Notes 1. Arduino Board 2. RFID sensor board 3. RFID antenna 4. Wires Image Notes 1. Card that I used to add another tag. 2. The card I used to deny others TAGs 3. Sample TAGs http://www.instructables.com/id/Arduino-Projects/ Step 2: Plugging all together Connect the antenna on the appropriate pins like the first photo. Plug the RFID sensor to the protoboard like the second photo above. Only 3 wires are required to interface, 2 wires for supply and another for the serial line(communication) The wires as connected as the third photo shows. On RFID sensor: PIN 1 -> Tx PIN 2 -> Rx (Not Used) PIN 3 -> NC PIN 4 -> GND PIN 5 -> VCC (+5V) Tx from RFID board goes to Digital PIN 2 on Arduino Board. That is all you gonna need to wire. Moving on to next step, the software. Image Notes 1. Some tape to hold the wires. Image Notes 1. Tx PIN 2. GND 3. Vcc Image Notes 1. Arduino PIN2 (Rx) SoftSerial 2. NC 3. Tx 4. Vcc 5. GND 6. Antenna http://www.instructables.com/id/Arduino-Projects/ Step 3: The code I'm not a software guy, so this code is just for demonstration. I don't make any kind of checksum at the tags code, but it seems to work fine. The code is really simple. I used a new library for the serial, using software emulation. With the two white cards you can deny or allow the access of others keys. Any doubt, please ask me. File Downloads RFID_2_eng.pde (1 KB) [NOTE: When saving, if you see .tmp as the file ext, rename it to 'RFID_2_eng.pde'] Step 4: Results! There is no LED, sound or LCD for debug or visualization, just through the serial line. The video demonstrate how to use the software. I didn't post any kind of explanation as text on the video. I hope that the images spokes more then words, xD Any doubt or suggestion, feel free to ask, or correct me. Please, if you like it, rate it, thank you Related Instructables RFID cat door by landmanr RFID Reader! RFID pet feeder Identify by landmanr anything with RFID from credit cards to license plates by simonfrfr Twitter Poem Box by saccpcomp Stupid Simple Arduino LF RFID Tag Spoofer by sketchsk3tch How to block/kill RFID chips by w1n5t0n RFID Reader Detector and Tilt-Sensitive RFID Tag by nmarquardt AVR/Arduino RFID Reader with UART Code in C by nevdull http://www.instructables.com/id/Arduino-Projects/ Mushroom Environment Control - Arduino Powered by anthony_p1234 on June 22, 2010 Author:anthony_p1234 I pass the time by involving myself in small projects and watching youtube political discussions. I am a jack of all trades and master of none, and am good up until I have to house a project in a box, I never was able to colour in between the lines. Intro: Mushroom Environment Control - Arduino Powered This is my first Arduino project aimed at helping me with my other hobby which is growing oyster and shiitake mushrooms indoors. In a nutshell, the controller takes in two temperature readings, 1 Humidity reading and 1 Co2 reading and triggers a set of four relays connected to mains power. Intended to be connected to the mains are two heating pads, a sonic humidifier and an air pump (although the choice isn't limited to these of course). Step 1: Items Here is the list of items I used for the project. MAIN: -Arduino. -LCD Keypad shield. - 7-12 volt power supply. - USB cable (socket that connects to USB on Arduino). -Box To house the whole thing. -Veraboard/breadboard. - 4x solid state 5v- 240v relays. - Mains Power board with four sockets. - Wires. - Jiffy box to house inline socket/screws to connect Sensors. SENSORS: -Thermistors 10k x2 -Resistor 10k x2 -HS1100 humidity reader - 555 timer (cmos type) - resistors: 576k, 49.9k, 1k and 909k - Veraboard/breadboard - Jiffy Box - Digital divide by ten Chip -MG811 C02 sensor (I got a breakout board with op-amp amplifier built in. You can make it yourself, it is a high precision op amp set up as non-inverting with gain around 10). - Jiffy Box ENVIRONMENTAL CONTROLLERS - 2 x heating pads - Sonic Humidifier - Aquarium Tubing - Air Pump (aquarium) - Plastic lunchbox (airtight) - HEPA Filter for Vacuum cleaner. - Plastic tub - Aquarium Air pump - Aquarium Tubing - Plastic Lunchbox (airtight) - HEPA Filter for Vacuum cleaner http://www.instructables.com/id/Arduino-Projects/ EXTRAS: - Hot Glue gun - Soldering Iron - Screwdrivers - Multimeter - Drill - Home brew larger. Step 2: Thermistors Solder two wires to each thermistor. On a breadboard solder on a 10k ohm resistor, one end will connect to the Arduino ground, the other to Analog input 1 and to one of the thermistor wires. The other end of the thermistor wire connects to +5v from the Arduino. Do this for another Thermistor and connect it to Analog input 2 instead. Basically it is a voltage divider with the thermistor defining the Voltage going to the Arduino analog input. One analog divider for each thermistor. I added the circuitry in a separate jiffy box where the thermistor leads could be screwed into inline screws protruding from the box. To test this sensor, use a multimeter to look at the voltage change as you put your finger on the Thermistor. Step 3: Humidity Reader The humidity sensor is a variable capacitor which changes linearly with the relative humidity. The datasheet shows how to hook up the sensor using a 555 timer (must use CMOS type). I used this circuit to send data pulses to the Arduino. At first I found the pulses were too close together and did not give high enough discrimination, so at the output of the 555 I put a digital divide by ten chip. This made it so the pulses wavelength was in the hundreds of microseconds rather than the tens of microseconds. Please find attached the datasheet which has the circuit diagram using the 555 timer. I used the same style inline screws as described with the Thermistor step as a go between for this sensor and the Arduino. To Test this, hook up the output to a speaker supply power (6volts will do) and breath on the sensor, you should hear a drop in frequency. Image Notes 1. Nice jiffy box housing Image Notes 1. 555 cmos timer http://www.instructables.com/id/Arduino-Projects/ 2. Remember to listen to some tunes while you work... and you can use the speaker to test if the sensor is working correctly 2. Digital divide by ten chip File Downloads HS1101-HS1100.pdf ((595x841) 518 KB) [NOTE: When saving, if you see .tmp as the file ext, rename it to 'HS1101-HS1100.pdf'] Step 4: Co2 Sensor Initially I had ordered an MG811 Co2 sensor by itself, after setting it up I couldn't make it work properly so I ordered one already on a board with an op amp amplifier built in. I later found that the power supply I was running it with was faulty and the heating element in the Co2 sensor was running on overdrive. Basically the circuit has the sensor hooked up to a non-inverting op-amp with roughly a gain of ten, and the heating element is supplied by a 6 volt voltage regulator. The set up is shown on the datasheet attached with pinouts of the sensor which is self explanatory, what isn't self explanatory is the graph on the datasheet which gives a totally inacurate picture of the expected output of the sensor. Give it a test by placing a Multimeter on the sensor and breathing on it, it should change reading. Image Notes 1. MG811 sensor, it heats up a little. 2. Board that came with the sensor, has an op-amp non-inverting amplifier, also a comparator but I just wanted the amp output so I bypassed it (the orange wire). 3. Hot Hot Hot glue Image Notes 1. Gain = 1+ R2/R1 2. Op amp should be high quality. An input offset voltage of 1mv is good. File Downloads MG811Datasheet.pdf ((595x842) 146 KB) [NOTE: When saving, if you see .tmp as the file ext, rename it to 'MG811Datasheet.pdf'] Step 5: Connect the Arduino In this step I connected the Arduino to the go between board. The Keypad shield goes just on top of the Arduino. Solder onto the shield the separate Thermistor voltage dividers inputs to Analog 1 and Analog 2, Analog 3 takes in the Co2 input. Solder to digital 2 the Humidity input. Solder on the power supply, I recommend 7 volts supply as the C02 reader needs 6 volts at least. I soldered the power supply onto the go between board and then soldered from there to the Arduino. I fed the 6 volts to power the humidity sensor and C02 sensor directly(as the C02 board had a voltage regulator), but used the 5volt reference voltage from the Arduino for the temperature sensor voltage divider. http://www.instructables.com/id/Arduino-Projects/ Image Notes 1. Humidity reader 2. Thermistor, temperature reader 3. Arduino with keypad shield 4. Extra board for Voltage divider circuit. I also used this as a go between for the inline screws/sockets and the arduino 5. Inline screws, later to be put in a jiffy box so I can add/remove sensors to this with ease. 6. Bubble wrap for stress release Image Notes 1. Humidity digital input 2. +5 and ground from the arduino 3. A1 and A2 for temperature A3 for the Co2 reading 4. These wires are going to power the Arduino Step 6: Mains Relays and connection to Powerboard ***MAINS WIRING HERE SO BE CAREFUL*** Solder the four Mains relays to some Veraboard. My relays had marked on them "+" "-" and two load pins. The - pins are connected to Arduino ground, each + is connected to the arduino digital pins 3, 11 ,12 ,13. The load is what switches the mains active signal, and I used this to switch each individual active within the powerboard. Opening up the power board I removed the copper strip connecting the actives, and cut them into four separate peices. Soldered onto each peice was one of four wires which were soldered back onto one of the load pins of each of the relays. The active wire from the mains was then connected to the other load on the relay. I put hot glue where normally the gromit would go on the powerboard outlet, and I also put hot glue around the mains wires near the relays, just to give it some extra strength. Image Notes 1. Normally this copper strip would extend the length of the board connecting all the Actives. I cut them into separate pieces and soldered wires to each http://www.instructables.com/id/Arduino-Projects/ Image Notes 1. Each of these wires will go to a separate load connection on one of the four relays Image Notes 1. Relays on the veraboard Image Notes 1. To active on powerboard, plug 1 2. To active on powerboard plug2 3. To active on powerboard plug 3 4. To active on powerboard plug 4 5. Active from AC power plug 6. To Digital 3 of Arduino 7. To digital 11 of Arduino 8. To digital 12 of Arduino 9. To digital 13 of Arduino 10. To Arduino ground http://www.instructables.com/id/Arduino-Projects/ Image Notes 1. I connected each load 1 to a separate active on the powerboard. 2. Load 2 was connected to the active from the mains power. 3. To Arduino Digital out (3, 11, 12 or 13) 4. To Arduino Ground Step 7: The Code This was the first time I have coded in C in a long time (and my first real Arduino project). I am sure that there are many changes that could be made to streamline it, but it does the job and what's required of the Arduino board isn't really that intensive for this project. ...please note the original lcd4bit library has a lot of unnecessary delays in it which slows the code down A LOT, these should be removed (look in the cpp library file for clues). In brief the code (in order of how it appears in the attached code) does: PRE-MAIN LOOP - #defines M and C values for the linear and log equations required to translate the bit values for the inputs. i.e. y=mx+c and y= Mlog(x)+C -#defines sizes for averaging array, sampling times, histerisis levels, Pins, EEProm storage size. -defines variables, trigger values etc. MAIN LOOP -Read in sensor values every "SENSOR_INTERVAL" milliseconds. -Puts the new values in an array and averages this array. -Performs calculations on the averages to give a 'proper' value i.e. centigrade (apologies to my american cousins but I am metric), ppm (co2), Relative Humidity. -Prints updates of new temp, humidity and Co2 levels to LCD shield. -Stores values to eeprom every "EE_PROM_INTERVAL" milliseconds. -Trigger relays if bellow/above trigger, every "INTERVAL" milliseconds. -Keypad code that implements a rudimentary menu system allowing triggering values to be changed and EEPROM values to be dumped to serial. -Funtions to help with averaging and key selection. I have tried to give an explanation within the code as to what each section does, by all means go in and take a look. If you are more inclined to shy away from reading the code, please note the main things to note are the #define statements for manipulating intervals for reading,triggering and averaging and the #define statements for calibrating M and C values. These are all situated at the top of the code so take a look and have fun fiddling. Please note that the code uses the EEprom library for reading writing eeprom values, the lcd4bit library (modified, delays are removed and the pinouts changed) for the lcd shield, and stdlib for converting int into char for writing to the LCD display. http://www.instructables.com/id/Arduino-Projects/ File Downloads enviro_w_display_v10_with_serial_upload.pde (16 KB) [NOTE: When saving, if you see .tmp as the file ext, rename it to 'enviro_w_display_v10_with_serial_upload.pde'] Step 8: House the project ....what?? you're asking me, the guy who had to add an extra jiffy box because he misjudged the size of the project and got a box that was too small! Just a couple of notes here, make sure whatever you do that there is no chance that any of the mains power will ever in any way come into contact with any other wires. For me this involved having the mains veraboard as far away as possible within the project housing and to tie up all the wiring, and a dash of hot glue here and there to hold down the wiring. Basically keep it neat and tidy. For the front panel I made a stencil of the LCD/Keypad shield of the arduino and drilled/cut to get the front panel to fit, and then with some nuts and bolts bolted on the keypad shield onto the front. You can also see that I drilled holes for the buttons. Image Notes 1. Drilled holes for the buttons 2. Dynamic display of temperature, humidity and Co2 ppm 3. Asterixes show if relays are on. Top left = Temperature 1 Top right = Temperature 2 Bottom Left = Humidity Bottom right = Co2 Image Notes 1. Inline screws for easy connection to the sensors 2. 5 volt reference from Arduino for the Thermistors 3. ground and six volts (really 7 volts) for the Humidifier and C02 sensor http://www.instructables.com/id/Arduino-Projects/ Step 9: The Humidifier To keep the temperature up you would plug in a beer heating pad (of course beer has to be involved). To keep the C02 levels low you would add a fan. ...But what to add to keep the humidity up?? A humidifier and here's how I made mine. First I got a small tub and drilled a number of holes in the top cover, and one bigger hole in the center. Next you thread the sonic humidifier wiring through and seat the humidifier on the bottom. In one of the holes I attached some aquarium tubing. On the other end of this tubing was an air pump held within a airtight tub. The lid of the tub had a hole cut out and was covered by a HEPA filter. The reason for the HEPA filter is so that air going into feed the mushrooms isn't contaminated with bacteria and other fungi. This system of air filtration is also used for the air supply when the co2 gets too low. After putting water in the tub, turn it on and watch. Image Notes 1. Air from the air pump is pumped in 2. Like an 80's rock show. 3. There was a grommit on the humidifier cable which fitted nicely. 4. In normal operation the lid is closed Image Notes 1. An aquarium air pump is housed inside here. There is a hole cut out on the top and a HEPA filter has been glued. 2. You cant see it, but the tubing goes in through a hole at the front of the airtight tub and attaches to the aquarium pump. Image Notes 1. Sonic Humidifier, just add water 2. The plug to plug up the hole in the tub Image Notes 1. Aquarium air pump 2. Tubing from air pump that will go to the humidifier 3. HEPA filter from a vacuum 4. Technics turntables to play the choons while you work :) http://www.instructables.com/id/Arduino-Projects/ Step 10: Humidity Calibration This bit is tricky in that unless you have another humidity reader that you trust you can't be 100% sure that what you are calibrating is correct. After some investigation I did find that I could get two readings (two is all you need) to calibrate. First get a a plastic lunch bag and in it put a mug of salt which you have dampened just enough to make it feel like wet sand. Put the humidity reader in with it and wait for about 12 hours. From what I understand the humidity should be at 75% inside the bag. Read off the serial out on the Arduino to find what value you are getting Serial.println(humval[4]); Average this value over a number of readings. Write this value down, this is your X1 val, your Y1 value is 75. Next go take a shower (take your computer with you), make sure it is a cold morning, after having a shower make sure there is a fine mist and take a number of readings with Serial.println(humval[4]); Average this value and write it down, this is your X2, your Y2 value is 100. Alternatively the last step can be done using the humidifier inside a large bag with the humidity reader inside it. Now remember your algebra! Solve these two equations: Y1 = m*X1 + C Y2 = m*X2 + C ...and hope that m is as big as possible! Using the M and C values fill out the portion of the code: #define HUMIDITY_C 680 #define HUMIDITY_M 1.6 Image Notes 1. Wet salt (still solid but wet to touch like wet sand) 2. Electrical tape because I'm that paranoid about airflow! 3. Humidity reader Step 11: Temperature Calibration This one is relatively easy, I used my Digital multimeter and got two readings, one from under my arm (this was after the shower!) and one at normal room temp. Yes it does look funny having two sets of wires protruding from your armpit. Use serial.println(thermVal1[4]); to output values. Average those values to get your X value, your Y value comes from the temperature reading off the digital multimeter. Your first set of readings comes from under your arm, your second set from normal room temperature. Once again solve th equations to get M and C Y1 = M*X1 +C Y2 = M*X2 +C Update M and C values in the code: #define TEMPERATURE_M 13.31 #define TEMPERATURE_C 188.1 http://www.instructables.com/id/Arduino-Projects/ Image Notes 1. Thermistor next to Multimeter heat sensor 2. Thermistor reading 3. Pretty close! Step 12: C02 Calibration This one is difficult. The way I went about this was to look at the current value of C02 ppm in the world today (yes it is going up!), it's around 400ppm. Assuming that it is a bit higher if you live in the city (my one is relatively clean) I assumed normal outside Co2 levels to be 500 ppm. So I opened my window and after allowing the Co2 sensor to heat up I took a number of Serial.println(carbonD[4]); readings. I averaged these out, and set my X1 value to equal this, my Y1 = 500. The datasheet showed that the sensor maxed out at 10000ppm, so for my second reading I got some bicarb and vinegar put that in a plastic bag with the sensor and sealed it up and set the reaction off. After a minute or so It reached its lowest reading using Serial.println(carbonD[4]); so I used this value as my X2, my Y2 I set to 10000. Now I solved to find M and C: (or use excell :) ) y1 = MLogn(x1) + C y2 = MLogn(x2) + C And plugged these values back into the program: #define Carbon_M -83.45 #define Carbon_C 768.62 By the way for this step I am not convinced about my assumptions made about X2 and Y2 values (or Y1 values for that matter :) ), if anyone has some suggestions I am open to them. Image Notes 1. Wonderful sunny Melbourne! :) 2. Co2 sensor 3. I know it's at 1000ppm, give it a few seconds, the Co2 sensor needs to heat up http://www.instructables.com/id/Arduino-Projects/ Step 13: Test it out Get a mini greenhouse and... Hook up the gear and see how it performs, have fun fiddling with the histerisis, the averaging array size, the trigger temps, placing of the sensors and heaters humidifier etc. A quick starter: In normal display mode (where the temps hum co2 are shown) the only button that does anything is the right button which pushes the last days readings to serial tx. To the far right of the display appear asterixes if the relays are triggered. Press button 1 to go into configure mode, here you can adjust the triggering for temperature, relative humidity levels and C02 relays. Right scrolls through the different values, up/down lowers and raises the values. Left button does nothing, my shield had a problem with the left button so I didn't program it in :). Related Instructables Open Source Server Room Monitor by inventgeek seeedstudio Office Gnome by seeedstudio Seeeduino Humidity and Noise notifier by suqingxiao Using Humidity sensor with 8051 Microcontroller (video) by ashoksharma The Arduino Weather Station / Thermostat by sspence How to Grow Oyster Mushrooms (Low Tech) by uniqueutopia Arduino + Temperature + Humidity by devillived A credit card sized Ethernet Arduino compatable controller board by drj113 http://www.instructables.com/id/Arduino-Projects/ Arduino Watch Build Instructions by Matthew Garten on May 28, 2010 Intro: Arduino Watch Build Instructions The Arduino Watch provides augmented sensing of temperature and range, 16-bit color drawing program, Breakout game, and also tells the time in your choice of digital, binary, or analog. Additional sensors, devices, and programs are easy to add as any standard Arduino. The source code can be downloaded from the google code page, code.google.com/p/arduino-watch . Updates and news on the Arduino Watch can be found at OptimizedForce.com This is a video that gives an overview of what the Arduino Watch can do. http://www.instructables.com/id/Arduino-Projects/ Step 1: The Materials The materials used in making the watch are Electronics 1 Arduino Mini Pro 328 - 3.3V/8MHz available at SparkFun 1 FTDI Basic Breakout (if you don't have one) available at SparkFun 1 4D Systems OLED Module 1.5" (128x128 pixels) available at SparkFun 1 Blackberry Trackballer Breakout available at SparkFun (I'm sensing a theme of the supplier) 1 3.7V 1000mAh Li-Polymer battery available at SparkFun 1 LiPoly Fast Charger available at SparkFun 1 DS1307 Real-time clock available at Digi-Key 1 Crystal 32kHz available at SparkFun Nuts and Bolts available at local hardware stores 2 #4 bolts 3/8" long 2 #4 bolts 1/4" long 4 #4 bolts 3/4" long 8 #4 nuts (for the nuts and bolts I found the brass ones at Ace and the zinc ones at Home Depot) Watch Band ~13" x 1 5/8" leather band for the outer layer (I used a wide leather belt) ~8" x 1 7/8" elastic band for the inner layer (I used another belt) Misc 1/4" OD copper tube available at Home Depot 1/2" thick piece of wood for screen case, I usually use poplar wood. 6 right angle header pins available at MarVac 1 Connector Housing 6 pin housing (if you can find a 5 pin housing get that) available at MarVac 2 Connector Housings 1 pin housing 7 female pins available at MarVac 1 IDE ribbon cable (dig it out of that pile of cables you never use) Alternate parts 1 4D Systems OLED Module 0.96" (96x64 pixels) available at SparkFun will also work since I originally programmed the watch for that display until I accidentally broke mine and everyone was out of stock so I had to move to the next size up. 1 3.7V 900mAh Li-Polymer battery available at SparkFun smaller cheaper battery almost as much power. 1 Real-time clock module available at SparkFun or at RobotShop these modules would replace the real-time clock chip and the 32kHz crystal and give you a backup battery. http://www.instructables.com/id/Arduino-Projects/ File Downloads Arduino Watch BOM.xls (15 KB) [NOTE: When saving, if you see .tmp as the file ext, rename it to 'Arduino Watch BOM.xls'] Step 2: The Software The code for the Arduino Watch can be found on my Arduino Watch google code page http://code.google.com/p/arduino-watch/ . The main file needed is the WatchRXX.pde (were XX is the current revision) and at the same location you can also download all the libraries needed for the Arduino Watch software. http://www.instructables.com/id/Arduino-Projects/ Step 3: Preparing the materials Arduino Prep Solder the right angle header pins to the Arduino so that you can connect the FTDI Basic Breakout board easily. Battery Prep Cut the JST connector off of the battery and attach the single pin housings to the ends of the wire this tutorial is useful to teach how to crimp the wires. Step 4: Carving the Screen Case This step covers the carving of the case for the OLED display. The frame was carved on a Carvewright woodcarving machine. Then sanded down the part and drilled the screw holes on a drill press with a 1/8" bit. To locate the holes I put the display in and marked out where to drill. Originally I tried to drill the holes in with the Carvewright but it split the frame during the hole drill and I had to start over. Next I used a dark stain to give the poplar wood a nice finish. http://www.instructables.com/id/Arduino-Projects/ Step 5: Parts Layout This step is where you layout the parts to see how long of wires you need to have for the watch. Remember that when the watch is on your wrist the parts will be closer together due to the curvature of the watch band. Tape the components to the watch band and see how it fits on your wrist and make sure everything is in a comfortable position. Layout the ribbon cable from the part to the Arduino and mark the distance on the cable (leaving wire to solder to), then cut the cable and strip the wires. For the trackball to Arduino there needs to be a minimum of 7 wires (power, ground, button press, up, down, left, right). If you want to light up the trackball you can use more wires and connect to an available digital out. For the display to Arduino there are 5 wires. Step 6: Cutting the watch band The step covers the cutting of the watch band to create mounting points for the trackball, display, and battery. The screw holes are 1/8" diameter and the hole for the trackball is 1/2" diameter. The large square in the picture was for the smaller display I was originally going to use and is not necessary. The smaller rectangle cut out is for the connection to the display which is necessary. Step 7: Soldering Connections Diagram This Excel file has the pin map for how to wire the Arduino to the other components. The picture shows you what it will look like after following the next few steps. Remember helping hands are always, well, helpful when soldering. And if your helping hands cut into your wires stick a clothes pin in the helping hand and put your wire in the clothes pin. http://www.instructables.com/id/Arduino-Projects/ File Downloads Watch Pin Allocations R57.xls (12 KB) [NOTE: When saving, if you see .tmp as the file ext, rename it to 'Watch Pin Allocations R57.xls'] Step 8: Soldering the Trackball Place the trackball board and the trackball ribbon cable into the helping hands and solder the wires. After soldering put a little bit of hot glue over where the wires connect to the trackball board for improved strength. Note: To make a more compact design wires should head out to the left in the picture (opposite the direction seen below) laying flat against the back of the trackball board. At this point it is good to test that everything is wired correctly, you can do this by uploading the the Trackball Tester software found on the Arduino Watch google code page. Step 9: Soldering the Display Connector Now that the trackball is connected and tested you can move to the display connector. Now you do not want to directly solder to the OLED display since it uses a serial connection to communicate with the Arduino and you want to be able to upload new sketches to the Arduino after you have completed the build (only one serial connection at a time allowed). Use a Dremel (or other cutting tool) to cut off one of the pin slots on the Connector Housing 6 pin housing to make it a 5 pin housing. Also you can cut down the height of the housing so that it does not stick into your wrist as much. Take the 5 wire piece of the IDE cable from the "Parts Layout" step and crimp the wires into the female pins and insert in the housing. To increase the strength of the connector (especially if you cut the height down) add a hot glue to where the wires come out of the housing. Solder the other side of the wires to the Arduino as specified in the pin diagram from the "Soldering Connections Diagram" step. At this point you can use the Arduino Watch software to test the setup. Upload the software with the display disconnected, then disconnect the power and connect the screen. You can then power the watch with either the battery or the FTDI. If everything is working right you should be able to navigate the displays with the trackball and run the programs from the menu screen. The time screens will just display 0:00 in their various formats. http://www.instructables.com/id/Arduino-Projects/ Step 10: Soldering the Real-Time Clock This step covers how to solder the oscillating crystal to the real time clock and how to wire the real time clock to the Arduino. The data sheet for the DS1307 real-time clock can be found here . First trim the legs down on the real-time clock so that they don't poke other parts of the watch. Then solder the 32kHz crystal to X1 and X2 The SCL is soldered to A5 and SDA to A4 as shown in the soldering chart from the "Soldering Connections Diagram" step. Then solder the power to Vcc and ground to ground. At this point the Arduino Watch is fully functional for the basic functions, so power it up and test it out! If the clock doesn't run try power cycling and/or use the reset button on the Arduino. Sometimes it takes a couple cycles to the the real-time clock going. http://www.instructables.com/id/Arduino-Projects/ Step 11: Solder the Extensions Header External sensors and devices can be easily attached to the Arduino Watch. Soldering the 4 pin header to the D/I 10, 11, Vcc, and ground allows for these extensions to be connected and disconnected easily. http://www.instructables.com/id/Arduino-Projects/ Step 12: Steampunking the watch Copper tubing is your friend when you want to give your watch a steampunk look. Spacers for the screws were made with 1/4" OD copper tube cut to about 0.26" length, you may need to try a few times to get the right length (I had to), but you can use the extra pieces in the cover for the battery wires. To cover the battery wires thread the wire through the small pieces of copper tube until you have covered up to the connector. Magnifying lenses like the ones in the picture make a great addition to the look. You may need to remove one of the spacers to allow them to clip onto the screw or you can glue or solder the lenses to one of the spacers. http://www.instructables.com/id/Arduino-Projects/ Step 13: Extensions: Range Finding One of the attachments for the Arduino Watch is an ultrasonic range finder. This one is a Maxbotix LV-EZ2 (from SparkFun) and the watch is reading the pulse width modulated signal from the sensor. In future versions I may route the output to a vibrating motor or speaker to allow for someone with visual impairment to use the range finder as a cane. http://www.instructables.com/id/Arduino-Projects/ Step 14: Extensions: Temperature Sensing With the temperature sensing glove attachment the Arduino Watch can give temperature warnings to the user i.e. warning that the drink is too hot or that there is a fire behind a door. I'll be posting a separate short Instructable on how to make the glove but the sensors used are the one-wire Dallas 18B20 sensors. Step 15: Wear and Enjoy! Now that you have your Arduino Watch wear it and enjoy! Related Instructables Arduino Basics: PIR Sensors by frenzy (w/ Video) Basic Arduino Robot, Light Seeker! by Chowmix12 Ultrasonic Parking Sensor (Photos) by atatistcheff LED as lightsensor on the arduino (video) by kenyer Arduino Laser Tripwire by Adum24 Arduino 2-axis servo solar tracker by aplavins Biofeedback Device based on Arduino (Photos) by neptunier Smart Thermal + Arduino by gamesh_ http://www.instructables.com/id/Arduino-Projects/ Digital Window Sticker (Arduino Controlled) by als_liahona on November 6, 2009 Author:als_liahona Andrew L. Sandoval I've been writing software since I was in the 6th grade. In recent years I've developed for Blue Coat Systems, what I believe is the most advanced code injection and API hooking engine for Windows ever produced. I've done similar work at other companies for Unix code injection and hooking. I love to hack! Lately my hacking has been in the Windows networking stack (kernel mode). While currently at Blue Coat Systems, I am entertaining new employment opportunities where my Windows and Unix Internals skills can be utilized to produce great products! Electronics has been a favored hobby since I was very young. I am a tinkerer (thank you Massimo Banzi for finding the perfect word). I took an extended holiday from Electronics while I served a mission for my Church, and then while I had young children. Now I am hoping my children will enjoy the projects I build and will enjoy helping me with them. I have four talented and extremely good looking children, over whom I am extremely protective, along with one very wonderful wife! Being a Father and Husband are true adventures worthy of any committed tinkerer or hacker! I spend my days writing software professionally, and my evenings (usually well into the mornings) working on projects, and/or with my family. Intro: Digital Window Sticker (Arduino Controlled) A bumper-sticker sized L.E.D. matrix that displays images in sequence from an SD card, to produce an animated sign or "window sticker." Arduino controlled! Also includes Windows, Mac, and Linux code for converting .xbm image files into Digital Window Sticker files. Perfect for a shop or home window, or a fun desktop sign! Step 1: Parts List Digital Window Sticker Parts List 1x 1x Arduino Compatible Bare Bones Board KIT (BBBKit) Ask for the LM7805 regulator! USB BUB Board Optional, see below… 2416 Dot Matrix Display DE-DP016 Now available in Green: DE-DP017 SEE IMPORTANT NOTE BELOW Radio Shack Printed Circuit Board 276-170 See PCB note below Radio Shack 8x6x3 Project Enclosure 270-1809 74HC4050 Hex NON-Inverting Buffer * $15.00 $12.00 $11.64 (23.28) $2.99 $6.99 $0.09 $0.75 2x 1x 1x 1x 1x 16-pin DIP Socket http://www.instructables.com/id/Arduino-Projects/ 1x 1x 1x 1x 1x 1x 1x 8x 1x 1x LM3940 3.3v Regulator .47uF Tantalum Capacitor 33uF Tantalum Capacitor * 33uF Electrolytic Capacitor * 1x20 Female .100" header receptacle See Header Receptacle note below. 2x8 Shrouded Box Header Breakout Board for SD-MMC Card See SD-MMC Card note below. 4-40 3/4" machine screws with 2 nuts each Low Capacity SD Card (e.g. 512 MB) 9-volt power source Solder and 22-gauge wire of various colors $1.75 $0.32 $0.19 $0.11 $0.75 $0.49 $17.95 $3.98 The BBB Kit is an Arduino clone produced by moderndevice.com. At $15.00 for a complete Arduino kit, it is one of the least expensive options. I could have cut a few dollars off of the cost by using an alternate Arduino board and a separate supply list for each Arduino component, but the convenience of a single supplier for the Arduino portion of this project was worth the $3 to $5 I may have saved. You should be able to make this project with any Arduino. It can be prototyped on a breadboard as shown below, with a Boarduino, a Bare Bones Board, or other breadboard adaptable Arduino clones. You can also purchase the BBB fully assembled for an additional $10. The owner of moderndevice.com is very helpful and will work with you if you run into problems. Download the BBB assembly instructions and follow them carefully. MAKE SURE to request the LM7805 voltage regulator for the board, or purchase one separately and use it in place of the smaller regulator that he ships by default. The USB BUB Board plugs into the BBB (Arduino). It has the FTDI USB to serial converter needed to program your BBB Arduino. If you have already have an ICSP programmer, or an Arduino with a ZIF socket for programming the Atmega 328p, it is not necessary to purchase the USB BUB, though it is useful if debugging the microcontroller code, through the Arduino IDE's Serial Port Monitor. IMPORTANT NOTE regarding the 2416 Dot Matrix Displays. As you view my construction photos you will notice that my 2416 Dot Matrix Display boards don't match. One has white (when not powered) L.E.D.s, the other has transparent ones. The transparent set is slightly dimmer than the diffused set. When I contacted Sure Electronics about the problem they agreed to send a replacement board. It arrived just in time to complete this article, and the final photos and introduction video show the matching set. Unfortunately, the new board they sent me uses the dimmer, transparent L.E.D.s. Be sure to let Sure Electronics know that you need a matching set! You may want to order 3 boards just to be safe. Also, the green boards came out recently. I don't have experience with them, but had they been available when I made my purchase I would have used the green. Finally, remember that Sure Electronics is based in China. Plan on waiting a while for your product to arrive, and arrange for someone to sign for the package. The folks there are easy to work with. PCBs: If you wish to follow the step-by-step instructions I am providing you will need the Radio Shack printed circuit board, and you will need to trim the ends of it to fit properly in the enclosure. This also means you need a right-angle connector on the 2x8 Shrouded Box Header (that the ribbon cable from the displays plugs into). The right-angle connector is required so that the pins can be bent to bridge the breadboard gap on the Radio Shack PCB. If I were to start from scratch, I'd try using one of the following prototype PCBs, which would also allow you to wire-up a straight 2x8 shrouded box header: Prototype PCB with 3-holes per pad, pads spaced .1" 103RAW Wireless Prototype PCB with copper traces to each pad which then can be cut, preventing the need for (as many) wires Create a custom printed circuit board If there is enough interest, I will design a circuit board and have them manufactured.Enclosure: The project enclosure is an almost perfect fit. You'll see in the steps and photos that follow, that my strength is not in cutting plastic enclosures. You will hopefully do much better and provide feedback on better methods. Mine works great, but isn't great looking. As you will see, the enclosure was something of an after-thought for me. I had an entirely different enclosure planned, but this worked out much better. (More information in following steps.) Jameco*: Each of the items listed above with an asterisk(*) can be purchased from Jameco, but require a minimum order of 10, so if calculating the cost keep this in mind. (It is always good to have extra parts!) Header Receptacle: The BBB has 18-pins for the power-supply and Arduino pins to plug into a breadboard. Use the 20-pin header receptacle to plug the BBB into your printed circuit board as shown in the following instructions, with the following variations: I did not have a 20-pin header receptacle, but I did have 2 8-pin receptacles. This will work fine. It is a tight fight to get them to align properly, but it works. Just make sure to follow the pictures provided. You'll notice that 2 of the BBB pins are left unconnected. If you use the 20-pin header receptacle, 2-pins will remain unconnected. Mark your board so that when you plug-in the BBB you know where it goes. You could also forgo the breadboard pins on the BBB, and the socket on the secondary PCB, and simply run wires directly to the needed locations. This may provide some flexibility with enclosures. The 2x8 Shrouded header box is for plugging in the ribbon cable from the display matrices. As mentioned above under PCBs, the right-angle version is needed if you have a gap like that on the Radio Shack PCB. You could possible use the same board and cut copper traces to make a straight header box work properly. I purchased my header box from a local supplier (M.C. Howards Electronics in Austin, TX), but they only had a few and I've not seen any more in subsequent trips. The link provided above was the first one I found that had a matching part, but I don't have experience with the company. SD-MMC Card: Wow, this is an over-priced component if there ever was one. It works great! In fact, don't bother with any of the Arduino SD card Shields. They all seem to use a resistor network to drop the signal voltage to the 3.3 volts required by the SD card. This will not work with all SD cards. In fact, my card worked for only a few minutes this way, and when I put it back in the PC I had to format it, and then it never worked again with the Arduino until I used the 74HC4050 for the signal level conversion. I had other cards that didn't work at all without this as well. If you decide to use a different circuit board, and could plan out the fitting in the enclosure better, I would try to solder a much less expensive SD card socket to the board directly, instead of using the costly breakout board. Incidentally, NKC Electronics has the same breakout board listed for much less, but it was unavailable when I last checked. I don't remember if the breakout board includes header pins. You will need 11. A spare http://www.instructables.com/id/Arduino-Projects/ set can be ordered from Jameco: http://www.jameco.com/webapp/wcs/stores/servlet/ProductDisplay?langId=-1&storeId=10001&catalogId=10001&productId=53532, for $0.75. SD Card Addendum: I've commented at length in the comments (below) about alternatives to the relatively expensive SD Card breakout board. In short, the photos below show experiments I've done with spare parts on a breadboard, using the alternatives for the SD Card socket. Please read the comments and related Instructables for more information. As for the SD card itself, smaller is better! The Arduino code provided works only with a FAT16 filesystem, and only reads files from the root directory. That means you have a limit of 512 image files on the card, and the files are only 100 bytes. A very small card will work fine, and a card larger than 2GB probably will not work at all. There are FAT32 libraries for the ATMega328, but in the time I had, it was more work than it was worth to get it working with the Arduino. (More later.) Finally, use a variety of wires when wiring the PCB. It will make it easier to trace connections. As you will see, I used red, black, green, yellow, and white. I wish I had more colors. Regarding the 9-volt power supply: A 9 volt battery will work, but you will have strange problems when it begins to diminish. Once the battery voltage (when tested on a meter) drops below 7 volts your display may light up fine, but there will be insufficient current to power the Arduino and the behavior is somewhat unpredictable. A 9 volt wall-wart works great, and the LM7805 on the BBB should be able to handle a 12-volt input, like that from an auto-adapter. (Please use caution though if you put this in a moving vehicle! You alone are responsible for what happens if you distract other drivers! You might even want to consider wiring up an accelerometer and disable the displays when the unit is in motion. The circuit is yours as is the responsibility. I recommend it for a home Window or Desktop, or shop Window, not a moving vehicle! I love the idea of it as a bumper sticker, but not at the risk of anyone's life or health! In general however this should be much less distracting than most roadside digital signs, and many printed bumper stickers with hard to read text.) Tools I used the following tools to complete this project: A quality, variable wattage soldering iron Wire cutters Wire strippers A multimeter (helpful for testing) A large solder-less breadboard, for testing - you may not need this A Dremel, with cutting wheels and drill bits (for making openings in the enclosure case) A variable speed drill and various drill bits Software Arduino IDE 0017 My micro controller code (see Step 3) GIMP image editor, or another editor capable of producing .xbm files My xbmtodws code, to create image files for the SD card from .xbm files Image Notes 1. Sparkfun SD Card breakout board shown here with my early prototype. 2. Notice the two types of 2416 display boards. Ask for a matching set when ordering! Image Notes 1. This is an alternative SD Card socket. Use care in seating the card. The cable is an old-style IDE cable that has a PCB connector on the cable (they have 2 http://www.instructables.com/id/Arduino-Projects/ actually). I've cut off excess cable and attached a DIP IDC plug. This idea is documented in the following instructable: http://www.instructables.com/id/SDMMC-fits-in-floppy-edge-connector/ 2. These are another type of display Sure electronics sells. I've plugged them in to my other 2416 display, just for testing the SD card options. With small changes to the Arduino code these displays could be used in a similar project. (You'd also have to change xbm to dws code.) 3. My now spare 2416 display board. Sure Electronics sent a replacement that matches the non-diffused version, so now the brighter board is a spare. 4. Note that you could easily cut this connect off the cable, or buy a pre-made 16-pin cable that has a DIP IPC plug on one end. This would work better on the breadboard, and on the breadboard style PCB. (For pre-made cables see page 33 of the digikey interactive catalog http://onlinecatalog.digikey.com/WebProject.asp?BookCode=dik08flx#) 5. Prototyping the 3.3v regulator. The boarduino above has 3.3v output when powered by the USB. Image Notes 1. SD Card socket (sort of) following instructions in http://www.instructables.com/id/SDMMC-fits-in-floppy-edge-connector/, but adding the DIP IDC plug. This cable cost me $1 at a used computer/junk store. I picked up the 14-pin DIP plug at a surplus electronics store. 16-pins would have been best, but 14 is sufficient if the 2 right-most wires are removed. 2. 2 wires removed so that the 14-pin DIP IDC plug can be used. Pin 1 becomes CS, and pin 7 DO on the SD Card. Pins: 1 = CS 3 = DI 5 = GND 7 = 3.3v 9 = CLK 11 = GND 13 = DO Image Notes 1. This was the header-pin based SD card socket. It works but was hard to get the pins to make good contact with the card connector. Soldering to an adapter card might be a good option for a mini or micro SD card. Look at the Instructable (not mine) for this for better ideas/suggestions: http://www.instructables.com/id/Cheap-DIY-SD-card-breadboard-socket/ Step 2: Assemble the BBB Arduino and USB BUB... Follow the instructions provided by Modern Device to assemble the BBB Arduino. Instructions: http://moderndevice.com/Docs/BBB_RevE_Instructions03.pdf When assembling the BBB, remember to use an LM7805 voltage regulator in place of the L4931CZ50LDO. The smaller voltage regulator might work just fine, but we are pulling quite a bit of current to power up to 768 L.E.D.s. The optional inductor is not needed for this project. You can follow the instructions on creating a solder bridge if you'd prefer to save the inductor, or if you'd rather not deal with the surface mount component. Nevertheless, it is not difficult to solder and I used it on my board. If you also purchased the USB-BUB follow the assembly instructions to complete it. Instructions: http://moderndevice.com/Docs/BUB_instructions.02.pdf When assembling the USB-BUB, I selected Configuration 2, though in practice I only ever use Configuration 1 (no jumper). http://www.instructables.com/id/Arduino-Projects/ Image Notes 1. Fully assembled BBB Arduino and USB-BUB (connected to the BBB). Step 3: Program your Arduino... BBB Jumpers: Set the USB|EXT jumper on your BBB to the USB side so that we can program it using the USB-BUB without supplying an external power-supply. (Or, supply a 9 volt power supply on the D.C. input jack and keep the jumper on the EXT side.) When this step is completed you want to move the jumper back to the EXT side! The other jumper with +5v|EXT|+V should be on the +5v side always. FAT16 Library Installation: Next, download the FAT16 library and the DigitalWindowSticker.pde file below. The FAT16 library needs to be unzipped/untared into the hardware/libraries directory where your Arduino IDE is located. On my Windows system, I keep the current version of the Arduino IDE in c:\temp\arduino-0017\. Once the FAT16 library is in place there should be a set of files in [c:\temp\arduino-0017\\hardware\libraries\Fat16\. The FAT16 library is also available here: http://code.google.com/p/fat16lib/. It is written by Bill Grieman. A copy of this library that is known to work with the Digital Window Sticker is available in the files below (Fat16.tar.gz or Fat16.zip). Arduino IDE: Start the Arduino IDE. Open the DigitalWindowSticker.pde file using the IDE. There are two ways you can do this: 1) Download and open the file in a text editor, copy the contents to the clipboard, paste the contents into a new sketch in the Arduino IDE, and then save the sketch as DigitalWindowSticker. 2) Download the DigitalWindowSticker.zip or DigitalWindowSticker.tar.gz file and extract the files to the directory containing your sketches. Then open the DigitalWindowSticker sketch in the Arduino IDE. Next, compile the sketch. If there are any errors, make sure you are using version 0017 of the Arduino IDE, with the Atmega328 board selected (Arduino Duemilanove or Nano w/Atmega328). Also make sure you've properly unpacked the FAT16 library, into the hardware/libraries directory, where other Arduino libraries reside. Program the Arduino: Plug-in the USB-BUB, and wait for for the drivers to be installed, or coach your system into loading the drivers. In the Arduino IDE, a new COM port should show up under Tools|Serial Port. Select the new port for the USB-BUB. Plug the USB-BUB into the BBB as shown in the photo in Step 2, and Upload the compiled code from the Arduino IDE. http://www.instructables.com/id/Arduino-Projects/ Prepare for External Power Source: Now that the Arduino is programmed, move the BBB jumper back to the EXT side (not the USB side) so that it will be powered by the external 9 volt source. Image Notes 1. Always keep this jumper in this position! Image Notes 1. This Jumper should be moved to the right (towards the connector to the USBBUB) for programming unless an external power source is connected to the DCinput jack. Be sure to move the jumper back to the position shown after programming! Image Notes 1. Open DigitalWindowSticker.pde in the Arduino IDE (from File|Open) Image Notes 1. Compile (Verify) the sketch http://www.instructables.com/id/Arduino-Projects/ Image Notes 1. Sketch is compiling... Image Notes 1. Sketch has compiled successfully. The only issue may be if you have not properly installed the FAT16 library according to instructions. Image Notes 1. Select the board with the ATmega328 Image Notes 1. Select the appropriate COM port. Typically FTDI based ports are numbered higher than 2. In my case, my Deumilanove shows up as COM9, my Boardunio boards as COM12, and my USB-BUB+BBB as COM13. http://www.instructables.com/id/Arduino-Projects/ Image Notes 1. Re-compile and upload the executable code to the BBB. File Downloads Fat16.tar.gz (28 KB) [NOTE: When saving, if you see .tmp as the file ext, rename it to 'Fat16.tar.gz'] Fat16.zip (44 KB) [NOTE: When saving, if you see .tmp as the file ext, rename it to 'Fat16.zip'] DigitalWindowSticker.tar.gz (3 KB) [NOTE: When saving, if you see .tmp as the file ext, rename it to 'DigitalWindowSticker.tar.gz'] DigitalWindowSticker.zip (5 KB) [NOTE: When saving, if you see .tmp as the file ext, rename it to 'DigitalWindowSticker.zip'] Step 4: Assemble the SD-MMC Card Breakout Board Simply solder a set of header pins to the SD-MMC card breakout board. Alternatives: Uses wires to connect the SD-MMC card breakout board directly to the printed circuit board in the next step. Doing so will give you flexibility with where the SD card socket is located in your enclosure. Solder a bare SD card socket to your selected printed circuit board as part of the next step. Notes: Only the following pins are used: CS (for SPI access to the SD Card) DI (data input for SPI access to the SD Card) VCC is the 3.3v power source for the card GND is the common ground DO is the data output, which can be connected directly to pin 12 of the Arduino WP is used to detect a missing card. This will be connected to pin 2 of the Arduino COM needs to be connected to GND http://www.instructables.com/id/Arduino-Projects/ Image Notes 1. This image is displayed by the Digital Window Sticker if the SD Card is not detected. The WP pin on the SD Card breakout board is held low when a card is present. We connect this to Arduino pin 2 in subsequent steps. Image Notes 1. Solder a set of header-pins (11) to the break-out board. Note that only the following pins are required: CS, DI, VCC, CLK, GND & COM, DO, and for a better experience WP. Step 5: Build the circuit Use the schematic below as a reference as you build the circuit. An Eagle schematic file is attached as well as a the image file Schematic.png. Use the photos below for hints. Remember that if you find it more convenient, you can use any of the gates on the 74HC4050. Just reference the datasheet. About the Circuit: The 74HC4050 is used to convert 5-volt signals sent from the Arduino to the 3.3 volts required by the SD card. There are 6 buffers on the 74HC4050, only three are used by this circuit. All inputs come from the Arduino, and the outputs go to the SD card. The forth SPI connection runs directly from DO on the SD card to Arduino digital pin 12. (The Arduino can read the lower voltage signals just fine.) Some Arduino projects that use SD cards use a resistor network to drop the 5-volt signal to 3.3 volts. For me this didn't work well. I found one SD card that worked and several that did not. As soon as I hooked up the 74HC4050 all of my SD cards worked. The SD card has an SPI mode. We connect it to the Arduino SPI pins 10, 11, 12, and 13 through the 74HC4050. The LM3940IT is a "1A Low Dropout Regulator for 5v to 3.3v Conversion". It takes the 5-volt input from the BBB Arduino board and produces a steady 3.3v that powers both the 74HC4050 and the SD card. Before starting I recommend marking the input pin on the LM3940 to distinguish it from the output pin while building the circuit. The ground pin is in the middle. The other "component" on the board is the shrouded box header used to connect the LED Display Matrices to the Arduino. The 5-volt power from the BBB Arduino needs to be connected to the displays and to the input on the LM3940. As you will see below, we use the power rail on the circuit board to carry ground on one side, and 3.3 volts on the other. We will directly connect the BBB's 5 volt pin to the LM3940 and the shrouded box header for the LED displays. Prepration: Start by laying out the components on the circuit board. If you intend to use the enclosure I've used, in the way I've used it, try to follow the layout in the photos below. It doesn't have to be exact as long as all of the right connections are made, and nothing is connected that shouldn't be. Be careful in planning where the DC jack and the header pins for the USB-BUB on the BBB, as well as the SD card socket will be physically located. This will be important when you place it in the case. If you use the same holes in the PCB that I used, you can get the same match, but beware that it took a fair amount of grinding and cutting to get it to work with the plastic enclosure. Again, it works great, but clearly demonstrates that I am new to the Dremel. After placing the parts on the printed circuit board, use a thin point Sharpie to mark the pin numbers/labels for the BBB connection and the pin numbers for the shrouded box header. If you don't know where pin 1 is on the box header, attach a ribbon cable into the box header and a solid wire into the other end of the ribbon cable where the red wire lines up and use your meter to test for continuity. You may also want to plug the ribbon cable into the LED display and check continuity between what you think is pin 1 on the box header, and what you think is pin 2, pin 15, and pin 16. Then mark it on the PCB. On top of the LED display are the pins from the shrouded box header soldered to it, one on each side. This makes it very easy to match up your box header pins to those on the display. One important note: The shrouded box header I used has right angle connectors. The printed circuit board doesn't have a way of allowing connections to each pin, because on each side of the board the pads are connected like they would be on a breadboard. To solve I bent the pins of the right-angle box header so that one row pins would fit on each side of the breadboard gap on the board. A photo below shows the bent pins. The header sits on the board at angle, but it works great. Be careful not to use too much force inserting it into the PCB -- don't use insertion force to get a better fit, or you run the risk of snapping the PCB in half (voice of experience). Solder the Components: Once you have things laid out on the board and have marked pin numbers it is time to solder each of the main components. I recommend the following order: http://www.instructables.com/id/Arduino-Projects/ The 16-pin DIP socket for the 74HC4050 The LM3940IT The capacitors need for the 3.3 volt regulator (see next section below) The SD card breakout board The shrouded box header The header pin receptacles for connecting the BBB 3.3 Volt Regulator Capacitors: I elected to keep the capacitors for the 3.3 volt regulator as near as possible to the LM3940. I use two 33µF capacitors between the ground pin and the output pin. One is tantalum capacitor, the other is electrolytic. To save cost, the tantalum capacitor does not require a high voltage rating. 6-volts is just under twice what should ever come out of the regulator and should suffice. REMEMBER that both the electrolytic and the tantalum capacitors are polarized! The long pin needs go into a pad connected to the output of the LM3940, and the short pin into a pad connected to the ground (middle pin) of the LM3940. The leads are small enough that you can fit both in a single hole for each pin. A .47µF tantalum capacitor goes between the ground pin (middle pin) on the LM3940 and its input pin. This capacitor is also polarized. Be sure the short pin goes into a pad connected to ground and the long pin into a pad connected to the +5v input pin. The voltage regulator part of the circuit is now ready to be tied to power rails. Placing the Wires: Now comes the tedious part: running all of the wires. The more colors of wire you have the easier this will be. Try to keep the wires as direct and short as possible, and flat against the board to avoid clutter and enhance visual traceability. Power rails: Start by wiring all of the power connections. I selected the rail behind the LM3940 for the 3.3-volt power line, and the rail on the other side of the board as ground. Run one wire from the output pin of the LM3940 to the rail behind it. Run another wire from the ground pin (middle pin) to the rail on the opposite side of the board. Next connect the +5v input of the LM3940 to a pad connected to pin 12, 14, or 16 of the box header, and from another pad connected to that line of the box header, run a wire to the +5v line that will come from the BBB Arduino. Pin 16 on the box header is used for +5v in the photos below. This will complete the voltage regulator portion of the circuit. Now connect a black wire from pin 11, 13, or 15 of the box header to the ground rail. Also connect the ground pin from the BBB to the ground rail. Pin 15 of the box header is used for GND in the photos below. This will complete the power connections for the LED displays and the sources from the BBB circuit. Connect pin 15 of the box header to the COM pin on the SD-MMC card breakout board, and then connect the COM pin of the breakout board to pin 8 on the 16-pin DIP socket. Also connect the GND pin of the SD-MMC card breakout board to the COM pin of the breakout board. All connections to ground should now be complete. To complete the power rails, connect pin 1 of the 16-pin DIP for the 74HC4050 to the 3.3 volt power rail. Also connect the Vcc pin of the SD-MMC breakout board to the 3.3 volt power rail. Wire-up the LED Displays to the Arduino: Connect the following box header pins to Arduino (BBB) pins: Pin 2 of the box header (CS2) to Digital Pin 5 on the Arduino BBB receptacle Pin 1 of the box header (CS1) to Digital Pin 4 on the Arduino BBB receptacle Pin 5 of the box header (WR) to Digital Pin 6 on the Arduino BBB receptacle Pin 7 of the box header (DATA) to Digital Pin 7 on the Arduino BBB receptacle The photos below show each connection. Wire-up the SD-MMC card to the 74HC4050 and the Arduino: First the easy one... Connect the DO pin of the SD-MMC breakout board to Digital Pin 12 on the Arduino. Next connect Pin 7 of the 16-pin DIP for the 74HC4050 (3A) to Digital Pin 13 on the Arduino BBB receptacle. Then connect pin 6 of the 74HC4050 (3Y) to the CLK pin on the SD-MMC card. Now connect Pin 9 of the 16-pin DIP for the 74HC4050 (4A) to Digital Pin 11 on the Arduino BBB receptacle. Then connect pin 10 of the 74HC4050 (4Y) to the DI pin on the SD-MMC card. Finally, connect Pin 11 of the 16-pin DIP for the 74HC4050 (5A) to Digital Pin 10 on the Arduino BBB receptacle. Then connect pin 12 of the 74HC4050 (5Y) to the CS pin on the SD-MMC card. Don't forget to insert the 74HC4050 into the DIP socket as shown in the photo below. This completes the wiring needed to read files from the SD Card. Hookup the Card Detect: In order to be able to tell if a card is present in the SD socket, connect the CD pin on the SD-MMC breakout board to Arduino Digital Pin 2. Connect the BBB to the header receptacle: To finish the circuit connect the BBB to the header receptacle. Be sure to align the pins so that they match the labels on our circuit board! After the enclosure is properly prepared we will connect the ribbon cable from the LED displays, completing the circuit! http://www.instructables.com/id/Arduino-Projects/ Image Notes 1. Right-angle connector pins on the shrouded box header bent to span the gap on the printed circuit board. Image Not 1. Shroude Image Notes 1. Label the pins on the box header! Note that one side has three pins for ground and the other has three pins for +5 volts. On the +5v side, only one other pin CS2 is connected to the Arduino. On the GND side three pins will be connected to the Arduino digital pins. 2. Label the pins for the BBB Arduino connection! Note that I elected to go from pin 13 on the left to the GND line on the right. If you have a 20-pin receptacle (instead of the 2 8-pin receptacles I used) you should label all of the pins! 3. The LM3940IT with the INPUT pin marked in green on the right, and 5v / 3.3 marked over the input and output pins respectively. 4. Socket for the 74HC4050. Pin 8 (GND) is shown, but pin 1 (3.3v Vcc) is not. Image Notes 1. A close-up of the .47uF tantalum capacitor. The long pin connects to the input pin on the LM3940. The short pin connects to the ground pin (middle pin) of the LM3940. http://www.instructables.com/id/Arduino-Projects/ Image Notes 1. The 3.3v regulator circuit showing the 33uF electrolytic (blue) capacitor and the 33uF tantalum capacitor connected between the output pin (right-most) of the LM3940 (long pins on capacitors) and the ground (short pin on capacitors, middle pin of LM3940), as well as the .47uF tantalum capacitor connected to the input pin (left-most) on the LM3940, with it's short pin connected to the ground pin (middle pin) on the LM3940. The black wire connects the middle/ground pin of the LM3940 to the power rail on the far side of the board. The red wire is connected to the input pin on the LM3940 and to the +5v pin on the box header (and thereby the +5v on the BBB). Image Notes 1. +5v between the box header and the input pin of the LM3940. 2. 3.3v output from the output pin of the LM3940 to the 3.3v rail on the PCB. 3. 3.3v rail 4. Ground rail 5. Ground wire from the ground pin (middle) of the LM3940 to the ground rail. 6. Ground wire from the BBB Arduino to the ground rail. 7. +5v wire from the +5v BBB pin to pin 12, 14, or 16 of the box header. To power the circuit when the ribbon cable is not connected to the displays, make sure the wire is connected to the same pad row where the input wire to the LM3940 is connected. 8. Next connect a ground wire from the ground rail to pin 11, 13, or 15 of the box header. Image Notes 1. Connect the ground rail to pin 13 of the box header. 2. Connect the COM line on the SD-MMC card breakout board to pin 13 of the box header (GND). Image Notes 1. Connect pin 8 of the 74HC4050 to GND on the SD-MMC breakout board. 2. Connect the GND pin to the COM pin on the breakout board. This should all lead back to the GND rail. http://www.instructables.com/id/Arduino-Projects/ Image Notes 1. Connect pin 1 of the 74HC4050 to the 3.3 volt power rail. 2. Connect the VCC pin of the SD-MMC card breakout board to the 3.3 volt power rail. Image Notes 1. Connect pin 2 (CS2) from the shrouded box header to Arduino Pin 5. Image Notes 1. Connect pin 7 (DATA) of the box header to Digital Pin 7 on the Arduino. 2. Connect pin 5 (WR) of the box header Digital Pin 6 on the Arduino. 3. Connect pin 2 (CS1) on the box header to Digital Pin 4 on the Arduino. 4. Pin 1 (CS2) of the box header is connected to Digital Pin 5 on the Arduino. Image Notes 1. Connect the DO pin on the SD card to Digital Pin 12 on the Arduino. http://www.instructables.com/id/Arduino-Projects/ Image Notes 1. Connect pin 7 (74HC4050 3A) to Digital Pin 13 on the Arduino. Image Notes 1. Connect pin 6 (74HC4050 3Y) to the CLK pin on the SD card. Image Notes 1. Connect pin 9 of the 74HC4050 to Digital Pin 11 of the Arduino. 2. Connect pin 10 of the 74HC4050 to the DI pin on the SD-MMC card. 3. Connect pin 12 of the 74HC4050 to the CS pin on the SD-MMC card. Image Notes 1. Connect pin 11 of the 74HC4050 to Arduino Digital Pin 10. 2. Connect pin 12 of the 74HC4050 to the CS pin on the SD-MMC card. 3. Insert the 74HC4050 into the DIP socket. Image Notes 1. Completed all connections except for the Card Detect pin on the SD-MMC card to Digital Pin 2 on the Arduino. Image Notes 1. Connect the CD pin on the SD-MMC card to Digital Pin 2 on the Arduino. 2. This is the completed board. http://www.instructables.com/id/Arduino-Projects/ Image Notes 1. Attach the BBB to the header receptacle. Make certain the pins align to the proper labels on our printed circuit board! File Downloads DigitalWindowSticker.sch (154 KB) [NOTE: When saving, if you see .tmp as the file ext, rename it to 'DigitalWindowSticker.sch'] Step 6: The Enclosure As mentioned previously, I am not overly talented with a Dremel. I urge you to post suggestions on better ways of modifying the enclosure to hold the circuit. Nevertheless, this is what I did: Hack the Board: Start by scoring each end of the Radio Shack Printed Circuit Board (well away from any copper traces), and use a pair of pliers to break away the unneeded side. When you are done, the board should fit lengthwise against the 6-inch side of the enclosure. Preping the LED Matrix Displays: Each of the Display boards has a DIP-switch that controls whether or not the board responds to CS1, CS2, CS3, or CS4. Make sure the board on the left side of the display (when it is facing outwards) has CS1 turned on, and all other switches off. Make sure the right-board has CS2 turned on, with all other switches turned off. Hack the Enclosure - Lid: The lid of the enclosure is used to hold the LED displays together. To do this, you need to cut a whole in the lid exactly the length and width of the two displays together. I cut up a cardboard box exactly the size of the two LED displays, not counting the circuit board they are mounted to, or the other components on the board -- just the size of the LED cubes. I then placed this on the inside of the lid and taped it in place with masking tape. I used a box knife to repeatedly score the lid along the sides of the cardboard until the cutout was complete. I little bit of follow-up shaving with the box knife provided a nice firm fit for the LED displays, with the rest of the board behind the plastic. Next I put the LED displays in place and used a drill with a tiny bit (3/64) to drill holes through each of the screw holes on the display boards. (4 per board, 8 total.) I placed a 4-40 3/4" machine screw in each hole from the top of the lid. On the inside I secured each screw with a 4-40 nut. On the top screws I placed a second nut to provide a buffer equivalent in height to the transistors on the boards. With this in place, each display was back into the lid, with the screws going through the screw holes, and another nut added to hold the boards in place. Hack the Enclosure - Inside: Now use some ingenious method (I used masking tape to mark approximate areas) to make slots on the side of the enclosure where the following items can be accessed: The SD card socket The DC power jack on the BBB The USB-BUB pins for connecting the serial monitor to the BBB (for debugging, reprogramming, and simply because they need to protrude if the SD card is going to be accessible, due to my lack of engineering that part in advance. ;) To do this, I used a Dremel with a cutting wheel. The resulting slots are much larger than necessary, and not super straight. I polished it a bit. I also used a grinding wheel to remove some of the plastic inside the box so that the DC jack on the BBB board is flush against the outside edge of the enclosure. I found that my DC input jack wouldn't go in far enough otherwise. NOTE: The cutting wheel on the Dremel cuts, but it also melts the plastic. I then placed the boards inside the bottom of the enclosure, aligned the DC jack and the SD card socket just where I thought they'd be suffciently accessible, and then used a hot glue gun to glue the board to the bottom of the enclosure. I also added some hot glue around the DC jack to keep pressure off of the header receptacle when inserting the jack. I placed a small amount of hot glue on the bottom of the PCB before placing it in the enclosure and quickly set it in place. I then lined the entire edge of the PCB with hot glue, again, to keep it firmly in place when plugging in the DC jack or SD cards. Attach the Cable and Lid: We can now finally attach the ribbon cables that came with the display board. The short cable should connect the two display boards to each other. The longer cable can go into the other header box on either board. (The bus is shared!) The other end of the longer cable should be plugged into the header box on our printed circuit board. Make sure you orient the cable correctly so the notch aligns. Attach the lid to the enclosure and tighten the 4 corner screws. The Digital Window Sticker is now complete. If you remove the SD card and power the unit with a 9-volt http://www.instructables.com/id/Arduino-Projects/ DC supply through the BBB's DC jack, you should see a message on the display telling you to insert an SD card. If you don't see the message it is time to pull out your multimeter and verify there are no shorts and that each connection is wired correctly according to the schematic. Congratulations on your new Digital Window Sticker. In the next step you'll see how to place images on the SD card. Image Notes 1. Remove the excess from the sides of the board. (Both Sides) Image Notes 1. Set the switch properly. The left board (when viewed from the front) should have CS1 On, and CS2-4 Off. The right board should have CS1 Off, CS2 On, and CS3-4 Off. Image Notes 1. Create a cardboard cutout the size of the LED matrix. (Not the size of the board, just the LED matrix blocks.) http://www.instructables.com/id/Arduino-Projects/ Image Notes 1. Tape the cardboard guide to the inside of the lid. Use a box knife to score the plastic on the top and bottom of the cutout guide. Image Notes 1. Once the top and bottom are cut through, remove the cardboard guide and use the box knife to cut the side through. Image Notes 1. The cutout is complete. Some shaving may be necessary to make the displays fit. Image Notes 1. Use a small 3/64 drill bit to drill through the screw holes, creating pilot holes. Follow this up with a drill bit the same size as the screw holes, after removing the displays, using the pilot holes for positioning. Image Notes 1. Larger holes drilled. Image Notes 1. In the top row of screw holes, insert a 4-40 machine screw, and place 2 4-40 http://www.instructables.com/id/Arduino-Projects/ nuts onto each screw on the inside of the lid. Image Notes 1. For the bottom screw holes, insert a 4-40 machine screw and secure it on the inside with a single 4-40 nut. Image Notes 1. Insert the LED displays and attach a nut on each machine screw. Image Notes 1. Mark where slots need to be cut for the SD card socket, the USB-BUB pins, and the DC Jack. Image Notes 1. Cut the slots for the DC Jack, USB-BUB pins, and the SD Card slot. Hopefully do a better job than I did. http://www.instructables.com/id/Arduino-Projects/ Image Notes 1. SD card slot. Image Notes 1. Place the board inside and check the clearance of components through the slots. Once satisfied apply a dab of hot glue to the corners of the PCB and stick it in place. Image Notes 1. Apply a thick line of hot glue to hold the PCB in place and prevent sliding when inserting power jacks or SD cards. 2. Attach the ribbon cable to the PCB and to the display bus. Image Notes 1. Attach the lid to the enclosure and tighten the screws. (Not too tight, or the plastic will crack.) Image Notes 1. The working unit, before I received a matching display from Sure Electronics. The video and final photos have matching displays. 2. USB-BUB connected. Not needed normally, and the pins can be covered if there is a risk of a short. 3. Powered by a 9 volt battery. WARNING: I was thrown off for several hours thinking something was wrong with my circuit. It turned out to be a low battery that caused strange results (the unit would cycle through two dozen files and then freeze up.) Be careful about the power supply. http://www.instructables.com/id/Arduino-Projects/ Step 7: Creating and Displaying Images This circuit reads files from the SD card and displays them on the LED display. In order to accomplish this the following must be understood: Your SD card must be formatted with a FAT16 file system. This is the default for most older cards, and cards less than 2 GB. FAT16 limits the number of files in the root directory to 512. The micro controller is only programmed to read files from the root directory. Files are read from 0.dws to 511.dws, sequentially. When the micro controller reaches a file it can't read (say 10.dws after reading 9.dws) it will restart at 0.dws. .dws files are bitmap files with the bits ordered in rows. The first eight bits fills the first row of LEDs on the left-hand side of the display. 16-bits are required for one full row, and there are 48 rows. (24-per display board.) To create a .dws file, start with an XBM (x-bitmap) file and use my command-line program xbmtodws to convert the file. The best cross-platform tool I've found for creating .xbm files in GIMP. .xbm files are bitmap files that run from left to right. Each byte represents eight black or white pixels. The images below show how to create a Digital Window Sticker template in GIMP, and how to save files as .xbm files. Conversion: After creating the .xbm files you want to display, run them through xbmtodws. Full source code is attached for xbmtodws. It compiles on Windows with Visual Studio 2005, on Mac OS X with g++, and on Linux with g++. There is a build-linux.sh for examples of how to compile on linux, and a build-macos.sh that shows how to build on Mac. xbmtodws requires Boost 1.40.0 header files. It uses Boost Spirit to parse the .xbm files, and Boost dynamic_bitset to simplify changing the bits from left-to-right, to topto-bottom. Pre-compiled versions of xbmtodws are included in the attached files (xbmtodws-1.0.zip and xbmtodws-1.0.tar.gz). The Linux version is in xbmtodws\xbmtodws\linux. The Mac version is in xbmtodws\xbmtodws\macosx. The Windows (32-bit) version is in xbmtodws\release. xbmtodws creates a 100-byte .dws file from each 16-by-48 pixel .xbm file. 96-bytes are pixel data, and 4 bytes contain time to display the image in milliseconds. Converting a file called fred.xbm: Windows: xbmtodws.exe fred.xbm Linux/Mac: xbmtodws fred.xbm By default the image will be displayed for 1 second (1000 milliseconds) . To change the display time use the -delay nnnMilliseconds command-line argument. For example, to show the image for 10 seconds use: xbmtodws.exe fred.xbm -delay 10000 xbmtodws will create a new file called fred.dws. To display this file, copy it to the root directory of the SD card and give it a numeric name with the .dws suffix (e.g. 0.dws). Remember that if you leave a gap in the numbers, say you have files 0.dws, 1.dws, and 3.dws, only files 0 and 1 will display. An error will be detected reading 2.dws and the microcontroller will start again at 0.dws. Another option is to invert the image. Use the -inverse flag to invert the image when the .dws file is created. Animations: It is possible to create animations like those shows in the video on the Intro screen, by creating a sequence of images with small movements between frames and a short delay. You now have complete instructions to create your own Digital Window Sticker. Please post feedback showing how you use your Digital Window Sticker! Image Notes 1. Select File|New to create a new image. Image Notes http://www.instructables.com/id/Arduino-Projects/ 1. Digital Window Sticker files are 48 by 16 pixels! 2. Select grayscale, and then use on black and white. Image Notes 1. Use the Save as Template option to create a template for Digital Window Stickers. Image Notes 1. Enter Digital Window Sticker and hit Ok. Image Notes 1. Zoom the image at least to 8:1 to simplify editing. Image Notes 1. Now you can select the DigitalWindowSticker template to save some typing. Image Notes 1. There is a free font available on the Internet called BPdots that works very well at 10 points in Digital Window Stickers. http://www.instructables.com/id/Arduino-Projects/ Image Notes 1. Disable Hinting and Antialiasing when using fonts! Image Notes 1. Use File|Save As... to save the file an .xbm file. Image Notes 1. Select the X BitMap image file type http://www.instructables.com/id/Arduino-Projects/ Image Notes 1. Select Merge Visible Layers and then Export. Image Notes 1. Take the defaults in this window and hit save. The image can now be converted to a .dws file and placed in sequence on the SD card. Image Notes 1. Command-line to convert test.xbm to test.dws, inverted, with a 650ms. delay. 2. Ignore this unless you want to use for debugging your micro controller code. 3. The new file test.dws needs to be give an numeric name like 0.dws, or 1.dws and placed in the root directory on the SD card. File Downloads xbmtodws-1.0.tar.gz (9 MB) [NOTE: When saving, if you see .tmp as the file ext, rename it to 'xbmtodws-1.0.tar.gz'] xbmtodws-1.0.zip (9 MB) [NOTE: When saving, if you see .tmp as the file ext, rename it to 'xbmtodws-1.0.zip'] http://www.instructables.com/id/Arduino-Projects/ Related Instructables Digital Name Plate (video) by kunal_djscoe Thank You Instructables! by bkb2 GUI Controlled LED Matrix by Technochicken 9*9 LED matrix with Arduino by zmolroc The BlokClok Concept Arduino driven RGB Abstract Clock (video) by earthshine Knight Rider Rides Again by alien200049655 Extremely Easy LED MATRIX!!!! by axeman911 Pong with 8x8 Led Matrix on Arduino (video) by bsoares http://www.instructables.com/id/Arduino-Projects/ Interface a rotary phone dial to an Arduino by guidomax on July 18, 2009 Intro: Interface a rotary phone dial to an Arduino An old rotary phone can be used for a number of purposes in your Arduino projects - use it as a novel input device, or use the Arduino to interface a rotary phone to your computer. This is a very basic guide describing how to interface the dial to an Arduino, and get the number dialed passed into a computer over the Arduino's serial link. Step 1: Remove the dial from the phone First step is to remove the dial unit from the phone. I'm using a GPO phone of some sort from the 1970s. On this phone, the dial popped straight out - I just needed to give it a tug. If it doesn't, you may have to open up the phone and work out how to get it off. There were five cables connected to the back of the dial unit. On my phone, these were regular spade connections, so I loosened the screws and pulled them out. If you want to re-assemble your phone, remember to record which color wire goes to which connection. Image Notes 1. wires - remember which goes where! 2. the rear of the dial http://www.instructables.com/id/Arduino-Projects/ Image Notes 1. 1. This rotates, and the notches engage in... 2. 2. .... this follower, which bounces in the notches and cause... 3. 3. ... this arm to go backwards and forwards, breaking and making the circuit with.... 4. 4. ... this arm. 5. these terminals connect to the two arms above. Step 2: Identify the switch Once the dial is out, it should be relatively easy to see how the dial converts rotary movement into pulses. Try spinning the dial by hand and watching the movement on the back. You should see a switch making and breaking a circuit rapidly - so if you dial '9', the switch should engage nine times. For those of you who may never have used a rotary dial before - remember that the dialing only happens when you let go the number and let it spool back . I've documented how it works for my phone in the Notes of the photo below. There's also a blurry video of the mechanism working. Image Notes 1. 1. This rotates, and the notches engage in... 2. 2. .... this follower, which bounces in the notches and cause... 3. 3. ... this arm to go backwards and forwards, breaking and making the circuit with.... 4. 4. ... this arm. 5. these terminals connect to the two arms above. http://www.instructables.com/id/Arduino-Projects/ Step 3: Make the circuit Once you have found the switch that is being made and broken, you should be able to identify the connections by following the wires back to the connection terminals. In my case, the two sides of the switch are connected to the two leftmost terminals. Hook up these terminals to some jumper wires, and get prototyping! The switch in my dial is always-on, and is broken for each pulse when dialling, so I used the very simple circuit below. Pin 2 will go HIGH for each pulse as the dial rotates. When the phone isn't being dialed, the switch in the dial unit is closed (a so-called NORMALLY CLOSED switch, for obvious reasons) so the circuit connects pin 2 to ground (which to the Arduino is LOW). This is because there is much less resistance through the 470 ohm resistor than the 10K resistor. When the phone is being dialed, the switch opens and closes rapidly (for a 9, it will open and close again nine times, remember). When the switch is open, pin 2 is not connected to ground - instead it is connected to the 5V supply through a resistance of 10470 ohms. This is interpreted by the Arduino as a HIGH. If your dial has a NORMALLY OPEN switch, then swapping the positions of the 10K resistor and the dial should do the trick. Image Notes 1. 1. This rotates, and the notches engage in... 2. 2. .... this follower, which bounces in the notches and cause... 3. 3. ... this arm to go backwards and forwards, breaking and making the circuit with.... 4. 4. ... this arm. 5. these terminals connect to the two arms above. Step 4: Develop the code Now we need some code for the Arduino to count the pulses and send the total number per number dialed back through the serial port. My code's below. As we're dealing with mechanicals here, yours may differ. Try playing about with the debounce constant and the 'how long do we wait before assuming dial has finished rotating' constant. I've tried to comment it as neatly as I can. Hopefully it's pretty simple. int needToPrint = 0; int count; int in = 2; int lastState = LOW; int trueState = LOW; long lastStateChangeTime = 0; int cleared = 0; // constants int dialHasFinishedRotatingAfterMs = 100; int debounceDelay = 10; void setup() { Serial.begin(9600); pinMode(in, INPUT); } void loop() { int reading = digitalRead(in); if ((millis() - lastStateChangeTime) > dialHasFinishedRotatingAfterMs) { // the dial isn't being dialed, or has just finished being dialed. if (needToPrint) { // if it's only just finished being dialed, we need to send the number down the serial // line and reset the count. We mod the count by 10 because '0' will send 10 pulses. Serial.print(count % 10, DEC); needToPrint = 0; count = 0; http://www.instructables.com/id/Arduino-Projects/ cleared = 0; } } if (reading != lastState) { lastStateChangeTime = millis(); } if ((millis() - lastStateChangeTime) > debounceDelay) { // debounce - this happens once it's stablized if (reading != trueState) { // this means that the switch has either just gone from closed->open or vice versa. trueState = reading; if (trueState == HIGH) { // increment the count of pulses if it's gone high. count++; needToPrint = 1; // we'll need to print this number (once the dial has finished rotating) } } } lastState = reading; } Step 5: Check it works! Check it works by opening up a serial window (I use screen on a unix machine, you may want to use Hyperterm or similar on Windows), and try dialing some numbers. Make sure that the serial program is set to read from the USB->serial adaptor in your Arduino (check the Tools->Serial Port menu in the Arduino software if you forget what that is), and a baud rate of 9600 bps. You should see the correct number pop up as it's dialed. Step 6: Hook it into something useful! I came up with a Quartz Composer file on my Mac to take the input and render it nicely to the screen. Once it's in the machine as serial data, you can do anything with it. Waiting to hear your ideas! I'll come up with a video of it 'in action' and printing the numbers to the screen as soon as I can get someone to hold the camera for me - wish I had three hands. http://www.instructables.com/id/Arduino-Projects/ Related Instructables How To Connect a PS/2 Keyboard to the iPhone by awgh Android talks to Arduino by circuit_breaker Cell Phone Penguin Loves You! Thing a Day - Day 1 (Photos) by randofo Power Arduino The with a cellphone RRRRRRRRRRBBA, zimirken by a $3 Arduino by jackzylkin Arduino Color Mixer controlled Arduino EMF (Electromagnetic by iPhone by Field) Detector hbjackson by computergeek iAndroidRemote - Control Android mobile using an Apple Remote by sudar http://www.instructables.com/id/Arduino-Projects/ Arduino Powered Binary Clock by ArduinoFun on October 20, 2009 Intro: Arduino Powered Binary Clock This instructable will help you to build an Arduino Binary Clock. The orignial idea for this instructable was designed by Daniel Andrade. My instructable uses surface mount components, but can easily be adapted to through-hole components if you wish. You can follow my other Instructable for Building Your Own Arduino to get started. I would encourage you to give the surface mount an attempt however as this project is a great way to begin learning to solder surface mount components. For my clock, I have the display set on the top of the container. I use it on my workbench which I am usually standing at, so this way is easier to see. It also creates a nice luminous effect when the lights are down low or off, casting the blue color upwards into the room. You can select a container to your liking and place the clock face how it best fits your needs. Image Notes 1. finished arduino binary clock Step 1: Component Shopping List Below is a list of all the items that you will need in order to complete this project. I have tried to include places where you can order from as well as optional components that you may want to pick up. This list is for surface mount items. If you decide to go with through-hole components, the resources I have listed all sell them as well and you can just do a search on the component. What You Need: ATmega168 with Arduino Bootloader - Available at FunGizmos for $4.00 10K Resistor - Available at Jameco - Cost 0.01 (ea./ 100 for $1.00) Item # 1877832 220 Ohm Resistor - Available at Jameco - Cost 0.01 (ea. / 100 for $1.00) Item # 1878149 22pF Capacitor - Available at Jameco - Cost 0.06 (ea. / 100 for $6.00) Item # 1856783 10uF Capacitor - Available at Jameco - Cost 0.12 (ea. / 10 for $1.20) Item # 1858797 Pushbutton Switch - Available at Jameco - Cost .35 ea. Item # 2076236 LM78L05AC Voltage Regulator - Available at Jameco - Cost .39 ea. Item # 902186 13 LED's. I used Blue, but you can use any color. Available at Jameco - Cost .25 ea Item # 2046441 16MHz Crystal - Available at SparkFun.com - Cost 1.50 ea SKU: COM-00536 DC Power Jack Connector - Available at SparkFun.com - Cost 1.25 ea. PRT-00119 If you don't already have one, an Arduino Board. Available at SparkFun.com - Cost 29.95 DEV-00666 or Build Your Own Arduino PC Board (Perf Board/Proto Board) - Available at Radioshack - cost varries. Optional Protoboard - Available at Wright Hobbies - Cost 3.99 Item # PB400. I love these! Project Container. This will be used to house your clock. I went to Hobby Lobby craft store and picked up a cheap wood box for $1.99, and some scrap trim molding from Lowes for .25 15. Translucent Acrylic - I picked up some white translucent acrylic from a local shop which cost $1 per pound. 16. x2 SPDT Pushbuttons - Available at RadioShack -Cost $3.99 - Catalog #: 275-1549 1. 2. 3. 4. 5. 6. 7. 8. 9. 10. 11. 12. 13. 14. http://www.instructables.com/id/Arduino-Projects/ Step 2: 8421 Binary and 24 Hour Time First, lets take a look at how to understand the 8421 Binary system. Your clock is going to have two columns for the "hours" and two columns for the "minutes". We are using a 24 hour time system. With that said, if it were 8 AM, the time is 0800 hours and if it were 8 PM, the time would be read as 20:00 hours. In US Army basic training, when you first learn this time system, they taught us to just count backwards by 2 for PM times. So for example, if I was told to be in formation by 2100 hours. In my head I was thinking 2100 - so 1, 0, 9 and knew they meant 9 PM. Or if we were off work at 1630 hours, in my head I was thinking 1630 - so 6, 5, 4 and knew the day was over at 4:30 PM. I hope that makes sense, I felt the need to explain for anyone who is not use to telling time with this method. Looking at the 8421 Binary Example image, in the first column of the hour leds, if the first led was lit up, its value would be worth 1 and in the second column if the 4th(top) led was lit, its value would be worth 8. Therefore you would have 18. Now with the minute leds, lets say the first column has the third led and the first led lit up. This value would be 4+1=5. The second column, third led is lit up would give a value of 4. So together you would have 54. The overall time would read as 18:54 which would be 6:54 PM Look at the second image example. The time is 21:37 Examples Images from Daniel Andrade Image Notes 1. (BCD) Binary Example Image Notes 1. 2 2. 1 3. 2 4. 1 5. 4 6. 2 7. 1 http://www.instructables.com/id/Arduino-Projects/ Step 3: Creating the Arduino Binary Clock PCB You have a few options with this step. You could use your Arduino board and run all the components to it. This option however, you wont have access to your Arduino as long as you are using the clock :( so you would have to buy another one. You can Build Your Own Arduino onto a piece of Protoboard, and then run the connection wires to a seperate protoboard that has the LED's on it. This was the method that I used for my first clock design. A better approach would be to etch your own copper PCB. The second clock that I designed I went with this method. There are pleanty of Instructables on how to do this . Since this method requires more equipment, I am going to keep with the first clock design for instruction purposes. Later or on your own you can research other methods if you would like to attempt etching your own PCB. Once you have the protoboard that will be used as your Arduino completed. Use your actual Arduino board, and upload the sketch supplied at the end of this tutorial. Pop that chip out, and place it in the protoboard Arduino. The resistors and leds will be connected from the second protoboard, down to your designed Arduino board. Follow the attached schematic with this step. Arduino Pin 1 connects to Resistor 1 which connects to LED 1, which connects to GND. Arduino Pin 2 connects to Resistor 2 which connects to LED 2, which connects to GND. * repeat this process for all 13 resistors, pins and led's. SOLDERING TIP. Place a tiny and thin layer of solder onto the area that you are going to be soldering to first, then with one hand holding the soldering iron, and the other using a pair of tweezers, place the component onto the area to be soldered to. Hold it down with the tweezers, and then reheat the solder. Keep pressure applied with the tweezers and move the solder iron away. Now you can let go with the tweezers and the part will be connected into place. More Instructables for soldering. Image Notes 1. Protoboard #1 contains LED's. 2. Protoboard #2, your Arduino set up. 3. Method #1 using two protoboards 4. Pin connection wire, resistor, led 5. GND Image Notes 1. Method #2 Etched PCB version. Image Notes 1. Binary clock sketch running. 2. Switches used to program clock time. http://www.instructables.com/id/Arduino-Projects/ 3. 9V wall power into DC Power Jack 4. resistors and connections for switches Image Notes 1. schematic for buttons used to set time Step 4: Clock Case The next step is to measure out and cut the acrylic. I cut slightly over the amount of the protoboards so that I had room to move the location of the LED's around to be fairly centered. For the clock housing, I selected a box that had a deep lid. This allowed me to be able to fit the protoboards into it, and still have room to make a flat cover to hide everything once the lid is opened. I drew out a square pattern for where the face will be, then drilled a hole into the corner. This allowed me to use a small copping saw to then cut out the shape. The cuts are kind of rough, so I added trim molding around the opening to hide this. It also makes it look more finished. After I sanded and stained the box, I placed the acrylic and components in and measured where the pushbuttons and power jack were located. With a drill bit and counter sink, I made the holes for them. Carefully insert your arduino binary clock boards into the lid. Image Notes 1. translucent white acrylic used to cover led board. Image Notes 1. measure and cut clock face hole into container http://www.instructables.com/id/Arduino-Projects/ Image Notes 1. deep lid, able to hide protoboards and wires in. cover up when finished. Image Notes 1. trim added to cover up ruff cuts Image Notes 1. interior view 2. enough room to cut a flat piece of balsa wood to hide components. 3. storage. Image Notes 1. finished arduino binary clock Step 5: Arduino Sketch /* An open-source binary clock for Arduino. Based on the code from by Rob Faludi (http://www.faludi.com) Code under (cc) by Daniel Spillere Andrade, www.danielandrade.net http://creativecommons.org/license/cc-gpl */ int second=0, minute=0, hour=0; //start the time on 00:00:00 int munit,hunit,valm=0,valh=0,ledstats,i; void setup() { //set outputs and inputs pinMode(1, OUTPUT);pinMode(2, OUTPUT);pinMode(3, OUTPUT);pinMode(4, OUTPUT);pinMode(5, OUTPUT); pinMode(6, OUTPUT);pinMode(7, OUTPUT);pinMode(8, OUTPUT);pinMode(9, OUTPUT);pinMode(10, OUTPUT); pinMode(11, OUTPUT);pinMode(12, OUTPUT);pinMode(13, OUTPUT); pinMode(0, INPUT); } void loop() { static unsigned long lastTick = 0; // set up a local variable to hold the last time we moved forward one second // (static variables are initialized once and keep their values between function calls) // move forward one second every 1000 milliseconds if (millis() - lastTick >= 1000) { lastTick = millis(); http://www.instructables.com/id/Arduino-Projects/ second++; } // move forward one minute every 60 seconds if (second >= 60) { minute++; second = 0; // reset seconds to zero } // move forward one hour every 60 minutes if (minute >=60) { hour++; minute = 0; // reset minutes to zero } if (hour >=24) { hour=0; minute = 0; // reset minutes to zero } munit = minute%10; //sets the variable munit and hunit for the unit digits hunit = hour%10; ledstats = digitalRead(0); // read input value, for setting leds off, but keeping count if (ledstats == LOW) { for(i=1;i<=13;i++){ digitalWrite(i, LOW);} } else { //minutes units if(munit == 1 || munit == 3 || munit == 5 || munit == 7 || munit == 9) { digitalWrite(1, HIGH);} else { digitalWrite(1,LOW);} if(munit == 2 || munit == 3 || munit == 6 || munit == 7) {digitalWrite(2, HIGH);} else {digitalWrite(2,LOW);} if(munit == 4 || munit == 5 || munit == 6 || munit == 7) {digitalWrite(3, HIGH);} else {digitalWrite(3,LOW);} if(munit == 8 || munit == 9) {digitalWrite(4, HIGH);} else {digitalWrite(4,LOW);} //minutes if((minute >= 10 && minute < 20) || (minute >= 30 && minute < 40) || (minute >= 50 && minute < 60)) {digitalWrite(5, HIGH);} else {digitalWrite(5,LOW);} if(minute >= 20 && minute < 40) {digitalWrite(6, HIGH);} else {digitalWrite(6,LOW);} if(minute >= 40 && minute < 60) {digitalWrite(7, HIGH);} else {digitalWrite(7,LOW);} //hour units if(hunit == 1 || hunit == 3 || hunit == 5 || hunit == 7 || hunit == 9) {digitalWrite(8, HIGH);} else {digitalWrite(8,LOW);} if(hunit == 2 || hunit == 3 || hunit == 6 || hunit == 7) {digitalWrite(9, HIGH);} else {digitalWrite(9,LOW);} if(hunit == 4 || hunit == 5 || hunit == 6 || hunit == 7) {digitalWrite(10, HIGH);} else {digitalWrite(10,LOW);} if(hunit == 8 || hunit == 9) {digitalWrite(11, HIGH);} else {digitalWrite(11,LOW);} //hour if(hour >= 10 && hour < 20) {digitalWrite(12, HIGH);} else {digitalWrite(12,LOW);} if(hour >= 20 && hour < 24) {digitalWrite(13, HIGH);} else {digitalWrite(13,LOW);} } valm = analogRead(0); if(valm<800) { minute++; second=0; delay(250); } valh = analogRead(5); if(valh<800) { hour++; second=0; delay(250); } } // add one minute when pressed // add one hour when pressed http://www.instructables.com/id/Arduino-Projects/ Image Notes 1. Arduino Icon created by Thomas Gläser Related Instructables Arduino Binary Clock (Photos) by Macgyver THX 4 Leds Binary Clock (video) by macobt Smallest Binary Clock by macobt Binary Clock (video) by macobt Binary Clock (video) by macobt Arduino Binary Alarm Clock by njakol Binary Marble Clock by matseng How to Count in the Binary and Hexadecimal Numbering Systems by dsman195276 http://www.instructables.com/id/Arduino-Projects/ Arduino All-in-One Getting Started Guide by gunnk on January 27, 2009 Author:gunnk author's website One of my first memories is Apollo 11. Guess that set the stage for everything else. I have a degree in physics, researched indoor air pollution for several years, then moved on to IT *before* the dotCom boom and bust. I'm a sysadmin by day and a husband, father and maker 24/7. I also like to run (and have been known to need to apply that skill thanks to the occasional project that yielded -- unexpected -- results). Intro: Arduino All-in-One Getting Started Guide An all-in-one tutorial to getting started with the Arduino open-source electronics prototyping platform. This guide is meant for the beginner but should be also be useful to you if you already tinker with electronics but want to get started with the Arduino. I'll cover: - breadboarding LED outputs from the Arduino - creating and reading digital inputs to the Arduino - how to program the Arduino to take the input and act on it to modify the outputs Our demonstration project will consist of a set of three blinking LED's that blink in sequence. You'll control the speed of the blinks via a pushbutton controller. I've designed this project to be modular in nature: we can create a fairly complex effect, but I've wired and coded everything in a modular fashion to make it easier to follow. Of course, that means that neither the circuits nor the code are necessarily the most efficient way of doing things -- but the emphasis here is on making it clear and understandable. Acknowledgement: I'd like to thank Lady Ada for her excellent set of tutorials on the Arduino which is where I first learned Arduino basics. I cover a lot of the same ground, but her work has a very different flavor and emphasis including a different set of circuits and programs. I recommend that you pay her tutorials a visit. You can also buy Arduino boards and an wide variety of shields and accessories for the Arduino from her company, Adafruit Industries. Here's how the finished project behaves: http://www.instructables.com/id/Arduino-Projects/ Step 1: Testing Your Board / Getting Started If you have already connected an Arduino to your computer and run the basic "blink" example you can skip this step. However, if all you've done is unbox it, here's how to start: 1) Download the software you'll need from the makers: Software Download. 2) Install the software and connect your Arduino to your computer via a USB cable. It draws power directly from the USB port, so you don't need to connect a power supply to it at this point. 3) If you have a newer board you'll see a resistor next to pin 13 and an LED next to that. That LED works just as if it were connected between pin 13 and the ground (GND) pin next to it. If the LED is NOT on your board, just connect an LED between 13 and GND. You don't need to do anything else since a resistor is already built in and limits the current through the LED so you don't put your board at risk of a short circuit. NOTE: This resistor may not be present on really old boards (I just don't know), but I doubt you have one of those. 4) Set your board type and serial port under "Tools" in the software kit. The current version (at the time of writing) does not have an option for the newest Duemilanove boards, but choosing Diecimila works just fine. 5) Open the blink example from the software kit: It's under File | Sketchbook | Examples | Digital. The onboard LED (or the one you added) should blink on and off after you upload the Blink "sketch" (as Arduino projects are called) to the board (File | Upload). When you write programs for your Arduino, you will normally do much of your debugging in the software development kit by doing a Verify/Compile before uploading, but since we just uploading a pre-built test sketch I skipped that here. Step 2: Wiring the Blinky Lights I've broken the circuit down in such a way that we will be wiring up our output (the blinky lights) completely separately from our input (the pushbutton switch). Makes it easier to understand if you're just starting out. First, a note and word of caution. Newer Arduino boards have an LED right on the board itself or at least a resistor connected to pin 13 so that you can stick an LED right between pin 13 and ground (GND). This is NOT true for the other pins! If you connect LED's or other circuits on other pins you must be certain to protect your board from excessive currents or full-out short circuits. You can fry your Arduino! Personally, I recommend that you always use a resistor when experimenting. You don't want to accidentally short to ground, so at least connect a low value resistor to the ground pin. Better safe than sorry. In this circuit we are using pins 11,12 and 13 as digital outputs (5V) to power the LED's. The negative post of each LED connects across a single shared resistor and then to ground. In my circuit I'm using a 150 ohm resistor (it was just a convenient grab from my parts bin). You can use other values here -- just don't go too extreme so that you don't either (a) keep the LED from lighting or (b) push too much current through your Arduino. If you run the Arduino "blink" sketch from step one you should now notice that one of your LED's is blinking. If not, you should check back over your wiring and components. A diagram for this very simple circuit is below. http://www.instructables.com/id/Arduino-Projects/ Step 3: Wiring the Pushbutton Switch To keep things modular, the pushbutton switch also connects to your Arduino, but it's a very separate circuit. Note that the little pushbutton switches commonly available have four legs. The pins on each side are permanently connected to one another, so the button actually makes a single connection between the two sides. If you're in doubt as to which posts are which, just check it with your multimeter. In the circuit diagram you're going to notice that we are using two resistors. Again, the exact values aren't really important, but the relative values are. If you aren't familiar with the concept of pull-up/pull-down resistors, please take a minute to really understand this circuit. If you don't, you will likely get flaky results in future projects or -worse yet -- burn out your Arduino. When the switch is OPEN, the circuit is simply a connection from the digital input (pin 2 in our case) to ground through a couple of resistors. Since we are connected to ground the value at pin 2 is LOW (approximately zero volts). If we were connected only to the switch the value would be whatever noise the wires were picking up. Maybe it would be close enough to zero to work, but maybe not. We need that ground connection to make sure our reading is right. When the switch is CLOSED, the 5V source is connected to ground across our 15k resistor. The 150 ohm resistor is negligible by comparison, so it has a minimal effect on the voltage our input pin is reading (5V) and the digital input is HIGH (~5V). The 150 ohm resistor keeps us from creating a short between the power source and the pin so that we don't damage the Arduino. Again, the exact values of these resistors are not important. Just make sure R1 is MUCH bigger than R2 and that R2 is big enough to limit the current back to the board. My values were simply plucked from my parts bin. Clarification: The resistor is a pull-DOWN resistor because it connects the digital input to ground. A pull-UP resistor would pull the normal (no button pressed) state of the input to 5V. http://www.instructables.com/id/Arduino-Projects/ Step 4: Programming the Project Now that we have completed wiring up our project it is time to write some code. I'm including all the code below, but will talk about the theory a little first. The code I've provided compiles to 1560 bytes in size. The Arduino handles programs up to 14336 bytes in size. This little project takes up over 10% of the Arduino's capacity, but this is REALLY not optimal code. It's a tutorial, so I've tried to be clear rather than efficient. I wouldn't be at all surprised to find it could be rewritten in half the space or less. Every Arduino "sketch" has two mandatory areas: setup and loop. Setup executes ONCE after the program starts. This allows you to configure the initial state of the board: which pins are inputs, which are outputs, and whether outputs start off HIGH or LOW. The loop is the section of the program executived repeatedly as soon as setup has completed. There is no "end" or "exit" to an Arduino program -- there is nowhere to exit to! If you have experience programming, you'll immediately recognize the language used to program the Arduino is our good old buddy C. If not, you can pick up the basics just by going over my code and the other examples in the development kit. Many great C tutorials are also available on the web. You can copy and paste the code into your Arduino development environment, then verify and upload it. If everything is right you should get blinky lights and be able to vary the speed by pressing the button. Now a section-by-section breakdown of the sketch: 1) First we start by defining some variables. Much of this area is for human comprehension and could be skipped for the sake of efficiency. For example, I've defined a variable called "ledPinRed" and set it equal to 13 (I used three colors of LEDs -- the red one is connected to digital pin 13). I could have used "13" directly throughout the program, but that makes it much harder to comprehend. The comments next to the variables note what each is for. 2) Setup. Here I've set the pin to which the pushbutton is attached as an input pin. The Arduino will be looking to receive information (HIGH or LOW signals) there. I've set the LED connections to be outputs where the board will set the voltage as HIGH or LOW (5V or 0V) as appropriate. Finally, I turned on my green LED and made sure the others were turned OFF. 3) getButton: a function (just a container for code for any non-programmers reading this) that can be called from the main loop to find out if we've pressed the button. It keeps track of the current state of the button AND the previous state of the button the last time we looked at it. This allows us to respond only to individual button presses: holding down the button only counts as ONE press. This is important when the lights are changing very rapidly lest it be very tough to control. 4) changeLights: another function. This one gets called whenever we need to move from one LED to the next. The one that's on gets turned off and the next one in sequence gets turned on. It also updates the "currentLED" variable so we can keep track of which LED is currently active. 5) loop: The main loop. Here we first make a call to check on the button. If we find the button wasn't being pressed but now it is, we add to the "currentSpeed" variable. If we're going really fast, we reset currentSpeed back to 1 -- looping around so we can go back to slow speeds. After that... ...well, then we hit an ugly line that determines if it is time to change to the next LED. millis() is a built-in Arduino function that keeps track of how long the board has been running the current program. All we're doing here is finding out if enough time has gone by that we should change to the next light. If so, we call the "changeLights" function to make it happen. Finally, here is the code (warning: it loses a little formatting when posted here, so it's not as pretty as it could be): /* Kevin's Arduino Tutorial * This software is designed to be used with my Arduino All-in-One Getting Started Guide over at http://instructables.com. * */ // Note that these variables are all GLOBAL in scope, so they'll work inside our function calls int ledPinRed = 13; // Set up digital outputs for LEDs int ledPinYellow = 12; int ledPinGreen = 11; int switchPin = 2; // Set up to read the switch state from digital input 2 int currentLED = 1; //Green = 1, Yellow = 2, Red = 3 int currentSpeed = 1; // Determines how fast we switch between lights. int buttonWas = 0; // The state of the switch (pushed = 1, not pushed = 0) last time we looked int buttonIs = 0; // Current state of the switch unsigned long timer = 0; // A timer to keep track of where we are. void setup() // Runs once, when the program ("sketch") starts { pinMode(switchPin, INPUT); // Tells the Arduino to treat the switchPin as INPUT pinMode(ledPinRed, OUTPUT); // Tells the Arduino that the Red LED pin is for OUTPUT pinMode(ledPinYellow, OUTPUT); pinMode(ledPinGreen, OUTPUT); digitalWrite(ledPinGreen, HIGH); // Green LED is ON at start digitalWrite(ledPinRed, LOW); // Red LED is OFF at start digitalWrite(ledPinYellow, LOW); // Yellow LED is OFF at start } void getButton() { // Let's see what the button is doing, shall we? buttonWas = buttonIs; // Set the old state of the button to be the current state since we're creating a new current state. buttonIs = digitalRead(switchPin); // Read the button state } void changeLights() { // Turn OFF the currently lit LED and turn ON the next one. timer=millis(); // reset our timer to the current time if(currentLED==1) { digitalWrite(ledPinGreen, LOW); http://www.instructables.com/id/Arduino-Projects/ digitalWrite(ledPinYellow, HIGH); } if(currentLED==2) { digitalWrite(ledPinYellow, LOW); digitalWrite(ledPinRed, HIGH); } if(currentLED==3) { digitalWrite(ledPinGreen, HIGH); digitalWrite(ledPinRed, LOW); } currentLED++; // Add one to currentLED if (currentLED==4) { currentLED=1; } } void loop() // This is our "main" loop. Arduino programs don't exit -- nowhere to exit TO! { getButton(); if((buttonIs==1)&&(buttonWas==0)) { currentSpeed++; // Add one to the current delay because the button was pressed. if(currentSpeed==15) { currentSpeed = 1; } // Loop around -- this sets us back to a slow rotation. } if (millis()>=timer+(1000/currentSpeed)) { // Time to change the lights! changeLights(); } } File Downloads KevinsArduinoTutorial.cpp (2 KB) [NOTE: When saving, if you see .tmp as the file ext, rename it to 'KevinsArduinoTutorial.cpp'] Step 5: Where to Go from Here Congratulations! You've made it to the end of my tutorial. I'll leave you with a couple of hints plus some ideas of what you can do using this circuit as a basis. My biggest hint is the use of the Arduino software kit's serial monitor. Learn to love it. When the Arduino is running, use the serial monitor to see any information the board is sending to your computer. The command Serial.begin(9600); will tell the Arduino to send data to the computer. What data? Anything you want. Just use: Serial.print("My variable is now: "); Serial.println(myVariableName); Notice that those lines are bit different. The first doesn't add a newline on the end while the second does. Use Serial.print functions LIBERALLY when debugging code. You can delete them once everything is working correctly. Also, note that the great thing about the Arduino is that you don't have to keep it hooked to your computer once you've uploaded your sketch. However, the board will need power. A 9V DC adapter with a positive tip is what you'll need (I keep an assortment on hand plus a couple of adjustable power supplies). If you don't have a suitable one, Adafruit Industries has them and includes one in their Arduino starter kit. So now what? You know how to wire output and input to your Arduino and have a working copy of my tutorial project. Here's a couple of ideas for you to try: 1) Add more LED's. Instead of looping from the last LED to the first, just reverse direction. The back and forth should make a decent Cylon effect. 2) Try adding a second button on another input to slow down the rate of blinking. Or maybe create entirely different patterns using your second switch (the first one is speed, the second is mode). In any case, have fun! The Arduino is a great piece of hardware with virtually unlimited applications. A little practice and a bit of imagination and the sky's the limit! Related Instructables How to use Arduino Mega 2560 as Arduino isp by tsillen Arduino / Processing Serial LED Blink Tutorial (video) by c0ffeepowder Turn Your Arduino Into an ISP by mr_mac3 RGB's with Arduino and Processing by nazdreg2007 Integrating your Arduino With Flash and Actionscript 3 by acksheep13 Powering the Arduino Mega with a Lithium Battery by inthebitz Hacking an Arduino ISP Shield for AtTiny45 / AtTiny85 by rleyland Arduino tutorial - organize your projects by liudr http://www.instructables.com/id/Arduino-Projects/ The Arduino Weather Station / Thermostat by sspence on September 27, 2010 Author:sspence author's website Professionally, I'm an IT Engineer (Executive Level) and Electronics Tech. Philosophically, I'm a Green Conservative, and probably would have been a hippie in the 60's if I had been old enough. I live off grid, with Solar (PV), Wind, and veggie oil fueled diesel generator power. Intro: The Arduino Weather Station / Thermostat I've always been interested in monitoring my local weather, and noticed the difference between what weather.com and accuweather.com think my local weather is, and what I see out the window. I also wanted better control over my heating and A/C system. As a computer and electronics nut, I've been playing with the Arduino Microcontroller, and decided to to meld my interests. So here goes the documentation on my home built solar powered weather station (always being modified, and expanded) with HVAC Control. Step 1: The Arduino The first step was obtaining a Arduino board. We purchased ours from hacktronics.com. After working through the tutorials on their site, I felt confident that I understood the simple scripting and connection concepts, and moved forward. Arduino is an open-source electronics prototyping platform based on flexible, easy-to-use hardware and software. It's intended for artists, designers, hobbyists, and anyone interested in creating interactive objects or environments. - http://arduino.cc/ The Arduino requires 5v to run, and we supply this with our Pico Solar PV / Lithium battery pack. http://www.instructables.com/id/Arduino-Projects/ Step 2: The LCD Display I needed the ability to display temperature, humidity, barometric pressure, and time/date, so I picked a 4 line white on blue LCD display from Hacktronics. I used their LCD tutorial to get it connected and display some sample text on the screen. // character LCD example code // www.hacktronics.com // Connections: // rs (LCD pin 4) to Arduino pin 12 // rw (LCD pin 5) to Arduino pin 11 // enable (LCD pin 6) to Arduino pin 10 // LCD pin 15 to Arduino pin 13 // LCD pins d4, d5, d6, d7 to Arduino pins 5, 4, 3, 2 LiquidCrystal lcd(12, 11, 10, 5, 4, 3, 2); int backLight = 13; // pin 13 will control the backlight void setup() { pinMode(backLight, OUTPUT); digitalWrite(backLight, HIGH); // turn backlight on. Replace 'HIGH' with 'LOW' to turn it off. lcd.begin(16,2); // columns, rows. use 16,2 for a 16x2 LCD, etc. lcd.clear(); // start with a blank screen lcd.setCursor(0,0); // set cursor to column 0, row 0 (the first row) lcd.print("Hello, World"); // change this text to whatever you like. keep it clean. lcd.setCursor(0,1); // set cursor to column 0, row 1 lcd.print("hacktronics.com"); // if you have a 4 row LCD, uncomment these lines to write to the bottom rows // and change the lcd.begin() statement above. //lcd.setCursor(0,2); // set cursor to column 0, row 2 //lcd.print("Row 3"); //lcd.setCursor(0,3); // set cursor to column 0, row 3 //lcd.print("Row 4"); } void loop() { } See http://www.hacktronics.com/Tutorials/arduino-character-lcd-tutorial.html for actual code as instructables breaks our include statements. http://www.instructables.com/id/Arduino-Projects/ Step 3: Temperature & Humidity I purchased a SHT21 Temperature Humidity sensor from MisensO.com. This chip uses the I2C protocol for communicating. I found some sample code on the net that makes it talk to the Arduino, but it outputs to the serial port back to the pc. I modified the code to output to my LCD. I now have the Temperature and Humidity showing on the LCD display. //Tested with SHT21 Breakout from Misenso //SHT21 pin SDA to Arduino Analog pin 4 //SHT21 pin SCL to Arduino Analog pin 5 //SHT21 pin GND to Arduino GND //SHT21 pin VCC to Arduion 3v (not 5v) lcd.begin(20,4); // columns, rows. use 16,2 for a 16x2 LCD, etc. lcd.clear(); // start with a blank screen lcd.setCursor(0,0); // set cursor to column 0, row 0 (the first row) lcd.print("Humidity: "); // change this text to whatever you like. keep it clean. lcd.print(humidity.GetHumidity()); lcd.setCursor(0,1); // set cursor to column 0, row 1 lcd.print("Temp in C: "); lcd.print(humidity.GetTemperatureC()); lcd.setCursor(0,2); // set cursor to column 0, row 2 lcd.print("Temp in F: "); lcd.print(humidity.GetTemperatureF()); See http://arduinotronics.blogspot.com/2010/09/our-temperature-humidity-monitor-is.html for actual code as instructables breaks our include statements. You will need the LibHumidity.h library from Modern Devices for this project. http://www.instructables.com/id/Arduino-Projects/ Step 4: HVAC Control Now that I know what the temperature is, I need to control my A/C and heat based on what I want the temp to be. I installed a RGB LED as a placeholder for the relays I will be installing. If the system calls for heat, it turns the LED red. If it calls for cooling, it turns the LED Blue. If it's in our comfort range, it turns green. if (humidity.GetTemperatureF() < 60) { digitalWrite(RedLEDPin, LOW); // sets the Red LED on digitalWrite(BlueLEDPin, HIGH); // sets the Blue LED off digitalWrite(GreenLEDPin, LOW); // sets the Green LED off } else if (humidity.GetTemperatureF() >= 75) { digitalWrite(BlueLEDPin, LOW); // sets the Blue LED on digitalWrite(RedLEDPin, HIGH); // sets the Red LED off digitalWrite(GreenLEDPin, HIGH); // sets the Green LED off } else { digitalWrite(GreenLEDPin, LOW); // sets the Green LED on digitalWrite(BlueLEDPin, HIGH); // sets the Blue LED off digitalWrite(RedLEDPin, HIGH); // sets the Red LED off } See http://arduinotronics.blogspot.com/2010/09/our-temperature-humidity-monitor-is.html for actual code as instructables breaks our include statements. Step 5: Current code with wiring instructions The following is the code as it exists today. I am adding a second SHT21 for indoor/outdoor measuring (means hacking a second I2C channel, as the SHT21's all have the same address, and can't exist on one channel), and I'm still waiting for my real time clock chip and barometric pressure sensor to arrive from Sparkfun.com (they arrived yesterday, and I will work on this on the weekend - 9-29-10). I migrated the project over to my new Arduino Mega 2560 (58 I/O lines), and installed the new 0021 IDE. I will edit this instructable as the project evolves. // Connections: // LCD pin 1 to Arduino GND // LCD pin 2 to Arduino 5v // LCD pin 3 (Contrast) to GND // rs (LCD pin 4) to Arduino pin 12 // rw (LCD pin 5) to Arduino pin 11 // enable (LCD pin 6) to Arduino pin 10 // LCD pin 15 to Arduino pin 13 // LCD pin 16 to Arduino GND // LCD pins d4, d5, d6, d7 to Arduino pins 5, 4, 3, 2 //Tested with SHT21 Breakout from Misenso //SHT21 pin SDA to Arduino Analog pin 4 //SHT21 pin SCL to Arduino Analog pin 5 //SHT21 pin GND to Arduino GND //SHT21 pin VCC to Arduino 3v (not 5v) //RGB LED //Red Cathode to Arduino pin 9 //Blue Cathode to Arduino pin 8 http://www.instructables.com/id/Arduino-Projects/ //Green Cathode to Arduino pin 7 //Anode to 270 ohm resistor to 5V #include #include #include LibHumidity humidity = LibHumidity(0); LiquidCrystal lcd(12, 11, 10, 5, 4, 3, 2); int backLight = 13; // pin 13 will control the backlight int RedLEDPin = 9; // LED connected to digital pin 9 int BlueLEDPin = 8; // LED connected to digital pin 8 int GreenLEDPin = 7; // LED connected to digital pin 7 void setup() { pinMode(backLight, OUTPUT); digitalWrite(backLight, HIGH); // turn backlight on. Replace 'HIGH' with 'LOW' to turn it off. //I2C pinMode(16, OUTPUT); digitalWrite(16, LOW); //GND pin pinMode(17, OUTPUT); digitalWrite(17, HIGH); //VCC pin //Furnace / AC Indicator pinMode(RedLEDPin, OUTPUT); // sets the digital pin as output pinMode(BlueLEDPin, OUTPUT); // sets the digital pin as output pinMode(GreenLEDPin, OUTPUT); // sets the digital pin as output } void loop() { lcd.begin(20,4); // columns, rows. use 16,2 for a 16x2 LCD, etc. lcd.clear(); // start with a blank screen lcd.setCursor(0,0); // set cursor to column 0, row 0 (the first row) lcd.print("Humidity: "); // change this text to whatever you like. keep it clean. lcd.print(humidity.GetHumidity()); lcd.setCursor(0,1); // set cursor to column 0, row 1 lcd.print("Temp in C: "); lcd.print(humidity.GetTemperatureC()); lcd.setCursor(0,2); // set cursor to column 0, row 2 lcd.print("Temp in F: "); lcd.print(humidity.GetTemperatureF()); { if (humidity.GetTemperatureF() < 60) { digitalWrite(RedLEDPin, LOW); // sets the Red LED on digitalWrite(BlueLEDPin, HIGH); // sets the Blue LED off digitalWrite(GreenLEDPin, LOW); // sets the Green LED off } else if (humidity.GetTemperatureF() >= 75) { digitalWrite(BlueLEDPin, LOW); // sets the Blue LED on digitalWrite(RedLEDPin, HIGH); // sets the Red LED off digitalWrite(GreenLEDPin, HIGH); // sets the Green LED off } else { digitalWrite(GreenLEDPin, LOW); // sets the Green LED on digitalWrite(BlueLEDPin, HIGH); // sets the Blue LED off digitalWrite(RedLEDPin, HIGH); // sets the Red LED off } } delay (20000); } See http://arduinotronics.blogspot.com/2010/09/our-temperature-humidity-monitor-is.html for actual code as instructables breaks our include statements. http://www.instructables.com/id/Arduino-Projects/ Step 6: Arduino Clock Module We finished the Arduino Time & Date functions using the Sparkfun DS1307 I2C RTC module, a 2 line LCD, and the Arduino Duemilanove. There are four connections from the DS1307 to the Arduino: //pin SDA to Arduino Analog pin 4 //pin SCL to Arduino Analog pin 5 //pin GND to Arduino GND //pin VCC to Arduino 5v To set the time, edit the following section in the code with the correct time and date, // Change these values to what you want to set your clock to. // You probably only want to set your clock once and then remove // the setDateDs1307 call. second = 0; minute = 42; hour = 9; dayOfWeek = 1; //Sunday dayOfMonth = 3; month = 10; //October year = 10; and temporarily remove the // from the following line: //setDateDs1307(second, minute, hour, dayOfWeek, dayOfMonth, month, year); Upload your code to the Arduino, then put the // back in the above line, and upload again. The complete code and wiring are posted at http://arduinotronics.blogspot.com/2010/10/ds1307-real-time-clock-working.html http://www.instructables.com/id/Arduino-Projects/ Related Instructables Using Humidity sensor with 8051 Microcontroller (video) by ashoksharma Arduino-based master clock for USB schools by Indoor/Outdoor MasterClockMaker Thermometer (or, 'My first USB device') by ian Arduino Weather Station Part2 by msuzuki777 Wise Clock 3 Arduino-based geeky alarm clock by florinc Terrarium Twitter Monitoring by MarioBoehmer Arduino Pedometer by msuzuki777 Who Needs a Meteorologist? Measure Humidity the Old-School Way, With a Sling Psychrometer! by nrromsey http://www.instructables.com/id/Arduino-Projects/ Control a Schlage electronic deadbolt with an arduino! by quadmasta on October 1, 2009 Intro: Control a Schlage electronic deadbolt with an arduino! This instructable will walk you through the process of dismantling and hacking a Schlage electronic deadbolt in order to control it with an arduino. Step 1: Purchase the lock and unpack it I got mine on sale for $99 at Lowe's. Remove it from the box and take a look at what's there. The construction of the lock is really great. Anywhere that could even remotely see any moisture is surrounded with rubber sleeving or a rubber o-ring. The lock has 3 basic parts: outside portion: This portion has a regular key cylinder, a knob for the deadbolt similar to what you normally see inside of a house, and a keypad for entering the code. inside portion: This portion has a knob to operate the deadbolt, a housing for a 9v battery, and a switch to tell the electronics in the front of the lock when the lock is in use. deadbolt mechanism: This portion is similar to any other deadbolt on the market. http://www.instructables.com/id/Arduino-Projects/ Step 2: Take the faceplate off of the lock Turn the outside portion over and you'll see 6 #2 phillips screws. Remove them and you should see something like the second picture. Step 3: Take the intermediary plate off Flip the outside portion over and you'll see what's in the first picture. remove 2 T10 Torx screws seen in the second picture and you'll have something like what's in the third and forth pictures. http://www.instructables.com/id/Arduino-Projects/ Step 4: Check out all of the neat stuff You should see the backside of the intermediary plate as well as the part of the mechanism that actually does the locking. If you weren't careful, the long thin part that goes through the middle portion likely pushed its way out a bit and an almost invisible spring went shooting somewhere. Go find it. We'll call this assembly the working portion. Picture 2 displays how it goes together. On the right you'll see a piece of plastic that resembles a backwards C. This piece of plastic uses a post on its backside between two coils of a spring attached to a motor. When it moves up, it pushes the mushroom shaped part of the working portion upwards causing the "stem" of the mushroom to stick out into some of the fingers of the star shaped piece on the rear of the intermediary plate. This allows the knob on the front of the lock to turn the working portion and operate the deadbolt. It's pretty simple but very effective. Motor spins in one direction, plastic goes up and the lock works. Motor spins in the opposite direction, plastic goes down, lock freewheels. In the next step, I'll show how to attach some wires to the motor so you can control them. http://www.instructables.com/id/Arduino-Projects/ Step 5: Wire it up! Pull the control pad off of the motor and examine the rear. You'll see a black wire and white attached to the small motor. These are isolated from one another via the microcontroller on the Schlage circuit board so just find some small wiring ~24AWG and solder one to each post. Carefully route these two wires around the Schlage circuit board and push them through the rubber sleeve so you'll have access to them once the lock is reassembled. http://www.instructables.com/id/Arduino-Projects/ Step 6: Reassemble the lock Put the working portion in, put the intermediary plate on and then put the face plate back on the lock. You should be able to use a 9v battery to control the lock's function. http://www.instructables.com/id/Arduino-Projects/ Step 7: Create H bridge circuit Follow this schematic and create your H bridge circuit. http://triindia.co.in/resources_images/Stepper/bipolardriver.JPG You should now be able to pick any two digital outs on the arduino. Setting one low and one high will operate the lock's motor in one direction and obviously if you do the opposite, the motor will operate in the opposite direction. I added a Parallax RFID reader and I can use the Schlage's keypad or an RFID card to open the lock. I also am developing a new security product, Tactcess, that I've interfaced with the arduino. Read more here: http://www.cribbstechnologies.com Related Instructables How To Install A Keyless Entry Electronic Deadbolt (video) by build.com How to use Arduino Mega 2560 as Arduino isp by tsillen Very Simple Arduino Electric Lock by RKlenka Arduino Examples #2 Use an Arduino as a FTDI Programmer by qazwsx755 Build a Remote Control Deadbolt by stuffman ArduinoPowered Game'n'Watch Alarmclock (Photos) by m_frey The RRRRRRRRRRBBA, a $3 Arduino by jackzylkin Secret Knock Detecting Door Lock by Grathio http://www.instructables.com/id/Arduino-Projects/ Garduino: Gardening + Arduino by liseman on December 9, 2008 Author:liseman author's website bicycles, gardening, and other important stuff Intro: Garduino: Gardening + Arduino Garduino is a gardening Arduino. So far, Garduino: -Waters my plants whenever their soil moisture level drops below a predefined value. -Turns on grow lights, but only when it's dark out and only long enough to make the plants get 15 hours of total light (sunlight + supplemental light) daily. -Alerts me if the temperature around the plants drops below 50 degrees. This is the first grow-light and auto-water setup i know of that takes into account natural sunlight received and soil moisture level before turning on water / light. This and other projects I've built are available as kits / products at my website. I heavily relied on knowledge / inspiration / encouragement from: -Mikey Sklarand his many green-tech projects -Selwyn Pollit's permaculture knowledge -Mitch Altman, for giving me a long-overdue lesson on how to properly solder Future expansions might include: -Teaching my Garduino to brew his own compost tea from greywater. -Using pulsed, red-and-blue LED grow lights (like Mikey Sklar's setup) to significantly increase efficiency. -Adding a solar panel and batteries to remove any need for a power grid. -Testing for soil ph level and air CO2 content. Image Notes 1. relays, ac power 2. garduino 3. pump in bucket; water runs up to milk jug and then directly to planters 4. fluorescent grow light Image Notes 1. to relays 2. nails, to put in the dirt:) 3. to nails 4. photocell 5. thermistor http://www.instructables.com/id/Arduino-Projects/ Step 1: Obtain Your Materials I built this using recycled / free materials wherever I could think to. It cost significantly less than $100 in total. Here's what I used: The relays: 2 http://www.jameco.com/webapp/wcs/stores/servlet/ProductDisplay?jameco_page=42&langId=-1&productId=187151&catalogId=10001&freeText=omron+g5le1&storeId=10001&search_type=all&ddkey=http:StoreCatalogDrillDownView Omron G5LE-1 relays] 2 http://www.jameco.com/webapp/wcs/stores/servlet/ProductDisplay?langId=-1&storeId=10001&catalogId=10001&productId=1537918& 1N4004 diodes] 1 A.C. extension cord 1 A.c. power cord 1 A. C. outlet The watering system: 1 Tiny clean-water pump 1 Plastic milk jug ~2 Old road bike tubes 1 Milk crate String The lighting system: 1 4' fluorescent light fixture 1 "plant type" fluorescent bulb (I used the Ott-Lite, but any bulb marketed as for plants should be fine) The soil moisture sensor: 2 galvanized nails, 1-4" in length The light sensor: 1 photocell The temperature sensor / alert: 1 LED (any you'd use with an Arduino will do) 1 10k-ohm thermistor The plants and holders: A variety of seeds, preferably that'll grow into things you'd like to eat. Everywhere, I hear people recommend swiss chard as an easy starter plant... Planting containers: As many plastic milk jugs as you'd like. I used ~30. 28-gallon clear plastic storage containers. You'll need one for every 6 milk jugs. ~5 red bricks for each storage container, or anything else that will allow the milk jugs to stand at least an inch off the bottom of the container. Soil mixture: I used Mel's Mix, the mixture recommended in "The Square Foot Gardener." It consists of 1/3 peat moss, 1/3 coarse vermiculite, and 1/3 mixed compost, with the mixed compost coming from at least 6 different sources. I've heard lots of people bash peat moss and vermiculite's sustainability (not to mention vermiculite's obscenely-high price), so definitely explore your options here. As I understand it, you want something w/: -lots of plant nutrients (the mixed compost) -water retention (peat moss / vermiculite) -'fluffiness:' soil should be light so plants can easily grow their roots through and you can easily remove plants from it (vermiculite / peat moss) Tools / Miscellaneous Multimeter Wire stripper Solder Electrical tape 3 ~10k-ohm resistors 1 ~210-ohm resistor (for the LED) several feet 22-gauge wire 1 Arduino (in my case a Duemanilove, but any should work) 1 Protoshield (Ladyada's model) 1 mini circuit board Hot glue gun, with glue Image Notes 1. relays http://www.instructables.com/id/Arduino-Projects/ 2. thermistor 3. cds photocell 4. diodes 5. resistors 6. breadboard 7. wire Step 2: Sprout Your Plants Get your plants going by sprouting them. There are lots of guides and devices to help you do this, so I'll just mention that you can use the vermiculite watered regularly and placed in a windowsill as an ultra-basic sprouting setup. Here is my favorite sprouting setup, and here's a useful chart on sprouting times for a bunch of different plants. Make sure you remember to rinse the sprouts regularly, or they can get moldy and gross. If you're smarter than me, you'll label your seed grid so that you can remember what is growing in the different areas of your sprouter. Below is my attempt at this, rendered useless when I planted the plants in random disorder. Image Notes 1. moist paper towel Step 3: Build Your Relays This was a lot more difficult before Sparkfun released their guide; y'all have it easy now:) I used Omron G5LE-1 relays, attaching wires with solder for the electrical connections and then adding hot glue around them for some structural integrity. As per this guide, you should make sure to run the white wire directly to the outlet / end of extension cord and the black wire through the relay. For this to be useful, you'll also need to make sure you plug your creation into the wall corectly: black wire to small slot... See photo 3 for a view of how you place the diode. Obviously, you're now dealing with more potential to hurt yourself: AC does not feel good! Oh, and there's no reason you can't use outlets or extension cords for both of these. I just switched it up for variety:) Image Notes Image Notes 1. to 120v ac from the wall 2. not used 3. to ac outlet: when digital i/o is high, this is switched on http://www.instructables.com/id/Arduino-Projects/ 1. this will plug into your wall 2. plug in lights or pump here 3. to a digital i/o pin on the arduino 4. to ground on arduino 5. to black wire from end of extension cord into which you plug things:) 6. to black wire from wall end of extension cord (middle pin from left side of relay) 7. not used for this circuit, the top right lead of the relay is normally closed; for our circuit, that means current flows through here when the relay is switched off 4. to ground on arduino 5. to a digital i/o pin on arduino Image Notes 1. lights plug into ac outlet 2. normal ac outlet, like on a wall 3. relay, viewed from above (leads down) 4. 120 volts ac: the wall plug in your house 5. ground 6. to digital i/o on arduino 7. diode (remember, the triangle points to the end with the band) Step 4: Build Your Moisture Sensor Your moisture sensor consists of galvanized nails some distance apart from each other in the same milk jug of soil. When the soil is more moist, the sensor will report a lower resistance. Solder a wire to the head of each nail, and be generous: this will be a structural connection as well as electrical. One nail wire gets connected to +5v on the Arduino, and the other goes to both an analog input and a resistor (then ground) Image Notes 1. 5v on arduino 2. an analog i/o on arduino 3. ground on arduino 4. 10k resistor Image Notes 1. solder 2. dirt on nails. appropriate, and kinda beautiful imho:) http://www.instructables.com/id/Arduino-Projects/ Step 5: Add temperature and light sensors The temperature and light sensors are easy: connect one end of each sensor to +5v on the arduino and the other end to both an analog i/o on the arduino and a 10k resistor. Then, connect the other end of the resistor to arduino ground and revel in your sensor-building skills. Image Notes 1. +5v on arduino 2. sensor: circuit is same for light and temperature 3. 10k resistor 4. ground 5. analog i/o on arduino Step 6: Make and Populate Your Soil and Planters Let your creativity run wild here, with a little advice: -Your inner pots (in my case, the milk jugs) should allow water to drain out and rest on top of bricks to provide space below them. I nearly killed some lettuce because of over-watering and a lack of drainage... thanks to ~20 nail holes on the bottom of the jug, the lettuce is now recovering nicely -Your outer planter should not leak, unless you really want water all over your house The soil I used is the Mel's Mix described in step 1. Mix all ingredients well to a consistent soil. Planting's basically a matter of burying the bottom half of your sprout in the dirt and hoping for the best. Be sure not to plant too densely (like I probably have); you can get recommendations on planting density via the back of your seed packets. Image Notes 1. little bit of mold: didn't have enough drainage initially... 2. milk jug cut at most of the way up the handle Image Notes 1. bricks; the milk jugs rest on these 2. yellowing leaf: soil too moist? http://www.instructables.com/id/Arduino-Projects/ Step 7: Test and Calibrate Your Sensors I loaded this code onto my Arduino to read sensors connected to analog pins 0, 1, and 2 and output values to screen: int moistureSensor = 0; int lightSensor = 1; int tempSensor = 2; int moisture_val; int light_val; int temp_val; void setup() { Serial.begin(9600); //open serial port } void loop() { moisture_val = analogRead(moistureSensor); // read the value from the moisture-sensing probes Serial.print("moisture sensor reads "); Serial.println( moisture_val ); delay(500); light_val = analogRead(lightSensor); // read the value from the photosensor Serial.print("light sensor reads "); Serial.println( light_val ); delay(500); temp_val = analogRead(tempSensor); Serial.print("temp sensor reads "); Serial.println( temp_val ); delay(1000); } Here are some values I maintained from my sensors: moisture (nails fully into soil at opposite ends of milk jug: nails touching each other: 985 nails in air, not touching: 0 soil that seems too wet: 889 soil that's totally dried out: 0 soil that's starting to seem too dry: 707 soil that seems about right: 826 light: indirect sun: 949 ambient indoor light at night: 658 ambient indoor light at night, hand casting shadow over sensor: 343 ~2 feet from grow light, at night: 832 ~2 feet from grow light, at night, hand casting shadow over sensor: 797 temperature (used temperature lead on multimeter to calibrate): 61 degrees Fahrenheit = 901 90F = 949 51F = 877 32F = 796 On soil moisture, it's kind of guesswork unless you get a fancy probe to compare its values to what your Garduino is outputting. Or, you could add a fixed amount of water to a known quantity of soil to figure out how resistance value varies with changes in water added... if you do, you'll want to mount the nails some fixed distance from each other (with some nonconductive material, obviously). Let me know if you do this! Image Notes 1. 1 moisture probe 2. the other moisture probe http://www.instructables.com/id/Arduino-Projects/ 3. thermistor and photocell are on here Step 8: Make Your Sensors Control Your Relays Based on the values you obtained in step 6, we're going to make our Arduino flip a relay on and off depending on light intensity. Here's the code I used: int moistureSensor = 0; int lightSensor = 1; int tempSensor = 2; int moisture_val; int light_val; int temp_val; void setup() { Serial.begin(9600); //open serial port pinMode (2, OUTPUT); pinMode (7, OUTPUT); pinMode (8, OUTPUT); digitalWrite (2, LOW); digitalWrite (7, LOW); digitalWrite (8, LOW); } void loop() { moisture_val = analogRead(moistureSensor); // read the value from the moisture sensor Serial.print("moisture sensor reads "); Serial.println( moisture_val ); if (moisture_val < 850) { Serial.println("turning on pump"); digitalWrite (7, HIGH); delay(2000); } if (moisture_val > 850) { Serial.println("turning off pump"); digitalWrite (7, LOW); delay(2000); } light_val = analogRead(lightSensor); // read the value from the photosensor Serial.print("light sensor reads "); Serial.println( light_val ); if (light_val < 850) { Serial.println("turning on lights"); digitalWrite (8, HIGH); delay(2000); } if (light_val > 850) { Serial.println("turning off lights"); digitalWrite (8, LOW); delay(2000); } temp_val = analogRead(tempSensor); Serial.print("temp sensor reads "); Serial.println( temp_val ); if (temp_val < 920) { Serial.println("turning on low-temperature LED"); digitalWrite (2, HIGH); delay(2000); } if (temp_val > 920) { Serial.println("turning off low-temperature LED"); digitalWrite (2, LOW); delay(2000); } } For my particular setup, here's the responses I received: -moisture-probe nails separated --> relay connected to output pin 7 flips, turning on anything plugged in to that plug. Relay should turn off when nails are touched together -light sensor: turns on relay connected to output pin 8 when shaded, off when bright light / indirect sunlight shining on sensor -temperature LED: turns off when you touch it for a few seconds or breathe steadily on it I hooked up LEDs to test the relay without blowing out my fluorescent bulbs by switching them on and off too quickly... http://www.instructables.com/id/Arduino-Projects/ Image Notes 1. sensor in direct light = digital i/o pin 7 low = red light on Image Notes 1. sensor in finger shade = digital i/o pin 7 high= green light on Step 9: Setup Your Lighting System An easy step here: after checking your light's working, plug it into the relay that will control it. I rested the light fixture on top of the outer plant container, but feel free to get fancy. Optimum distance from these fluorescents for the light intensity you want is just a few inches, so make sure you get them up close, personal, and adjustable as the plants grow Image Notes 1. cord runs to relay/outlet setup 2. light fixture rests on containers http://www.instructables.com/id/Arduino-Projects/ Step 10: Create A Self-Watering Setup You've got a wide variety of options here. Here's how mine works: -pump is activated by relay; relay is controlled by moisture sensors -pump moves water from 5-gallon bucket to chunk of milk carton -gravity moves water from chunk of milk carton down bike tubes directly to plants If you do a setup like this, be sure to elevate the bucket on a crate or something else: moving water a few inches vs. several feet vertically will greatly reduce the strain on your pump. I initially tried just using a sprinkler valve mounted to the bottom of a bucket, but gravity wasn't providing enough pressure for the water to flow beyond the slightest trickle. I thought about connecting the sprinkler valve right into my plumbing, but I worried the chlorine content of water straight from the faucet would be bad for my plants (chlorine evaporates from water within something like 24 hours). A better version of this would use 2 buckets, with water coming from sprinkler valve connected to house plumbing into one bucket, being held there 24+ hours, and then moving into the 2nd, plant-feeding bucket. The best version I can think of would use greywater and a little aquarium pump to make compost tea... have at it! Image Notes 1. pump and water in here 2. pump cord runs to relay-controlled extension cord Image Notes 1. bike tube connected to pump. i used one of those wires coated with white paper stuff that holds bread bags closed, but a ziptie, hose clamp, or anything else similar would also work 2. power cord for pump Step 11: Give Garduino Control Now that you've got everything built, it's time to let Garduino loose on your plant friends. Here's the code I used: //include the datetime library, so our garduino can keep track of how long the lights are on #include <DateTime.h> //define analog inputs to which we have connected our sensors int moistureSensor = 0; int lightSensor = 1; int tempSensor = 2; //define digital outputs to which we have connecte our relays (water and light) and LED (temperature) int waterPump = 7; int lightSwitch = 8; int tempLed = 2; //define variables to store moisture, light, and temperature values int moisture_val; int light_val; int temp_val; //decide how many hours of light your plants should get daily float hours_light_daily_desired = 14; //calculate desired hours of light total and supplemental daily based on above values float proportion_to_light = hours_light_daily_desired / 24; float seconds_light = 0; float proportion_lit; //setup a variable to store seconds since arduino switched on float start_time; float seconds_elapsed; float seconds_elapsed_total; float seconds_for_this_cycle; void setup() { http://www.instructables.com/id/Arduino-Projects/ //open serial port Serial.begin(9600); //set the water, light, and temperature pins as outputs that are turned off pinMode (waterPump, OUTPUT); pinMode (lightSwitch, OUTPUT); pinMode (tempLed, OUTPUT); digitalWrite (waterPump, LOW); digitalWrite (lightSwitch, LOW); digitalWrite (tempLed, LOW); //establish start time start_time = DateTime.now(); seconds_elapsed_total = 0; } void loop() { // read the value from the moisture-sensing probes, print it to screen, and wait a second moisture_val = analogRead(moistureSensor); Serial.print("moisture sensor reads "); Serial.println( moisture_val ); delay(1000); // read the value from the photosensor, print it to screen, and wait a second light_val = analogRead(lightSensor); Serial.print("light sensor reads "); Serial.println( light_val ); delay(1000); // read the value from the temperature sensor, print it to screen, and wait a second temp_val = analogRead(tempSensor); Serial.print("temp sensor reads "); Serial.println( temp_val ); delay(1000); Serial.print("seconds total = "); Serial.println( seconds_elapsed_total ); delay(1000); Serial.print("seconds lit = "); Serial.println( seconds_light); delay(1000); Serial.print("proportion desired = "); Serial.println( proportion_to_light); delay(1000); Serial.print("proportion achieved = "); Serial.println( proportion_lit); delay(1000); //turn water on when soil is dry, and delay until soil is wet if (moisture_val < 850) { digitalWrite(waterPump, HIGH); } while (moisture_val < 850) { delay(10000); //thanks to JoshTW for the following, important correction moisture_val = analogRead(moistureSensor); } digitalWrite(waterPump, LOW); //update time, and increment seconds_light if the lights are on seconds_for_this_cycle = DateTime.now() - seconds_elapsed_total; seconds_elapsed_total = DateTime.now() - start_time; if (light_val > 900) { seconds_light = seconds_light + seconds_for_this_cycle; } //cloudy days that get sunny again: turn lights back off if light_val exceeds 900. this works b/c the supplemental lights aren't as bright as the sun:) if (light_val > 900) { digitalWrite (lightSwitch, LOW); } //turn off lights if proportion_lit>proportion_to_light, and then wait 5 minutes if (proportion_lit > proportion_to_light) { digitalWrite (lightSwitch, LOW); delay (300000); } //figure out what proportion of time lights have been on proportion_lit = seconds_light/seconds_elapsed_total; //turn lights on if light_val is less than 900 and plants have light for less than desired proportion of time, then wait 10 seconds if (light_val < 900 and proportion_lit < proportion_to_light) http://www.instructables.com/id/Arduino-Projects/ { digitalWrite(lightSwitch, HIGH); delay(10000); } //turn on temp alarm light if temp_val is less than 850 (approximately 50 degrees Fahrenheit) if (temp_val < 850) { digitalWrite(tempLed, HIGH); } } Note the inclusion of the datetime library, which you can install from here. Place the contents of the file in the libraries directory of the arduino folder and you should be good to go. See the readme in the download if you run into problems. Monitoring needs to be greatly improved, as Garduino should sit there doing nothing most of the time when it's working properly. You should be able to pull the moisture sensors from the soil and have them turn on within a few seconds (air = 0 conductivity between them), but you can't do this with the light sensor: it's just trying to turn on for 16 hours every 24 hours. Currently, connecting your Arduino to your computer and then monitoring the serial port will give you some meaningful feedback. But, this is resetting the time counter to 0, so you don't get any useful historical data unless you leave the Garduino with a computer connected during the period you want to monitor... Image Notes 1. hit this button to monitor serial port 2. don't forget to download this! 3. i avoided pins 0 and 1 b/c of their weirdness with rx / tx Step 12: Reap your harvest Check your seed packets (you saved them, right?) to see when your plants should be mature, and harvest them by that date. But, don't be surprised if you've got them ready to go sooner! Save your bounty's seeds to replant, if you didn't plant some weird hybrid that doesn't produce viable seeds... http://www.instructables.com/id/Arduino-Projects/ Image Notes 1. woohoo! a bean grown in my window, in my mouth! Step 13: Share your results What excites me most about this project is the ability to trade information about growing things with conditions more controlled than is typical for gardening. So, please: participate! Build a better version of this, or buy it from somebody else, and let me know how it's working. Most importantly, let me know what settings or improvements produce greater yields for you! http://www.instructables.com/id/Arduino-Projects/ Step 14: Improve away! I mentioned some planned improvements in the introduction, and I'm sure you can think of a bunch more. Let me know what you build or want built! Happy planting! Image Notes 1. the yield from the better version you're gonna build:) Related Instructables Garduino Upgrade, Now with more Twitter! by natantus Raised garden bed design and demo (video) by lazlow69 Properduino When an Engineer Gardens - Part 1 - Le Propergator Watering System by grahamslawson Plantduino Greenhouse by clovercreature Raised bed for wet backyard (Photos) by lazlow69 Sheet mulching howto (video) by lazlow69 Autonomous Greenhouse Factory by pablopeillard Cold frame construction with recycled materials by marythomas http://www.instructables.com/id/Arduino-Projects/ Garduino Upgrade, Now with more Twitter! by natantus on November 14, 2009 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. I want to stay involved with education and the open hardware community. Intro: Garduino Upgrade, Now with more Twitter! A couple months ago I came across two great instructables. The first was the Garduino, an arduino controlled garden to help you grow plants at home. The second was the Tweet-a-Watt, a project that teaches you how to monitor your home power usage using Xbees and Twitter. I read about both these projects here at Instructables and in Make Magazine, Vol 18. I thought it would be great to combine both these projects and build myself an indoor garden that I could monitor from work via Twitter. Thus began an adventure in gardening and electronics that taught me a lot and took me much longer than perhaps it should have. Fortunately for you I'm going to write down all the steps so you can get started right away. Maybe you'll follow up with this project and upgrade your garden or use this as a guide to start on a similar project. Either way, I hope you'll let me know what you get up to. If you're ready then head to the next step and begin the process! Edit: Please see the code now posted on GitHub - https://github.com/chrisgilmerproj/garduino-upgrade Image Notes 1. Basil plant good for soups 2. Mint good for ... what isn't it good for? 3. Water bucket with pump 4. Foil keeps the light inside 5. Planter with lots of yummy soil 6. SEnsor board 7. Pump relay box 8. Light relay box 9. Arduino running it all 10. Power to all the good stuff here 11. Light for the plant from the "Hydroponics Store" 12. Starter kit for garden drip system Image Notes 1. Hadn't thought of the foil idea yet 2. Plants! They grow! 3. All the good upgrades for this project 4. Water ... note that it's not on my kitchen floor yet 5. Box of goodies Step 1: Gather your materials This project is really two projects in one. It is both a gardening project and a wireless project. But, as is true with any project, getting your materials will probably be the hardest part. This is because building can move along pretty fast once you have everything, but it's finding out you're missing the one crucial piece that always holds things up. Below is a list of web pages from my wiki with a list of all the parts you'll need. Go ahead and take a look, I've listed them with as much detail as I could and if I've left something out just let me know so I can add it to the list. Various Parts Lists: Garduino Parts List Relay Box Parts List Arduino Xbee Adapter Parts List I highly recommend you buy a couple extra parts here and there. You'll find, as I did, that they come in handy when you make a mistake. For the majority of the parts nothing is particularly expensive so buying a few extra things won't hurt. http://www.instructables.com/id/Arduino-Projects/ Step 2: Build your Garduino The Garduino Instructable is probably your best resource for starting this project. It has tons of great insights that will help you get started with your own arduino controlled garden. He has also put together a website with more pictures and a kit that you can get, but I chose to build this project with my own parts. When you get started you'll want to get some plants and a place to plant them. I recommend a local gardening store where possible. You'll pick up some healthy plants there and probably a few good tips on how to care for them. I picked up basil and mint, a couple plants I'd find useful to have for cooking. I also got an 8" x 18" planter with a matching dish to catch water. You can certainly go out and use tubs or custom pots, just choose what's right for you and your plants. Also, pick something that will look nice around your house if that's important to you. The first thing that is different about my project is that I was building an indoor garden. My apartment doesn't have a lot of light from any of the windows, nor does any good light fall on the patio. This changed a lot of the parameters for my garden. For one, I didn't need a light or temperature sensor, something I discovered after the fact, as my light will be constant from the fluorescent bulb and my temperature inside the apartment is pretty stable. I also learned that whether you choose to keep your plants inside or outside you should be aware of bugs. My first plants died because of spider mites, something I hadn't even thought of when starting this project. I found the solution was actually pretty easy, involving a spray bottle, a tiny bit of soap and water. It's a much cleaner solution, especially if you plan to eat your plants, and doesn't hurt the environment either. Image Notes 1. Basil plant good for soups 2. Mint good for ... what isn't it good for? 3. Water bucket with pump 4. Foil keeps the light inside 5. Planter with lots of yummy soil 6. SEnsor board 7. Pump relay box 8. Light relay box 9. Arduino running it all 10. Power to all the good stuff here 11. Light for the plant from the "Hydroponics Store" 12. Starter kit for garden drip system Image Notes 1. Defense against spider mites! Step 3: Upgrade #1: Remote Sensors One of my early upgrades to this project was to take the sensors off the arduino and put them closer to the plants. I wanted to do this primarily to keep the arduino as far away from the water and water pump as possible. The nice thing about this is that you can put your arduino somewhere accessible and safe and keep the sensors you want closer to the plants, where they are needed. Is this a good idea? Maybe, but I was happy to do it. My sensor was designed to have the temperature, light and moisture sensors onboard. Also, I included 2 red LEDs so that I could indicate if the plants were being watered or if the temperature went out of an acceptable range. Of course this was before I had decided to keep the plants indoors, so in retrospect I'd probably ditch the temp and light sensor and leave the LED on the arduino. Better yet I could have just used the onboard LED connected to pin 13 on the arduino. Then all I'd have is two wires leaving the arduino to act as the moisture sensor for the plant. Regardless, this was a fun part of the project and I learned a lot. You can download the schematic and board layout files I created. I decided to build the board by hand instead of having it manufactured for me primarily due to cost. http://www.instructables.com/id/Arduino-Projects/ Image Notes 1. All the sesors and lights that tell my arduino what the plant is up to 2. Down here are the nails that act as the moisture sensor 3. Nails act as the moisture sensors for the plant 4. The light was thankfully turned off for this photo Image Notes 1. A ton of resistors 2. LEDs tell me about the temperature and the pump 3. Temperature sensor 4. light sensor, pretty useless right here 5. Moisture Sensor wires File Downloads garden_sensor.brd (10 KB) [NOTE: When saving, if you see .tmp as the file ext, rename it to 'garden_sensor.brd'] http://www.instructables.com/id/Arduino-Projects/ garden_sensor.sch (69 KB) [NOTE: When saving, if you see .tmp as the file ext, rename it to 'garden_sensor.sch'] Step 4: Update #2: Relay Boxes The most important upgrade I think I made was to build real relay boxes to control my power to the light and the water pump. With water so close to the electricity I figured a safer approach was needed than the one used in the original Garduino instructable. Fortunately the author pointed out a great resource at SparkFun that I used to do the project. Finding the whole thing incredibly useful I wrote up another instructable on how I built my relay boxes and made it more generic for other projects where you might want an arduino to control power. Check out the Arduino Controlled Relay Box Instructable when you get a chance. At this point I decided to add on an arduino protoboard to my project so that I could have access to more power lines without having to solder together a new breadboard. You may choose to do something different, but this made things significantly easier, especially if I decide to do more modification later. If you don't do anything else with your Garduino definitely do this upgrade. It's definitely the most important. Image Notes 1. Test and Reset buttons 2. Extension cord wires 3. Nail mount housing hides in the shadows! 4. Control wires Image Notes 1. Nail mount housing 2. GFCI Outlet 3. Relay circuit completed 4. Hot wire disconnected from the extension cord 5. Extension cord Image Notes 1. Relay - 240/120V, 30A 2. Load connectors 3. Control connectors to Arduino 4. LED tells you its on or off 5. Diode to protect microcontroller 6. Transistor does all the hard work for no pay! http://www.instructables.com/id/Arduino-Projects/ Image Notes 1. Breadboard for circuit 2. Beefy Relay 3. Load connector 4. Control connector 5. Bright red LED 6. Transistor 7. Diode 8. Resistor 9. Resistors, same type Step 5: Upgrade #3: New Software Now it's time for the software upgrade. With an indoor garden I no longer had the need to have the entire project be automated within the arduino. The original arduino kept an internal clock and counted the amount of daylight from the light sensor against the number of seconds in the day. I found this to be more frustrating than it was worth once I moved inside and stopped using the light sensor. This was primarily because I found that the light cycle revolved around when I power cycled the arduino, having no way to set the internal clock myself. In fact I thought I could do a better job regulating the time from my laptop. Not only would the light only be on at night and in the morning when I wouldn't care, but I could reset the arduino power at any time and it wouldn't change this schedule. The added advantage to this method would be that I'd also be able to record the sensor readings from the garden to look at them later. To get started you have to know that the arduino can talk over a serial connection to your laptop. You probably already knew this, but what you may not know is that you can use the Python programming language to read and talk to the arduino. This is great because it opens up all sorts of tools for you to use when interacting with your arduino. For this you'll need to download and install the following: Arduino IDE (0017 or later) Python (preferably 2.6.X or later) PySerial Library At this point I also want to direct you to the Arduino Controlled Servo Robot project by Oomlout. My methods roughly follow what I learned there. The basic premise is that you'll be sending a command from the laptop to the arduino every 15 seconds. The arduino will decode this message, check that it is a correct message, and then the arduino will use the commands to manage the garden. If no message is received then no new actions will be applied to the garden. I choose to send a command that looks like this: "+++lw". The arduino can tell if the message is correct by reading that I have included the "+++". Then I pass the letters 'l' and 'w'. If the 'l' is lower case then it tells the arduino to turn off the light. If the 'l' is an uppercase 'L' then the light will come on. Easy, right? The 'w' is trickier. I have included some safety protocols in my software. The arduino will only turn on the pump for a maximum of 5 times for 5 seconds each time. You may wonder how a plant will live on only 25 seconds of watering. Well I reset the counter every 4 hours. This way the plant will continue to get water and my kitchen will not continue to get flooded. The 'w' as a lower case tells the arduino nothing useful, but if I change the 'w' to an uppercase 'W' then the pump counter will reset to zero and the arduino can again water my plant if it's necessary. Make sense? You may want to something slightly different, but this worked for me. http://www.instructables.com/id/Arduino-Projects/ Instead of including the code in the text here I've decided to include files. You should be able to open these with your Arduino IDE for the arduino code and with IDLE or a text editor for the Python code. File Downloads garduino_twitter.py (7 KB) [NOTE: When saving, if you see .tmp as the file ext, rename it to 'garduino_twitter.py'] garduino.pde (4 KB) [NOTE: When saving, if you see .tmp as the file ext, rename it to 'garduino.pde'] twitter.py (45 KB) [NOTE: When saving, if you see .tmp as the file ext, rename it to 'twitter.py'] Step 6: Upgrade #4: Wireless Control Now comes the exciting part! It's probably not likely that you can leave your computer connected via USB to your arduino all day long in your kitchen. If you can that's great, but I need my laptop in my office where I find it useful. This is where my experience with the Tweet-a-Watt came in handy. Early on I decided to use Xbee wireless devices to talk between my computer and the computer. Now I apparently did things the hard way because I thought you'd need to send the data through the Xbee controller from the arduino and then decode it on the other end with the Xbee Python library. This turns out to be completely untrue. You certainly can do it this way, but it's way harder than simply using the Xbee modules as a direct serial link to your computer. It may have taken me hours, but this step shouldn't take you very long once you've set up your Xbees. Essentially you remove the USB cable between your computer and the arduino, hook up your Xbee modules (one to the computer via an FTDI cable and one to the arduino via tx/rx lines), and then continue as though you were still using the USB cable. Don't believe me? Try it. Maybe this was obvious to other people but it was pretty exciting when I figured it out. Now I should tell you there are several steps to doing this whole wireless step. You need to first purchase and assemble the Xbee modules. Then you'll want to program each of the Xbee chips and finally connect them up. The best resource I found for setting up my modules was actually a tutorial about Wirelessly Programming your Arduino. I decided to set up my arduino to be wirelessly programmed so that I could easily update the code from my laptop when I needed to upgrade my arduino. This was an added bonus to being able to wirelessly talk to my arduino via serial and it just seemed to sweeten the whole project. I also found this made some of the debugging easier since I needed to do a lot of writing and rewriting to the arduino. http://www.instructables.com/id/Arduino-Projects/ Image Notes 1. Xbee module for computer 2. FTDI cable to computer 3. Arduino Duemilanove 4. 9V power from wall 5. TX/RX lines to Xbee module 6. Xbee module for arduino 7. Electronics to program arduino remotely and hit the reset 8. Power! Step 7: Update #5: Twitter your Garden Now you've got your garden all hooked up to your computer and talking wirelessly to the computer. You may even be recording your data to a file to look at it later. What you may not be able to do yet is monitor your plants while you're at work. To do this I employed Twitter, much like the Tweet-a-Watt did. I signed up for an account that I could use for testing, @chrisgilmertest. Then I hooked my code into the Python Twitter API, entered my user name and password, and voila! I was done. I set up my twitter to send back the readings for the different sensors and the current time. I know you can track the time you posted, but I wanted the time from my computer. I also decided to have it tweet every half hour. When I originally was programming this I had it tweet every 5 minutes, which was good when I wanted to ensure it was actually working, but got annoying to follow pretty quick. I may actually have it tweet every hour or couple hours in the future. You get to decide what you want for yourself and go from there. I have asked friends to help me come up with some silly messages for my garden to tweet, based on the sensor readings, so maybe I'll get some snarky comments up there soon. You may have noticed that this code was already provided to you earlier in this Instructable. My hope was that you got excited and already started to play with it. If not, what are you waiting for? Image Notes 1. I like to time tag all of these 2. I think my garden has not put out more tweets than me 3. People are already following my garden! Image Notes 1. Arduino and protoshield 2. Sensor board 3. Xbee module set up temporarily on a protoboard 4. Pump outlet 5. Light outlet 6. Too many wires! http://www.instructables.com/id/Arduino-Projects/ Step 8: Useful project notes I learned a bunch of useful things while doing this project and I wanted to make sure I captured them here for you. Hopefully I've written them all down because they are mighty handy: Plants: When it comes to plants remember that they are indeed alive. They are also tasty, not just to you but often to other things as well. My first plants were eaten by cats and then destroyed by spider mites. I never would have thought about this during the planning stage of the project and it definitely cost me a few extra bucks to replace them. Lighting: Plants need light and it can be tough finding the right set of lights. There is plenty of information out there about lights for growing plants but it turns out to be incredibly difficult to find these lights at a local hardware store. It took me a while but after asking around I was directed to a Hydroponics Store. You know the kind (wink, wink), and they hooked me up in no time at all. Pun partially intended. The people were great at the store and definitely reminded me of why I like to buy local when possible. Water: You've got to be really careful when you get started with automatically watering your plants. The soil resistivity will change dramatically as you first start to water it, meaning your calibration of the sensors will be difficult. I found this out the hard way when my pump decided to water not only my plant but my entire kitchen. It's better to program in some safety catches in the software to prevent this. My plants will only water for up to 30 seconds at four different times in the day and no more. It may be different for you, but be warned. Wireless Programming: You may have set up your arduino to be wirelessly programmed. I did and I found the only annoying thing is that I'd reset my arduino when I reset my computer. Turns out I was flipping the reset line on the arduino via the Xbee. The easiest solution to fix this was to disconnect the reset line whenever I didn't want to reprogram. I could still leave the other electronics in place, but removing the reset line fixed the problem without having to disassemble anything else. Final Comments: I had a lot of fun building this project. I learned a lot along the way and I hope to have some delicious plants for eating after all this work. I hope you found this project interesting and useful for upgrading your own Garduino. If you do follow any of the upgrades in this project let me know and tell me how they worked out for you. You can always ask for more information or check out my website for more information. I keep a blog, a project wiki, and an svn repository with the latest code. I also have a set of photos you can look at. Hopefully it's all up to date and full of resources to help you out. Good luck with your project! PS - If you like this project please vote for it in the "Arduino Contest" and help me win! Image Notes 1. Basil plant good for soups 2. Mint good for ... what isn't it good for? 3. Water bucket with pump 4. Foil keeps the light inside 5. Planter with lots of yummy soil 6. SEnsor board 7. Pump relay box 8. Light relay box 9. Arduino running it all 10. Power to all the good stuff here 11. Light for the plant from the "Hydroponics Store" 12. Starter kit for garden drip system http://www.instructables.com/id/Arduino-Projects/ Related Instructables Tweeting Pet Bowl by swimray5 Image Capturing Bird Feeder by quasiben The Twittering Office Chair by randofo Wireless Altoids Display by Alexdlp Twitter Mention Mood Light by pdxnat Tweet-a-watt How to make a twittering power meter... by adafruit simpleTweet_01 python by pdxnat Tweet-a-Pot: Twitter Enabled Coffee Pot by frenzy http://www.instructables.com/id/Arduino-Projects/ n: how to make a multi-layered acrylic and LED sculpture with variable lighting levels by slight on November 14, 2008 Intro: N: how to make a multi-layered acrylic and LED sculpture with variable lighting levels Here you can find out how to make you very own n as made for the exhibition www.laplandscape.co.uk curated by art/design group Lapland. More images can be seen at flickr This exhibition runs from Wednesday 26 November - Friday 12 December 2008 inclusive, and had a private view on Tuesday 25 November. Each participant has been asked to make a letter each of the 'laplandscape' portion of the web address. On the website each letter will link to related web contributions from each participant. This instructable is our web exhibit for this exhibition. This n is an art work and experimental and these instructions should be treated as such! The n takes the form of 5 layers of laser cut acrylic, 3 of which have LEDs in them. The front panel has the outline of a letter n etched in it. 3 knobs control the LEDs and fade them between the ones inside and outside the outline of the n being on, on each layer. There are no doubt simpler ways if wiring up the LEDs to do the same thing but, as all the exposed components etc are a big part of the aesthetic, we decided to do it this way. Enjoy! Step 1: Gathering parts Electronics 150 x LED's - Yellow 150 x carbon film resistors - 0.5W 68ohm 5% 6 x transistors 3 x 22k pots 3 x knobs 1 x arduino decimila 4 x stripboard pin strip Stuff 5 x 3mm acrylic sheet 610mm x 610mm small white cable ties 4 x 400mm M10 stud 38 x M10 nuts 4 x M10 dome nuts http://www.instructables.com/id/Arduino-Projects/ Power 1 x regulated power supplies 4.5volts 1400ma 1 x regulated power supplies 7.5 volts Consumables solder super glue araldite Image Notes 1. DC power in http://www.instructables.com/id/Arduino-Projects/ 2. USB 3. jumper set to use external power supple, as apposed to USB power. 4. analog inputs 5. 5voly output used for pots 6. PWM pin 3 7. PWM pins 5 and 6 8. PWM pins 9, 10 and 11 9. Ground 10. Ground http://www.instructables.com/id/Arduino-Projects/ Image Notes 1. set to 7.5V for arduino set to 3.5v for LED power Image Notes 1. yellow 2. gray 3. white Step 2: Gathering tools tools soldering iron damp sponge solder sucker snips screwdriver tape measure or ruler strip breaker work surface 'steady eddie' multi-meter hacksaw spanner cable stripper (though I prefer just to use the snips) Image Notes 1. steady eddie 2. snips 3. screw driver 4. tape mesure 5. solder sucker 6. soldering iron (temperature controlled is best) 7. strip breaker 8. heat proof work surface; or dining table http://www.instructables.com/id/Arduino-Projects/ 9. damp sponge Step 3: Preparing artwork In order to laser cut the acrylic sheets first you need to prepare the vector files. To do this we used Adobe Illustrator CS3, though any vector based software would suffice. Files for each layer will be added below shortly, but the instructions explain how we made the files so that you could create your own. The pdf file has the 5 layers saved and named as below Front Sheet 1 Sheet 2 Sheet 3 Back Sizing The first step is to measure the components that will be used, to make sure we create shapes the correct size. To do this we used a set of digital callipers. Our 3mm LEDs were 2.9mm dia. The pots were 7mm. Holes to enable LEDs and attached wires to be pushed through easily from one layer to the next needed to be 5mm. Holes to take stud 10mm. And screw fixing "key hole" 15mm were at biggest and 6mm at smallest Layout Make sure you save your file at regular intervals. We called our source file source layers. Next layout the basic shape in Illustrator. We are using a 400mm x 400mm square with rounded corners, radius 18mm. Centered within that is a lowers case n; font myriad overall height 337mm. This should be converted to outlines in the file. We specified a line thickness of 1mm and no fill. We then expanded the stroke to make it a solid object. The 4 x 10mm dia. circles should be placed with the centre 20mm from top and side edge closest, so that they sit squarely in each corner. This layer is named sheet front, and then duplicated and the new layer is named sheet 1. Next work on sheet 1, but have sheet front visible but locked. Save the file regularly. Delete the outline of the n on sheet 1. Then place 50 x 2.9mm dia. circles within the outline of the letter ,and 50 x 2.9mm dia. circles outside the letter. Distribute them fairly evenly across the layer, but concentrate the ones outside the letter near the perimeter of the letter. Duplicate sheet 1 and name the new layer sheet 2'. Hide and lock sheet 1. ' sheet 2 will be the next layer back in the sculpture. The circles on sheet 2 should be resized to be 5mm dia. These will be used to thread the wires through to the LEDs on sheet 1. Place another 50 x 2.9mm holes within the letter and 50 x 2.9mm outside the letter on sheet 2. Distribute them evenly across the layer similar to before. Make sure that the new holes are not overlapping, or too close to, the previous ones. This layer should then be duplicated and the new layer named sheet 3. Hide and lock sheet 2. The 2.9mm circles on sheet 3 should be resized to be 5mm dia. Then place another 50 x 2.9mm holes within the letter and 50 x 2.9mm outside the letter on sheet 3. Again make sure the distribution is fairly even and no holes overlap with previous ones. Duplicate sheet 3 and call the new layer sheet back. Hide and lock sheet 3. Delete all the holes except the 10mm ones in the corners on sheet back. You now have the basic layout that will allow you to place a maximum of 300 LEDs over the 3 layers. Details We then added some further details. We selected all the holes on sheet 3 and copied them and pasted them onto sheet front. We then replaced each one with a little concentric circle pattern to act as diffusers in front of each LED. We expanded these in the same way as the n to create thick lines. On sheet 1, sheet 2, and sheet 3 we added a tab to each at the bottom for the pot and knob. We added a circle for the hole for the pot and a rectangle for the locating pin. On sheet back we added keyholes to allow us to attach it to the wall with screws. Saving To save these drawings as separate files we saved the source file as sheet front.ai,sheet 1.ai, sheet 2.ai, sheet 3.ai and sheet back.ai using the 'save as' command. These files were then opened and the other layers in the file deleted so that the file sheet 1.ai only has the layer sheet 1 in it and the file sheet back.ai only has the layer sheet back etc. http://www.instructables.com/id/Arduino-Projects/ File Downloads sheets for n.pdf ((1191x1417) 376 KB) [NOTE: When saving, if you see .tmp as the file ext, rename it to 'sheets for n.pdf'] back.eps ((1136x1136) 313 KB) [NOTE: When saving, if you see .tmp as the file ext, rename it to 'back.eps'] sheet 1.eps ((1334x1136) 339 KB) [NOTE: When saving, if you see .tmp as the file ext, rename it to 'sheet 1.eps'] sheet 2.eps ((1334x1136) 366 KB) [NOTE: When saving, if you see .tmp as the file ext, rename it to 'sheet 2.eps'] sheet 3.eps ((1334x1136) 393 KB) [NOTE: When saving, if you see .tmp as the file ext, rename it to 'sheet 3.eps'] Step 4: Laser cutting preparation To use the vector files created in the previous step with the laser cutter we had access to (laserpro 3000) we exported them as EPS files (version 8). Our laser cutter is located in our local Art School and many educational institutions have ones that will do work for members of the public at a cost. Look for places near you with engineering or product design courses if you want to try using one. These instructions refer to the laser cutter we used, but most of the steps will be similar across many brands of cutters. The EPS files were transferred to the computer attached to the laser cutter and opened in Corel Draw 13. This is what is used to print to the laser cutter. In Corel Draw the cut lines in each file were set as 'hairline'. Then colours are selected for the objects to define the cut order. In this case anything black was cut first, red next, then green, yellow after that. On sheet 1,sheet 2, sheet 3, and sheet back we set the internal pattern of holes to cut first, then the corner, pot, and keyholes holes next, then the outline of the whole piece last. The speed was set to 1.7% and power to 100%. The page size was set to just bigger than the whole drawing. On sheet front we set the etching to go first, then the corner holes, then the outline of the whole sheet. Page set up was similar to other layers. The etch settings were 100% speed and 30% power. In the printer page size setting we set the size to the same as the page size of the document and set it to 'relative' so that we could determine the zero-point to start cutting from. NOTE: To select the correct power and speed settings for etching and cutting we first found the recommended levels for this machine and 3mm acrylic, and then did 'bracketed' tests either side of these figures on a spare bit of acrylic. It is always worth testing, as machines can vary over time and with use. http://www.instructables.com/id/Arduino-Projects/ Image Notes 1. EPS file in Corel Draw for sheet 3. Step 5: Laser cutting We placed the first piece of acrylic on the bed of the laser cutter and then focused the cutter. We set the cutter head to just inside the top left corner of the bit of acrylic. A red dot of light on the material you are cutting shows where the head is set to. Then the lid gets closed, the extractor started to remove any fumes during cutting, and the file is printed from the Corel Draw document to the laser cutter 'printer', using the print preview to do a last minute check before printing. The file then spools to the laser cutter and details of it appear on the screen on the front of the machine. If the cutter is focused, lid down, and extractor on, then you can now press start and the laser cutter will start cutting your file. Once it has finished switch off the extraction and open the lid to retrieve the acrylic. On this machine we pressed delete and delete to remove the file before sending the next file to print. We repeated with each of the further 4 files until all layers were cut and etched. You should re-focus the cutter each time to ensure a correct cut. The etching took around 50 minutes to complete. The cut sheets around 8, 10, 13 and 4mins. Then, handling them using white cotton gloves, we cleaned the sheets with a window cleaning spray to remove finger prints and other marks. http://www.instructables.com/id/Arduino-Projects/ Image Notes 1. Laser Cutter 40W Mercury 2. Extractor 3. Extractor switch Image Notes 1. Laser head Image Notes 1. Small etched section http://www.instructables.com/id/Arduino-Projects/ Step 6: Electronics The next step, now you have the acrylic sheets, is to make up the LEDs and control circuits. We decided to put 50 LEDs on each layer not the full 100 that we have enough holes for. After testing we decided 50 was enough and liked the way that the LEDs reflected internally within the acrylic to light up the 'empty' holes, but you could do the full 100 on each sheet if you wanted. stripboards First use the "strip cutting tool" to create the breaks on the strip board as needed. Next solder 50 resistors in two groups of 25 at each end. In each block of 25 we did them in smaller blocks of 5 for spacing purposes. Now solder the 2 transistors onto the strip board. Then run a line of solder down the board to join all the strips with resistors to each other and to where the positive supply will come in. You could also do this with wire if you prefer, joining each strip to the next. Next solder the transistors onto the stripboard. After that use a multimeter to make sure that there are no short circuits between strips. Then do a multimeter test to check that all the resistors were soldered correctly by putting one contact on the positive line of solder and the other on the other side of the resistor. Then cut the wires, you will need 100 wires for each 50 LEDs. We used yellow and white to differentiate between positive and negative. We cut the wires for the sheet 3 to 300mm each, for sheet 2 and sheet 1 we cut them to 800mm. The yellow wires should be soldered to the positive side of the circuit, beyond the resistors. The white ones are soldered in a cluster in the area not connected to the positive line of solder. Having attached all the components to the strip board, now solder the LEDs to the ends of the wires. Yellow to the long pin, white to the short pin (and flat edge). We shortened the length of the pins before doing this, making sure to keep the pins different lengths so we knew which side was which. Repeat another two times so that you have three identical boards. Image Notes 1. done 2. doing 3. to be done Image Notes 1. cutting the breaks in the stripboard http://www.instructables.com/id/Arduino-Projects/ Image Notes 1. checking for a lack of continuity Image Notes 1. resistors Image Notes 1. 25 resistors 2. 25 more resistors in blocks of 5 Image Notes 1. first bit of soldering 2. resistor 'legs' Image Notes 1. transistor Image Notes 1. transistor http://www.instructables.com/id/Arduino-Projects/ Image Notes 1. 50 resistors and 2 transistors Image Notes 1. yellow wires to the long pin Image Notes 1. then white wire to the short pin Step 7: Arduino program Next we need a way of controlling the LEDs. We used an Arduino development board, as we have been playing around with them a bit for various projects. Initially download and install the arduino software, which is available for; Windows, Mac OS X, Linux (32bit) and Linux (AMD 64bit). After installing we used the following code: (download the .pde file below) /* opening 'n' version 1.2 3 sets of 2 led's fadding from one to other via pot */ int ledPin1a = 11; //led 1 a int ledPin1b = 10; // led 1 b int ledPin2a = 9; //led 2 a int ledPin2b = 6; // led 2 b int ledPin3a = 5; // led 3 a int ledPin3b = 3; //led 3 b int PotPin1 = 1; //set variable to value of analog pin 1 int PotPin2 = 2; //set variable to value of analog pin 2 int PotPin3 = 3; //set variable to value of analog pin 3 int value1 = 0; int value2 = 0; int value3 = 0; int ledValue1a = 0; int ledValue1b = 0; int ledValue2a = 0; int ledValue2b = 0; int ledValue3a = 0; int ledValue3b = 0; void setup() { pinMode(ledPin1a, OUTPUT); pinMode(ledPin1b, OUTPUT); pinMode(ledPin2a, OUTPUT); pinMode(ledPin2b, OUTPUT); pinMode(ledPin3a, OUTPUT); pinMode(ledPin3b, OUTPUT); Serial.begin(9600); value1 = analogRead(1); value2 = analogRead(2); value3 = analogRead(3); } void loop() { value1 = analogRead(PotPin1); //read value of PotPin1 http://www.instructables.com/id/Arduino-Projects/ ledValue1a = value1 /=4; ledValue1b = 255 - ledValue1a; analogWrite(ledPin1a, ledValue1a); analogWrite(ledPin1b, ledValue1b); value2 = analogRead(PotPin2); //read value of PotPin2 ledValue2a = value2 /=4; ledValue2b = 255 - ledValue2a; analogWrite(ledPin2a, ledValue2a); analogWrite(ledPin2b, ledValue2b); value3 = analogRead(PotPin3); //read value of PotPin3 ledValue3a = value3 /=4; ledValue3b = 255 - ledValue3a; analogWrite(ledPin3a, ledValue3a); analogWrite(ledPin3b, ledValue3b); Serial.print(ledValue1a); } //works nice, straight fade, one high other low. This then needs to be uploaded via USB to the arduino board. Having the serial.print function enabled means that it is possible to see the value being created by pot 1 which is good for testing and debugging. Having completed upload and testing you then unplug the USB and move the jumpers to enable the arduino to use a external power supply rather than the USB. File Downloads sketch_n_v1_2.pde (1 KB) [NOTE: When saving, if you see .tmp as the file ext, rename it to 'sketch_n_v1_2.pde'] Step 8: Arduino board The Board The Arduino now needs the inputs, outputs, power connections and grounds attaching. The wiring diagrams are in the images below of the whole wiring set-up and also one of the stripboards, and the photos have notes on them to show how this corresponds with the actual board. We are using 3 analogue inputs from the pots and 6 digital outputs to the stripboards, with pulse width modulation (pwm). There are 3 grounds coming back to the board from the 3 stripboards. There is 3v power from one supply to the 3 stripbaords, and 7.5v power to the arduino board from another power supply. http://www.instructables.com/id/Arduino-Projects/ Image Notes 1. DC power in 2. USB 3. jumper set to use external power supple, as apposed to USB power. 4. analog inputs 5. 5voly output used for pots 6. PWM pin 3 7. PWM pins 5 and 6 8. PWM pins 9, 10 and 11 9. Ground 10. Ground Image Notes 1. pin strip 2. arduino Image Notes 1. pin strip attached to strip board and put into the arduino inputs and outputs Image Notes 1. 22k Pot http://www.instructables.com/id/Arduino-Projects/ Image Notes 1. + to LED's 2. Ground from LED's 3. Break in strips 4. Inside of 'n' other side is outside of 'n' 5. transistor Step 9: Assembly The LEDs now need to be threaded through the layers. We attached the layers (sheet 1, sheet 2, and sheet 3) together on the stud, leaving plenty of room between the layers, enough to get our hands in between them. Use a nut either side of each layer to keep them from moving around. We wore cotton gloves to handle the sheets, to stop any greasy marks getting them that we wouldn't be able to clean off once they were filled with LEDs. Take a board with LEDs and thread them through the larger holes in sheet 3 and sheet 2 into the smaller ones into sheet 1. The LEDs should stay neatly in the holes as they were measured to fit at the cutting stage, but if they don't then use a small dab of glue to hold them in place. You may need to print out the EPS files so that you can work out which ones you are working with on each layer. Using a marker on the drawings to highlight which dots are the target ones may help. Remember if you are using less than 100 LEDs on each sheet then you will have to choose which of the holes you thread the LEDs through into. Then take the next board with LEDs and thread them through the large holes in sheet 3 and fit them into the small holes on sheet 2. Again they should just hold in place, but use glue if not. With the last board you just need to fit the LEDs into sheet 3, gluing as necessary. This will get a bit fiddly as you do the LED threading, you may need to turn round the whole sculpture to get in at different angles. If you have a friend with small hands enlist their help at this point. Pots need fixing to the three tabs next, fit them through and tighten up making sure the locating pin goes in the slot that was cut. The back layer should go on next, we put small plastic 'feet' onto the backs of the strip boards, to space them from the back layer. Then we glued these feet onto sheet back layer. Thread the power and ground cables back through some of the spare larger holes, or if you don't have spare holes use a small cable tie to bunch them together. The layers can now be spaced more closely together. Measure between the layers to get them level. We had a gap of 6cm between layer front and layer 1, and then 9cm between both layer 1 and layer 2 and layer 2 and layer 3, then 15cm between layer 3 and layer back. This gives a rough dimension of 40cm deep. The knobs need to be attached to the pots, we used a G-clamp and tightened it gradually to push them on gently. Make sure you alighn the mark/dot/line on the knob with the small mark you will find on the pot. http://www.instructables.com/id/Arduino-Projects/ Image Notes 1. threaded wires Image Notes 1. LEDs pushed into holes Image Notes 1. wires threaded through bigger holes through to next layer 2. LEDs fixed into small holes Image Notes 1. wires threaded through from one layer to the next Image Notes 1. pot fixed through the hole on the 'tab' http://www.instructables.com/id/Arduino-Projects/ Step 10: Hang on a wall We were hanging on a chipboard wall in a gallery so to attach it we used 4 self-tapping screws (No. 8 x 50mm). We measured the location of the 'keyholes' on sheet back and then marked out those onto the wall with pencil using, a plumb line and spirit level to make sure they were square. We then drilled pilot holes for the screws, and screwed the screws into the holes leaving 1cm of the screw protruding. This is the depth of the back nut on the threaded bar. Two people held the n up to the wall and guided it onto the screws and then slid it down to that it locked into the small part of the keyholes. The n will sag a little at the front under the weight of itself. This could be minimised by having the layers closer to each other than we have suggested, so that the whole piece wasn't so deep, but the movement is minimal. We drilled a small hole into the chipboard wall and threaded the power cables though this so that they were hidden from view. And plugged it in. And then it was finished. Image Notes 1. Screw Image Notes 1. wire through wall Image Notes 1. 4 screws 2. power cables 3. power cables at top of wall 4. collection of tools on plinth for 'd' 5. David Bellingham 's' http://www.instructables.com/id/Arduino-Projects/ Image Notes 1. 7.5v for arduino 2. 3v for LED's Step 11: Twiddle the knobs Having installed the 'n' all that is left to do is to twiddle the knobs and enjoy the effect of reflections and total internal reflection. Related Instructables Arduino Examples #1 Make An RGB Led Randomly Flash Different Colors by qazwsx755 Flicker up to 6 LEDs with Arduino by gotcha99 Arduino running LEDs (video) by robot1398 ArduinoPowered Game'n'Watch Alarmclock (Photos) by m_frey Controlling an RGB Led with Arduino and Processing by smitec08 Arduino Binary Clock (Photos) by Macgyver THX Arduino RGB led controller by sapc Arduino 4x4x4 LED Cube by Phogie7 http://www.instructables.com/id/Arduino-Projects/ Ardu-pong! the Arduino based pong console by kyle brinkerhoff on October 25, 2010 Author:kyle brinkerhoff instructibles hi i enjoy making ludicrisly over the top and complex devices.... only thing that helps with the ADD..... Being an ameture engineer, I refuse pick the easy option, but rather the one that seems best, which inevitably devolves into a weekend of hacking, cursing, and setting things on fire, with a best case of eventually restoring the object of interest to something resembling a functioning state Intro: Ardu-pong! the Arduino based pong console A while back the instructables robot made a post on Facebook about some guys who played pong on an Arduino (http://wayneandlayne.com/projects/video-gameshield/games/#pong) but after looking around, i saw that everyone who did this was only worried about making it work. and often resulted as a very hard to use system with only potentiometers to use as controllers. so in my attempt at this, i decided that it needs to be much more polished if it is ever to be something of use. so heres how i did it: UPDATE! ive managed to shink it down into an entire atari themed mint tin! check it out here Step 1: Get the stuff. so to do this, we are going to need a couple of things. first off, we obviously need an Arduino, we are also going to need an atari joystick, a rs232 socket, a rca jack, 1Kohm resistor and a 330 ohm resistor, a switch for power, and something to cram all the guts into , i decided to use a busted digital tv receiver as my enclosure Step 2: Hack the enclosure. now take your chosen enclosure and take it apart and remove all the circuit boards and junk you otherwise will not need, then mount your Arduino against the backside of the enclosure and drill a hole large enough for a usb cable to fit through, then cut out a hole for the serial port to be mounted through. Image Notes 1. Arduino, is there anything you cant do? http://www.instructables.com/id/Arduino-Projects/ 2. little scrap of plex to raise it up so the ports would come out on a existing hole Step 3: Install the rca jack. before we install the rca jack we need to freeform the following circuit off of the pins of the rca jack . then we can drill a hole in the back of the enclosure for the rca jack to come through and then glue it in place. Image Notes 1. freeform the circuit here Step 4: Wire the serial port now we have to wire the serial port to the pins on the arduino so we can get input from the joystick. so using the following pinout, connect the following to the corresponding pins on the Arduino pin1 up, to Arduino pin 7 pin2 dn, to Arduino pin 6 pin6 fire,to Arduino pin 2 http://www.instructables.com/id/Arduino-Projects/ Step 5: Wire the rca jack this is pretty simple just connect the 1kohm resistor lead to pin9 and the 330kohm resistor lead to pin8 Step 6: Software now we need to download and install the tvout library for the Arduino sdk here and once you have done that i have modded a version of pong for the arduino to take our input from the joystick you can get right from this instructable. btw thanks pete File Downloads ardupong.txt (6 KB) [NOTE: When saving, if you see .tmp as the file ext, rename it to 'ardupong.txt'] Step 7: Congratulations!!! your done (almost). now just install your power switch anywhere you'd like and wire it to control the power to the arduino, im not going to explain this, if you've gotten this far Im pretty shure you can handle it. then assemble the enclosure, plug in the controller, upload the code, and plug it into the tv. if it worked you'll see somethin like this : http://www.instructables.com/id/Arduino-Projects/ Step 8: UPDATE: hey all, this is the follow up on my original ardupong instructable, as always its about making the hardware better, the software stays pretty much the same. so in this instructible i got the idea at work when I came across these video game console themed candy tins and i saw an atari joystick and thought to myself "hmm i bet i could turn that into the real thing" so i bought the mints and ordered the smallest arduino i could find and waited a week, and this was the result: Image Notes 1. ugly hole cut into tin:\ http://www.instructables.com/id/Arduino-Projects/ Related Instructables Arduino MIDI-in shield by carkat 2 player Pong using Arduino by duboisvb USB grass charging station by Elite Noob A different design of "helping hands" by frank113 How to back-up DVD's for Noobs ( With Video ) by sweny knex famas (Photos) by KNEXFRANTIC Fairly Simple Simon - the evolution of an Arduino game by thedod Xbox 360 music/headphone/mic rig by To-Rail http://www.instructables.com/id/Arduino-Projects/ Arduino Laser Tag - Duino Tag by j44 on November 7, 2009 Intro: Arduino Laser Tag - Duino Tag Duino tagger- General introduction Duino tag is a laser tag system based around the arduino. Finally a laser tag system that can be tweaked modded and hacked until you have the perfect laser tag system for office ordnance, woodland wars and suburban skirmishes. Laser tag is combat game like paintball or airsoft without the pain, it uses infrared light (IR) to simulate the tagging / shooting of other players or targets. I have been working on this project for a while, but don't see it as over, I just though it was time to get more people involved. Hopefully this instructable will be near enough finished in time for me to enter it in the arduino competition, although I expect the instructable will need editing and tweaking for some time to come. This instructable aims to provide you with the information you will need to go out and build your own duino tagger. This instructable focuses on how to build a duino tagger by modifying a light gun but with a bit of extra work you could build you own gun from scratch. This instructable does not look in too much detail at the software / code side of the project, although a working code based on the miles tag protocol is provided. For those wishing to learn about duino tagger programming I suggest you start at the excellent tutorials found at A Terrible Idea. Thoes experience arduino users will probably find the overview page (Step 1) and code pages (Step 8) the most useful, newer arduino users may need to take a closer look at the instructable and the links provided. I hope many of you will find this instructable useful and will go on to build your own duino taggers. There is much scope for improving and upgrading this system outlined here. If you do go on to improve on this duinotagger please share your work and hopefully in time the system will evolve into a much richer gaming experience. Youtube videos of my duino taggers: This video shows me using the second duino tagger I made to shoot at a talcapult target I have been working on. I hope to make an instructable about the talcapult soon. Image Notes 1. Arduino Nano 2. Battery http://www.instructables.com/id/Arduino-Projects/ Image Notes 1. The Mk 2 Duino Tagger 2. Arduino & Battery 3. The Mk 1 Duino Tagger 4. Wire to external sensors Step 1: Overview Overview Key parts of a duino tagger: IR Transmitter system What - Transistor amplifier, high power IR LED and a lens to give a well focused IR beam. Why - To give the tagger means of tagging / shooting other players as well as communicating game information. The transmitter amplifies the transmission signal from the arduino and transmits it using an IR LED, lenses are used to make the signal very directional in order to make the guns behave like guns and make long range transmissions possible. Sound What - Peizo Sounder (& mini sound recorder / playback electronics from greetings card) Why - It’s nice to have some audio feedback from the system. Sound effects to let you know when the tagger has been shot or run out of ammunition or lives. Receivers What - Standard IR receiver module and power regulation capacitor Why - So the gun knows when it has been shot. This design in this instructable looks at using 3 sensors 1 on the gun as well as front and rear head sensors. Visual Effects and lights What - LED’s and bar graph driver circuits Why - It is nice to get visual feedback on game information, eg lights to let you know when you have been shot. Cost To make this section internationally friendly; at the time of writing: £1 GBP = $ 1.6 USD = 1.1 EUR Assuming you already own an arduino the basic extra components for this project can be bought for around £10. Now is a great time to try to build a duino tagger as it is easy to get hold of cheap second hand light guns. Light guns are the guns that you can use with computer games, many of them don’t work with modern LCD screens and so there are a lot of them going cheap on ebay and else where. I bought two light guns each cost about £4 one off ebay one from a charity shop. Light guns are a great starting point for this project as they provide the optics, switches and case required for the build. You will need: Arduino Light Gun Coloured LED’s (preferably 30mA+) IR sensors At least 2x IR LED’s matched to the IR receiver (preferably 100mA+) Peizo sounder Power transistor /MOSFET A few electronics basics: solder, resistors , capacitors. You may also want Scrap plastic LED bar graph driver chips More LED’s Record your own message greetings card Hats / helmets / headbands to mount sensors on Image Notes http://www.instructables.com/id/Arduino-Projects/ 1. Arduino Duemilanove 2. 9v battery (pp3) 3. LED's Show ammo level 4. Switches 5. Trigger switch 6. Sound: Piezo Sounder 7. Transmitter IR LED transmitter and two red LEDs for muzzle flare. 8. Transmitter amplifier: Transistor and a few resistors covered in electrical tape. 9. Optics 10. Wire to head sensors 11. Receiver 12. Rumble / Force feedback motor. Not used (battery could not cope). Step 2: Basics Basics Page to try to help the electronics noobs. Some basics which are useful at several points in the design of the duino tagger. R = Resistor C = Capacitor V = Voltage I = Current Using LED's LED's must be used with a resistor to limit the current through them. Choose the current the LED will work at R = (V supply - V led) / I Not: You will probably just be able to copy the resistor values I used. Buttons The buttons (triggers etc) in this project are assumed to give a low voltage when pressed. The standard circuit for this is show in the circuit diagram provided. Filters R C (Resistor Capacitor) circuits can come in useful at a few places in duino tagger, either for smoothing out changes in the power supply voltage or to turn PWM signals into analogue levels, not as complicated as it might sound: To use the water analogy for electricity and current the resistor acts like a narrow pipe (imagine a straw) only allowing slow water (current) flow. The capacitor acts like a big water tank / bucket. The low pass filter in the diagram acts like a straw and bucket combo: Even if you suddenly change the flow of water in or out of the bucket the level (voltage) will only change slowly. Cut off frequency for low pass: f = 1/(2pi*R*C) http://www.instructables.com/id/Arduino-Projects/ http://www.instructables.com/id/Arduino-Projects/ Step 3: Modding the light gun Modding the light gun The details of the light gun modifications will depend on the light gun. Here are some general guidelines and ideas: Useful parts to leave in the: Switches Trigger LED's Lense Adding storage space to your light gun: Fitting things in can be difficult, you might also not wish to put your arduino inside the gun. I wanted to be able to easily remove my arduinos from my duino taggers so I could use them in other projects. On one of my duino taggers (MK1 gun) I cut holes in the case for the arduino nano pins to go through and mounted a socket on the inside of the gun so the arduino plugged on the outside of the gun. On my Mk2 gun I added an external case for the arduino and tried to make it look like an ammunition clip. The case / ammo clip was made from plastic I got from a cheap ring binder folder and its cover is held in place by a strong magnet. http://www.instructables.com/id/Arduino-Projects/ Step 4: Transmitter IR transmitter You will need: IR LED: Look for an LED with a narrow viewing angle (to ensure as much of the IR light makes it through the optics). Higher power the better. Pick LED’s with a wavelength that matches your IR receivers. Get some spare LED’s as they are operated above their rated current so may burn out. You can just attach an IR LED (with a current limiting resistor) to an output pin on the arduino and it will be able transmit, but the range of the duino tagger won’t be very impressive. In order to improve the range of the duino tagger amplification is needed. The basic amplifier I made was a simple transistor circuit (circuit diagram provided), you may wish to consider a mosfet instead of the transistor. Current through the LED: I aimed for about 300mA current through the IR LED. This is more than the rated current for the LED, but the LED seems to be able to cope because you are only pulsing the high current for a short time. If you are using the 5V supply from the arduino to power the LED it can only provide about 400/500mA so using 300mA for the IR transmitter Led does not leave too much for the other LED’s and speakers etc, so bare this in mind when designing building your duino tagger, it might be a good idea to add a voltage regulator capable of supplying higher currents. Optics You will need to use a lense to focus the IR beam, you can use the lense that came with the light gun. You can use a red LED to work out where to put the IR led to get a good focused beam. For more details see the miles tag site. Image Notes 1. Lense 2. Transmitter and muzzle flare LED's Step 5: Receiver Receivers The receivers are for detecting when the tagger has been shot and receiving game data. The receivers are standard IR remote control receivers like you would find in a TV remote. There are quite a few different receivers you can choose from I went for the cheapest I could find the main things to consider are: Will you be able to find a matching LED, one that works at the same light wavelength that the sensor is optimised for, If you don't match the LED and receiver the tagger range will be reduced. If you want to be able to use your duino tagger to be compatible with any other duino tag, laser tag or miles tag systems you will need be working at the same modulation frequency and light wavelength. Most of the IR receivers work in a very similar way and you will be able to wire then up the same as the circuit diagrams in the pictures. The output pin of the receiver drops to a low voltage when a signal is being received. The outputs from multiple sensor can be connected and one sensor receiving will still cause the combined output signal voltage to drop. The receivers work on there own and can be connected directly to the arduino, but they are much more reliable when used with capacitors to regulate the power supply and pull up resistors. http://www.instructables.com/id/Arduino-Projects/ http://www.instructables.com/id/Arduino-Projects/ Step 6: Sound Effects Audio / Sound Effects Adding sounds to the system makes for a better game experience. It is nice to have sounds for the: Fire, been shot, start, dead / out of lives sound, out of ammo.......... Ideally to add sounds you would use a fully featured audio shield like the wave shield. keep me updated if you try this. For simplicity and to save on build cost I chose just to use a piezo buzzer, this works well for most of the system tones, but it is tricky to use the piezo to make a good gun shot noise. If you are interested in the details of making sounds on an arduino usining a piezo buzzer have a look at the melody example. One simple and cheap way of adding better sound effects to your duinotagger is to use the electronics form a “record your own message” card. You can get the cards for £2/3 off ebay. Mini instructable. 1. Remove the electronics from the greetings card. 2. Play around with the electronics for a while to get an idea for what it all does. 3. The card circuit will play the recorded sound as soon as it is powered. The card circuit draws about 50mA so can be powered direct from an arduino output, ideally you would power it at 3V to the card circuit (the same as the button cells that powered it previously), but I did not encounter any problems powering it with the 5v direct form the arduino. If you found that 5v was damaging the circuit you could diodes to reduce the voltage (just make sure you pick ones able to cope with 50mA). http://www.instructables.com/id/Arduino-Projects/ 4. Connect the arduino output to where the positive on the batteries originally powering the circuit would have been and connect the arduino ground to where the battery negative was. You should now find when the arduino output goes high the sound recorded on the card circuit is played. Methods of recording the sound to the card circuit, you could just use the microphone (peizo transducer) that came with it or for slightly better sound quality you could use a potential divider (eg 10k pot) to connect it up to a computer and record directly to the circuit. You may wish to consider adding an audio amplifier to make the sound effects a bit more impressive. Step 7: Visual effects / Lighting Display / Visual Feedback It is nice to have visual feedback for things like ammunition and lives there are a few ways you could do this: the main being using LED’s or an LCD to display the information. I chose to uses LED’s, and there is provision for using LED’s in the code provided. The code varies two of the arduino’s PWM pins( ammoPin and lifePin) dependant on the ammunition and life. The PWM pins can be used to power LEDs and the more life or ammo the player has the brighter the LEDs will be alternatively the PWM output can be used to drive an bar graph driver chip like the LM3914N The PWM output can not be used to directly drive a bar graph driver chip, the PWM signal needs to be smoothed to give an analogue output, this can easily be done using an RC low pass filter. Step 8: The Code The Code Code Notes: I am not going to go into much detail about how the code works hopefully the fairly extensive comments provided in the code will be enough to explain it, if not the there are already good tutorials out there. Limitations: The code only works is set up in a way that it can only do one thing at a time and until the dual core arduino is easiest just to cope with that. This means when one tagger is shooting it will not notice if it gets shot/tagged. You could complicate the code by using interrupts , but in the real world it is not really a big problem, the shooting or getting shot happen so quickly that they very rarely interfere with each other. In future iterations of the code I will probably make it so that the tagger checks to see if it has been tagged in-between each bit it transmits, making it very very unlikely that it would miss an incoming message (hit / tag). I have played a few games using this code and similar code and it seems to work well. -----------------------------------------------------------------------------------------------------------------// Start of code (copy and paste into arduino sketch) // // Duino Tag release V1.01 // Laser Tag for the arduino based on the Miles Tag Protocol. // By J44industries: www.J44industries.blogspot.com // For information on building your own Duino Tagger go to: http://www.instructables.com/member/j44/ // // Much credit deserves to go to Duane O'Brien if it had not been for the excellent Duino Tag tutorials he wrote I would have never been able to write this code. // Duane's tutorials are highly recommended reading in order to gain a better understanding of the arduino and IR communication. See his site http://aterribleidea.com/duino-tag-resources/ // // This code sets out the basics for arduino based laser tag system and tries to stick to the miles tag protocol where possible. // Miles Tag details: http://www.lasertagparts.com/mtdesign.htm // There is much scope for expanding the capabilities of this system, and hopefully the game will continue to evolve for some time to come. // Licence: Attribution Share Alike: Give credit where credit is due, but you can do what you like with the code. // If you have code improvements or additions please go to http://duinotag.blogspot.com // // Digital IO's int triggerPin int trigger2Pin int speakerPin int audioPin = 3; // Push button for primary fire. Low = pressed = 13; // Push button for secondary fire. Low = pressed = 4; // Direct output to piezo sounder/speaker = 9; // Audio Trigger. Can be used to set off sounds recorded in the kind of electronics you can get in greetings card that play a custom message. http://www.instructables.com/id/Arduino-Projects/ int lifePin = 6; // An analogue output (PWM) level corresponds to remaining life. Use PWM pin: 3,5,6,9,10 or 11. Can be used to drive LED bar graphs. eg LM3914N int ammoPin = 5; // An analogue output (PWM) level corresponds to remaining ammunition. Use PWM pin: 3,5,6,9,10 or 11. int hitPin = 7; // LED output pin used to indicate when the player has been hit. int IRtransmitPin = 2; // Primary fire mode IR transmitter pin: Use pins 2,4,7,8,12 or 13. DO NOT USE PWM pins!! More info: http://j44industries.blogspot.com/2009/09/arduino-frequency-generation.html#more int IRtransmit2Pin = 8; // Secondary fire mode IR transmitter pin: Use pins 2,4,7,8,12 or 13. DO NOT USE PWM pins!! int IRreceivePin = 12; // The pin that incoming IR signals are read from int IRreceive2Pin = 11; // Allows for checking external sensors are attached as well as distinguishing between sensor locations (eg spotting head shots) // Minimum gun requirements: trigger, receiver, IR led, hit LED. // Player and Game details int myTeamID = 1; // 1-7 (0 = system message) int myPlayerID = 5; // Player ID int myGameID = 0; // Interprited by configureGane subroutine; allows for quick change of game types. int myWeaponID = 0; // Deffined by gameType and configureGame subroutine. int myWeaponHP = 0; // Deffined by gameType and configureGame subroutine. int maxAmmo = 0; // Deffined by gameType and configureGame subroutine. int maxLife = 0; // Deffined by gameType and configureGame subroutine. int automatic = 0; // Deffined by gameType and configureGame subroutine. Automatic fire 0 = Semi Auto, 1 = Fully Auto. int automatic2 = 0; // Deffined by gameType and configureGame subroutine. Secondary fire auto? //Incoming signal Details int received[18]; int check = 0; // Stats int ammo int life // Received data: received[0] = which sensor, received[1] - [17] byte1 byte2 parity (Miles Tag structure) // Variable used in parity checking = 0; // Current ammunition = 0; // Current life // Code Variables int timeOut = 0; // Deffined in frequencyCalculations (IRpulse + 50) int FIRE = 0; // 0 = don't fire, 1 = Primary Fire, 2 = Secondary Fire int TR = 0; // Trigger Reading int LTR = 0; // Last Trigger Reading int T2R = 0; // Trigger 2 Reading (For secondary fire) int LT2R = 0; // Last Trigger 2 Reading (For secondary fire) // Signal Properties int IRpulse = 600; // Basic pulse duration of 600uS MilesTag standard 4*IRpulse for header bit, 2*IRpulse for 1, 1*IRpulse for 0. int IRfrequency = 38; // Frequency in kHz Standard values are: 38kHz, 40kHz. Choose dependant on your receiver characteristics int IRt = 0; // LED on time to give correct transmission frequency, calculated in setup. int IRpulses = 0; // Number of oscillations needed to make a full IRpulse, calculated in setup. int header = 4; // Header lenght in pulses. 4 = Miles tag standard int maxSPS = 10; // Maximum Shots Per Seconds. Not yet used. int TBS = 0; // Time between shots. Not yet used. // Transmission data int byte1[8]; // String for storing byte1 of the data which gets transmitted when the player fires. int byte2[8]; // String for storing byte1 of the data which gets transmitted when the player fires. int myParity = 0; // String for storing parity of the data which gets transmitted when the player fires. // Received data int memory though. int hitNo // Byte1 int player[10]; int team[10]; // Byte2 int weapon[10]; int hp[10]; int parity[10]; = 10; = 0; // Number of signals to be recorded: Allows for the game data to be reviewed after the game, no provision for transmitting / accessing it yet // Hit number // Array must be as large as memory // Array must be as large as memory // Array must be as large as memory // Array must be as large as memory // Array must be as large as memory void setup() { // Serial coms set up to help with debugging. Serial.begin(9600); Serial.println("Startup..."); // Pin declarations pinMode(triggerPin, INPUT); pinMode(trigger2Pin, INPUT); pinMode(speakerPin, OUTPUT); pinMode(audioPin, OUTPUT); pinMode(lifePin, OUTPUT); pinMode(ammoPin, OUTPUT); pinMode(hitPin, OUTPUT); pinMode(IRtransmitPin, OUTPUT); pinMode(IRtransmit2Pin, OUTPUT); pinMode(IRreceivePin, INPUT); pinMode(IRreceive2Pin, INPUT); frequencyCalculations(); // Calculates pulse lengths etc for desired frequency configureGame(); // Look up and configure game details http://www.instructables.com/id/Arduino-Projects/ tagCode(); // Based on game details etc works out the data that will be transmitted when a shot is fired digitalWrite(triggerPin, HIGH); digitalWrite(trigger2Pin, HIGH); // Not really needed if your circuit has the correct pull up resistors already but doesn't harm // Not really needed if your circuit has the correct pull up resistors already but doesn't harm for (int i = 1;i < 254;i++) { // Loop plays start up noise analogWrite(ammoPin, i); playTone((3000-9*i), 2); } // Next 4 lines initialise the display LEDs analogWrite(ammoPin, ((int) ammo)); analogWrite(lifePin, ((int) life)); lifeDisplay(); ammoDisplay(); Serial.println("Ready...."); } // Main loop most of the code is in the sub routines void loop(){ receiveIR(); if(FIRE != 0){ shoot(); ammoDisplay(); } triggers(); } // SUB ROUTINES void ammoDisplay() { // Updates Ammo LED output float ammoF; ammoF = (260/maxAmmo) * ammo; if(ammoF <= 0){ammoF = 0;} if(ammoF > 255){ammoF = 255;} analogWrite(ammoPin, ((int) ammoF)); } void lifeDisplay() { // Updates Ammo LED output float lifeF; lifeF = (260/maxLife) * life; if(lifeF <= 0){lifeF = 0;} if(lifeF > 255){lifeF = 255;} analogWrite(lifePin, ((int) lifeF)); } void receiveIR() { // Void checks for an incoming signal and decodes it if it sees one. int error = 0; if(digitalRead(IRreceivePin) == LOW){ // If the receive pin is low a signal is being received. digitalWrite(hitPin,HIGH); if(digitalRead(IRreceive2Pin) == LOW){ // Is the incoming signal being received by the head sensors? received[0] = 1; } else{ received[0] = 0; } while(digitalRead(IRreceivePin) == LOW){ } for(int i = 1; i <= 17; i++) { // Repeats several times to make sure the whole signal has been received received[i] = pulseIn(IRreceivePin, LOW, timeOut); // pulseIn command waits for a pulse and then records its duration in microseconds. } Serial.print("sensor: "); Serial.print(received[0]); Serial.print("..."); // Prints if it was a head shot or not. for(int i = 1; i <= 17; i++) { // Looks at each one of the received pulses int receivedTemp[18]; receivedTemp[i] = 2; if(received[i] > (IRpulse - 200) && received[i] < (IRpulse + 200)) {receivedTemp[i] = 0;} // Works out from the pulse length if it was a data 1 or 0 that was received writes result to receivedTemp string if(received[i] > (IRpulse + IRpulse - 200) && received[i] < (IRpulse + IRpulse + 200)) {receivedTemp[i] = 1;} // Works out from the pulse length if it was a data 1 or 0 that was received received[i] = 3; // Wipes raw received data received[i] = receivedTemp[i]; // Inputs interpreted data http://www.instructables.com/id/Arduino-Projects/ Serial.print(" "); Serial.print(received[i]); } Serial.println(""); // Print interpreted data results // New line to tidy up printed results // Parity Check. Was the data received a valid signal? check = 0; for(int i = 1; i <= 16; i++) { if(received[i] == 1){check = check + 1;} if(received[i] == 2){error = 1;} } // Serial.println(check); check = check >> 0 & B1; // Serial.println(check); if(check != received[17]){error = 1;} if(error == 0){Serial.println("Valid Signal");} else{Serial.println("ERROR");} if(error == 0){interpritReceived();} digitalWrite(hitPin,LOW); } } void interpritReceived(){ // After a message has been received by the ReceiveIR subroutine this subroutine decidedes how it should react to the data if(hitNo == memory){hitNo = 0;} // hitNo sorts out where the data should be stored if statement means old data gets overwritten if too much is received team[hitNo] = 0; player[hitNo] = 0; weapon[hitNo] = 0; hp[hitNo] = 0; // Next few lines Effectivly converts the binary data into decimal // Im sure there must be a much more efficient way of doing this if(received[1] == 1){team[hitNo] = team[hitNo] + 4;} if(received[2] == 1){team[hitNo] = team[hitNo] + 2;} if(received[3] == 1){team[hitNo] = team[hitNo] + 1;} if(received[4] == 1){player[hitNo] = player[hitNo] + 16;} if(received[5] == 1){player[hitNo] = player[hitNo] + 8;} if(received[6] == 1){player[hitNo] = player[hitNo] + 4;} if(received[7] == 1){player[hitNo] = player[hitNo] + 2;} if(received[8] == 1){player[hitNo] = player[hitNo] + 1;} if(received[9] == 1){weapon[hitNo] = weapon[hitNo] + 4;} if(received[10] == 1){weapon[hitNo] = weapon[hitNo] + 2;} if(received[11] == 1){weapon[hitNo] = weapon[hitNo] + 1;} if(received[12] == 1){hp[hitNo] = hp[hitNo] + 16;} if(received[13] == 1){hp[hitNo] = hp[hitNo] + 8;} if(received[14] == 1){hp[hitNo] = hp[hitNo] + 4;} if(received[15] == 1){hp[hitNo] = hp[hitNo] + 2;} if(received[16] == 1){hp[hitNo] = hp[hitNo] + 1;} parity[hitNo] = received[17]; Serial.print("Hit No: "); Serial.print(hitNo); Serial.print(" Player: "); Serial.print(player[hitNo]); Serial.print(" Team: "); Serial.print(team[hitNo]); Serial.print(" Weapon: "); Serial.print(weapon[hitNo]); Serial.print(" HP: "); Serial.print(hp[hitNo]); Serial.print(" Parity: "); Serial.println(parity[hitNo]); //This is probably where more code should be added to expand the game capabilities at the moment the code just checks that the received data was not a system message and deducts a life if it wasn't. if (player[hitNo] != 0){hit();} hitNo++ ; } void shoot() { if(FIRE == 1){ // Has the trigger been pressed? Serial.println("FIRE 1"); sendPulse(IRtransmitPin, 4); // Transmit Header pulse, send pulse subroutine deals with the details delayMicroseconds(IRpulse); for(int i = 0; i < 8; i++) { // Transmit Byte1 if(byte1[i] == 1){ sendPulse(IRtransmitPin, 1); //Serial.print("1 "); http://www.instructables.com/id/Arduino-Projects/ } //else{Serial.print("0 ");} sendPulse(IRtransmitPin, 1); delayMicroseconds(IRpulse); } for(int i = 0; i < 8; i++) { // Transmit Byte2 if(byte2[i] == 1){ sendPulse(IRtransmitPin, 1); // Serial.print("1 "); } //else{Serial.print("0 ");} sendPulse(IRtransmitPin, 1); delayMicroseconds(IRpulse); } if(myParity == 1){ // Parity sendPulse(IRtransmitPin, 1); } sendPulse(IRtransmitPin, 1); delayMicroseconds(IRpulse); Serial.println(""); Serial.println("DONE 1"); } if(FIRE == 2){ // Where a secondary fire mode would be added Serial.println("FIRE 2"); sendPulse(IRtransmitPin, 4); // Header Serial.println("DONE 2"); } FIRE = 0; ammo = ammo - 1; } void sendPulse(int pin, int length){ // importing variables like this allows for secondary fire modes etc. // This void genertates the carrier frequency for the information to be transmitted int i = 0; int o = 0; while( i < length ){ i++; while( o < IRpulses ){ o++; digitalWrite(pin, HIGH); delayMicroseconds(IRt); digitalWrite(pin, LOW); delayMicroseconds(IRt); } } } void triggers() { // Checks to see if the triggers have been presses LTR = TR; // Records previous state. Primary fire LT2R = T2R; // Records previous state. Secondary fire TR = digitalRead(triggerPin); // Looks up current trigger button state T2R = digitalRead(trigger2Pin); // Looks up current trigger button state // Code looks for changes in trigger state to give it a semi automatic shooting behaviour if(TR != LTR && TR == LOW){ FIRE = 1; } if(T2R != LT2R && T2R == LOW){ FIRE = 2; } if(TR == LOW && automatic == 1){ FIRE = 1; } if(T2R == LOW && automatic2 == 1){ FIRE = 2; } if(FIRE == 1 || FIRE == 2){ if(ammo < 1){FIRE = 0; noAmmo();} if(life < 1){FIRE = 0; dead();} // Fire rate code to be added here } } void configureGame() { // Where the game characteristics are stored, allows several game types to be recorded and you only have to change one variable (myGameID) to pick the game. if(myGameID == 0){ myWeaponID = 1; maxAmmo = 30; http://www.instructables.com/id/Arduino-Projects/ ammo = 30; maxLife = 3; life = 3; myWeaponHP = 1; } if(myGameID == 1){ myWeaponID = 1; maxAmmo = 100; ammo = 100; maxLife = 10; life = 10; myWeaponHP = 2; } } void frequencyCalculations() { // Works out all the timings needed to give the correct carrier frequency for the IR signal IRt = (int) (500/IRfrequency); IRpulses = (int) (IRpulse / (2*IRt)); IRt = IRt - 4; // Why -4 I hear you cry. It allows for the time taken for commands to be executed. // More info: http://j44industries.blogspot.com/2009/09/arduino-frequency-generation.html#more Serial.print("Oscilation time period /2: "); Serial.println(IRt); Serial.print("Pulses: "); Serial.println(IRpulses); timeOut = IRpulse + 50; // Adding 50 to the expected pulse time gives a little margin for error on the pulse read time out value } void tagCode() { // Works out what the players tagger code (the code that is transmitted when they shoot) is byte1[0] = myTeamID >> 2 & B1; byte1[1] = myTeamID >> 1 & B1; byte1[2] = myTeamID >> 0 & B1; byte1[3] = myPlayerID >> 4 & B1; byte1[4] = myPlayerID >> 3 & B1; byte1[5] = myPlayerID >> 2 & B1; byte1[6] = myPlayerID >> 1 & B1; byte1[7] = myPlayerID >> 0 & B1; byte2[0] = myWeaponID >> 2 & B1; byte2[1] = myWeaponID >> 1 & B1; byte2[2] = myWeaponID >> 0 & B1; byte2[3] = myWeaponHP >> 4 & B1; byte2[4] = myWeaponHP >> 3 & B1; byte2[5] = myWeaponHP >> 2 & B1; byte2[6] = myWeaponHP >> 1 & B1; byte2[7] = myWeaponHP >> 0 & B1; myParity = 0; for (int i=0; i<8; i++) { if(byte1[i] == 1){myParity = myParity + 1;} if(byte2[i] == 1){myParity = myParity + 1;} myParity = myParity >> 0 & B1; } // Next few lines print the full tagger code. Serial.print("Byte1: "); Serial.print(byte1[0]); Serial.print(byte1[1]); Serial.print(byte1[2]); Serial.print(byte1[3]); Serial.print(byte1[4]); Serial.print(byte1[5]); Serial.print(byte1[6]); Serial.print(byte1[7]); Serial.println(); Serial.print("Byte2: "); Serial.print(byte2[0]); Serial.print(byte2[1]); Serial.print(byte2[2]); Serial.print(byte2[3]); Serial.print(byte2[4]); Serial.print(byte2[5]); Serial.print(byte2[6]); Serial.print(byte2[7]); Serial.println(); Serial.print("Parity: "); Serial.print(myParity); http://www.instructables.com/id/Arduino-Projects/ Serial.println(); } void playTone(int tone, int duration) { // A sub routine for playing tones like the standard arduino melody example for (long i = 0; i < duration * 1000L; i += tone * 2) { digitalWrite(speakerPin, HIGH); delayMicroseconds(tone); digitalWrite(speakerPin, LOW); delayMicroseconds(tone); } } void dead() { // void determines what the tagger does when it is out of lives // Makes a few noises and flashes some lights for (int i = 1;i < 254;i++) { analogWrite(ammoPin, i); playTone((1000+9*i), 2); } analogWrite(ammoPin, ((int) ammo)); analogWrite(lifePin, ((int) life)); Serial.println("DEAD"); for (int i=0; i<10; i++) { analogWrite(ammoPin, 255); digitalWrite(hitPin,HIGH); delay (500); analogWrite(ammoPin, 0); digitalWrite(hitPin,LOW); delay (500); } } void noAmmo() { // Make some noise and flash some lights when out of ammo digitalWrite(hitPin,HIGH); playTone(500, 100); playTone(1000, 100); digitalWrite(hitPin,LOW); } void hit() { // Make some noise and flash some lights when you get shot digitalWrite(hitPin,HIGH); life = life - hp[hitNo]; Serial.print("Life: "); Serial.println(life); playTone(500, 500); if(life <= 0){dead();} digitalWrite(hitPin,LOW); lifeDisplay(); } Step 9: Optional Extras Other features There is a lot of potential for the game to be improved the code I have provided transmits quite a lot of data when shooting another tagger. This leaves the potential for player statistics at the end of the game, different weapon types etc... Force feedback Many light guns come with an eccentrically weighted motor to give force feedback, on one of the duino taggers I made I wired this up to allow for force feedback, but it caused a lot of problems as the pp3 9v battery I was using could not really cope with the power demands. So only attempt to add force feedback if you have a decent battery pack. Secondary fire: I have started to write some provision for this into the code. Compatibility: I have tried to make the code fairly compatible with the MilesTag Protocol, the chances are it will be able to transmit and receive the data, although the code does not yet have much provision for acting on the information. http://www.instructables.com/id/Arduino-Projects/ Step 10: Design Ideas I have been thinking about building a duino tagger from scratch. Here are a few of the concept sketches I drew of gun design ideas. Hopefully they might offer some ideas and inspiration. Image Notes 1. Steampunk tagger Made from bits of pipe etc Step 11: Links My Sites: j44industries Laser tag and Duino tag: Duino Tag Code Tutorials Miles Tag the DIY laser tag system Arduino Links: Melody Button Related Instructables Explosion Effect - Talcapult by Ninja tag by j44 bowmaster Conversion of cheap Airsoft P90 to Miles laser tag. by Solion lazer tag at the Kalahari! by thekid Paintball, How it's done. Beginners Guide by dkfa Zombie Tag by bendog38 Scenario Paintball by captocommando Manhunt! by ELMo_0007 http://www.instructables.com/id/Arduino-Projects/ The 4x4x4 LED cube (Arduino) by forte1994 on September 2, 2010 Intro: The 4x4x4 LED cube (Arduino) In this instructable I will show you how to make a 4x4x4 LED cube that will be controlled by an Arduino Demulionove. now yes you might say" that Arduino has only 14 I/O pins well also the 6 analog pins can be used as pins 15,16,17,18,19,20. that way giving us enough pins (16 columns + 4layers = 20 I/O pins) This instructable is made for those who know how to solder (well) and how to program the Arduino. Also I will be providing detours to skip sum steps so if you see (Detour available skip to __ Step) you can follow if you are to lazy to do that. Step 1: Get the materials To start of you will need these materials: Mandatory -- 64 LED (color optional) ** -- Arduino Demulionove -- Wire Optional --32 male pin strip --PCB prototype board --Fine Grit (400 +) sand paper Your choice -- 64 resistors or 16 you can get 64 resistors which will help by keeping all the lights at the same light out put regardless of how many are on but it will be considerably more work. Tools: --Computer http://www.instructables.com/id/Arduino-Projects/ --Soldering Iron --Solder --thin nose pliers **Color is optional but use this website to find the right resistor for your leds http://led.linear1.org/led.wiz (I got Green so I used 100 ohm resistors) Image Notes 1. 64 LED your choice in this case its green 2. PCB but I didn't end up using this one because it was too small so I used a bigger one 3. broken off peace off the 32 male pin header 4. Arduino 5. 64-100 ohm resistors 6. 400 G sand paper 7. My keyboard Image Notes 1. supper Bright 2. clear Image Notes 1. now Defused LED Step 2: Assemble the board(the LED cube base) (Detour available skip to next step) In this step you will need the board and the wiring. First you will want to map out were all the wires will go and then feed the wires through the board. Don't mind the LED and resistor note on the picture for now. NOTE: I recommend you use Different color wire just because you won't get confused which wire is which. http://www.instructables.com/id/Arduino-Projects/ Image Notes 1. 100 ohm resistor 2. coloms(+) 1 - 8 3. coloms(+) 9 - 14 4. coloms(+) 15 ,16 5. levels(-) 1 - 4 6. defused LED using sand paper Step 3: Defuse the LED DETOUR if you don't want to do this then go to next step So to defuse the LED I took normal 400 grit sand paper and sanded all the LEDs which made them look pretty good. Image Notes 1. 400 GRIT sand paper 2. clear LED Image Notes 1. now Defused LED http://www.instructables.com/id/Arduino-Projects/ Image Notes 1. normal 2. after sanding Image Notes 1. with flash you can still see the defused one but not the normal Image Notes 1. this = lighting up the LED above it 2. this = dispersing light Step 4: Construct the cube Now there is the Easy way to do this and that is to connect all the (--) in one layer and then the columns (+) to the resistor and then board. (Look at picture diagram below) what happens is when you turn it on (all of them) the lights are dimmer then when one is on. My solution to this was to solder a 100 ohm resistor to each LED. (Follow picture instruction on how to do it.) Everything is done in the same way only now you solder all the resistors to the column which is a piece of Ethernet wire. (See picture) Image Notes 1. the resistor 2. LED 3. resistor plased in between the (-) bent down and the (+) bent up. http://www.instructables.com/id/Arduino-Projects/ 4. start wraping the resistor around the (+) leed. 5. when done solder and snip off the end of the LED that is after the solder. Image Notes 1. LAYER(--) 2. COLOMN (+) 3. LED 4. 100 ohm resistor 5. connections to arduino pins (+) 6. conections to arduino (--) http://www.instructables.com/id/Arduino-Projects/ http://www.instructables.com/id/Arduino-Projects/ Image Notes 1. resistor rining from the (+) on the LED to the (+) colom 2. (+) colom runing to the arduino 3. the (--) layer conected to the (--) of the LED Step 5: PROGRAM Good job on making it too this step now all you need to do is upload this code and you are done. the code did not fit the line so here it is http://www.instructables.com/id/Arduino-Projects/ Image Notes 1. All finished YAY took me about 4 days 2-5 hours a day to finish and program. File Downloads LED_cube_4x4x4.zip (2 KB) [NOTE: When saving, if you see .tmp as the file ext, rename it to 'LED_cube_4x4x4.zip'] Step 6: ADD on so to program the cube all you need to do is change the B1111, B1111, B1111, B1111, B1111, B1111, B1111, B1111, B1111, B1111, B1111, B1111, B1111, B1111, B1111, B1111, 80, code each B1111 corresponds to a line of LEDs in your cube 0 being off and 1 being on. The last number is the time it will display that part in milliseconds. so get programing and enjoy. Related Instructables Arduino 4x4x4 LED Cube by Phogie7 Led Cube 4x4x4 (video) by bajgik DIY Funky Nightlight: The 4x4x4 LED Cube LED Cube and Arduino Lib by by AnalogueChick gzip 4x4x4 interactive ledcube (Photos) by kenyer Carlitos' Project: RGB LED Mood Cube by RobotShop How to build an 8x8x8 LED cube and control it with an Arduino by R- LED Cube 4x4x4 by chr http://www.instructables.com/id/Arduino-Projects/ http://www.instructables.com/id/Arduino-Projects/ Arduino and Touchpad Tic Tac Toe by origamiwolf on November 14, 2009 Intro: Arduino and Touchpad Tic Tac Toe Or, an exercise in input and output multiplexing, and working with bits. And a submission for the Arduino contest. This is an implementation of a tic tac toe game using a 3x3 array of bicoloured LEDs for a display, a simple resistive touchpad, and an Arduino to tie everything together. To see how it works, check out the video: What this project requires: Parts and consumables One perf board (or strip board) Nine bicoloured LEDs, common cathode Nine identical resistors, in the 100-220 ohm range Six identical resistors, in the 10kohm - 500kohm range One single pole, double throw switch A bunch of header pins A bunch of electrical wire One small square sheet of transparent acrylic, ~ 1 mm thick, 8 cm on the side Clear sticky tape Heatshrinks (optional) All of the above are quite common items, total cost should not exceed USD$20. Tools One Arduino setup (Arduino Duemilanove, Arduino IDE, computer, USB cable) Usual electrical tools (multimeter, solder solder gun, wire snips, wire cutter) Everything Arduino related can be found at http://www.arduino.cc. On with the build! http://www.instructables.com/id/Arduino-Projects/ Step 1: Wiring up the LED matrix For an LED to light, both its leads must be connected. If we were to dedicate a pair of pins to each of the 18 LEDs (9 red, 9 green), we'd quickly run out of pins on the Arduino. However, with multiplexing, we'll be able to address all the LEDs with merely 9 pins! To do this, the LEDs are wired up in a crossbar fashion, as shown in the first figure. The LEDs are grouped in columns of threes, and their cathodes are grouped in rows of sixes. By setting a particular anode line high, and a particular cathode line low, and having a high impedance on all the other anode and cathode lines, we can select which LED we want lit up, as there is only one possible path the current can take. For instance, in the second figure, setting the green anode 1 line high, and the cathode 1 line low, the bottom left green LED lights up. The current path in this case is shown in blue. But what if you want to light up more than one LED on different lines? We'll use persistence of vision to achieve this. By selecting pairs of LED lines very very quickly, it gives the illusion that all the selected LEDs are lit at the same time. Image Notes 1. This is set HIGH. 2. This is set LOW. 3. This LED lights up. Step 2: LED matrix layout The circuit diagram below shows how the LEDs are physically wired up (G1-G9: green LEDs, R1-R9: red LEDs). This diagram is for single red and green LEDs, if you are using bicoloured common cathode red/green LEDs, there's only one cathode leg per red/green pair that you have to wire up. The red and green anode lines go into the PWM pins of the Arduino (pins 3, 5, 6, 9, 10, 11 on the Duemilanove), so that we can have effects like fading later on. The cathode lines go into pins 4, 7 and 8. Each of the cathode and anode lines have 100 ohm resistors for protection. Image Notes 1. strain relief is essential! 2. protection resistors, about ~100 ohms each. 3. bicoloured red/green common cathode LEDs 4. header pins to go into Arduino http://www.instructables.com/id/Arduino-Projects/ Step 3: Addressing the LED Matrix For the tic tac toe code, we'll need to be able to store the following information about the LEDs: - whether an LED is lit or not - if lit, whether it's red or green One way of doing this is to store the state in a 9-cell array, using three digits to represent the state (0 = off, 1 = red on, 2 = green on). Everytime we need to check on the states of the LED, for example, to check if there's a win condition, we'll need to cycle through the array. This is a workable method, but rather clunky. A more streamlined method would be to use two groups of nine bits. The first group of nine bits stores the on-off status of the LEDs, and the second group of nine bits stores the colour. Then, manipulating the LED states simply becomes a matter of bit arithmetic and shifting. Here's a worked example. Let's say we draw our tic tac toe grid graphically, and first use 1s and 0s to represent the on-off status (1 is on, 0 is off): 000 000 = matrix with bottom left LED lit 100 100 010 = matrix with diagonal LEDs lit 001 If we enumerate the cells from the bottom left, we can write the above representations as a series of bits. In the first case, that would be 100000000, and in the second case, it would be 001010100. If we think of these as binary representations, then each series of bits can be condensed into a single number (256 in the first case, 84 in the second case). So instead of using an array to store the state of the matrix, we can just use a single number! Similarly, we can represent the colour of the LED in the same way (1 is red, 0 is green). Let's first assume all the LEDs are lit (so the on-off status is represented by 511). The matrix below will then represent the colour state of the LEDs: 010 green, red, green 101 red, green, red 010 green, red, green Now, when displaying the LED matrix, we just have to cycle through each of the bits, first in the on-off state, and then in the colour state. For example, let's say our on-off state is 100100100, and the colour state is 010101010. Here's our algorithm for lighting up the LED matrix: Step 1. Step 2. Step 3. Step 4. Step 5. Do a bitwise addition of the on-off state with a binary 1 (ie bit masking). If it's true, the LED is lit. Do now a bitwise addition of the colour state with a binary 1. If it's true, light up the red LED. If it's false, light up the green LED. Shift both the on-off state and colour state, one bit to the right (ie bit shifting). Repeat Steps 1 - 4 until all nine bits have been read. Note that we're filling the matrix backwards - we start with cell 9, then proceed back down to cell 1. Also, the on-off and colour states are stored as an unsigned integer type (word) instead of a signed integer type. That's because in bit shifting, if we're not careful, we might inadvertenly change the sign of the variable. Attached is the code for lighting up the LED matrix. File Downloads LED_matrix.pde (1 KB) [NOTE: When saving, if you see .tmp as the file ext, rename it to 'LED_matrix.pde'] Step 4: Constructing the touch pad The touchpad is constructed from a sheet of thin acrylic, large enough to overlay over the LED matrix. Then, tape down the row and column wires onto the acrylic sheet, using clear tape. Clear tape is also used as the insulating spacer between the wires, at the intersections. Be sure to use clean tools, to prevent finger grease from getting onto the sticky side of the tape. Fingerprint stains not only look ugly, but make the tape less sticky. Trim off one end of each of the lines, and solder the other end to a longer wire. Solder a resistor in-line with the wires, before soldering on connectors. The resistors used here are 674k, but any value between 10k and 1M should be fine. The connections to the Arduino are made using the 6 analog pins, with pins 14-16 connected to the wire grid rows, and pins 17-19 connected to the columns. Image Notes http://www.instructables.com/id/Arduino-Projects/ 1. transparent acrylic, with the protective sheet peeled off on one side. On the other side, lines have been drawn as a guide. 2. An easy way to get thin wire is to strip the insulation off a length of multistrand wire, and use the individual strands. Image Notes 1. Bottom protective sheet is peeled off. 2. Don't forget the strain relief! 3. Inline 674k resistors 4. Connectors to Arduino Image Notes 1. When you get old like me, you'll need this to see the finicky little insulation squares at the intersections. 2. Essential tools for placing the tape. 3. Taped up wire grid. Step 5: The touch pad - how it works Just as we used a crossbar multiplexer to set up an LED matrix with minimal pins, we can use a similar crossbar multiplexer to set up a touch sensor array, which we can then use to activate the LEDs. The concept for this touch pad is simple. It is essentially a wire grid, with three bare wires running in rows, and three bare wires running in columns above the rows. At each intersection point is a small square of insulation that prevents the two wires from touching. A finger touching the intersection will make contact with both wires, resulting in a huge, but finite resistance between the two wires. A small current, but detectable, current can therefore be made to flow from one wire to the next, via the finger. To determine which intersection was pressed, the following method was used: Step 1: Set all the column lines to OUTPUT LOW. Step 2: Set the row lines to INPUT, with the internal pullups activated. Step 3: Take an analog read on each row line until the value drops below a given threshold. This tells you in which row the pressed intersection is. Step 4: Repeat Steps 1-3, but now with the columns as inputs and the rows as outputs. This tells you which column the pressed intersection is. To minimise the effects of noise, a number of readings are taken and then averaged. The averaged result is then compared against a threshold. Since this method just checks against a threshold, it's not suitable for detecting simultaneous presses. However, since tic tac toe proceeds in turns, reading a single press is sufficient. Attached is a sketch illustrating how the touchpad works. As with the LED matrix, bits are used to represent which intersection was pressed. http://www.instructables.com/id/Arduino-Projects/ Image Notes 1. touch here with a finger File Downloads wiregridsense.pde (1 KB) [NOTE: When saving, if you see .tmp as the file ext, rename it to 'wiregridsense.pde'] Step 6: Putting everything together Now that all the individual components are done, it's time to put them all together. Overlay the wire grid on the LED matrix. You may need to reorder the pin numberings in the LED matrix code to get it synchronised with the wire grid sensor. Secure the wire grid in place with fastenings or adhesives of your choice, and stick on a nice playing board. Add a switch between pin 12 and ground of the Arduino. This switch is to toggle between 2 player mode, and 1 player mode (vs the microcontroller). Image Notes 1. Arduino Duemilanove 2. LED matrix connections. 3. Switch between ground and pin 12. 4. Wire grid sensor connections. 5. Tic Tac Toe board, with square cutouts over the intersections and LED positions. A small sheet of tracing paper is placed between the LED matrix and wire grid sheet, to act as a diffuser for the LEDs. 6. Switch. http://www.instructables.com/id/Arduino-Projects/ Step 7: Programming Tic Tac Toe Attached is the code for the game. Let's first break down the tic tac toe game into its various steps, in the two player mode: Step 1: Player A picks an unfilled cell by touching an intersection. Step 2: The LED for that cell lights up with the colour A. Step 3: Check to see if Player A has won. Step 4: Player B picks an unfilled cell. Step 5: The LED for that cell lights up with colour B. Step 6: Check to see if Player B has won. Step 7: Repeat 1-6 until there's a win condition, or if all the cells are filled. Reading the cells: The program loops between reading the grid and displaying the LED matrix. As long as the grid sensor does not register a non-zero value, this loop will continue. When an intersection is pressed, the Pressed variable stores the position of the pressed cell. Checking if the cell is unfilled: When a position reading is obtained (variable Pressed), it is compared against the current cell status (stored in the variable GridOnOff) using a bitwise addition. If the Pressed cell is unfilled, then proceed to light up the LED, otherwise return to reading the cells. Toggling the colours: A boolean variable, Turn, is used to record whose turn it is. The LED colour chosen when a cell is picked is determined by this variable, which alternates each time a cell is chosen. Checking for a win condition: There are only 8 possible win conditions, and these are stored as word variables in an array (winArray). Two bitwise additions are used to compare a player's filled cell positions to the win conditions. If there's a match, then the program displays a win routine, after which it starts a new game. Checking for a draw condition: When nine turns have been recorded and there is still no win condition, then the game is a draw. The LEDs are then faded out and a new game is started. Switching to one player mode: If the switch is in the on position, the program goes into one player mode, with the human player starting first. At the end of the human player's turn, the program simply picks a random cell. Obviously, this isn't the smartest strategy! File Downloads tictactoe.pde (8 KB) [NOTE: When saving, if you see .tmp as the file ext, rename it to 'tictactoe.pde'] Step 8: Remarks and further improvements Here a video showing the one player mode, with the program playing totally random moves: The program shown here is only a minimal, bare bones version. Many other things can be done with this: 1) Lighting up LEDs three at a time The current code displays only one LED at once. However, with the wiring shown here, it's possible to light up all the LEDs connected to one cathode line at the same time. So, instead of cycling through all the nine positions, all you need to do is cycle through the three cathode lines. 2) Use interrupts to display the LEDs Depending on the LED display routine and the amount of processing, the LEDs may show some degree of flickering. By using interrupts, the timing of the LEDs can be controlled precisely and would lead to a smoother display. 3) A smarter computer player The currrent code takes up only a few kb, leaving quite a bit more for the implementation of a smarter computer tic tac toe player. Hope you've enjoyed reading this instructable as much as I had fun working on it! http://www.instructables.com/id/Arduino-Projects/ Related Instructables Electronic TicTac-Toe with RGB LEDs (video) by cedtlab DIY 3D Controller by kylemcdonald K'nex Tic-TacToe by RNB Winning tic-tac- Mad Dog Robot toe strategies by by e024576 CamillaLuvzMusic Tic-Tac flashlight by bob the greater K'nex Tic-TacToe by Daniel662000 Puppeteer Motion-Capture Costume by Plusea http://www.instructables.com/id/Arduino-Projects/ Make a Web Connected Robot (for about $500) (using an Arduino and Netbook) by oomlout on November 26, 2008 Intro: Make a Web Connected Robot (for about $500) (using an Arduino and Netbook) This Instructable will show you how to build your own Web Connected Robot (using an Arduino micro-controller and Asus eee pc). Why would you want a Web Connected Robot? To play with of course. Drive your robot from across the room or across the country, using nothing more than Skype and a web browser (nothing to install on the controlling computer). After that? Dig into the software & adapt it however you like, add a GPS so you can watch where you're driving on a map, add temperature sensors to map temperature gradients in your house, or sonar sensors to add controls on what you're web drivers can and cannot run into. Features: Inexpensive - (~$500 if you purchase all parts new and considerably cheaper if you dig around in your parts bin) Once up and running controlling the robot requires only a web browser - (and Skype if you want to see where you're driving) Open Source and Easily Adaptable - (uses an Arduino micro-controller, Processing for the web server & all software can be run on Linux (all the code is also heavily commented to make jumping in and changing things easy)) Modular Design (not a completely integrated system, if you want to use a different video conferencing service no worries, or if you have a Basic stamp rather than an Arduino just right a small piece of code and slot it in) Here's a quick video of my Web Connected Robot being driven out of the kitchen. Image Notes 1. A Web Connected Robot - (WEBB) Available in kit form from oomlout.com Image Notes 1. Computer running Skype and a web browser 2. Robot running a web server (written in Processing) 3. Camera 1 4. Camera #2 http://www.instructables.com/id/Arduino-Projects/ Image Notes 1. -Servo Robot- Dual servo motor robot 2. -Arduino Micro-controller- Listens for serial commands from the laptop on the robot. It translates these into move commands. 3. -Small Laptop- A small laptop (I used an Asus eee pc). Running a webserver (written in Processing), as well as Skype for video calling 4. -Computer- Connected over the internet or a local network. It downloads a web page from the small laptop and delivers move commands through this. Also running Skype to allow driving via video possible Step 1: Parts & Tools Only a few parts are required: Robot: Arduino Controlled Servo Robot - (SERB) ($175 @ oomlout.com ) or (make your own) An open source robot which uses an Arduino micro-controller as it's brain. (any dual servo robot platform with an arduino can be used (option 1) (please message me if you discover any other options) Computer: Asus eee PC 4G ($280) (@Best Buy) A small inexpensive laptop that is perfect for this purpose. (any laptop (or desktop if you want to run with a chord) capable of running Processing sketches can be used) Laptop Desk: Laser Cut Acrylic ($25 (@ oomlout) ) or (build your own step 3) A few additional acrylic pieces which bolt onto a (SERB) to give it a desk for the laptop to sit on. Nuts and Bols: (available at home depot) 3mm x 10mm bolt (x4) 3mm x 15mm bolt (x4) 3mm nut (x8) http://www.instructables.com/id/Arduino-Projects/ Image Notes 1. Arduino Controlled Servo Robot - (SERB) Available at oomlout.com 2. Asus eee PC 3. Laptop Desk Step 2: Cutting Pieces & Assembly There are three options for getting pieces for your laptop desk. Cutting Option 1: (Purchasing from oomlout.com) laser cut desk pieces and the neccesary hardware are available from oomlout for $25 (here) Option 2: (Cutting on your own laser cutter or Ponoko.com) Download the file below (03-WEBB-Acrylic Parts.cdr or 03-WEBB-Acrylic Parts (Ponoko P2).eps) Cut them from 3mm (1/8") Acrylic Option 3: (Scroll Saw) Download the scroll saw pattern from below (03-WEBB-ScrollSaw Pattern (A4).pdf (for A4 size paper) or 03-WEBB-ScrollSaw Pattern (letter).pdf (for letter sized paper)) Double check that it hasn't been scaled when printing (by measuring the printed rulers) Glue to a piece of 3mm (1/8") acrylic and cut the pieces out. Assembling: Download the assembly guide (04-WEBB-Assembly Guide.pdf) below and put the laptop desk together. Image Notes 1. An Arduino Controlled Servo Robot - (SERB) with it's laptop desk attached. Image Notes 1. Scroll saw pattern ready to be cutout. http://www.instructables.com/id/Arduino-Projects/ Image Notes 1. Assembly Guide Cover Image Notes 1. Assembly Guide Example Steps File Downloads 03-WEBB-ScrollSaw Pattern (le...pdf ((612x792) 22 KB) [NOTE: When saving, if you see .tmp as the file ext, rename it to '03-WEBB-ScrollSaw Pattern (le...pdf'] 03-WEBB-ScrollSaw Pattern (A4...pdf ((595x842) 22 KB) [NOTE: When saving, if you see .tmp as the file ext, rename it to '03-WEBB-ScrollSaw Pattern (A4...pdf'] 04-WEBB-Assembly Guide.pdf ((595x842) 885 KB) [NOTE: When saving, if you see .tmp as the file ext, rename it to '04-WEBB-Assembly Guide.pdf'] Step 3: Software - (Arduino) For those new to Arduino check out the great getting started guide at Arduino.cc First off the software running on the Arduino. It is a very simple program, what the Arduino does is monitor its serial port for data. What it is looking for is a conversation 5 bytes long. Byte 1-3 (Check bytes "AAA") Byte 4 Command (Tells the arduino what to do) (Supported commands 'F' - Forward, 'B' - Backward, 'L' - Left, 'R' - Right, 'S' - Speed, 'X' - SetSpeedLeft, 'Y' SetSpeedRight, 'C' - Stop) Byte 5 Parameter - For the move commands this is interpretted as a time interval (Parameter * 100 ms), and for the speed commands a percentage from 0-100 The code is commented thoroughly and given this framework adding additional commands should be easy. To Download: Download the attached zip file. (05-WEBB-Arduino Code.zip) Unzip to your Arduino Sketch directory. (default: My Documents\Arduino\) Open your arduino development enviroment and upload to your Arduino. To Copy and Paste http://www.instructables.com/id/Arduino-Projects/ Copy the code from below. Paste into the Arduino development environment. Upload to your Arduino. Appendix: The Arduino Program /* * Arduino Controlled Web Connected Robot (WEBB) - Serial Host * For more details visit: http://www.oomlout.com/serb * * Behaviour: The Arduino listens t Step 4: Software - Robot Laptop (WebServer) (Processing is an open source programming language and environment which is super easy to get started with. For more details visit Processing ) The software that runs on the robot laptop is also quite simple. It is a rather rudimentary web-server (listening for web page requests from a web browser), a small user interface (to set it up), and facilities for passing the commands received from the Web Server to the Arduino. To Install Quickly: (on windows) Download the zip file below (06-WEBB-Processing Webserver (windows exe).zip) Unzip it and run the .exe file (_WEBB_WebServer_RobotComputer.exe) To Edit in Processing: Download the zip file below (06-WEBB-Processing Webserver (source files).zip) Unzip anywhere on your computer. Open the Processing environment and open (_WEBB_WebServer_RobotComputer.pde) To Test: Run the program. In box #1 there will be a list of the available comm ports on your computer (click on the one your Arduino is conneced to. (your robot will twitch a few times as the computer connects, and a cyan dot will appear beside the chosen comm port) In box #2 test to see if your Arduino is connected. Click one of the arrows and hopefully your robot will move in the clicked direction for half a second. In box #3 click the "Start" button to start the web server. Open a web browser (on the Robot Laptop) and visit http://127.0.0.1:12345/ControlPage.html (hopefully the control web page with buttons on it will appear) Details on how to use this page in the next stepWhat is happening: The Web Server listens to port 12345 for http requests (what is sent when you type in a web page address) There are two types of requests it responds to. 1. It listens for "ControlPage.html" and will send the control Webpage 2. It listens for requests of the form "/request?command=F&param1=100" (these commands are parsed and sent to the Arduino (this example would result in the robot going Forward for 10 seconds) Appendix: (The code for the WebServer) /* * Arduino Controlled Web Connected Robot (WEBB) - Webserver * For more details visit: http://www.oomlout.com/serb * * Behaviour: The program listens for http://www.instructables.com/id/Arduino-Projects/ Image Notes 1. #1. Click on the comm port your Arduino is connected to 2. #2. Test. click one of the directions to move your robot for half a second in any direction 3. #3. Start the webserver, and visit http://127.0.0.1:12345/ControlPage.html 4. My Computer telling me my hard-drive is full File Downloads 06-WEBB-Processing Webserver (source files).zip (1 MB) [NOTE: When saving, if you see .tmp as the file ext, rename it to '06-WEBB-Processing Webserver (source files).zip'] 06-WEBB-Processing Webserver (windows exe).zip (462 KB) [NOTE: When saving, if you see .tmp as the file ext, rename it to '06-WEBB-Processing Webserver (windows exe).zip'] Step 5: Software - (Webpage) Well we're almost finished all that is left is talking to your robot. To Get Talking: (over a local network -on windows-) Discover the local ip address of the laptop computer. To do this go to "Start\Programs\Accesories\Command Prompt" and when the terminal window opens up type "ipconfig". Write down "IP Address" and head to another computer on your local network. Open a web browser, type "http://(robot computer ip):12345/ControlPage.html The control web page should load, in the "IP Address" box type the robot computers ip. Begin controlling your robot. To Get Talking: (over the internet) Now that you have it working locally getting it talking over the internet is just a few short steps away. (most difficult step) Set up Port Forwarding - Your computer needs to be listening to the internet rather than just the local network. To do this you need to tell your router to pass certain requests through to the computer controlling the robot. This is a bit complex and goes far beyond the scope of this Instructable. However if you visit PortForward.com they will give you all you need to know about configuring your router (you need to forward port 12345 to your robot laptop) Next discover your internet IP (visit WhatIsMyIP.com ) Finally fire up skype setup a video call and get whomever you are talking to to visit "http://(internet IP):12345/ControlPage.html" Type in the internet IP into the "IP Adress" box in the control webpage and your Web Connected Robot is being driven from afar. Image Notes 1. Your local IP Address http://www.instructables.com/id/Arduino-Projects/ http://www.instructables.com/id/Arduino-Projects/ Image Notes 1. Type the ip address of the Robot Laptop in here 2. The amount of time you'd like your robot to move (in 100 milli-second increments). Or the percent of speed. File Downloads 07-WEBB-ControlPage.html (2 KB) [NOTE: When saving, if you see .tmp as the file ext, rename it to '07-WEBB-ControlPage.html'] http://www.instructables.com/id/Arduino-Projects/ Step 6: Finished Well that's it. I hope you're having a fun time driving your robot from a far. If you have any issues with the software or hardware feel free to leave a comment and I'll try and help you out. If you would like to check out more neat projects try visiting: oomlout.com Related Instructables Arduino Controlled Servo Robot (SERB) by oomlout MAYA Budget Telepresence Rover by bhylak Add Obstacle Detecting Whiskers to Your Robot by oomlout iRover: Remotely controlled iRobot Create (or Roomba) by techgeek75 Easy DIY Home Automation (using servo switches) by oomlout Solderless Breadboard Layout Sheets (plug and play electronics) by oomlout Android controlled robot by deryck.williams Uses for your own private cloud. by Computothought http://www.instructables.com/id/Arduino-Projects/ The Lightning Simulator/Breathalyzer/Graphic Equalizer - Arduino Powered by alinke on September 7, 2010 Intro: The Lightning Simulator/Breathalyzer/Graphic Equalizer - Arduino Powered *** UPDATE: A portable version of the Talking Breathalyzer is in the works here http://talkingbreathalyzer.com *** The LED strips are mounted on an outdoor trellace which functions as a lightning simulator, outdoor breathalyzer, graphic equalizer synced to music, and a few other effects with sound. Materials: 8 12v RGB Waterproof Flexible LED Strips 10ft long (usledsupply.com) - $800 8 RGB 4A/Ch Amps (usledsupply.com) - $200 8 RGB 4A/Ch Amps with TTL input (usledsupply.com) - $200 RGB Controller 8 Key Touch (Wall Plate) - $25 1 Arduino Mega - $60 1 Arduino Mega ProtoShield - $15 1 AdaFruit WaveShield - $22 1 Electrical panel enclosure to house the Arduino and LED Strip amps - $30 18-4 cable for wiring the LED strips - $30 2 Power Supply 12v 48W 4A 1 5VDC Power Supply Waterproof Butt Connectors Standard CAT5 wire 2 pairs of Audio Baluns Molex connectors and crimping pins Alcohol Sensor Various switches and two 10K potentiometers Other sensors of your choice Speakers Audio Amplifier or Whole House Audio System Electro-Seal by Ducky (waterproof, flexible rubber coating) - Optional http://www.instructables.com/id/Arduino-Projects/ Image Notes 1. Start the Breathalyzer 2. Turn to change the mode from Lightning simulator, Breathalyzer, and Graphic Equalizer 3. Change the Breathalyzer Character/voice 4. Small piece of PVC which is removed and then exposes the alcohol sensor Step 1: The Schematic & Audio Solution I needed to be able to control each of the 8 LED strips (each strip is 10 feet long) individually. Controlling each LED in the strip individually would have been nice but was not required for this project. After a bit of research, I landed on the folks over at usledsupply.com. Their service was great, they answered all of my questions even the dumb ones in a timely manner. They also did a custom wiring schematic based on my requirements and pre-cut the LED strips to the lengths I needed. The project also needed sound for the Breathalyzer feature as well as some of the other effects, the Adafruit WaveShield fit the bill for this. Line level audio comes out of the WaveShield and goes into an existing whole house audio sound system (the Nuvo Grand Concerto). It was a 70ft run to the Grand Concerto audio system and unfortunately line level audio picks up noise very quickly on long runs so audio baluns over CAT5 were used to eliminate the noise. For the Graphic Equalizer (VU Meter) feature, line level audio goes out from the Grand Concerto audio system into an analog input pin on the Arduino Mega. usledsupply.com had an off the shelf LED controller for controlling the colors, dimming, flashing, etc. So I wanted to be able to use this controller along with the Arduino Mega for the lightning simulator/breathalyzer/graphic equalizer functions. The way this works is you simply turn on the controller you want and turn the other one off. A higher resolution pic of the schematic Image Notes 1. usledsupply.com off the shelf RGB LED strip controller http://www.instructables.com/id/Arduino-Projects/ Step 2: Digging the Trenches & Running the Power & Audio I had decided at the beginning I didn't want a lot of wires and power cords showing so I housed the power supplies downstairs in my basement and ran the +12VDC power for the LED strips and +5VDC power for the Arduino Mega over standard sprinkler 18/5 wire (70 foot run). Also ran CAT5 for the audio baluns mentioned in step 1. Image Notes 1. digging the trenches Image Notes 1. Ran the +12vDC over 18 gauge 5 conductor sprinkler wire, the power adapters are in the basement http://www.instructables.com/id/Arduino-Projects/ Image Notes http://www.instructables.com/id/Arduino-Projects/ 1. Picked up the orange wire snaking tool at Home Depot, it was absolutely great. Unlike the traditional fishing wire, this was solid and rigid and add 12 ft was long enough for the runs I needed Image Notes 1. Audio Baluns 2. 70ft CAT5 run to outdoor controller box Image Notes 1. Grand Concerto Whole House Audio System (in the basement) Image Notes 1. Grand Concerto keypad, used to select music tracks from a networked iPod http://www.instructables.com/id/Arduino-Projects/ Step 3: Mounting the LED strips Mounting the LED strips was pretty easy although time consuming. Mount them using a caulking gun with a tube of 100% Silicone from your local home improvement store. Lay down a bead of the Silicone and then attach the strips. You'll need to secure them with staples or in my case, painter's tape until the Silicone has dried and hardened. It's also a good idea to power at least one of the strips so you know you've got your wiring right and the strips are not defective before permanently attaching them. Image Notes 1. Laying down the silicone bead along the trellace Image Notes 1. +12VDC power supply (2 of them) 2. 8 LED strips 3. butt connectors 4. LED amps Image Notes 1. Secure the LED strip with a staple or painter's tape. Image Notes 1. The guys at usledsupply.com were nice enough to pre-cut the strips to the length I needed http://www.instructables.com/id/Arduino-Projects/ Step 4: Wiring the LED Strips and Sensors to the Arduino Mega Now the hardest and most time consuming part, wiring up the LED strips and various sensors to the Arduino Mega. I soldered the LED strip and sensors to the Arduino Mega Protoshield for permanent connections. There are a few minor tweaks needed to get the AdaFruit WaveShield to work with the Arduino Mega which is well documented in the AdaFruit support forums. The LED Amps from usledsupply.com came with screw terminals connections as opposed to solder points which is nice for moving things around but a little more work for permanent installations. I also used Molex connectors so the controller board can be removed later for future modifications without the need to cut wires. The RGB amps were secured to a piece of wood using RTV silicon and then the wood board was mounted inside the off the shelf electrical panel (spray painted black). I then ran standard CAT5 cable to the knobs and buttons enclosure in the next step. CAT5 wire is great for this purpose as you get 8 wires in one nice clean run and the wires are color coded already. Image Notes 1. The finished controller mounted in a standard outdoor electrical panel box Image Notes 1. Yes I know, I'm surprised it works myself http://www.instructables.com/id/Arduino-Projects/ Image Notes 1. Arduino Mega with AdaFriut WaveShield (for the sound) 2. Audio Balun 3. To the LED Strips, the Molex connector helped keep things organized 4. LED Strip Amps Image Notes 1. ProtoShield for the Arduino Mega, I soldered connections here for the Sensors and LED strips Image Notes 1. Custom CAT5 cable http://www.instructables.com/id/Arduino-Projects/ Image Notes 1. Audio Balun Image Notes 1. these wires in between the trellace beams are pretty much hidden from view unless someone knows to look for them http://www.instructables.com/id/Arduino-Projects/ Image Notes 1. CAT5 and +12VDC power over the 18 gauge sprinkler wire Step 5: The Outdoor Breathalyzer My wife and I throw a Halloween party every year and we'd thought it'd be cool to have an outdoor Breathalyzer where the LED strips light up proportionally based on how much you've had to drink and also talks to you giving a different response based on your alcohol intake. The potentiometer with the knob on the right changes the voice of the Breathalyzer character. The Breathalyzer has four characters, an old English voice, a Pirate, a scary Halloween character, and an insulting New York cabbie character. I used the same characters and voices for this Breathalyzer as from a different project of mine, the Magic Mirror at diymagicmirror.com. The potentiometer with the knob on the left is used to toggle the mode from Lightning Simulator, to Breathalyzer, and to Graphic Equalizer. There are two CAT5 cables running into this box from the controller in the previous step. The big red button is from Seeedstudio and really has a nice sturdy feel to it, this triggers the Breathalyzer. http://www.instructables.com/id/Arduino-Projects/ Image Notes 1. Start the Breathalyzer 2. Turn to change the mode from Lightning simulator, Breathalyzer, and Graphic Equalizer 3. Change the Breathalyzer Character/voice 4. Small piece of PVC which is removed and then exposes the alcohol sensor Image Notes 1. alcohol sensor (from MQ-6 from Seeedstudio) http://www.instructables.com/id/Arduino-Projects/ Image Notes 1. Standard CAT5 cable Step 6: Arduino Code With all the sample code out there on the Internet, this part is pretty easy. Attached is the Arduino code for this project. What's cool about having the Arduino Mega is there are enough digital pins available (24 to be exact) where the red, green, or blue colors for each strip can be controlled by each of the 24 digital pins. So if you want to make yellow for example, then just turn on red and green at the same time. To make white, turn on red, green, and blue all at the same time. I'd like to thank the guys who posted this VU meter Instructable, I was able to use that code for the Graphic Equalizer piece. On other funny thing about these LED strips is that to turn them on, use this digitalWrite(red1, LOW); not this: digitalWrite(red1, HIGH); Took me awhile to figure that one out as LOW normally turns something off and HIGH turns it on. It's the opposite in this case with the LED strips. http://www.instructables.com/id/Arduino-Projects/ File Downloads trellace_led.pde (57 KB) [NOTE: When saving, if you see .tmp as the file ext, rename it to 'trellace_led.pde'] Related Instructables The Digital Light Arduino Kitchen Wand! (video) by Timer by TxPilot anonymouse197 Arduino Examples #1 Make An RGB Led Randomly Flash Different Colors by qazwsx755 Wireless Accelerometer Controlled rgbLED's by Andlier RGB's with Arduino and Processing by nazdreg2007 Arduino Examples #2 Use an Arduino as a FTDI Programmer by qazwsx755 Capacitive touch Mood/Ambilight by lunar Arduino mood lighting by sapc http://www.instructables.com/id/Arduino-Projects/ Arduino XMAS hitcounter by alex_weber on December 16, 2007 Intro: Arduino XMAS hitcounter Christmas is coming closer, so here is my contribution to put you in the right mood. It is a blog hitcounter, that rings a bell. Literally. It puts a smile on your face, every time someone hits your blog. It consists of an Arduino board, a bell, a servo and a couple of lines of code in c, python and php. Most parts are fairly common and should be easy to get. Step 1: Tools and Materials So what is needed? Arduino Board. I got an Arduino Diecimila from Adafruits. In the meantime there are really cheap and handy clones out there, e.g. the really bare bone board from Modern Devices, especially if you want to use them on a breadboard. A servo motor. Any servo will do. I took an old one that was used in my former hobby. A bell. Preferably one that is small enough to shake it with the servo. Two paperclips. A large one to hold the bell and a small one to build the actuator to ring the bell. Wires to connect the servo with the Arduino. A website. In fact it has not to be a website or a blog. Actually everything that can be counted, will work. A PC or a Mac to connect the Arduino board with the blog or website. You may need an soldering iron, if the wires can not be connected directly to the Arduino. http://www.instructables.com/id/Arduino-Projects/ Step 2: Hardware Assembly The bell is held by a strong paperclip. The small paperclip is used to form a kind of arm that is atached to the servo motor. Note, that you want to bent the paperclip that holds the bell in a way, that already a little shaking generates a ding. http://www.instructables.com/id/Arduino-Projects/ Image Notes 1. Attach the paperclip with the bell to the servo. Fix it with these cable strippers (what are they called?). Image Notes 1. fix the paperclip to hold the bell in position. Image Notes 1. attach the small paperclip to the servo arm. Image Notes 1. Bent the paperclip in a way, that small shaking rings the bell. http://www.instructables.com/id/Arduino-Projects/ Step 3: Schematics There is no real schematic. Just attach the servo motor to the Arduino. The servo has three wires: yellow or orange: signal red: VCC brown: GND The red and the brown one are attached to the according pins on the Arduino (5V and GND). The orange one is wired to pin 2. It will signal the servo in which direction to turn. You may want to solder small connectors to the wires if the wires do not fit directly into the Arduino or the servo. http://www.instructables.com/id/Arduino-Projects/ Step 4: Programming the Arduino Arduino If you are new to the Arduino, it is a small board, fully assembled with a AVR microcontroller. It is well suited for hacking and interacting with your environment. Many things that are hard with microcontrollers are rather easy with Arduino. Some of the advantages: no need for a separate programming device (programmer) comes with an integrated development environment (IDE) runs on any platform, Windows, Mac, Linux. easy connection to your PC with USB hardware is open source (but the name Arduino is not) has a great community More information can be found at the official Arduino website. Be sure, to check out John's Arduino instructable for further details on how to get started with Arduino. What does the software do? The small piece of software that gets uploaded to the Arduino, controls the servo. It receives single bytes via the serial connection over the USB cable. If it receives a value of 5, it moves the servo arm five times forth and back. So the max value to send is 255. Program the Ardiuno So I assume you have downloaded and installed the latest Arduino IDE from Arduino.cc. For now it is version 0010 Alpha. To drive the servo more comfortably you have to download a library. You can find it on the Arduino Playground. Unzip it and put the folder in .../arduino0010/hardware/libraries/. Attach the Arduino to your PC with the USB cable. Open the IDE and start a new sketch. Sketch is Arduino speak for program. Select File -> New. Select the appropriate serial device (Tools -> Serial Port). This depends on your environment, for me it is /dev/tty.usbserial-A4001JAh. Download the attached source file and paste it into the new sketch. Hit the save button. Hit the verify button. This compiles your sketch into a hex file that can be transferred to your Arduino. Hit the upload button to transfer your sketch to the Arduino. Testing Now your hitcounter is ready for some action. Let's see if it works. Hit the serial monitor button. Select the text box next to the send button. Hit the tab key and send it. By now the servo arm should move forward and back. Phew. That was the hardest part. For now you can send a byte to the Arduino and the servo waves at you. Next is to find something that you want to trigger the bell. We are almost done. Image Notes 1. verify/compile http://www.instructables.com/id/Arduino-Projects/ 2. upload 3. serial monitor 4. editor for your sketch 5. debug and status messages. File Downloads bells.pde (1 KB) [NOTE: When saving, if you see .tmp as the file ext, rename it to 'bells.pde'] Step 5: Make it a hitcounter To make it a hitcounter for your website, we need two small code pieces. One two create and take care of the counter and a second to fetch the value of the counter and to send it to the Arduino. Note: If you are not familliar with Python or PHP, the scripts can be easily ported to your favorite programming language. The counter Here is a small PHP script, that reads a value from a file (hitcounter.txt), increments it and writes it back to the file. That is all, that is needed. This file can be saved as counter.php on your server for example. You can then trigger a count with you webbrowser pointing to http : //www.youdomain.com/counter.php. I included this snippet in my wordpress blog. $hits = file($count_my_page); $hit = trim($hits[0]); $hit++; $fp = fopen($count_my_page , "w"); fputs($fp , "$hit"); fclose($fp); echo $hit; ?> The glue code This next code snippet is used to fetch the counter. I used Python but anything should work. It opens an HTTP connection and fetches the hitcounter.txt. If the value has changed since the last fetching, the diff is calculated and pushed to the Arduino. This is done every ten seconds until you interrupt the script with crtl-c. Adapt the myUrl and the serial connection below to your needs. # # fetch counter # import time import urllib import serial # usb serial connection to arduino ser = serial.Serial('/dev/tty.usbserial-A4001JAh', 9600) myUrl = 'http://tinkerlog.com/hitcounter.txt' last_counter = urllib.urlopen(myUrl).read() while (True): _ counter = urllib.urlopen(myUrl).read() _ delta = int(counter) - int(last_counter) _ print "counter: %s, delta: %s" % (counter, delta) _ ser.write(chr(ord(chr(delta)))) _ last_counter = counter _ time.sleep(10) I could not upload files with php extension, so you have to rename the counterphp.txt to counter.php. If your Arduino is still attached to your PC, then start the Python script to fetch your hitcounter. ..>python counter.py and you should see the output of the counter. If you point your browser to the URL of your counter.php and hit reload, you should hear your hitcounter ringing. Yes, now we are done. Time to lean back and enjoy our work. File Downloads counter.py (484 bytes) [NOTE: When saving, if you see .tmp as the file ext, rename it to 'counter.py'] counterphp.txt (202 bytes) [NOTE: When saving, if you see .tmp as the file ext, rename it to 'counterphp.txt'] http://www.instructables.com/id/Arduino-Projects/ Step 6: Conclusion It is the first time, that I built something, that has moving parts. That is the first step to bridge the gap between the virtual and the real world. And it was really easy, the code is straight forward. Also most of the parts were in my trash bin, except the bell. Putting everything together and waiting for someone to hit my blog was fun. Hope you enjoyed it. Related Instructables Spectrographic Auroral Indicator - A Northern Lights Warning Device by youevolve Sewable Arduino Interface by Plusea xmas-box: Arduino/ioBridge Time-Lapse Photography by internet randofo controlled Christmas lights and music show by noelportugal coin slot detector by semiotech Moisture Test: Build an Arduino Controlled Low Temp Oven by mollyd Solid Wood Digital Clock by J_Hodgie Future xmas lights (video) by Computothought http://www.instructables.com/id/Arduino-Projects/ Arduino magnetic stripe decoder by powerpants on July 31, 2008 Intro: Arduino magnetic stripe decoder This instructable shows how to use some freely available code, an arduino, and a standard magnetic stripe reader to scan and display the data stored on magnetic stripe cards such as credit cards, student IDs, etc. I was inspired to post this after reading the intro to magnetic stripe reading and Stripe Snoop that is found in MAKE magazine Volume 1. That tutorial details how to interface a stripe reader to a game port interface, but I have a mac laptop, so I don't have a game port interface! Also, I think that the arduino suite of hardware/software is much more integrated and easy to understand for beginners than the "traditional" approach presented on the Stripe Snoop website and MAKE magazine. However, this application simply shows the data that's on a magnetic stripe; it does not have any of the more advanced features that Stripe Snoop does. The last step of this instructable has some links to more in-depth information about this topic for those who are interested. Image Notes 1. Magnetic Stripe Reader 2. Arduino Step 1: Hardware Obviously, you first must obtain a magnetic stripe reader. I'm using an Omron V3A-4K that I ordered from digikey. It cost me $20.00 or so. If you can't find one of these, any standard TTL reader will do. Don't worry about buying one of the fancy harnesses that they sell. There are breakout pads on the circuit board inside of the reader. Once you have received your reader, pop off the side cover, and solder wires to the pads as shown in the picture. Of course, if you have a different reader, the wiring will probably be different. In this case, consult your reader's datasheet to locate the necessary pads. Next, connect the wires to the Arduino's digital pins as follows: DATA - 2 CLK - 3 LOAD - 5 Finally, connect the +5v and GND to their respective terminals on the Arduino board. http://www.instructables.com/id/Arduino-Projects/ Image Notes 1. GND 2. +5V 3. DATA 4. CLK 5. LOAD Image Notes 1. Reader with the cover removed Image Notes 1. Supply wires 2. DATA, CLK, and LOAD wires Image Notes 1. Magnetic Stripe Reader 2. Arduino Step 2: Software This step is easy. Simply load the attached sketch on to your Arduino. Note: I didn't write this code, I found it here. I've just attached it here for convenience. http://www.instructables.com/id/Arduino-Projects/ File Downloads Arduino_Magstripe_Reader.pde (4 KB) [NOTE: When saving, if you see .tmp as the file ext, rename it to 'Arduino_Magstripe_Reader.pde'] Step 3: Use it! Finally, simply open the serial connection in the arduino applet, and start swiping cards! The decoded data from the card will appear in the window as soon as you swipe one. http://www.instructables.com/id/Arduino-Projects/ Image Notes 1. Pei Wei Gift Card! Step 4: Where do I go from here? If you're interested in learning more about magnetic stripe cards, the attached article, "A Day in the Life of a Flux Reversal" by Count Zero is required reading. This document is pretty much the bible on the nuts and bolts (volts?) of how magnetic stripes physically work. It also contains information about the standard formatting of the tracks on magnetic stripes, which is helpful in interpreting data that you get from the setup shown in this instructable. Also, check out Stripe Snoop. This software requires a slightly more complicated hardware setup, but comes with a database of known card formats and will attempt to parse human-readable data out of any card that you swipe through it. For example, if you swipe your credit card or driver's license, it will recognize it, and show you all of your personal information that is stored on that card! Although, since this setup outputs data directly to the serial port of the computer, I'm sure that with a little code hacking it wouldn't be too hard to get this reader to interface directly to Stripe Snoop..... File Downloads magstripe.txt (43 KB) [NOTE: When saving, if you see .tmp as the file ext, rename it to 'magstripe.txt'] Related Instructables Arduino Magstripe Emulator by sketchsk3tch Magnetic stripe card spoofer by powerpants coin slot detector by semiotech MAS 960 Design for empowerement - Arduino project RUDI by finkejer Autonomous Control of RC Car Using Arduino by careyfisher Arduino XMAS hitcounter by alex_weber Sewable Arduino Interface by Plusea Power Arduino with a cellphone by zimirken http://www.instructables.com/id/Arduino-Projects/ Arduino EMF (Electromagnetic Field) Detector by computergeek on May 25, 2009 Intro: Arduino EMF (Electromagnetic Field) Detector A while back I saw an EMF (Electromagnetic Field) Detector at makezine.com that used a led bargraph. I decided to modify it to use a 7-Segment LED Display! Here's my project. Sorry I don't have any pictures of it in use. Hopefully I can post some soon. Credit goes to Aaron ALAI for the original project . Also Conner Cunningham at Make: for doing a remake . Have fun, work hard, & play nice! If you have questions please ask them! Image Notes 1. In case you're wondering, This is the same diagram I used in my app, which is in the iTunes app store, 'Electrical Ref'. Step 1: The Stuff: The parts & tools. Parts: - Arduino - 7-Segment LED Display - 3.3M Resistor (Orange, Orange, Green) - 470 ohm resistor (Yellow, Violet, Brown) or a similar value for the LED display - Wire. I'm using 26 gauge wire - Breadboard Tools: - Computer with Arduino IDE - USB A-B cable for Arduino - Wire Strippers http://www.instructables.com/id/Arduino-Projects/ Image Notes 1. Arduino 2. Breadboard 3. Wire 4. 3.3M Resistor 5. Arduino power cable or a usb cable 6. 7-segment Display 7. 470 Ohm Resistor not pictured Step 2: Wire the 7-Segment LED Display This is probably one of the most confusing parts of the project, so I'll try to be clear. But if I'm not please ask any questions you have. I used pins 2-8 on my arduino for the display. I wired the pins on the display counter-clockwise starting at the upper-left corner. Hopefully the pictures help explain it better. Picture 1) Display before installation. Picture 2) Display after installation. Picture 3) Pin 1 on the display goes to pin 2 on the Arduino. Picture 4) Pin 2 on the display goes to pin 3 on the Arduino. Picture 5) Pin 4 on the display goes to pin 4 on the Arduino. Picture 6) Pin 5 on the display goes to pin 5 on the Arduino. Picture 7) Pin 6 on the display goes to pin 6 on the Arduino. Picture 8) Pin 8 on the display goes through the 470 ohm resistor to the side rail on the bread board Picture 9) Pin 9 on the display goes to pin 7 on the Arduino. Also Ground on the arduino is connected to the side rail on the arduino. Picture 10) Pin 10 on the display goes to pin 8 on the Arduino. If you have any question please ask them! Image Notes 1. The display goes here 2. The Display http://www.instructables.com/id/Arduino-Projects/ Image Notes 1. Goes to pin 5 2. Goes to pin 4 3. Goes to pin 2 4. Goes to pin 3 5. Pin 5 6. Pin 3 7. Pin 4 8. Pin 2 9. Pin 8 10. Pin 7 11. Pin 6 12. Goes to pin 6 13. Goes to Ground 14. Goes to pin 7 15. Goes to pin 8 http://www.instructables.com/id/Arduino-Projects/ http://www.instructables.com/id/Arduino-Projects/ Image Notes 1. 470 Ohm resistor between ground on the breadboard and the cathode on the display Image Notes 1. Another wire added 2. ground on the arduino to the side rail on the breadboard 3. This is now ground http://www.instructables.com/id/Arduino-Projects/ Step 3: Add the Probe/Antenna Make the antenna/probe: - Cut a 6-7 in. piece of solid core wire. - Strip one end so you can plug it into your breadboard - Strip the other end about 2 in. from the end. Add the antenna: (Pictures 2-6) - Take the 3.3M ohm resistor and connect it from the ground on the arduino to a point on the breadboard - Add another wire from where the resistor is connected to analog pin 5 on the arduino. - Add the antenna to where the resistor and the wire are connected on the breadboard. Image Notes 1. The other side Image Notes 1. 3.3M resistor from ground Image Notes 1. Analog pin 5 Image Notes 1. Antenna http://www.instructables.com/id/Arduino-Projects/ Image Notes 1. All done Image Notes 1. In case you're wondering, This is the same diagram I used in my app, which is in the iTunes app store, 'Electrical Ref'. Step 4: The Code Here's some basic steps to program your arduino. 1) Download the source code from below 2) Open the file in the Arduino IDE 3) Press the "Upload to I/O Board" button 4) Once the program is uploaded it will start running Hopefully there are enough comments in the code, but if you have any questions, please ask them. There is no difference between the .pde file & the .txt http://www.instructables.com/id/Arduino-Projects/ File Downloads _7_seg_EMF_detector.pde (6 KB) [NOTE: When saving, if you see .tmp as the file ext, rename it to '_7_seg_EMF_detector.pde'] 7_seg_EMF_detector.txt (6 KB) [NOTE: When saving, if you see .tmp as the file ext, rename it to '7_seg_EMF_detector.txt'] Step 5: Play with it! Now go measure EMF's! Here's a few ideas: - Your dog/cat - You - Computer - Cell phone - TV Make sure to use common sense, I'm not responsible for any damage to you or your arduino! Related Instructables Charlieplexing 7 segment displays by matseng Make a debug display for microcontrollers by andyk75 4-Digit 7Segment LED Display + Arduino by RoboGeekDude12 TimeDuino- 7 Segment Arduino Clock (No shift registers needed!) by astroboy907 7-SegmentDisplay by mertaxoy Arduino 7 segment countdown timer by baharini Make your own programmable thermostat for $66 with Arduino by dustinandrews The 74HC164 Shift Register and your Arduino by osgeld http://www.instructables.com/id/Arduino-Projects/ http://www.instructables.com/id/Arduino-Projects/ Using a Dot Matrix LED with an Arduino and Shift Register by nevdull on July 27, 2009 Author:nevdull AVR-based Network Combat Gian is a microbial biochemist by education but an avid computer science flunky and wishes this hobby could be self-sustaining.. He has a collection of 8-bit microcontrollers and a room full of computer junk that he believes talks to him. He is a sympathizer with the Robot Overlords and is adroitly maneuvering himself to be in a comfortable position when the AVR global domination begins. He is also scared of zombies. Intro: Using a Dot Matrix LED with an Arduino and Shift Register The Siemens DLO7135 Dot matrix LED is one amazing piece of optoelectronics. It's billed as a 5x7 Dot Matrix Intelligent Display (r) with Memory/Decoder/Driver. Along with that memory, it's got a 96-character ASCII display set with upper and lower case characters, a built-in character generator and multiplexer, four levels of light intensity, and it all runs on 5V. That's a lot to live up to, and at $16 a pop, it definitely should. While spending half the day at my favorite local electronics shop I found a bin full of these for $1.50 a piece. I left the store with several. This instructable will show you how to connect to these dot matrix LED's and display characters using an AVR-based Arduino. If you've read any of my previous guides, you may get the idea that I'm often in favor of the most parsimonious solution, and you wouldn't be wrong, even if I do fall short of the goal from time to time. Therefore, I'll also go another step in this instructable and show you how you can reduce the number of I/O ports needed to drive these big, honkin' dot matrix LED's. http://www.instructables.com/id/Arduino-Projects/ File Downloads DLO7135.pdf ((612x792) 173 KB) [NOTE: When saving, if you see .tmp as the file ext, rename it to 'DLO7135.pdf'] Step 1: Get the Goods... For this short little project, you will need: an AVR-based microcontroller like an Arduino or any of it's ilk. These instructions could probably be adapted to your MCU of choice. a DLO7135 dot matrix LED or other in the same family an 8-bit shift register like the 74LS164, 74C299, or 74HC594 a breadboard hookup wire, wire cutters, etc. A soldering iron isn't needed, although I use one later; you can get by without it. Image Notes 1. Pay no attention to the man behind the curtain.... http://www.instructables.com/id/Arduino-Projects/ Step 2: Directly Connect to the LED Display Lay out your small list of parts and grab the LED. Place it on the breadboard centered somewhat, straddling the midline groove. The first part of connecting takes place all on the left side of the LED. Pin #1 is located at the top left as indicated by the triangle/arrow. I put the pin functions on a picture for your reference as you're reading or connecting up your LED. The Left Side Positive and Negative Starting at the top left, connect Vcc to 5V. It's maybe a good idea to not have your board powered until you get the entire left side completed; the LED can be bright if you're trying to see small holes to poke in wires. Connect the bottom left GND to ground. Lamp Test, Chip Enable and Write The 2nd and 3rd from the top on the left are Lamp Test and Chip Enable. These are both negative logic, meaning they are enabled when they are at a logical 0 instead of 1. My picture below should have bars over them, but I didn't annotate that for any of them. The LT pin when enabled lights up every dot in the dot matrix at 1/7th brightness. It's more of a pixel test, but the interesting thing about the LT pin is that it doesn't overwrite any character that's in the memory, so you if you have several of these strung together (they have a 20ft viewing distance), strobing LT can make it look like a cursor. To ensure it's disabled, connect it to 5V. The CE and WR pins are also negative logic and are required to be enabled for this smart device to be written to. You could micromanage these pins with spare I/O ports on your microcontroller, but we won't bother here. Just connect them to ground to keep them enabled. Brightness Levels There are four programmable brightness levels on the DLO family of LEDs: Blank 1/7 Brightness 1/2 Brightness Full Brightness BL1 HIGH and BL0 LOW is 1/2 brightness. Both HIGH is full brightness. Set it to whatever you like. Again, if you have I/O ports to spare and it's important enough to you, this can also be controlled by your Arduino. That wraps up the left side. If you bring power to your board you should see the LED light up. Play with the brightness controls and the lamp test to get familiar with it, if you're curious. The Right Side The right side consists of entirely data ports. The bottom right, pin 8 or D0 to be precise, represents the Least Significant Bit in the 7-bit character. The top right, pin 14 or D6 represents the Most Significant Bit. This lets you know what order to shuffle your bits when writing to the LED. When you have the data input ports wired up, find seven empty digital I/O ports on your Arduino or AVR and connect them. You'll probably want to remember what data output port on your AVR goes to which data input port on the LED. Now you're ready to push some data onto that smart LED. Are you trembling with excitement yet? I know I am... http://www.instructables.com/id/Arduino-Projects/ Image Notes 1. Left side connected except for BL0 Image Notes 1. Ground 2. 5V 3. Lamp Test 4. BL1 Image Notes 1. D6 MSB 2. D0 LSB Image Notes 1. BL0 free floating while I get ready to try the different brightness levels. http://www.instructables.com/id/Arduino-Projects/ Image Notes 1. I changed wires from previous pictures to a heavier gauge so they'd stay in. Otherwise, same setup. Step 3: Specifying a Character to be Displayed The character set that's used on this CMOS LED is your run-of-the-mill ASCII starting at 0x20 (decimal 32; a space) and ending at 0x7F (decimal 127; a delete, although represented on the LED as a cursor graphic). So, having the LED display a character entails nothing more than pushing the a logic 1 or 0 on your data output pins, usually followed by a WR pulse, but I'm foregoing that for this exercise. So, you've written down or remembered what pins go to what ports, right? I chose PD[2..7] and PB0 (digital pins 2 through 8 in Arduino-speak). I don't normally suggest using PD[0..1] because I dedicate it to my serial communication back to a FreeBSD box, and Arduino's et al. map those pins to their FTDI USB communication channel, and although "they" SAY pins 0 and 1 will work if you don't initialize serial communication, I have never been able to use those pins as normal digital I/O. In fact, I spent two days trying to debug a problem when I tried to use PD0 and PD1 and found that they were always HIGH. *shrug* It would probably be good to have some sort of external input, like maybe a keypad, a pushwheel or thumbwheel switch, or maybe even input from a terminal (my ArduinoTerm isn't ready for prime time just yet...). The choice is yours. For now, I'm just going to illustrate how to get the code to get the character you want onto the LED. There is a zipfile for download including the source code and Makefile and there's also a short movie showing the LED printing out its character set. Sorry for the crappy quality of the video. The code below prints the string "Welcome to my Instructable!" then cycles through the entire character set that the LED supports. DDRD = 0xFF; // OutputDDRB = (1<<DDB0); char msg[] = "Welcome to my Instructable!";uint8_t i;for (;;){ for(i=0;i<27; i++) { Print2LED(msg[i]); The port output is taken care of in the Print2Led() function. voidPrint2LED(uint8_t i){ PORTD = (i << 2); if (i & 0b01000000) PORTB = (1<<PINB0); else PORTB = (0<<PINB0);} The code and Makefile is included in a zip file below. http://www.instructables.com/id/Arduino-Projects/ File Downloads dotmatrixled1.zip (6 KB) [NOTE: When saving, if you see .tmp as the file ext, rename it to 'dotmatrixled1.zip'] Step 4: Conserve I/O Ports with a Shift Register So now our microcontroller can send data to the dot matrix LED but it's using eight I/O ports. That excludes using an ATtiny in an 8-pin DIP package, and even with a newer Arduino sporting an ATmega328p that's a lot of I/O ports for one LED. We can get around this, however, by using an IC called a shift register. A moment to "shift" gears... A shift register can be understood best by thinking about the two words that make up its name: "shift" and "register." The word shift refers to how the data is moving through the register. Here (as in our Arduino and microcontrollers, in general) a register is a location that holds data. It does this by implementsing a linear chain of digital logic circuits called "flip flops" that has two stable states that can be represented by either a 1 or 0. So, by putting eight flip flops together you have a device that is capable of holding and representing an 8-bit byte. Just as there are several types of flip flops, and several variations on a theme of shift registers (think up/down counters and Johnson counters), there are also several types of shift registers based on how data is latched into the register and how that data is output. Based on this, consider the following types of shift registers: Serial In / Parallel Out (SIPO) Serial In / Serial Out (SISO) Parallel In/ Serial Out (PISO) Parallel In / Parallel Out (PIPO) Two of note are SIPO and PISO. SIPO registers take data serially, that is, one bit after another, shifting the previously input bit over to the next flip flop and sending the data out on all inputs at once. This makes a nice serial to parallel converter. PISO shift registers, conversely, have parallel inputs, so all bits are entered at once, but are output one at a time. And you guessed it, this makes for a nice parallel to serial converter. The shift register we want to use to reduce the number of I/O pins would allow us to take those 8 IO pins we used earlier and reduce them down to one, or maybe just a couple, considering we may need to control how we input the bits. Therefore, the shift register we'll use is a Serial In / Parallel Out. Wire up the shift register between the LED and Arduino Using a shift register is easy. The hardest part is just visualizing the data output pins and how the binary digits will end up in the IC, and how they will eventually show up on the LED. Take a moment to plan this out. 1. Attach 5V to pin 14 (top right) and take pin 7 (bottom left) down to ground. 2. The shift register has two serial inputs but we'll only be using one, so connect pin two to 5V 3. We won't be using the clear pin (used to zero out all outputs) so leave it floating or attack it to 5V 4. Connect one digital IO port to pin one of the shift register. This is the serial input pin. 5. Connect one digital IO port to pin 8 (bottom right). This is the clock pin. 6. Connect your data lines from Q0 to Q6. We're only using 7 bits because the ASCII character set only uses seven bits. I used PD2 for outputting my serial data and PD3 for the clock signal. For the data pins, I connected Q0 to D6 on the LED and continuing that way (Q1 to D5, Q2 to D4, etc). Since we're sending out data serially we will have to examine the binary representation of each character we want to send, looking at 1's and 0's, and outputting each bit on the serial line. I've included a second version of the dotmatrixled.c source along with a Makefile below. It cycles through the character set and displays all even characters (if it's weird thinking that a letter could be odd or even, think about the binary representation for a moment). Try to figure out how to make it cycle through displaying all odd characters. You can further experiment with the connections between the shift register, the dot matrix LED, and your Arduino. There are several control features between the LED and the register that can allow you to fine-tune your control about when data is displayed. So....we've gone from having to use eight I/O ports to only using two! http://www.instructables.com/id/Arduino-Projects/ http://www.instructables.com/id/Arduino-Projects/ File Downloads dotmatrixled.c (1 KB) [NOTE: When saving, if you see .tmp as the file ext, rename it to 'dotmatrixled.c'] Makefile (16 KB) [NOTE: When saving, if you see .tmp as the file ext, rename it to 'Makefile'] Step 5: Summary In this instructable, I have presented the DLO7135 dot matrix LED and how to make it work. I've further, discussed how to reduce the number of required I/O ports from eight to only two using a shift register. The DLO7135 dot matrix LED can be strung together to make very eye catching and interesting marquees. I hope you had fun reading this instructable! If there's any improvements you think I could make or suggestions you'd like to give on this or any of my 'ibles, I'm happy to hear them! Happy AVR'ing! Related Instructables How to use a 74HC595 Shift Register with a AVR ATtiny13 by roznerd Make a 8x10 L.E.D Matrix by Syst3mX The BlokClok Concept Arduino driven RGB Abstract The 74HC164 Shift Register and your Arduino by osgeld LED matrix using shift registers by barney_1 Arduino Pong (Photos) by fredrikl Make a 24X6 LED matrix by Syst3mX OSRAM DLO3416 Intelligent LED Display Module - Arduino Test (video) by http://www.instructables.com/id/Arduino-Projects/ Clock (video) by earthshine earthshine http://www.instructables.com/id/Arduino-Projects/ The 74HC164 Shift Register and your Arduino by osgeld on November 15, 2009 Intro: The 74HC164 Shift Register and your Arduino Shift registers are a very important part of digital logic, they act as glue in between the parallel and serial worlds. They reduce wire counts, pin use and even help take load off of your cpu by being able to store their data. They come in different sizes, with different models for different uses, and different features. The one I will be discussing today is the 74HC164 8 bit, serial in parallel out, non latched, shift register. Why? Well for one it is one of the most basic shift registers out there, which makes learning about it easier, but it just so happened to be the only one I had (lol!) This instructable covers how this chip works, how to wire it, and interface it with an arduino including some sample sketches and led circuits. I hope you all enjoy! Image Notes 1. 74HC164 2. bare bones arduino, the first arduino I have ever owned (since October) Image Notes 1. there is a lot of companies that make 74xx logic series chips, mine happens to be GoldStar, it could have been TI, phillips or anyone Step 1: So, what are shift registers? As mentioned earlier they come in all different flavors, and I also mentioned that I am using a 74HC164 8 bit, serial in parallel out, non latched, shift register so what does that all mean?!? First, the name 74 -- means its part of the 74xx logic family, and since its logic it cannot directly control very much current (16-20ma for the entire chip is common) , it only passes signals around, but that does not mean that signal is not going to a transistor which can switch a higher current load. HC means its a high speed cmos device, you can read about that on the link below, but what you basicly need to know about that is that it is a low power device and will run from 2 to 5 volts (so if your using a 3.3 volt arduino your ok) Also it can work properly at high speeds this particular chip has a typical speed of 78mhz, but you can go as slow or as fast (until it starts goofing up) as you want www.kpsec.freeuk.com/components/74series.htm 164 is the model number for this chip, there is a large chart of them on wikipedia en.wikipedia.org/wiki/List_of_7400_series_integrated_circuits Next, 8 bit A shift register is made up of flip flop circuits, a flip flop is 1 bit of memory, this one has 8 (or 1 byte of memory). Since it is memory, if you do not need to update the register you can just stop "talking" to it and it will remain in whatever state you left it, until you "talk" to it again or reset power. other 7400 logic series shift registers can go upto 16 bit serial in parallel out This means your arduino sends it data serially (on off pulses one after another) and the shift register places each bit on the correct output pin. This model only requires 2 wires to be controlled, so you can use 2 digital pins on the arduino, and break those 2 out to 8 more digital outputs some other models are parallel in serial out, they do the same thing but as inputs to the arduino (for example a NES gamepad) non latched This may be a downfall of this chip if you need it. As data enters a shift register via serial, it shows up on the first output pin, when a clock pulse enters in, the first bit shifts over 1 place, creating a scrolling effect on the outputs, for example 00000001 would show up on the outputs as http://www.instructables.com/id/Arduino-Projects/ 1 01 001 0001 00001 000001 0000001 00000001 If your talking to other logic devices who are sharing the same clock and not expecting this, it could cause issues. Latched shift registers have an extra set of memory, so once the data is done entering the register you can flip a switch and show the outputs, but it adds another wire, software, and things to keep up with. In the case of this instructable we are controlling LED displays, the scrolling effect happens so fast you cant see it (except when you very first turn on the chip), and once the byte is in the shift register there is no more scrolling We will be controlling bargraph type, 7 segment, and a 16LED 4x4 dot matrix with this chip and software on the arduino using only 2 digital pins (+ power and ground) Image Notes 1. there is a lot of companies that make 74xx logic series chips, mine happens to be GoldStar, it could have been TI, phillips or anyone Step 2: Basic wiring and operation Wiring The 74HC164 is a 14 pin chip, it has 4 input pins, 8 output pins, power and ground, so lets start from the top. Pins 1 and 2 are both serial inputs, they are setup as a logical AND gate, meaning that they both have to be logic high (ie 5 volts) in order for the bit to be seen as a 1, a low state (0 volts) on either will read as a zero. We dont really need this and its easier to deal with in software, so choose one and tie it to V+ so it always reads high. I choose to use a jumper from pin 1 to pin 14 (V+) since you can just pop a breadboard jumper over the chip. The one remaining serial input (pin 2 in my schematics) will goto digital pin 2 of the arduino. Pins 3,4,5,and 6 of the 74HC164 are the first 4 bytes of output Pin 7 connects to ground Jumping to the right, pin 8 is the clock pin, this is how the shift register knows the next serial bit is ready for it to read, this should be connected to digital pin 3 on the arduino. Pin 9 is to clear the entire register at once, if it goes low, you have the option to use it, but nothing in this inscrutable does, so tie it to V+ pins 10, 11 12 and 13 are the last 4 bytes of output pin 14 is the chips power Operation First you need to set the serial input of the register (digital pin 2 on the arduino) high or low, next you need to flip the clock pin (digital pin 3) from low to high, the shift register will read the data on the serial input and shift the output pins by 1, repeat 8 times and you have set all 8 outputs. This can be done by hand with for loops and digital writes in the arduino IDE, but since this is a very common hardware level communications (SPI) they have a single function that does it for you. shiftOut(dataPin, clockPin, bitOrder, value) Just tell it where the data and clock pins are connected to the arduino, which way to send the data and what to send, and its taken care of for you (handy) http://www.instructables.com/id/Arduino-Projects/ Step 3: Projects Okay, enough lecture and theory, lets do some fun stuff with this chip! There are 3 projects to try in this instructable, the first 2 are easy and can be breadboarded out in moments. The third one, the 4x4 led matrix, requires more time and thought to construct, due to the led wiring. List of parts Project 1: '2 Wire' bargraph LED display controller 1 * 74HC164 Shift register 1 * solderless breadboard 1 * arduino, or arduino compatible (5v) 1 * 330 ohm 1/4 watt resistor 8 * normal output red LED's 12 * jumper wires Project 2: '2 Wire' 7 segment display controller 1 * 74HC164 Shift register 1 * solderless breadboard 1 * arduino, or arduino compatible (5v) 1 * 330 ohm 1/4 watt resistor 1 * common cathode seven segment display 9 * jumper wires Project 3: '2 Wire' 4x4 led matrix display 1 * 74HC164 Shift register 1 * arduino, or arduino compatible (5v) 4 * 150 ohm 1 1/4 watt resistor 8 * 1Kohm 1/8 watt resistor (or larger) 8 * NpN transistor (2n3904 or better) 16 * normal output red LED's a means to construct it and regulated 5 volt power that can handle 160+ma (you can turn on all the LED's at once like a brake light) http://www.instructables.com/id/Arduino-Projects/ Step 4: Project 1[pt 1]: '2 Wire' bargraph LED display controller hardware Hook up the arduino and shift register according to the schematic, I already have a 10 segment bargraph display ready for breadboard use and that is what you will see in the image, but you can do the same thing with individual led's On the second page I stated that these were not driver devices, that they were logic devices, with tiny amounts of current able to pass through them. In order run 8 LEDs, while keeping the circuit simple, and not cooking the shift register, requires that we limit the current quite a bit. The LED's are wired in parallel and share a common ground (common cathode), before going into the power supply ground they need to pass through a 330 ohm resistor, limiting the total amount of current that all the LED's could possibly use to 10ma (at 5 volts) This leaves the LED's in a sickly looking state but they do light up and thus serve for this example, in order to drive the LED's at their proper current you will need to insert a transistor where the shift register can turn on / off a higher current source (see project 3) The Data pin of the shift register (pin 2) needs to connect to arduino digital pin # 2 The Clock pin of the shift register (pin 8) needs to connect to arduino digital pin # 3 http://www.instructables.com/id/Arduino-Projects/ Step 5: Project 1[pt 2]: '2 Wire' bargraph LED display controller software Example 1: Open the file " _164_bas_ex.pde" Inside the arduino IDE, Its a simple sketch that just lets you define on or off LED's in the bargraph display The first 2 lines define the pin numbers we will be using for data and clock, I use #define over const integer, I find it easier to remember, and there is no advantage to one or the other once compiled #define data 2 #define clock 3 next is the void setup function, it only runs once, so the arduino turns on, sets the shift register and has nothing else to do. Inside the void setup function we set the clock and data pins as OUTPUT pins, then using the shiftOut function we send the data to the shift register void setup() { pinMode(clock, OUTPUT); // make the clock pin an output pinMode(data , OUTPUT); // make the data pin an output shiftOut(data, clock, LSBFIRST, B10101010); // send this binary value to the shift register } In the shiftOut function you can see its arguments data is the data pin, clock is the clock pin LSBFIRST refers to what order its in, when writing it out in binary notation (Bxxxxxxxx) the 7th element past the B is the Least Signifigant Bit First, this is fed in first so it ends up on the last output once all 8 bits are fed in B10101010 is the Binary value being sent to the shift register, and it will turn on every odd light, try playing with different values to turn on or off different patterns and finally a empty void loop (because you need one even if your not using it) void loop(){} // empty loop for now Example 2: the first 8 lines are the same as the first 8 lines of the first example, in fact they will not change for any of the other projects, so http://www.instructables.com/id/Arduino-Projects/ #define data 2 #define clock 3 void setup() { pinMode(clock, OUTPUT); // make the clock pin an output pinMode(data , OUTPUT); // make the data pin an output But now in void setup there is an 8 count for loop, its taking an empty byte and shifting 1 bit in at a time starting from the leftmost bit and moving right. This is backwards from the first example where we started from the rightmost bit and worked left, but using MSBFIRST the shift out function sends the data the correct way Also we add a delay in the for loop so it slows down enough to be visible. for(int i = 0; i < 8; ++i) //for 0 - 7 do { shiftOut(data, clock, MSBFIRST, 1 << i); // bit shift a logic high (1) value by i delay(100); // delay 100ms or you would not be able to see it } } void loop(){} // empty loop for now upload the script and you should now see the bargraph light up each light one at a time Image Notes 1. notice the lights match our binary pattern of B10101010 File Downloads _164_bas_ex.pde (296 bytes) [NOTE: When saving, if you see .tmp as the file ext, rename it to '_164_bas_ex.pde'] _164_bas_ex_2.pde (411 bytes) [NOTE: When saving, if you see .tmp as the file ext, rename it to '_164_bas_ex_2.pde'] Step 6: Project 2: '2 Wire' 7 Segment display controller Look at the pinout of your 7 segment display (I only had a dual one but just using half) and use the drawing below to connect each segment to the correct bit on the shift register bit 1 = pin 3 bit 2 = pin 4 bit 3 = pin 5 bit 4 = pin 6 bit 5 = pin 10 bit 6 = pin 11 bit 7 = pin 12 bit 8 = pin 13 (if you want to use the decimal point) And the cathode of the display through the 330ohm resistor and to power supply ground now open the seven_seg_demo.pde in the arduino IDE First you see where we define the data and clock pins http://www.instructables.com/id/Arduino-Projects/ #define data 2 #define clock 3 Next we set all of the charater patterns in binary, this is pretty easy, look at the drawing below, if you need the middle segment type in a one, next do you need the top segment, if so type in another one, keep doing this until you cover all 8 segments, notice my rightmost bit (bit 8) is always 0, thats becuase i never turn on the decimal point. byte zero = B01111110; byte one = B00000110; byte two = B11011010; byte three = B11010110; byte four = B10100110; byte five = B11110100; byte six = B11111100; byte seven = B01000110; byte eight = B11111110; byte nine = B11110110; next in void setup we set our data and clock pins to outputs void setup() { pinMode(clock, OUTPUT); // make the clock pin an output pinMode(data , OUTPUT); // make the data pin an output3 } then in void loop we use shiftOut to display each pattern (number) wait 1/2 a second and display the next, 0 to 9, since its being done in the void loop function it will count 0-9 and repeat forever. void loop() { shiftOut(data, clock, LSBFIRST, zero); delay(500); shiftOut(data, clock, LSBFIRST, one); delay(500); shiftOut(data, clock, LSBFIRST, two); delay(500); shiftOut(data, clock, LSBFIRST, three); delay(500); shiftOut(data, clock, LSBFIRST, four); delay(500); shiftOut(data, clock, LSBFIRST, five); delay(500); shiftOut(data, clock, LSBFIRST, six); delay(500); shiftOut(data, clock, LSBFIRST, seven); delay(500); shiftOut(data, clock, LSBFIRST, eight); delay(500); shiftOut(data, clock, LSBFIRST, nine); delay(500); } File Downloads seven_seg_demo.pde (1 KB) [NOTE: When saving, if you see .tmp as the file ext, rename it to 'seven_seg_demo.pde'] http://www.instructables.com/id/Arduino-Projects/ Step 7: Project 3[pt 1]: '2 Wire' 4x4 led matrix display The 4x4 LED matrix project is quite a bit more complex, but it is almost all in construction, I choose to make mine soldered on perfboard, but it should be possible to replicate on a breadboard , just a lot more spaced out. The circuitry also differs in that the shift register is not directly driving the led's, instead the shift register outputs are sent through a 1Kohm resistor to the base of a NpN transistor, when the output of the bit is high, it lets enough current and voltage pass into the transistor to switch the connection tween the collector and emitter, the collectors are tied to a "sturdy" regulated 5 volts. The emitters of the transistors are connected to 150 ohm resistors and the resistors are tied to the annodes of 4 led's in a row and limits the row to 20ma, although when drawing images on the display only 1 led is on at a time, and therefore near full brightness (near becuase they switch on and off really fast to make up the whole image) There are 4 rows and 4 columns, each row gets a resistor and a transistor, on each column the LED's cathodes are tied together, ran into the collector of a transistor, whose base is also controlled by the shift register, and finally out to ground. Large version of schematic www.instructables.com/files/orig/F7J/52X0/G1ZGOSRQ/F7J52X0G1ZGOSRQ.jpg Step 8: Project 3[pt 2]: '2 Wire' 4x4 led matrix display The shift register controls both the anode and the cathodes of the LED's in a YX format, look at the following bit 1 = column 1 (rightmost) bit 2 = column 2 bit 3 = column 3 bit 4 = column 4 bit 5 = row 1 (topmost) bit 6 = row 2 bit 7 = row 3 bit 8 = row 4 To make an image draw out a 4x4 square on graph paper and fill in which ones you want displayed, next make a YX table. Below you will see a mapping for a simile, well as best one can do on 4x4 "pixels" For each filled in section I write down which column (Y) it is in, then which row it is in (X) Now open up the _4x4.pde file in the arduino IDE you will see our old 2 friends #define data 2 #define clock 3 then a array of integers int img[] = {1,1,4,1,1,3,4,3,2,4,3,4}; If you look its just a list of my written down YX coordinates, it would be a big pain in the butt to convert those values by hand, and we have a computer ... let it do it! Moving on there is void setup where we make our clock and data pins OUTPUTS void setup() { pinMode(clock, OUTPUT); // make the clock pin an output pinMode(data , OUTPUT); // make the data pin an output3 } And a confusing looking void loop, to start things off we need to declare some local variables void loop() { int Y; http://www.instructables.com/id/Arduino-Projects/ int X; byte out; Then a for loop, this loop needs to be as long as the amount of entries in the img array, for this image I only used 6 pixels, so that makes 12 YX coordinates. I make it skip every other number by using i +=2, because we read 2 coordinates per loop for(int i = 0; i < 12; i += 2) // number of points in the img array, this case 12 { Now we read the Y entery at [i] in the array, and subtract one from its value, because bytes don't start at one, they start at zero, but we counted from 1 // get the first pair of YX cords Y = (img[i] - 1); // subtract one since the bit count starts at 0 Next we read the X entery at [i + 1] in the array, and subtract one from its value, because of the same reason X = (img[i+1] - 1); After we have the YX values of the pixel, we do some bitwise or math and shifting to the left. First we need to read the X value, and whatever its value is shift it that many places + 4 left, so if X is 4 and add 4 it is bit 8 (MSB), looking at the chart again ... bit 1 = column 1 (rightmost) bit 2 = column 2 bit 3 = column 3 bit 4 = column 4 bit 5 = row 1 (topmost) bit 6 = row 2 bit 7 = row 3 bit 8 = row 4 Bit 8 is the last row Next the Y value is also shifted to the left, this time just by its self, nothing added on. Finally the two are or'ed together into 1 byte instead of 2 half bytes (nibbles), using bitwise or (the symbol | ) takes two bytes and basicly adds them together, lets assume X = 10000000 Y = 00000001 -------------------OR =10000001 row 4 column 1 out = 1 << (X + 4) | 1 << Y; And finally shiftOut to display the current picture, and keep doing that until we have no more data in the array ... delay a moment and loop forever, since we were shifting data to the left and we need the MSB to be on the last output pin of the shift register send it out first. shiftOut(data, clock, MSBFIRST, out); // shift the byte out to our register delay(1); // delay it abit so it has a chance to leave a spot of light in your eyes Feel free to make your own images, and effects, There are 3 sample files, the smiley face and a checkerboard (which looks more like stripes), and finally a random sparkle maker http://www.instructables.com/id/Arduino-Projects/ File Downloads _4x4.pde (884 bytes) [NOTE: When saving, if you see .tmp as the file ext, rename it to '_4x4.pde'] _4x4_rnd_sparkle.pde (570 bytes) [NOTE: When saving, if you see .tmp as the file ext, rename it to '_4x4_rnd_sparkle.pde'] _4x4_chx.pde (892 bytes) [NOTE: When saving, if you see .tmp as the file ext, rename it to '_4x4_chx.pde'] Step 9: Conclusion Over all this is a pretty handy little chip, and I am glad I scrapped it off of a old piece of electronics headed to the trash. It can be used for other things besides display systems, but everyone likes lights and the instant feedback of seeing whats going on is extremely helpful for the visual thinkers like I. Also please forgive my code, I have only had the arduino since bout the third week of October, and its been a pretty big crash course. But that's the great thing about the system, if you sit down and work with it, its full of neat features that make controlling the world with an 8 bit microcontroller quite easy to do. As always questions and comments are most welcome, and thanks for reading, I hope you learned a lot http://www.instructables.com/id/Arduino-Projects/ Image Notes 1. 74HC164 2. bare bones arduino, the first arduino I have ever owned (since October) Image Notes 1. there is a lot of companies that make 74xx logic series chips, mine happens to be GoldStar, it could have been TI, phillips or anyone Related Instructables How to use a 74HC595 Shift Register with a AVR ATtiny13 by roznerd Arduino Target Make a debug Practice by display for Using a Dot microcontrollers Matrix LED with sebtiger an Arduino and by andyk75 Shift Register by nevdull Big 7-segment Digital Clock by slwthr Make a 24X6 LED matrix by Syst3mX Decaplexing by jazzzzzz How to build a 8x8x8 led cube (English version) by agofi http://www.instructables.com/id/Arduino-Projects/ turn signal biking jacket by leahbuechley on June 21, 2008 Intro: Turn signal biking jacket This tutorial will show you how to build a jacket with turn signals that will let people know where you're headed when you're on your bike. We'll use conductive thread and sewable electronics so your jacket will be soft and wearable and washable when you're done. Enjoy! A version of this tutorial is also on my website. Image Notes 1. the first jacket I made Step 1: Supplies . Get your supplies. You need: -- LilyPad Arduino main board -- FTDI connector -- mini USB cable -- LilyPad power supply -- 16 LilyPad LEDs (note: these aren't available from SparkFun yet, but will be soon) -- 2 push button switches -- a spool of 4-ply conductive thread -- a digital multimeter with a beeping continuity tester. This is the one I have. -- a garment or a piece of fabric to work on -- a needle or two, a fabric marker or piece of chalk, puffy fabric paint, a bottle of fabric glue, and a ruler (Available at your local fabric shop or Joann Stores .) -- a pair of scissors -- double sided tape (optional) -- a sewing machine (optional) http://www.instructables.com/id/Arduino-Projects/ disclosure: I designed the LilyPad, so I'll make some $ if you buy one. Image Notes 1. conductive thread and needle 2. chalk for drawing on fabric 3. LilyPad Arduino main board, power supply and USB link 4. LilyPad LEDs 5. switches 6. fabric glue 7. mini USB cable (like the one for your camera) Step 2: Design . Plan the aesthetic and electrical layout of your piece. Decide where each component is going to go and figure out how you will sew them together with as few thread crossings as possible. Make a sketch of your design that you can refer to as you work. The photos below show the sketches for my jacket. Stitching for power (+) is shown in red, ground (-) in black, LEDs in green, and switch inputs in purple. Important note about the power supply As you design, plan to keep your power supply and LilyPad main board close to each other. If they are too far apart, you are likely to have problems with your LilyPad resetting or just not working at all. Why? Conductive thread has non-trivial resistance. (The 4-ply silver-coated thread from SparkFun that comes with the LilyPad starter kit has about 14 ohms/foot.) Depending on what modules you're using in your construction, your LilyPad can draw up to 50 milliamps (mA) of current, or .05 Amps. Ohm's law says that the voltage drop across a conductive material--the amount of voltage that you lose as electricity moves through the material--is equal to the resistance of the conductive material times the amount of current that is flowing through it. For example, if your LilyPad is a foot away from the power supply, the total resistance of the conductive material that attaches your LilyPad to your power supply is about 28 ohms. (14 Ohms in the conductive thread that leads from the negative terminal of the power supply to the negative petal on the LilyPad and 14 Ohms in the conductive thread that ties the positive terminals together). This means we can expect a drop of 1.4 Volts (28 Ohms * .05 Amps.) This means that while 5 Volts is coming out of the power supply, the LilyPad will only be getting 3.6 Volts (5 Volts - 1.4 Volts). Once the voltage at the LilyPad drops below about 3.3 Volts, it will reset. The resistance of the traces from + on the power supply to + on the LilyPad and - on the power supply to - on the LilyPad should be at most 10 Ohms. Plan the distance accordingly. If all of this was confusing, don't worry! Just keep the LilyPad and power supply close to each other in your design. Transfer the sketch to your garment. Use chalk or some other non-permanent marker to transfer your design to the garment. If you want, use a ruler to make sure everything is straight and symmetrical. Use double sided tape to temporarily attach LIlyPad pieces to your garment. This will give you a good sense of what your final piece will look like. It will also keep everything in place and, as long as the tape sticks, make your sewing easier. http://www.instructables.com/id/Arduino-Projects/ http://www.instructables.com/id/Arduino-Projects/ Step 3: Sew your power supply and LilyPad to your jacket . First, trim the leads off of the back of the power supply Get out your LilyPad power supply piece and trim the metal parts that are sticking out the back of it. Small clippers like the ones shown in the photo work well, but you can also use scissors. Stabilize your battery on the fabric. Generally, you want to do everything you can to keep the power supply from moving around on the fabric. I recommend gluing or sewing the battery down before starting on the rest of the project. You may also want to glue or sew something underneath the power supply to help prevent it from pulling on the fabric and bouncing around as you move. If you are working on a thin or stretch piece of fabric--first of all, reconsider this choice! It's much easier to work on a heavy piece of non-stretchy fabric. If you are determined to forge ahead with a delicate fabric, choose the location for your power supply wisely. It's the heaviest electronic module, so put it somewhere where it will not distort the fabric too badly. definitely glue or sew something underneath the power supply. Sew the + petal of the power supply down to your garment. If you are new to sewing, check out this great introduction before you start for info on how to thread a needle, tie knots and make stitches. Cut a 3-4 foot length of conductive thread. Thread your needle, pulling enough of the thread through the needle that it will not fall out easily. Tie a knot at the end of the longer length of thread. Do not cut the thread too close to the knot or it will quickly unravel. Coming from the back of the fabric to the front, poke the needle into the fabric right next to the + petal on the power supply and then, from the front of the fabric, pull it through. The knot at the end of the thread will keep the thread from pulling out of the fabric. Now make a stitch going into the hole in the hole in the + petal on the power supply. Do this several more times, looping around from the back of the fabric to the front, going through the + petal each time. Pay special attention to this stitching. It is the most important connection that you'll sew in your project. You want to make sure you get excellent contact between the petals on the power supply and your conductive thread. Go through the hole several times (at least 5) with your stitching. Keep sewing until you can't get your needle through anymore. Do not cut your thread, just proceed to the next step. Sew from the battery to the LilyPad. Once you've sewn the + petal of the battery down, make small neat stitches to the + petal of your LilyPad. I used a jacket with a fleece lining and stitched only through the inner fleece lining so that no stitches were visible on the outside of the jacket. Sew the + petal of your LilyPad down, finishing the connection. When you reach the LilyPad, sew the + petal down to the fabric with the conductive thread. Just like you were with the battery petal, you want to be extra careful to get a robust connection here. This stitching is making the electrical connection between your power supply and LilyPad. When you are done with this attachment, sew away from the LilyPad about an inch along your stitching, tie a knot, and cut your thread about an inch away from the knot so that your knot won't come untied. Put fabric glue on each of your knots to keep them from unraveling. Once the glue dries, trim the thread close to each knot. http://www.instructables.com/id/Arduino-Projects/ Image Notes 1. trimming the battery posts off the power supply. Image Notes 1. sewing on the + petal of the power supply. notice how I'm sewing through the hole from the front instead of the back, which is much harder. http://www.instructables.com/id/Arduino-Projects/ Image Notes 1. notice how dense my stitching is here. this is what your stitches should look like. Image Notes 1. a glued and trimmed knot. knots without glue will come unraveled quickly. http://www.instructables.com/id/Arduino-Projects/ Step 4: Test your stitching . Measure the resistance of your stitching. Get out your multimeter and put it on the resistance measuring setting. Measure from power supply + to LilyPad + and power supply - to LilyPad -. If the resistance of either of these traces is greater than 10 ohms, reinforce your stitching with more conductive thread. If you're not sure how to measure resistance, check out this tutorial . Put a AAA battery into the power supply and flip the power supply switch to the on position. The red light on the power supply should turn on. If it doesn't and you're sure you flipped the switch, quickly remove the battery and check for a short between your + and - stitches. (Most likely there is a piece of thread that's touching both the - and + stitching somewhere.) You can test for a short between + and - by using the beeping continuity tester on your multimeter. See this tutorial for information on how to use the continuity tester. Also check the resistance between the + and - stitching. If the resistance is less than 10K Ohms or so, you've got a mini-short (probably a fine conductive thread hair that is touching both + and -) that you need to find and correct. If the power supply does turn on, look at your LilyPad. It should blink quickly each time you press its switch. Once these connections are working properly, turn off the power supply and remove the battery. Insulate your power and ground stitching So, your jacket is now full of uninsulated conductive stitches. This is fine when a body is inside of it. A body will prevent sewn traces from contacting each other. But when the jacket is off of a person and you bend or fold it, traces will touch each other and short out. To fix this problem, cover your traces with puffy fabric paint (or another insulator like a satin stitch in regular thread). But, you don't want to cover traces until you're sure that everything works ! So, use good judgment in when to coat traces. Image Notes 1. this is the resistance measuring setting http://www.instructables.com/id/Arduino-Projects/ Image Notes 1. this is the continuity testing setting Step 5: Sew on your turn signal LEDs . Sew in your left and right signals. Using the same techniques you used to sew the power supply to the LilyPad, attach all of the + petals of the lights for the left turn signal together and to a petal on the LilyPad (petal 9 for me) and all of the + petals for the right signal together and to another LilyPad petal (11 for me). Attach all of the - petals of the lights together and then to either the - petal on the LilyPad or another LilyPad petal (petal 10 for me). Refer back to my design sketches if any of this is confusing. Remember to seal each of your knots with fabric glue to keep them from unraveling. Be careful to avoid shorts; don't let one sewn trace touch another. In this case, the traces for the LEDs are all connected, but you want to make sure that the + traces for the left and right signals do not touch the - trace or each other. Test your turn signals. Load a program onto your LilyPad that blinks each turn signal to make sure all of your sewing is correct. Note, if you don't know how to program the LilyPad, work through a few of these introductory tutorials before proceeding. Here's my test program: int ledPin = 13; // the LED on the LilyPad int leftSignal = 9; // my left turn signal is attached to petal 9 int rightSignal = 11; // my right turn signal is attached to petal 11 int signalLow = 10; // the - sides of my signals are attached to petal 10 void setup() { pinMode(ledPin, OUTPUT); // sets the ledPin to be an output pinMode(leftSignal, OUTPUT); // sets the leftSignal petal to be an output pinMode(rightSignal, OUTPUT); // sets the rightSignal petal to be an output pinMode(signalLow, OUTPUT); // sets the signalLow petal to be an output digitalWrite(signalLow, LOW); // sets the signalLOW petal to LOW (-) } void loop() // run over and over again { delay(1000); // wait for 1 second digitalWrite(leftSignal, LOW); // turn the left signal off delay(1000); // wait for 1 second digitalWrite(rightSignal, HIGH); // turn the right signal on delay(1000); // wait for 1 second http://www.instructables.com/id/Arduino-Projects/ digitalWrite(rightSignal, LOW); // turn the right signal off delay(1000); // wait for 1 second } If your layout is the same as mine, you can just copy and paste this program into your Arduino window. If your turn signals don't work, use your multimeter (and the instructions from the last step) to test for shorts or bad connections and make sure that your program matches your physical layout. insulate your turn signal stitches Cover your traces with puffy fabric paint. Remember, you don't want to cover traces until you're sure that everything works ! Use good judgment in when to coat traces. Image Notes 1. stitching in process, outside view: 3 + petals are sewn together Image Notes 1. these 2 middle traces are the negative (-) traces for all of my turn signal LEDs. these traces are attached to petal 10 on my LilyPad 2. this is the stitching for the positive (+) leads of my right turn signal LEDs. (Since this is an inside view, everything is reversed.) These traces lead to petal 11 on my LilyPad. Image Notes 1. my finished right turn signal. notice how my stitching doesn't come through to the outside of the garment. http://www.instructables.com/id/Arduino-Projects/ Step 6: Sew in your control switches . Place your switches Find a spot for your switches where they'll be easy to press when you're riding your bike. I mounted mine on the underside of my wrists. I found a good spot by trying out different places. Check out the photos to see what I mean. Once you've found a good position, push the legs of the switch through the fabric and bend them over on the inside of the fabric. Sew in your switches. Sew your switches into the garment. Sew 1 leg to the switch input petal on the LilyPad and another leg, one that is diagonally across from the first , to ground or another LilyPad petal. I used petal 6 for the switch input on the left side and petal 12 for switch input on the right side. I used - for the - connection on the left side, but petal 4 for the - connection on the right side. Refer back to my design drawings if any of this is confusing. When you're done sewing, go back and reinforce the switch connections with glue. You don't want your switches to fall out of their stitching. http://www.instructables.com/id/Arduino-Projects/ http://www.instructables.com/id/Arduino-Projects/ Image Notes 1. the first trace from my left switch is finished. this is the switch input trace that is tied to petal 6 on the LilyPad. I just have to glue and trim the knot. 2. these are the stitches that lead from the power supply to the LilyPad. 3. these are my left turn signal stitches. I have a knot to glue and trim on these too. 4. you might have noticed that I didn't insulate my traces. you too can leave them uninsulated, but be aware of shorts from folding/bending whenever you're not wearing the jacket! especially when you are programming and troubleshooting. http://www.instructables.com/id/Arduino-Projects/ Step 7: Sew in your indicator LEDs . Sew a single LED onto the sleeve of each arm. These will give you essential feedback about which turn signal is on. They'll flash to tell you what the back of your jacket is doing, so make sure they're in a visible spot. Sew the + petals of each LED to a LilyPad petal and the - petals of each LED to the - side of the switch (the - trace you sewed in the last step). I used petal 5 for the LED + on the left side and petal 3 for the LED + on the right side. Again, refer back to my design drawings if any of this is confusing. As always, remember to glue and trim knots and be careful not to create any shorts. Once you sew both wrist LEDs, you're done with the sewing phase of the project! Now, on to programming... http://www.instructables.com/id/Arduino-Projects/ Step 8: Program your jacket . Decide on the behavior you want. I wanted the left switch to turn on the left turn signal for 15 seconds or so, and the right switch to do the same thing for the right signal. Pressing a switch when the corresponding turn signal is on should turn the signal off. Pressing both switches at the same time should put the jacket into nighttime flashing mode. The wrist mounted LEDs should provide feedback about the current state of the jacket. Here's the code I wrote to get that behavior. Program your jacket To program your garment, copy and paste my code into an Arduino window and load it onto the LilyPad. You may have to make some small adjustments first depending on where you attached lights and switches. Play with delays to customize your blinking patterns. Follow my LilyPad introduction instructions if you need more information on how to program the LilyPad or how to make sense of my code. Plug your battery back in and see if it works and...go biking! Insulate the rest of your traces Cover the rest of your traces with puffy fabric paint. Again, don't coat anything until you're sure it works. About washing Your creation is washable. Remove the battery and wash the garment by hand with a gentle detergent. Note: silver coated threads will corrode over time and their resistance will gradually increase with washing and wear. To limit the effects of corrosion, insulate and protect your traces with puffy fabric paint or some other insulator. You can also revive exposed corroded traces with silver polish. Try this on a non-visible area first to see what it does to your fabric! http://www.instructables.com/id/Arduino-Projects/ http://www.instructables.com/id/Arduino-Projects/ Related Instructables Programmable LilyPad EL-Wire Dress by quasiben soundie: a musical touchsensitive lightup hoodie by kanjun EL Driver Board by quasiben LilyPad Arduino Blinking Bike Safety Patch by bekathwia Interactive Bee Game by quasiben Latch-Modified Turn-Signal Jacket by quasiben Light for life: Glowing button cycling jacket by kempton ProximitySensing Pocket Squares by quasiben http://www.instructables.com/id/Arduino-Projects/ Android G1 Serial To Arduino Robot by mranalytical on January 24, 2010 Intro: Android G1 Serial To Arduino Robot Learn how your Android cell phone can control a robot using an Arduino board. The phone takes commands via telnet from another phone or a PC, so you can control the robot remotely. This project will not otherwise modify the G1 so you can continue using it as your normal phone after undocking it. Why? By using cheap electronic components such as Arduino boards, you can pair them with your $400 phone to make an awesome robot. It would cost hundreds of dollars to add GPS, LCD's, motion sensors, wi-fi, cellular connections, speakers, and more to a hobby bot, but your phone already has these! Together, the Android G1 and Arduino board allow you to use inexpensive electronics such as simple servos and sensors, to build powerful devices such as robots, remote telepresence, or fun toys for kids. More information at Cellbots.com . Notice: This project currently requires an Android G1 with root access to use serial output from the phone to the Arduino robot. You can add a $20 BlueTooth module to your Arduino board to have the phone talk to it over serial BlueTooth if you want to use the commercial Android software. Special thanks: We have the Hacker Dojo in Mountain View, CA to thank for putting us in touch, helping with some tricky issues via their mailing list of awesome members, and for having 74LS04 chips in stock. Most of the assembly was done at the Tech Shop in Menlo Park. Image Notes http://www.instructables.com/id/Arduino-Projects/ 1. Goes to nothing Image Notes 1. Freeduino SB 2. Breadboard 3. HTC USB and phone off screen in this direction Image Notes 1. This goes to pin 8 on the HTC USB board 2. Goes to pin 8 ground on HTC USB board 3. 5v power to the Arduino is at the other end of the breadboard and not in this picture 4. 5v Power 5. Jump pins 2 and 3 together 6. Connects to the RX pin 0 on the Arduino 7. Ground 8. Connects to ground on the Arduino at the other end of the breadboard out of this picture Image Notes 1. These two are not used during this tutorial but I used them when testing serial to USB from the other linked instructable 2. Pins 7 and 8 are used to connect to your breadboard Step 1: Items needed To complete this tutorial you will need the following: Hardware: - Android G1 Dev Phone (or other Android device with root access and serial output) - Arduino (I'm using a Freeduino SB but any one should do) - 3.3v to 5v converter if you aren't using a 3.3v Arduino (I'm using a 74LS04 chip for under $1 but other options are available) - HTC USB break-out board for the G1 - Soldering equipment for two quick connections - A robot body with micro servos (cardboard, acrylic, treads, wheels, anything will do) Software: - Android Scripting Environment (ASE) - Telnet client for your PC (I'm using PuTTY on Windows) http://www.instructables.com/id/Arduino-Projects/ - Arduino development environment - (optional) Serial client for your PC (I'm also using PuTTY on Windows for this) - (optional) Android SDK If you can follow instructions you can complete this tutorial with little knowledge of Python , Arduino, Android, or electronics. You'll want to know those things if you want to go beyond a blinking LED but this will get you started. Image Notes 1. The TX0 pin of the HTC USB board connects here 2. Connect these two togther 3. This does to the RX pin 0 on the Arduino 4. Connect to ground 5. Connect to the 5v power from the Arduino Image Notes 1. You can scan this with a barcode reader to download the apk file. Or go to the official project site. http://www.instructables.com/id/Arduino-Projects/ Image Notes 1. Use ddms from the Android SDK to take screen shots from your phone (among other tricks) 2. Use adb shell from the Android SDK to execute commands from the PC instead of typing them into the phone. 3. I used PuTTY on Windows to telnet into the phone. Image Notes 1. We use the Android Dev Phone 1, also known as the G1 in this tutorial but ADP2 should also work in theory. Image Notes 1. Android Scripting Environment (ASE) logo Step 2: Android G1 with serial output enabled G1's do not ship with the ability to send serial commands out of the USB port and there is no native option to enable it. If you are an advanced Android SDK user you could make your own build but I chose to use the Cyanogenmod 4.2.13 . If you know of other Android devices with serial out working, add them to the comments. Optionally, you can follow the links there to this instructable on talking to your G1 over USB from your PC. That serial to USB connection isn't required for this tutorial but I used it as a nice sanity check to verify the phone was sending serial out. If you don't use the other intructable to verify serial output is working, you can try this simple check: 1. Open the Terminal app on the G1 (comes with Cyanogen but download one from the Market if you have a different image) 2. Navigate to the /dev/ directory by typing in cd /dev/ 3. Type ls (that's an L) and look for ttyMSM2 in the list returned The Python script we'll use later sends commands to '/dev/ttyMSM2' in order for them to go out the serial connection. Since that requires root access, you'll need to change permissions on that every time you reboot the phone. To do that: 1. Open the terminal app on the phone 2. Enter 'chmod 777 /dev/ttyMSM2' http://www.instructables.com/id/Arduino-Projects/ Then you can run the Python script from the Android Scripting edit in the next step and it will have access to send serial output. Image Notes 1. We use the Android Dev Phone 1, also known as the G1 in this tutorial but ADP2 should also work in theory. Image Notes 1. If you don't see this the phone does not have serial out enabled. Step 3: Install the Android Scripting Environment (ASE) with Python The scripts we'll be using to create an open socket connection on the phone and send commands out is written in Python. To run this on the G1 we'll need the Android Scripting Environment . If you don't see it in the Market you can download it by scanning the barcode on that page which links to the apk file on this page . Once you install and run ASE you will want to add on the Python module from the menu: 1. Open ASE and make sure you have a working internet connection (wi-fi or 3G) 2. Press the menu button on the phone and select Interpreters 3. Press menu again and select Add 4. Select Python (currently v2.6.2 as of writing this) and it will download some zip files You may want to explore creating, opening, editing, and running scripts to become familiar with Python via ASE but it isn't required. http://www.instructables.com/id/Arduino-Projects/ Image Notes 1. Android Scripting Environment (ASE) logo Image Notes 1. You can scan this with a barcode reader to download the apk file. Or go to the official project site. Step 4: Copy and run the cellbot.py script to launch the Python program This tutorial uses a Python script to be the "brains" of the robot. Get the latest code from our open source Google Code project . You only need the cellbot.py file but others may help with various things you want to explore. I simply plugged the phone into my PC's USB connection and mounted the drive before copying the file to /sdcard/ase/scripts. The program creates an open socket connection to accept an incoming telnet session. It also prints the received commands to the screen while sending them out the serial port. Put this file on the phone's SD card in the /ase/scripts/ directory. Detailed steps to load and run the scripts: 1. Copy the cellbot.py script to the SD card's /ase/scripts/ directory 2. Be sure to dismount the SD card from your PC if you copied them that way since the phone can't access the files at the same time your PC is. 3. Open the Android Scripting Environment app 4. Click on cellbot.py to launch it You should see a confirmation that the device is ready at this point to accept incoming telnet sessions on port 9002. Tip: Be sure to run the "chmod 777 /dev/ttyMSM2" command from step #3 first. See step #5 for finding the phone's IP address. Image Notes 1. This is where the received commands get sent out the serial port http://www.instructables.com/id/Arduino-Projects/ Step 5: Telnet into the G1 and test sending it commands The phone should be ready for you to telnet into it and send it commands from your PC. It will print them to the phone's screen to confirm what it receives. I used PuTTY on Windows but we've confirmed that minicom works great on Macs as described in this instructable . You will first need to find your phone's IP address. This is available by going to Menu > Settings > Wireless controls > Wi-Fi settings and then pressing the currently active connection. A pop-up toast message will come up with the current IP address on the local network. Write this down as you'll use this every time you want to open a telnet session from your PC. IP assignments typically expire after a certain number of days so you may need to check this again. Note: This tutorial assumes your PC and phone are on the same local network. Routing to the phone from outside of the local network should be possible but is not covered here. Open your telnet client of choice and connect to the IP of the phone on port 9002. From a command line you do this as "telnet 192.168.1.1 9002" using the actual IP of the phone. Type in some characters and hit enter to see them show up on the phone's screen. You can type a q to cause the Python script to quit, which should close your terminal session. If for any reason you can't connect via telnet and need to kill the program, a simple reboot of the phone should do the trick. Advanced users may want to find the process ID via ps and then use kill to stop it. Advanced: A future version of this could run a local web server from the phone rather than accepting commands via telnet. We're also exploring XMPP to chat with your robot. Step 6: Connect a 3.3v to 5v level shifter to the Arduino The Arduino used in the this tutorial is a 5v model so we need to convert the 3.3v signal coming out of the G1 using a level shifter. It should be possible to connect directly to a 3.3v Arduino but that was not something I tested. There are several ways to approach this but we'll use a 74LS04 chip in this example. You can search for one here and they are likely under $1. Tim and I picked ours up from the Hacker Dojo in Mountain View , CA but these are VERY common and should be plentiful wherever chips are sold or donated. At a high level we're simply going to send the TX signal from the HTS USB breakout board into pin 1 of the 74LS04 chip. To make it work we go through the chip twice and come out pin 4 to the RX pin on the Freeduino SB (your serial pin may be different if you have another Arduino board but all should support this). Follow these steps to wire up the level shifter and connect the HTC USB board (do not plug it into the phone yet and unplug power to the Arduino): 1. Insert the 74LS04 chip onto your breadboard. Make sure the chip hurdles the center break so the pins aren't shorted (a dumb move I made at first) 2. Soldier two wires to the HTC USB board as described in this instructable , but we'll only be using pins 7 (Ground) and 8 (TX0) since we're only doing oneway transmission for this tutorial. 3. Connect the other end of the ground (pin 7) wire to a ground on your breadboard (which should be connected to a ground on your Arduino) 4. Connect the other end of the TX0 (pin 8) wire to the breadboard where it runs into pin 1 of the 74LS04 chip. (do an image search for a full diagram of the chip) http://www.instructables.com/id/Arduino-Projects/ 5. Use a wire to connect pin 2 and 3 of the chip 6. Connect pin 4 of the chip to the Arduino RX point (pin 0 on the Freeduino SB and Arduino Duemilanove) 7. Connect pin 7 (GND) on the chip to the ground for your breadboard (which also connects to the Arduino ground) 8. Connect pin 14 (VCC) to the 5v power on your breadboard (which gets the power from the Arduino 5v output) You should now be ready to plug in the HTC USB break-out board into the bottom of the phone and power on the Arduino. Check for sparks and smells and touch things to make sure they are cool. Note: The current cellbot code turns on LED #13 when the servo motors of the robot should be running. If you don't have a robot yet you can check to see that the LED turns on and off to confirm it is working. Image Notes 1. This goes to pin 8 on the HTC USB board 2. Goes to pin 8 ground on HTC USB board 3. 5v power to the Arduino is at the other end of the breadboard and not in this picture 4. 5v Power 5. Jump pins 2 and 3 together 6. Connects to the RX pin 0 on the Arduino 7. Ground 8. Connects to ground on the Arduino at the other end of the breadboard out of this picture Image Notes 1. Goes to nothing Image Notes 1. These two are not used during this tutorial but I used them when testing serial to USB from the other linked instructable 2. Pins 7 and 8 are used to connect to your breadboard Image Notes 1. Not used 2. Used http://www.instructables.com/id/Arduino-Projects/ Image Notes 1. Freeduino SB 2. Breadboard 3. HTC USB and phone off screen in this direction Image Notes 1. 5v power 2. Ground 3. Connects to pin 4 on 74LS04 chip 4. Optional - connects to external LED but the onboard LED would suffice for this tutorial. 5. I'm using external 9V power but you could use another voltage in the Arduino's 7-12v range, or use power over USB (but that doesn't demonstrate the coolness of being disconnected from the PC) 6. USB plugged in during this picture but unplugged when fully running. Image Notes 1. The TX0 pin of the HTC USB board connects here 2. Connect these two togther 3. This does to the RX pin 0 on the Arduino 4. Connect to ground 5. Connect to the 5v power from the Arduino Step 7: Load the Cellbots program on the Arduino Get the Arduino source code from our Google Code project site . Open the Cellbots.pde Arduino program in the Arduino editor. Then push it to your Arduino board. You can test talking to the Arduino code by opening the serial monitor in the Arduino editor. This is a great way to test your robot or device by talking directly to the Arduino before hooking everything up to the phone. The code sends serial commands back to the serial monitor to confirm what it is doing even if you don't have your robot built yet. Note: You can't load programs onto the Arduino while the wire is connected to the RX serial input pin. So you might want to put this one a switch but I simply unplugged it when I needed to load a new program. http://www.instructables.com/id/Arduino-Projects/ Image Notes 1. You should be able to control the LED from the Arduino serial monitor without having the phone plugged in. Image Notes 1. Type commands in here to test sending ASCII characters over serial to the Arduino Step 8: Run the whole process You should be able to connect the HTC USB board to the phone, fire up the cellbot.py file in ASE, and open a terminal sessions into the phone. Type "H" to have the phone say hello or any other commands from the README.txt file. A "q" will quit the Python script on the phone and close the terminal socket. Here is a recap of how it all works: 1. The Python script opens a socket to accept incoming telnet connections and echo the commands out the serial port 2. We connect from our PC to the phone via telnet on port 9002 and send it commands that we see on screen 3. The HTS USB board interfaces with the G1's USB port and sends the 3.3v signal into the 74LS04 pin 1. 4. The signal comes out of the chip on pin 2, goes back in on pin 3, and comes out again on pin 4 at 5v 5. Our Arduino accepts the serial signal on RX pin 0 and process it via the Cellbot.pde program 6. We can type 'q' to kill the Python script and close the telnet connection Now that you've completed this very complicated process to send basic commands to an Arduino robot, it is time for you to hack it to be more awesome! We don't yet have 2-way serial working so the Arduino can't send commands back into the phone but we're working on that. Stay current by subscribing to our blog at Cellbots.com . About the Authors: Tim Heath Lead researcher who first put this process together at the Tech Shop in Menlo Park, where he is a member. Ryan Hickman Programmer who worked on the Python and Arduino code and authoered this Instructable. http://www.instructables.com/id/Arduino-Projects/ Image Notes 1. Use ddms from the Android SDK to take screen shots from your phone (among other tricks) 2. Use adb shell from the Android SDK to execute commands from the PC instead of typing them into the phone. 3. I used PuTTY on Windows to telnet into the phone. Image Notes 1. Goes to nothing Related Instructables Super Nintendo on Android with original controller (video) by bsoares Voice Controlled iRobot Create by phroseph Android talks to Arduino by circuit_breaker Use your android phone sensors on the arduino ! by a1r simpleTweet_01 python by pdxnat iAndroidRemote - Control Android mobile using an Apple Remote by sudar Tweet-a-Pot: Twitter Enabled Coffee Pot by frenzy Use android cellphone as webcam free by Sharky44401 http://www.instructables.com/id/Arduino-Projects/ http://www.instructables.com/id/Arduino-Projects/ Ard-e: The robot with an Arduino as a brain by imadami on June 28, 2008 Intro: Ard-e: The robot with an Arduino as a brain How to create an open source Arduino controlled robot for under $100. Hopefully after reading this instructable you will be able to take your first step into robotics. Ard-e cost about $90 to $130 depending on how much spare electronics you have lying around. The main costs are: Arduino Diecimella- $35 https://www.makershed.com/ProductDetails.asp?ProductCode=MKSP1 Bulldozer kit- $31 http://www.tamiyausa.com/product/item.php?product-id=70104 Servo- $10 I got mine at a local hobby store Worm gear Motor- $12 http://www.tamiyausa.com/product/item.php?product-id=72004 Various other Electronics- around $10 radioshack or digikey.com Sensors- anywhere from 0 dollars to $28 depending on how many you want and how extensive your pile of junk electronics is So with spending around $100 you get a remote control robot with a pan and tilt system that could be used to aim a camera, a hacked airsoft gun ( http://inventgeek.com/Projects/Airsoft_Turret_v2/Overview.aspx ) or you could attach a laser to it because thats what you have lying around. If you wanted to be really cruel you could attach a dvd laser to it and burn whatever you wanted ( http://www.youtube.com/watch?v=CgJ0EpxjZBU ) In addition to making the pan and tilt system that is remote controlled you can also buy about three dollars worth of chips, attach sensors to Ard-e and make him fully autonomous. For around a hundred dollars you can build your own robotics system that has most of the functionality of a roomba or a lego-mindstorms robot: It can sense when it bumps into something be programmed to avoid what it bumps into, it can follow the brightest light, smell pollutants, hear sounds, know precisely how far it has gone, and be controlled by an old recycled remote control. All of this for about half of the price of commercial units. This is my entry into the RobotGames robot contest so if you like it make sure to vote for it! Note- Originally I was going to enter the remote controlled version only as my entry to the contest but since the deadline was pushed back Im gonna show you how to make Ard-e run himself. So on to how to build Ard-e http://www.instructables.com/id/Arduino-Projects/ Image Notes 1. left wheel sensor 2. right wheel sensor 3. crazy jumble of wires. 4. touch sensors 5. right eye 6. left eye 7. The autonomous version of Ard-e Image Notes 1. bulldozer kit base 2. Arduino Decimilla 3. pan and tilt system 4. remote control Image Notes 1. laser power supply 2. tilt servo 3. panning gear box Step 1: Build your Bulldozer So once you get your new bulldozer kit either in the mail or at your local hobby shop you have to put it together. These kits from Tamiya tend be a little on the expensive side but they are worth it. I found the worm gear box that I use to pan the laser in a box of old projects covered in dust, it hadnt been touched for maybe three years. After blowing off the dust and hooking it up it ran fine. A pocket knife or leatherman should be all the tools you'll need to set up the bulldozer. The instructions are step by step and easy to follow even if the English is a little shaky. Since I wasn't planning on using Ard-e as a really weak bulldozer I didn't attach the plow. The dc motors that drive the bulldozer are controlled by the double pole double throw (DPDT) switches that make up the controller. I added a diagram about how to hook up your own DPDT switch to control a motor because I later end up controlling the panning motor with another DPDT switch. Hopefully the diagram makes it clear that the switch when thrown one way makes the motor turn one way and when thrown the other it turns the other way. http://www.instructables.com/id/Arduino-Projects/ Image Notes 1. plow parts that i didnt use 2. instructions 3. handy pocket knife 4. the remote control 5. motors, gears, shafts and screws 6. Chassis 7. how its supposed to look 8. wheel parts 9. important plastic pieces that I forgot what they do... Image Notes 1. Finished bulldozer minus the plow 2. finished remote Image Notes 1. The motor you want to control with the DPDT switch 2. poles 3. poles 4. the throw connected to your voltage source http://www.instructables.com/id/Arduino-Projects/ Step 2: Assemble the pan and tilt system So you now have a base for Ard-e that is engineered and constructed well (hopefully the English in the instructions didn't throw you off too much). Now you need to build something that this base can drive around and do cool stuff with. I chose to put another DC motor and a servo on it as a pan and tilt system that could be used to aim whatever you wanted. The servo is controlled by the Arduino and the panning motor is controlled by a DPDT switch that I bought at radio shack for around two dollars. To control the servo I wrote some code in the Arduino software environment that reads the voltage drop off of a potentiometer and converts that to the angle that the servo should be moved to. To implement this on the Arduino you hook the servo data wire to one of the digital output pins on the Arduino and the plus voltage wire to 5V and the ground wire to ground. For the potentiometer you need to connect the outer two leads to +5V and the other to ground. The middle lead from the potentiometer should then be connected to an analog input. The potentiometer then acts as a voltage divider having possible values of 0V to +5. When the Arduino reads the analog input it reads it from 0 to 1023. To get an angle to run the servo at I divided the value that the Arduino was reading by 5.68 to get a scale of roughly 0-180. Heres the code that I used to control the tilt servo from a potentiometer: #include <Servo.h> int potPin = 2; // selects the input pin for the potentiometer Servo servo1; int val = 0; // variable to store the value coming from the potentiometer void setup() { servo1.attach(8); //selects the pin for the servo } void loop() { val = analogRead(potPin); // read the value from the potentiometer val = val / 5.68; //convert the value to degrees servo1.write(val); //make the servo go to that degree Servo::refresh(); //command needed to run the servo } If you need help working with the Arduino like I did then I highly suggest going to www.arduino.cc Its a fantastic open source website that is really helpful. So after testing the control of the servo and the switch I needed a place to put them. I ended up using a piece of scrap wood cut to about the same length as Ard-e and screwing it into the back board with a piece of aluminum bent at a 90 degree angle. I then installed the DPDT switch and the potentiometer into the controller. It was a tight squeeze and I had to drill another hole in the top of it to run wires out of but overall it worked out pretty nicely. I also ended up soldering wires onto the existing controller circuitry to power the worm gear box. I really probably should have used another servo for the panning but the hobby store I went to only had one of the ten dollars ones and the motor can turn 360 degrees unlike the servo. The motor is a little too slow though. Now on to testing. Image Notes 1. Attachment jerry rigged to hold the servo 2. panning motor worm gear box 3. screws installed to mount the gear box Image Notes 1. Tilt servo 2. A very professional duct tape mounting of the servo http://www.instructables.com/id/Arduino-Projects/ Image Notes 1. Testing the Arduinos control of the servo Image Notes 1. Power wires for the panning motor Image Notes 1. the AA's that power Ard-e 2. testing the DPDT switches control of the panning motor 3. The DPDT switch is mounted on the cover of the Controller and the wires run out of a hole in the back. 4. orange electrical tape- adding a little style to Ard-e Image Notes 1. aluminum mounting piece 2. scrap wood add on 3. almost all of the wires that will run to the controller Image Notes http://www.instructables.com/id/Arduino-Projects/ 1. potentiometer to control servo 2. DPDT switch to control the panning motor 3. DPDT switches to control the driving motors 4. hole cut to run wires out of Step 3: Testing and making the remote controlled version of Ard-e So before we start driving Ard-e we need to make the Arduino mobile. All that you need for the Decimilla to become mobile is a 9 volt battery connected to a plug that fits into the external power supply. I ended up cutting the power cord from an old transformer and got a nine volt batter clip by taking apart an old nine volt. The jumper also needs to be moved from the usb power to the ext power. If the battery is hooked up correctly the power light on the Arduino should light up. If not you probably got the polarity wrong and should switch the wires. I did this at first and it didn't cause any damage to the chip but I would not recommend doing it for long. Now you should test to see if everything is working as you expected. Attach something to the pan and tilt system like a camera or led. I used a laser zip-tied to the servo because it fit nicely and I had one laying around. Drive Ard-e around and try to not shine the laser into your eyes. When I first put Ard-e together I put the Arduino behind the controller and taped it in place. With this set up every time I ran either the driving motors or the panning motor the servo would go to the 0 degree position. Apparently the running of the motors would interfere with the timing control pulse and make the servo think that it was supposed to be at 0 degrees. I figured this probably was because of how long the control wire on Ard-e's servo was. It had to the run from Ard-e to the Ardunio behind the controller all the while being in close proximity to the wires carrying the current to the motors. These wires induced alot of noise into the control wire and made it go to 0. To fix this problem I moved the Arduino from behind the controller to on Ard-e. Note the very professional looking duct tape mounting of both the servo and the Arduino. This eliminated the motor wires inducing noise and fixed the problem. The long wires then just carried the power to and input signal from the potentiometer instead of the power and control signal for the servo. The noise from the motor wires now affects the reading of the potentiometer which has little to no effect on the degree that the servo is driven to. So you now have the remote controlled version of Ard-e. Basically you just made a really cool home built car that you can drive around and point at stuff with. The Arduino is underused to say the least. Ard-e right now is using 1/6th of his ability to sense the analog world and 1/14th of his digital I/O capabilities. You could save yourself some money and just take out the servo and Arduino if a home built car is all you want.... But if you want to really sink your teeth into robotics read on about how to make Ard-e drive himself. Image Notes 1. plug from an old transformer soldered to the clip from an old nine volt battery Image Notes 1. testing the first controller configuration 2. having different colored wires helps to keep from confusing yourself in the jumble of wires Image Notes Image Notes http://www.instructables.com/id/Arduino-Projects/ 1. first configuration that didnt work very well 2. an essential to any project 1. what to try and avoid while testing Ard-e Image Notes 1. the Arduino mounted on the back of the controller = bad Image Notes 1. the Arduino duct taped to the side of Ard-e = Good 2. a pretty cool remote control but lets get rid of it... Step 4: Ard-e on Auto: Using the Ardunio to drive the DC motors So if you wanted to use the Arduino to control the motors you cant just hook them up to one of the output pins because the Arduino wont supply enough current to drive them. To use it to drive them you need to buy a motor driving chip or a motor shield for the arduino. http://www.ladyada.net/make/mshield/ has one for $20 or you can just buy the chips that she uses from digikey http://search.digikey.com/scripts/DkSearch/dksus.dll?Detail?name=296-9518-5-ND . The chip that is commonly used is a L293 or other similar H bridge motor driver chip. This site has the pinout of it and some details about running a program on it http://www.me.umn.edu/courses/me2011/robot/technotes/L293/L293.html The chip basically takes three inputs, one PWM input that sets the speed of the motor and turns it on and off and two inputs that determine the direction that the motor spins. The PWM pin is the Enable of the L293, the two pins that determine the direction of the motor spins are the Inputs 1A and 2A. The motors are connected to the outputs 1Y and 2Y. The L293 can control two DC motors so once you get it hooked up to the Arduino Ard-e can drive himself. The data-sheet for the L293 can be found at http://www.datasheetcatalog.com/datasheets_pdf/L/2/9/3/L293.shtml I ended up ordering two of the L293 chips from www.mouser.com and they cost me about $7. After a few hours of trial and error I finally got the Arduino to drive both of Ard-e's motors. I didn't read the data-sheet carefully enough because I originally was using 3V to try and run the L293 when it obviously (now at least its obvious) needs at least five volts. So after numerous trips to www.Arduino.cc here is the code I used to test drive Ard-e's motors: int diraPin = 10; int dirbPin = 9; //These two have to be opposite digital values to spin the motor if they are both HIGH or both LOW then the motor is actually braked. int enablePin = 11; //This pin sets the speed of the motor and needs to be a PWM pin. int dira2Pin = 2; int dirb2Pin = 3; int enable2Pin = 5; // These are used in the same way to drive the second motor. int val = 0; // Variable used to set the speed of the motors. void setup() { pinMode(diraPin, OUTPUT); pinMode(dirbPin, OUTPUT); pinMode(enablePin, OUTPUT); pinMode(dira2Pin, OUTPUT); pinMode(dirb2Pin, OUTPUT); pinMode(enable2Pin, OUTPUT); // Declares all of the pins as outputs. } void loop() { val = 175; //A value used for setting the speed of the motor, about 70% of its speed. //Spin motor 1 backward for one second analogWrite(enablePin, val); // Set the speed of the motors with PWM digitalWrite(diraPin, LOW); digitalWrite(dirbPin, HIGH); //spin motor 2 backward for one second analogWrite(enable2Pin, val); digitalWrite(dira2Pin, LOW); digitalWrite(dirb2Pin, HIGH); delay(1000); // If you switch which direction pin is high and which is low the motor will spin a different direction. //spin motor 1 forward for one second digitalWrite(diraPin, HIGH); digitalWrite(dirbPin, LOW); //spin motor 2 forward for one second http://www.instructables.com/id/Arduino-Projects/ digitalWrite(dira2Pin, HIGH); digitalWrite(dirb2Pin, LOW); delay(1000); // stop for a second val=0; analogWrite(enablePin, val); analogWrite(enable2Pin, val); delay(1000); } So to test this out on Ard-e I ended up putting a breadboard onto the addition that had previously held the pan and tilt system. I also moved the Arduino right next to the breadboard for easy prototyping. I also had to add another two AA batteries so the the L293 would have the 6V it needs to power the motors. Heres a quick video of Ard-e running this program. One of the motors spins faster than the other so he veers towards the camera near the end of it. I don't really know why this happens... So once you write all of the code and rearrange the components to make the Arduino boss around the L293 and get those pesky DC motors under control Ard-e's possible uses increase dramatically. All you need now are some sensors. Image Notes 1. the muscle of Ard-e http://www.instructables.com/id/Arduino-Projects/ Image Notes 1. two 3V AA battery packs connected in series to get the 6V needed to power the L293 2. Arduino decimilla 3. crazy jumble of wires 4. L293 on a breadboard for easy prototyping Image Notes 1. I took this picture to maybe help with the wiring but it probably will just confuse you... just go by the the L293 data sheet. 2. My brothers dog apparently likes to chew on 9V batteries. Step 5: Making Ard-e sense the world with junk So once you get Ard-e's DC motors controlled by the Arduino you can make Ard-e into a truly autonomous robot that is no longer tethered to a controller. Like any autonomous robot though Ard-e is gonna need to have sensors so it can interact with its environment. Where are you going to get these sensors you ask? Your old pile of electronics junk that any maker has. Ard-e should at least have all the basic senses that we humans have right? How are robots going to take over the world if they cant see or touch things?? Well at least four of the senses, since robots don't eat anything other than batteries i doubt they will need a sense of taste. So if you have a very extensive pile of junk electronics you can make Ard-e have these four senses with just a bit of recycling. If your junk pile isn't humongous then a few trips to radioshack and maybe a few orders from digikey or mouser should fix that. One of the most important senses for Ard-e to have is touch. Ard-e needs to know when he runs into something, and an old mouse that just about everyone has laying around is perfect for harvesting the push-button switches that he needs to accomplish this. After opening up the mouse you merely unsolder the switches and solder some wires on in place. Careful with this step though... I melted one of the switches by holding the soldering iron on it for too long. To make these switches into a touch sensor for Ard-e I used a piece of scrap metal bent into a bump switch that can tell if Ard-e hits something on his right side or his left side. The metal is easy to work with and if you fold it over itself as you make the shape you need it becomes pretty strong. The pictures will hopefully help with this step. To interface these switches with the Arduino so Ard-e can react when he bumps into something I ended up using them as a voltage divider to an analog input pin on the Arduino. I'm sure it would be just as easy to use them as digital inputs but I just could not write a program to get them to work as digital inputs. Im probably overlooking something really simple but whatever. Heres a short video of Ard-e running into two obstacles (my fingers), if he hits it on his right side he will reverse turn to the left and go forward. If he hits it on his left side he will reverse turn right and go forward. Ard-e now has the sense of touch! Now onto sight. http://www.instructables.com/id/Arduino-Projects/ Image Notes 1. pile of old junk? or Ard-e's new sensors? 2. Frisbees should never be put in a junk pile. Image Notes 1. old microsoft mouse Image Notes 1. IR led emitter and detector 2. IR emitter and detector 3. Three push button switches and an IR emitter/ detector Image Notes 1. push button switches with leads soldered on... soon to become a touch sensor Image Notes 1. lovely piece of scrap metal that will be the housing of the switches Image Notes 1. after alot of cutting folding and some drilling you get this nice looking touch http://www.instructables.com/id/Arduino-Projects/ sensor Image Notes 1. bent piece of wire that is the sensors axle 2. the original plans for the touch sensor Image Notes 1. pushbutton switch mounted onto the scrap metal touch sensor Image Notes 1. sensor screwed into the bottom of Ard-e Image Notes 1. Autonomous Ard-e now has the sense of touch! Step 6: Making Ard-e see, or at least go towards the brightest light To make Ard-e have the sense of sight all you need is a few light sensors. I bought a pack of cadmium sulfide photocells from RadioShack for like 3 dollars. A lot of night lights have these that you can steal and the little outside solar lights are possible sources of these photocells too. I didn't have any of these laying around so I bit the bullet and bought them. So these photocells change their resistance from around 10K to 100K ohms. I made up a little excel spreadsheet to figure out the possible values it would output if i hooked it up as a voltage divider. I got around 30K as providing the greatest difference from high resistance to low. I found some 39K resistors and figured they would work fine. I just stuck them into the breadboard bent them forward and started testing out programs to make it seek out the brightest light. I ended up writing a program that reads the value from both sensors and if they are different by 8 it turns towards the one that is reading a higher value of light hitting it. I also used the 9V battery between the two sensors to block some of the light from spilling over and affecting the readings of the second photocell when Ard-e was turned one way. Here is a video of Ard-e following the light from a flashlight that I was shining at him then veering off and going towards the light coming from the door. The quality of the video is really bad because the readings of the sensors get all screwy if alot of background light is present. http://www.instructables.com/id/Arduino-Projects/ Now on to making Ard-e smell and hear. Image Notes 1. 9V battery separating the light sensors 2. Ard-e's left eye 3. Ard-e's right eye Image Notes 1. left eye 2. right eye Step 7: Ard-e's sense of hearing and smell: interfacing an old speaker and a VOC sensor with an Arduino So to give Ard-e the final two senses that he really needs, hearing and smell, all you need is an old speaker and a Volatile Organic Compound sensor. So to make Ard-e hear the world and react very simply to it all you need is an old headphone. Just as a headphone can turn electrical pulses into sound it can turn sound into electrical pulses. All you need to do is hook one of the leads from the headphone to ground and one of them to an analog input on the Arduino. The program to very simply interface this with the Arduino is to make a threshold that is set very low maybe like 2 or 5 and if the analog input is driven higher than this threshold make Ard-e react. You can implement it like the clapper where clapping makes him turn on or off. I was able to use an old headphone in the very preliminary stages of making Ard-e to act as a clapper but by the time that I got Ard-e up and running by himself the headphone no longer functioned as a microphone so I didn't actually make Ard-e interface with it. The microphone/ headphone was proven to work as an input to the Arduino though. To get finer resolution on Ard-e's ability to hear you might want to use an OPAMP based inverting amplifier with an adjustable gain. I attached a schematic of a circuit that I think would work ideally for this but I didn't test it out so be careful if you choose to attach it to your Arduino. To get Ard-e to smell is a little pricey though. All it takes is a VOC sensor hooked up to an analog input of the Arduino. The sensors run around $22 a piece though. I'm now going to link you to an instructable that my brother wrote about how to use these sensors with the Arduino but be warned... he never wears a shirt and is sorta a tool. Follow the link with caution: http://www.instructables.com/id/How-To-Smell-Pollutants/ Once this sensor is attached to the Arduino its a simple matter to write a program that makes it drive to where the concentration of VOC's is the highest and set off an alarm. To easily make an alarm for the Arduino all that I did was take apart an old broken alarm clock take the piezo-electric buzzer and attach it to one of the digital PWM output pins. A simple call of analogWrite(the pin, and a value from around 10-255) produces a very nice alarm noise. So now Ard-e can see, smell, touch and hear the world around him. He can even produce tones too. These are all really important senses but robots need some other senses that humans don't necessarily need. Lets build Ard-e some sensors so he can have some robot senses. http://www.instructables.com/id/Arduino-Projects/ Image Notes 1. crappy old headphone Image Notes 1. crappy old headphone cut from it case Image Notes 1. crappy old headphone miraculously transformed into a microphone! Image Notes 1. An opamp with a 5V power supply 2. The microphone input Image Notes 1. crappy old alarm clock http://www.instructables.com/id/Arduino-Projects/ Image Notes 1. Ard-e's nose: a figaro sensor's 2620 VOC sensor. Image Notes 1. piezo buzzer that is just begging to be used to give Ard-e a voice 2. LED display that would be cool to use 3. Cool looking transformer that I am pretty sure I'm not gonna use on Ard-e at all... 4. Whats the third wire for? Step 8: Ard-e's robot senses: tracking how far his wheels turn and seeing IR light Since humans don't have wheels their is really no need for us to be able to track how far our wheels have turned. Ard-e being a wheel based robot however needs to know this. To accomplish this you can employ many different methods. An instructable was just submitted for this contest that takes the data from an accelerometer then extrapolates the distance from that. For Ard-e however all we are going to need is an LED and another light sensor. We just need to shine a led through his tracks and then have a light sensor on the other side count how many times the light changes from high to low. Once you have a count on this number you can measure the distance between holes in the tread and correlate this to a distance. Or you could just set Ard-e to drive for a number of counts of the light switching from high to low then measure the distance that he traveled to get the conversion factor from counts to inches (or centimeters if you like working in SI). Then you can literally program Ard-e to go exactly six feet forward turn right go forward a foot or any other course you want it to take. To actually build the sensor I used my trusty piece of scrap metal and folded a rectangular piece of it into a U shape. I drilled a hole to mount it into the side of Ard-e and then two holes for the led and the light sensor to fit into. I mounted it onto Ard-e so that the led shines right through the center of the holes in the treads onto the light sensor. I put the light sensor on the top part of the U and then put some electrical tape around the sides of the U to block out some of the ambient light that would mess up the readings of the light sensor. I then connected the light sensors just like I connected them for making Ard-e sense where the brightest light is, as a voltage divider to an analog input (using the same input pins and resistors as the "eyes" of Ard-e). The led was soldered to a resistor sized to enable it to run off of 5V and then plugged http://www.instructables.com/id/Arduino-Projects/ into the power being supplied by the Arduino. Just by moving the wheel manually and watching the values that the Arduino outputs using the Serial.print() command to the serial monitor you can get a 600 point swing on the scale of 0-1023. The low is around 200 and the high is around 800. I attempted to write a program that uses 400 as the cutoff for a low to high value and counted the times it switched from below to above 400 but it was beyond the scope of my programming abilities. I think it was because i was using too slow of a speed on the serial printing and checking of the values of both sensors and the treads were being spun pretty fast. When I tried to use a higher speed it wouldn't print at all. In retrospect I don't even need to have the values printed. I wasn't able to get the Arduino to correctly read the values coming from the sensors as the wheels were spinning but I demonstrated that it was possible to use this sensor to count the number of times that the tread interrupted the light from the LED to the light sensor. And if your a better programmer than I am you could convert this number to a distance and program Ard-e to drive to that distance. Another of Ard-e's robot senses that would be awesome for him to have is being controlled by an old VCR remote. I found a remote in the old pile of electronics junk and found a infrared Radiation sensor at Radio Shack. All that you would need to do is hook the infrared sensor up to the +5V and Ground and then the output to an analog input on the Arduino, just as it says on the back of the box for the sensor. Again if your a much better programmer than I am you could then program the Arduino to recognize the IR signal from the remote and correlate it to making Ard-e move. If the up arrow on the remote is pressed make Ard-e drive forward, if the down arrow on the remote is pressed go backwards, etc. I bought the sensor from radio shack but haven't been able to get the Arduino to interface with it it yet. So now Ard-e's senses are complete! Or at least as complete as I can make them. You on the other hand should get started recycling some old junk to add on as sensors for your own version of Ard-e. Now whats next for Ard-e? Image Notes 1. LED 2. light sensor Image Notes 1. left wheel sensor 2. right wheel sensor 3. crazy jumble of wires. 4. touch sensors 5. right eye 6. left eye 7. The autonomous version of Ard-e Image Notes 1. The holes in the treads limit the accuracy of the distance that you can tell Ard-e to drive to.... if you know how to program better than i do http://www.instructables.com/id/Arduino-Projects/ Step 9: The Future of Ard-e: What comes next So what should I do now that I have a really cool autonomous robot? Make him even cooler of course. I would absolutely love to have Ard-e controlled by a wii remote. That would be excellent. Its really far beyond my programming skills though. Interfacing him with a cheap cell phone to make him do different things when the phone is called or texted would also be pretty cool. I feel like Ard-e should also have some more manipulators so he can not only sense the world but also interact with it. I found a crappy old joystick at a junk store that is just begging to be used to control Ard-e. It doesn't seem like it should be that much of a challenge to control him with it so I hope to do that soon. This is the end of my instructable so the other ideas for making Ard-e cooler have to come from you. Get working and post what you come up with as an instructable! Hopefully you liked this instructable and will vote for it in the RobotGames Contest. Leave any questions about the building of or attempts i made at programming Ard-e as comments and ill do my best to answer them. Image Notes 1. $4 joystick that i might use to make another remote controlled version of Ard-e Image Notes 1. the easily hackable innards of the joystick Related Instructables Homemade stretchsensors for robotic apps, made from conducting foam. (video) by renaissanceman Make a scary scarab robot by djsures Carlitos' Projects: Wireless SpeechControlled Arduino Robot by RobotShop Cheap, Easy Robotics for the NonProgrammer by doctek (w/ Video) Basic Arduino Robot, Light Seeker! by Chowmix12 Paper lamp + touch on/off mechanism with Arduino by celguero Arduino Robot (video) by c0ffeepowder Wii Nunchuck as general purpose controller via Arduino board by XenonJohn http://www.instructables.com/id/Arduino-Projects/ Build Your Own BARBOT by techball on March 13, 2010 Intro: Build Your Own BARBOT Ever wanted a robotic liquor server? I purchased a Lynxmotion robotic arm last year and an Arduino (deci) to play around with. I had it serial controlled with a joystick and it was a great way to start in robotics. More recently I wanted to take on another micro-controller related project for a university science fair. Since it was going to be hosted at the on-campus pub, I thought it would be fitting to build a robot that would dispense alcohol into shot glasses. I hope this instructable is easy to understand and I will try to include as much detail as possible so that anyone could make one for under 200 dollars. Please vote and comment on this instructable. It is my first one and I hope to make even better ones in the future. DISCLAIMER: It is a experimental project and will require some basic electronic skills such as soldering and AVR programming. Modifications may cause damage to your micro controllers if you are not careful (since you are working with liquids). I DO NOT claim any responsible for such misfortunes. As well, this project is not fully documented as I was tight on time completing it, therefore more detail may be added as time goes on. If you have any question, please ask and I will be happy to help. PS. During the build I discovered that there is competition and audience for this kind of robotics and to my surprise it is under the same name "BarBot" (link: robogames.net/barbot.php). I hope no one is angry that I used the same name. I do wish I could attend Robogames though. Step 1: From Concept to Reality My first step was to consider my available resources. I had 5 servos, a 14" by 14" piece of 1/4" polycarbonate, the Arduino, and a few servo brackets from Lynxmotion. (Purchase from www.robotshop.ca/) Then I considered the features required: Liquor Reservoir (I wanted at least 3 containers of minimum 500ml each in volume) Tray for the shot glasses (I wanted at up to 4 shots to be served at once) Human Interface (Controls for the selection of type of liquor to be intuitive) Liquor Selector (A mechanism that chooses the selected type of liquor to dispense) Dispensing volume controller (A mechanism that allows the control of volume of liquid per shot) Initially, the idea was to directly use the robotic arm and attach a liquor dispensing mechanism to it, but this proved to be difficult due to a number of factors. First, I did not have proper sized valves so it was difficult to figure out how to transport the liquid to the dispenser on the arm without interruption. Second, I had 1/4" tubing (sourced locally at a hardware store) but it was not the silicone type and therefore not very flexible (too much torque will be required for the servo). The next idea was to have the dispenser be stationary and have the tray with the glasses move under it. This had a few advantages: no need for a mechanical liquor sector as the tray could just move under the selected liquor container, and less torque would be needed for the main servo since the tray is horizontal and weight of the glasses (acting vertically) could be supported through structure. The images below highlight some of the ideas, with them evolving to the final sketch at the end. Funny thing is I know AutoCAD and SolidWorks, but prefers to draw them because I get most of my ideas right before I go to bed (I have pen and paper prepared under the bed just for that :P). http://www.instructables.com/id/Arduino-Projects/ Image Notes 1. The rough draft. As you can see, its is just the general dimensions. I want to emphasize that the project contains a certain amount of trial and error, but the next step will help you make less mistakes. Step 2: Building the Supporting Structure. I had a piece of polycarbonate left over from an underwater camera case I built last year. Originally it was destined for a computer case mod that I started but never finished. I felt bad for it as it was just sitting there waiting to be useful. It was a 14" by 14" square, so just over a square foot. Unfortunately it is also the only material for this project that I do not know where a good and well-priced source could be found. I hope avid readers of this instructable could provide their insight on this matter (so I could update this). I am a fan of circles, and since the tray would be traveling in an arc, I decided to build the base based on circles (its a pun, I love puns). The main dimensions are based on the material constraints, so its pretty easy to see the general size of the whole structure by looking at the image below. However, the dimension are also based on the size of the shot glasses I used as well as the size of the Lynxmotion servo bracket (I wanted the tray to have the same curvature as the base so it looks like two intersecting half-circles). I found that the easier way to prototype for structures like this is to build a 1:1 scale out of cardboard (this was faster for me than CAD and can provide similar insight on whether your designs will be feasible. Attached are pictures of the frame built with cardboard. Image Notes 1. Exact 1:1 to the initial design, but I did realize that more material could be saved if this middle section is removed. Image Notes 1. The most important thing here is to have the axis of rotation to be at the center of the circled tray. You can adapt this to a larger tray if needed, just make sure your servo and servo arm could handle the torque and range. http://www.instructables.com/id/Arduino-Projects/ Image Notes 1. The shot holder size and location was determined here. You will have to adjust for it accounting to the type of shot glass you want to use. Step 3: Working with Polycarbonate Despite being strong and aesthetically crystal-like, polycarbonate is relatively easy to work with. The major cuts were done on a band saw, although a jigsaw, hacksaw or dremel could have been used as well. Too ensure a nice clean look, all cuts were then sanded with a belt sander. Some smaller corners had to be filed smooth first then sanded. One important thing I have learned is that you NEED sharp tools and patience, especially when drilling large diameter holes. I had some decent hole saws that I assumed would go through like butter. Well, it did, it melted the material surrounding the hole as well, causing slight discoloration and a lot of headache. So remember to take it slow and do not apply too much pressure when drilling so it could cool. Image Notes 1. The material saving I mentioned earlier. Image Notes 1. The basic shapes are all there, but there will be some rounding to ensure a clean modern look. 2. Initial this tab was to ensure stability of the stand, but I found it too protruding and removed it. 3. This is where I had to file a lot before sanding to achieve a nice curve. Step 4: The Tray Arm The tray arm is made from a piece of polycarbonate with holes that will allow the glasses to sit 2/3 of the way. There are contact switches glued under each hole to allow the Arduino to sense the presence of the glasses (we wouldn't want to waste liquor now). The tray arm is made from: 1 x Lynxmotion "L" Connector Bracket (www.robotshop.ca/lynxmotion-connector-bracket-asb-06b-3.html) 1 x Lynxmotion Long "C" Servo Bracket (www.robotshop.ca/aluminum-long-c-servo-bracket-asb-05-3.html) 1 x Lynxmotion Multi-purpose Servo Bracket (www.robotshop.ca/lynxmotion-aluminum-multi-purpose-servo-3.html) 1 x Hitec HS-645MG Servo, although a cheaper HS-422 would do as well. (www.robotshop.ca/hitec-hs422-servo-motor.html) 4 x Small Snap-action switches with levers. There are great inexpensive contact sensors I got from All Electronics, a great online store http://www.instructables.com/id/Arduino-Projects/ (www.allelectronics.com/make-a-store/item/SMS-242/SMALL-SNAP-ACTION-SWITCH-W/-LEVER/1.html) 1 ft of Multi-wired cord (8 strands needed) I got this great 10-strand cable that is useful for situation such as this. (www.allelectronics.com/make-a-store/item/10CS22/10-CONDUCTOR-SHIELDED-CABLE-W/-DRAIN/-/1.html) Most of the mounting screws will be available to you at your local hardware store. I used a few nuts, screws and bolts from the bracket kits. Image Notes 1. Be sure to set up the switches perfectly or the shot glasses will not sit well in the tray. Hot glue sets in fast and you will have to be right on the spot the first time! Image Notes 1. Two heavy duty nuts were used. Make sure that the nuts used are slight smaller in diameter than the mounting holes on the bracket. This way you can adjust the horizontal alignment of the tray (to make sure its flat with the ground). Image Notes 1. Zipties are used to secure the cable to the tray. The colored wired made it easy to know which switch is which. http://www.instructables.com/id/Arduino-Projects/ Image Notes 1. Testing shot. Step 5: Liquor Containment Modules This was by far the most difficult part of the build. In fact I am still not completely satisfied with the performance (volume flow mostly). The problem lies in my choice of driving the liquid - through gravity. I did not want to increase the cost and difficulties of this project through the addition of a powered pump so I opted for the easier way. How does it work? Basically, the servo adjusts the height of the the existing end (nozzle) of the tube. When the end of the tube is lowered below the the liquid level (analogous to the water table) of the of container, the pressure from the weight of the liquid pushes itself out. To stop the flow, simply raise the end above the liquid level. Without going through the fluid dynamics aspects of it, the flow rate is completely dependent of the vertical height of the liquid in the container. This creates serious limitations. To have a higher flow rate I would need a taller liquid level, and that, in turns, means a way to raise the exist end of the tube above that as well. I simple terms, the more flow rate I want, the longer the dispense tube would have to be. That is not something I want, as I would prefer a more compact design. I the end, I settled for sacrificed flow speed for size. The Container I used a Voss water bottle which I picked up at my local Shopper's Drugs. It is 1L in volume are beautifully simple. Any bottles that are in the general volume range of 1L should do. The Voss bottles are especially nice, as the cap is big and flat, which made attaching the bracket a breeze. Dispenser The dispenser is made from a standard servo with two eye hooks and a 9in length of tubing. The mechanics of the dispenser is largely dependent on your individual setup, but there are a few things to look for. Make sure that the neck of the tubing is dipped below the lowest point of the container (see picture). This ensures the siphoning action is not interrupted by air bubbles from the back flow when the nozzle is up. Image Notes 1. Each module is hot-glued to the frame with a square piece of polycarbonate in between for height adjustment. 2. Make sure the mouth of the tubing in the container is at the lowest point. 3. When in the "OFF" position, the nozzle must be above the water level in the container. Image Notes 1. The servo bracket is attached to the container with a screw on the top and one on the bottom. 2. Tubing passes through the bottle cap by a drilled hole. Epoxy was applied to ensure a proper seal. 3. This part of the tubing must be lower than the base of the container to ensure no air bubbles form when the nozzle is up. http://www.instructables.com/id/Arduino-Projects/ Image Notes 1. The depth of the eye hooks controls the lateral angle of the tubing to help with the aim into the funnel. Step 6: Control Panel The control panel allows you to choose the drinks. I have a very basic setup with LEDs and a pot for selection. You can be more creative and use a LCD if you optimize the output pins used, which was my original plan before I run out of time. The panel is made from: 1 x Small project box - I got mine from Radio Shack a long time ago, but All Electronics has a bunch to choose from (www.allelectronics.com/make-a-store/category/219/Enclosures/1.html) 1 x Linear-tapered Potentiometer - I used a pot as it was what I had around, I think its a nice input but a slide pot may have been even more intuitive. What I used (www.allelectronics.com/make-a-store/item/LTP-15M/15M-LINEAR-POTENTIOMETER/1.html) Slide pot (www.allelectronics.com/make-a-store/item/SP-20K/20K-LINEAR-SLIDE-POT-OPEN-FRAME/1.html) 3 x Bright LEDs - These are just a great and simple way to indicate your drink choice, I had them mounted in the control panel, but I think it would be even cooler if they were attached to the container modules (perhaps with the liquor type indicated beside it). I also went for the more expensive option of having a metal mount. (www.allelectronics.com/make-a-store/item/IND-13B/5MM-ULTRA-BRIGHT-LED-W/METAL-CASE-BLUE/1.html) 1 x Push button switch - Just a simple start switch to let the BarBot know that you are ready. (www.allelectronics.com/make-a-store/item/PB-138/SPST-N.O.-PUSHBUTTON-RED/-/1.html) You should be creative with your user controls. For example, you can mount the LEDs on the dispensing modules themselves and label them with the liquor. I chose to use a project box because I had a few of them that were lying around. I am an amateur when it comes to soldering and circuit layouts, so it was fairly messy. Image Notes 1. I had the Arduino set up so that the knob of the pot points to the indicator LED that is lit. There is also a random function when the knob is turned all the way. Image Notes 1. It's a bit of a mess. You will not have this if you mount the indicator LEDs on the modules. :P http://www.instructables.com/id/Arduino-Projects/ Step 7: Interfacing with the Arduino This section will be covered in brief as I am a beginner at AVR programming so I am only qualified to give you hints and tips. Make sure you have the latest version (0018) of the compiler so your servo library is up to date. I have uploaded the sketch, but keep in mind that many of the variables have been set to my specific conditions (servo angles, pouring time, etc). You will have to experiment with your set up to determine your own settings. As I plan to use the Arduino for other projects (a tracked robot maybe :D), the wiring were all done with jumper wires and an inexpensive bread board. You can purchase the Arduino proto-shield if you would like the project to be permanent. In which case you might also consider a BareBones Arduino for cost savings. I will not go into specifics of the pin connections setup as I believe that most people who are familiar with AVR programming will find the coding itself to be fairly straight forward. As for those people new to Arduino, I think it will be more fun to explore my coding and see for yourself what it is like. The Arduino website is a great source of references for syntax and the such. BE CREATIVE! File Downloads BarBot5.pde (4 KB) [NOTE: When saving, if you see .tmp as the file ext, rename it to 'BarBot5.pde'] Step 8: Putting it all Together This section will cover some of the little things that I encountered along the way of building this BarBot as well as final finishing touches. As always, pictures will do me a more justice than endless paragraphs. Image Notes 1. The electronics and batteries are enclosed in another Voss bottle for liquid protection and to make sure the many wires remain well connected. Image Notes 1. Alignment is key, the position of the funnel is the adjustable control for such alignment. http://www.instructables.com/id/Arduino-Projects/ Image Notes 1. You want a tight tolerance on the gap here to prevent spillage. Image Notes 1. A proper setup will allow the nozzle to be positioned in the middle of the funnel so as to avoid too much contamination between pours. Image Notes 1. Air hole for container depressurization. Image Notes 1. I used screws with break away heads for a cleaner look, but the hot glue in between the joint minimized that effort. Step 9: Afterthoughts Well, I did receive first place for the fair so overall I was very pleased with the project. I loved explaining the workings and purpose of the robot and getting their reactions. I think more forethought would have made the build process more smooth, but trial and error helped along the way. It's surprising how much fun building something like this was. I would recommend this type of project to any avid builder that are interested in robotic. Please post comments and pm any questions to me. Related Instructables 5 minute DNA Extraction in a Shot Glass by macowell Understanding: Drinking Alcohol by )(angman Build A Mobile Bar - BaR2D2 by jamiep Robot Rampage (video) by techsean How to enter the iRobot Create Challenge by jeffreyf Building Small Robots: Making One Cubic Inch Micro-Sumo Robots and Smaller by mikey77 Joystickcontrolled Robot (Photos) by a1r Robotic Drink Mixer by jamiep http://www.instructables.com/id/Arduino-Projects/ Control a RepStrap with Processing by marc.cryan on October 4, 2009 Intro: Control a RepStrap with Processing This instructable shows how you can use many openly available projects together to build an interesting and complex system. It draws on several community projects including: RepRap, Arduino, Processing, Linux and, of course, Instructables! More specifically this intructable shows how to draw the path of a bouncing ball with a CNC machine. But this is primarly an example of this open source toolchain. The first few steps of this intstructable describe the basic setup I am using and includes links to additional information. This is followed by more specific intructions and code to creaste the drawings. Here is a breif outline of the setup I am using. Setup: Hardware: 1 - RepStrap McWire Carestion Bot 2 - Stepper drivers with firmware from RepRap 3 - PC power supply 4 - Arduino Duemilanove Software: 1 - Arduino IDE on a computer 2 - Processing software on a computer http://www.instructables.com/id/Arduino-Projects/ Step 1: The Setup Here is the setup in detail. All the pieces were built following directions from community projects. In this step I've included descriptions and links for all the hardware and software components for this project. If you follow all the instructions on all these links you will have a setup identical to mine. You can use whatever X-Y CNC platform you can get your hands on. I've listed some alternatives in one of the final steps. From left to right. RepStrap This is "McWire Cartesian Bot v1.2" - It is a version of Tom McGuire's CNC machine which has been adapted by The RepRap group for 3D printing. For simplicity, this Instructable is only using the X-Y axis. You should be able to use any X-Y stage that is driven with stepper motors. If you would like to build this exact machine, detailed instructions can be found here (http://reprap.org/bin/view/Main/McWire_Cartesian_Bot_1_2) I believe these were posted by Zach Smith of the RepRap team. Tom McGurie's original instructable is here (http://www.instructables.com/id/Easy-to-Build-Desk-Top-3-Axis-CNC-Milling-Machine/) "Stepper Drivers" These driver boards are also the work of the RepRap team. They are "Stepper Motor Driver V1.2" Designed by Zach Hoeken. Full instructions can be found at http://reprap.org/bin/view/Main/Stepper_Motor_Driver_1_2. These include ports for optical endstops. This is a very nice feature, but I am not using it here. They have new version - Stepper Motor Driver v2.3 which is availble here (http://store.makerbot.com/featured-products/stepper-motor-driver-v2-3-kit.html). SparkFun is stocking a good looking driver as well (http://www.sparkfun.com/commerce/product_info.php?products_id=9402). "Power" The power to the drivers is from a desktop computer power supply. RepRap will also tell you how to do this! http://dev.www.reprap.org/bin/view/Main/PCPowerSupply "Arduino with breakout" This setup is using an Arduino Duemilanove with an Atmega 168 chip. Everything should work with other Arduino's and clones. This breakout is also from RepRap. It is "Arduino Breakout v1.4" also Designed by Zach Hoeken. And available here. http://store.makerbot.com/electronics/pcbs/arduinobreakout-v1-4-pcb.html Spark fun is stocking a nice screw sheild as well (http://www.sparkfun.com/commerce/product_info.php?products_id=9282) "USB cable to PC" The Arduino is connected to a desktop computer with a USB cable. "Software on the PC" I'm running an Ubunto distribution of Linux on my PC, the operating system shouldn't really matter since this project using Arduino and Processing software which is designed to run on most platforms (Linux, Mac, Windows). If you don't already have them, You will need to load the Arduino and Processing software packages. http://www.arduino.cc/ http://processing.org/ http://www.instructables.com/id/Arduino-Projects/ Step 2: Build a pen holder Ideally you would have a milling tool or plastic extruder mounted on the Z-axis of your desktop CNC machine. Since I have not built those parts for my RepSrap yet, I am using a Sharpie marker clamped to the Z-axis frame. To build a quick Sharpie holder. Drill a 1/2" hole in through one end of a strip of wood or plastic (approx 1/4?X1.5"X6"). Wrap a bit of duct tape around the Sharpie for traction. Then stick the sharpie through the hold and clip it inplace with two binder clips, as shown below. This holds reasonalby will and can be quickly adjusted. Once you are ready to start "printint" you just clamp the strip of wood to the fram of the Z-axis, or whatever is handy. http://www.instructables.com/id/Arduino-Projects/ Step 3: Arduino Wiring: Arduino Wiring: It is important to have stepper motor drivers wired to the stepper motor correctly. In this case, 'correclty' means that the Arduino to Stepper driver connections match the pins called out in the Arduino and Processing Code that follows. Wire the stepper motor to the Arduino like this: X - Driver "Arduino" "What it does" Pin 3 2 Step Pin 4 3 Direction Y - Driver "Arduino" "What it does" Pin 3 10 Step Pin 4 7 Direction This is the same setup used by RepRap.org (http://make.rrf.org/electronics-2.0). So if you have a half built RapRap you are all set! http://www.instructables.com/id/Arduino-Projects/ Step 4: Arduino Code "Arduino Code:" This project requires to peices of code. 'Firmware' that is loaded onto the Arduino microcontroller. And 'Software' that is run by the Processing program on the PC. The chain of command goes like this - Processing -> Ardcuino Board -> Steppr drivers -> stepper motors -> X-Y stages. Here is a little more detail of the communication that will be happening, based on my understanding of the way things work.... The Processing software will send commands to the Arduino board over the USB cable. T The Arduino board will take the command and set the specifed output pins to high or low logic states (5V or 0V). The stepper drivers are wired to the Arduino board outputs. So when the drivers see the high and low signals, they send power to the approriate coils in the stepper motors, making them go. The code below sets up the Arduino board to listen for the commands sent from Processing and then take actions. You can cut and paste the code in the Arduino IDE. Then verify the code by clicking the 'Play" button. If there are no errors you can then upload it to the board by pressing the upload button - which looks like a right arrow. // Arduino code: // Read data from the serial and turn ON or OFF a light depending on the value //and control stepper motor on RepStrap char val; // Data received from the serial port int ledPin = 13; // Set the pin to digital I/O 13 #define XstepPin 10 http://www.instructables.com/id/Arduino-Projects/ #define XdirPin 7 #define YstepPin 2 #define YdirPin 3 void setup() { pinMode(ledPin, OUTPUT); // Set pin as OUTPUT pinMode(XstepPin, OUTPUT); pinMode(XdirPin, OUTPUT); pinMode(YstepPin, OUTPUT); pinMode(YdirPin, OUTPUT); Serial.begin(9600); // Start serial communication at 9600 bps } void loop() { if (Serial.available()) { // If data is available to read, val = Serial.read(); // read it and store it in val } if (val == 'H') { // If H was received digitalWrite(ledPin, HIGH); // turn the LED on digitalWrite(XdirPin,HIGH); digitalWrite(XstepPin,HIGH); delayMicroseconds(2); digitalWrite(XstepPin,LOW); delayMicroseconds(2); } if(val == 'h') { digitalWrite(ledPin, HIGH); // turn the LED on digitalWrite(YdirPin,HIGH); digitalWrite(YstepPin,HIGH); delayMicroseconds(2); digitalWrite(YstepPin,LOW); delayMicroseconds(2); } if (val == 'L'){ digitalWrite(ledPin, LOW); // Otherwise turn it OFF digitalWrite(XdirPin,LOW); digitalWrite(XstepPin,HIGH); delayMicroseconds(2); digitalWrite(XstepPin,LOW); delayMicroseconds(2); } if (val == 'l'){ digitalWrite(ledPin, LOW); // Otherwise turn it OFF digitalWrite(YdirPin,LOW); digitalWrite(YstepPin,HIGH); delayMicroseconds(2); digitalWrite(YstepPin,LOW); delayMicroseconds(2); } delayMicroseconds(1000); // <<<<<< USE TO CHANGE SPEED <<<<<<<< } http://www.instructables.com/id/Arduino-Projects/ Step 5: Processing Code "Processing Code" Here is the Processing code. Open Processing and cut and paste the code. This code is built on an example from the Processing text book written by Casey Reas and Ben Fry. (http://www.amazon.com/Processing-Programming-HandbookDesigners-Artists/dp/0262182629) //This outputs the motion of the bouncing ball to the RepRap X and Y axis import processing.serial.*; Serial myPort; // Create object from Serial class int val; // Data received from the serial port float x= 50.0; float y = 50.0; float speedX = 1.0; float speedY= .4; float radius = 15.0; int timeDelay = 10; //10 ms delay between direction prints gives rocky step int directionX = 1; int directionY = 1; void setup(){ size(100, 100); smooth(); noStroke(); ellipseMode(RADIUS); String portName = Serial.list()[0]; myPort = new Serial(this, portName, 9600); } void draw(){ fill(0,12); rect(0,0,width, height); fill(255); ellipse(x, y, radius, radius); x += speedX * directionX; if (directionX == 1){ //if the direction is up, the motor goes one way myPort.write('H'); print('H'); http://www.instructables.com/id/Arduino-Projects/ delay(100); } else { // if the direction is down, the motor goes the other way myPort.write('L'); // send an L otherwise print('L'); delay(100); } if((x>width-radius) || (x < radius)) { directionX = -directionX; } y += speedY * directionY; if (directionY == 1){ //if the direction is up, the motor goes one way myPort.write('h'); print('h'); delay(100); } else { // if the direction is down, the motor goes the other way myPort.write('l'); // send an L otherwise print('l'); delay(100); } if((y>height-radius) || (y < radius)) { directionY = -directionY; } } Step 6: Run the Processing Code "Run the Processing Code:" Confirm that power is OFF to the stepper motors. Run the Processing code by clicking the 'Play' button. You should see: 1 - A display window on the computer monitor showing the ball slowly bouncing around. 2 - The LEDs on the Arduino and stepper boards blinking. The H,h,L,l outputs are printed on the bottom of the screen, they are also sent over the USB cable to the Aduino board. http://www.instructables.com/id/Arduino-Projects/ Step 7: Draw! Draw! Now that the path of the bouncing ball is being sent to the Arduino Board, it is time to set up the paper and pen. - Tape a peice of paper to the X-Y platform. - Clip a pen to the Z-axis frame. -Check that the ball is still bouning and the lights are still blining. -Turn on power to the stepper motors! -Now the X-Y platform will move about following the path of the bouncing ball. Yay! Step 8: Make changes "Make changes:" Now you can mess around with the code to change the behavior of the ball, which will change the comands to the robot and it will draw somehting different. Changing the size of the box will make a bigger drawing. You can also: Change speed Change the X or Y bounce You will probably notice that the steppers are not running very smoothly. I'll post some new code once this is fixed. Alternatives and ideas: -You can do almost this exact instructable using the Arduino "Frimata" library. I don't know if there is much advantage either way. -Ultimately would like to print 3D objects that are generated from Processing. I'd like to print 3D fractals, but I am a long way off for now! http://www.instructables.com/id/Arduino-Projects/ Step 9: Making it a little better As I make improvements I am going to add steps to the end of this instructable. 10-11-09 The previus code tracks the ball pretty well but the steppers are driven in a very rocky way. In this updated code, the Proccessing sketch only sends a signal to the Arduino when there is a change in direction. So the stepper motors just run in whatever direction they were last set to, until they are told to change. This allows the motors to run alot faster and smoother. But there is still somthing a bit off. The Arduino seems to miss some of the signals, so the RepStrap ends up with the X-Y stage pushed all the way to one side. I will try to fix this. The Arduino and Processing code is below. I have added more comments to help keep things clear. ///////////////////////////////////////////////// // Arduino code: // Read data from the serial //Use data to determine direction of X and Y steppers #define XstepPin 10 #define XdirPin 7 #define YstepPin 2 #define YdirPin 3 int val; // Data received from the serial port void setup() { pinMode(XstepPin, OUTPUT); pinMode(XdirPin, OUTPUT); pinMode(YstepPin, OUTPUT); pinMode(YdirPin, OUTPUT); Serial.begin(9600); // Start serial communication at 9600 bps } void loop() { int dirX; int dirY; if (Serial.available()) { // If data is available to read, val = Serial.read(); // then read it and store value in val } if (val == 'H'){ dirX = HIGH; } if (val == 'L'){ dirX = LOW; } if (val == 'h'){ dirY = HIGH; } if (val == 'l'){ dirY = LOW; } digitalWrite(XdirPin,dirX); //set X direction digitalWrite(YdirPin,dirY); //set Y direction digitalWrite(XstepPin,HIGH); //take steps digitalWrite(YstepPin,HIGH); delayMicroseconds(2); digitalWrite(XstepPin,LOW); digitalWrite(YstepPin,LOW); delayMicroseconds(2); delayMicroseconds(1000); // <<<<<< USE TO CHANGE SPEED <<<<<<<< } /////////////////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////////// //Processing Code: //This outputs the motion of the bouncing ball to the RepRap X and Y axis import processing.serial.*; Serial myPort; // Create object from Serial class int val; //set the direction of X and Y based on data sent from Processing http://www.instructables.com/id/Arduino-Projects/ float x= 50.0; float y = 50.0; float speedX = 1.0; float speedY= .4; float radius = 15.0; int directionX = 1; int directionY = 1; int old_directionX = 1; int old_directionY = 1; void setup(){ size(100, 100); smooth(); noStroke(); ellipseMode(RADIUS); String portName = Serial.list()[0]; myPort = new Serial(this, portName, 9600); } void draw(){ fill(0,12); rect(0,0,width, height); fill(255); ellipse(x, y, radius, radius); x += speedX * directionX; if((x>width-radius) || (x < radius)) { //change X direction if the ball hits the side of the box directionX = -directionX; } y += speedY * directionY; if((y>height-radius) || (y < radius)) { //change Y direction if the ball hits the side of the box directionY = -directionY; } if ((directionX != old_directionX) && (directionX == 1)){ //if X direction changed print H myPort.write('H'); print('H'); delay(100); } if ((directionX != old_directionX) && (directionX == -1)){ //if X direction changed print h myPort.write('h'); print('h'); delay(100); } if ((directionY != old_directionY) && (directionY == 1)){ //if Y direction changed print L myPort.write('L'); print('L'); delay(100); } if ((directionY != old_directionY) && (directionY == -1)){ //if Y direction changed print l myPort.write('l'); print('l'); delay(100); } old_directionX = directionX ; //stores the directions we just used, as the old direction old_directionY= directionY; //delay(100); //uncomment to slow the whole thing down for troubleshooting } http://www.instructables.com/id/Arduino-Projects/ Step 10: Doing it with Firmata Here is an alternative approach that uses the Firmata library to change the direction of the stepper motor from Processing. You can learn more about it here: http://arduino.cc/en/Reference/Firmata and here: http://firmata.org/wiki/Main_Page I don't understand the details. But, from my experience so far, I do know that is does a good job of handling the communication between the PC and the Arduino. So, I am happy to ignore the details for now. I have started by modifying an example that is included in theArduinoIDE called "SimpleDigitalFirmata". Once this code is loaded onto the Arduino, You can communicate with the digital pins on the Arduino board directly from Processing. In processing I am working from an example that turns on and off an LED on the Arduino board when you move a mouse over a square dawn of the monitor of the PC. To make Processing control the LED and a Stepper motor, you need to modiify the code for the Arduino and Processing. On the Arduino side - I've defined the stepper pins at the top of the sketch. Then I jammed in code to drive the stepper at the end of the main loop. I put this outside of the code that reads the serial port. So the stepper will just go. The direction of the stepper is set directly from Processing. The example code turned on and off an LED on pin13. So, I just made the step direction pin do the same thing as the LED. Here is the code. This only controls the X stepper. ///////////////// ARDUINO ////////////////////// //Supports as many digital inputs and outputs as possible. // //This example code is in the public domain. #include #define XstepPin 10 #define XdirPin 7 //Step pin //Direction pin byte previousPIN[2]; // PIN means PORT for input byte previousPORT[2]; void outputPort(byte portNumber, byte portValue) { // only send the data when it changes, otherwise you get too many messages! if(previousPIN[portNumber] != portValue) { Firmata.sendDigitalPort(portNumber, portValue); previousPIN[portNumber] = portValue; Firmata.sendDigitalPort(portNumber, portValue); } } void setPinModeCallback(byte pin, int mode) { if(pin > 1) { // don't touch RxTx pins (0,1) pinMode(pin, mode); } } void digitalWriteCallback(byte port, int value) { byte i; byte currentPinValue, previousPinValue; if(value != previousPORT[port]) { for(i=0; i<8; i++) { currentPinValue = (byte) value & (1 << i); previousPinValue = previousPORT[port] & (1 << i); if(currentPinValue != previousPinValue) { digitalWrite(i + (port*8), currentPinValue); } } previousPORT[port] = value; } } void setup() { Firmata.setFirmwareVersion(0, 1); Firmata.attach(DIGITAL_MESSAGE, digitalWriteCallback); Firmata.attach(SET_PIN_MODE, setPinModeCallback); Firmata.begin(57600); } void loop() { outputPort(0, PIND &~ B00000011); // pins 0-7, ignoring Rx/Tx pins (0/1) outputPort(1, PINB); // pins 8-13 while(Firmata.available()) { http://www.instructables.com/id/Arduino-Projects/ Firmata.processInput(); } //added stepper sequence to firmata code digitalWrite(XstepPin,HIGH); //take steps delayMicroseconds(2); digitalWrite(XstepPin,LOW); delayMicroseconds(2); delayMicroseconds(1000); // <<<<<< USE TO CHANGE STEPPER SPEED <<<<<<<< } //////////////////////////////////Processing///////////////////////////////// /** * Simple Write. < modified to control stepper direction * * Check if the mouse is over a rectangle and writes the status to the serial port. * This example works with the Wiring / Arduino program that follows below. */ import processing.serial.*; import cc.arduino.*; Arduino arduino; //Serial myPort; // Create object from Serial class // Data received from the serial port int ledPin = 13; // pin for LED int XdirPin = 7; // pin for stepper X direction int XstepPin = 10; //pin for X step void setup() { size(200, 200); // I know that the first port in the serial list on my mac // is always my FTDI adaptor, so I open Serial.list()[0]. // On Windows machines, this generally opens COM1. // Open whatever port is the one you're using. // String portName = Serial.list()[0]; //myPort = new Serial(this, portName, 9600); arduino = new Arduino(this, Arduino.list()[0], 57600); // v1 arduino.pinMode(ledPin, Arduino.OUTPUT); arduino.pinMode(XdirPin, Arduino.OUTPUT); } void draw() { background(255); if (mouseOverRect() == true) { // If mouse is over square, fill(204); // change color and arduino.digitalWrite(ledPin, Arduino.HIGH); // LED on arduino.digitalWrite(XdirPin, Arduino.HIGH); // Stepper direction this way } else { // If mouse is not over square, fill(0); // change color and arduino.digitalWrite(ledPin, Arduino.LOW); // LED off arduino.digitalWrite(XdirPin, Arduino.LOW); //Stepper direction the other way } rect(50, 50, 100, 100); } boolean mouseOverRect() { // Test if mouse is over square return ((mouseX >= 50) && (mouseX <= 150) && (mouseY >= 50) && (mouseY <= 150)); } // Draw a square http://www.instructables.com/id/Arduino-Projects/ Step 11: Correction to firmata.... It looks like something is wrong in step 10, which is making it so the stepper motor doesn't run. The code below works - but doesn't have as many comments. //////////////////////////Arduino////////////////////////// // Wiring/Arduino code:// simmple digital firmata //Supports as many digital inputs and outputs as possible. //This example code is in the public domain. #include <Firmata.h> #define XstepPin 10 #define XdirPin 7 #define YstepPin 2 #define YdirPin 3 byte previousPIN[2]; // PIN means PORT for input byte previousPORT[2]; void outputPort(byte portNumber, byte portValue) { // only send the data when it changes, otherwise you get too many messages! if(previousPIN[portNumber] != portValue) { Firmata.sendDigitalPort(portNumber, portValue); previousPIN[portNumber] = portValue; Firmata.sendDigitalPort(portNumber, portValue); } } void setPinModeCallback(byte pin, int mode) { if(pin > 1) { // don't touch RxTx pins (0,1) pinMode(pin, mode); } } void digitalWriteCallback(byte port, int value) { byte i; byte currentPinValue, previousPinValue; if(value != previousPORT[port]) { for(i=0; i<8; i++) { currentPinValue = (byte) value & (1 << i); previousPinValue = previousPORT[port] & (1 << i); if(currentPinValue != previousPinValue) { digitalWrite(i + (port*8), currentPinValue); } } previousPORT[port] = value; } } void setup() { Firmata.setFirmwareVersion(0, 1); Firmata.attach(DIGITAL_MESSAGE, digitalWriteCallback); Firmata.attach(SET_PIN_MODE, setPinModeCallback); Firmata.begin(57600); } void loop() { outputPort(0, PIND &~ B00000011); // pins 0-7, ignoring Rx/Tx pins (0/1) outputPort(1, PINB); // pins 8-13 while(Firmata.available()) { Firmata.processInput(); } //added stepper sequence to firmata code digitalWrite(XstepPin,HIGH); //take steps digitalWrite(YstepPin,HIGH); delayMicroseconds(2); digitalWrite(XstepPin,LOW); digitalWrite(YstepPin,LOW); delayMicroseconds(2); delayMicroseconds(1000); // <<<<<< USE TO CHANGE STEPPER SPEED???? <<<<<<<< } http://www.instructables.com/id/Arduino-Projects/ /////////////////////////////PROCESSING////////////////////////////////////// /** * Simple Write. * * Check if the mouse is over a rectangle and writes the status to the serial port. * This example works with the Wiring / Arduino program that follows below. */ import processing.serial.*; import cc.arduino.*; Arduino arduino; //Serial myPort; // Create object from Serial class // Data received from the serial port int ledPin = 13; int XstepPin = 10; int XdirPin = 7; void setup() { size(200, 200); // I know that the first port in the serial list on my mac // is always my FTDI adaptor, so I open Serial.list()[0]. // On Windows machines, this generally opens COM1. // Open whatever port is the one you're using. // String portName = Serial.list()[0]; //myPort = new Serial(this, portName, 9600); arduino = new Arduino(this, Arduino.list()[0], 57600); // v1 arduino.pinMode(ledPin, Arduino.OUTPUT); arduino.pinMode(XstepPin, Arduino.OUTPUT); arduino.pinMode(XdirPin, Arduino.OUTPUT); } void draw() { background(255); if (mouseOverRect() == true) { // If mouse is over square, fill(204); // change color and arduino.digitalWrite(ledPin, Arduino.HIGH); // send an H to indicate mouse is over square arduino.digitalWrite(XdirPin, Arduino.HIGH); //arduino.digitalWrite(XstepPin, Arduino.HIGH); //delay(1); //arduino.digitalWrite(XstepPin, Arduino.LOW); //delay(1); } else { // If mouse is not over square, fill(0); // change color and arduino.digitalWrite(ledPin, Arduino.LOW); // send an L otherwise arduino.digitalWrite(XdirPin, Arduino.LOW); //arduino.digitalWrite(XstepPin, Arduino.HIGH); //delay(1); //arduino.digitalWrite(XstepPin,Arduino.LOW); //delay(1); } rect(50, 50, 100, 100); } boolean mouseOverRect() { // Test if mouse is over square return ((mouseX >= 50) && (mouseX <= 150) && (mouseY >= 50) && (mouseY <= 150)); } // Draw a square Step 12: Corrected and commented Here is a third pass at the Firmata code. This should work and includes comments. ///////////////// ARDUINO ////////////////////// /* Supports as many digital inputs and outputs as possible. *<modified to drive a stepper motor * This example code is in the public domain. */ #include <Firmata.h> #define XstepPin 10 #define XdirPin 7 //Step pin //Direction pin http://www.instructables.com/id/Arduino-Projects/ byte previousPIN[2]; // PIN means PORT for input byte previousPORT[2]; void outputPort(byte portNumber, byte portValue) { // only send the data when it changes, otherwise you get too many messages! if(previousPIN[portNumber] != portValue) { Firmata.sendDigitalPort(portNumber, portValue); previousPIN[portNumber] = portValue; Firmata.sendDigitalPort(portNumber, portValue); } } void setPinModeCallback(byte pin, int mode) { if(pin > 1) { // don't touch RxTx pins (0,1) pinMode(pin, mode); } } void digitalWriteCallback(byte port, int value) { byte i; byte currentPinValue, previousPinValue; if(value != previousPORT[port]) { for(i=0; i<8; i++) { currentPinValue = (byte) value & (1 << i); previousPinValue = previousPORT[port] & (1 << i); if(currentPinValue != previousPinValue) { digitalWrite(i + (port*8), currentPinValue); } } previousPORT[port] = value; } } void setup() { Firmata.setFirmwareVersion(0, 1); Firmata.attach(DIGITAL_MESSAGE, digitalWriteCallback); Firmata.attach(SET_PIN_MODE, setPinModeCallback); Firmata.begin(57600); } void loop() { outputPort(0, PIND &~ B00000011); // pins 0-7, ignoring Rx/Tx pins (0/1) outputPort(1, PINB); // pins 8-13 while(Firmata.available()) { Firmata.processInput(); } //added stepper sequence to firmata code //digitalWrite(XdirPin,HIGH); digitalWrite(XstepPin,HIGH); //take steps delayMicroseconds(2); digitalWrite(XstepPin,LOW); delayMicroseconds(2); delayMicroseconds(1000); // <<<<<< USE TO CHANGE STEPPER SPEED <<<<<<<< } //////////////////////PROCESSING/////////////////////////////////// // // Simple Write. < modified to control stepper direction // //Check if the mouse is over a rectangle and writes the status to the serial port. //This example works with the Wiring / Arduino program that follows below. // import processing.serial.*; import cc.arduino.*; Arduino arduino; //Serial myPort; // Create object from Serial class // Data received from the serial port int ledPin = 13; // pin for LED int XdirPin = 7; // pin for stepper X direction int XstepPin = 10; http://www.instructables.com/id/Arduino-Projects/ void setup() { size(200, 200); // I know that the first port in the serial list on my mac // is always my FTDI adaptor, so I open Serial.list()[0]. // On Windows machines, this generally opens COM1. // Open whatever port is the one you're using. // String portName = Serial.list()[0]; //myPort = new Serial(this, portName, 9600); arduino = new Arduino(this, Arduino.list()[0], 57600); // v1 arduino.pinMode(ledPin, Arduino.OUTPUT); arduino.pinMode(XdirPin, Arduino.OUTPUT); } void draw() { background(255); if (mouseOverRect() == true) { // If mouse is over square, fill(204); // change color and arduino.digitalWrite(ledPin, Arduino.HIGH); // LED on arduino.digitalWrite(XdirPin, Arduino.HIGH); // Stepper direction this way } else { // If mouse is not over square, fill(0); // change color and arduino.digitalWrite(ledPin, Arduino.LOW); // LED off arduino.digitalWrite(XdirPin, Arduino.LOW); //Stepper direction the other way } rect(50, 50, 100, 100); } boolean mouseOverRect() { // Test if mouse is over square return ((mouseX >= 50) && (mouseX <= 150) && (mouseY >= 50) && (mouseY <= 150)); } // Draw a square Step 13: Follow the Bouncing Ball with Firmata! (this works good) http://www.youtube.com/watch?v=VYgbStFaQbM Now I've taken the bouncing ball sketch and combined it with the Firmata one. Now the stepper motors smoothly follow the path of the bouncing ball!! Now we are getting somewhere! //////////////////////////Arduino////////////////////////// // Wiring/Arduino code:// simmple digital firmata //Supports as many digital inputs and outputs as possible. //This example code is in the public domain. #include <Firmata.h> #define XstepPin 10 #define XdirPin 7 #define YstepPin 2 #define YdirPin 3 byte previousPIN[2]; // PIN means PORT for input byte previousPORT[2]; http://www.instructables.com/id/Arduino-Projects/ void outputPort(byte portNumber, byte portValue) { // only send the data when it changes, otherwise you get too many messages! if(previousPIN[portNumber] != portValue) { Firmata.sendDigitalPort(portNumber, portValue); previousPIN[portNumber] = portValue; Firmata.sendDigitalPort(portNumber, portValue); } } void setPinModeCallback(byte pin, int mode) { if(pin > 1) { // don't touch RxTx pins (0,1) pinMode(pin, mode); } } void digitalWriteCallback(byte port, int value) { byte i; byte currentPinValue, previousPinValue; if(value != previousPORT[port]) { for(i=0; i<8; i++) { currentPinValue = (byte) value & (1 << i); previousPinValue = previousPORT[port] & (1 << i); if(currentPinValue != previousPinValue) { digitalWrite(i + (port*8), currentPinValue); } } previousPORT[port] = value; } } void setup() { Firmata.setFirmwareVersion(0, 1); Firmata.attach(DIGITAL_MESSAGE, digitalWriteCallback); Firmata.attach(SET_PIN_MODE, setPinModeCallback); Firmata.begin(57600); } void loop() { outputPort(0, PIND &~ B00000011); // pins 0-7, ignoring Rx/Tx pins (0/1) outputPort(1, PINB); // pins 8-13 while(Firmata.available()) { Firmata.processInput(); } //added stepper sequence to firmata code digitalWrite(XstepPin,HIGH); //take steps digitalWrite(YstepPin,HIGH); delayMicroseconds(2); digitalWrite(XstepPin,LOW); digitalWrite(YstepPin,LOW); delayMicroseconds(2); delayMicroseconds(1000); // <<<<<< USE TO CHANGE STEPPER SPEED???? <<<<<<<< } ///////////////////PROCESSING////////////////////////////// /** * Simple Write. * * Check if the mouse is over a rectangle and writes the status to the serial port. * This example works with the Wiring / Arduino program that follows below. */ import processing.serial.*; import cc.arduino.*; Arduino arduino; //Serial myPort; // Create object from Serial class // Data received from the serial port int ledPin = 13; int XstepPin = 10; int XdirPin = 7; int YstepPin = 2; int YdirPin = 3; http://www.instructables.com/id/Arduino-Projects/ //parameters for the ball float x= 50.0; float y = 50.0; float speedX = 1.0; float speedY= .4; float radius = 15.0; int directionX = 1; int directionY = 1; void setup() { //setup the drawing size(100, 100); smooth(); noStroke(); ellipseMode(RADIUS); //setup communication with Arduino arduino = new Arduino(this, Arduino.list()[0], 57600); // v1 arduino.pinMode(ledPin, Arduino.OUTPUT); arduino.pinMode(XstepPin, Arduino.OUTPUT); arduino.pinMode(XdirPin, Arduino.OUTPUT); arduino.pinMode(YstepPin, Arduino.OUTPUT); arduino.pinMode(YdirPin, Arduino.OUTPUT); } void draw() { fill(0,12); rect(0,0,width, height); fill(255); ellipse(x, y, radius, radius); x += speedX * directionX; if((x>width-radius) || (x < radius)) { //change X direction if the ball hits the side of the box directionX = -directionX; } y += speedY * directionY; if((y>height-radius) || (y < radius)) { //change Y direction if the ball hits the side of the box directionY = -directionY; } if (directionX >= 0){ arduino.digitalWrite(ledPin, Arduino.HIGH); arduino.digitalWrite(XdirPin, Arduino.HIGH); } else{ arduino.digitalWrite(ledPin, Arduino.LOW); arduino.digitalWrite(XdirPin, Arduino.LOW); } if (directionY >= 0){ //arduino.digitalWrite(ledPin, Arduino.HIGH); arduino.digitalWrite(YdirPin, Arduino.HIGH); } else{ //arduino.digitalWrite(ledPin, Arduino.LOW); arduino.digitalWrite(YdirPin, Arduino.LOW); } } Step 14: Working towards a 3D print The RepRap builds up 3D objects with melted plastic. Each layer is laid down as a plastic mesh. There is softwar/firmware availalbe to generate this mesh for any 3D object. But I am interested in making a program that will print the shapes directly from Processing. I'm starting by modifiying the bouncing ball sketch to draw a mesh that will cover a 2D shape. The next step will be to rotated the mesh 90deg and repeat (to print the next layer). Here is what I have so far - this is only in Processing and does not include any communitation with the Arduino. ///////////////////Processing///////////// /** *ball traces back and forth across the window */ int size = 10; // Width of the shape float xpos, ypos; // Starting position of shape float xspeed = 3; // Speed of the shape http://www.instructables.com/id/Arduino-Projects/ float yspeed = 0;// Speed of the shape int xdirection = 1; // Left or Right int ydirection = 1; // Top to Bottom void setup() { size(200, 200); noStroke(); frameRate(30); smooth(); // Set the starting position of the shape xpos = 0; ypos = 0; background(102); } void draw() { //background(102); // Update the position of the shape xpos = xpos + ( xspeed * xdirection ); ypos = ypos + ( yspeed * ydirection ); // change direction when the ball hits the edge - to draw a square //starts at left and moves towards right //move down 10 steps if (xpos > width-size && ypos== 0) { //down ydirection=1; yspeed =2; xspeed=0; } //reverse X direction until it hits the 0X edge if(xpos>width-size && ypos ==20){ xdirection = -1; yspeed = 0; xspeed =2; } //move down 10 steps if (xpos < 0 && ypos ==20) { //down ydirection=1; yspeed =2; xspeed=0; } //reverse X direction until it hiths the 200X edge if(xpos < 0 && ypos ==40){ xdirection = 1; yspeed = 0; xspeed =2; } //move down 10 steps if (xpos > width-size && ypos ==40) { //down ydirection=1; yspeed =2; xspeed=0; } //reverse X direction until it hits the 0X edge if(xpos>width-size && ypos ==60){ xdirection = -1; yspeed = 0; xspeed =2; } //move down 10 steps if (xpos < 0 && ypos ==60) { //down ydirection=1; yspeed =2; xspeed=0; } //reverse X direction until it hits the 200X edge if(xpos < 0 && ypos ==80){ xdirection = 1; yspeed = 0; xspeed =2; } http://www.instructables.com/id/Arduino-Projects/ //move down 10 steps if (xpos > width-size && ypos ==80) { //down ydirection=1; yspeed =2; xspeed=0; } //reverse X direction until it hits the 0X edge if(xpos>width-size && ypos ==100){ xdirection = -1; yspeed = 0; xspeed =2; } //move down 10 steps if (xpos < 0 && ypos ==100) { //down ydirection=1; yspeed =2; xspeed=0; } //reverse X direction until it hiths the 200X edge if (xpos < 0 && ypos ==120) { //down xdirection=1; yspeed =0; xspeed=2; } //move down 10 steps if (xpos > width-size && ypos ==120) { ydirection=1; yspeed =2; xspeed=0; } //reverse direction until it hits teh 0X edge if (xpos > width-size && ypos ==140) { xdirection=-1; yspeed =0; xspeed=2; } //move down 10 steps if (xpos < 0 && ypos ==140) { //down ydirection=1; yspeed =2; xspeed=0; } //reverse X direction until it hiths the 200X edge if (xpos < 0 && ypos ==160) { //down xdirection=1; yspeed =0; xspeed=2; } //move down 10 steps if (xpos > width-size && ypos ==160) { ydirection=1; yspeed =2; xspeed=0; } //reverse direction until it hits teh 200X edge if (xpos > width-size && ypos ==180) { xdirection=-1; yspeed =0; xspeed=2; } //move down 10 steps if (xpos > 0 && ypos ==180) { ydirection=1; yspeed =2; xspeed=0; } //reverse direction until it hits teh 200x edge if (xpos > 0 && ypos ==200) { xdirection=1; yspeed =0; xspeed=2; } // Draw the shape ellipse(xpos+size/2, ypos+size/2, size, size); } http://www.instructables.com/id/Arduino-Projects/ Step 15: Working towards a 3D print .... The code is step 14 needs to be tweaked a bit in order to the stepper motors. The main change that whenever the balls speed is zero - the corresponding stepper needs to be disabled. Here is the processing code. This only runs one layer, many layers need to be stacked to make a 3D print. ///////////////////Processing///////////// /** *ball traces back and forth across the window in a mesh that will be useful for plastic printing */ import processing.serial.*; import cc.arduino.*; Arduino arduino; int ledPin = 13; int XstepPin = 2; int XdirPin = 3; int XenablePin = 4; int YstepPin = 7; int YdirPin = 10; int YenablePin = 8; int size = 10; // Width of the shape float xpos, ypos; // Starting position of shape float xspeed = 3; // Speed of the shape float yspeed = 0;// Speed of the shape int directionX = 1; // Left or Right int directionY = 1; // Top to Bottom void setup() { size(200, 200); noStroke(); frameRate(30); smooth(); // Set the starting position of the shape xpos = 0; ypos = 0; background(102); //setup communication with Arduino arduino = new Arduino(this, Arduino.list()[0], 57600); // v1 arduino.pinMode(XstepPin, Arduino.OUTPUT); arduino.pinMode(XdirPin, Arduino.OUTPUT); arduino.pinMode(YstepPin, Arduino.OUTPUT); arduino.pinMode(YdirPin, Arduino.OUTPUT); arduino.pinMode(EstepPin, Arduino.OUTPUT); arduino.pinMode(EdirPin, Arduino.OUTPUT); arduino.pinMode(EenablePin, Arduino.OUTPUT); http://www.instructables.com/id/Arduino-Projects/ } void draw() { //background(102); // Update the position of the shape xpos = xpos + ( xspeed * directionX ); ypos = ypos + ( yspeed * directionY ); // change direction when the ball hits the edge - to draw a square //starts at left and moves towards right //move down 10 steps if (xpos > width-size && ypos== 0) { //down directionY=1; yspeed =2; xspeed=0; } //reverse X direction until it hits the 0X edge if(xpos>width-size && ypos ==20){ directionX = -1; yspeed = 0; xspeed =2; } //move down 10 steps if (xpos < 0 && ypos ==20) { //down directionY=1; yspeed =2; xspeed=0; } //reverse X direction until it hiths the 200X edge if(xpos < 0 && ypos ==40){ directionX = 1; yspeed = 0; xspeed =2; } //move down 10 steps if (xpos > width-size && ypos ==40) { //down directionY=1; yspeed =2; xspeed=0; } //reverse X direction until it hits the 0X edge if(xpos>width-size && ypos ==60){ directionX = -1; yspeed = 0; xspeed =2; } //move down 10 steps if (xpos < 0 && ypos ==60) { //down directionY=1; yspeed =2; xspeed=0; } //reverse X direction until it hits the 200X edge if(xpos < 0 && ypos ==80){ directionX = 1; yspeed = 0; xspeed =2; } //move down 10 steps if (xpos > width-size && ypos ==80) { //down directionY=1; yspeed =2; xspeed=0; } //reverse X direction until it hits the 0X edge if(xpos>width-size && ypos ==100){ directionX = -1; yspeed = 0; xspeed =2; } //move down 10 steps if (xpos < 0 && ypos ==100) { //down http://www.instructables.com/id/Arduino-Projects/ directionY=1; yspeed =2; xspeed=0; } //reverse X direction until it hiths the 200X edge if (xpos < 0 && ypos ==120) { //down directionX=1; yspeed =0; xspeed=2; } //move down 10 steps if (xpos > width-size && ypos ==120) { directionY=1; yspeed =2; xspeed=0; } //reverse direction until it hits teh 0X edge if (xpos > width-size && ypos ==140) { directionX=-1; yspeed =0; xspeed=2; } //move down 10 steps if (xpos < 0 && ypos ==140) { //down directionY=1; yspeed =2; xspeed=0; } //reverse X direction until it hiths the 200X edge if (xpos < 0 && ypos ==160) { //down directionX=1; yspeed =0; xspeed=2; } //move down 10 steps if (xpos > width-size && ypos ==160) { directionY=1; yspeed =2; xspeed=0; } //reverse direction until it hits teh 200X edge if (xpos > width-size && ypos ==180) { directionX=-1; yspeed =0; xspeed=2; } //move down 10 steps if (xpos > 0 && ypos ==180) { directionY=1; yspeed =2; xspeed=0; } //reverse direction until it hits teh 200x edge if (xpos > 0 && ypos ==200) { directionX=1; yspeed =0; xspeed=2; } //TELL ARDUINO WHICH WAY TO SEND MOTORS if (directionX >= 0){ arduino.digitalWrite(ledPin, Arduino.HIGH); arduino.digitalWrite(XdirPin, Arduino.HIGH); } else{ arduino.digitalWrite(ledPin, Arduino.LOW); arduino.digitalWrite(XdirPin, Arduino.LOW); } if (directionY >= 0){ //arduino.digitalWrite(ledPin, Arduino.HIGH); arduino.digitalWrite(YdirPin, Arduino.HIGH); } else{ //arduino.digitalWrite(ledPin, Arduino.LOW); arduino.digitalWrite(YdirPin, Arduino.LOW); } if (xspeed == 0) { arduino.digitalWrite(XenablePin, Arduino.HIGH); } http://www.instructables.com/id/Arduino-Projects/ else{ arduino.digitalWrite(XenablePin, Arduino.LOW); } if (yspeed == 0) { arduino.digitalWrite(YenablePin, Arduino.HIGH); } else{ arduino.digitalWrite(YenablePin, Arduino.LOW); } // Draw the shape ellipse(xpos+size/2, ypos+size/2, size, size); } Step 16: Pinch Wheel Extruder If have looked at the reprap.org site, you'll notice that the plastic extruder is very important to making a 3D print. They've come up with a nice looking "pinch wheel" extruder. I've built one based on the discriptions here (http://builders.reprap.org/search?q=pinch+wheel ). This includes a stepper motor. I am driving it with an "EasyDriver" I bought from SparkFun. It is EasyDriver V4 co-designed with Brian Schmalz. It has breakouts for microstepping and does not get too hot. http://www.sparkfun.com/commerce/product_info.php?products_id=9402. Here are some images of the extruder. If anyone is intersted I can post a template for the layout. http://www.instructables.com/id/Arduino-Projects/ Step 17: Extruder temp control and code Description: To get a usable stream of melted plastic out of the extruder, the tempurature has to be hot enough to melt the plastic, but not so hot that it starts to smoke and burn. You also only want to drive the stock material while the temp is within this range. Arduino code (this is just a modifed version of some RepRap code). This allows you to set a temperature range and then only runs the extruder motor when the heater within range. As shown below, the Raw tempurate reading is used. Actual temp can also be used. //////////////////Arduino Code/////////////////// //this example keeps temp above melting point of HDPE - but not too hot //turns off stepper if temp is too low [NOTE: using EasyDriver board, pull enable pin HIGH to turn off //turn heat off if too hot //turn heat way up if too cold http://www.instructables.com/id/Arduino-Projects/ //turn heat to medium if //webpage http://dev.www.reprap.org/bin/view/Main/Temperature_Sensor_1_1 // Thermistor lookup table for RepRap Temperature Sensor Boards (http://make.rrrf.org/ts) // Made with createTemperatureLookup.py (http://svn.reprap.org/trunk/reprap/firmware/Arduino/utilities/createTemperatureLookup.py) // ./createTemperatureLookup.py --r0=100000 --t0=25 --r1=0 --r2=4700 --beta=4066 --max-adc=1023 #define THERMISTOR_PIN 0 #define heatPin 11 //heat level #define EstepPin 5 //set extruder stepper to pin12 #define EdirPin 6 //set step direction to stepper pin11 #define EenablePin 12 // byte lowTemp = 245; // >>> if below lowTemp then extruder is disabled - degF byte minTemp = 245; //>>>> SET MIN TEMP HERE >>>>>> - degF byte maxTemp = 250; //>>>> SET MAX TEMP HERE >>>>>> - degF byte maxRaw = 125; byte minRaw = 130; byte cool = 0; // heater off byte warm = 255; //medium heat byte hot = 255; //heat up pretty high >> max would be 255, but I don't want to burn out the heater // r0: 100000 // t0: 25 // r1: 0 // r2: 4700 // beta: 4066 // max adc: 1023 #define NUMTEMPS 20 short temptable[NUMTEMPS][2] = { {1, 841}, {54, 255}, {107, 209}, {160, 184}, {213, 166}, {266, 153}, {319, 142}, {372, 132}, {425, 124}, {478, 116}, {531, 108}, {584, 101}, {637, 93}, {690, 86}, {743, 78}, {796, 70}, {849, 61}, {902, 50}, {955, 34}, {1008, 3} }; void setup() { Serial.begin(9600); Serial.println("Starting temperature exerciser."); pinMode(heatPin, OUTPUT); pinMode(EstepPin, OUTPUT); pinMode(EdirPin, OUTPUT); pinMode(EenablePin, OUTPUT); } void loop() { int rawvalue = analogRead(THERMISTOR_PIN); int celsius = read_temp(); int fahrenheit = (((celsius * 9) / 5) + 32); Serial.print("Current temp: "); Serial.print(celsius); Serial.print("C / "); Serial.print(fahrenheit); Serial.println("F"); Serial.print("Raw value: "); Serial.println(rawvalue); Serial.println(" "); // //control the extruder heater and stepper motor based on the temperature http://www.instructables.com/id/Arduino-Projects/ // if (rawvalue >= minRaw){ //if temp too low - turn stepper off analogWrite(heatPin, hot); //if temp too low- turn heat to max digitalWrite(EenablePin,HIGH); //if temp too low - turn off the stepper //??? Stop everything if temp too low ??? } // if((fahrenheit >=lowTemp) && (fahrenheit <=minTemp)){ // if temp below range- LED slow blink // analogWrite(heatPin, hot); //if temp below range - turn extruder up to max // digitalWrite(EenablePin,LOW); //if hot enough then turn on stepper // } // if ((fahrenheit >= minTemp) && (fahrenheit <=maxTemp)){ //if temp in range - LED ON // analogWrite(heatPin, warm); //if temp is in range - keep extruder warm // digitalWrite(EenablePin,LOW); //if hot enough then turn on stepper // } if ((rawvalue <= minRaw)){ //if temp in range - LED ON analogWrite(heatPin, warm); //if temp is in range - keep extruder warm digitalWrite(EenablePin,LOW); //if hot enough then turn on stepper } if(rawvalue <=maxRaw){ //if temp above range -LED fast blink analogWrite(heatPin, cool); //if temp too high - turn heater off digitalWrite(EenablePin,LOW); //if hot enough then turn on stepper } //run extruder stepper motor digitalWrite(EdirPin,LOW); digitalWrite(EstepPin,HIGH); delayMicroseconds(2); digitalWrite(EstepPin,LOW); delay(15); // delay(1000); } int read_temp() { int rawtemp = analogRead(THERMISTOR_PIN); int current_celsius = 0; byte i; for (i=1; i if (temptable[i][0] > rawtemp) { int realtemp = temptable[i-1][1] + (rawtemp - temptable[i-1][0]) * (temptable[i][1] - temptable[i-1][1]) / (temptable[i][0] - temptable[i-1][0]); if (realtemp > 255) realtemp = 255; current_celsius = realtemp; break; } } // Overflow: We just clamp to 0 degrees celsius if (i == NUMTEMPS) current_celsius = 0; return current_celsius; } http://www.instructables.com/id/Arduino-Projects/ Step 18: Second round of extruder code Here is a second pass at the extruder code - If the first doesn't work, then try this. ///////////// Arduino Only/////////////////////// //////////////////Arduino Code/////////////////// //this example keeps temp above melting point of HDPE - but not too hot //turns off stepper if temp is too low [NOTE: using EasyDriver board, pull enable pin HIGH to turn off //turn heat off if too hot //turn heat way up if too cold //turn heat to medium if //webpage http://dev.www.reprap.org/bin/view/Main/Temperature_Sensor_1_1 // Thermistor lookup table for RepRap Temperature Sensor Boards (http://make.rrrf.org/ts) // Made with createTemperatureLookup.py (http://svn.reprap.org/trunk/reprap/firmware/Arduino/utilities/createTemperatureLookup.py) // ./createTemperatureLookup.py --r0=100000 --t0=25 --r1=0 --r2=4700 --beta=4066 --max-adc=1023 #define THERMISTOR_PIN 0 #define heatPin 11 //heat level #define EstepPin 5 //set extruder stepper to pin12 #define EdirPin 6 //set step direction to stepper pin11 #define EenablePin 12 // byte lowTemp = 175; // >>> if below lowTemp then extruder is disabled - degF byte minTemp = 180; //>>>> SET MIN TEMP HERE >>>>>> - degF byte maxTemp = 185; //>>>> SET MAX TEMP HERE >>>>>> - degF byte maxRaw = 110; byte minRaw = 120; byte cool = 0; // heater off byte warm = 255; //medium heat byte hot = 255; //heat up pretty high >> max would be 255, but I don't want to burn out the heater // r0: 100000 http://www.instructables.com/id/Arduino-Projects/ // t0: 25 // r1: 0 // r2: 4700 // beta: 4066 // max adc: 1023 #define NUMTEMPS 20 short temptable[NUMTEMPS][2] = { {1, 841}, {54, 255}, {107, 209}, {160, 184}, {213, 166}, {266, 153}, {319, 142}, {372, 132}, {425, 124}, {478, 116}, {531, 108}, {584, 101}, {637, 93}, {690, 86}, {743, 78}, {796, 70}, {849, 61}, {902, 50}, {955, 34}, {1008, 3} }; void setup() { Serial.begin(9600); Serial.println("Starting temperature exerciser."); pinMode(heatPin, OUTPUT); pinMode(EstepPin, OUTPUT); pinMode(EdirPin, OUTPUT); pinMode(EenablePin, OUTPUT); } void loop() { int rawvalue = analogRead(THERMISTOR_PIN); int celsius = read_temp(); int fahrenheit = (((celsius * 9) / 5) + 32); Serial.print("Current temp: "); Serial.print(celsius); Serial.print("C / "); Serial.print(fahrenheit); Serial.println("F"); Serial.print("Raw value: "); Serial.println(rawvalue); Serial.println(" "); // //control the extruder heater and stepper motor based on the temperature // if (rawvalue >= minRaw){ //if temp too low - turn stepper off analogWrite(heatPin, hot); //if temp too low- turn heat to max digitalWrite(EenablePin,HIGH); //if temp too low - turn off the stepper //??? Stop everything if temp too low ??? } // if((fahrenheit >=lowTemp) && (fahrenheit <=minTemp)){ // if temp below range- LED slow blink // analogWrite(heatPin, hot); //if temp below range - turn extruder up to max // digitalWrite(EenablePin,LOW); //if hot enough then turn on stepper // } // if ((fahrenheit >= minTemp) && (fahrenheit <=maxTemp)){ //if temp in range - LED ON // analogWrite(heatPin, warm); //if temp is in range - keep extruder warm // digitalWrite(EenablePin,LOW); //if hot enough then turn on stepper // } if ((rawvalue <= minRaw)){ //if temp in range - LED ON analogWrite(heatPin, warm); //if temp is in range - keep extruder warm digitalWrite(EenablePin,LOW); //if hot enough then turn on stepper } if(rawvalue<=maxRaw){ //if temp above range -LED fast blink analogWrite(heatPin, cool); //if temp too high - turn heater off digitalWrite(EenablePin,LOW); //if hot enough then turn on stepper } //run extruder stepper motor http://www.instructables.com/id/Arduino-Projects/ digitalWrite(EdirPin,LOW); digitalWrite(EstepPin,HIGH); delayMicroseconds(2); digitalWrite(EstepPin,LOW); delay(1); // delay(1000); } int read_temp() { int rawtemp = analogRead(THERMISTOR_PIN); int current_celsius = 0; byte i; for (i=1; i <NUMTEMPS; i++) { if (temptable[i][0] > rawtemp) { int realtemp = temptable[i-1][1] + (rawtemp - temptable[i-1][0]) * (temptable[i][1] - temptable[i-1][1]) / (temptable[i][0] - temptable[i-1][0]); if (realtemp > 255) realtemp = 255; current_celsius = realtemp; break; } } // Overflow: We just clamp to 0 degrees celsius if (i == NUMTEMPS) current_celsius = 0; return current_celsius; } Step 19: Third Round of Extruder Code! This bit of extruder conrol is working well with polylactic acid (PLA). You can by some here if you are intersted: https://ultimachine.com/ //////////////////Arduino Code/////////////////// // /* EXTRUDER CONTROL WHAT IT DOES: -REGULATE TEMP VIA PWM -RUN STEPPER MOTOR OF PINCH WHEEL EXTRUDER WHEN IT IS WITHIN PROPER TEMP RANGE -RUNNING STEPPER FROM EASYDRIVER BOARD */ //Turns off stepper if temp is too low [NOTE: using EasyDriver board, pull enable pin HIGH to turn off //turn heat off if too hot //turn heat way up if too cold //turn heat to medium if //THIS IS BASED ON CODE AND DESIGNS FROM //webpage http://dev.www.reprap.org/bin/view/Main/Temperature_Sensor_1_1 // Thermistor lookup table for RepRap Temperature Sensor Boards (http://make.rrrf.org/ts) // Made with createTemperatureLookup.py (http://svn.reprap.org/trunk/reprap/firmware/Arduino/utilities/createTemperatureLookup.py) // ./createTemperatureLookup.py --r0=100000 --t0=25 --r1=0 --r2=4700 --beta=4066 --max-adc=1023 #define THERMISTOR_PIN 0 #define heatPin 11 //heat level #define EstepPin 5 //set extruder stepper to pin12 #define EdirPin 6 //set step direction to stepper pin11 #define EenablePin 12 // #define LED 13 byte lowTemp = 95; // >>> if below lowTemp then extruder is disabled - degF byte minTemp = 100; //>>>> SET MIN TEMP HERE >>>>>> - degF byte maxTemp = 105; //>>>> SET MAX TEMP HERE >>>>>> - degF //byte maxRaw = 690; //byte minRaw = 700; byte cool = 0; // heater off byte warm = 255; //medium heat byte hot = 255; //heat up pretty high >> max would be 255, but I don't want to burn out the heater http://www.instructables.com/id/Arduino-Projects/ // r0: 100000 // t0: 25 // r1: 0 // r2: 4700 // beta: 4066 // max adc: 1023 #define NUMTEMPS 20 short temptable[NUMTEMPS][2] = { {1, 841}, {54, 255}, {107, 209}, {160, 184}, {213, 166}, {266, 153}, {319, 142}, {372, 132}, {425, 124}, {478, 116}, {531, 108}, {584, 101}, {637, 93}, {690, 86}, {743, 78}, {796, 70}, {849, 61}, {902, 50}, {955, 34}, {1008, 3} }; void setup() { Serial.begin(9600); Serial.println("Starting temperature exerciser."); pinMode(heatPin, OUTPUT); pinMode(EstepPin, OUTPUT); pinMode(EdirPin, OUTPUT); pinMode(EenablePin, OUTPUT); } void loop() { int rawvalue = analogRead(THERMISTOR_PIN); int celsius = read_temp(); int fahrenheit = (((celsius * 9) / 5) + 32); Serial.print("Current temp: "); Serial.print(celsius); Serial.print("C / "); Serial.print(fahrenheit); Serial.println("F"); Serial.print("Raw value: "); Serial.println(rawvalue); Serial.println(" "); // //control the extruder heater and stepper motor based on the temperature // if (celsius <= minTemp){ //if temp too low - turn stepper off analogWrite(heatPin, hot); //if temp too low- turn heat to max digitalWrite(EenablePin,HIGH); //if temp too low - turn off the stepper digitalWrite(LED,HIGH); //??? Stop everything if temp too low ??? } if((celsius >=lowTemp) && (celsius <=minTemp)){ // if temp below range- LED slow blink analogWrite(heatPin, hot); //if temp below range - turn extruder up to max digitalWrite(EenablePin,LOW); //if hot enough then turn on stepper } if ((celsius >= minTemp) && (celsius<=maxTemp)){ //if temp in range - LED ON analogWrite(heatPin, warm); //if temp is in range - keep extruder warm digitalWrite(EenablePin,LOW); //if hot enough then turn on stepper } //run extruder stepper motor digitalWrite(EdirPin,LOW); digitalWrite(EstepPin,HIGH); delayMicroseconds(2); digitalWrite(EstepPin,LOW); delay(1); http://www.instructables.com/id/Arduino-Projects/ // delay(1000); } int read_temp() { int rawtemp = analogRead(THERMISTOR_PIN); int current_celsius = 0; byte i; for (i=1; i if (temptable[i][0] > rawtemp) { int realtemp = temptable[i-1][1] + (rawtemp - temptable[i-1][0]) * (temptable[i][1] - temptable[i-1][1]) / (temptable[i][0] - temptable[i-1][0]); if (realtemp > 255) realtemp = 255; current_celsius = realtemp; break; } } // Overflow: We just clamp to 0 degrees celsius if (i == NUMTEMPS) current_celsius = 0; return current_celsius; } Step 20: 3D Bouncing Ball - Processing Here is some Processing code that shows a ball bouncing around in a 3D cube. This is useful because it contains information for the X,Y and Z axiz. It will be combined with the Firmata code in order to send the movements of all 3-axis to the Arduino, which in turn controlls the stepper motors, that move the platforms in each axis. That code will then be combined with the "mesh" pattern from step 14 to create a 3D mesh. As in step 6 - I've built this on some sample code that came packaged with Processing. It is under Examples->Topics->Motion->Bounce /////////////////// *********PROCESSING CODE ONLY********* /** * Bounce_3D_0 * * When the shape hits the edge of the window, it reverses its direction. * *Modified for 3D NOTE: 0,0,0 - top left corner (facing the computer monitor) negative Z axis points 'into' the computer monitor positive Y axis points down positive X axis points to the right */ int size = 40; // Width of the shape float xpos, ypos, zpos; // Starting position of shape float depth; float xspeed = 2.5; // Speed of the shape float yspeed = 2; // Speed of the shape float zspeed = 3; int xdirection = 1; // Left or Right int ydirection = 1; // Top to Bottom int zdirection = 1; //front or back void setup() { size(400, 400, P3D); noStroke(); frameRate(30); smooth(); // Set the starting position of the shape xpos = width/2; ypos = height/2; zpos = -height/2; //note that Zaxis goes 'into' the screen depth = -height; http://www.instructables.com/id/Arduino-Projects/ } void draw() { background(102); lights(); //glass box //note: line(x1, y1, z1, x2, y2, z2) stroke(255); //back line(0,0,depth, width,0,depth); line(0,height,depth, width,height,depth); line(0,0,depth, 0,height,depth); line(width,0,depth, width,height,depth); //corners line(0,0,0, 0,0,depth); line(0,height,0, 0,height,depth); line(width,0,0, width,0,depth); line(width,height,0, width,height,depth); // Update the position of the shape xpos = xpos + ( xspeed * xdirection ); ypos = ypos + ( yspeed * ydirection ); zpos = zpos + ( zspeed * zdirection ); // Test to see if the shape exceeds the boundaries of the screen // If it does, reverse its direction by multiplying by -1 if (xpos > width-size || xpos < 0) { xdirection *= -1; } if (ypos > height-size || ypos < 0) { ydirection *= -1; } if (zpos < -height-size || zpos > 0) { //note that Zaxis goes 'into' the screen zdirection *= -1; } // Draw the shape lights(); translate(xpos, ypos, zpos); sphere(size); } http://www.instructables.com/id/Arduino-Projects/ Step 21: 3D - Follow the Bouncing Ball (this includes Firmata) Here is the 3D bouncing ball Processing and Adruino code. This will run X,Y,Z stepper motors. The Arduino code follows, this is the code from Step 13 with the Z axis added. ///////////////////////////////PROCESSING ///////////////////////////// /////////////////// *********PROCESSING with FIRMATA********* /** * Bounce_3D_0 * * When the shape hits a boundry it reverses its direction. There are X,Y, Z bounds Direction is outputed Processsing -> Firmata -> Arduino -> Drivers -> Steppers * *Modified for 3D NOTE: 0,0,0 - top left corner (facing the computer monitor) negative Z axis points 'into' the computer monitor positive Y axis points down positive X axis points to the right */ import processing.serial.*; import cc.arduino.*; Arduino arduino; //Serial myPort; // Create object from Serial class // Data received from the serial port int ledPin = 13; int XstepPin = 10; int XdirPin = 7; int YstepPin = 2; int YdirPin = 3; int ZstepPin = 19; int ZdirPin = 18; int size = 40; // Width of the shape float xpos, ypos, zpos; // Starting position of shape float depth; float xspeed = 2.5; // Speed of the shape float yspeed = 2; // Speed of the shape float zspeed = 3; int xdirection = 1; // Left or Right int ydirection = 1; // Top to Bottom int zdirection = 1; //front or back void setup() { size(200, 200, P3D); noStroke(); frameRate(30); smooth(); // Set the starting position of the shape xpos = width/2; ypos = height/2; http://www.instructables.com/id/Arduino-Projects/ zpos = -height/2; //note that Zaxis goes 'into' the screen depth = -height; //setup communication with Arduino arduino = new Arduino(this, Arduino.list()[0], 57600); // v1 arduino.pinMode(ledPin, Arduino.OUTPUT); arduino.pinMode(XstepPin, Arduino.OUTPUT); arduino.pinMode(XdirPin, Arduino.OUTPUT); arduino.pinMode(YstepPin, Arduino.OUTPUT); arduino.pinMode(YdirPin, Arduino.OUTPUT); arduino.pinMode(ZstepPin, Arduino.OUTPUT); arduino.pinMode(ZdirPin, Arduino.OUTPUT); } void draw() { background(102); lights(); //glass box //note: line(x1, y1, z1, x2, y2, z2) stroke(255); //back line(0,0,depth, width,0,depth); line(0,height,depth, width,height,depth); line(0,0,depth, 0,height,depth); line(width,0,depth, width,height,depth); //corners line(0,0,0, 0,0,depth); line(0,height,0, 0,height,depth); line(width,0,0, width,0,depth); line(width,height,0, width,height,depth); // Update the position of the shape xpos = xpos + ( xspeed * xdirection ); ypos = ypos + ( yspeed * ydirection ); zpos = zpos + ( zspeed * zdirection ); // Test to see if the shape exceeds the boundaries of the screen // If it does, reverse its direction by multiplying by -1 if (xpos > width-size || xpos < 0) { xdirection *= -1; } if (ypos > height-size || ypos < 0) { ydirection *= -1; } if (zpos < -height-size || zpos > 0) { //note that Zaxis goes 'into' the screen zdirection *= -1; } // Draw the shape lights(); translate(xpos, ypos, zpos); sphere(size); // CONTROLL THE STEPPER MOTORS // X if (xdirection >= 0){ arduino.digitalWrite(ledPin, Arduino.HIGH); arduino.digitalWrite(XdirPin, Arduino.HIGH); arduino.digitalWrite(ZdirPin, Arduino.HIGH); } else{ arduino.digitalWrite(ledPin, Arduino.LOW); arduino.digitalWrite(XdirPin, Arduino.LOW); arduino.digitalWrite(ZdirPin, Arduino.LOW); } // Y if (ydirection >= 0){ arduino.digitalWrite(YdirPin, Arduino.HIGH); } else{ arduino.digitalWrite(YdirPin, Arduino.LOW); } // Z if (zdirection >= 0){ http://www.instructables.com/id/Arduino-Projects/ arduino.digitalWrite(ZdirPin, Arduino.HIGH); } else{ arduino.digitalWrite(ZdirPin, Arduino.LOW); } } /////////////////////////////ARDUINO//////////////////////////////////////// // Wiring/Arduino code:// simmple digital firmata //Supports as many digital inputs and outputs as possible. //This example code is in the public domain. #include #define XstepPin 10 #define XdirPin 7 #define YstepPin 2 #define YdirPin 3 #define ZstepPin 19 #define ZdirPin 18 byte previousPIN[2]; // PIN means PORT for input byte previousPORT[2]; void outputPort(byte portNumber, byte portValue) { // only send the data when it changes, otherwise you get too many messages! if(previousPIN[portNumber] != portValue) { Firmata.sendDigitalPort(portNumber, portValue); previousPIN[portNumber] = portValue; Firmata.sendDigitalPort(portNumber, portValue); } } void setPinModeCallback(byte pin, int mode) { if(pin > 1) { // don't touch RxTx pins (0,1) pinMode(pin, mode); } } void digitalWriteCallback(byte port, int value) { byte i; byte currentPinValue, previousPinValue; if(value != previousPORT[port]) { for(i=0; i<8; i++) { currentPinValue = (byte) value & (1 << i); previousPinValue = previousPORT[port] & (1 << i); if(currentPinValue != previousPinValue) { digitalWrite(i + (port*8), currentPinValue); } } previousPORT[port] = value; } } void setup() { Firmata.setFirmwareVersion(0, 1); Firmata.attach(DIGITAL_MESSAGE, digitalWriteCallback); Firmata.attach(SET_PIN_MODE, setPinModeCallback); Firmata.begin(57600); } void loop() { outputPort(0, PIND &~ B00000011); // pins 0-7, ignoring Rx/Tx pins (0/1) outputPort(1, PINB); // pins 8-13 while(Firmata.available()) { Firmata.processInput(); } //added stepper sequence to firmata code digitalWrite(XstepPin,HIGH); //take steps digitalWrite(YstepPin,HIGH); digitalWrite(ZstepPin,HIGH); delayMicroseconds(2); digitalWrite(XstepPin,LOW); http://www.instructables.com/id/Arduino-Projects/ digitalWrite(YstepPin,LOW); digitalWrite(ZstepPin,LOW); delayMicroseconds(2); delayMicroseconds(1000); // <<<<<< USE TO CHANGE STEPPER SPEED???? <<<<<<<< } Step 22: Doing to things at once So far we have been building two sets of code: 1: to controll the X,Y,Z axis 2: to control the extruder temperature and motor The trick now, is to run both at once. The problem is that the extruder motor must be run at a much slower rate then the X,Y,Z motors. In order to run the steppers at different speeds you need a timer or counter, or something. I'm going to make it so that for every so many X,Y,Z steps, the extruder motor takes one step. Here is a very simple bit of code that does this. This is based on an example that was included in the Processing dowload. The orgingal code ran a line across the screen, moving one position for every loop through the program. I've added a parameter called "timer" that coundt up to 4, then changes teh background to white, then resets to 0 and starts counting again. So what you get is two things running at once at a rate of 4:1. Here is the processing code: ///////////////////////////PROCESSING ONLY////////////////////////////////// void setup() { frameRate(4); } int pos = 0; int timer= 0; void draw() { background(204); pos++; line(pos, 20, pos, 80); if(pos > width) { pos = 0; } timer++; //INCREMENT TIMER if (timer ==4){ // DO SOMETHING AFTER 4 COUNTS background(255); //SOMETHING timer = 0; //RESET THE TIMER } } http://www.instructables.com/id/Arduino-Projects/ Step 23: Better mesh (in progress) here is mesh drawing code, that used less specific coordinates ///////////////////Processing///////////// /** *Point moves back and forth accross the screen - includes movement in the X direction ****uses different variables to indicate that this is in progress (and because I forgot what variables I was using) */ int res = 50; //print resolution int a = 100; int b = 1; int dir_a = 1; int dir_b = 0; int step_a = 1; int step_b = 0; int old_b = 0; int next_b = res; void setup() { size(640, 200); stroke(255); background(50); } void draw() { a = a + dir_a*step_a; b = b + dir_b*step_b; if ((a < 10 || a > height-10) && b < next_b) { dir_b = 1; step_a = 0; step_b = 1; dir_a = (-1)*dir_a; http://www.instructables.com/id/Arduino-Projects/ old_b = b; } else { step_a=1; step_b=0; next_b = old_b+res; } point(b, a); // Syntax point(x1, y1) print(b); print(','); println(a); } Step 24: Continous mesh rotating 90deg each layer This shows a point continously tracing mesh pattern across an X,Y plane. The mesh is rotatated 90deg after each layer is traced. This can be used to output X,Y directions to the stepper motors. Z axis control can be added to this. ///////////////////Processing///////////// /** *Point moves back and forth accross the screen - includes movement in the X and Y direction Repeats over and over, rotating 90deg every time a layer is complete takes some odd steps at the begining ****uses different variables to indicate that this is in progress (and because I forgot what variables I was using) */ int res = 50; //print resolution int a = 10; int b = 10; int dir_a = 1; int dir_b = 1; int step_a = 1; int step_b = 0; int old_step_a = 1; int old_step_b =0; int old_dir_a = 1; int old_dir_b = 0; int dir_switch = 0; int old_dir_switch = 0; int old_a = 0; int old_b = 0; int next_b = res; int next_a = res; void setup() { size(200, 200); stroke(255); background(50); } void draw() { background(50); if ((a < 10 || a > height - 10) && old_step_b ==0){ dir_a = -1 * dir_a; next_b = b+res; dir_switch = 1; } if ((old_dir_switch != dir_switch) && b < next_b){ step_a = 0; step_b = 1; dir_switch = 0; http://www.instructables.com/id/Arduino-Projects/ } if (b > next_b){ step_a = 1; step_b = 0; next_b = b+res; dir_switch = 0; } if ((b < 10 || b > width - 10) && old_step_a ==0){ dir_b = -1 * dir_b; next_a = a + res; dir_switch = 1; } if ((old_dir_switch != dir_switch) && a < next_a){ step_b = 0; step_a = 1; dir_switch = 0; } if (a > next_a){ step_b = 1; step_a = 0; next_a = a + res; dir_switch = 0; } // calculate postion a = a + dir_a*step_a; b = b + dir_b*step_b; //display point point(b, a); // Syntax point(x1, y1) //store some values as old for comparison old_a = a; old_b = b; old_step_a = step_a; old_step_b = step_b; old_dir_a = dir_a; old_dir_b = dir_b; old_dir_switch = old_dir_switch + dir_switch; print(b); print(','); println(a); } Step 25: Prints using reprap Gcode interpreter and Host software http://www.instructables.com/id/Arduino-Projects/ Related Instructables Reprap Mendel K'nex Frame (Photos) by Superchef Quad Stepper Controller by Jason-B Constructing A RepRap: Part 1 by hoeken XY-Plotter by bdeakyne CRANE GAME by marc.cryan Creating a Model for 3D Printing on an iPhone/iPod Touch by doktorvortexx How to Make a Three Axis CNC Machine (Cheaply and Easily) by oomlout 3D Printing (Article) by howitgoes http://www.instructables.com/id/Arduino-Projects/ A fully automatic coffee bean roaster (Arduino) by nightlife31 on September 14, 2009 Intro: A fully automatic coffee bean roaster (Arduino) I got introduced into the world of Arduino when two friends informed me about this little device independently from each other. I read about it and was sold immediately. What if I had this so many years ago, how much would I have invented already, what would I have made? What would my house have looked like? I ordered one directly and there I was playing with lights, sensors, etc. But then? ..... it has the potential to control everything, but what? What should I make? I think this is where more people get stuck. What should I do with it? Coincidently I just finished constructing a coffee roaster, made from an ordinary popcorn machine. In basic it works by a fan blowing air past a heating element through the green coffee beans. By controlling the fan speed, I was able to control the temperature of the air roasting the beans. But, the roasting process turned out to be quite hands on, as the temperature needed to be kept constant following a profile, which was done by measuring the temperature the whole time and adjusting the fan speed with a pot meter. That, I thought, should be automated.... Image Notes 1. LCD module http://www.instructables.com/id/Arduino-Projects/ Step 1: Materials used For this project I used: -1x Arduino Duemilanove -1x Arduino protoshield v2 (sparkfun) with breadboard -1x 12x2 LCD screen (use a parallel one, would recommend a serial LCD) -1x -4x -1x -2x -1x -1x -1x electric popcorn machine 1KOhm resistors small push button 1KOhm potmeter variable resistor IRF540N temperature sensor ZTK 33 V/7 mA solid state relais S216S02 (sharp) -19V adapter (used the one of my laptop) -plugs, wires, etc http://www.instructables.com/id/Arduino-Projects/ Step 2: Adjusting the popcorn machine The popcorn machine itself is adjusted by placing a temperature sensor, disconnecting the heating coil and fan motor contacts and installing wires and a solid state relais. Be sure to read my previous instructable as well, since that was my starting point. Temperature sensor: The sensor is installed on the inside of the aluminium cup, just above the sleeves, as it needs to measure the temperature of the beans while roasting. I used a piece of silicon (from a silicon hose) to make a heat resistant housing to keep the sensor in place and prevent short circuit. Drill a hole in the cup and place the sensor as shown on the photo's. Take care the sensor leads don't touch the metal of the cup. Outside the cup, the sensor is connected to wires long enough the lead out of the popcorn machine. The sensor and wires are secured with a tierap. Take care that the wires don't touch the cup either, as they can melt. Installing a solid state relais to the heating coil: The heating coil needs to be disconnected from the motor and from the heat security build into the popcorn machine. The electricity cord of the machine (220V) should be directly connected to the heating coil and the switch. In this circuit you build the solid state relais. Wires to control the solid state relais run out of the popcorn machine to the Arduino. Fan motor: The contacts of the fan motor are disconnected from the rest of the electronics and connected to two wires running out of the popcorn machine. A diode is placed between the two contacts to stop electricity being produced by the motor, after it is switched off but still turning. As power supply, a plug is installed to attach the 19v adapter of my laptop. http://www.instructables.com/id/Arduino-Projects/ Image Notes 1. The sensor in a piece of silicon http://www.instructables.com/id/Arduino-Projects/ Image Notes 1. The sensor is kept in place with a tierap and connected to a wire. This set up short circuited after a while when the plastic of the wires melted. In a new set up I placed a piece of silicon between the cup and the plastic wires. The tierap appears to be ok. Step 3: Connecting the Arduino As the roaster should be able to operate without a pc connected to it, I installed it with a LCD screen. The LCD screen I have is parallel and a bit annoying to connect. I therefore made a LCD module I can simply take off and use on other projects. The module is on its own breadboard with a potmeter to control the light and 8 wires connecting to the Arduino. I would recommend getting a serial LCD as you only need 3 wires. The Arduino is equipped with a protoshield with a small bread board. It consists of: * The temperature sensor: a simple voltage divider connection with a 1KOhm resistor, using analog port 9. * The fanspeed controller: pulse width modulator (PWM) of port 3, connected to a mosfet (IRF540N) which controls the fan motor with 19V coming from the laptop adapter. Use 1Kohm resistor between base and digital 3. *Heater controller: turned on or off by the solid state relais, connected to digital port 5 (dont forget the 1KOhm resistor or you blow you relais). *A potmeter to adjust the minimal fanspeed, connected to 5V, ground and analog port 0. *A button to start the roasting, connected to digital port 6, use another 1KOhm resistor here. *LCD connection Digital pins 7-13 connected to RS, RW, E, d4, d5, d6, d7 of the LCD screen (and of course 5V and ground) The popcorn machine is connected to the Arduino through 4 wires, all connected to metal pins to easily stick them in the holes of the breadboard. http://www.instructables.com/id/Arduino-Projects/ Image Notes 1. A potmeter to control the minimal fan speed (to low fanspeed will burn the beans) 2. Wires leading to the coffee roaster: ground and temperature sensor. 3. Wires leading to the coffee roaster: Fanspeed controller and relais of heating coil 4. IRF540N controlling the fanspeed 5. Ground and 5V for the LCD module 6. Arduino undernead the protoshield 7. Minibreadboard on top of the protoshield Image Notes 1. LCD module Image Notes 1. Connections to the Arduino. http://www.instructables.com/id/Arduino-Projects/ Step 4: The Arduino program code The program to run the Arduino consist of work of others, as it include a library for the LCD display (LiquidCrystal.h) and the PID control (PID_Beta6.h) , and a protocol to communicate with the associated Arduino PID Tuning Front-end, running on Processing (same maker as the PID control library, great work from Brett Beauregard!) The program does the following: Display a welcome screen and waiting for you to push the button. Then it turns on the fan but not the heating coil and it allows you to set the minimal fan speed at which the beans still move a little (you can lower it during the roasting as beans get lighter). When you press the button again the heating coil is turned on and the roasting starts. The program continuously measures the temperature and adjusts the fanspeed in order to match the set point. It will lower the fan speed to increase the temperature of the beans of increase the fan speed to do the opposite. If the beans get more than 3 degrees above the set point the heating coil is switched of, which will lower the temperature directly. The set point is updated along a profile that is set into the program. First heat up to 150C and stay there for 1 minute, then slowly increase to 190C and stay there for 1 minute. Then slowly increase the temperature again until the final temperature is reached. At this point, the fan is set on max and the heating is turned down. The roaster stops when the beans are lowered to 40C. After lots and lots of tweaking, the final program code to run the coffee roaster can be found in the file below. File Downloads Coffee_Roaster_v1_0.pde (11 KB) http://www.instructables.com/id/Arduino-Projects/ [NOTE: When saving, if you see .tmp as the file ext, rename it to 'Coffee_Roaster_v1_0.pde'] Step 5: Testing..... and roasting your coffee beans Ok, so now you connect the popcorn machine to the Arduino, to the 19V and 220V power supply and you connect the Arduino to the LCD screen and your computer, and you are ready to test your roaster. I guess if you use the program, the temperature sensor should be more or less ok. But better be to calibrate is, and if necessary to adjust is. For this you would need a thermometer which can measure up to 220C. Measure at difference temperatures and adjust "a = 0.6271 and b = -213.13" Next I suggest to try out some things, see how it works and follow the temperature profile with the front-end program. You will need some beans to be able to follow the temperature profile. Take good care that you set a minimal fanspeed that still keeps the beans a little bit moving. Otherwise the beans might burn (can work out dangerously!). As the roasting progresses, the beans get lighter and therefore the minimal fanspeed can be lowered. If this all works out, I suggest you try your first batch of coffee beans. Mine can take up to 100g of beans each time, which isn't so much (but then I dont drink THAT much coffee). If it works out fine, you can start to experiment with different profiles (I would suggest to start with the final temperature settings) Good luck and enjoy. I have thought about an additional controller that would keep an eye on the beans. If they stop dancing then the fan speed should be increased a little bit. Couldn't think of any way to sense this, so if you have any suggestion please let me know. Image Notes 1. Red is the actual temperature and green is the set point temperature profile. Blue is PID output of the fanspeed controller. Related Instructables Popcorn machine made into a high class coffee roaster by nightlife31 How to Roast Your Own Coffee by JJAJoshua Roast your own Coffee at home by sysiphus 4 different coffee roasters by plumber_bob Simple Coffee Roasting (video) by technogumbo $11 PopcornPopper Coffee Roaster by sehrgut Temperature Control For Kitchen Appliances by timothy Gravy to go with a Roast by bunycraft http://www.instructables.com/id/Arduino-Projects/ Ghostbusters Proton Pack with Arduino and LASERS! by depotdevoid on October 26, 2009 Author:depotdevoid DepotDevoid on Facebook! Like me on Facebook! My ego needs a boost! Depotdevoid is short for The Depot Devoid of Thought, the place where you go when you lose your train of thought and you're waiting for the next thought train to pick you up. The depot represents a fairly high level of absent mindedness and ease of being distracted, as well as a love of seeing what will pique my interest next, and where that idea will take me. I am a ball bearing salesman by day and a mad scientist by night (and on the weekends). I love making and learning about all sorts of things, and while I'll never be the best at any one thing, I am reasonably competent in many areas. I hope you enjoy my instructables, please take a moment to subscribe! Intro: Ghostbusters Proton Pack with Arduino and LASERS! Last year, I was a Ghostbuster for Halloween. It was pretty cool, but I had some problems with the costume. I decided to do it again, but get it right this time. I picked up a khaki flight suit instead of blue coveralls, built a trap and some ecto goggles, and made some major refinements to proton pack. Here I will share with you how I went about the various improvements to my costume. ***UPDATE 5/4/10: If you make your own ghostbusters proton pack, post some pictures in the comments below, and I'll send you a patch!*** http://www.instructables.com/id/Arduino-Projects/ Step 1: Make a Ghostbusters costume I've seen a bunch of ads this year for a Ghostbusters costume with an inflatable proton pack. These costumes are crap! I don't care if you don't want to spend the time and effort on building a good quality costume, if I see anyone dressed up in one of these turds when I go out on Halloween, I swear I will glare at them disapprovingly! ***Oh, looking off to the right, I see that I'm insulting the sponsors! I would just like to point out that this paragraph is what is known as HYPERBOLE and should not be taken literally. I worked my ass off building this thing and it rocks so much harder than those costumes, but I won't really insult anyone wearing one. I'll just upstage them with my awesomeness. There are many resources for building a proton pack out there. I've got my slideshow from last year, as well as a more detailed instructable on how to make a kid sized Proton Pack, which could easily be scaled up to full size. I also recommend this instructable, as well as gbfans.com I picked up the flight suit from ebay member direct-pb. This company really came through for me. The suit was good quality and very inexpensive. Image Notes 1. gut Step 2: Wire the pack for Arduino control This looks more complicated than it is, I swear! I built a simple Arduino shield that lives in the wand (see pictures below). All of the LEDs had a common negative ground, and each positive lead went to either to a digital pin (if it was going to flash) or to the +5v pin if it was going to be on at all times. I also built an on/off switch into wand and installed a 9v battery clip to power the Arduino. http://www.instructables.com/id/Arduino-Projects/ Image Notes 1. Cycling red lights Image Notes 1. Two LEDs that alternate on and off 2. Cycling wand LEDs 3. Always on power indicator Image Notes 1. Alternate on and off 2. Flashes on and off very quickly 3. Full on, then fades to off Image Notes 1. Flashes on and off very quickly 2. Full on, then fades off Step 3: Program the Arduino I am very new at this whole microcontroller thing, so I'm sure all of you veterans out there could have written a much more elegant piece of code for this. My simplistic idea for how to make this work does however have the advantage of being both very easy to understand by the uninitiated and very simple to change if you want to alter the way the lights flash. The basic concept behind the code is that it runs a loop 6.4 seconds long, broken into 64 100 millisecond "ticks." At each tick, I can have a light turn on, turn off, dim, brighten, etc. After it's gone through it all once, it goes right back to the beginning and repeats until the battery runs out. http://www.instructables.com/id/Arduino-Projects/ File Downloads ProtonPack.pde (10 KB) [NOTE: When saving, if you see .tmp as the file ext, rename it to 'ProtonPack.pde'] Step 4: Install the lasers! Lasers are awesome! I don't even care that if you aren't in a fog or a haze of tobacco smoke the beam isn't visible, it's still super cool! I got these lasers from a couple of broken pen-style laser pointers. They stopped working, I took them apart, and then I found out there was just a loose battery connection in both. I was never able to get everything crammed back in the housings though, so I harvested the electronics for my costume. I originally wanted to power everything through the Arduino, but I found that the two lasers running along with everything else drained the battery VERY quickly, so I installed them on a separate power source (2 AA batteries) shoved into the handle of the wand. Image Notes 1. Laser controls Image Notes 1. Batteries for the lasers http://www.instructables.com/id/Arduino-Projects/ 2. Green laser 3. Red laser Step 5: Make more junk you'll have to lug around with you! I also built a trap and a pair of ecto goggles for the costume this year. These are simply boxes cut to size, painted black, and with a bunch of doodads and widgets glued on. The trap has a 1/4" plywood base and a 1/4" plywood mounting plate on the belt. They connect with a wedged shape hunk of sheet metal I cut out with my dremel tool. The handle of the trap is also wood, but nearly everything else is just cardboard. The ecto goggles are made out of a small cardboard box with one side cut out in the shape of my forehead. The straps were harvested from a broken headlamp. Everything on them was simply junk from my stuff drawers or screws from my screw jar. Step 6: Marvel at your own awesomeness! Look how rad I am, not like a dork who's nearly thirty and playing with toys at all! All the cool kids are sitting in their darkened shops late into the evening building props from 80's movies that they'll wear for one day and then put into storage! http://www.instructables.com/id/Arduino-Projects/ Step 7: Final thoughts Thanks for reading! I hope you enjoyed my little 'ible and found it useful and/or amusing. I am very tired and feeling quite silly at the moment. Please take the time to vote for me in the Arduino contest! Also, please leave me a rating or some feedback. It's pretty late right now, and I know I wasn't too descriptive in the technical details this time, so if you need some clarification, don't be afraid to ask. Also, if you post some pictures of your own home made proton pack, post 'em in the comments below. I'll send you a DIY patch! Image Notes 1. Happy nerd 2. Butter Related Instructables Ghostbusters Ghost Costume by Greasetattoo Kid Sized Ghostbusters Costume! by depotdevoid Ghostbusters Proton Pack for Halloween! (Photos) by depotdevoid Be a Ghostbuster for Halloween! by Honus Simple and easy Ecto Goggles (Photos) by aliencatx Ghostbusters Proton Pack by ZombieDUG Halloween 2007 - "Who Ya Gonna Call?" by NavySWO91 Laser Beam Super Hero Guantlets by AshleyJean http://www.instructables.com/id/Arduino-Projects/ Arduino controlled Silly String shooter by erickingston on October 28, 2009 Intro: Arduino controlled Silly String shooter This is a fun device that's very simple to make. I put mine in a pumpkin for Halloween. I also added an IR motion sensor, sound, and Twitter. You can follow the victim count on Twitter by following: hackolantern Image Notes 1. IR Sensor 2. All other components: - Arduino mini pro - Audio recorder - RF transmitter 3. Silly String shooter as shown in instructable 4. External Components (didn't want to get them dirty!): - RF receiver - Protoshield - Wifi module - Arduino Duemilanove This is only used to send tweets. Image Notes 1. 39g Servo http://www.instructables.com/id/Arduino-Projects/ Step 1: Materials Checklist Items needed: - Arduino microcontroller - A couple cans of Silly String (it's no fun with just one can!) - Wire coathanger - Standard sized servo (I used a 39g servo) - Zip ties - Basic tools (I'm not going to list everything. You're smart, surely you'll figure it out.) Step 2: Mark, Measure, and Cut Take the cap off the Silly String. Measure and mark the cutout locations. You might be able to use my measurements in the images below, but your brand of Silly String may have different dimensions. Good luck. Step 3: Bendy / Twisty Bend your coathanger to resemble the image below. This will act as the trigger. Image Notes 1. Internal bend http://www.instructables.com/id/Arduino-Projects/ Step 4: Mount Servo Run the zip tie through the top holes, and attach the servo. **Important** The trigger should be adjusted to fit YOUR can of Silly String. With my setup, the internal bend is horizontal when the outside lever rests all the way against the servo. This allows for the servo to make a full 90 degree rotation without applying any stress to the other components. Image Notes 1. Outside lever Image Notes 1. 39g Servo http://www.instructables.com/id/Arduino-Projects/ Step 5: Example Code This code is pretty stupid, but it will give you an idea of how to start. ** I used the SoftwareServo.h library only because the standard servo.h library and the VirtualWire.h library don't get along. If you want to use the standard servo library, it works just fine, but you'll have to whip up your own code (it shouldn't be too hard). Download the sketch anyway, and take a look. The other sketches on here, SillStringShooter2.pde and Hackolantern_Tweet.pde, is the actual code I used for my pumpkin. Enjoy! File Downloads SillyStringShooter.pde (713 bytes) [NOTE: When saving, if you see .tmp as the file ext, rename it to 'SillyStringShooter.pde'] SillyStringShooter2.pde (1 KB) [NOTE: When saving, if you see .tmp as the file ext, rename it to 'SillyStringShooter2.pde'] Hackolantern_Tweet.pde (2 KB) [NOTE: When saving, if you see .tmp as the file ext, rename it to 'Hackolantern_Tweet.pde'] Related Instructables Silly String Can explosion in Slow Motion at 600FPS (video) by engineerable Halloween Animatronics by mik3 Scariest Pumpkin Ever! by wurx Cheshire Cat Pumpkin animated with LEDs by J_Hodgie Arduino & Visual Basic 6.0 (Continuous Servo Motor) by Daphne00Z The Making of a Steampunk Pumpkin by nothans Tips for Halloween pumpkin pictures by ewilhelm Talking Arduino Halloween Skeleton by samseide http://www.instructables.com/id/Arduino-Projects/ Arduino True Battery Capacity Tester (Li-Ion/NiMH/NiCD/Pb) by moris_zen on November 10, 2009 Intro: Arduino True Battery Capacity Tester (Li-Ion/NiMH/NiCD/Pb) If anyone saw my last instructable "Simple Li-Ion Battery Power Tester" they can now upgrade to a computerized hi-tech version that is capable of measuring almost any type of rechargeable or none rechargeable batteries (but it will drain one charge from them in the process). It can even connect to a PC and give you a full "Data-sheet" graph of the discharge and total capacity. Note that this is my first Arduino project (I am not counting my "blink LED"). Image Notes 1. Auto Detect Battery type by voltage Step 1: This is what you can get at the end...(just to get you interested) This is the graph you can get from the text file sent to the PC during drain cycle. Image Notes 1. Total capacity of a new 2000 mAh Bat was 1580mAH! 2. When voltage drops bellow 950mV (for NiCD/NiMH) the load is removed (via the FET) 3. Seconds 4. mV Image Notes 1. Li-ION Battery graph http://www.instructables.com/id/Arduino-Projects/ Step 2: Lets start at the begining - Arduino I really wanted to get this Diecimila copy Arduino board bit it took me ~2 weeks to get it by mail so I just had to start fast with my own bread-board Arduino so I purchased an ATMEGA168 and thought I could get it running without any more components .. to my suprize it didn't work and I just had to get another shipment with a 16Mhz crystal and two 22pf caps .. then I got the next ... Step 3: Bread board Arduino I basically took junk apart and added the components one by one ... most of the information can be found in the Arduino web page : http://arduino.cc/en/Main/ArduinoBoardDiecimila They realy have everything you need . It took me about a week to get it up and running (bootloader / building an ISP cable and an RS232 cable ...) - you can read all about this in the site above . http://www.instructables.com/id/Arduino-Projects/ Image Notes 1. connector to LCD 2. ATMEGA168 3. Max232 4. This led indicates you want to vote for me :-) Does anyone even read all these comments? Step 4: FET with 2.2Ohm load it was fairly simple to add a FET with "on" resistance of ~8mOHM (no barly any power disipation on it) and a 2.2 10W resistor . I connected two A/D pins from the Arduino to the resistor poles and subtracted the values to get the exact volatge drop on the resistor . Now I samples them every second and acumulated the current (I=DeltaV/R). I also added a buzzer to indicate when charging was over and stoped the discharge . Image Notes 1. This FET was removed from a TV set - it has 4mOhm on-resistance.cool! 2. 10W 2.2Ohm Resistor load Step 5: The SW So I also connected and LCD (which I took apart from some other junk) and found the data-sheet on the net + a cool driver from the Arduino web page and started coding . Auto detecting battery type by the voltage . Image Notes 1. Testing voltage to deterim battery type 2. RS232 connector 3. Reset 4. Power On 5. Load is active (discharging) 6. Ventilation holes for the 10W resistor http://www.instructables.com/id/Arduino-Projects/ Step 6: Auto Detect Battery tyoe It will detect if it is NiMH/NiCD or Li-ION by the voltage range . And then start the discharge cycle. Image Notes 1. Auto Detect Battery type by voltage Step 7: Discharging... The discharge can take anywhere from 30-120 minuets depending on batery capacity but at the end you get a true indication of battery capacity / quality . Do you want to use that battery for your air-plain receiver or not ? This is the diagram of the discharge circuit... Image Notes 1. The discharge just started - the 1Ma will increase as time goes bye.. Step 8: Discharge Circuit very simple with the 2 A/D connected on the two sides of the resistor / Vr=Vbat-Vfet. http://www.instructables.com/id/Arduino-Projects/ Image Notes 1. Connect to pin 19 of Atmega168 2. Battery to be tested 3. 10W load Step 9: My SW (free for anyone to use) // include the library code: #include LiquidCrystal lcd(12, 11, 5, 4, 3, 2);// initialize the library with the numbers of the interface pins int sensorPin = 0; // select the input pin for the potentiometer (pin 23) int sensor2Pin = 2; // select the input pin for the potentiometer (pin 23) int ledPin = 13; // select the pin for the LED int SPKPin = 6; int sensorValue = 0; // variable to store the value coming from the sensor int sensor2Value = 0; // variable to store the value coming from the sensor float LiMinThreshold = 2700; // Lithium Minimal Voltage for load removal float LiMaxThreshold = 4200; // Lithium Max Voltage for load removal float NmhMinThreshold = 950; // NMH Minimal Voltage for load removal float NmhMaxThreshold = 1600; // NMH Max Voltage for load removal float SelectedMinThreshold = 5000; int i; int BatVoltage = 5000; int FetVoltage = 5000; long TotalCurrent = 0; boolean done = false; unsigned long PrevMillis ; unsigned long MillisPassed ; void CL2(){ lcd.setCursor(0, 1);// Second line first char lcd.print(" "); lcd.setCursor(0, 1);// Second line first char } void setup() { Serial.begin(9600);// start serial port to send data during run to the PC pinMode(ledPin, OUTPUT);//activation led and enable for FET pinMode(SPKPin, OUTPUT);//activation led and enable for FET lcd.begin(24, 2);// set up the LCD's number of rows and columns: lcd.print("Bat PWR Tester[Active]"); // Print a message to the LCD. lcd.setCursor(0, 1);// Second line first char lcd.print("Detecting Bat Type..."); // print voltage value delay(2000); lcd.setCursor(0, 1);// Second line first char lcd.print(" "); lcd.setCursor(0, 1);// Second line first char digitalWrite(ledPin, HIGH); // set the LED on sensorValue = analogRead(sensorPin); // read the value from the sensor: digitalWrite(ledPin, LOW); // set the LED off // Detecting battery type BatVoltage = sensorValue*4.887; if (BatVoltage > 4500){ lcd.print("Warning high-V! "); done = true;} else if (BatVoltage > LiMinThreshold){ lcd.print("Type:Li-Ion Bat "); SelectedMinThreshold = LiMinThreshold;} http://www.instructables.com/id/Arduino-Projects/ else if (BatVoltage > NmhMinThreshold){ lcd.print("Type:NiMH/Cd Bat "); SelectedMinThreshold = NmhMinThreshold;} else{ lcd.print("Unknown Bat V<1 "); done = true;} lcd.print("V="); lcd.print(sensorValue*4.887); // print voltage value Serial.print("DT[ms]"); Serial.print("\t"); Serial.print("Bat[mV]"); Serial.print("\t"); Serial.print("Fet[mV]"); Serial.println(""); delay(3000); CL2(); PrevMillis = millis(); } void loop() { if (BatVoltage > SelectedMinThreshold && !done) { digitalWrite(ledPin, HIGH); // set the LED on sensorValue = analogRead(sensorPin); // read the value from the sensor: sensor2Value = analogRead(sensor2Pin); // read the value from the FET: FetVoltage = (sensor2Value*4.887); BatVoltage = (sensorValue*4.887); CL2(); lcd.print("V="); lcd.print(BatVoltage); // print voltage value lcd.print("mV"); //lcd.print(FetVoltage); // print voltage value TotalCurrent=TotalCurrent+MillisPassed/1000*(BatVoltage-FetVoltage)/2.2/3.6; lcd.print(" I="); lcd.print(TotalCurrent/1000); lcd.print("mAH "); delay(1000); MillisPassed = millis()- PrevMillis; PrevMillis = millis(); Serial.print(int(MillisPassed)); Serial.print("\t"); // prints a tab Serial.print(BatVoltage); Serial.print("\t"); // prints a tab Serial.print(FetVoltage); Serial.println(""); // prints a tab CL2(); } else { done=true; digitalWrite(ledPin, LOW); // set the LED off - stop loading lcd.setCursor(0, 0);// First line first char lcd.print("Bat Power Tester [DONE] "); // Print a message to the LCD. CL2();//clear line 2 sensorValue = analogRead(sensorPin); // read the value from the sensor: BatVoltage = (sensorValue*4.887); lcd.setCursor(0, 1);// Second line first char lcd.print("V="); lcd.print(BatVoltage); // print voltage value lcd.print("mV I="); lcd.print(TotalCurrent/1000); lcd.print("mAH "); for (int i=0; i<100 ; i++){ digitalWrite(SPKPin, HIGH); delay(1); digitalWrite(SPKPin, LOW); delay(1); } delay(1000); } } http://www.instructables.com/id/Arduino-Projects/ Step 10: The schematics ... All the schematics for arduino can be found on the Arduino web page (step 2). you can Also find how to connect standard LCDs on the same site so no need to copy it all here. Step 11: Please support my work by voting for me ! All and all prototype Breadboard and then moving it to a box and soldering it all together took me two weeks (night work 3-4 hours a day) Thanks you for reading and feel free contacting me with any questions / remarks . I am now an Arduino expert (naa I am not - 2 weeks XP ) But I have many new project I would like to do . Related Instructables Rechargeable Battery Capacity Tester by BrianH Rechargeable Battery Tips by msuzuki777 SAFE Recharging of Exotic Batteries, NiMH, LiPO and complex battery packs or multiple cells. by erckgillis NiCd - NiMH PC Based Smart Charger Discharger by hosam_eldin Homemade Cordless Drill Battery Charger by yeltrow Increase battery life for electronics by Plasmana Extend Life... (of notebook batteries) by denanderen Li-Ion Battery capacity tester (Lithium power tester) by moris_zen http://www.instructables.com/id/Arduino-Projects/ Wii Nunchuck Adapter by dany32412 on July 14, 2009 Intro: Wii Nunchuck Adapter This tutorial is for all those people who have an arduino and want to use there Wii nunchuck as an input device, but dont realy feel like cutting open the cord and ruining the nunchuck FOREVER!!!!!!!! well youve come to the right place! Step 1: Supplies These are the supplies you will need most can be found at radioshack and at hardware stores. if you cant find any etchant solution i made my own on STEP 6. + iron +scisors +tape +soft gloss photo paper +arduino +wii nunchuck +LED's +brake cleaner +etchant solution (is makeable, see step 6) +double sided PCB .062" thick (you do have a bit of lee way) +solder +hack saw http://www.instructables.com/id/Arduino-Projects/ Image Notes 1. etchant solution found at radioshack Image Notes 1. scisors found any ware 2. tape found any ware 3. an iron i used a ski waxing iron, but any iron will do 4. DOUBLE sided copper clad found at radioshack 5. paper clip any ware 6. CD yAy haha not used was just on my desk 7. and any laser printer. found at staples Image Notes 1. kodak soft gloss photo paper found at staples MUST BE SOFT GLOSS Image Notes 1. brake cleaner. found at autozone or any other auto parts store. Step 2: Printing our transfers Thanks to icecreamterror who made a pdf version of the pcb heres a link www.megaupload.com/ For those you who wan to do it old school style... start by downloading DipTrace http://www.diptrace.com/download.php and the Wii Nunchuck layout http://www.megaupload.com/?d=0212FN11 1. install diptrace by following all the on screen instructions 2. Start Diptrace 3. go to file>open and locate "wii_nun_chuck_adapter.dip" (image 2) 4. click open 5. go to view> click mirror (so it is checked) 6. now it should look like image 3 http://www.instructables.com/id/Arduino-Projects/ 7. Load a piece of photo soft gloss paper into your printer (image 4) 8. now go to file>print> and select your laser printer (image 5) 9. press PRINT. 10. now you should have a nice looking transfer. WOOO HOOOO we are almost there. sorta Image Notes 1. download this one Image Notes 1. 1) locate the file where ever you saved it 2. 2) click OOOPPPEEENNN Image Notes 1. soft gloss 2. feed mee! http://www.instructables.com/id/Arduino-Projects/ Image Notes 1. select laser printer 2. print that thing Step 3: Preping the transfer 1) no that you have your printed sheet of PCB transfer. pick one and cut it out like i have in image 1. 2) Now what we want to do is fold the paper so the two sides line up. you can use a light to help you look through the paper. 3) once its lined up make a nice clean crease. (image 2) 4) now we use some tape to make sort of a tube that the PCB will slide into. (image 3) 5) the transfer is ready next step is to cut and prep the board. Image Notes 1. nice crease http://www.instructables.com/id/Arduino-Projects/ Image Notes 1. taped side 2. folded side side 3. peice of tape should be about that long and wide Step 4: Cutting and preping the PCB for this step i dont have very many pictures but its pretty much straight forrow 1) Remove your new board you just bought at radioshack from its bag 2) I recomend cutting out one of the transfers and using it as a template to get the dimensions right 3) place the transfer on the corner of the board and with a knife score around it 4) Then i placed the board in my vice and used a hack saw to cut it or if you can get your hands on a band saw that would be much easier 5) once the board is cut out. (image 1) take a peice of 800 grit sand paper and sand down the edges 6) finaly clean of the board with some rubbing alcohal or water making sure to dry it good if used water next we will transfer the design onto the board Image Notes 1. after one failed attempt. Step 5: Transfering the design So we have our tube like transfer and out cut to size board. 1) take your board and slowly slide it into the transfer 2) next use some object (i used a paper clip) to try to adjust the board so it lines up with the design 3) now place the transfer and board on some surface. i put a paper bag down so it wouldnt mess up my desk. 4) now what ever iron you are using turn it up to the HIGH POSSIBLE SETTING (image 4) 5) once the iron is warmed up take it and press down on the board with about 20lbs of force for 20 seconds. (image 5) 6) turn it over and press for another 20 seconds. 7) turn it over again and let it cool for 1 minute or so and press for another 10 seconds. 8) turn it over again and press for another 10 seconds. 9) let it sit for 2 minutes. 10) now you can cut the tape and peel off the paper. hopefully the toner adheared to the baord. (image 6) 11) now go to your sink and using a paper towel and scrub off the white paper until you can see your crispy black lines. 12) if not use the brake cleaner and clean off the PCB completely and start over :( http://www.instructables.com/id/Arduino-Projects/ PS: if you are lost in any of these processes this is a good video showing you how to transfer your PCB design. now we are almost done. WOOO HOOO!!!!!!! Image Notes 1. slide it in trying not to scratch the toner (very unlikely), this could cause a break in one of your traces. Image Notes 1. used to aline the board with the design. have to kinda squint to see where it is. Image Notes 1. yeah thats right. all me. 2. ahhh help meeeeeee! Image Notes 1. yeah to the max!!!! http://www.instructables.com/id/Arduino-Projects/ Image Notes 1. this is not the transfer it just a peice of paper. 2. dont even think about it 3. squish!!! ahhhh help! Image Notes 1. the toner may or may not be white. the white is just the paper. Step 6: Etching the PCB now that we have our PCB transfered and ready for etching.... um lets etch it MAKE YOUR OWN ETCHANT: Supplies +Muratic Acid (image 1) +Hydrogen Peroxide (image 2) +PLASTIC measureing spoon (CANT BE METAL CAUSE THE ACID WILL EAT IT!!!!!) (image 3) +and a PLATIC bowl (SAME REASONS) 1) Measure out 2 quantities of hydrogen peroxide and pour it in your bowl. 2) Measure out 1 quantity of muratic acid. Ex. 2 tbls of hydrogen peroxide, and 1 tbls of muratic acid. Keep in mind the 3 A's from high school chemistry class Always Add Acid always pour acid into water or what ever you mixing not water into acid! 3) Now you have your own etchant solution. ETCHING THE PCB: 1) Go ahead and pour some etchant into a tuper ware bowl (if you made it you should already have it a bowl) 2) Use a plastic fork to slowly lower the PCB into your etchant solution. being carful not to splash. 3) Let it sit in the solution until you canot see any more copper, ecationaly lifting the board with the plastic fork just to get it all even. 4) Once you think its done remove the board and rinse it off with water. 5) get the brake cleaner and spray some on the board and scrub with a paper towel untill all the toner is off. Checking to make sure that all your traces are good and not broken. yess we are so close to finishing this thing i can almost taste it. Image Notes 1. found this at the pool section at home depot Image Notes 1. regular dollar general stuff http://www.instructables.com/id/Arduino-Projects/ Image Notes 1. first 30 seconds Image Notes 1. 1 minute 30 seconds into the proccess Image Notes 1. done! after about 10 minutes http://www.instructables.com/id/Arduino-Projects/ Step 7: Drilling holes DRILLING HOLES: this step is pretty self explanatory but.... 1) I would rather use a fine drill bit but those are hard to find so I went to the hardware store and bought a dremel bit set for 5 bucks. (image 1) 2) Pick out the bit you want making sure that its not too big or too small, and put it in your drill press. (image 2) 3) I put a piece of wood under my PCB (not actually the PCB cause I forgot to take pictures) so that it will be on a flat surface. 4) Drill all the way through the tabs where we will put our header pins. DRILL DRILL AWAY. (image 4) Image Notes 1. OUR VICTIM!!!! MWA HA HA HA HA!!! 2. this is the reason for the wood board so that we arnt bending the PCB when ever we go to drill though it. Image Notes 1. battle wounds 2. battle wounds 3. battle wounds 4. battle wounds 5. battle wounds 6. testing out some paint for my mame machine Image Notes 1. WOW whos that good lookin drill bit? Image Notes 1. drill these Step 8: Soldering on the header pins SOLDERING ON THE HEADER PINS: +header pins +soldering iron +electronic solder (with flux perferd) this is kinda a pain cause we dont have the privalage of through hole soldering, so we have to solder on both sides of the PCB. 1) place your header pin in the board 2) Solder in each pin on the side that says "TOP" 3) let cool 4) turn the board over and romove the black plastic it should just slide right off. 5) here comes the sort of hard part. solder the bottom of the pin and try to keep it relativly straight, or else it woulnt fit in the arduino. You must to this because we have a double sided pcb. 6) try inserting it into the arduino and if it doesnt fit heat up the solder and adjust the pins as needed. http://www.instructables.com/id/Arduino-Projects/ Image Notes 1. top solder job should look somewhat like this Image Notes 1. and bottom somewhat like this Image Notes 1. analog pin 5 2. analog pin 4 3. analog pin 3 4. analog pin 2 Step 9: Testing The adapter If you dont have the Arduino program installed yet then go to www.arduino.cc/en/Guide/HomePage and follow the arduino getting started tutorial. Part I 1) DOWNLOAD these 2 files www.megaupload.com/ www.megaupload.com/ 2) Create a new folder called "WiiChuckDemo" without the quotes. 3) Place those 2 files in the folder 4) Open up arduino IDE and goto file> open> and open "WiichuckDemo.pde" 5) Upload that sketch to your arduino 6) we are done with part 1 Part II +various jumper wires +4 leds +the nunchuck adapter +bread board or protoshield +and a wii nunchuck 1) Plug in the adapter into analog pins 5,4,3, and 2 like image 1 shows. 2) Now were are going to put in all our ground jumpers, in a "daisy chain" style. (image 2) 3) Now put in all the wire going from the LED's positive legs to there coresponding pins on the arduino. (image 3) UP led= digital pin 4 DOWN led= digital pin 5 LEFT led= digital pin 2 RIGHT led= digital pin 3 http://www.instructables.com/id/Arduino-Projects/ 4) Now its time to place our leds into the bread board making sure that the short leg or the flat side on the led is in the ground, and the long leg is in the positive (or the wire going to the arduino digital pins) (image 4) 5) plug in you wii nunchuck 6) power up your arduino 7) and hopfully it will work if now leave a comment and i will try my best to help you. 8) heres a demo video Image Notes 1. analog pin 5 2. analog pin 4 3. analog pin 3 4. analog pin 2 Image Notes 1. right led here 2. up led here 3. left led here 4. down led here Image Notes 1. connected to ground pin on arduino 2. i will flip this upside down when i connect it to the arduino so everything is kinda flipped Image Notes 1. flat edge 2. flat edge 3. flat edge http://www.instructables.com/id/Arduino-Projects/ 3. digital pin 3 4. digital pin 4 5. digital pin 5 6. digital pin 2 4. flat edge 5. long leg 6. long leg 7. long leg 8. long leg Related Instructables Using WiiChuck Adapter with Arduino by josestude Mario Bros. costumes with sound effects by Wireless Wii Nunchuck RobHopeless controlled Arduino by XenonJohn Wii Nunchuk Controlled Model Train by aspro648 Control Your Robot Using a Wii Nunchuck (and an Arduino) by oomlout Wii chuck controlled Airsoft gun turret :D (video) by demonxkid Wii Nunchuck as general purpose controller via Arduino board by XenonJohn The WiiBell! by HeyJBay http://www.instructables.com/id/Arduino-Projects/ Addressable Milk Bottles (LED Lighting + Arduino) by Nachimir on March 30, 2008 Author:Nachimir author's website I live in the UK, and work for a games consultancy. I used to take my toys apart and put them back together when I was a kid, nowadays I try to do the same with emotion, motives and culture. I also have this habit of trying new things. I'm an utter neophile when it comes to functionality, but I have taste for retro aesthetics. Customisation is important to me. As well as making things more special, it keeps many skills alive, relevant and coexisting with global economies of scale. It, and all of the open source, sharing type stuff enshrined by sites like instructables, keep culture healthy. Also, things I've bought are my property and I'll do what I like to them, regardless of cruddy EULAs, or warranties. Intro: Addressable Milk Bottles (LED Lighting + Arduino) Make PPE milk bottles into good looking LED lights, and use an Arduino to control them. This recycles a number of things, mainly the milk bottles, and uses a very low amount of power: the LEDs apparently dissipate less than 3 watts but are bright enough to see by. Among other things, I wanted to see if I could make an electronic light feel more human friendly than most, and found rotary controllers are a good way of doing this. PPE milk bottles make for a cheap yet aesthetically pleasing way to diffuse LED lighting. Especially if you can find nice round ones :) Modding an object with LED lighting is not only environmentally friendly, but also much more straightforward than building a housing from scratch. Because LEDs are tiny, you can put them almost anywhere, and they don't produce much heat as long as they're spread out and running at the correct voltage. This instructable will deal mainly with physical design and production, and I'm going to assume you have a basic knowledge of creating electronic circuits and LED lighting. Since the exact LEDs and power supply you use will probably vary, I'll only go into the basics of my circuit in terms of specs. I'll also try to point you to useful resources, and explain more about the Arduino microcontroller and code that tells them to work in sequence. The electronics of basic LED lighting are really simple, similar to elementary school electronics, so probably won't take long for you to pick up at all. http://www.instructables.com/id/Arduino-Projects/ Step 1: Tools and Materials To manufacture the lights themselves, you will need: PPE milk bottles Sheet of 3mm clear acrylic 2 core electrical cable (or speaker wire will do - it can be fairly light duty since it will only take about 12v and very little current, depending on how you design your circuit). LEDs Resistors Solder Heat shrink tubing An old transformer (wall wart to Americans), plus socket+plug to go with it. Braided copper wire Solid core bell wire Zip ties Tools you will need: Drill Hole cutter (matched to the width of your milk bottle caps - see step 2) Assorted tiny drill bits Junior hacksaw (depending on what you use as a housing) Screwdrivers Wire strippers Side cutters/Wire clippers Soldering iron Multimeter Third hand (vital for soldering components together) Desoldering wick (if you salvage any components from other devices) Crocodile clip leads (for testing/prototyping). You also might want to make some kind of housing for them. I've tried various ways of hanging them, and settled on a bent section of PVC pipe, hung from the ceiling with holes drilled for the cables. I also tried stapling them to the ceiling. You could also hang them through a piece of board mounted on the ceiling, from conduit, or even make holes in your ceiling itself to accommodate the wires and power them from a loft. Step 5 shows and talks about a few of these options. The above is all you'll need to make some lights that work with a basic on/off switch. To give them more advanced functions such as fading or sequencing, you'll also need a load of components such as transitors and a microcontroller: Arduino mini Mini USB adapter for above, or FTDL USB to header lead. Pin header sockets Solderless breadboard LM317T voltage regulator BC337 NPN transistors All shown below but more about them and how they work together in step 6. There's also an enclosure for switch box, which could be anything you like. I saw a lovely round sacrament box in the Japan room at the British Museum, but they wouldn't let me have it. In the end I used a white plastic moo card box because it fits so well with the theme :) With such a circuit in place, there are all kinds of things you can program an arduino to do with it. I like kinetic lighting, but I find flashing christmas lights, etc., gaudy and mechanical. Their regularity and consistency is cold and unwelcoming (it must take work to create the naturalistic twinkle of good christmas lights). I don't want anything flashy (literally). I want a single, analogue control for the lights that feels very human-operated, that simply sequences the way they turn on and off. Code for that, coupled with a nice feeling dial and an aesthetically pleasing aluminium knob makes this into a pleasing toy. Image Notes 1. Croc clip leads for hooking up and testing circuits easily. 2. Zip ties, okay-ish strain relief for cables in a pinch. 3. Multimeter 4. Screwdrivers, also for general spudging of things. Image Notes 1. The holes these cut match the inner width of the milk bottle caps quite closely. 2. This kind of hole cutter, with a drill bit in the centre, is perfect for making these lights, as the resulting centre holes can be used to pass wiring through. http://www.instructables.com/id/Arduino-Projects/ 5. Soldering iron. Cordless because of gas power = easy to use. 6. If you plan on salvaging any components from old electrical devices, this desoldering wick will make it a lot easier. 7. Cutters 8. Strippers 9. Junior Hacksaw 10. Assorted drill bits 11. Third hand, vital for soldering. 12. Assorted wire. You'll want copper stranded wire for your actual electronics since it can bend without eventually breaking. You'll want solid core bell wire for prototyping with breadboard though, as copper strands break off in solderless breadboards and ruin them. 13. One of about 4 different drills I used in the course of working on this :) Image Notes 1. These holes align with discs to allow cable through from the top. Image Notes 1. You'll need the caps too of course. I don't have any pristine ones left to photograph. http://www.instructables.com/id/Arduino-Projects/ Image Notes 1. The first LEDs I used. Ugly, ugly yellowish-green off white light from these. They made me feel slightly nauseous without other light sources on in the room. 2. So I replaced them with these, which have diffused lenses instead of water clear, and give a very mellow, cool bluish white. Image Notes 1. 3mm clear perspex. Small circles of this will hold the LEDs and wiring together. Not as good as a custom made PCB, but an okay stand in for something this simple. Image Notes 1. If you don't have a socket to go with yours, you could just clip the plug off and go directly from the wires. Image Notes 1. Cheap speaker cable, great for hidden wiring and economically covering distances. 2. Two core electrical cable, more aesthetically pleasing thing to hang the lights with. Image Notes 1. 12.15v, but close enough. 2. More then enough juice. The LEDs only draw 240mA, so I could probably run four times as many plus arduinos to control them from this. Image Notes 1. Assorted resistors, and I still needed to splice to get the exact values I wanted. 2. This is all the heatshrink I had left when I was done. http://www.instructables.com/id/Arduino-Projects/ 3. Solder 4. Pin header sockets, a very good way to connect your wiring to the arduino. Image Notes 1. Arduino Mini 2. Mini USB adapter. 3. Solderless breadboard. Image Notes 1. Beautiful. Here's the potentiometer that will control the milk lights. Image Notes 1. LM317T - voltage regulator, used to produce a lower voltage supply from a http://www.instructables.com/id/Arduino-Projects/ higher one. The difference is dissipated as heat, so use a heatsink if you're going to be creating a large drop in voltage. 2. NPN transistor, put between the circuit and earth connection to act as a switch. This is what the Arduino will use to control the lights. Step 2: Cut and Drill Perspex First of all, we're going to cut some perspex discs to go inside the caps on the milk bottles, then drill holes through which we can mount the LEDs and cable. When using the hole cutter, drill into a piece of wood. Pressing your material against something like this while you cut will help to keep the back edge neat. Softwood also lets you know when you've gone all the way through, as you can really feel the way the drill bites changing as it reaches the wood. Once your discs are ready, make hole in all your milk bottle tops to match the centre holes in the perspex. You also need to drill holes ready for the wiring and LEDs. What exactly you do here depends on what kind of power supply you'll be using and what kind of circuits you want to connect to it. Mine use three LEDs per light, which I arranged evenly around the disc. You need a pair of holes to pass the legs of each LED through, and two holes big enough to pass the two strands of your cable through. (See the picture for explanatory notes). I didn't use a template or anything for this, I just did it by eye with a battery drill, some small bits, and patience. Occasionally, two holes would be a little bit too far apart or close together for the LED legs, but as long as you're careful, a little bit of bending will allow them to fit. If this doesn't make sense yet, don't worry, the next step should make it clear. Image Notes 1. Wood gives soemthing for the drill to go into, and allows you to feel when it's gone all the way through. Image Notes 1. The holes these cut match the inner width of the milk bottle caps quite closely. 2. This kind of hole cutter, with a drill bit in the centre, is perfect for making these lights, as the resulting centre holes can be used to pass wiring through. Image Notes 1. An almost perfect fit. It doesn't matter if they're not absolutely perfect. http://www.instructables.com/id/Arduino-Projects/ Image Notes 1. These holes align with discs to allow cable through from the top. Image Notes 1. Cable cores 2. Cable 3. LED 4. LED 5. LED Step 3: Mount LEDs Now, pop the LEDs through the holes, being careful to observe polarity. We're basically going to daisy chain them, with each negative leg on one LED connecting to the positive leg on the next. How many you daisy chain like this, if at all, depends on the voltage of the power supply you use. Mine is 12v, and my LEDs have a forward voltage of 3.3, so the 9.9 volts of three LEDs is the maximum my supply can handle. They'll also need a resistor to bring the circuit up to 12v. You should definitely have a resistor on each bottle, because if you don't the LEDs will burn out or at least run hot (and brighter). I tried this with an early prototype, and they ran hot enough without a resistor to melt the PPE of the bottle cap. You can use this handy LED calculator to work out what to do with your own circuit: http://led.linear1.org/led.wiz The screengrab from it in this step shows exactly the values I was working with and the resulting circuit (The resistors are added in the next step). Once your LEDs are through the holes and you're sure the polarity is correct, start twisting the leads together as shown in the sequence of images for this step. The leads nearest the cable holes are left untwisted, because they will be soldered to the cable rather than each other. Keep doing this with all of them, making sure to only connect positive to negative rather than pos-pos or neg-neg. I also made sure to keep all of these lights consistent. Looking down on them, the current always goes in on the left, then clockwise around the LEDs, which are earthed through the left hole. Image Notes 1. Positive 2. Negative 3. Negative 4. Negative 5. Positive 6. Positive 7. +12v 8. GND Image Notes 1. Cross leads from neighobring LEDs 2. I filed the ends of these clear LEDs down to make them cast diffused light. They were the wrong colour though (had a sickly yeloow/green tinge), so I later swapped them out for some bluer ones. http://www.instructables.com/id/Arduino-Projects/ Image Notes 1. Twist them around each other gently, trying to flatten against the disc as much as possible without stressing them. Image Notes 1. Keep twisting until they're bound up nicely. Image Notes 1. Do this with both pairs of neighboring leads that aren't beside the cable holes. 2. Cable holes here; the two straight leads will be soldered to the cables rather than each other, so remain untwisted. Image Notes 1. One ready for soldering. 2. Current will come through here. 3. To positive lead here 4. Negative lead will earth circuit through this hole. http://www.instructables.com/id/Arduino-Projects/ Step 4: Solder Components Now we need to solder everything in place. First of all, solder all your pairs of twisted leads together, then clip off the excess. Next, strip lengths of electrical cable then thread them through the cable holes you drilled into each disc. Wrap the cables around the LED leads, with live (brown) going to the long (positive) lead of the LED string. Coil the copper around the leads, solder it in place, and again snip off any excess lead. Double your cable back through the centre hole, then slide the bottle cap down the lead and over the disc. At the other end, solder a resistor of the correct value (in my case 120 ohms) to the positive cable. The length of your cables depends on how you're going to hang your lights. As you can see in the final picture of this step, I chose to use fairly short lengths of flex, because I knew I'd be joining them to longer lengths and making housings that would conceal the joints. It's also easier to work with 12 shorter lengths, rather than 12 much longer ones. Image Notes 1. Solder twists together 2. + 3. - Image Notes 1. Snip excess off Image Notes 1. Thread cables through disc and wrap around leads, carefully making sure of the correct polarity for live and earth. Image Notes 1. Double flex back through centre hole http://www.instructables.com/id/Arduino-Projects/ Image Notes 1. Slide cap down flex and over disc. Image Notes 1. Solder resistor to end of positive cable. Step 5: Switches and Housings At this point you have a set of lights mounted in milk bottle caps and designed to run with a particular power supply. The PPE bottles, once you've delabeled and washed them, will just screw right back into the caps and act as nice looking diffusers. You could now connect the lights up with a simple switch box, as I did at first, or choose to do something more complex, like drive them using the same power supply but also a microcontroller to make them do more interesting things. Due to time constraints, I've had these lights around as a prototype in various stages of development for around 18 months, and in that time I've mounted them in two different ways with three different switch boxes. I also retrofitted them with some better LEDs, that gave a slightly bluer light and had diffused housings. Rather than detail every step of each iteration, I've put a selection of pictures in this step with notes illustrating each of them. The rest of this instructable will deal with the latest (and coolest) way I've chosen to use them: Mounted in plastic pipe and controlled individually. http://www.instructables.com/id/Arduino-Projects/ Image Notes 1. Second protoype, made without a perspex disc and all components mounted through the cap. The PPE caps are thin, weak, and melt if you run LEDs hot. There's also very little strain relief for the connections, I found that moving this around broke some of the leads easily, whereas ones made with perspex discs have been hauled around to parties and are still holding together fine at around 12 months old. Image Notes 1. The first iteration had the lights separated into three strands, controlled by these three switches. Image Notes 1. Very simple (wiring not done at this point): Power in, splits into three, switches supply three cables (box not drilled for those yet in this image, they exited from the top), all return to common earth. http://www.instructables.com/id/Arduino-Projects/ Image Notes 1. These three strands could be powered on and off independently. I found though that that lights were so dim that there wasn't much point in this level of separation. It wasn't particularly pretty or functional. Image Notes 1. Ping pong balls cut in half to hide joints. They were hole punched to take the cables, and looked pretty dodgy. Image Notes 1. For this second attempt, I used a hot air gun to bend some plastic pipe into a curve that would go from one side of my room to the main light. Each length of flex is extended with a strand of speaker cable, just the right length to go to the end of the pipe. 2. This iteration ran off a single power cable and one switch (shown in next pictures). I'd put the separate wiring in for each bottle, because I knew this setup was temporary and I wanted to hook them up to a microcontroller as soon as I had the time. 3. Completely unrelated lamp shade. It's a home made mexican IQ light variant, cut from document wallets: http://0pointer.de/blog/iqlamp-stencil.html Image Notes 1. Simple switch box made from a push fit pipe joint and two endcaps. Toggle switch + rubber cover at this end http://www.instructables.com/id/Arduino-Projects/ Image Notes 1. Power in from wall and power back out to lights at this end. 2. Cheap speaker cable Image Notes 1. Socket and switch both reused from last switch box, and socket reused again for the latest version. Image Notes 1. Messy, temporary clumps of wires for +12v and GND. 2. Crocodile clips from speaker wire to lights. 3. Yes. I also finally got around to redecorating just before building the new switch box for this. Step 6: Microcontrol, Components, Scavenging Ok, so, great. We have working milk bottle lights now. But on-off control isn't very interesting. What about dimming and sequencing? For this, we need a microcontroller, and I'm going to use an Arduino. We'll also need a bunch of components to work with it, some of which I'll scavenge and recycle from old hardware. I used a standard Arduino for prototyping and making sure I could code what I wanted to (I'm still very much a newbie at this kind of thing): http://www.arduino.cc/en/Main/ArduinoBoardDiecimila And bought one of these plus a USB adapter to go in the actual light: http://arduino.cc/en/Main/ArduinoBoardMini In case you haven't already heard of them, Arduinos are beautiful little prototyping platforms that allow you to inexpensively start learning about microcontrollers. The programming language used to tell them what to do is fairly accessible too. There's great reference on the Arduino website, and a bunch of good beginner level tutorials by Limor Friedman: http://www.arduino.cc/en/Reference/HomePage http://www.ladyada.net/learn/arduino/ So I need to redesign my circuit, more complex to accommodate an arduino mini. I want it to be able to switch them on and off according to a reading from a rotary potentiometer, which means incorporating transistors into the circuit for the arduino to trigger as switches. The arduino also runs at 5v, so I'll need to produce a regulated 5v supply from my existing 12v one unless I use two wall warts. The LM317T fits the bill; by using just a few resistors with it (detailed later) I can get it to push the right amount of voltage out for the arduino. Here's some reference on the LM317T: http://ourworld.compuserve.com/homepages/Bill_Bowden/page12.htm I've included some pictures of the components below, which are actually going to form quite a simple circuit. I've also included some photos of an old amplifier I got from a local market for 2 pounds. It has beautiful aluminium knobs that would most likely cost more than 2 pounds each, and a whole load of nice potentiometers and chunky switches to boot. Scavenging from old equipment can bag you some really nice old components for next to nothing. See the photos for a few tips. http://www.instructables.com/id/Arduino-Projects/ Image Notes 1. LM317T - voltage regulator, used to produce a lower voltage supply from a higher one. The difference is dissipated as heat, so use a heatsink if you're going to be creating a large drop in voltage. 2. NPN transistor, put between the circuit and earth connection to act as a switch. This is what the Arduino will use to control the lights. Image Notes 1. USB adapter 2. Arduino mini. You need to connect this up through breadboard to talk to it from your computer. Image Notes 1. Standard Arduino, now one model out of date (Duemilenove is the latest). Cheap and great for prototyping, not so great for squeezing inside smaller projects. Image Notes 1. These good looking aluminium knobs also have potentiometers behind them. I'm going to use one to control my lights. 2. This amp was sitting at a market stall. It had been rained on and had the cord cut out the back, the stall owner wasn't sure if it worked or not, so sold it for £2. The knobs alone are worth way more than that! http://www.instructables.com/id/Arduino-Projects/ Image Notes 1. These are very large capacitors. Do NOT mess around with these, they can easily hold enough charge to stop your heart. 2. This massive heatsink is a useful source of smaller ones :) Image Notes 1. Knobs are usually designed to just pull off and push back on. Image Notes 1. With the fascia removed, you can get at these nuts securing the potentiometers to the front panel. Image Notes 1. After much disassembly you will get something like this. Desoldering can be Image Notes 1. You can do it the messy way (if you don't mind damaging the PCB), by pulling http://www.instructables.com/id/Arduino-Projects/ an awful job, especially if you're out of copper desoldering wick. There are some tips here: http://www.geocities.com/mistertippy/howto/desolder.html on the component while desoldering all of the leads. It takes a while and only moves a little at a time, but will come eventually. I recommend desoldering braid instead though. Image Notes 1. Beautiful. Here's the potentiometer that will control the milk lights. Step 7: Transistor Circuit I can't just switch the lights through the arduino, because they run at 12v and the Arduino runs at 5v. Transistors allow me to use a smaller current to switch on and off a much larger one, without frying the Arduino. The first time I separated the wiring for the lights, I labeled each wire with a number, knowing I'd come back to them with an Arduino at some point. Since I'm using NPN transistors, which go on the earth end of the circuit, I'll need to separate out all these cables and start splicing the +12v ones together. Using speaker wire, I stuck to the convention that the black striped side of each pair would be live, whereas plain would be earth. Making and sticking to conventions like this is important so as not to get lost later. After separating all the wires out, I sawed a ragged hole in the top of the pipe for wiring. It was my intention to seal it back up with white gaffer tape, with the wiring and arduino inside, but this went a bit wrong as you'll see later. First thing was to test my circuit. The transistor has three pins: a collector, voltage out, and base. Base is the one the Arduino will talk to through a 1K resistor, collector will take current from the earth connection, and voltage out goes to earth. The test works. More information on using transistors with Arduinos here: http://itp.nyu.edu/physcomp/Tutorials/HighCurrentLoads (Note the 1K resistor between the Arduino and the base pin there) here's a primer on transistors too: http://www.mayothi.com/transistors.html So basically: Solder resistors to transistor base pins Separate ground connection for each light, and number so you can keep them in a comprehensible order. Splice all live connections for the lights together, heatshrinking over the splices when they're done (This is really important, as the wires will be packed back into the pipe it would be too probable for them to short the light out when packed if they weren't properly insulated). Build the splices down to a single connection for the +12v. Solder the collector of each transistor to the ground connection of each light, heatshrinking it too. Use short bits of wire to splice all of the transistor emitters together, building them down to a single earth connection. Next, they'll be hooked up to communicate. http://www.instructables.com/id/Arduino-Projects/ Image Notes 1. The circuit works Image Notes 1. Base 2. Collector 3. Emitter 4. To Arduino 5. To ground 6. From light Image Notes 1. Bend the legs out ready to solder to. Don't bend too close to where the lead enters the package; they usually have a little oblong on them marking where it's http://www.instructables.com/id/Arduino-Projects/ safe to bend/clip from. http://www.instructables.com/id/Arduino-Projects/ Step 8: Communication Cables Cut and strip 12 cables to solder to the resistors on the base pins of the transistors. These will be the cables that the arduino uses to talk to the transistors. Don't forget the heatshrink. Once the cables are in place, solder them to pin sockets to fit the pin headers on the Arduino Mini. I used pins 4 - 13 and pins AD0 (14) and AD1 (15) as the 12 output pins to switch the transistors. You can find the pinout for the Arduino Mini here: http://www.arduino.cc/en/Main/ArduinoBoardMini If you solder your comms wires to the pin sockets in the right order, they should plug straight into the arduino and work as intended... mine did. Phew. With the sockets completed, thread them through the end of the pipe for now, along with the live and ground connections you spliced earlier. If you have any spare pin headers around, they make it easier to use crocodile clips to test everything is still working. You can tell the arduino to set a single pin high all the time, then use one lead from it to touch the pin for each light in turn. http://www.instructables.com/id/Arduino-Projects/ Step 9: Voltage Regulation Since the lights run from a 12v supply, there needs to be a voltage regulator dropping it to 5v for the arduino. Enter the LM317T, which gives an output voltage depending on the resistors you augment it with. The difference between the input and the output is shed as heat, so sometimes these ICs need a heatsink. Here's a tutorial on the LM317: http://www.sash.bgplus.com/lm_317/tutorial-full.html and here's a handy calculator: http://www.electronics-lab.com/articles/LM317/ Once I've found the right values to get it belting out 5v for the Arduino, I solder, heatshrink, and test. 5.07v coming out, not bad. Now I know it works, I can solder it into the main bundle of wiring, taking 12v, going to earth, and having a third output that will go to the arduino. I start another header socket, putting the 5v line on it corresponding to the 5v pin on the arduino. I also connect ground from the arduino on the same socket too. Almost time to test it. http://www.instructables.com/id/Arduino-Projects/ http://www.instructables.com/id/Arduino-Projects/ Step 10: Programming I need to write some code to test with first, and to upload it to the Arduino I need to wire up some breadboard to connect the USB adapter to the Arduino Mini. See the guide to the Arduino mini here: http://arduino.cc/en/Guide/ArduinoMini and the pinout for the USB adapter here: http://arduino.cc/en/Main/MiniUSB After trying out flashing sequences with the code, etc. I settle on something like the debugged and tweaked code at the end of this instructable. Also notice how the crocodile clip tests get neater the more soldering is done. It's kind of satisfying, and also very worthwhile to test that each light still works at every stage. Testing solely at the end will leave you mystified and not knowing where to start if you do have a problem. http://www.instructables.com/id/Arduino-Projects/ Step 11: Cabling and Switchbox Now for the controls. Since I want the controls to be separate to the light, I'll need some cable. The circuit needs live and ground connections, and the potentiometer will need three connections. One of these will be live from the Arduino, one with be the connection to the analog pin that the arduino will use to read the pot. The other is earth, so that means I need just four cores going up to the light. Since I don't have any four core cable, I twist two long lengths of speaker wire together. Not perfect, but not bad. You can easily do this as shown in the photos below by zip tying the ends of two lengths of cable, putting one end under something heavy enough to hold it, then braiding the cables yourself. I'll be making the control box out of an empty white plastic moo card box I've had for quite a while. Some of the components, such as the power socket, are also recycled from previous projects. An end cap and some zip ties will serve as strain relief at the light end of the cable. I start marking out the box for the pot, then set to connecting the cables up at the light end. By stripping one pair but not the other when they're entwined, it makes it easy to identify them. One of the stripped ones will go to ground on the potentiometer in the switch box, one will go to +12v at the power socket. The other two will be signaling wires connected to the other pins on the pot. At the other end, one of these will go to the analog pin that the code tells the arduino to take a reading from, and one to +5v. Again, all heatshrinked up when in place. The pictures should show you better how I made my switch box, which almost went disastrously wrong. I tried gluing it first, and the plastic seems to be impervious to superglue... in the end, I sorted it by using a couple of rubber pads inside the box then putting a couple of PC case screws though all the layers of the box to hold them together and keep the pot in place. The power socket also needed a zip tie since I didn't have any nuts to fit the thread on it. http://www.instructables.com/id/Arduino-Projects/ http://www.instructables.com/id/Arduino-Projects/ http://www.instructables.com/id/Arduino-Projects/ http://www.instructables.com/id/Arduino-Projects/ http://www.instructables.com/id/Arduino-Projects/ Step 12: Sequenced Light Finished! More photos and video to come, and the code is attached below. The wiring, it turned out, was too big to all go back in the pipe, which is unfortunate. It means the LM317 and the arduino both stick out of the top of the pipe because it's so packed with wires and components. Squashing them in any further started to make it behave erratically, so I'm going to leave them outside. Since it will hang from the ceiling, I doubt they'll be particularly noticeable. However, I would have liked to have come up with a solution that stayed good looking while accommodating all of the circuitry. Never mind though, it works how I want it to. The simple analogue control feels pleasingly human. Notice in the code that the numbers at which things get turned on and off don't have uniform differences? That's because the pot I used turned out to be Log rather than Linear, so distributing the thresholds evenly resulted in all the activity being squashed up in one end of the pot's travel. http://www.instructables.com/id/Arduino-Projects/ Image Notes 1. I was going to use another six pin header socket here to wire the arduino up to a USB socket and a reset switch. However, I realised that wouldn't work without the FTDL chip on the Mini USB adapter. While it would be nice to have a USB socket in the side of the light to program it with, for this iteration I might as well just get a USB to header lead with the chip in instead. File Downloads milklightsketch.txt (2 KB) [NOTE: When saving, if you see .tmp as the file ext, rename it to 'milklightsketch.txt'] PWMtest-milklights.txt (1 KB) [NOTE: When saving, if you see .tmp as the file ext, rename it to 'PWMtest-milklights.txt'] Related Instructables Sprite Bottle Lamp by itsthatsguy Quick and easy homestead uses Recycled for Plastic Bottles (PET) by Christmas Tree by chaintool velacreations Water Bottle Track Lighting, by ikssk Water Bottle Hack - LED Booklight by ikssk Recycled Plastic Wallet [Its FREE] by TheBlueChild Recycle Reminder Lamp from upcycled Water Bottle by Lftndbt LED Torch Light Saber by joelogs http://www.instructables.com/id/Arduino-Projects/ http://www.instructables.com/id/Arduino-Projects/
Copyright © 2024 DOKUMEN.SITE Inc.