Section outline

    • Assignment #2 -

      Parts: 1 Breadboard, 1 Red LED, 1 Yellow LED, 1 Green LED, 3 resistors (220 ohm red, red, brn, gold),  at least 8 jumper wires

      In Class We'll Discuss:
        - CQCQ - Link
        -Morse Code to 800 hz - Link

      CdS
       
        -LEDs and Resistor Codes
        -Calculating Current Limiting resistor values in ohms
      (Ω) - 

      Ohm's Law  V=I R
               10mA at 5 Volt, 20mA at 5 Volt, Current at 5 Volts and 220
       ohms
      ** Note: Arduino Digital Pins can safely output a maximum of 40
      mA 


               
      Can't Resist

      -Comic Strip Pages 10 - 11 - Wiring LEDs on a breadboard
       
      - Don't let the Smoke Out !!! - Use only prescribed wiring !

      - Wire with the Power OFF (USB unplugged)


      With no Power to your Arduino:

      Wire 3 LEDs (with 3 Current Limiting Resistors) to Pins 4,5,6
      Pin4 to Resistor1.1 (resistor 1 - wire 1)
      Resistor1.2 to LED+ (resistor 1 - wire 2)
      LED- to Gnd

      Pin5 to Resistor2.1 (resistor 2 - wire 1)
      Resistor2.2 to LED+ (resistor 2 - wire 2)
      LED- to Gnd

      Pin6 to Resistor3.1 (resistor 3 - wire 1)
      Resistor3.2 to LED+ (resistor 3 - wire 2)
      LED- to Gnd

      Schematic

      1) Modify Blink to test each LED

      2) Write a program to simulate a traffic light.
      Green for 10 Seconds
      Yellow for 2 Seconds
      Red for 5 Seconds

      Add comment lines to the top of your program to explain what is wired to the Arduino






      Stoplight

       

    • ...

      Assignment 4 - Sound

       

      New parts: Speaker, CdS photoresistor, 10k Resistor (Br, Bl, Or, Gold)

      In Class:

      coil

      How a speaker works.

      Review Resistor Circuits:

      Current Limiting, Pull Down, Voltage Divider (Potentiometer), Pull Up

      See How a light sensitive resistor can create "Music":

       Examples - Basic - AnalogReadSerial -Determine range of A0 

        TonePitchFollower Code Link

      - Adjust to Pin 8 - Adjust to range of A0

       * 8-ohm speaker on digital pin 8 and Gnd

       * photoresistor on analog 0 to Gnd
       * 10K resistor (brown, black, red)  on analog 0 to 5v

      circuit

      Assignment:

      Write a program (sketch) that plays a song.

      Use the following as a guide:

      C Scale

      Note Values

      Table of Musical Frequencies          
                     
      Note Frequency   Note Frequency   Note Frequency
      C 130.82   C 261.63   C 523.25
      C# 138.59   C# 277.18   C# 554.37
      D 146.83   D 293.66   D 587.33
      D# 155.56   D# 311.13   D# 622.25
      E 164.81   E 329.63   E 659.26
      F 174.61   F 349.23   F 698.46
      F# 185   F# 369.99   F# 739.99
      G 196   G 392   G 783.99
      G# 207.65   G# 415.3   G# 830.61
      A 220   A 440   A 880
      A# 233.08   A# 466.16   A# 932.33
      B 246.94   B 493.88   B 987.77


      Treble and Bass Clefs

      Chromatic Scale - Link

    • Arduino Code to play the Chromatic Scale

    •  

      Demo: 2 Note Music - Tesla

      New Part: 7 LED Disk 

      For Duino app:
      Have your project open
      Click Libraries
      Search for FastLED
      Click Add

      Arduino Web Editor:
      FastLED should be preinstalled

      For Arduino PC/Mac app:
      Download FastLED library Here
      Click Libraries
      Beside Library Manager Click Import
      Upload the FastLED-3.2.1.zip


      Click FastLED Blink - Link

      1) Get 1 LED Blinking
      2) Blink All LEDs RED
      3) Blink All LEDS another Color

      Click FastLED Random Color Blink Code - Link

      Note: Num_LEDS variable, DATA_PIN variable, leds[NUM_LEDS] array, use FastLED.addLeds<NeoPixel...

      CRGB Defined Colors Link

      (Note Bottom of the WebPage Chart of Colors - may not reproduce accurately - varies with LED Strip)

      Assignment:

      Create a sketch that:

      1)  Lights all 7 lights the same color for 3 seconds, then changes all to another color (repeat until 6 colors have been shown)

      2) Lights each LED with a different color for 2 seconds (repeat for 6 color combinations)

      Extra Credit:

      Write a creative sketch for Mikey.

    • Applications of MicroControllers:

       
      MicroControllers Measure and Control 
      A 3D printer:
       - Measures temperatures of the extruder and print bed
       - Measures the extreme positions of the X,Y,Z axes (limiting switches)
       - Controls 4 stepper motors - X,Y,Z and extruder
       

       
      3-D Printing:
       
      Solidoodle 2
       
       
      Solidoodle 2
      Bambou P1S Printer
       
       
       
       
       
       
       
       
       
       
       
       
    •  

       
      Creality CR-6 Max - Print Sample Pawn

      Discuss: Pawn and Card-Holder-IOTA
       
      Rotate:
      rotate([45,45,45]){
      cube([30, 40,30], center = true);
      }

       
      1) Online OpenSCAD - OpenSCAD Cloud

      2) Online OpenSCAD

      3) Online OpenSCAD  

      OpenSCAD Cheatsheet

      1. Create object
      2. Store Code in Arduino Web Editor or Google Drive
      3. Convert to  STL
      4. Name file: username-title  i.e. jrich-castle
      5. Upload  stl file to Google Drive (link Below)
      6. Create a Google Doc with your Openscad Code in the same Google Drive
      7. email support@blackhawkchristian.org that you have a 3D print job ready
      https://drive.google.com/drive/folders/0B1nHub4i4-YxekRwVHpOektHYWc?usp=sharing
       
       
      Assignment 7:
      Create a small Castle with Towers,  Battlements and a Wall.
      Max Dimensions:  66mm x 66mm x 66mm (~ 2.5" Cube)


      castle1

      castle2

      castle3

       

       
       
       

    • Turn in All but the Arduino and USB
      Get LCD, Ultrasonic Rangefinder and 4 patch cables

      Demo: Ultrasonic Acoustic Levitation

      Video Explaining Ultrasonic Levitation

      Ultrasonic Range Finders

       



      Install the HC-SR04 Rangefinder
      Note the Pin assignments on the HC-SR04
       
      4 Wires:
       
      HC-SR04 to Arduino
       
      1) Vcc to 5v
      2) Trig to Pin A5 
      3) Echo to Pin A4
      4) Gnd to Gnd

      Copy the program below into a blank Arduino sketch.

      Save as HC-SR04-LCD

      #include <LiquidCrystal.h>
      #define trigPin A5
      #define echoPin A4
      LiquidCrystal lcd(8, 9, 4, 5, 6, 7);
      void setup()
      {
        pinMode(trigPin, OUTPUT);
        pinMode(echoPin, INPUT);
        lcd.begin(16, 2);              // start the library
        lcd.setCursor(0, 1);
        lcd.print("        HC-SR04         ");
      }
      void loop()
      {
      lcd.setCursor(0, 0);    
          int duration, distance;
          digitalWrite(trigPin, HIGH);
          delayMicroseconds(1000);
          digitalWrite(trigPin, LOW);
          duration = pulseIn(echoPin, HIGH);
          distance = (duration/2) / 29.1; 
              lcd.print(distance);
              lcd.print(" cm             ");
              delay (500); 
      }

      Upload the program
      Read distance on LCD Screen
       
      Activities:
      1) Set the HC-SR04 sensor 10 cm from a large flat surface. 
       
      Note the location of 0 cm on the sensor.
       
      (Front Edge?, at PC Board?, 1/2 way to PC Board?...)
       
       
      2) Measure 8 known distances and record sensor reading.
       
      Calculate % error = 100(a-e)/a where a = accepted, e = experimental
      3) What are the shortest and longest distances the Ultrasonic measures accurately?
      4) Are there surfaces that are "invisible" to the sensor?  (absorb the sound and give erroneous readings?)

      5) Extra Credit:
      Create a program to scroll an Appropriate message across the LCD display.

      :-)

       
       
       
       
       
Accessibility

Background Colour Background Colour

Font Face Font Face

Font Kerning Font Kerning

Font Size Font Size

1

Image Visibility Image Visibility

Letter Spacing Letter Spacing

0

Line Height Line Height

1.2

Link Highlight Link Highlight

Text Colour Text Colour