1 of 70

Welcome to the World of Arduino

Alicia Trout, P.E.

Engineering & Technology Teacher

1

2 of 70

Physical

Computing

Building interactive systems using software and hardware that can sense and respond to the physical world.

2

3 of 70

Arduino Microcontroller

  • Essentially a small, portable computer.
  • Capable of taking inputs (push of a button or reading from a light sensor) and interpreting to control outputs (blinking an LED or turning on an electric motor).

3

4 of 70

Circuit Components

4

5 of 70

Circuits

* Electricity travels from Power to Ground (the common or reference point in an electrical circuit - sometimes an actual physical connection with the ground)

Circuit: A circular journey or one beginning and ending at the same place

5

6 of 70

Lighting an LED

6

7 of 70

Soldering

7

A Semipermanent

connection.

8 of 70

What is a Breadboard?

  • One of the most important tools for electrical prototyping.
  • A piece of plastic with holes to place wires into.
  • copper connecting the holes so electricity can get to all the components.

  • It allows you to create circuits without having to solder.
  • Metal underneath, which is a conductor.

8

9 of 70

A Closer

Look

9

BREADBOARD:

  • Trench
  • Rows of Tie-Points
  • Ground Distribution Buses
  • Power Distribution Buses

10 of 70

Using a Breadboard

10

  • Light your LED without needing the alligator clip wires, or soldering.
  • Let’s try to find 3 ways to wire our LED.

11 of 70

ANALOG VS. DIGITAL

11

  • We live in an analog world.
  • There are an infinite amount:
    • of colors to paint an object
    • of tones we can hear
    • of smells we can smell
  • Digital signals and objects ARE discrete or finite, meaning there is a limited set of values they can be.
  • Most commonly digital signals will be one of two values– like either 0V or 5V (ON OR OFF).

12 of 70

Arduino IDE

(Integrated Development Environment)

  • The Arduino IDE is used to “program” your Arduino.
  • A set of instructions that tell a computer what to do.
  • The syntax of a language describes the possible combinations of symbols that form a correct program.

12

13 of 70

Arduino IDE: Bare Minimum

13

14 of 70

CODING TIPS

declare variables

reference libraries

void setup ()

{

all commands that you only need to do once;

}

void loop ()

{

all commands or functions that you want to repeat forever;

if (this statement is true)

{

do these commands in the curly brackets;

}

}

define functions

if (condition1) {

// do Thing A

}

else if (condition2) {

// do Thing B

}

else {

// do Thing C

}

15 of 70

Arduino IDE

  • Go to https://create.arduino.cc/
  • Create an account by signing in with Google
  • In the Editor, go to Examples —> Basics —> Blink
  • In the Drop-down Menu, select the “Arduino Uno” board
  • Click on the Upload” button

15

16 of 70

Arduino IDE

16

17 of 70

Arduino IDE

17

18 of 70

Individual Arduino

Challenge Sign-off

18

Challenge:

Sign-off:

1. Blink LED

2. 3 LED light show

3. LED with Photoresistor

4. RGB (Rainbow of colors)

5. One button (Example code)

6. Two Buttons (Challenge)

Name: __________________________________

19 of 70

Blinking LED

19

* We always use resistors between the Arduino and LEDs to keep the LEDs from burning out due to too much current. Use the 560 Ohm resistor (see next slide).

Wire the LED circuit as seen in the diagram below.

* Use a 560 Ohm resistor

20 of 70

Resistor Color Code

20

21 of 70

Multiple LEDs (Min of 3)

Create a little light show!

21

* Use 560 Ohm resistors

Wire at least 3 LEDs.

Modify the program to create a little light show.

* Show Mrs. Trout for sign-off.

22 of 70

Adding Input: photo Resistor

22

Use 10K Ohm resistor (with black & Orange stripe)

* Wire LED to pin 13.

* Wire Photoresistor to pin A0

23 of 70

Photoresistor

23

A photoresistor changes resistance based on how much light the sensor receives. The Arduino board measures voltage, not resistance, but our circuit will interpret the photoresistor resistance as voltage.

We will run a program to only turn on the LED while you’re holding your hand over (without touching) the photoresistor.

Hints:

  • We will monitor the value of the sensor in the Serial Monitor
  • We will use an If/Else statement.

* Show Mrs. Trout for sign-off.

if (condition1) {

// do Thing A

}

else {

// do Thing B

}

24 of 70

Photoresistor

24

25 of 70

Photoresistor

25

if (condition1) {

// do Thing A

}

else {

// do Thing B

}

26 of 70

RGB (Red green blue) LED

26

Use 560 Ohm resistors

Pin 9

Pin 10

Pin 11

27 of 70

27

RGB LED

This example starts with the RGB LED off and then turns on Red.

Modify the program to light up the following colors in this order:

REDGREENBLUEYELLOWTURQUOISEPURPLE

WHITE

Pin 9

Pin 10

Pin 11

const int RED_PIN = 9;

const int GREEN_PIN = 10;

const int BLUE_PIN = 11;

const int DISPLAY_TIME = 1000;

void setup()

{

pinMode(RED_PIN, OUTPUT);

pinMode(GREEN_PIN, OUTPUT);

pinMode(BLUE_PIN, OUTPUT);

}

void loop()

{

digitalWrite(RED_PIN, LOW);

digitalWrite(GREEN_PIN, LOW);

digitalWrite(BLUE_PIN, LOW);

delay(DISPLAY_TIME);

digitalWrite(RED_PIN, HIGH);

digitalWrite(GREEN_PIN, LOW);

digitalWrite(BLUE_PIN, LOW);

delay(DISPLAY_TIME);

}

Tips:

  • Think of how to mix colors.
  • You can use analog values if you’d like.

* Show Mrs. Trout for sign-off.

28 of 70

Buttons/Switches

29 of 70

Buttons

* Wire buttons to digital pins

2 & 3

* Power and GrounD to Column/Bus

* Use 10K Ohm PUll-down

Resistors (to negative/

Ground)

* blue/Yellow wires to positive

30 of 70

Program Buttons

Next step: Once you get your button to work, modify your program to have either button turn on the LED, and turn off the LED when both buttons are pressed together. Hint: Use Logical operators (shown in box above).

This program only uses one button (wired to pin 2). Leave both buttons wired for next step (bel0w).

31 of 70

Stop here and ask for next step...

31

32 of 70

32

33 of 70

Rover Track

33

34 of 70

Rover Build Instructions

34

35 of 70

Rover Build

35

36 of 70

36

37 of 70

37

38 of 70

38

A-1A: Pin 10

A-1B: Pin 9

B-1A: Pin 6

B-1B: Pin 5

39 of 70

39

40 of 70

40

Rover 1

Rover 2

Rover 3

Rover 4

Grace

Logan

Divya

Sawyer

41 of 70

41

Rover 1

Rover 2

Rover 3

Rover 4

Grace

Logan

Divya

Sawyer

Jonah

Elias

Jake

Taylor

42 of 70

42

Rover 1

Rover 2

Rover 3

Rover 4

Grace

Logan

Divya

Sawyer

Jonah

Elias

Jake

Taylor

Rohan

Audrey

Tejas

Koe

Lily

43 of 70

43

44 of 70

44

45 of 70

Stop here and ask for next step...

45

46 of 70

46

47 of 70

Challenge Sign-off

47

Challenge:

Sign-off:

1. Blink LED (Heartbeat)

2. MUltiple LEDs (at least 3)

3. RGB - 7 COlors

4. LED with Photoresistor

5. Button with LED

6. LED with Potentiometer

8. DC Motor

48 of 70

48

Refer to 7th Grade page of www.engtechclass.com for Individual Arduino Training Resources, which include basic coding to get you started on the circuits you will need to complete to receive sign-off.

49 of 70

Blinking LED

49

Open the “LED Blink” code.

You may either download the LEDBlink.ino file and then open it within the Arduino application

OR

Open the “LED Blink Arduino Code” Google Document and copy and paste the code into an Arduino sketch.

This example blinks an LED by turning on for 1 second (1000 milliseconds) and then turning off for 1 second (1000 milliseconds).

* To get signed off, adjust the timing to make the LED blink like a heartbeat.

50 of 70

RGB LED

50

Open the “RGB Starter” code.

This example starts with the RGB LED off and then turns on Red.

Modify the program to light up the following colors in this order:

REDGREENBLUEYELLOWTURQUOISEPURPLE

WHITE

* Show Mrs. Trout for sign-off.

Tips:

  • Think of how to mix colors.
  • You can use analog values if you’d like.

51 of 70

Photoresistor

51

Open the “Photoresistor” code.

A photoresistor changes resistance based on how much light the sensor receives. The Arduino board measures voltage, not resistance, but our circuit will interpret the photoresistor resistance as voltage.

The example program uses the value read by the photoresistor as the delay to blink the LED.

Modify the program to only turn on the LED while your holding your hand over (without touching) the photoresistor.

Hints:

  • Monitor the value of the sensor in your Serial Monitor (Tools - Serial Monitor).
  • Use an If/Else statement.

* Show Mrs. Trout for sign-off.

if (condition1) {

// do Thing A

}

else {

// do Thing C

}

52 of 70

Servo Motor

52

Pay attention to how you attach your wires.

* Red wire is positive;

Brown wire is Negative

53 of 70

Servo MOtor

53

Open the “Servo Sweep” code.

Once you get your Servo Motor to work with the “Servo Sweep” program, modify your sketch to have your Servo motor go side to side like it is shaking it’s head to say “NO.”

* Show Mrs. Trout for sign-off.

54 of 70

DC Motor

54

Diode:

Match Direction

Diagram Key:

Green wire = Positive

Yellow wire = Negative wire

Use 560 Ohm

Transistor

55 of 70

DC MOtor

55

Open the “DC Motor” code.

Once you get your DC Motor to work, show Mrs. Trout that you can change the speed of the motor using the Serial Monitor (see next slide).

56 of 70

DC Motor

56

Serial Monitor

To Open Serial Monitor

57 of 70

Stop here and ask for next step...

57

58 of 70

Technology and Engineering Showcase

7 Work Days!!

58

59 of 70

Project Requirements

59

  • You may choose to work individually or with a partner (of your choice)

  • Two Project Choices:
    • Useless Machine
    • Dancing Robot

  • All projects must include:
    • Minimum of 3 separate components

(ex: RGB, Photoresistor, Servo)

      • 2 LEDs still count as 1 component

  • Mrs. Trout will provide you with reusable ties (velcro) if needed to keep your Arduino and Breadboard together (back-to-back)

60 of 70

Submit a Video of your Project

60

  • Record a video of your useless

machine.

  • Add your video to the shared folder.

  • Rename your video with this format:
    • 7A Kait Noa

61 of 70

Potentiometer

61

* 1oK: T103

62 of 70

Potentiometer

62

* Once you get your Potentiometer to work to adjust the Blinking speed of your LED, modify your circuit and program to adjust the intensity/brightness of your LED.

* Open this program from your folder on your Desktop (installed by Ms. Crump)

* Open

* From Desktop

* SIK Guide Code

63 of 70

LCD Screen

63

* Use the Autoscroll program and Change the text to something fun.

PLEAsE Refer to next slide for wiring your LCD Screen.

64 of 70

LCD Screen

64

65 of 70

LCD Screen

65

* Use the Autoscroll program and Change the text to something fun.

66 of 70

Circuit Components

Let’s make sure we have what you need to make your own complete Arduino set. Create an inventory in your journal.

66

Component (Quantity)

Image:

UNO

Microcontroller (1)

3’ USB Cable (1)

Tiny Breadboard (1)

10K Potentiometer (1)

1K Potentiometer (1)

Small Pushbutton (2)

Component (Quantity)

Image:

Red Diffused LED (5)

Red Ultra-Bright LED (1)

Green Ultra-Bright LED (1)

Blue Ultra-Bright LED (1)

100 Ohm Resistor (5)

1K Resistor (5)

10K Resistor (5)

Photocell Sensor (1)

DC Motor (1)

Servo Motor (1)

67 of 70

Wiring

Schematic

67

68 of 70

Arduino Individual Assessment

68

69 of 70

Arduino IDE: Bare Minimum

69

70 of 70

Arduino IDE

  • Open the Arduino Application.
  • Open existing program or create new program.
  • Connect the Arduino board through the USB.
  • Go to “Tools” menu and select the “Arduino Uno” board.
  • GO to “Tools” menu and select the USB Serial Port. (Tools → Port → usbserial).
  • Click on the “Upload” button.

70