Difference between revisions of "EGR 224/Arduino Interfacing With Hardware II"

From PrattWiki
Jump to navigation Jump to search
(Inventory)
Line 15: Line 15:
 
* 4x4 keypad
 
* 4x4 keypad
 
* 8-pin header
 
* 8-pin header
* Breadboard
+
* Smaller breadboard and larger breadboard (see note above about larger breadboard)
 
* Screwdriver
 
* 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.
 
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.

Revision as of 17:04, 21 March 2023

IMPORTANT NOTE

There are two breadboards in the bin

  • The smaller breadboard has a single row running along the top (all those are connected), a single row running along the bottom (all those are connected), and multiple groups of 5.
  • The larger breadboard hsa two sets of two rails at the top and two sets of two rails at the bottom. If you look at the blue and red lines at the top and bottom of the board, there are gaps in the middle - those gaps are meant to indicate that the left rails do not connect to the right rails; you can, of course, connect a wire between them if you want one long rail.

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
  • Smaller breadboard and larger breadboard (see note above about larger 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. Wait for the computer to say it has finished recognizing / installing the Arduino. Once that is done, In the Arduino window, select the Tools menu, pick Board, and then find Arduino Uno or Arduino/Genuino Uno. Next go back to the Tools menu and select Port - there should be a COMN (Arduino/Genuino Uno). Finally 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 BareMinimum. 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 may need to install the Keypad.h library. To do that:

  • Go to the Sketch menu, then pick Include Library. If Keypad is already listed (likely near the bottom in the Contributed libraries section), 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.

Arduino Sketches

To create a new sketch, go to File and then New. The first time you want to upload and run a sketch, Arduino will ask you to save it somewhere. You can save it wherever you like, though "Documents" would be a good choice. Since these programs should already exist on Tinkercad, you will not be required to turn them in a second time.

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).