Arduino Halloween Pumpkin

by Arghuino in Circuits > LEDs

1728 Views, 14 Favorites, 0 Comments

Arduino Halloween Pumpkin

Halloween Title Image.png

Hi it's me Captain Arghuino! Let's continue from where we left off last week with our lesson on transistors and let's make a nightlight or a colorful pumpkin for Halloween. Follow Leddy and Darling as they explain how you can use transistors to amplify the current necessary to power RGB LED strips. These LED strips are very cool and you can use them in all kinds of projects.

In our first lesson you learned how transistors can amplify a small current entering the base and have the flow between the collector and emitter be much larger. In order to control powerful LEDs like the LED strips, you need to add transistors between your microcontroller and the LEDs.

You will need for this project:

  • 1 Arduino board
  • 1 Arduino prototype shield (or a custom RGB LED shield)
  • 3 NPN transistors (i.e. 2N3904)
  • 3 4K7 Ohms resistors
  • 3 5V RGB LED strips
  • Wooden lamp structure (optional)
  • 1 pumpkin
  • 1 AC Arduino Adapter

This lesson is an extract of Volume 7 of the Island of PodPi, a series of adventures in learning STEM. The first comic book series on teaching kids JavaScript and Electronics.

Why Do I Need Transistors?

ED7_C_P02-03 (1).png

Using your Arduino board, you can control all sorts of components from LEDs, sensors and servo motors. However, your board can only supply a maximum of 40mA per pin and a total of 400mA per board. While this may be enough for a few LEDs for testing and learning, it is not powerful enough to control a full LED strip.

Depending on the strip you use each LED may add 15mA to 20mA. If you have a strip with 8 LED, this can amount to 160mA, way above what the Arduino is able to produce per digital pins.

Why is that? The Arduino digital pins are not designed to power components. They are designed to receive and send digital signals with low current at fast speeds. Transistors or other power devices are then used to interface the microcontroller with components that consume larger amounts of current.

Order a few transistors. They always come in handy.

How Do I Connect My Transistors?

ED7_C_P10-11.png

Refer to our previous Instructable on how to setup your very first transistor. In the picture above Darling provides you with the schematic (the logical connections) and the physical layout of the components of the Arduino prototype shield.

Each color in the RGB strip (Red, Green and Blue) will have its own channel. That is, each transistor will power a single color with multiple LEDs. In this configuration, we decided to use 5V LED strips to avoid using a separate power supply. Some LED strips come in configurations of 6V and 12V. These strips required an external power supply to power the LEDs. For our project, the 5V work very well.

Access the high-resolution comic here.

Let's Connect the RGB Strip

ED7_C_P14-15.png

It's now time to connect the RGB strip to our breadboard. Now you can test each color by holding the wires going to the base of the transistors and the 5V power supply. Each transistor will amplify the current enough that you can control each color with just your fingers. Try it out, it's fun! (Use the same concept as the High-Five Instructable)

Access the high-resolution comic here.

Connect Your Arduino Digital Pins

ED7_C_P18-19 small.png

Now, it's time to connect the transistor bases to the the Arduino digital pins. This will allow you to control each color using the Arduino software. We will use pins 9, 10 and 11. These pins are PWM enabled. PWM allows you to pulse the colors to make smooth transitions. In this step, add a 4K7 Ohms resistors to each transistor base and connect the other side to one of the digital pins.

Access the high-resolution comic here.

What Is an Arduino Shield?

ED7_C_P22-23.png

An Arduino shield is a custom electronic board that connects on top of the Arduino to provide custom functionality. In this Instructable, the RGB LED shield already has the transistors, resistors and connections to the digital pins so that you can use your Arduino board as a nightlight or as a light source for your Halloween pumpkins.

Access the high-resolution comic here.

If you want to solder your own boards, Captain Arghuino shared the design on OshPark.

If you want to order a complete kit including the Arduino, you can find it in my stash.

(Optional) Add the Lamp Structure

ED7_C_P24-25.png
Halloween Pumpkin Steps.png

Assemble the lamp structure (optional) if you want to use it as a nightlight. For your pumpkins, you can use it or skip this step.

Access the high-resolution comic here.

Program Your Lamp

ED7_C_P26-27.png
Halloween Closing Image.png

It's now time to program you lamp. We suggest using the code attached from Clay Shirky.

For questions, visit Captain Arghuino at http://www.podpi.com

Downloads