Instructions

Deliverable A

Your Arduino kit comes with two potentiometers. Find them and connect one to your Arduino. The potentiometer has two pins on one side and one pin opposite. The two pins should be connected to 5V and GND (it does not matter which is which) on the Arduino. The solo pin should be connected to one of the Analog to Digital Converter (ADC) inputs on the Arduino. Write code that reads the current value of the ADC you used and print it to the Serial Monitor.

Deliverable B

ADCs are all about making microprocessors work with the real world. Your Arduino kit comes with an Ultrasonic sensor that can measure distances to an object using high frequency sound waves. Find the datasheet and implement the sensor such that the serial monitor displays the distance of the object in front of the sensor in centimeters. Note that the Ultrasonic sensor has labels printed on its board that can lead you to its datasheet. You will need the actual datasheet (there should be a few graphs and a description of the pins), not marketing material. You may also find other Arduino functions to precisely calculate time to microseconds. The Arduino is one of the most popular programming devices in use today, use the publicly available documentation to learn about these functions. Double-check the conversion to centimeters listed in the datasheet with real-world measurements and adjust accordingly.

Deliverable C

Let’s make this a little more user-friendly by connecting the provided LCD to the Arduino and outputting the distance there. Use Lesson 9 of the Elegoo tutorial that came with your kit (or here: https://www.elegoo.com/blogs/arduino-projects/elegoo-mega-2560-basic-starter-kit-tutorial) to learn how to setup the LCD and display characters on it. Once this is set up and your Deliverable C code is uploaded to the Arduino, you can disconnect the USB from your computer and use the provided 9V battery and power adapter to move your components around and check distances.

Turn in to Blackboard

  • A zip file with the following code named after the deliverable it corresponds to:
    • Deliverable A (4 points)
    • Deliverable B (4 points)
    • Deliverable C (4 points)
  • A PDF with answers to the following questions. Use the datasheet for the AVR processor used on the Arduino (found here: https://www.microchip.com/en-us/product/atmega2560) to answer these questions.
    1. What type of ADC is used? (6 points)
    2.  The datasheet mentions a noise-cancelling mode for the ADC. In one or two sentences, what does this mode do and when might you want to use it? (6 points)
    3. How do you find the input voltage of the signal given the ADC value? (6 points)

Rubric

Demo

  • Deliverable A
    • 10 points
  • Deliverable B
    • 10 points
  • Deliverable C
    • 10 points