Devantech SRF04 Ultra-Sonic Ranger Finder Cornerstone Electronics Technology and Robotics II

Similar documents
Programming PIC Microcontrollers in PicBasic Pro LCD Lesson 3 Cornerstone Electronics Technology and Robotics II

SRF05-HY - Ultra-Sonic Ranger Technical Specification

o What happens if S1 and S2 or S3 and S4 are closed simultaneously? o Perform Motor Control, H-Bridges LAB 2 H-Bridges with SPST Switches

WEEK 5 Remembering Long Lists Using EEPROM

' The PicBasic Pro Compiler Manual is on line at: '

PING))) Ultrasonic Distance Sensor (#28015)

OBSTACLE EVADING ULTRASONIC ROBOT. Aaron Hunter Eric Whitestone Joel Chenette Anne-Marie Cressin

Laboratory 11. Pulse-Width-Modulation Motor Speed Control with a PIC

Direct Current Waveforms

Pin Symbol Wire Colour Connect To. 1 Vcc Red + 5 V DC. 2 GND Black Ground. Table 1 - GP2Y0A02YK0F Pinout

Measuring Distance Using Sound

Sonar Made Simple. Ping. Echo. Figure 1 - Sonar Ping and Echo

Web Site: Forums: forums.parallax.com Sales: Technical:

' Turn off A/D converters (thereby allowing use of pins for I/O) ANSEL = 0

Introduction. Theory of Operation

Mechatronics Project Report

Hashemite University Faculty of Engineering Mechatronics Engineering Department. Microprocessors and Microcontrollers Laboratory

LaserPING Rangefinder Module (#28041)

Potentiometer Tutorial Cornerstone Electronics Technology and Robotics I Week 8

Infrared Remote AppKit (#29122)

Advanced Mechatronics 1 st Mini Project. Remote Control Car. Jose Antonio De Gracia Gómez, Amartya Barua March, 25 th 2014

Figure 1: Basic Relationships for a Comparator. For example: Figure 2: Example of Basic Relationships for a Comparator

ECE Senior Design Final Report For. Scalable Regulated Three Phase Power Rectifier. May 10, 2004 Rev. 1.0

Ultrasonics. Introduction

Ultrasonic Range Finding

Sten-Bot Robot Kit Stensat Group LLC, Copyright 2013

Lesson 13. The Big Idea: Lesson 13: Infrared Transmitters

PIC Functionality. General I/O Dedicated Interrupt Change State Interrupt Input Capture Output Compare PWM ADC RS232

Electronic Buzzer for Blind

LAB PROJECT 2. Lab Exercise

RB-Dev-03 Devantech CMPS03 Magnetic Compass Module

Simulation Of Radar With Ultrasonic Sensors

EXERCISE 4: A Simple Hi-Fi

GE423 Laboratory Assignment 6 Robot Sensors and Wall-Following

HVW Technologies Analog Infra-Red Ranging System (AIRRS )

LDOR: Laser Directed Object Retrieving Robot. Final Report

POKER BOT. Justin McIntire EEL5666 IMDL. Dr. Schwartz and Dr. Arroyo

Distance Measurement of an Object by using Ultrasonic Sensors with Arduino and GSM Module

SCHOOL OF TECHNOLOGY AND PUBLIC MANAGEMENT ENGINEERING TECHNOLOGY DEPARTMENT

A Model Based Approach for Human Recognition and Reception by Robot

PROTOBot: Amoeba! A complete interactive robot By Camp Peavy and Randy Hootman. Complete Parts List: Prices may vary

Walle. Members: Sebastian Hening. Amir Pourshafiee. Behnam Zohoor CMPE 118/L. Introduction to Mechatronics. Professor: Gabriel H.

Electronics Review 1 Cornerstone Electronics Technology and Robotics II Week 1

the Board of Education

Pulse-Width-Modulation Motor Speed Control with a PIC (modified from lab text by Alciatore)

MOBILE ROBOT CRUISE CONTROLLER

HB-25 Motor Controller (#29144)

Mech 296: Vision for Robotic Applications. Logistics

C++ PROGRAM FOR DRIVING OF AN AGRICOL ROBOT

Follow this and additional works at: Part of the Engineering Commons

Andrew Kobyljanec. Intelligent Machine Design Lab EEL 5666C January 31, ffitibot. Gra. raffiti. Formal Report

Autonomous Obstacle Avoiding and Path Following Rover

Circuit LED 1 LED 2 A on or off on or off B on or off on or off C on or off on or off

A Sonar-Based Omni Directional Obstacle Detection System Designed for Blind Navigation

EGG 101L INTRODUCTION TO ENGINEERING EXPERIENCE

Ultrasonic Level Detection Technology. ultra-wave

Cornerstone Electronics Technology and Robotics I Week 19 Electrical Relays

Figure 1. CheapBot Line Follower

THE NAVIGATION CONTROL OF A ROBOTIC STRUCTURE

Experiment #3: Micro-controlled Movement

Sonar Fish Detection and Measurement System with PIC16F873

Figure 1: One Possible Advanced Control System

ECE U401/U211-Introduction to Electrical Engineering Lab. Lab 4

Devantech Magnetic Compass on I2C

A Design for the Integration of Sensors to a Mobile Robot. Mentor: Dr. Geb Thomas. Mentee: Chelsey N. Daniels

ME 2110 Controller Box Manual. Version 2.3

Bohunt School (Wokingham) Internet of Things (IoT) and Node-RED

MB7137, MB7138, MB7139

Welcome to. NXT Basics. Presenter: Wael Hajj Ali With assistance of: Ammar Shehadeh - Souhaib Alzanki - Samer Abuthaher

Controlling Your Robot

MB1013, MB1023, MB1033, MB1043

Figure 1. CheapBot Smart Proximity Detector

Today s Menu. Near Infrared Sensors

Boe-Bot robot manual

Sensor and. Motor Control Lab. Abhishek Bhatia. Individual Lab Report #1

Lab 06: Ohm s Law and Servo Motor Control

Directions for Wiring and Using The GEARS II (2) Channel Combination Controllers

A servo is an electric motor that takes in a pulse width modulated signal that controls direction and speed. A servo has three leads:

GetTutorialized Workshops Brochure-2017

Sonic Distance Sensors

INTRODUCTION TO DATA STUDIO

MILFORD INSTRUMENTS Limited

Australian Journal of Basic and Applied Sciences

Introduction to the ME2110 Kit. Controller Box Electro Mechanical Actuators & Sensors Pneumatics

Voice Guided Military Robot for Defence Application

A Day in the Life CTE Enrichment Grades 3-5 mblock Programs Using the Sensors

νµθωερτψυιοπασδφγηϕκλζξχϖβνµθωερτ ψυιοπασδφγηϕκλζξχϖβνµθωερτψυιοπα σδφγηϕκλζξχϖβνµθωερτψυιοπασδφγηϕκ χϖβνµθωερτψυιοπασδφγηϕκλζξχϖβνµθ

Sensors. CS Embedded Systems p. 1/1

Published by: PIONEER RESEARCH & DEVELOPMENT GROUP ( 1

A Low-Cost Collision Detection System for Compact Vehicles (aka Ping Around the Rosey )

Ultrasonic Sensor Module for a Robot (HG-M40 Series, HG-L40 Series)

International Journal of Advance Engineering and Research Development

DSTS-5A/2C User's Manual

Precision Range Sensing Free run operation uses a 2Hz filter, with. Stable and reliable range readings and

MAKER: Development of Smart Mobile Robot System to Help Middle School Students Learn about Robot Perception

Prototype Realization

Line Tracking Car. Yi Lin& Zhenbin Zhu

New Sensors for Ridgesoft Robot

Available online Journal of Scientific and Engineering Research, 2018, 5(4): Research Article

Small and easy to mount IP67 rated. distance to target 1 Weather station monitoring

Transcription:

Devantech SRF04 Ultra-Sonic Ranger Finder Cornerstone Electronics Technology and Robotics II Administration: o Prayer PicBasic Pro Programs Used in This Lesson: o General PicBasic Pro Program Listing: http://www.cornerstonerobotics.org/picbasic.php o Lab 1 array1.pdf: http://www.cornerstonerobotics.org/code/array1.pdf o Lab 1 array2.pdf: http://www.cornerstonerobotics.org/code/array2.pdf o Lab 2 sonar1.pdf: http://www.cornerstonerobotics.org/code/sonar1.pdf o Lab 3 sonar_car1.pdf: http://www.cornerstonerobotics.org/code/sonar_car1.pdf SRF04 Ultra-Sonic Sensor: o Introduction: Gives precise non-contact distance measurements Measures distances from 3 cm (1.2 ) to 3 m (39.5 ) Generates an ultrasonic sound burst, or ping, and then measures the time it takes for the echo to return to the receiver. See figure below: Sonar Sensor Function From: http://www.mech.utah.edu/~me3200/labs/f03labs/f03_ultrasonic_l7.pdf Ultrasonic means the frequency of the sonic (sound) pulse is above the human hearing range. The highest frequency that is detectable by the human ear is approximately 20 KHz. Using a function generator and the following circuit, test the 20 KHz limit. Sound Generator Circuit 1

The SRF04 Ultra-Sonic ranger finder frequency is 40 khz. The ultrasonic pulse travels at the speed of sound (1087 ft/sec or 1.087 ft/msec). The speed of sound varies with temperature, humidity and altitude. The output from the SRF04 is a variable width pulse from 100 usec to 18 msec depending upon the distance to the object detected (the target). The SRF04 has a separate transmitter and receiver transducer while some sonar sensors have but a single transducer. o Robotic Uses: Navigation, obstacle avoidance Distance measurements o Other Uses: Auto-focusing cameras o Better performance than IR when: High ambient infrared light levels, such as bright sunlight Encountering dark objects that do not reflect the IR energy o Specifications: Voltage: 5 vdc Current: 30 ma typical, 50 ma maximum Frequency: 40 KHz Minimum Range: 3 cm Maximum Range: 3 m Input Trigger: 10 usec minimum, TTL level pulse Echo Pulse: Positive TTL level signal with the width proportional to the range of the object Dimensions: 43 mm long x 20 mm wide x 17 mm high o Operation: The user sends a 10 usec trigger pulse to the SRF04 module. The user trigger pulse causes the ultrasonic ranger to send out a burst of 8 sonic pulses at 40 KHz. The trigger pulse also activates the echo receiver which awaits an echo pulse. If an echo is received, the SRF04 module outputs an echo pulse whose width is proportional to the distance to the object detected. 2

o SRF04 Connections: SRF04 Connections From: http://www.robot-electronics.co.uk/htm/srf04tech.htm o SRF04 Schematic: SRF04 Schematic From: http://www.wwwactiverobots.com/products/sensors/devantech/srf04_sonar_schematic.pdf 3

o Beam Pattern: SRF04 Beam Pattern From: http://www.robot-electronics.co.uk/htm/srf04tech.htm o Mounting: If you mount the SRF04 module lower than 12 above the floor, point it slightly upwards to avoid reflections from the flooring material. o Using more than one SRF04 range finder at one time: In our class, do not fire two SRF04 modules at one time since they will pick up each other s ping and result in a false reading. Fire them sequentially 65 msec apart. Arrays: o Definition for our purposes: An array is a rectangular arrangement of quantities in rows and columns, as in a matrix. o Our application - variable arrays: This lesson will use a variable array to track the first variable - several servo positions and the second variable the respective sonar readings from a SRF04 range finder. o Array format in PicBasic Pro: Variable arrays are created or declared as follows: Label VAR Size[Number of elements] Where: Label is the name of the array (excludes keywords) Size is BIT, BYTE, or WORD Number of elements is the number of locations reserved in memory for the array Examples: temp1 VAR BYTE[10] c0 VAR BIT[4] distance VAR WORD[8] 4

In the first array, temp1[ ], the first element is temp1[0], the second element is temp1[1]. Since there are 10 elements in the array, so the last element is temp1[9]. See excel file below: Since memory is reserved for variable arrays like any other variable, there are size limits for each type. For the PIC16F88 the maximum number of elements for each type is as follows: BIT 768 BYTE 96 WORD 48 The complier will not compile successfully unless the array will fit into the memory. The maximum number of elements for other PIC microcontrollers may be determined by changing the [Number of elements] when creating the array: Label VAR Size[Number of elements] For example, the PIC16F88 will not compile the following array creation since it exceeds the maximum number of elements for BIT. temp1 VAR BIT[769] Perform Ultra-Sonic Lab 1 array1 and array2.pbp New PicBasic Pro Commands: o SELECT CASE: Format: SELECT CASE Var CASE Expression 1 Statement CASE Expression 2 Statement CASE Expression 3 Statement. CASE ELSE Statement END SELECT Explanation: SELECT CASE statements are used instead of multiple IF..THEN statements. Each CASE compares the value of the variable to the expression in that CASE. When the expression is true, the statement after that CASE is executed. When none of the CASES are true, the statement after the CASE ELSE is executed. 5

If the comparison in the expression is something other than equal, IS must be used. Examples: SELECT CASE x CASE 0 HIGH PORTB.0 CASE 1 HIGH PORTB.1 CASE 2 HIGH PORTB.2 CASE ELSE GOTO loop END SELECT PAUSE 500 PORTB = 0 SELECT CASE dist CASE IS < 20 GOSUB left_turn CASE IS > 30 GOSUB right_turn CASE ELSE GOSUB straight END SELECT If the variable dist (for distance) is less than 20, the program will execute the subroutine left_turn. If the variable dist is greater than 30, the program will execute the subroutine right_turn. When neither of the two CASES are true, i.e., 20 >= dist <= 30, the program executes the subroutine straight. o PULSIN: Format: PULSIN Pin,State,Var Explanation: Measures pulse width on Pin. If State is zero, the width of a low pulse is measured. If State is one, the width of a high pulse is measured. The measured width is placed in Var. If the pulse edge never happens or the width of the pulse is too great to measure, Var is set to zero. If an 8-bit variable is used, only the LSB of the 16-bit measurement is returned. Pin is automatically made an input. Pin may be a constant, 0-15, or a variable that contains a number 0-15 (e.g. B0) or a pin name (e.g. PORTA.0). The resolution of PULSIN is dependent upon the oscillator frequency. If a 4MHz oscillator is used, the pulse width is returned in 10us increments. If a 20MHz oscillator is used, the pulse width will have a 2us resolution. Defining an OSC 6

value has no effect on PULSIN. The resolution always changes with the actual oscillator speed. PULSIN normally waits a maximum of 65535 counts before it determines there is no pulse. If it is desired to wait fewer counts before it stops looking for a pulse or the end of a pulse, a DEFINE can be added: DEFINE PULSIN_MAX 1000 This DEFINE also affects RCTIME in the same manner. Example: PULSIN PORTB.4,1,W3 Measure high pulse on Pin4 stored in W3 Perform Ultra-Sonic Lab 2 sonar1.pbp Perform Ultra-Sonic Lab 3 Completion Sonar Car 7

Cornerstone Electronics Technology and Robotics II Ultra-Sonic LAB 1 array1 and array2.pbp Purpose: The purpose of this lab is to acquaint the student with the PicBasic Pro variable arrays. Apparatus and Materials: o 1 Breadboard o 1 PIC 16F88 Microcontroller o 1 4.7K Ohm Resistor o 1 20K Tripot o 1 LCD Screen, Jameco # 618003 Procedure: o Wire the circuit array1 as shown below. o Program the PIC16F88 with array1.pbp and power the chip. o Program the PIC16F88 with array2.pbp and power the chip. o Program the PIC16F88 to three take CdS photoresistor readings and record the sample number and CdS reading in two arrays, sample[3] and cds[3]. Display all of the results of the two arrays at one time on an LCD. Save the program as array10.pbp. 8

Cornerstone Electronics Technology and Robotics II Ultra-Sonic LAB 2 sonar1.pbp Purpose: The purpose of this lab is to acquaint the student with the basic function of the SRF04 ultra-sonic range finder and the PicBasic Pro commands to drive the range finder. Apparatus and Materials: o 1 Breadboard or Robotic Car o 1 PIC 16F88 Microcontroller o 1 4.7K Ohm Resistor o 1 20K Tripot o 1 LCD Screen, Jameco # 618003 Procedure: o Wire the circuit sonar1. o Open sonar1.pbp and download to your chip. Place an object about 10 inches from the sonar and let the sonar take readings over time. Observe any changes in the readings. Use the attached SRF04 Beam Pattern Plot sheet to plot the sensitivity of the SRF04 module detecting a 2 x 4 piece of lumber. Keep the wood perpendicular to the radial lines that converge at the SRF04. Record only readings that are valid and consistent with the range of the sonar. 9

Challenge: o Using a servo and a SRF04 for obstacle avoidance: Use a SRF04 mounted on a servo to sweep through 180 degrees and navigate your robot to avoid obstacles. At this point, do not use an interrupt, but rather use pauses in your forward movement. 10

Cornerstone Electronics Technology and Robotics II Ultra-Sonic LAB 3 Completion of Sonar Car Purpose: The purpose of this lab is to have the student complete the robotic sonar car project. Apparatus and Materials: o See parts list at: http://www.cornerstonerobotics.org/excel%20doc/robotics_2_parts_li st.pdf Procedure: o Complete the mechanical and electronic systems on the car. For the schematics see: Sonar Car Circuitry 1: http://www.cornerstonerobotics.org/schematics/pic_programmi ng_sonar_car1.pdf Sonar Car Circuitry 2: http://www.cornerstonerobotics.org/schematics/pic_programmi ng_sonar_car2.pdf o Program the car with sonar_car1: Format in.pbp: http://www.cornerstonerobotics.org/code/sonar_car1.pbp Format in.pdf: http://www.cornerstonerobotics.org/code/sonar_car1.pdf Photos: o To see past project solutions see: http://www.cornerstonerobotics.org/sonar_car_2008.php 11