EGR 224/Arduino Interfacing With Hardware II

From PrattWiki
Revision as of 14:12, 21 March 2023 by DukeEgr93 (talk | contribs) (Pushbutton)
Jump to navigation Jump to search

Inventory

You need to check the inventory of your box before you begin the lab. You will also be required to check your box in with a TA before leaving. Failure to get your inventory checked will result in a grade of 0 for this lab! Your box should contain:

  • Arduino Uno
  • USB Cable for Arduino Uno
  • 4 470 $$\Omega$$ resistors (yellow-purple-brown-gold)
  • 1 15 k$$\Omega$$ resistor (brown-green-orange-gold)
  • 5 LEDs (clear, red, yellow, green, and blue)
  • 18 wires(2 each of red, orange, yellow, green, blue, purple, black, white, brown, gray)
  • 2 buttons (one white, one brown)
  • 4x4 keypad
  • 8-pin header
  • Breadboard
  • Screwdriver

If your box is missing anything or has anything extra, let a TA know at the start of lab to get your box in order.

Arduino Software Initialization

You may need to install the Arduino software on the computer. Search for "Arduino" - if nothing comes up as an installed program, go to Arduino Downloads and install the software.

Once installed. run it. A bank sketch should come up (or possibly the last sketch that was opened). Now connect the USB cable to your Arduino and then connect it to the computer. In the Arduino sketch, select the Tools menu, pick Board, and then find Arduino Uno or Arduino Genuino/Uno. Now from the File menu, pick Examples, 01.Basic, and Blink. Upload and run this on your board by clicking the right-arrow icon. After a few moments, the on-board light on the Uno should Blink. If that doesn't work, let a TA know.

Next, go to File, pick Examples, 01.Basic, and Bare Minimum. Upload this to your Arduino. You should upload this sketch every time you plan to change the circuit connected to the Arduino so that all the pins are off.

Finally, to make the keypad work, you will need to install the Keypad.h library. To do that:

  • Go to the Sketch menu, then pick Include Library. If Keypad is already listed, the library is installed.
  • If Keypad is not listed, go to Manage Libraries and type keypad in the search box. Scroll down to the one named Keypad and install it.

Required Parts

All parts of the lab will require the Arduino, Arduino cable, and breadboard. Note: replace "small" resistors in the tutorials (220 $$ \Omega$$) with the 470 $$\Omega$$ resistors and replace the "large" resistor (10 k$$\Omega$$) with the 15 k$$\Omega$$ resistor.

Blink an LED

  • 1 470 $$\Omega$$ resistor
  • Red LED
  • 3 wires

Multiple LEDs

  • 3 470 $$\Omega$$ resistors
  • Red, Yellow, and Green LEDs
  • 5 wires

Pushbutton

  • 1 470 $$\Omega$$ resistor
  • 1 15 k$$\Omega$$ resistor
  • Red LED
  • 4 wires
  • Pushbutton

Traffic Signal

  • 3 470 $$\Omega$$ resistors
  • Red, Yellow, and Green LEDs
  • 7 wires (or connect short lead of LED to the ground rail directly, eliminating the need for three of the wires)

Keypad and DEC TO BIN

  • 3 470 $$\Omega$$ resistors
  • Red, Blue, and Yellow LEDs
  • 14 wires (or connect short lead of LEDs to the ground rail directly, eliminating the need for three of the wires)
    • Use 7 wires to connect the left seven leads from the keypad to pins 2-8. You will not be using the far-right eighth lead on the keypad (this senses the right ABCD column, which we are not using).