Introduction. Photocells are light-sensitive, variable resistors. As more light shines of the sensor's head, the resistance between its two terminals decreases.
Table of contents
- Arduino Tutorial - Lesson 3 - Breadboards and LEDs
- Recent Comments
- How to Hookup Light Dependent PhotoResistor (LDR) to an Arduino
But when the potentiometer is wired as a rheostat, only two connections are needed. Either side of the variable resistor may be attached to the circuit board, with the remaining side unattached or grounded, but it is important to always connect the wiper.
The wiper must be grounded or affixed to the voltage source. For example, you can attach the left terminal of the pot to the voltage source and the wiper to ground, or use the right terminal instead of the left. Changing the side affects the direction of rotation for the potentiometer's maximum resistance. In the exercise below, you will practice wiring the variable resistor in different ways in a series circuit.
Begin constructing the schematic on the left by first connecting the battery holder not shown to the breadboard. Connect end 1 of the potentiometer to the voltage source, and attach the wiper terminal 2 to ground. Leave terminal 3 disconnected. Place the limiting resistor and LED combination into the circuit. Do this by adding the resistor in series, and by connecting the positive terminal of the LED to the resistor, and its negative terminal to ground.
Arduino Tutorial - Lesson 3 - Breadboards and LEDs
Secure the battery to the battery holder. Turn the knob on the variable resistor and observe how the LED changes its brightness. Ground terminal 3 by adding a wire or by moving the connection to the appropriate place on the breadboard. Once more, test the circuit. Repeat all of the preceding steps, but this time use the wiper for the voltage source, terminal 3 for ground, and leave terminal 1 disconnected. Alternatively, just switch the end terminals; use 3 for the voltage source and leave the wiper grounded.
Observe how you now have to switch the direction of the knob to achieve the maximum voltage. You may wish to test the actual resistance of the potentiometer before using it. Do this with the use of a multimeter.
Imagine such a one-way street with a traffic policeman in front. If you want to turn onto the street the wrong way, he will not let you. Likewise the diode simply does not let current go through it the wrong way. Current in a diode can only flow from the positive side to the negative side. If you place the LED in backwards it won't work. Diecimila Arduino users already have the LED a very very small one soldered onto the circuit board the right way.
Its a tiny LED. As we mentioned before, its easy to figure out which side of an LED is positive and which one is negative. The positive leg is slightly longer and if you look inside, the chunk of metal is larger on the negaive side. We're going to now use the breadboard to light up an LED. You will need a breadboard, an LED and a 1. If you have a protoshield, make sure its assembled first.
Then, place the tiny breadboard on top. You can remove the backing to stick it on which is permanent or you can just use double-sided tape. If you have a regular breadboard you'll need 2 jumper wires as well. While LEDs will not work when placed backwards, you don't have to worry about whether it will be damaged: However, using an LED without a series resistor is a sure-fire way to kill it! You'll see a bright flash and it may turn dark Always use a resistor! We'll cover how to figure out the best resistor value later on.
Place the resistor and LED as shown. Make sure the longer leg of the LED is to the right, connected to the resistor. The resistor doesn't have a direction, so it doesnt matter which way it goes in. Click for a high resolution photo if necessary!
If you're using a standard breadboard, you'll need to use wires to reach the Arduino. Run one wire red to the 5V socket on the Arduino. Run the other wire black to one of the GND sockets on the Arduino. The colors aren't essential but they will help you remember what the wires are connected to! Hooray, you just built your first circuit! Its quite simple but still worth explaining.
Basically you've connected the LED and resistor in series one after the other to a 5V 'battery'. The positive pin of the LED is connected to the positive terminal of the battery, then the negative pin is connected to a resistor which goes to the negative terminal of the battery. The battery is supplying the current that flows through the LED, making it light up. The positive and negative battey terminals are often called the power supply , as they supply power to our circuit.
The positive terminal is called power as thats where current flows from and the negative terminal is called ground , as it is where current flows to. Lets say you want to "save" this design and send it to a friend to check out and build for herself But a better way is to draw a wiring diagram.
Then it wouldn't matter if your camera wasn't very good. A wiring diagram is also known as a schematic. Schematics are the standard method for people to trade information about circuits. Being able to read and write schematics is a key skill! Here is a schematic for a really big project, a Roland TB synthesizer clone. Each electronic component has a schematic symbol, which is a simplified drawing of the part. For resistors the symbol looks like this:. LED symbol, positive pin on the left, negative pin on the right. You can see that the resistor symbol is symmetric, just like resistors themselves.
The LED symbol, however, has an arrow thing going on. This is the direction in which current flows. The little arrows that are coming out of the symbol indicate that this is a diode that emits light. Power and Ground symbols. The only thing we need to do now is indicate how the LED and resistor are hooked up and show the 5V and ground connections. Next to symbols, we often write important information like what the resistor value is, what color and size the LED should be, and the voltage associated with the power supply.
- Related Content.
- radiometric age dating techniques.
- find dating online;
- Parts List?
A well documented schematic! Before you change your breadboard, make a guess of what will happen: Will the LED stay lit? Will the LED go out?
How to Hookup Light Dependent PhotoResistor (LDR) to an Arduino
Now make the change to your breadboard:. You will notice that, in fact, the LED has gone out. That is because it is no longer connected to a power source and current is not flowing. If you were very fast at it, you could make the LED blink! Start up the Arduino software again and open up the MyBlink sketch from lesson 2. If you left it with delay times of 10ms, you may want to modify it so its back to ms on and ms off. Upload the sketch to your Arduino. Now change your breadboard wiring so that it matches this schematic. That is, instead of connecting the resistor to 5V or ground, connect it to the Arduino pin socket labeled You should see the LED turn on and off.
Lets look at that code again. We didn't quite explain what digitalWrite does, but now it should be clear: You may want to think about how cool it is for a few moments. The LED isn't be blinking anymore! Go back to the beginning of the sketch and find this line again. This is the line of code that indicates which pin is connected to the LED. Change it so that it is now connected to pin Re-compile and verify the sketch, then send it over the the Arduino. The LED should now be blinking again. Thats because its connected to pin 13 only! OK sure you've had plenty of practice messing around with LEDs.
It's time to go full color! Find a red, green and blue LED. You can't tell which one is which until they are lit so just build the circuit and then rearrange them if needed. Red, green and blue LED schematic. In this schematic we will have three LEDs connected to three different pins: Quick quiz What does this sketch do? Compile and upload the sketch to test your hypothesis. Highlight the text below to see the answer It blinks the two LEDs connected to pins 11 and 12 at the same time.
Add the line of code that will create a variable called bluePin. What pin should it be assigned? Examine the schematic above to find out. Add the line of code that will tell the Arduino that bluePin is a digital output. Compile and verify your code. If not use your debugging skills to figure out what is wrong and fix it!