Question

In: Electrical Engineering

Kit Requirements: Arduino Uno Small breadboard Jumper wires 10kΩ potentiometer 10kΩ resistor (x2) 220Ω resistor (x3)...

Kit Requirements:

  • Arduino Uno
  • Small breadboard
  • Jumper wires
  • 10kΩ potentiometer
  • 10kΩ resistor (x2)
  • 220Ω resistor (x3)
  • USB cable
  • Photoresistor
  • TMP36 temperature sensor
  • Digital Multimeter

Lab 3a:

Procedure:

·         Watch the videos:

o   Tutorial 03 for Arduino: Electrical Engineering Basics(https://www.youtube.com/watch?v=abWCy_aOSwY)

o   Tutorial 04 for Arduino: Analog Inputs (https://www.youtube.com/watch?v=js4TK0U848I)

o   TechBits 13 - Analog and Digital Signals (https://www.youtube.com/watch?v=Z3rsO912e3I)

·         Construct the breadboard circuit and implement the program presented in the video to create an adaptable night light and detailed in Chapter 2 (pp.35-39) of your textbook.

Lab 3b:

Procedure:

This week’s lab will simulate the coffee maker heater functionality we saw in Week 1. The difference in our program and the actual coffee maker is that instead of turning on a heating element, our program will blink an LED.

·         Design a circuit and Arduino program that expands the concepts explained in Chapter 3 ( pp. 52- 59) of your textbook and accomplishes the following:

o   Blinks an LED when the temperature of a temperature sensor is at or below room temperature for more than 5 seconds

o   If the temperature exceeds room temperature for more than 5 seconds, the LED will turn off.

·   

Solutions

Expert Solution

int led = 9; /* led is connected to pin 9 */
int sensor_pin = A1;
#define aref_voltage = 3.3

void setup() {
  // put your setup code here, to run once:
pinMode(led,OUTPUT);
/* SETTING Vref TO  3.3 V For better precision . */
analogReference(EXTERNAL);
}

void loop() {
  // put your main code here, to run repeatedly:
 room_temp = 27 ; /* normal temp = 27 degree C */
 
int reading = analogRead(sensor_pin);
/*converting the Reading voltage to Degree centigrade */
float voltage = (reading * aref_voltage ) / 1024.0 ;
float temp_in_c = ( voltage - 0.5 ) * 100;

if(temp < room_temp ){ /*if temp is less than room temp */

  delay(5000); /*5 seconds delay */
  if(temp < room_temp){ /*if temp still less than room temp */
     digitalWrite(led,HIGH); 
         }
  
  }
  else if(temp > room_temp ){ /*if temp is GREATER than room temp */

  delay(5000); /*5 seconds delay */
  if(temp > room_temp){ /*if temp still GREATER than room temp */

     digitalWrite(led,LOW); 
    }


}}


Related Solutions

ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT