Lab 4: Analog Input

OVERVIEW:

For this lab, I practiced performing analog input with the Arduino. I created circuits using a potentiometer and varying sensors to detect light, temperature, force, and flex. The Arduino has 6 pins that can be used for analog input. These inputs take a voltage (from 0 to 5 volts) and convert it to a digital number between 0 (0 volts) and 1023 (5 volts).

For all of the circuits, the code used to program the Arduino was provided in the lab document.

PROCEDURE:

Potentiometer

For this part of the lab, I created a circuit to light an LED. A potentiometer was used to dim the LED to my liking. The potentiometer is a variable resistor. When connected to our Arduino and 5V, it reads between 0 and 5 volts dependent on the angle it is turned to. If it is turned to the middle, it reads 2.5 volts.

The schematic for the potentiometer circuit.

The potentiometer is turned and changes the brightness of the LED.

Light

For this part of the lab, I created the same circuit as above except instead of a potentiometer (twist based resistance), I used a photo resistor (light based resistance)..

The schematic for the photo resistor circuit.

The closer my finger gets to the light sensor, the brighter the light gets.

After we completed this circuit with the code given to us in the lab, we then changed the code a little to simply turn the LED on if it reaches a threshold of darkness. It turns back off once the detected light value sinks back below the threshold:

Temperature

For this part of this lab, I created a circuit that measured temperature and gave an output to the Arduino IDE’s serial monitor.

The schematic for the temperature sensor circuit.

Notice the temperature (in Fahrenheit) rises as our temperature sensor is placed in a cup of hot water.

Pressure

For this part of the lab, I created a circuit that measured pressure and lit up an LED if it detected some threshold of squeezing pressure. It uses a Force Sensitive Resistor (FSR) sensor. It is simliar to a potentiometer, except rather than varying its resistance in relation to shaft position its resistance varies with pressure.

The schematic for the Force Sensitive Resistor circuit.


The  Arduino IDE’s serial monitor displays the value of force applied to the FSR sensor.

Since I also had a flex sensor in the lab, I decided to create a flex sensor circuit. The schematic is the same as the pressure circuit except I used a flex sensor instead of an FSR sensor.

I am bending the flex sensor back and forth. The serial monitor displays the associated value of flex.

Accelerometer

For the final circuit in this lab, my lab partner and I went above and beyond. We decided to use an accelerometer that we found in the lab room.

The board layout of our accelerometer circuit.

My lab partner and I decided to connect an LED to the circuit. Our idea was to change the brightness of the LED as the accelerometer is rotated about the y-axis. Here is our final result:

It worked!

Notes/Problems:

One note to make about the temperature sensor circuit is that we had to change the given code slightly to account for our temperature sensor that differed from the one in the lab example.

Overall, this lab was a ton of fun! I created many different circuits and used many types of sensors. This lab was a great way for me to practice performing analog input with the Arduino  I am now prepared to move on to bigger and better things!

Leave a Reply

Your email address will not be published.