Sensors with Arduino A Microcontroller.

Slides:



Advertisements
Similar presentations
Khaled A. Al-Utaibi  Digital Vs Analog Signals  Converting an Analog Signal to a Digital One  Reading Analog Sensors with the.
Advertisements

Living with the Lab Using Your Arduino, Breadboard and Multimeter EAS 199A Fall 2011 Work in teams of two!
PING))) Ultrasonic Distance Sensor living with the lab ultrasonic pressure waves from PING))) speaker The PING))) sensor emits short bursts of sound and.
1 Ultrasonic Distance Sensor. 2 How it Works The distance sensor emits short bursts of sound and listens for this sound to echo off of nearby objects.
Basic Circuits – Lab 2 Arduino and Sensors Xmedia Spring 2011.
PROGRAMMING WITH ARDUINO. Arduino An open-source hardware platform based on an Atmel AVR 8-bit microcontroller and a C++ based IDE Over boards.
Embedded Programming and Robotics Lesson 10 Ultrasonic Range Finder Range Finder1.
ARDUINO PROGRAMMING Working with the Arduino microcontroller.
Arduino Part 2 Topics: Serial Communication Programming Constructs: functions, loops and conditionals Digital Input.
Sensors Material taken from Robotics with the Boe-Bot.
Sensors. This is a set of transmitter and receiver in one of the photoelectric sensor. Detection distance can be adjusted according to the requirements.
PING))) Ultrasonic Distance Sensor living with the lab ultrasonic pressure waves from PING))) speaker The PING))) sensor emits short bursts of sound and.
1 of 20 Core Arduino Workshop Chris Koehler and Brian Sanders Colorado Space Grant Consortium.
Material taken from Robotics with the Boe-Bot
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.
TechKnowTone Contents: Sensor Features Sensor Connections Sample Sketch Questions …Sensor Features… Arduino Coding – Distance Sensors.
Temperature Sensor TYWu. Seeed’s Temperature Sensor Picture.
Final Term Project Hi-Tek Smoke Detektor By: Rohan Sharma.
INTERNET OF EVERYTHING SDU 2016 Week 6. Getting Input from Sensors  Sensors give report on the world around it  Sensors convert physical input an electrical.
LAB1 TYWU. Devices Dip Switch (4 Switches) Triple Output LED (RGB) –Common Cathode.
Introduction to Arduino A very basic intro to Arduino, the IDE and the Servos class.
Istituto Tecnico Industriale A.Monaco EURLAB Object Detection Object Detection by Ultrasonic How to install and program a ultra sonic sensor with Arduino.
Istituto Tecnico Industriale A.Monaco EURLAB Object Detection Object Detection by Ultrasonic How to install and program a ultra sonic sensor with Arduino.
Arduino “Getting Started” Instructor : Dr Matthew Miss Khin Yi Kyaw
Ultrasonic Sensor TYWu.
Infrared Proximity Sensors & Liquid Crystal Display Instructor Dr Matthew Khin Yi Kyaw.
DC Motor – H bridge L293D ile Kontrolü /* Adafruit Arduino - Lesson 15. Bi-directional Motor */ int enablePin = 11; int in1Pin = 10; int in2Pin = 9; int.
physical computing .2 – Day 3
What is Arduino? It's an open source electronics prototyping platform: Open source: resources that can be used, redistributed or rewritten free of charge,
ARDUINO UNO The Arduino uno is a microcontroller board based on the ATmega328. It has 14 digital Input / Output pins (of which 6 can be used as PWM outputs),
Having fun with code, using Arduino in a middle school CS classroom
Outline Sensors Embedded and real-time operating systems FreeRTOS
Servo’s and Motor’s with Arduino
Using Arduino and Cheap Ultrasonic Transducer for Robotics
Application of Programming: Scratch & Arduino
Breadboards and LED’s with Arduino
Using Arduinos to Teach Engineering Concepts
Assist. Prof. Rassim Suliyev - SDU 2017
DHT 11 Sensor Connect the sensor with Arduino board like picture below. Download DHT11 Sensor library from
RECAP OF THE LAST LESSON
Arduino Alarm System Guanglong Hu GeoSc 597 Final Project
An Arduino Workshop A Microcontroller.
Welcome to Arduino A Microcontroller.
Get Your Project Started with Arduino
Ultrasonic Distance Sensor
UltraSonic Sensor VCC is the pin that powers the device, connect to 5V. Trigger is the pin that sends out the burst. Echo is the pin that outputs when.
Arduino motor control using servo & ultrasonic sensor
Sensors with Arduino A Microcontroller.
Arduino Part 1 Topics: Microcontrollers Programming Basics
Arduino.
Arduino - Introduction
LCD’s with Arduino A Microcontroller.
Chapter E –Transistors and H-Bridges
Arduino Uno and sensors
SENSORS AND ARDUINO.
ARDUINO     What is an Arduino? Features 14 Digital I/O pins 6 Analogue inputs 6 PWM pins USB serial 16MHz Clock speed 32KB Flash memory 2KB SRAM.
Maxbotix Ultrasonic Distance Sensor
Continuing with LED’s and Arduino
Ultrasonic Distance Sensor
Arduino Week 2 Lab ECE 1020 Prof. Ahmadi.
Last of the LED’s and Arduino
Arduino Practice: Photoresistors, PWM, Potentiometers, Motors
Teacher’s Note (do not include in student packet/slide show)
Sensors and actuators Sensors Resistive sensors
The George Washington University Electrical & Computer Engineering Department ECE 1020 Dr. S. Ahmadi Lab 1.
CTY SAR FCPS Shawn Lupoli, Elliot Tan
frclabviewtutorials.com/workshop
CTY SAR FCPS Alexander Velikanov
Ultrasonic Distance Sensor
Presentation transcript:

Sensors with Arduino A Microcontroller

Exercise 22 – Temperature sensor The SIK kit has 2 sensors that look the same, the tmp36 and the 222 Use the tmp36 If you use the 222 then when you look at the serial monitor it will have negative numbers displayed (for project 7)

Fritzing diagram Note the facing of the sensor and the connectors <File>, <Examples>, <SIK_Guide_Code_32>, <Circuit_07>

Reading the temperature sensor: Flat face Curved face

Notes on the code Should be familiar by now The conversion from an analog reading to temperature is the most interesting part: Analog reads 0-1023 (LOW – 0v, to HIGH, 5v) Convert this reading to a percentage (relating the range 0-1023 to 0-5v) Using a datasheet specific to each temperature sensor type convert the reading to temperature

Exercise 23 – Ultrasonic sensor HC-SR04 has 4 connectors: VCC – Power Trig – Trigger Echo – receive 4 GND – ground Measuring angle: 15o Ranging distance: 2cm-4cm

Write the code void setup() { Serial.begin(9600); pinMode(trigPin,OUTPUT); //set the trigger to pulse pinMode(echoPin, INPUT); //set the echo to read the pulse return } float distanceCm(){ //define a new function, in 2 parts, one for the trigger (pulse) and one for the echo (return) digitalWrite(trigPin, LOW); //set to zero to start delayMicroseconds(3); //rapid pulses digitalWrite(trigPin, HIGH); delayMicroseconds(5); digitalWrite(trigPin, LOW); float tUs = pulseIn(echoPin, HIGH); float t = tUs / 1000.0 / 1000.0 / 2.0; //convert microseconds to seconds float d = t*v; //distance = time x velocity return d*100; //to give a result in cm void loop() { int d=distanceCm(); Serial.println(d, DEC); delay (200); // Exercise 23 // Sourced from p58 Kimmo and Tero Karvinen, Make: Getting started with sensors, p58 // HC-SR04 Ultrasonic sensor for distance int trigPin = 8; //When set to HIGH this will trigger the sensor to emit a pulse int echoPin = 7; //the echo pin will lsiten for the response to the triggers pulse float v=343.21+0.6*20; // the speed of sound is 343.21 meters per second at 20 degrees C // the calc also sets the temp as 20 degrees C // for a slight gain in accuracy - what is the room temperature and what is the speed of sound at that temp?

Running the code Teacher can email the code to you USB key Copy from screen… Write, compile, upload… Open the serial monitor and wave your hand over the sensor Test it, explore

Exercise 24 - Add two LED’s, Stop/Go

The code: void loop() { long duration, distance; digitalWrite(trigPin, LOW); delayMicroseconds(2); digitalWrite(trigPin, HIGH); delayMicroseconds(10); duration = pulseIn(echoPin, HIGH); distance = (duration/2) / 29.1; if (distance < 10) { // This is where the LED On/Off happens digitalWrite(led1,HIGH); // When the Red condition is met, the Green LED should turn off digitalWrite(led2,LOW); } else { digitalWrite(led1,LOW); digitalWrite(led2,HIGH); if (distance >= 200 || distance <= 0){ Serial.println("Out of range"); Serial.print(distance); Serial.println(" cm"); delay(500); // Exercise 24 // Using HC-SR04 Ping distance sensor to activate 2 LED's // LED1 = Red on Pin 11, LED2 = Green on Pin 10 #define trigPin 8 #define echoPin 7 #define led1 11 #define led2 10 void setup() { Serial.begin (9600); pinMode(trigPin, OUTPUT); pinMode(echoPin, INPUT); pinMode(led1, OUTPUT); pinMode(led2, OUTPUT); }

Notes on the code What's different? What does that mena? Why?