Intro to Robotics

Using the Raspberry Pi and Arduino for robotics applications.

Week One Overview • • •

• • • •

Review Robot Base platform kit Breakdown of parts and function Assembling the robot base and connecting Arduino. Making the robot move Connecting Ultrasonic Sensor Control speed using PWM Driving the robot using Skid Steering

SainSmart Mega 2560 R3 4WD Mobile Car Robot Kit For Arduino

Parts included in kit • • • •



SainSmart 4WD Drive Aluminum Mobile Car Robot Platform SainSmart Mega 2560 R3 SainSmart Sensor Shield Module V5 SainSmart L298N Dual H Bridge DC Motor Driver SainSmart Ultrasonic Module HC-SR04 Distance Sensor

SainSmart 4WD Drive Aluminum Mobile Car Robot Platform

• • •

• • •

Can hold many controllers, drivers, sensors and RF modules etc. Support plate with controller mounting holes, 2 dof pan. Tilt holds down groove, collision switch mounting hole, can be added with sensors. Elastic rubber tires. Damping, gripping, and wear-resisting. Light weight, high strength and no deformation characteristics. Unique design and color.

SainSmart Mega 2560 R3

SainSmart Mega 2560 R3 Microcontroller

ATmega2560

Operating Voltage

5v

Input Voltage (recommended)

7-12v

Input Voltage (limits)

6-20

Digital I/O Pins

54 (15 provide PWM output)

Analog Input Pins

16

DC Current per I/O Pin

40mA

DC Current for 3.3v Pin

50mA

Flash Memory

256 KB (8KB for bootloader)

SRAM

8KB

EEPROM

4KB

Clock Speed

16MHz

SainSmart Sensor Shield Version 5

• • • •

Features : It can connect to various modules like sensors, servos, relays, buttons, potentiometers Each functional module has buckled port with VCC, GND and Output, which has corresponding port on the Sensor Shield, connected with a plain 2.54mm dualfemale cable ready for connection Access to 14 Digital I/O and 6 Analog I/O and power pin provided for each one Connections for LCD Display, I2C and Serial Communications ports

SainSmart Sensor Shield Version 5 The sensor shield is used to make it easy to connect devices to the Arduino while also giving easy access to Ground, Voltage, and Signal pins (GVS) for each device

Special Notes • •

Uses separate power source for digital connection Uses Arduino 5v pin for analog connections to avoid unwanted noise caused by 2nd power supply

SainSmart L298N Dual H Bridge DC Motor Driver

• • • • •

Driver: L298N Dual H Bridge DC Motor Driver IC Drive Part of the Peak Current: 2A Logic Part of the Operating Current: 0 ~ 36mA Control Signal Input Voltage Range: Low:-0.3V ? Vin ? 1.5V; High: 2.3V ? Vin ? Vss Maximum Power Consumption: 20W ( at 75 deg C)

Sample Code For L298N Dual H Bridge (One channel) #define OUT1PIN1 2 #define OUT1PIN2 4 #define ENABLE1 3 #define OUT2PIN1 7 #define OUT2PIN2 8 #define ENABLE2 6

// H-bridge OUT1.1 // H-bridge OUT1.2 // H-bridge Ena 1 // H-bridge OUT2.1 // H-bridge OUT2.2 // H-bridge Ena 2

void setup() { // setup motor pins pinMode(OUT1PIN1, OUTPUT); pinMode(OUT1PIN2, OUTPUT); pinMode(ENABLE1, OUTPUT); digitalWrite(ENABLE1, HIGH); // set the enables to high

} void loop() { digitalWrite(OUT1PIN1, LOW); // set leg 1 of the H-bridge low digitalWrite(OUT1PIN2, HIGH); // set leg 2 of the H-bridge high delay(5000); digitalWrite(OUT1PIN1, HIGH); // set leg 1 of the H-bridge high digitalWrite(OUT1PIN2, LOW); // set leg 2 of the H-bridge low

delay(5000); }

SainSmart Ultrasonic Module HCSR04 Distance Sensor

• • • • •

power supply :5V DC quiescent current : <2mA effectual angle: <15° ranging distance : 2cm – 500 cm resolution : 0.3 cm

• • •

There are 4 pins on the module : VCC , Trig, Echo, GND . So it's a very easy interface for controller to use for ranging. The process is : pull the Trig pin to high level for more than 10us impulse , the module starts ranging. If it finds an object in front , Echo pin will be high level , and based on the distance it will set the duration of high level so we can calculate the distance easily :

Distance = ((Duration of high level)*(Sonic :340m/s))/2

HC-SR04 Sample Arduino Code

/ --------------------------------------------------------------------------// Example NewPing library sketch that does a ping about 20 times per second. // ---------------------------------------------------------------------------

#include #define TRIGGER_PIN 12 // Arduino pin tied to trigger pin on the ultrasonic sensor. #define ECHO_PIN 11 // Arduino pin tied to echo pin on the ultrasonic sensor. #define MAX_DISTANCE 200 // Maximum distance we want to ping for (in centimeters). Maximum sensor distance is rated at 400-500cm.

NewPing sonar(TRIGGER_PIN, ECHO_PIN, MAX_DISTANCE); // NewPing setup of pins and maximum distance. void setup() {

Serial.begin(115200); // Open serial monitor at 115200 baud to see ping results. } void loop() { delay(50); // Wait 50ms between pings (about 20 pings/sec). 29ms should be the shortest delay between pings. unsigned int uS = sonar.ping(); // Send ping, get ping time in microseconds (uS). Serial.print("Ping: "); Serial.print(uS / US_ROUNDTRIP_CM); // Convert ping time to distance and print result (0 = outside set distance range, no ping echo) Serial.println("cm"); }

Connecting HC-SR04 to Arduino (According to sample code above)

Pulse Width Modulation (PWM)

• • • •



Pulse Width Modulation, or PWM, is a technique for getting analog results with digital means. Digital control is used to create a square wave, a signal switched between on and off. This on-off pattern can simulate voltages in between full on (5 Volts) and off (0 Volts) by changing the portion of the time the signal spends on versus the time that the signal spends off. The duration of "on time" is called the pulse width. To get varying analog values, you change, or modulate, that pulse width. If you repeat this on-off pattern fast enough with a motor for example, the result is as if the signal is a steady voltage between 0 and 5v controlling the speed of the motor.

SKID Steering

• By using Skid steering we can make a robot with fixed wheels turn in different directions • This is very similar to how you would steer an army tank.

Next Week

• • •

Adding Pololu QTR Reflectance Sensors to the Robot Base Controlling the robotic arm with Arduino Connecting to Arduino with Raspberry Pi to control the robot

Intro to Robotics -

Arduino. • Making the robot move. • Connecting Ultrasonic Sensor. • Control speed using ... Connections for LCD Display, I2C and Serial Communications ports ... Example NewPing library sketch that does a ping about 20 times per second.

732KB Sizes 4 Downloads 310 Views

Recommend Documents

Intro to Webapp - GitHub
The Public Data Availability panel ... Let's look at data availability for this cohort ... To start an analysis, we're going to select our cohort and click the New ...

Intro to Solubility
How do you determine the state of the products? • Use the solubility rules to decide whether a product of an ionic reaction is insoluble in water and will thus form a precipitate ( an insoluble compound formed during a chemical reaction in solution

Intro to Google Cloud - GitHub
Now that you know your way around the Google Cloud Console, you're ready to start exploring further! The ISB-CGC platform includes an interactive Web App, ...

Intro to Webapp SeqPeek - GitHub
brought to you by. The ISB Cancer Genomics Cloud. An Introduction to the ISB-CGC Web App SeqPeek. Page 2. https://isb-cgc.appspot.com. Main Landing ...

Intro to Sociology
+. Norms: □ Expectations about how people should behave. □ Eg. : □ At concerts people yell, scream, cheer. □ In the library, people whisper to keep quiet ...

Intro to Webapp IGV - GitHub
Home Page or the IGV Github Repository. We are grateful to the IGV team for their assistance in integrating the IGV into the ISB-CGC web application.

Intro to Google Cloud - GitHub
The Cloud Datalab web UI has two main sections: Notebooks and Sessions. ... When you click on an ipynb file in GitHub, you see it rendered (as HTML).

Intro to Email.pdf
Page 1 of 25. INTRO TO EMAIL. MATERI PEMBELAJARAN ONLINE. DARI. WWW.DIGITALLEARN.ORG. DITERJEMAHKAN OLEH : MUCHAMAD EKI S. A. ...

Intro to Electrostatics
Intro to Electrostatics. Forces at a Distance. So far in our exploration of forces at a distance, you have read about lightning and how charges between objects (for example, clouds and the ground) can lead to dangerous and exciting results. Now, you

Intro to Google Cloud - GitHub
known as “Application Default Credentials” are now created automatically. You don't really need to click on the “Go to. Credentials”, but in case you do the next ...

Intro to Model UN.pdf
anggamunclub.wordpress.com. [email protected]. @unairforhnmun. Airlangga Model United Nations 2013. Universitas Airlangga. 1. Introduction to ...

01 Intro to Apache Spark.pdf
Retrying... Download. Connect more apps... Try one of the apps below to open or edit this item. 01 Intro to Apache Spark.pdf. 01 Intro to Apache Spark.pdf. Open.

Intro to Titration Notes Blank.pdf
There was a problem previewing this document. Retrying... Download. Connect more apps... Try one of the apps below to open or edit this item. Intro to Titration ...

Intro to Google for the Hill - PDFKUL.COM
Google also offers enterprise versions of our consumer products for businesses, organizations, and government ... Android. Android is the first truly open and comprehensive platform for mobile devices. It includes an operating system, user-interface,

Linton's Intro Letter to LVA.pdf
... one of the apps below to open or edit this item. Linton's Intro Letter to LVA.pdf. Linton's Intro Letter to LVA.pdf. Open. Extract. Open with. Sign In. Main menu.

1. intro to real projects
preservation efforts in California. It seemed that ... High Tech High schools in San Diego, California, and the. Learning ... colleges or universities. 35% of these.

Intro to Google for the Hill
Page 2 .... devote their limited resources to projects more strategic to their business. .... electricity from renewable energy sources that is cheaper than electricity.

Intro to Arch Syllabus.pdf
forces, live loads, different types of bridge designs, and innovations in the field of structural engineering. Unit 5: Sustainable Design. Students will learn about the ...

Geol1130-Intro-to-Environmental-Science.pdf
Page 1 of 3. GEOL 1130 Intro. to Environmental Science. Spring, 2014. Location: LSci 185. Time: MWF 10AM. Instructor: Dr. Christina Gallup. Office Hours: W 11-12 PM or by appt. Office Location: 219 Heller Hall. Phone: 726-8984. E-Mail: [email protected].

lecture 2: intro to statistics - GitHub
Continuous Variables. - Cumulative probability function. PDF has dimensions of x-1. Expectation value. Moments. Characteristic function generates moments: .... from realized sample, parameters are unknown and described probabilistically. Parameters a

Intro to NIHR DEC Ncl.pdf
Study progress monitoring. • Assistance with preparation of. interim progress reports to funders,. sponsors and regulatory bodies. • Data collation, cleansing, and ...

intro to communications madhow - By www.EasyEngineering.net.pdf ...
64. 2.8.1 Time Domain Relationships . . . . . . . . . . . . . . . . . . . . . . . . . . 64. 3. Visit : www.EasyEngineering.net. Visit : www.EasyEngineering.net. Page 3 of 469. intro to communications madhow - By www.EasyEngineering.net.pdf. intro to

Intro to graphing science.pdf
Bar Graph: Circle Graph: Line Graph: List other types of graphs: Whoops! There was a problem loading this page. Intro to graphing science.pdf. Intro to graphing ...

Unit1Slideshow1 - Intro to Ecology.pdf
Page 4 of 48. Let's pick one of these resources,. the FISHERIES: How did people view the fisheries resource in. the past? It was believed that fish was an UNLIMITED. resource that could be EXPLOITED (i.e., take as. much as you want). Page 4 of 48. Un