Week 13 - More Sensors and DC Motor
Tuesday
Agenda
Artist of the Day
Amy Youngs
Temperature sensor
(image from Adafruit)
- The TMP 36GZ is a temperature sensor.
- This is an active sensor, meaning we provide power to ground and 5V, and it outputs a voltage proportional to temperature.
- Looking at the datasheet, we see it is 10mV/degree Celsius. That means we can use the output voltage (read by analog in) to figure out what the temperature is.
- To convert from AnalogRead value to milli-volts: Voltage at pin in milliVolts = (reading from ADC) * (5000/1024)
- To convert from milliVolts to degree celsius: Centigrade temperature = [(analog voltage in mV) - 500] / 10
- Activity:
- Use AnalogReadSerial to figure out what the current temperature in the room is in Celsius.
- Modify your code to convert Celsius to fahrenheit.
- Explore the dynamic behavior: how quickly does it change in response to breathing on it? In response to touching it? Can you get the temperature to go up, or go down?
Ultrasonic Rangefinder
See this file from the ELEGOO examples: l10 ultrasonic sensor.pdf
And this code: Lesson 10 Ultrasonic Sensor Module.zip
Bonus Artist: Garnet Hertz
DC Motor
See this file from the ELEGOO examples: l21 dc motor.pdf
And this code: Lesson 21 DC Motors.zip
Homework
Starting thinking about a final project.
Office Hours
Wednesday 4-6pm.
Thursday
Agenda
Artist of the Day 2
Garnet Hertz
Relay
See this file from the ELEGOO examples: l22 relay.pdf
And this code: Lesson 22 Relay.zip
Stepper Motor
See this file from the ELEGOO examples: l23 stepper.pdf
And this code: Lesson 23 Stepper Motor.zip
Homework 2
Write a proposal for the final project. Due Tuesday morning 11/22 for one-on-one meetings. https://canvas.unl.edu/courses/137404/assignments/1370188
Reference
- Detailed HC-SR04 tutorial with LEDs and Arduino https://www.instructables.com/Simple-Arduino-and-HC-SR04-Example/