drag2share: How to Start Making Your Own Electronics with Arduino and Other People's Code [Video]
The annual Consumer Electronics Show is in session, which means thousands of people have descended on Las Vegas to stare at next year's dust-gathering trash. Maybe you can do better. Maybe it's time to check out Arduino.
The word Arduino may conjure up an image of a wide-mouthed geek huddled over a work table, but its simplicity makes it an entry-point into electronics for even the most electronically inept. We'll outline the basics of the Arduino itself, what the crazy jumble of wires means, and then step through how to use other people's code and schematics to build your first electronics project, no programming required.
We've featured our share of clever Arduino hacks over the years. While the process for many of them might seem overwhelmingly complicated and abundantly geeky, it's surprisingly easy to get started. For this guide, we're going to walk step-by-step through how to use an Arduino to create an ambient light display (see image at right) that runs off data from your computer. This project takes the color information from your computer and lights up a strip of lights behind the display with a similar color. It can help reduce eye strain by increasing the light behind your computer, but it also makes a great visual addition to your movie-watching experience (which is why the feature is a selling point on some TVs). Before we dive into that project, let's quickly run through the basics behind the Arduino, and some of the various projects you can undertake using only other people's free, open-source Arduino code.
What the Heck Is an Arduino?
To the uninitiated, an Arduino looks like a crazy little machine that connects to a small piece of plastic with tiny wires. Once you have a kit in your hands, it starts to make a little more sense.
At its core, the Arduino is a small, programmable microcontroller board that accepts and stores code from your computer capable of cool outcomes ranging from controlling lights to making music. The board, the programming language, and most projects you find online are open-source. This means you can edit and use them to suit your own needs. Because it's open-source, simple, and has a $25 price tag, Arduino has become a go-to tool for creating and sharing electronics-based DIY projects.
The Arduino itself is a physical board that connects to your computer through a USB cable and downloads code from an application on your PC. You can find installation walkthroughs for Windows, Mac, and Linux on the official Arduino site. The software, also called Arduino, is where you program your own code (or sketches, as the Arduino software refers to them). For Arduino beginners like us, this is where you paste the code from other people's projects. When you send the code to the Arduino from your computer, the code is stored on the Arduino itself. You can upload and delete code from your Arduino as much as you like.
To get started, I recommend purchasing one of the larger starter bundles so you have all the different pieces you need to run most projects. Adafruit's Experimentation Kit ($85.00) or SparkFun's Inventor's Kit ($94.95) both include a good assortment of parts and guides to using them. In addition to what you get in those, it's good to keep a multimeter ($15) around to test the electric components and a soldering iron ($9.95) to make wire connections with solder.
Cool Arduino Projects You Can Pull Off Using Other People's Code
While you could (eventually) learn to code Arduino projects yourself and make your Arduino do almost anything, you can also simply piggy back off open-source projects already available (that's what this budding Arduino user has done). Programming knowledge isn't required to get started with an Arduino. You just need a little patience. Project complexity varies, but most can be accomplished exclusively with an Arduino and a computer.
As a beginner myself, many of these projects seemed a bit overwhelming, but I tried my hand at both the Luminch One (interactive lamp), the amp mod, and the PC ambient light with success. Since I typically wake up before the sun is up, my next project is the sunrise alarm clock so I can smooth over the process of getting out of bed. Here's a small taste of some of the simple Arduino projects you can do yourself, no programming experience necessary.
- Turn off an idle home theater amplifier: If you're anything like me, you consistently leave your amplifier on after listening to music or watching movies. This clever Arduino hack monitors the audio levels and turns off your amp when it's not in use.
- Monitor your computer's heat: You can use programs to monitor your computer's heat, but if you're looking for a fun and flashy way to tell you what's going on, this project uses an Arduino to monitor the temperature inside your case. If it gets too hot, it lights up so you know what's going on.
- Sunrise Alarm Clock: Waking up to an alarm sucks no matter how used to it you are. The sunrise alarm clock solves the problem by warming up the room with sunrise-like colors and lights before an alarm goes off. This one looks a bit complicated because of the number of cables, but as long as you can keep track of everything it's surprisingly easy.
- Luminch One wave controlled light: The Luminch One is an interactive lamp you can control by waving your hand to control the brightness. This project appears fairly complicated on first glance, but the bulk of the difficulty is assembling the lampshade out of balsa wood.
- PC Ambient Lighting: Adding ambient lights to a PC can make your video watching experience exceptionally cool. Using an Arduino and a little code on your PC, it monitors your screen and creates lighting behind your monitor. We're going to walk you through this project by Rajarshi Roy's project in the next section.
-
Build PC Ambient Lighting for Your Own Computer
While many people like to use Arduino to power their own ideas, an Arduino can also be used as a tool to accomplish projects where someone else has done all the hard work. Think of the Arduino here as an Allen wrench in an IKEA box. All you have to do is follow the directions and you get the correct results. Let's take a look at what parts you need for the PC Ambient Lighting project.
The Parts You Need
- Arduino
- 13 Jumper Wires ($6 for a pack of 75): You already know what a wire is, but wires are the bread and butter of making Arduino projects work. You use wires to connect the Arduino to the breadboard and create the circuits that make everything communicate. This is why you see movies where they need to cut a wire to stop a bomb from exploding. If you sever a connection it can stop the entire system from working.
- RGB LED Strip ($15.95): This is the core of our project. This strip of lights will light up with the same color as your computer screen and make it seem like the screen is bigger than it really is. Individual LED lights are common in Arduino projects because they offer proof a circuit works.
- Soldering iron and solder ($9.95): A soldering iron is used to create new and permanent connections between parts using solder. Generally you don't have to do anything more complicated than connect one wire to another for Arduino projects. You can get away with electrical tape for this project if you need to, but soldering is always the better choice.
- Breadboard ($5): The breadboard makes connections between different electronics without soldering them together. It's made up of a grid of tiny holes where you can connect different components. These holes are all linked like a small Lite-Brite. On the outside of the board, they're linked horizontally so that one end of the board is connected to the other. On the inside they're linked vertically. This makes it so one wire can send information to another component without having to physically connect them. The one in the picture to the right is a mini breadboard we experimented with, but this project is easier with a regular sized breadboard.
- LED Circuit Driver (60¢): Circuit drivers are used in place of complicated electronics code. A number of different types of circuits exist, but for this project we're using the LED driver so it can control the lights without a lot of extra work.
- 12V DC Power Supply ($5.95): This is your standard 12V power supply. You might even have one lying around the house you can use for this project. You can find the voltage on the back of a power supply brick or beneath the tongs under "output." We are using it to directly power the LEDs, which is why you won't be connecting it into the Arduino itself.
- DC Barrel Jack Adaptor (95¢): This adaptor connects the power supply into the breadboard directly so you don't have to splice the power supply cable in half and do it yourself. It's optional, but simplifies the project a little.
Step Zero: Install Arduino, Processing, and the Arduino Drivers on Your Computer
Download and install the Processing and Arduino software if you haven't already. You also need to download the Arduino compatible USB drivers so your machine can properly interface with the Arduino. If you're having trouble getting the software to work, refer to Ladyada's excellent guide for the initial setup process for Arduino.
Step One: Copy, Paste, and Run the Code in Processing
Open up Processing on your computer. Copy and paste the Processing code (it's the orange text) from Rajarshi Roy's blog into Processing. Click Sketch > Run. This will open a small window on your computer screen displaying the most prominent color currently on the screen and will eventually export it out to the Arduino. If the window doesn't open up on your screen, the program isn't running. Repeat the steps and make sure it's properly building the script.
Step Two: Copy, Paste, and Run the Code in Arduino
Open the Arduino software and paste the Arduino code (the text in the box near the bottom of the post) into a new sketch. Click Sketch > Verify / Compile to make sure the code is properly in there. Save the file and then attach the Arduino to your computer with the USB cable. Click File > Upload. Now everything is ready on the software side. For now, you can disconnect the Arduino from the computer because we're going to get the circuit put together.
Step Three: Connect the Circuit Driver and LED Strip to the Breadboard
Putting together the circuit is the most intimidating part. Thankfully, Rajarshi provides us with a high resolution image to copy from. If the picture is still to confusing for you, we've simplified it more. You can click the image to the right to enlarge it for an easy to understand view of what to do.
Start by connecting the circuit driver onto the center of your breadboard, this will be your point of reference for everything else. Next, we're going to prime the LED strip by doing some very lightweight soldering. With a soldering iron, four jumper cables, and the LED strip, follow this tutorial to solder and connect the jumper wires to the strip. If you're not comfortable with soldering, I had success with electrical tape to make the connections between the wires and LED strip, but this isn't a permanent solution.
Step Four: Connect All Remaining Cables
Connect all of the remaining cables exactly like you see in Rajarshi's picture. You only need to make nine connections, but if you're struggling to keep track, work from the left to the right. It's easiest if you have a similar breadboard as the picture, but it's not required. Just make sure your cables are lined up horizontally and vertically exactly like the picture.
Step Five: Connect the Power Supply and DC Barrel Jack Adaptor
The 12V power adaptor is plugged in on the upper left hand corner. Instead of splicing a cable like in the picture, we're going to plug in the DC Barrel Jack Adaptor so we don't have to worry about cutting apart a power supply. Snap the jack adaptor into the same spot as on our diagram. Then plug in the power supply.
If you want to make your setup identical to Rajarshi's tutorial, you need to cut off the adaptor end of your power supply, strip the plastic back a little with a utility knife or wirecutters, and then connect it into a terminal like this. If you're having trouble with the cutting part, this video will walk you through the process.
Step Six: Plug the Arduino Into the Computer, Run Processing and Test
With your breadboard connected to the Arduino and the power supply plugged into an outlet, plug the Arduino back into the computer with the USB cable. Next, run the Processing code we compiled earlier. The LEDs on the Arduino should be lighting up to reflect your computer's colors. Turn off the lights, throw on a movie and enjoy your DIY ambient lighting.
Troubleshooting
If something isn't working right, the comments section on Rajarshi's blog has a wide variety of solutions from other hackers and Rajarshi himself. Rajarshi also adds a few notes for the common problems you might run into (links added):
To check if the LED strip and power supply work, directly connect your power supply's +12V to the +12V pin of the strip and power supply's ground to each R,G,B pin one at a time to see if they light up.
To check if your Arduino is retaining the flashed code in its memory, make sure the simple LED blink code works after disconnecting and reconnecting to power.
The processing code works (with Arduino connected of course) if you see it run and color in box changes properly. If not, change the serial port number in the code. If it still doesn't work, check your Java installation.
If all of the above work, it's got to be your connections.
Further Reading and Sources
Walking you through a simple project isn't enough to get a grasp on everything the Arduino can do. Here are some of our favorite tutorials, stores, and forums you can turn to for help.
- Ladyada's Arduino Tutorial: For me, this was the best tutorial for getting started with my Arduino. It's a simple, linear tutorial that gets you familiar with the Arduino's basic functions. It guides you through the process to make lights glow, sounds buzz, and parts swing.
- Official Arduino Example Tutorials: The Arduino computer software is loaded with tons of examples for you to use in your own code or to run through as a learning experience. The official site walks you through every single one of the examples included with your initial download of the software. This is great if you see an example with a catchy name like tonePitchFollower and want to test it for yourself.
- Instructables' Arduino Section: Instructables' Arduino section is ripe with new ideas for projects. This is great if you want to see the types of projects other people use an Arduino for or to look for a new project.
- Make Magazine's Arduino Section: Make Magazine's Arduino section is a huge resource for new projects, explanations, guides, and tutorials. This is the best one-stop location for Arduino beginners and experts.
- Adafruit Industries: Adafruit Industries is the store started by Ladyada, whose tutorials are linked above. It's a great store for tracking down nearly any part you will ever need. It's also a good place to hit the forums to share or seek help on projects.
- Sparkfun Electronics: I've had the best luck ordering from SparkFun Industries, but that might be partially because they're based in the same state as me. Regardless, they're quick, willing to help find specific parts, and have a number of parts that are hard to find in stock elsewhere.
- Official Forums: When you're in doubt about a project or you need help to get something working, the official forum is the best place to turn. It's filled with helpful people that can critique your code and guide you through problems you might have with specific projects.
When you first look at it, an Arduino project is complete chaos, but slowing moving through the steps will expose how simple it really is. By the time you've completed your first tutorial, you have a solid understanding of the basics, and eventually you can move on to more complicated projects. In my short experience with the Arduino I've found the learning curve isn't as steep as it initially looks. I've only taken five or six projects so far (and failed at completing twice as many), but I'm now comfortable with the basics. After every completed project I get closer to cutting the quit ratio down, and hopefully it will eventually disappear completely.
Have you completed any Arduino projects of your own, simple or complex, using someone else's code or your own? Let's hear about it in the comments.
---
drag2share - drag and drop RSS news items on your email contacts to share (click SEE DEMO)