Arduino Presentation

Arduino

The Ins and Outs

of Inputs and Outputs


arduino-meme2.png


arduino-meme3.png


What is Arduino?

Arduino early board.png|600


arduino-embeddedsystem-accupoll.png|400
Embedded system
Accupoll Electronic Voting Machine


Parallax-board-of-education.png
Parallax Board of Education


Arduino-Comparison-types.png

Varieties of Arduinos found in the wild


Arduino Uno.png|600

For a a cool $27


arduino-schematic.png
Arduino Schematic


Arduino Diagram2.png


Screenshot 2025-02-06 at 4.10.34 PM.png

Digital Pin HIGH


Screenshot 2025-02-06 at 4.10.44 PM.png

Digital Pin LOW


Screenshot 2025-02-07 at 10.10.09 AM.png

Pulse Width Modulation (PWM) on

~ pins


Screenshot 2025-02-07 at 10.14.45 AM.png

Analog Inputs


Screenshot 2025-02-07 at 10.15.26 AM.png


Screenshot 2025-02-07 at 11.17.36 AM.png

Analog pins use a 10 bit ADC

Voltage is measured as 0 - 1024


Arduino Inputs and Outputs 1.png

Inputs and Outputs


Find inputs and outputs at Sparkfun

and Adafruit


Arduino IDE (arduino.cc/en/software)

arduino-ide.png


Breadboard Diagram.png

Breadboard


Basic Safety Recommendations When Using an Arduino




Arduino-circuit-led-blink.png


// the setup function runs once when you press reset or power the board
const int ledPin = 13;   // or can be set to LED_BUILTIN to blink the built-in LED

void setup() {
  // initialize digital pin LED_BUILTIN as an output.
  pinMode(LED_BUILTIN, OUTPUT);
}

// the loop function runs over and over again forever
void loop() {
  digitalWrite(LED_BUILTIN, HIGH);  // turn the LED on (HIGH is the voltage level)
  delay(1000);                      // wait for a second
  digitalWrite(LED_BUILTIN, LOW);   // turn the LED off by making the voltage LOW
  delay(1000);                      // wait for a second
}

arduino-circuit-led-pwm-old.png
LED PWM circuit


LED PWM fade code:

int ledPin = 9;  // LED connected to digital pin 9

void setup() {
  // nothing happens in setup
}

void loop() {
  // fade in from min to max in increments of 5 points:
  for (int fadeValue = 0; fadeValue <= 255; fadeValue += 5) {
    // sets the value (range from 0 to 255):
    analogWrite(ledPin, fadeValue);
    // wait for 30 milliseconds to see the dimming effect
    delay(30);
  }

  // fade out from max to min in increments of 5 points:
  for (int fadeValue = 255; fadeValue >= 0; fadeValue -= 5) {
    // sets the value (range from 0 to 255):
    analogWrite(ledPin, fadeValue);
    // wait for 30 milliseconds to see the dimming effect
    delay(30);
  }
}

Arduino-circuit-positional-servo.png
Positional Servo


/* Sweep
 by BARRAGAN <http://barraganstudio.com>
 This example code is in the public domain.

 modified 8 Nov 2013
 by Scott Fitzgerald
 https://www.arduino.cc/en/Tutorial/LibraryExamples/Sweep
*/

#include <Servo.h>

Servo myservo;  // create servo object to control a servo
// twelve servo objects can be created on most boards

int pos = 0;    // variable to store the servo position

void setup() {
  myservo.attach(9);  // attaches the servo on pin 9 to the servo object
}

void loop() {
  for (pos = 0; pos <= 180; pos += 1) { // goes from 0 degrees to 180 degrees
    // in steps of 1 degree
    myservo.write(pos);              // tell servo to go to position in variable 'pos'
    delay(15);                       // waits 15 ms for the servo to reach the position
  }
  for (pos = 180; pos >= 0; pos -= 1) { // goes from 180 degrees to 0 degrees
    myservo.write(pos);              // tell servo to go to position in variable 'pos'
    delay(15);                       // waits 15 ms for the servo to reach the position
  }
}

arduino-circuit-servo-knob-fixed.png|600
Positional servo with knob


Servo with knob

File > Examples > Servo > Knob

/*
 Controlling a servo position using a potentiometer (variable resistor)
 by Michal Rinott <http://people.interaction-ivrea.it/m.rinott>

 modified on 8 Nov 2013
 by Scott Fitzgerald
 http://www.arduino.cc/en/Tutorial/Knob
*/

#include <Servo.h>

Servo myservo;  // create servo object to control a servo

int potpin = A0;  // analog pin used to connect the potentiometer
int val;    // variable to read the value from the analog pin

void setup() {
  myservo.attach(9);  // attaches the servo on pin 9 to the servo object
}

void loop() {
  val = analogRead(potpin); // reads the value of the potentiometer (value between 0 and 1023)
  val = map(val, 0, 1023, 0, 180); // scale it for use with the servo (value between 0 and 180)
  myservo.write(val); // sets the servo position according to the scaled value
  delay(15);              // waits for the servo to get there
}

Arduino DHT11 Diagram.png
Temp/humidity sensor (DHT11)


/*
 * Created by ArduinoGetStarted.com
 *
 * This example code is in the public domain
 *
 * Tutorial page: https://arduinogetstarted.com/tutorials/arduino-temperature-humidity-sensor
 */

#include "DHT.h"
#define DHTPIN 2        // Pin where the sensor is connected
#define DHTTYPE DHT11   // Sensor type

DHT dht(DHTPIN, DHTTYPE);

void setup() {
  Serial.begin(9600);   // Start Serial communication
  dht.begin();          // initialize the sensor
}

void loop() {

  delay(2000);           // wait a 2 seconds between measurements.


  float humi  = dht.readHumidity(); // read humidity
  float tempC = dht.readTemperature(); // read temperature as Celsius
  float tempF = dht.readTemperature(true); // read temperature as Fahrenheit

  // check if any reads failed
  if (isnan(humi) || isnan(tempC) || isnan(tempF)) {
    Serial.println("Failed to read from DHT sensor!");
  } else {
	 // Output data to serial monitor
    Serial.print("Humidity: ");
    Serial.print(humi);
    Serial.print("%");

    Serial.print("  |  "); 

    Serial.print("Temperature: ");
    Serial.print(tempC);
    Serial.print("°C ~ ");
    Serial.print(tempF);
    Serial.println("°F");
  }
}

Future Applications and Beyond

Arduino Project IOT Flood Alarm.jpg
Basement Flood Alarm by  PM4


Arduino RoboGrazer Mower.png
RoboGrazer by  flappydunk


Arduino Project Watch.png
Arduino Watch by  陳亮


Mini Golf interactive course elements, (credit: Chris Myers)
Autonomous Cooler that follows using GPS by [Hacker Shack](https://www.youtube.com/watch?v=vGDMpLMkWFg/)

Arduino-Sparkfun-card-skimmer.png
SparkFun parts in nefarious projects (source)


Meme Arduino Losing Interest.png|400