If you're seeing this message, it means we're having trouble loading external resources on our website.

If you're behind a web filter, please make sure that the domains *.kastatic.org and *.kasandbox.org are unblocked.

Main content

LED eyes

In this video we create and wire Bit-zee's tri-color LED eyes. Created by Karl Wendt.

Want to join the conversation?

Video transcript

OK, so now we're going to give Bit-Zee some eyes. We're going to use tri-color LEDs and bottle caps. We're matching the LED up with a drill bit so that we can put a hole in the center of the bottle cap, and the LED will basically serve as a pupil and the bottle cap will serve as an iris. So we're going to trim the excess off of the bottle cap there, the scrap that the drill bit left. And then we can put our LED in the middle of it, and we've got a Bit-Zee eye. OK, so the LED has four legs, and the long one is the positive. And that's important, because we've got to wire the LED with the right polarity. So we've got our two LEDs put onto our bread board in the far, far right and left sides. Now we're connecting three transistors. These transistors are the same transistors, the NPN type transistors, that we used for our sound module and for our camera to turn them on and off and trigger their functions. So these LEDs are going to trigger the red, blue, and green lights in the LEDs that are on both the right and left sides. So we're using 1K ohm resistors and that'll be for our base on the transistor. And that's the center wire. And right now, we're just moving the wires over for our IR sensor so that we have a little more space. And then we're going to put another 1K ohm resistor there again, going to the center pin on our resistors. And so now that we've got that done, we're going to take a look at our pin-outs. And you can see that A1 is the green LED. A0 is the red LED, and A2 is the blue LED, so we want to make sure that we wire those up accordingly so that we can get the right colors to turn on when we want them to. So we're using a green wire to indicate the green LED, and that'll go to the transistor that switches on and off the greens. And then we're using a red wire for the one that's going to switch on and off the reds, and a black wire for the one that's going to switch on and off the blues. I didn't happen have a blue wire. And you can see how those are connected to the resistors. OK, and so now we have a 220 ohm resistor, and we're going to connect that to the positive leg or the long leg of both of our LEDs, and this is going to protect the LEDs from drawing too much current and burning out. You can change the value of the resistor. We'll talk in another video about how to determine the right resistor value, but there is some variation, and if you use a resistor with a higher value, you're going to get a dimmer LED, and if you use a lower value, you'll get a brighter one. OK, so we've got those two in place. And just fitting them with our needle-nose pliers. Sometimes it's hard to get the leads to sit in place all the way. Now we're going to run our positive wire up from our power distribution board below. That's the little board that we made in a previous video. And we'll connect it to the same row as our 220 ohm resistor, and let's run one for each LED. So there's one on the right side and one on the left. And we'll connect the one on the right side, again, to that 220 ohm resistor and then sort of push it out of the way. OK, so the positive power has been fed. Now, what we're going to do is we're going to connect the ground wire from the power distribution board below to our LED that's on our far left-hand side. And that's just going to the left leg with the transistor on the left-hand side, and that's the transistor that's going to switch on and off our green. And so we have another ground wire here, and we can run that ground wire up from our Arduino, because there's a ground port there, and connect it to our transistor on this I side. And now we're going to distribute the ground wire from the far left-hand side transistor to the one in the middle. And this uses the same type of wiring that we used before when we did our sound module and cameras, as I said before. So now we're going to connect the resistor that's switching the red LED to the red LED pin, which is the one on the far left when we're looking at the LED here. And I think I had already wired the green one. You can see it down there at the bottom. It connects to the wire on the far right on that same LED. And now we're going to run the wire for our blue LED, and that's just the one right next to the green. So we're stripping the wire there, and now we're connecting it, and connecting it to the transistor that should switch that on and off. And actually, I believe we downloaded some code for this, just some sample code, and you can see it's just to make the LED light up and flash. And you can get this code from Arduino's website. It's just an LED flash, and so you need to make sure that it's set up to the right pin-outs that we've listed there. But in any case, that one works. So now we're going to connect that LED to the one on the other side. So we're going to take our green wire and run it over to the same lead on the LED on the other side. And so you'll see it only lights up green now. It doesn't light up red and blue, because we haven't run the red and blue wires. So as it flashes, it goes through red, blue, green, red, blue, green, and you can see that only the green is showing up. So now we're going to run our other two wires. We're going to run our red wire and our blue wire, and so the eyes should flash in synchronous together. So now we're going to run our red wire, and you should be able to see the red wire caused the LED to flash red and green instead of just green on the right-hand side. So there you go. You can see it's red and green, but we're still missing our blue. I'll let you take a look at that for just a second so you can see the difference between each eye as they go about flashing. So the one on the left is going red, green, and blue, and then the one on the right is just red and green. So now we're going to connect our final wire, and that will allow us to light up in red, green, and blue. One thing I want to note is that the blue LED is not as bright as the red or the green, and you can change that by putting resistors on each LED instead of on the one positive out. You can put resistors on each LED that are different values and make the blue brighter and the green and the red less bright so that they're all sort of equal, if you want. So one thing you can see there is that when I bumped it, the lights turned off. And so it's a temporary connection on the bread board, and it's possible things will come loose, so you kind of have to keep an eye on that. But it does allow you the flexibility of changing the configuration and trying different things.