Basic Circuits – Lab 2 Arduino and Sensors

Slides:



Advertisements
Similar presentations
EMS1EP Lecture 9 Analog to Digital Conversion (ADC) Dr. Robert Ross.
Advertisements

Intermediate Electronics and Lilypad Where Electronics Meet Textiles Workshop with Lynne Bruning and Troy Robert Nachtigall Sponsored by Spark Fun and.
Servo Background Servos provide control of rotary position Servos are used extensively in the remote control hobby world for: Aircraft (flaps, ailerons,
temperature system wiring
Introduction to Sensor Technology Week Four Adam Taylor
Circuits Series and Parallel. Series Circuits Example: A 6.00 Ω resistor and a 3.00 Ω resistor are connected in series with a 12.0 V battery. Determine.
Working with Arduino: Lesson #2: Variable, Photo, and Force Sensitive Resistors EGN1007.
Basic Circuits – Lab 1 Xmedia Spring Basically Power –Provides energy for the sensor and the output Sensor –Changes aspects of the circuit based.
Before we get started, let’s review: Describe a Series Circuit.
Basic Circuits – Lab 1 Xmedia Spring Basically Power –Provides energy for the sensor and the output Sensor –Changes aspects of the circuit based.
Basic Circuits – Lab 2 Arduino and Sensors Xmedia Spring 2011.
Ohm’s Law V = IR.
ARDUINO PROGRAMMING Working with the Arduino microcontroller.
DataInputFrom Digital PinsUsing an On/OFF button to control an LEDFrom Analog Pins Reading light intensity using a photocell and turning an LED on and.
Series and Parallel Circuits. Circuits  Can either be series or parallel.
Image of Arduino. Arduino discussion Address issues with circuit walk-through – Electricity, Programming, Arduino Concepts Work on BeatTable (next week)
Tele-presence – Connecting Two Processing Platforms via Internet Controlling the Screen based on Distant User Input ServerClient 1.
Electric Circuits with Multiple Loads Some electric devices, such as calculators, simple cameras, and flashlights, operate only one electric load.
Electricity Define Electricity: Electrons: Short Circuit: Current: Battery: Voltage:
Parallel Circuits – Chapter 5
Series and Parallel Circuits. Series Circuit Current must pass through all resistors.
PARALLEL CIRCUITS HAVE MORE THAN ONE POSSIBLE PATHWAY FOR ELECTRONS.
Pulse Width Modulation (PWM). 100% Pulse Width Modulation (PWM) 0% On the chipKIT there are 490 periods per second. Use analogWrite(pin, value) to control.
Series Current Series Voltage Drops In a series circuit the sum of the voltage drops across each resistor or device is equal to the potential difference.
Sparkfun Electronics ATtiny85 Arduino Quick Reference Sheet
Series Series circuits Current in series circuits Voltage in series circuits.
Serial Communication. mouseX from computer to arduino processing sends a single byte of data arduino reads each byte arduino uses value to set light brightness.
ARDUINO 1. Basics  Comments  /* * Blink * * The basic Arduino example. Turns on an LED on for one second, * then off for one second, and so on... We.
Arduino Circuits and Code. int ledPin = 9; void setup() { pinMode(ledPin, OUTPUT); } void loop() { digitalWrite(ledPin, LOW); delay(1000); digitalWrite(ledPin,
Basic Circuits – Lab 4 Serial and OSC (maybe some theory too) Xmedia Spring 2011.
Youn-Hee Han, In-Seok Kang {yhhan, Laboratory of Intelligent Networks Advanced Technology Research Center Korea University of Technology.
Servo Demonstration In MPIDE, select File > Examples > Servo > Sweep.
Line following tips photoresistors positioned near floor photoresistor circuits © 2011 LWTL faculty team living with the lab.
Basic Circuits – Lab 5 Wireless Networking Xmedia Spring 2011.
Photoresistor resistance changes dramatically with light level living with the lab Using Photoresistors with an Arduino © 2011 LWTL faculty team.
Welcome to Processing Who does not have access to digital camera?
Potential – Learning Outcomes  Draw and discuss a potential divider.  Demonstrate a potential divider.  Discuss potentiometers and their use in variable.
Electronics for Physical Computing Materials: capacitor, diode, LED, transistor, switch,resistor, relay, proto board, multimeter.
Embedded systems and sensors 1 Part 2 Interaction technology Lennart Herlaar.
ME 120: User-defined functions: average analog input reading Arduino Programming – Part 5: User-defined functions ME 120 Mechanical and Materials Engineering.
Section Objectives  Describe how current divides in a parallel circuit.  Determine the voltage across and current through each branch of a parallel.
Microcontroller basics Embedded systems for mortals.
Bdps 2 Lecture 2. Circuits and Ohm's Law For resistive circuits.
Arduino + Bluetooth TYWu. Connection Arduino + Bluetooth Module.
:Blink Blink: Er. Sahil Khanna
Electronic instrumentation Digitization of Analog Signal in TD
ME 120: Arduino Programming Arduino Programming Part 1 ME 120 Mechanical and Materials Engineering Portland State University
Ultrasonic Sensor TYWu.
ME 120: Photoresistors and Arduino Programming Arduino Programming Case Study: Photoresistor Measurements ME 120 Mechanical and Materials Engineering Portland.
Microcontroller basics
9I Energy and Electricity
Tele-presence – Connecting Two Processing Platforms via Internet
Parallel Circuits 1. parallel circuits in which the voltage is the same across each branch and the sum of the currents in each branch is equal to the.
Sensors with Arduino A Microcontroller.
Line Following Tips photoresistor circuits
Arduino Uno and sensors
Analog Input through POT
Introduction to Arduinos
Using Photoresistors with an Arduino
Line Following Tips photoresistor circuit
Programming 2: The Arduino IDE & First Sketches
Series and Parallel circuits
Sensors and actuators Sensors Resistive sensors
CTY SAR FCPS Shawn Lupoli, Elliot Tan
Arduino 7 Segment Display Lab
Series and Parallel Circuit
Arduino UMBC IEEE Sekar Kulandaivel
CTY SAR FCPS Alexander Velikanov
Presentation transcript:

Basic Circuits – Lab 2 Arduino and Sensors Xmedia Spring 2011

Agenda Resistive Sensors Serial Communication Processing

Arduino – Reading Analog Sensor Data // Example 06B: Set the brightness of LED to // a brightness specified by the // value of the analogue input #define LED 9 // the pin for the LED int val = 0; // variable used to store the value // coming from the sensor void setup() { pinMode(LED, OUTPUT); // LED is as an OUTPUT // Note: Analogue pins are // automatically set as inputs } void loop() { val = analogRead(0); // read the value from // the sensor Serial.println(val); analogWrite(LED, val/4); // turn the LED on at // the brightness set // by the sensor delay(10); // stop the program for // some time

Resistive Sensors Flex or bend sensor Resistance increases with bend ~11k -> ~30k (straight -> bent) Photo resistor (i.e. light sensor) Resistance increases when covered ~2k -> ~60k (lots of light -> little light) Force sensitive resistor (FSR, i.e. pressure sensor) Resistance decreases with pressure ~4k -> ~0.5k (light touch -> lots of pressure) Different sensors have different specifications Read the datasheet or test using a multimeter

Arduino – Resistive Sensor // Example 06B: Set the brightness of LED to // a brightness specified by the // value of the analogue input #define LED 9 // the pin for the LED int val = 0; // variable used to store the value // coming from the sensor void setup() { pinMode(LED, OUTPUT); // LED is as an OUTPUT // Note: Analogue pins are // automatically set as inputs } void loop() { val = analogRead(0); // read the value from // the sensor Serial.println(val); analogWrite(LED, val/4); // turn the LED on at // the brightness set // by the sensor delay(10); // stop the program for // some time

Arduino – Notes about code analogRead(pin); Returns 0 to 1023 analogWrite(pin, val); Max val = 255 void loop() { val = analogRead(0); // read the value from the sensor Serial.println(val); analogWrite(LED, val/4); // turn the LED on at the brightness set by the sensor delay(10); // stop the program for some time }

Arduino – Serial Communication #define LED 9 int val = 0; void setup() { Serial.begin(9600); pinMode(LED, OUTPUT); } void loop() { val = analogRead(0); Serial.println(val); analogWrite(LED, val/4); delay(10); import processing.serial.* Serial sPort; int val; void setup() { println(Serial.list()); //find the port that is your arduino sPort = new Serial(this, Serial.list()[2], 9600); //set the position of the array so it corresponds //to your arduino } void draw() while(sPort.available() > 0) val = sPort.read(); println(val); background(val);

Processing – Notes about code Serial sPort; //creates the serial port object sPort = new Serial(this, Serial.list()[2], 9600); //instantiates the object and //opens the port sPort.available(); //returns the number of bytes in the buffer to be read sPort.read(); //returns the next byte in the buffer Each value added to the buffer by the Arduino is one byte (0 to 1023). The buffer may contain more than one byte. If you need to transmit data that requires more than one byte, you need to set up a protocol. http://www.processing.org/learning/library/serialcallresponse.html void serialEvent(Serial sPort) {} //event method called when data is //available http://www.processing.org/reference/libraries/serial/serialEvent_.html

Scaling Function

Lighting 3 LEDs in Parallel Each LED gets its own resistor Build this circuit Measure the voltage across each branch Measure the current out of the battery and before each LED

Current Split - Parallel Sum of the current through each branch equals the current from the power source Voltages are the same in each branch

Lighting 3 LEDs in Series One resistor for all the LEDs Build this circuit Measure the voltage across each LED Measure the current out of the battery and before each LED

Voltage Split - Series Voltage across each component is different Current through each component is the same

Voltage Divider Vout = Vin * R2 / (R1 + R2) If R1 is variable, as R1 increases Vout decreases

Calculating Resistance Series Rtotal = R1 + R2 + . . . + Rn Paralell 1/Rtotal = 1/R1 + 1/R2 + … + 1/Rn