logic over the next few chapters, we encourage you to think back to this project and brainstorm ways you can elaborate on it with what you learn.
3 The Nine-Pixel Animation Machine
We use monitors every day, on our phones, computers, tablets, and TVs. The displays on most present-day monitors are composed of millions of pixels , short for picture elements . Pixels are tiny points that the computer can light up in different colors; all the pixels together make up the text, images, and videos on the screen.
In this project, you’re going to build a simple monitor using LEDs. You’ll expand on your work with blinking LEDs and learn to use custom functions in Arduino. Finally, you’ll learn how to display secret characters on your very own Nine-Pixel Animation Machine. You can see ours in Figure 3-1 .
FIGURE 3-1: A completed Nine-Pixel Animation Machine
You can use the Nine-Pixel Animation Machine to show letters and numbers, draw basic geometric shapes, and make plenty of other fun pixel art.
MATERIALS TO GATHER
For this project, you’ll need a few more electronic components than you used in Project 2 , specifically more LEDs. This project is simpler in terms of enclosure construction, however. The materials you’ll need are shown in Figures 3-2 and 3-3 .
NOTE
In our project all the LEDs are the same color so the patterns are easier to see, but if you don’t have nine LEDs of the same color, you can mix them up.
Electronic Parts
• One SparkFun RedBoard (DEV-13975), Arduino Uno (DEV-11021), or any other Arduino-compatible board
• One USB Mini-B cable (CAB-11301 or your board’s USB cable; not shown)
• One solderless breadboard (PRT-12002)
• Nine LEDs, preferably of the same color (COM-10049 for a pack of 20 red and yellow LEDs)
• Nine 330 Ω resistors (COM-11507 for a pack of 20)
• Male-to-male jumper wires (PRT-11026)
• Male-to-female jumper wires (PRT-09140*)
• (Optional) One 4 AA battery holder (PRT-09835*; not shown)
NOTE
The parts marked with an asterisk (*) do not come with the standard SparkFun Inventor’s Kit but are available in the separate add-on kit.
FIGURE 3-2: Components for the Nine-Pixel Animation Machine
Other Materials and Tools
• Pencil
• Craft knife
• Metal ruler
• Wire cutters
• Glue (hot glue gun or craft glue)
• Graph paper (not shown)
• (Optional) Drill and a 3/16-inch drill bit
• (Optional) Soldering iron
• (Optional) Solder
• (Optional) Helping hands (not shown)
• Cardboard sheet (roughly 8 × 11 inches, or 20.5 × 30 cm; not shown)
• Enclosure template (see Figure 3-13 on page 83 )
FIGURE 3-3: Recommended tools
BUILD THE NINE-PIXEL ANIMATION MACHINE PROTOTYPE
This simple pixel art display will teach you to manage lots of wires in one circuit, which is important as your circuits grow larger. First, you’ll use the breadboard to make sure the circuit works, test a sketch, and get comfortable with all of the jumper wires. (We’ll show you how to transfer the LEDs to a display housing in “ Cardboard Construction ” on page 83 .) Notice that the circuit diagram in Figure 3-4 looks a lot like Figure 2-6 on page 43 . That’s because this project uses the same LED circuit, but instead of just three LEDs, it uses nine LEDs, each of which is independently controlled by a pin on the Arduino.
FIGURE 3-4: Schematic diagram for the Nine-Pixel Animation Machine
In this section, you’ll use the breadboard to connect all nine LEDs to pins on the Arduino. With your components and jumper wires in hand, build the circuit in Figure 3-5 on your breadboard. If you want to practice building smaller LED circuits first, flip back to “ Connect the Red LED to the Breadboard ” on page 44 for a refresher.
FIGURE 3-5: Nine LEDs connected to the Arduino, with the pin 13 LED at the top and the pin 5 LED at the bottom
Wiring up nine LEDs can make for a cluttered breadboard. To keep your breadboard organized, connect the ground rail (–)