DOC PREVIEW
Purdue CS 59000 - Arduino Workshop

This preview shows page 1-2-3-4-5 out of 15 pages.

Save
View full document
View full document
Premium Document
Do you want full access? Go Premium and unlock all 15 pages.
Access to all documents
Download any document
Ad free experience
View full document
Premium Document
Do you want full access? Go Premium and unlock all 15 pages.
Access to all documents
Download any document
Ad free experience
View full document
Premium Document
Do you want full access? Go Premium and unlock all 15 pages.
Access to all documents
Download any document
Ad free experience
View full document
Premium Document
Do you want full access? Go Premium and unlock all 15 pages.
Access to all documents
Download any document
Ad free experience
View full document
Premium Document
Do you want full access? Go Premium and unlock all 15 pages.
Access to all documents
Download any document
Ad free experience
Premium Document
Do you want full access? Go Premium and unlock all 15 pages.
Access to all documents
Download any document
Ad free experience

Unformatted text preview:

Winkler, Arduino workshop, sensors, p.1 Envision Art 01: the responsive screen Prof. Fabian Winkler Spring 2007 Arduino Workshop Arduino see: http://www.arduino.cc Arduino is an open-source physical computing platform based on a simple i/o board, and a development environment for writing Arduino software. Arduino can be used to develop interactive objects, taking inputs from a variety of switches or sensors, and controlling a variety of lights, motors, and other outputs. Arduino projects can be stand-alone, or they can communicate with software running on your computer (e.g. Flash, Processing, MaxMSP). The open-source IDE can be downloaded for free. • Arduino is an open source project, owned by nobody and supported by many. • The Team is composed of Massimo Banzi, David Cuartielles, Tom Igoe, Gianluca Martino, David Mellis and Nicholas Zambetti • Yaniv Steiner and Giorgio Olivero have been supporting the project and are working at using it with the Instant Soup platform. • The Arduino platform includes the avr-gcc tool chain, uisp, and the Procyon AVR-LIB by Pascal Stang. • The Arduino language syntax is based on Wiring by Hernando Barragan Why using Arduino? • It is flexible, offers a variety of digital and analog inputs, SPI and serial interface and digital and PWM outputs • It is easy to use, connects to computer via USB and communicates using standard serial protocol, runs in standalone mode and as interface connected to PC/Macintosh computers • It is inexpensive, around $30 per board and comes with free authoring software • It is an open-source project, software/hardware is extremely accessible and very flexible to be customized and extended • Arduino is backed up by a growing online community, lots of source code is already available and we can share and post our examples for others to use, too!Winkler, Arduino workshop, sensors, p.2 Introduction to the Arduino Board (see: http://www.arduino.cc/en/Guide/Board) Looking at the board from the top down, this is an outline of what you will see (parts of the board you might interact with in the course of normal use are highlighted): Starting clockwise from the top center: • Analog Reference pin (orange) • Digital Ground (light green) • Digital Pins 2-13 (green) • Digital Pins 0-1/Serial In/Out - TX/RX (dark green) - These pins cannot be used for digital i/o (digitalRead and digitalWrite) if you are also using serial communication (e.g. Serial.begin). • Reset Button - S1 (dark blue) • In-circuit Serial Programmer (blue-green) • Analog In Pins 0-5 (light blue) • Power and Ground Pins (power: orange, grounds: light orange) • External Power Supply In (9-12VDC) - X1 (pink) • Toggles External Power and USB Power (place jumper on two pins closest to desired supply) - SV1 (purple) • USB (used for uploading sketches to the board and for serial communication between the board and the computer; can be used to power the board) (yellow)Winkler, Arduino workshop, sensors, p.3 Sensors Sensors are electronic devices that measure a physical quality such as light or temperature and convert it to a voltage. This process of changing one form of energy into another is called transduction. Often, sensors are also referred to as transducers. Sensors can be broadly classified in two categories: digital sensors and analog sensors. A digital sensor's output can only be in one of two possible states. It is either ON (1) often +5V, or OFF (0), 0V. Most digital sensors work with a threshold. Is the incoming measurement below the threshold, the sensor will output one state, is it above the threshold, the sensor will output the other state. In contrast to a digital sensor, an analog sensor's output can assume any possible value in a given range. Very often the output of an analog sensor is a variable resistance that can be used to control a voltage. Rather than only being able to toggle between two states ( cf. a digital sensor) the analog sensor can output an almost infinite range of values. In the following examples we will take a look at a couple of digital and analog sensors. We will begin with the simplest digital sensor, the switch. When a switch is open, no current flows. In contrast, when a switch is closed, current flows (i.e. closed = ON). A switch that stays in the position it was put is called a latching switch. Switches can be spring loaded (e.g. microswitches/snap action switches), in this case they are called momentary. A simple switch can be Normally Open (NO) or Normally Closed (NC). tactile switch/ subminiature switch/ miniature toggle switch pushbutton switch snap action switch NO NC CWinkler, Arduino workshop, sensors, p.4 Connecting a Switch to the Arduino Board This is probably the simplest possible example to get started with Arduino. It uses an external switch and the Arduino board to turn ON or OFF the on-board LED (see: http://www.arduino.cc/en/Tutorial/Pushbutton): 1. Connect a switch (you can replace the switch with a plain jumper wire) to the Arduino board in the following way: Why do we need the resistor R1? R1 guarantees that the Arduino’s digital input pin 7 is connected to a constant voltage of +5V whenever the push button is not pressed. If the push button is pressed, the signal on pin 7 drops to ground (GND), at the same time the Arduino’s +5V power is connected to GND, we avoid a shorted circuit by limiting the current that can flow from +5V to GND with a resistor (1 - 10 KΩ). Also, if there was no connection from pin 7 to +5V at all, the input pin would be “floating” whenever the pushbutton is not pressed. This means that it is connected neither to GND nor to +5V, picking up electrostatic noise leading to a false triggering of the input. 2. Open the Arduino software and write the following code: /* Basic Digital Read * ------------------ * * turns on and off a light emitting diode(LED) connected to digital * pin 13 (onboard LED, when pressing a pushbutton attached to pin 7. * It illustrates the concept of Active-Low, which consists in * connecting buttons using a 1K to 10K pull-up resistor. * * Created 1 December 2005 * copyleft 2005 DojoDave <http://www.0j0.org> * http://arduino.berlios.de * */ int ledPin = 13; // choose the pin for the LED int inPin = 7; // choose the input pin (for a pushbutton)Winkler, Arduino workshop, sensors, p.5 int val = 0; // variable


View Full Document

Purdue CS 59000 - Arduino Workshop

Documents in this Course
Lecture 4

Lecture 4

42 pages

Lecture 6

Lecture 6

38 pages

Load more
Download Arduino Workshop
Our administrator received your request to download this document. We will send you the file to your email shortly.
Loading Unlocking...
Login

Join to view Arduino Workshop and access 3M+ class-specific study document.

or
We will never post anything without your permission.
Don't have an account?
Sign Up

Join to view Arduino Workshop 2 2 and access 3M+ class-specific study document.

or

By creating an account you agree to our Privacy Policy and Terms Of Use

Already a member?