MAKECourse
  • Home
  • About
  • Course Materials
    • Software
    • Course Kits
    • TA hours
  • Videos
    • Intro to Programming Videos
    • Advanced Topics >
      • DAC and ADC Tutorial
      • SD Card Data Logging
      • DC Motor Control
  • Schedule
    • Syllabus
  • Student Projects
    • Awesome Prizes
    • Fall 2020 Projects
    • Fall 2016 Awesome Prize Winners
    • Fall 2016 Projects
    • Spring 2016 Awesome Prize Winners
    • Spring 2016 Projects
    • Fall 2015 Awesome Prize Winners
    • Fall 2015 Projects
    • Spring 2015 Awesome Prize Winners
    • Spring 2015 Projects
    • Fall 2014 Projects
    • Spring 2014 Projects

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:
  • Learn to use Object Oriented (OO) Programming in Arduino Sketches.
  • Learn to define classes for hardware devices that are connected to the Arduino.
  • Transform the binary LED counter sketch into an object oriented sketch using a class.
Segment 2:
  • Learn to use a 7-segment 4-digits display
  • Use arrays in Arduino sketches
  • Learn about strobing/multiplexing digits
  • Write a class for the 7 segment display



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.


[Home] [Course Materials] [Syllabus] [Student Projects] [Contact]
Powered by Create your own unique website with customizable templates.