Basic Circuits – Lab 4 Serial and OSC (maybe some theory too) Xmedia Spring 2011.

Slides:



Advertisements
Similar presentations
Wireless Cue Light Project
Advertisements

Unit 8 Combination Circuits
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 Chapter 35. LAB 21 What will happen to bulbs 1 and 2 when you disconnect the wires at various points? Consensus: Current requires a closed loop.
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.
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.
Basic Circuits – Lab 2 Arduino and Sensors
Image of Arduino. Arduino discussion Address issues with circuit walk-through – Electricity, Programming, Arduino Concepts Work on BeatTable (next week)
DPNM Lab., POSTECH 1/25 CS490K - Internet of Things (IoT) Jonghwan Hyun DPNM Lab. Department of Computer Science and Engineering, POSTECH
Tele-presence – Connecting Two Processing Platforms via Internet Controlling the Screen based on Distant User Input ServerClient 1.
Sensors Material taken from Robotics with the Boe-Bot.
Electric Circuits with Multiple Loads Some electric devices, such as calculators, simple cameras, and flashlights, operate only one electric load.
1 LC1 Core Science Project.  Components :-  -Electrons Move from the (-ve) to (+ve) side -Electric current moves from (+ve) to (-ve) side -Energy is.
Practical Electronics & Programming
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.
Robootika lahenduste esitlus Raul Liinev Martin Ligema Siim Suu Martin Tõnne.
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,
Ohm’s Law Resistance in Series Circuits
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.
Serial Communication RS-232. In order to make two devices communicate, whether they are desktop computers, microcontrollers, or any other form of integrated.
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.
INTERNET OF EVERYTHING SDU 2016 Week 12. Remotely Controlling Devices  interact with almost any device that uses some form of remote control  TVs, audio.
Bdps 2 Lecture 2. Circuits and Ohm's Law For resistive circuits.
Arduino + Bluetooth TYWu. Connection Arduino + Bluetooth Module.
Electronic instrumentation Digitization of Analog Signal in TD
Ultrasonic Sensor TYWu.
ME 120: Photoresistors and Arduino Programming Arduino Programming Case Study: Photoresistor Measurements ME 120 Mechanical and Materials Engineering Portland.
Advantages and Disadvantages of Series and Parallel Circuits
Solving Circuits.
Wireless Cue Light Project
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.
Line Following Tips photoresistor circuits
Arduino Uno and sensors
3.1 Serial Communication Part 1
Analog Input through POT
Using Photoresistors with an Arduino
Line Following Tips photoresistor circuit
Series & Parallel Circuits
Programming 2: The Arduino IDE & First Sketches
Series and Parallel circuits
CTY SAR FCPS Shawn Lupoli, Elliot Tan
Arduino 7 Segment Display Lab
Parallel Circuits.
Series and Parallel Circuit
Arduino UMBC IEEE Sekar Kulandaivel
CTY SAR FCPS Alexander Velikanov
Presentation transcript:

Basic Circuits – Lab 4 Serial and OSC (maybe some theory too) Xmedia Spring 2011

Agenda Build your resistive sensor circuit Serial Communication –Arduino to Processing OSC –Processing to Unity

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 – 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); }

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. – void serialEvent(Serial sPort) {} //event method called when data is //available – Processing – Notes about code

Processing - OSC Basically a data structure String like object sent to a port Use oscP5 and netP5 libraries – Open Sound Control –originally for sharing music performance data Message Specification –similar to xml Name Value Pairs

Processing – Serial and OSC import processing.serial.*; import oscP5.*; import netP5.*; OscP5 oscP5; NetAddress myRemoteLocation; Serial sPort; int val; void setup() { oscP5 = new OscP5(this,12000); myRemoteLocation = new NetAddress(" ",32000); println(Serial.list()); sPort = new Serial(this, Serial.list()[2], 9600); } //... void draw() { while(sPort.available() > 0) { val = sPort.read(); } } void mousePressed() { OscMessage myOscMessage = new OscMessage("/pilot"); myOscMessage.add(val); println(myOscMessage.get(0).intValue()); oscP5.send(myOscMessage, myRemoteLocation); }

Processing - OSC oscP5 = new OscP5(this,12000); listening on port 1200 for OSC messages myRemoteLocation = new NetAddress(" ",32000); creates a location to send messages to on this machine on port OscMessage myOscMessage = new OscMessage("/pilot"); creates a new OSC message with the address pattern of /pilot myOscMessage.add(val); adds the value from the sensor to the messge println(myOscMessage.get(0).intValue()); prints the value at location 0 in the message as an int oscP5.send(myOscMessage, myRemoteLocation); sends the message to the location defined in setup()

Processing - OSC The specifics of the address pattern and the remote location will depend on the 3D side of the project. We will be coordinating this.

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 V out = V in * R 2 / (R 1 + R 2 ) If R 1 is variable, as R 1 increases V out decreases

Calculating Resistance Series –R total = R 1 + R R n Paralell –1/R total = 1/R 1 + 1/R 2 + … + 1/R n