Line following tips photoresistors positioned near floor photoresistor circuits © 2011 LWTL faculty team living with the lab.

Slides:



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

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
Panasonic EVE-KC2F2024B 24 pulses per revolution 6mm diameter flattened output shaft output type: quadrature (incremental) minimum life: 15,000 rotations.
Digital & Analog Inputs. Review Fundamental parts of an Arduino program are … Setting output types using pinMode. Declaring variables Can write a digital.
Introduction to Arduino Programming January MER-421:Mechatronic System Design.
Waterproofing a thermistor ENGR 121 living with the lab © 2013 David Hall.
User-defined functions in Arduino sketches living with the lab © 2012 David Hall.
Lesson 4: Breathing Monitors. Breathing Monitors In the past 3 classes, we’ve learned – How to write to a digital pin – How to read the value of a digital.
Working with Arduino: Lesson #2: Variable, Photo, and Force Sensitive Resistors EGN1007.
Analog and Digital Measurements living with the lab 14 digital input / output pins 6 analog input pins © 2011 LWTL faculty team.
Basic Circuits – Lab 2 Arduino and Sensors Xmedia Spring 2011.
Parallax 4x20 LCD (part number 27979) with Arduino Duemilanove
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)
Control Angle via Button Pushes One button increases angle. Other decreases angle. Both light LED.
Intro to Arduino Programming. Draw your circuits before you build them From Arduino 330 Ohm From Arduino 330 Ohm From Arduino 330 Ohm.
Arduino Week 2 Lab ECE 1020 Prof. Ahmadi. Objectives 1. Control the rotation of standard servo motor  A standard servo motor is limited in its rotation.
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.
Good LED Circuit 5V0 GND. What Voltage Does Meter See? Answer: 5 V.
Servos The material presented is taken from a variety of sources including:
Suleyman Demirel University CSS340 Microprocessor Systems – Lecture 2 ATMEGA328P ARCHITECTURE ANALOG INPUTS.
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:
Basic Circuits – Lab 4 Serial and OSC (maybe some theory too) Xmedia Spring 2011.
Servo Demonstration In MPIDE, select File > Examples > Servo > Sweep.
PHY 235 Robotics Workshop Day 4 Robotic Behaviors, Light Sensing, Voltage Dividers, LCD-MOD.
Arduino Training New Mexico Mathematics, Engineering, and Science Achievement (NM MESA) Getting Started.
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.
Welcome to Processing Who does not have access to digital camera?
Anodo (+) Catodo (-) Esempi: Rosso _ Rosso – Nero- Nero + (Marrone) = 220 ohm Marrone – Nero – Nero – Marrone + (Marrone) = 1 Kohm Marrone – Nero- Nero.
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.
Lecture 9: Introduction to Arduino Topics: Arduino Fundamentals, Bean Date: Mar 22, 2016.
Robotics Grant Agreement No LLP UK-LEONARDO-LMP Project acronym: CLEM Project title: Cloud services for E-Learning in Mechatronics Technology.
LAB1 TYWU. Devices Dip Switch (4 Switches) Triple Output LED (RGB) –Common Cathode.
Electronic instrumentation Digitization of Analog Signal in TD
Pulse-Width Modulation: Simulating variable DC output
Ultrasonic Sensor TYWu.
Microcontroller basics Embedded systems for mortals.
ME 120: Photoresistors and Arduino Programming Arduino Programming Case Study: Photoresistor Measurements ME 120 Mechanical and Materials Engineering Portland.
Arduino Programming. THE ARDUINO IS A MICROCONTROLLER – A LOW COST, LOW PERFORMANCE COMPUTER.
Hacking on Arduino George Patterson
Robotics Grant Agreement No LLP UK-LEONARDO-LMP Project acronym: CLEM Project title: Cloud services for E-Learning in Mechatronics Technology.
Assist. Prof. Rassim Suliyev - SDU 2017
Using servos.
Servo Library and Functions
Arduino motor control using servo & ultrasonic sensor
UCD ElecSoc Robotics Club 2017/2018
Get Your Project Started with Arduino
Lab 1: Arduino Basics Topics: Arduino Fundamentals, First Circuit
Line Following Tips photoresistor circuits
Control the color and brightness of an RGB LED with a Potentiometer
Arduino Uno and sensors
Control a motors angular position with a flex sensor
Analog Input through POT
IoT Programming the Particle Photon.
Servo Library and Functions
Digital Acquisition of Analog Signals – A Practical Guide
a few of my favorite sensors
Arduino Week 2 Lab ECE 1020 Prof. Ahmadi.
Using Photoresistors with an Arduino
Line Following Tips photoresistor circuit
Programming 2: The Arduino IDE & First Sketches
Calibration of Conductivity Sensors
CTY SAR FCPS Shawn Lupoli, Elliot Tan
Arduino 7 Segment Display Lab
Introduction to Arduinos
CTY SAR FCPS Alexander Velikanov
Presentation transcript:

line following tips photoresistors positioned near floor photoresistor circuits © 2011 LWTL faculty team living with the lab

add extensions to photoresistors while you may eventually use two photoresistors, you only need one to get started 2 living with the lab

review of photoresistor implementation int analogPin = 5; // middle terminal of voltage divider circuit int val = 0; // variable to store the value read void setup() { Serial.begin(9600); // setup serial display } void loop() { val = analogRead(analogPin); // read the input pin Serial.println(val); // print value to serial monitor } The “voltage” sensed at analog pin 5 is sent to the Serial Monitor for viewing. Here, and output of 0 represents 0V and 1023 represents 5V. 3 living with the lab 5V analog input 5 photoresistor 10k 

experiment with circuit & photoresistor placement void setup() { Serial.begin(9600); } void loop() { int val = analogRead(5); Serial.println(val); } photoresistor on analog pin 5 Move the robot with your hand so that the active photoresistor is over white and then over the black stripe. Make a note of the values sent to the serial monitor. Does it matter how far the photoresistor is from the ground level? R 5V analog input pin try different resistors to see which value gives the best response 4 living with the lab

photoresistor output variation void setup() { Serial.begin(9600); } void loop() { int val = analogRead(5); Serial.println(val); } Experimenting with your photoresistor in well lit conditions may result in consistent “white” and “black” output values. However, if you move to another environment, such as a dimly lit room, your “white” and “black” values would likely decrease (the way we have the circuit configured). To compensate for this variation, it is common practice to measure “white” and “black” values “on the fly” as your robot begins its mission. You could write a function that determines the “threshold” values for your robot. Consider the possible output values of your photoresistor setup: 5 living with the lab

Following the Left Edge of a Line Consider the case where we are following the left edge of a black line on a white background. One way to navigate along the edge of the line is to... Go forward and to the left when the photoresistor is over black Go forward and to the right when the photoresistor is over white Considerations:  Robot path: how sharp should the robot turn as it moves forward?  Would it be possible to go straight when you are on the edge of the line? Possible Algorithm:  Go right if output > 520  Go straight if 440 < output < 520  Go left if output < living with the lab

#include Servo myservo1; Servo myservo2; int white=520; // this number probably won't work for you int black=440; // this number probably won't work for you void setup() { myservo1.attach(2); myservo2.attach(3); Serial.begin(9600); } void loop() { int val = analogRead(5); Serial.print("white = "); Serial.print(white); Serial.print(" black = "); Serial.print(black); Serial.print(" val = "); Serial.println(val); if (val>white) {slow_right(); } // over white else if (val<black) {slow_left(); } // over black else {slow_forward(); } // over gray } void slow_forward() { myservo1.writeMicroseconds(1550); myservo2.writeMicroseconds(1450); } void slow_right() { myservo1.writeMicroseconds(1550); myservo2.writeMicroseconds(1520); } void slow_left() { myservo1.writeMicroseconds(1480); myservo2.writeMicroseconds(1450); } simple left-edge line following program 7 living with the lab