Upload
meghan-craig
View
214
Download
0
Embed Size (px)
Citation preview
INTRODUCTION TO ROBOTICSTUTORIAL: 3PI
Presented By: Md Aminul IslamChair, IEEE Computer Society
Carleton University
Robotics Club
AGENDA:
• Brief History
• A Simple Robot
• Introduction to 3Pi
• Hardware Overview
• Environment Setup
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
BRIEF HISTORY
A BRIEF HISTORY
250 BC: First Mechanical Robot 1495: First Humanoid Robot
A BRIEF HISTORY
Three Rules of Robots Zeroth Law
1942: Robot as Man Like Machines
A BRIEF HISTORY
"I'm sorry, Dave. I'm afraid I can't do that"
1968, 2001: A Space Odyssey
A BRIEF HISTORY
Star Wars, 1977
A BRIEF HISTORY
2005: For hire Honda Asimo $166,000/Year
1997
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
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
HARDWARE OVERVIEW (TOP VIEW)
HARDWARE OVERVIEW (BOTTOM VIEW)
START:
To start, you will need:
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
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
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)
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!
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!!!)
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
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);
THE END!!!
Question or Pop Quiz?