Lesson Plan: Week 6
In Week 6 we will do the following (please, click on the Segment/Deliverable links below to access the course materials):
Segment 1:
Segment 2:
|
Homework 5: Create an analog output signal and read it with an analog input pin of the Arduino
Goal: Understand the capabilities of the Arduino hardware. Learn how to generate an analog output voltage using a pulse width modulated (PWM) digital signal from a digital pin, and how to measure this voltage with an analog input pin. Set-up: Connect a low-pass filter made from a resistor (10k) and a capacitor (10uF) to a PWM capable digital pin of the arduino. Feed the generated analog output voltage back into one of the analog input pins (A0-5) of the Arduino. Connect your multimeter in voltage setting between the filter output and GND and observe the voltage as it is output from the filter. Programming: Program the digital PWM pin that it outputs a square wave. Use a "for" loop to linearly ramp the duty cycle of the square wave from 0-100%. Repetition of this ramp during execution of the main loop of the sketch will generate a "sawtooth" voltage output from the low-pass filter. Use the delay function within your for loop to slow the sawtooth frequency to about 0.2Hz (a duration of 5s per sawtooth cycle). The next step is to measure the sawtooth signal using the analog pin. This will yield a sawtooth ramp between 0 and 1023 (the output of the 10-bit analog to digital converter (ADC). Convert that number to a 0-5V voltage value and then send this value to the Arduino IDE serial monitor where it can be displayed. Helpful info: PWM signals and low pass filter: Watch the Arduino hardware introduction video in Week 5/Segment 1 Analog pins, how to generate a PWM signal, and how to read out an analog input pin: Read the entries on the arduino.cc reference under "Analog I/O" Transmitting the measured voltage to the serial monitor: EEawesome video#4. To get credit: Come to class on the due date and present your working set-up as well as the readout on the multimeter and the serial monitor to one of the TAs or Instructors. |