22
INTRODUCTION TO ROBOTICS TUTORIAL: 3PI Presented By: Md Aminul Islam Chair, IEEE Computer Society Carleton University Robotics Club

I NTRODUCTION TO R OBOTICS T UTORIAL : 3P I Presented By: Md Aminul Islam Chair, IEEE Computer Society Carleton University Robotics Club

Embed Size (px)

Citation preview

Page 1: I NTRODUCTION TO R OBOTICS T UTORIAL : 3P I Presented By: Md Aminul Islam Chair, IEEE Computer Society Carleton University Robotics Club

INTRODUCTION TO ROBOTICSTUTORIAL: 3PI

Presented By: Md Aminul IslamChair, IEEE Computer Society

Carleton University

Robotics Club

Page 2: I NTRODUCTION TO R OBOTICS T UTORIAL : 3P I Presented By: Md Aminul Islam Chair, IEEE Computer Society Carleton University Robotics Club

AGENDA:

• Brief History

• A Simple Robot

• Introduction to 3Pi

• Hardware Overview

• Environment Setup

Page 3: I NTRODUCTION TO R OBOTICS T UTORIAL : 3P I Presented By: Md Aminul Islam Chair, IEEE Computer Society Carleton University Robotics Club

ROBOTICS TUTORIAL: 3PINot:

Artificial Intelligence or Robotics classProgramming class/course.About Getting “F” Grade

About:Some basicsHow to program/use 3pi and setup

environmentEntertainment and InformationImproving Skills (A++)

Note: A copy of this material will be found in my blog: http://www.tanjir.net

Page 4: I NTRODUCTION TO R OBOTICS T UTORIAL : 3P I Presented By: Md Aminul Islam Chair, IEEE Computer Society Carleton University Robotics Club

BRIEF HISTORY

Page 5: I NTRODUCTION TO R OBOTICS T UTORIAL : 3P I Presented By: Md Aminul Islam Chair, IEEE Computer Society Carleton University Robotics Club

A BRIEF HISTORY

250 BC: First Mechanical Robot 1495: First Humanoid Robot

Page 6: I NTRODUCTION TO R OBOTICS T UTORIAL : 3P I Presented By: Md Aminul Islam Chair, IEEE Computer Society Carleton University Robotics Club

A BRIEF HISTORY

Three Rules of Robots Zeroth Law

1942: Robot as Man Like Machines

Page 7: I NTRODUCTION TO R OBOTICS T UTORIAL : 3P I Presented By: Md Aminul Islam Chair, IEEE Computer Society Carleton University Robotics Club

A BRIEF HISTORY

"I'm sorry, Dave. I'm afraid I can't do that"

1968, 2001: A Space Odyssey

Page 8: I NTRODUCTION TO R OBOTICS T UTORIAL : 3P I Presented By: Md Aminul Islam Chair, IEEE Computer Society Carleton University Robotics Club

A BRIEF HISTORY

Star Wars, 1977

Page 9: I NTRODUCTION TO R OBOTICS T UTORIAL : 3P I Presented By: Md Aminul Islam Chair, IEEE Computer Society Carleton University Robotics Club

A BRIEF HISTORY

2005: For hire Honda Asimo $166,000/Year

1997

Page 10: I NTRODUCTION TO R OBOTICS T UTORIAL : 3P I Presented By: Md Aminul Islam Chair, IEEE Computer Society Carleton University Robotics Club

A SIMPLE ROBOT

• (input->BlackBox->output)• Is Very Simple! Consists of :

o uController, small memory, few sensors, buttons,led, display. (Blacbox= uController+memory)

• Some Popular Microcontrollers: PIC, Atmel AVR, BASIC Stamp, Arduino

• Typical Languages: Almost everything can be used: All ISs converted to HEX C is the most common.

* IS= Instruction Set* RISC = Reduced Instruction Set Computer

Page 11: I NTRODUCTION TO R OBOTICS T UTORIAL : 3P I Presented By: Md Aminul Islam Chair, IEEE Computer Society Carleton University Robotics Club

3PI

• 3Pi is a Simple Roboto Has Atmel Atmega328p uController-C

programmable• Speed: Maximum 1m/s (3.6km/hr)• 5 Reflectance sensors • 3.5 inch D, 83gm • 2 Motors• Arduino Compatible• Price: $69-$100

Page 12: I NTRODUCTION TO R OBOTICS T UTORIAL : 3P I Presented By: Md Aminul Islam Chair, IEEE Computer Society Carleton University Robotics Club

HARDWARE OVERVIEW (TOP VIEW)

Page 13: I NTRODUCTION TO R OBOTICS T UTORIAL : 3P I Presented By: Md Aminul Islam Chair, IEEE Computer Society Carleton University Robotics Club

HARDWARE OVERVIEW (BOTTOM VIEW)

Page 14: I NTRODUCTION TO R OBOTICS T UTORIAL : 3P I Presented By: Md Aminul Islam Chair, IEEE Computer Society Carleton University Robotics Club

START:

 

To start, you will need:

Page 15: I NTRODUCTION TO R OBOTICS T UTORIAL : 3P I Presented By: Md Aminul Islam Chair, IEEE Computer Society Carleton University Robotics Club

ENVIRONMENT SETUP

+ Following Software/Tools: Pololu USB-to-serial adapter driver WinAVR C/C++ AVR Library AVR Studio USB Tiny ISP Driver * com0com* USBtiny500*

* You will need these, if you are using USB Tiny ISP instead of Pololu USB AVR Programmer. For the later one, you will only need to install the black ones.

All of these can be found as a big zip file: http://www.tanjir.net/upload/3pi.zip

Page 16: I NTRODUCTION TO R OBOTICS T UTORIAL : 3P I Presented By: Md Aminul Islam Chair, IEEE Computer Society Carleton University Robotics Club

ENVIRONMENT SETUP

 Pololu USB-to-serial adapter driver

-> Unzip -> Install PololuUSBInstaller.exe WinAVR -> Run WinAVR-20100110-install.exe

C/C++ AVR Library -> Unzip directory -> Copy avr/*.a files to C:\WinAVR-20100110\avr\lib -> Copy entire pololu directory

under C:\WinAVR-20100110\avr\include USB Tiny ISP Driver

-> Unzip the directory -> Plug in the USB programmer -> Advanced -> Show the path to the unzipped directory

Page 17: I NTRODUCTION TO R OBOTICS T UTORIAL : 3P I Presented By: Md Aminul Islam Chair, IEEE Computer Society Carleton University Robotics Club

ENVIRONMENT SETUP

 

com0com -> Install com0com (make sure to unselect the last optioncomA<->comB) -> Run install command -> Check your com ports and make a list: (3,4) -> Run: “install PortName=COM2 PortName=COM6”-> Install new drivers using recommended path (twice)

AVR Studio -> Install AVR Studio 4 -> Install Update patch

USBtiny500 -> Install -> Select the right ComPort from the

USBtiny 500 (you can choose either 2 or 6)

Page 18: I NTRODUCTION TO R OBOTICS T UTORIAL : 3P I Presented By: Md Aminul Islam Chair, IEEE Computer Society Carleton University Robotics Club

ENVIRONMENT SETUP

 Go back to libpololu-avr/examples, atmel328p, then go into any example (I did buzzer3)

Open the .aps file (it should open with AVR Studio 4). Build Tools-> Program AVR -> Connect STK500->

(Select the opposite one of what you have selected in USBtiny 500 ie: For 2, select here 6 or for 6, select here 2)

Cancel the update message Under Main tab, Read signature If you see all OK in bottom, then you are good to go!

Page 19: I NTRODUCTION TO R OBOTICS T UTORIAL : 3P I Presented By: Md Aminul Islam Chair, IEEE Computer Society Carleton University Robotics Club

HELLO WORLD!!!

 

To Program: Program Tab:

Select the hex file Select the elf file Program

WARNING! WARNING!! WARNING!!! NEVER EVER STOP WHILE IT IS RUNNING (SEE BOTTOM/SEE RED LIGHT ON THE PROGRAMMER!!!)

Page 20: I NTRODUCTION TO R OBOTICS T UTORIAL : 3P I Presented By: Md Aminul Islam Chair, IEEE Computer Society Carleton University Robotics Club

PROGRAMMING 3PI (MOTOR)

Physics:Output ports: PD5, PD6 (M1)PD3, PB3 (M2)Sample:0 1 Forward1 0 Reverse0 0 or 1 1 BrakeSpeed  is reduced by pressing brake.

 Code: set_motors(180,180); Range: -255  to 255

Page 21: I NTRODUCTION TO R OBOTICS T UTORIAL : 3P I Presented By: Md Aminul Islam Chair, IEEE Computer Society Carleton University Robotics Club

PROGRAMMING 3PI  Include header files for 3pi and memory space To store data to memory:

“const char wc_msg[] PROGMEM = " Pololu";” To display on LCD:

print_from_program_space(wc_msg);lcd_goto_xy(x,y);  /* Axis */print_long(pd);  print(string)

To play music: play_from_program_space(music);

To get battery power:read_battery_millivolts()

Delay:delay_ms(100);  

Wait for button:wait_for_button_release(BUTTON_B);  

Page 22: I NTRODUCTION TO R OBOTICS T UTORIAL : 3P I Presented By: Md Aminul Islam Chair, IEEE Computer Society Carleton University Robotics Club

THE END!!!

Question or Pop Quiz?