Upload
carmenez
View
228
Download
3
Embed Size (px)
DESCRIPTION
Â
Citation preview
sensors
INPUTS
OUTPUTSactuators
light
VISUALIZATIONSENVIRONMENT
PRODUINO 2015 Ramin Shambayati / Carmen Aguilar y Wedge
Arduino + Processing
What is Physical Computing?Physical computing is an approach to learning how humans communicate through computers, that starts by considering how humans express themselves physically. We will be building active and interactive physical systems by the use of software and hardware that can sense and respond to the analog world. Good physical interaction should be understandable, enjoyable, useful and meaningful to everyone in general.
DIYOpen Source
Open Source = FREE
Arduino, processing, fritzing, github and many other applications are free to download and use.
*Credit the original owner of the material you have used or modified in a project!
www.opensource.org/
Tinker
Hack
Remix
Modify
Learn
Teach
Share
Credit
intro
intro
Q: What is a Microcontroller? A: A microcontroller is a baby CPU (central processing unit). It operates much slower and is only capable of doing one process at a time. It runs one code at a time until you reprogram it to run a
different code.
pins read data from sensors and transmit data to hardware
Microcontrollers are everywhere:
Intel 4004: 1971. first commercially available microprocessor
Microcontrollers
Sounds easy right?
With the vast amount of ex-amples and tutorials just a click away, it usually is.
Q: What is Arduino?A: It is an “open-source electronic prototyping platform allowing users to create interactive electronic objects.” by making hardware and software easy to use together.
introArduino
basicsHardware
OFFICIAL ARDUINO HARDWAREwww.arduino.cc/en/Main/Products?from=Main.Hardware
Entry Level / Kits Enhanced Features
Wearables
Retired
Internet of Things
3D Printing
basics
ARDUINO-COMPATIBLE MICROCONTROLLERS
Raspberry PiT.I. BeagleBone Black
Adafruit Flora
SparkFun RedBoardIntel Edison
DF Robot Bluno
hardware
UNO
ANALOGUE IN [A0 - A5]these pins take analogue values (i.e., voltage readings from a sen-sor) and convert them into a number
between 0 and 1023.
These can be digital inputs or out-puts, which is specified by the sketch
you create.DIGITAL IO [0 - 13]
ANALOGUE OUT[3, 5, 6, 9, 10, 11]
Six of the digital pins that can be reprogrammed for analogue output.
Analog+Digital Pins
Ground
Digital I/O Pins (2-13)
Serial In (RX)
Serial Out (TX)
Analog Reference
(I2C) SDA - Data line
(I2C) SCL - Clock line
Ground
Analog Input Pins (0-5)
Voltage In (7-12V)5V Output3.3V Output
Reset Pin
USB Plug
Power Supply(7-12V)
www.arduino.cc/en/Main/arduinoBoardUnoforos.giltesa.com/otros/arduino/fc/docs/pinout/uno.jpg
Reset Button
Atmega 328Microcontroller
In-CircuitSerial Programmer
UNOPinout Guide
Digital = ON or OFFAnalog = continuous signal
DIGITAL(on / off)
ANALOG(less / more)
INPUTS OUTPUTS
digitalReadHIGH or LOW255 or 0
analogRead0 to 1023
digitalWriteHIGH or LOW255 or 0
analogWritePWM
0 to 255
digitalvs.analog
input
digitalRead
output
digitalWrite
digitalRead()
digitalRead(pin);LOW/HIGH or 0/255
digitalWrite()
digitalWrite(pin, value);LOW/HIGH or 0/255
5 Volts
0 Volts0 LOW(0)
HIGH(255)1
www.arduino.cc/en/Reference/DigitalReadwww.arduino.cc/en/Reference/DigitalWrite
digitalvs.analog
analogRead()
analogRead(pin);0 - 1023
10 bit analog to digital converter (ADC)www.arduino.cc/en/Reference/AnalogRead
Time
Time
Sample Times
Digitaloutput
Analoginput
0V
0
5V
1023
digitalvs.analog
analogWrite()
analogWrite(value, pin);0 - 255
Pulse Width Modulation (~PWM pins 3, 5, 6, 9, 10, 11)www.arduino.cc/en/Tutorial/PWM
0V
0V
0V
0V
0V
5V
5V
5V
5V
5V
0% Duty Cycle - analogWrite(0)
25% Duty Cycle - analogWrite(64)
50% Duty Cycle - analogWrite(127)
75% Duty Cycle - analogWrite(191)
100% Duty Cycle - analogWrite(255)
digitalvs.analog
When do we use?
digitalRead() - push button, sensors
digitalWrite() - actuator on/off
analogRead() - sensor values
analogWrite() - range of actuation
digitalvs.analog
Sensor | inputdevice that allows to transduce a physical parameter to an electrical signal.
Actuator | outputdevice that allows transducing an electrical signal into a physical parameter.
the interactive device
sensors &actuators
The kit you buy (or make) will include sensors and actuators. You can think of them as inputs and outputs.
sensors: Light, temperature, tilt, button, proximity, potentiometer, accelerometer, microphone, capacitive touch, force, piezo, muscle etc.
actuators: motors, leds, sound, solenoids etc.
https://www.sparkfun.com/categories/23?page=all
the kit
sensors &actuators
download and install the Arduino IDE (Integrated Development Environment)
www.arduino.cc/en/Main/Software
The Arduino programming cycle:
1) Plug your board into a USB port on your computer
2) Write a sketch that will bring the board to life.
3) Upload this sketch to the board through USB connector and wait a couple of seconds for the board to restart.
4) The board executes the sketch you wrote.
softwareArduino IDE
connect LED to the ArduinoCathode (negative) shorter lead - GNDAnode (positive) longer lead - Pin 13
File > Examples > 01.Basics > Blink
2) Verify“Done compiling”
3) UploadResets board, sends & stores sketch on board.“Done uploading”
1) Your sketch goes here
Once the code is in your Arduino board, it will stay there until you put another sketch on it. The sketch will survive if the board is reset or turned off, a bit like the data on your computer’s hard drive.
software“Hello World”Blinking LED
circuitsbreadboard
the breadboard: solderless circuit board (aka protoboard)
power
ground
temporary circuit board for testing and prototyping circuits, no soldering is done on the board, this mean
it is faster and easier to prototype circuits
breadboard hacks
circuitsBlinking LED on breadboard
LEDresistor
Ground Pin 13 (power)
LED Circuit
diagram made with fritzing.org/download
circuits
CIRCUIT a closed, never-ending loop of conductive material. Simple circuits exist, but useful circuits are a mix of wire connecting components controlling the flow of electricity. Complete circuits only work when there are no gaps.
LIVE The live or hot wire carries the incoming electricity.
GROUND earth is the from which voltage is measured, a common return path for electric current, or a direct physical connection to the Earth.
circuitsOhm’s Law
Voltage | Volts (V)the difference in charge between two points(water pressure that can potentially be produced by pump)
Current | Amperes (I)the rate at which charge is flowing.(water flow through the pipes)
ResistanceR (Ohms)a material’s tendency to resist current.(valve’s effect on water flow, which in turn affects turning of wheel)
circuitsWhy resistors?
Calculating Resistance - The resistor is your friend!
The Arduino provides 5V @ MAX 40mA per pin.
Our LED should run at 1.8V @ 20mA (see datasheet) So if we plug it in to the Arduino for too long we risk overruning it we eventually burn it.
Resistors reduce the current that flows across them and are useful for making sure our components aren’t overloaded with too much current.
Let’s use these values in our calculation.
V = (source voltage) – (forward voltage) = 5V – 1.8V = 3.2 VI = 25 mA = 25/1000 = 0.025 A
We need to find R.
V = I*RR = V/I
R = 3.2/0.025 = 128 Ohms.
We need to use 128 Ohm resistor, but why do we use a 220 Ohm one?
The next lowest resistor we have is 100 Ohms, which risks being too little, therefore better safe than sorry and use the next available value, 220. The higher the resistance the dimmer the bulb will get, but it will last longer.
resistancecalculator
http://www.digikey.es/en/resources/conversion-calculators/conversion-calculator-resistor-color-code-4-band
codesetup / loop
1) Make the on-board LED turn on for 3 seconds then off for 5 seconds only once, then continuously turn on for 10 seconds and off for 7 seconds.
2) Make the on-board LED turn off while an external LED turns on, continuously for 4 seconds.
3) Make an external LED shine at half-brightness.
assignment
Read Getting Started with Arduino, to end of Chapter 4.
Build pushbutton with LED circuit(examples 2, 3A, 3B, 3C)
Bonus. Tweak one the examples
{Remember!}*make your work portable.
*use the tools as an extension of your will.
Shops in BarcelonaOnda Radio DiotronicRo-BoticaBCN Dynamics
On-Line Shops near Barcelona (2-4 day shipping)Cooking HacksBricoGeek Reflexiona ElectanBotigaGRN
InternationalSparkFunAdafruit DigiKeySeeed StudioRobotShopDF Robot
Tutorials
learn.adafruit.com 123d.circuits.io/lab
learn.sparkfun.com
arduino.cc/en/Tutorial/HomePage
bildr.org
resources+ reference
it’s a trap!
Ramin ShambayatiCarmen Aguilar y Wedge
proArd_2015.