1
0
Fork 0
unlondon-workshops/presentations/workshop-may-2016/talk.md

353 lines
9.1 KiB
Markdown
Raw Normal View History

2016-05-20 15:20:38 -04:00
---
author: Fred Cahill, Shawn Nock
institute: Unlondon Digital Media Assoc.
title: Introduction to Art Engineering
subtitle: Medway High School
2016-05-20 15:20:38 -04:00
lang: en-CA
colorlinks: true
...
# Goals
## Art Engineering
- Science, technology, engineering and maths; in service of Art.
- Allows unprecedented interaction
- Opens doors to new funding sources, non-traditional gallery space.
## Unlondon
## Shawn: Biohacking
## @scanlime: Micah Elizabeth Scott, Art Engineer
> "...she explores the boundaries between technology, society, and creative
> expression, using her unique perspective to try and help illuminate
> what makes us human."
[^1]
- Eclipse
- Forest
- Zen Photon Garden
[^1]: Micah's Portfolio Website: [misc.name](http://www.misc.name)
## @kimalpert: Kim Alpert, Aesthetic Engineer
> "With a background in fine art, world music, and carpentry, Kim Alpert
> " brings an attention to detail and diverse style to her work."
[^2]
- Bodyphonic @ National Music Center, Calgary
[^2]: Kim's Portfolio Website: [http://aestheticengineer.com](http://aestheticengineer.com)
2016-05-20 15:20:38 -04:00
# What's in your kit?
## Kit Contents
- Arduino Uno R3 Clone
- Solderless Breadboard
- Connecting wires
- LEDs
- Resistors, Potentiometer
- Buzzer
- IR Remote
- IR Receiver
## What is Arduino?
\begin{center}
$\mu$C + reset button + led + USB communication
\end{center}
It's a kit (on a board) with the bare minimum components to easily use the $\mu$C
hardware. They do the basic, boring design needed for any board, so users only
need to add the neat stuff.
## Arduino UNO
The Arduino variety that we are using is the Arduino UNO.
- Processor: Atmel Atmega328p
- Memory: 2K RAM + 32K Flash
- FT232RL Logic-level Serial$\leftrightarrow$USB Chip
## Arduino Software
The Arduino folks also adapted an *Integrated Development Environment*
(IDE) to their boards. This IDE allows users to easily write programs
for their boards and then write the programs to the $\mu$C.
\Large Get the Arduino IDE: [https://www.arduino.cc/en/Main/Software](https://www.arduino.cc/en/Main/Software)
# Circuit Basics
## Current
Current is the flow of charge through a circuit. Conventionally we
think of this as happening from $+$ to $-$ of the power supply of the
circuit.
## Voltage / Potential / Resistance
Voltage is how fast the current can move in the circuit. River
metaphor:
- current = flow rate: ($\si{\liter\per\second}$)
- voltage = change in height: ($\si{\meter}$)
Other devices in a circuit can impede / effect current flow. We'll
call them resistance(s).
# Circuit Devices
2016-05-20 15:20:38 -04:00
## Diode
\begin{columns}[c]
\column{0.50\textwidth}
\begin{itemize}
\item One way value for current\footnotemark[1]
\item LED $\equiv$ Light Emitting Diode
\item Band marks (-)\footnotemark[2]
\item Longer leg marks (+)
\end{itemize}
\column{0.50\textwidth}
\begin{center}
\includegraphics[width=0.75\textwidth]{images/diode.png}
\vspace{5mm}
\includegraphics[width=0.50\textwidth]{images/led.jpg}
\end{center}
\end{columns}
\footnotetext[1]{\tiny \url{https://learn.sparkfun.com/tutorials/diodes}}
\footnotetext[2]{\tiny \url{https://learn.sparkfun.com/tutorials/polarity/diode-and-led-polarity}}
## Diode Problems
* Diodes don't limit current
* Diodes aren't perfect (some current turned to heat)
* Too much current = Too much heat = __BANG__
* How do we limit current?
## Resistor
\begin{columns}[c]
\column{0.50\textwidth}
\begin{itemize}
\item \emph{Resist} the flow of current
\item Needed for LEDs: $\approx\SI{400}{\ohm}$\\
(safe for $\le\SI{6}{\volt}$)
\item Button Pull-up/down: $\ge\SI{10}{\kilo\ohm}$
\item Color coded, Google it
\end{itemize}
\column{0.50\textwidth}
\includegraphics[width=0.98\textwidth]{images/resistor.png}
\end{columns}
<!-- ## Ohm's Law -->
2016-05-20 15:20:38 -04:00
<!-- Ohm's Law relates current to potential and resistance. -->
2016-05-20 15:20:38 -04:00
<!-- $$ V = IR $$ -->
<!-- $$ I=\frac{V}{R} $$ -->
<!-- $$ R = \frac{V}{I} $$ -->
2016-05-20 15:20:38 -04:00
<!-- * V = Potential in Volts (\si{\volt}) -->
<!-- * I = Current in Amperes (\si{\ampere}) -->
<!-- * R = Resistance in Ohms (\si{\ohm}) -->
2016-05-20 15:20:38 -04:00
<!-- ## Ohm's Law: Example -->
2016-05-20 15:20:38 -04:00
<!-- The datasheet for an LED says that the maximum continuous current is -->
<!-- \SI{15}{\milli\ampere}. Your circuit operates at \SI{5}{\volt}\footnotemark[1]. How -->
<!-- big should your resistor be? -->
2016-05-20 15:20:38 -04:00
<!-- $$ \si{\ohm} = \frac{\SI{5}{\volt}}{\SI{0.015}{\ampere}} = 333.\overline{3}\si{\ohm} $$ -->
2016-05-20 15:20:38 -04:00
<!-- How much current for our *cheet sheet* value? -->
2016-05-20 15:20:38 -04:00
<!-- $$ \si{\ampere} = \frac{\SI{5}{\volt}}{\SI{400}{\ohm}} = \SI{12.5}{\milli\ampere} $$ -->
2016-05-20 15:20:38 -04:00
<!-- \footnotetext[1]{\tiny Actually, this calculation is inaccurate. LEDs will have a *forward voltage drop* of between \SI{300}{\milli\volt} and \SI{700}{\milli\volt} this should be subtracted from \si{\volt} above... but it's not critical.} -->
2016-05-20 15:20:38 -04:00
## Buttons
- Buttons connect _or_ disconnect two wires/parts
- Momentary Switch: Normally Closed (NC), Normally Open (NO)
- Toggle Switch
## Digital Signals
- Vcc: The power supply of the digital circuit elements
- GND: The reference voltage (usually \SI{0}{\volt})
- Connecting a part to Vcc = Logical 1
- Connecting to GND = Logical 0
## Transducers {.fragile}
Transducers turn electrical energy into another sort of energy:
| |
-------|--------:
Speaker|Electrical $\rightarrow$ Sound
Microphone|Sound $\rightarrow$ Electrical
LED|Electrical $\rightarrow$ Light
LED|Light $\rightarrow$ Electrical
Piezoelectric|Electrical $\rightarrow$ Motion
## Piezo Buzzer
- Piezoelectric elements change shape when voltage is applied
- Thin discs can be made to oscillate and create sound.
- Contains oscillator circuit
- Two connections: Vcc, GND
- Use a switch; connected = annoying tone, disconnected = glorious silence
## Power
The power supply provides the energy to drive the system *and* defines logical 1.
Can be a:
* Voltage Regulator (converts one potential to another)
* Batteries
2016-05-20 15:20:38 -04:00
* Solar Panel
In our circuits, your laptop is converting it's power source to $\SI{5}{\volt}$ and
2016-05-20 15:20:38 -04:00
delivering power to our circuit via USB. You also have a battery pack
for computer-free shenanigans ($\SI{6}{\volt}$).
2016-05-20 15:20:38 -04:00
## $\mu$Controller
Microcontroller ($\mu$C) is a *processor*, *memory* and a few *peripherals* on a standalone
chip.
Processor
: is a group of transistors that understands a few dozen
commands (ADD, SUB, JUMP..)
Memory
: a circuit that can hold values.
Peripherals
: Vary chip to chip, but often include timers, radios, communication interfaces
Seems complicated, but really simple. They literally read a command
from memory, then execute the command. At the end of the
command, read the next command from the next memory cell and
repeat^[some commands change the next command memory address]
## $\mu$C + Digital Signals as Switches
If one end of an LED is connected to ground, and the other end is
connected to a pin on a $\mu$Controller, then:
If the $\mu$C sets the pin HIGH ($\SI{5}{\volt}$) then current will
flow from the pin through the LED to GND, if LOW ($\SI{0}{\volt}) then
the current will not flow and the LED is off.
2016-05-20 15:20:38 -04:00
# Let's start programming
## Configure Arduino
\begin{center}
\includegraphics[width=0.98\textwidth]{images/arduino-board.png}
\end{center}
* Board: Arduino UNO
* Processor: ATmega328
* Port: \ldots
## The Code Environment
\begin{center}
\includegraphics[width=0.5\textwidth]{images/arduino-toolbar.png}
\end{center}
## Your first Program
~~~ C
/* the setup function runs once on reset / power */
void setup() {
/* set pin 13 as an output */
pinMode(13, OUTPUT);
}
/* the loop function repeats forever */
void loop() {
digitalWrite(13, HIGH); // turn on LED
delay(1000); // wait for a second
digitalWrite(13, LOW); // turn the off LED
delay(1000); // wait for a second
}
~~~
<!-- ## Buzzer: Hardware -->
<!-- \begin{center} -->
<!-- \includegraphics[width=0.98\textwidth]{images/buzzer-breadboard.png} -->
<!-- \end{center} -->
<!-- ## Buzzer: Software -->
<!-- ~~~ C -->
<!-- #define BUZZER 8 /* Make BUZZER same as pin 8 */ -->
<!-- void setup() { -->
<!-- pinMode(BUZZER, OUTPUT); -->
<!-- digitalWrite(BUZZER, HIGH); /* Turn off buzzer */ -->
<!-- } -->
<!-- void loop() { -->
<!-- digitalWrite(BUZZER, LOW); /* Turn on buzzer */ -->
<!-- delay(100); /* wait for 100ms */ -->
<!-- digitalWrite(BUZZER, HIGH); /* Turn off buzzer */ -->
<!-- delay(900); /* wait 900ms */ -->
<!-- } -->
<!-- ~~~ -->
<!-- ## Push Button: Hardware -->
<!-- \begin{center} -->
<!-- \includegraphics[width=0.98\textwidth]{images/buzzer-button-breadboard.png} -->
<!-- \end{center} -->
<!-- ## Push Button: Software (Part 1) -->
<!-- ~~~ C -->
<!-- #define BUTTON 7 -->
<!-- #define BUZZER 8 -->
<!-- int button_state = 0; -->
<!-- void setup() { -->
<!-- pinMode(BUTTON, INPUT); -->
<!-- pinMode(BUZZER, OUTPUT); -->
<!-- digitalWrite(BUZZER, HIGH); -->
<!-- } -->
<!-- ~~~ -->
<!-- ## Push Button: Software (Part 2) -->
<!-- ~~~ C -->
<!-- void loop() { -->
<!-- button_state = digitalRead(BUTTON); -->
<!-- if (button_state == HIGH) { -->
<!-- digitalWrite(BUZZER, LOW); -->
<!-- } else { -->
<!-- digitalWrite(BUZZER, HIGH); -->
<!-- } -->
<!-- } -->
<!-- ~~~ -->
2016-05-20 15:20:38 -04:00
## The End?
\begin{center}
\LARGE{Questions?}
\end{center}