loading

The project described below is an introductory Arduino project. It is intended to give you a good idea of the capabilities of an Arduino with one simple project. The Arduino shines in the world of quick, easy and user friendly prototyping. Programming is based on the C programming language, and many function libraries are available to further ease the process. In order to compile code and run it on the Arduino follow the steps described on their home website.

The goal of this project is to adjust the brightness of an LED using a potentiometer, then capture the brightness reading using a photo-resistor, and finally use that reading to adjust the blinking speed of another LED. This project may seem trivial, but it introduces many key concepts for Arduino usage, and embedded systems, into one simple project. After completing this project, you will have a better understanding of how sensor values can be easily captured and manipulated to control output values.

Overview of steps:

1) Build circuit on breadboard

2) Compile and upload code onto Arduino

3) Test your circuit

Step 1: Materials Needed

The materials needed for this project include:

  1. Source Code (which will be provided)
  2. 1 resistor (resistance does not matter, it is a reference resistor)
  3. 1 Arduino Uno
  4. 1 Breadboard
  5. 1 A to B USB cable. (Or other cable included with Arduino to connect to computer, also used for must printers)
  6. A handful of jumper wires
  7. 1 Breadboard Potentiometer ( Pins need to be small to fit in breadboard)
  8. 1 instrument screwdriver ( if your potentiometer can not be adjusted by hand)
  9. 1 Photo-resistor
  10. 2 LEDs (chose your favorite colors)

You will need all these materials before proceeding onward. Be aware of potential hazards. Ground wires should link with ground connections, and positive wires should only be linked with positive connections. If the connections are not linked properly, the system will not function. In addition, be aware you are working with electrical equipment; if not handled properly, a spark or shock may appear. Although the shock will be harmless, you may jump out of your seat and hurt yourself.

Any potentiometer will work, the one used here is a PCB mount trimmer pot. If you use a potentiometer that has larger contacts, such as the ones found in audio equipment, you will need 3 alligator clips.

Step 2: Downloading Source Code

Before any building can occur, you must first write code that will control the functionality of the Arduino Uno. You will need a computer and Arduino IDE. Arduino IDE can be found at https://www.arduino.cc/en/main/software, and is the second option. For convenience, a the script used for this project is provided. You may write your own code or use the one provided.

If you choose to write your own code, you may use different ports on the Arduino Uno. Though make sure to check manual for Arduino Uno to make sure the ports you choose have the capability needed.

Step 3: Circuit Build Part A

Now that we have gathered all of our necessary materials it is time to build the circuit.

The most convenient way to realize most prototype circuits is to use a breadboard. It allows for solder free connections plenty of opportunities for trial and error. The two columns on the long edges of the board are called "bus strips," all holes in the column will be in electrical contact with each other. That gives you 4 long strips that can be used to make many connections, these are typically used for power supply. The inner strips on the bread board are called "terminal strips," here only the holes in the same row are in electrical contact. In addition, the center line breaks the contact between the two halves of the board.

Step 4: Circuit Build: Add Potentiometer

Connect the Potentiometer to the bread board. Take the output pin for the Potentiometer, and connect it to pin A0 on the arduino Uno. The potentiomer pictured in this guide has its middle pin as the output pin

Potentiometers act as a variable resistor, changing the output resistance based on the position of the dial, or position of the slider. In this instructable, we used a dial potentiometer. Generally, the output pin for these type of potentimoers is the middle pin, as the other two are input pins. Consult the datasheet for your model of potentiometer to find the output pin, and connect to the pin A0 on the Arduino Uno

Step 5: Circuit Build Part C

Next we will add the variable brightness LED. This LED is controlled by the potentiometer in software. It important to note that one contact of the LED is longer. The longer end is the positive lead and the shorter lead is the negative lead. So the longer end should be connected to the high voltage end while the short lead is connected to the low voltage end. In our case the positive lead should be connected to pin 11 and the negative lead should be connected to the ground, Gnd, pin.

LED is an acronym for light emitting diode, like all diodes they only permit current in one direction this means, if a diode is connecting the wrong way, no current will pass through it. In the case of light emitting diodes this corresponds to the light being off. Furthermore pin 11 is a digital output pin, it can either be set to HIGH or LOW, meaning it only as two discrete state. ON or OFF. . So how can we get the in-between values that give us varying brightness? PWM or pulse width modulation, simply put it is a trick that allows us to emulate a continuous analog value similar to when you wave your hand rapidly, it looks like it is in multiple places at once.

Step 6: Circuit Build Part D: Add Photo Resistor

In series with a arbitrary resistance resistor, add the photo resistor to the bread board. Make sure to direct the face of the photo-resistor toward the LED, in order to pick up as much light as possible. Connect one end of the photo-resistor to the 5V source of the Arduino board. Connect the other end of the photo-resistor into port A1.

The arbitrary resistance resistor is to provide a hardware baseline for the timing delay. it also helps regulate the voltage change from the photo-resistor. Putting the photo-resistor right next to the LED helps minimize background light interfering with the circuit, and will give you the best result.

Step 7: Circuit Build Part E: Attach Second LED

On the opposite end of the bread board from the photo-resistor and the LED, connect a second LED. Connect the positive terminal (the longer lead) to port 11via a jumper wire. Connect the negative terminal to the common ground, in the picture above common ground is the blue column bus.

This LED will be the blinking LED. In order to reduce interference with the photo-resistor, this LED is placed as far away from the photo-resistor as possible.

Step 8: Connect the Arduino to the Computer.

On a computer with Arduino IDE installed, connect the Arduino Uno to the computer via the type A to B USB cable. This cable is generally included upon purchase of the Arduino Uno.

Step 9: Upload Code to the Arduino Uno

Within the Arduino IDE, open the paste the .txt file included into a new Arduino script, or type up your own. Compile and upload the script to the Arduino. After it has finished uploading, the code should run immediatly. To adjust the brightness of the LED adjust the potentiometer dial. As discussed in the introduction, the changing brightness will modify the speed at which the other LED blinks.

<p>Thanks for sharing :)</p>

About This Instructable

872views

13favorites

License:

More by ENG314:Photo-Resistive-Pot-Controlled LED Blinker (PRPC LED Blinker) 
Add instructable to: