Table of Contents
Introduction
Arduino Basics
Getting Started with Arduino
Steve tests the Arduino board with a "hello world" example. The Arduino is connected to the computer, and an example blink program is loaded, causing an LED to blink on and off.Electricity & Hardware Terminology
Steve explains a few electrical engineering concepts, including Ohm's law, polarity, and resistors. A color-coded chart is shown, which helps identify the ohm value of a resistor.Wiring a Circuit to the Breadboard
Steve introduces the breadboard, which allows circuits to be wired without soldering. They are helpful for prototyping. Students are then instructed to wire a single LED and resistor to the breadboard. Use the wiring diagram linked below.Porting Blinking Light to JavaScript
Steve loads Firmata onto the Arduino, allowing the board to be controlled by JavaScript. A basic JavaScript program is written to blink the LED. The code is executed with Node.js, and the commands are sent to the Arduino.Pulsing the LED
Steve uses the pulse method to demonstrate Pulse Width Modulation. Digital pins simulate pulsing or fading by rapidly sending on/off signals.Wiring Button with LED
Steve adds a button to the circuit that logs messages to the console when pressed. Pressing the button completes the circuit and sends the voltage to a pin. Use the wiring diagram linked below.Controlling LED with Button Exercise
Students are instructed to modify the code so the button controls the LED light.
Communicating with a Web Server
Button with Web Server
Steve uses an Express server to read data from the Arduino. The Express server uses the Johnny-Five library to access the Arduino board. When the webpage is loaded, it checks to see if the button is pressed.Toggling LED from the Browser
Steve challenges students to write the code to toggle an LED from the browser. The code is then moved to a client-side application, and a button is coded to toggle the LED using a POST request.Communicating with Web Sockets
Steve creates a web socket connection, allowing the Arduino to communicate directly with the web server without relying on GET or POST requests. When a message is received through a specific channel, the text in the browser is updated.
Sensors & Actuators
Potentiometer
Steve introduces the potentiometer sensor, which emits values as a knob is turned. By default, the values are between 0 and 1023. The potentiometer is added to the breadboard with the other examples. The diagram linked below displays the individual wiring for the potentiometer.Changing Color with the Potentiometer
Steve uses the potentiometer sensor to change the background color of a web page. Since the color values are between 0 and 255, the scale method adjusts the minimum and maximum values emitted by the potentiometer.Detecting Light with the Photoresistor
Steve uses the photoresistor to detect ambient light values from the room. The client code is refactored to adjust the browser's brightness based on the room's brightness.Playing Notes on the Piezo
Steve wires a piezo to the Arduino, which can detect vibration and create sound. Once the piezo is wired up, notes are sent to the play method, and the piezo plays the sequence.Generating Audio with Face Detection
Steve uses a face detection library to track the position of the user's head. A frequency is generated based on the work so the user can play higher and lower frequencies by moving their head.
Further Exploration
Face Expressions & LED Light Exercise
Steve wires a color LED into the breadboard and updates the application to change the color of the LED based on the user's expression. Note: Ensure the LED uses PWM (~) pins in the breadboard.Working with an LCD Screen
Steve asks students to wire an LCD screen to the Arduino. Once the LCD is wired and configured, the cursor method can move locations on the screen, and the print method will write a message at that location.Displaying System Information
Steve imports the "systeminformation" Node module and demonstrates how system information can be displayed on the LCD screen. Memory usage and battery percentage are two of the statistics shown.Displaying Messages from GitHub
Steve connects the Arduino with a GitHub webhook. An Express server is created, and ngrok is used to expose the server and the port to be called from the webhook when the repo is starred.Web Serial API
Steve introduces the Web Serial API and demonstrates how the web browser can communicate with serial devices without a web server as an intermediary.