Sensors with Arduino A Microcontroller.

Slides:



Advertisements
Similar presentations
ARDUINO CLUB What we’re really doing. BASICS The setup() and loop() functions.
Advertisements

Lab7: Introduction to Arduino
Intermediate Electronics and Lilypad Where Electronics Meet Textiles Workshop with Lynne Bruning and Troy Robert Nachtigall Sponsored by Spark Fun and.
Anurag Dwivedi & Rudra Pratap Suman.  Open Source electronic prototyping platform based on flexible easy to use hardware and software.
Embedded Sumo 1T4 – 1T5 UTRA.
Digital & Analog Inputs. Review Fundamental parts of an Arduino program are … Setting output types using pinMode. Declaring variables Can write a digital.
Khaled A. Al-Utaibi  Digital Vs Analog Signals  Converting an Analog Signal to a Digital One  Reading Analog Sensors with the.
Introduction to Arduino Prepared by R. Lamond.  “Arduino is an open-source electronics prototyping platform based on flexible, easy- to-use hardware.
Basic Circuits – Lab 2 Arduino and Sensors Xmedia Spring 2011.
ARDUINO PROGRAMMING Working with the Arduino microcontroller.
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)
Microcontroller Hands-on Workshop #3 Ahmad Manshad New Mexico State University Institute of Electrical and Electronics Engineers November 7, 2009.
1 of 20 Core Arduino Workshop Chris Koehler and Brian Sanders Colorado Space Grant Consortium.
Good LED Circuit 5V0 GND. What Voltage Does Meter See? Answer: 5 V.
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,
1 - Remove LED from 13 and GND - Bring out your breadboard from HW#4 Arduino Overview:
Servo Demonstration In MPIDE, select File > Examples > Servo > Sweep.
INTERNET OF EVERYTHING SDU 2016 Week 4. Simple Digital and Analog Inputs  The Arduino’s ability to sense digital and analog inputs allows it to respond.
Photoresistor resistance changes dramatically with light level living with the lab Using Photoresistors with an Arduino © 2011 LWTL faculty team.
Embedded Programming and Robotics Lesson 11 Arduino Interrupts 1.
ME 120: User-defined functions: average analog input reading Arduino Programming – Part 5: User-defined functions ME 120 Mechanical and Materials Engineering.
Microcontroller basics Embedded systems for mortals.
Robotics Grant Agreement No LLP UK-LEONARDO-LMP Project acronym: CLEM Project title: Cloud services for E-Learning in Mechatronics Technology.
Programming in Arduino Materials:Arduino Board Casperelectronics Pre Pres. Notes Photos from workshop?
Arduino + Bluetooth TYWu. Connection Arduino + Bluetooth Module.
Arduino “Getting Started” Instructor : Dr Matthew Miss Khin Yi Kyaw
Pulse-Width Modulation: Simulating variable DC output
Infrared Proximity Sensors & Liquid Crystal Display Instructor Dr Matthew Khin Yi Kyaw.
ME 120: Photoresistors and Arduino Programming Arduino Programming Case Study: Photoresistor Measurements ME 120 Mechanical and Materials Engineering Portland.
1 Introduction to Coding. 2 Example Codes A lot of example codes are given with Arduino IDE A code can often be based on a previous example rather than.
Arduino Setup & Flexing the ExBow
Breadboards and LED’s with Arduino
Assist. Prof. Rassim Suliyev - SDU 2017
Microcontroller basics
More on LED’s with Arduino
Microcontroller basics
An Arduino Workshop A Microcontroller.
Sensors with Arduino A Microcontroller.
Cascade switching of an LED
Welcome to Arduino A Microcontroller.
Get Your Project Started with Arduino
Arduino Part 1 Topics: Microcontrollers Programming Basics
3.0 ARDUINO WORKSHOP PRESENTATION FOR STUDENTS IN 4º DEGREE OF COMPULSORY SECONDARY EDUCATION 3.0.
Arduino - Introduction
LCD’s with Arduino A Microcontroller.
Arduino Uno and sensors
Control a motors angular position with a flex sensor
Introduction to Arduino Microcontrollers
Analog Input through POT
Roller Coaster Design Project
Continuing with LED’s and Arduino
Arduino Week 2 Lab ECE 1020 Prof. Ahmadi.
Using Photoresistors with an Arduino
CS-4540 Robotics - Lab 05 Switch inputs to the Arduino Uno
Last of the LED’s and Arduino
Sensory perception with Arduino
Secret Door Knock Detector
Arduino : Introduction & Programming
Programming 2: The Arduino IDE & First Sketches
Sensors and actuators Sensors Resistive sensors
CTY SAR FCPS Shawn Lupoli, Elliot Tan
CTY SAR FCPS Shawn Lupoli, Elliot Tan
Aeroponic Engineering and Vertical Farming
Arduino Uno circuit basics
SAURABH GINGADE.
Interrupts.
Pulse-Width Modulation: Simulating variable DC output
CTY SAR FCPS Alexander Velikanov
Presentation transcript:

Sensors with Arduino A Microcontroller

Exercise 20 – IR sensor Using IR proximity to detect objects

First exploration <File>, <Examples>, <0.1 Basics>, <AnalogReadSerial> Then open the serial monitor (which is where?) Wave your hand over the IR sensor What do you see? What does it mean? How could you use the numbers shown in the serial monitor?

Exploring further <File>, <Examples>, <0.5 Control>, <IfStatementConditional> Wave your hand over the IR sensor What happens? Why, what range? Varying the ‘const int threshold’ will vary its sensitivity not its range

Different types Check the datasheet for performance Look up a datasheet online, for example: http://www.sharp-world.com/products/device/lineup/data/pdf/datasheet/gp2y0a41sk_e.pdf

Exercise 21 - Flexiforce flexiforce to measure pressure Open the serial monitor and watch what happens when you flex the sensor

Flexi-force script /* Flex Sensor and LEDs created by ScottC on 23rd May 2011 updated on 16/05/2012. Exercise 21 -----------------------------------------------------*/ //Flex Sensor Pin (flexPin) //the analog pin the Flex Sensor is connected to int flexPin = 0; int flexposition; void setup() { for (int i=4; i<14; i++){ pinMode(i, OUTPUT); //sets the led pins 4 to 13 to output } void loop(){ //Ensure to turn off ALL LEDs before continuing digitalWrite(i, LOW); Serial.begin(9600); Serial.println("sensor: "); Serial.print(flexposition); flexposition = analogRead(flexPin); /* Read the flex Level Adjust the value 130 to 275 to span 4 to 13 The values 130 and 275 may need to be widened to suit the minimum and maximum flex levels being read by the Analog pin */ int flexReading = map(analogRead(flexPin), 130, 275, 4, 13); // int flexReading = map(analogRead(flexPin), 200, 450, 4, 13); authors modified code line // Make sure the value does not go beyond 4 or 13 int LEDnum = constrain(flexReading, 4, 13); /*Call the blink function: this will turn the LED on for 10 milliseconds, and keep it off for only 1 millisecond. You can change the blink rate by changing these values, however, I want a quick response time when the flex sensor bends, hence the small values. LEDnum determines which LED gets turned on.*/ blink(LEDnum, 10,1); } // The blink function - used to turn the LEDs on and off void blink(int LEDPin, int onTime, int offTime){ // Turn the LED on digitalWrite(LEDPin, HIGH); // Delay so that you can see the LED go On. delay(onTime); // Turn the LED Off digitalWrite(LEDPin, LOW); // Increase this Delay if you want to see an actual blinking effect. delay(offTime); http://arduinobasics.blogspot.co.nz/2011/05/arduino-uno-flex-sensor-and-leds.html

What does it work like? A variable resistor The more it bends the higher the resistance

Notes on the code Using the serial monitor: We need to specify a comm link: Serial.begin(9600); Then we need to choose what we print to the serial monitor: Serial.println("sensor: "); //println at the end sets a carriage return (new line) Serial.print(flexposition); flexposition = analogRead(flexPin);

Alternative exercise – Flex Sensor and Servo Read through the SIK script <File>, <Examples>, <SIK_Guide_Code_32>, <Circuit_09>