top of page

2.16.21

LAB 3 - ARDUINO AND ANALOG I/O

Assignment:

This lab explores analog sensor input. You will learn to read sensor values to the serial monitor and utilize pulse width modulation (PWM) to affect outputs.

​

Objectives:

  • Read Analog sensor values using analogRead()

  • Print sensor values to the serial monitor

  • Use analogWrite() (Links to an external site.) on a PWM pin to dim an LED

  • Learn to fit an analog input reading into a single byte using the map() function

​

Deliverables:

  • A step-by-step explanation of your process.

  • Clear and informative photos and videos of each working circuit with a written explanation of the circuit does. Post the videos on YouTube or Vimeo and embed them in your post. 

  • An obvious link or embed of your Arduino code using Github Gist.

  • A schematic drawing of each circuit

Building the Circuit

Step 1: Gather Materials

phonto.png

Materials: 

1. Breadboard

2. Arduino Uno

3. USB Cable

4. 10k Ω resistor

5. Light Dependent Resistor (LDR) 

6. Potentiometer

7. 220 Ω resistor (x2)

8. LED (x2)

9. Jumper wires (x12)

Step 2: Set up Potentiometer

File_000 (5).jpeg

1. I used my blue jumper wires to identify connections for the potentiometer.

2. The single leg is going to the analog input A0 in order to listen to the position of the wiper to determine voltage.

3. One of the two legs on the other side is going to ground (negative terminal) and the other is going to the positive terminal.

Step 3: Set up LDR

File_001 (6).jpeg

1. I used my white jumper wires to identify connections for the LDR.

2. I used the 10k Ω resistor and made sure it was in series with the LDR.

3. I connected one of the jumper wires that's in line with the LDR and resistor to analog input A1.

4. I then connected a wire from the resistor to the negative terminal and another wire from the LDR to the positive terminal.

Step 4: Set up LEDs

File_003 (1).jpeg

1. I used a yellow jumper wire to identify the connection for the yellow LED and a green jumper wire to identify the connection for the green LED.

2. I used two 220 Ω resistors and bridged them from one side of the breadboard to the other.

3. I inserted my LEDs and made sure the long leg was facing the resistor and the short leg went to ground (negative terminal). 

Step 5: Complete the Circuit

File_002 (3).jpeg

1. I used red wires to identify connections for the positive terminal and black wires to identify connections to the negative terminal.

2. For the red wires, one is going from the 5V pin on the Arduino to the positive terminal on one side of the breadboard. The other red wire connects the positive terminals on each side of the breadboard. 

3. For the black wires, one is going from the GND pin on the Arduino to the negative terminal on one side of the breadboard. The other black wire connects the negative terminals on each side of the breadboard. 

Step 6: Schematic Diagram

IMG_1676.jpg

Coding in Arduino

For this section of the lab, we had to code the potentiometer and LDR to impact each LED when manipulated.

Video of LDR Impacting Yellow LED:

Video of Potentiometer Impacting Green LED:

bottom of page