• Tidak ada hasil yang ditemukan

Sistem Penjejak Robot Dengan Pemandu Berupa Bola Berwarna.

N/A
N/A
Protected

Academic year: 2017

Membagikan "Sistem Penjejak Robot Dengan Pemandu Berupa Bola Berwarna."

Copied!
39
0
0

Teks penuh

(1)

i Universitas Kristen Maranatha SISTEM PENJEJAK ROBOT DENGAN

PEMANDU BERUPA BOLA BERWARNA

Disusun Oleh : Nama : Piter

Nrp : 0422164

Jurusan Teknik Elektro, Fakultas Teknik, Universitas Kristen Maranatha, Jl. Prof.Drg.Suria Sumantri, MPH no.65, Bandung, Indonesia.

Email : piter_coolnian@yahoo.com

ABSTRAK

Perkembangan teknologi robotika semakin pesat akhir-akhir ini. Namun perkembangan teknologi robotika di Indonesia tidak sepesat perkembangannya di negara–negara lain. Untuk itulah mengapa bidang studi tentang robotika menjadi menarik untuk dipelajari dan dipraktekkan. Tugas Akhir ini merupakan salah satu cara untuk semakin memajukan teknologi robotika di Indonesia.

Dalam Tugas Akhir ini telah dibuat sebuah robot mobil yang dapat menjejak objek dengan menggunakan sensor visual dan bergerak mengikuti pergerakan objek yang dijejak. Objek yang dijejak adalah 3 buah bola dengan warna yang berbeda, yaitu merah, biru, dan kuning. Sistem yang dibangun terdiri dari perangkat keras dan perangkat lunak. Perangkat keras yang digunakan meliputi sensor visual CMUCam2+, pengontrol mikro ATmega16, dan robot mobil dengan penggerak menggunakan 2 motor DC. Sedangkan perangkat lunak dibuat dengan menggunakan bahasa pemrograman C. Hal–hal yang penting dalam sistem ini adalah fitur objek dan algoritma penjejaknya.

Robot mobil yang direalisasikan mampu menjejak pergerakan bola berdasarkan warna yang diinginkan dengan mempertahankan jarak tertentu. Fitur objek yang digunakan adalah parameter kanal warna objek. Parameter kanal warna objek berbeda untuk tiap kecerahan lingkungan. Pada kecerahan lingkungan yang rendah, CMUCam2+ tidak dapat membedakan objek yang dijejak dengan objek-objek lain di sekelilingnya.

(2)

ii Universitas Kristen Maranatha TRACKING ROBOT SYSTEM

WITH COLORED BALL GUIDANCE

Composed by : Name : Piter

Nrp : 0422164

Electrical Engineering, Maranatha Christian University, Jl. Prof.Drg.Suria Sumantri, MPH no.65, Bandung, Indonesia.

Email : piter_coolnian@yahoo.com

ABSTRACT

Nowadays, robotics technology has been developed very rapidly. But in Indonesia, the development is not fast as in other countries. therefore, robotics fields of study is an interesting topic to know and applied. This final project is one of many ways for developing robotics technology in Indonesia.

In this final project, has been designed a mobile robot that can track a particular object using visual sensor and move the actuator on its platform to follow the movement of the tracked object. The tracked objects are three balls with three different colors, which are red, blue, and yellow. The system consist of hardware and software. CMUCam2+ visual sensor, microcontroller ATMega16, were the hardware of the system. The software of the system built using C programming language. The important things on this system are object feature and algorithm.

Mobile robot can track movement a ball pursuant to wanted color by maintaining certain distance. The object feature that used is color channel parameters. Color channel parameter object is differ to every environment brightness. At low environment brightness, CMUCam2+ cannot differentiate between tracked object with other objects around.

(3)

iii Universitas Kristen Maranatha DAFTAR ISI

Halaman

ABSTRAK ... i

ABSTRACT... ii

KATA PENGANTAR ... iii

DAFTAR ISI... v

DAFTAR TABEL... viii

DAFTAR GAMBAR ... x

BAB I PENDAHULUAN I.1 Latar Belakang ... 1

I.2 Identifikasi Masalah ... 2

I.3 Perumusan Masalah ... 2

I.4 Tujuan ... 2

I.5 Pembatasan Masalah ... 2

I.6 Spesifikasi Masalah ... 3

I.7 Sistematika Penulisan ... 3

BAB II LANDASAN TEORI II.1 Sistem Gerak Mobile Robot Beroda ... 4

II.1.1 Differential Drive... 4

II.1.2 Trycycle Drive... 5

II.1.3 Synchronous Drive... 6

II.1.4 Holonomic Drive... 7

II.2 CMUCAM2+... 8

II.2.1 Pemetaan Output Pixel pada Kamera ... 11

(4)

iv Universitas Kristen Maranatha

II.2.3 Tipe Data CMUCam2+ ... 13

II.3 Pengontrol Mikro AVR ATmega16 ... 14

II.3.1 Konfigurasi Pin ATmega16……….... 16

II.4 Komunikasi Serial RS232 ... 17

II.4.1 Karakteristik Sinyal RS232 ... 18

II.4.2 Konektor dan Jenis Sinyal RS232 ... 18

BAB III PERANCANGAN DAN REALISASI III.1 Perancangan Sistem ... 21

III.1.1 Perancangan Robot ... 22

III.2 Realisasi Robot... 23

III.2.1 Perangkat Keras (Hardware)... 23

III.2.1.1 Sensor Kamera CMUCam2+ ... 23

III.2.1.2 Pengendali ... 24

III.2.2 Protokol Komunikasi Serial RS232 ... 27

III.2.2.1 Komunikasi Serial CMUCam2+ ke Komputer ... 27

III.2.2.2 Komunikasi Serial CMUCam2+ ke Komputer ... 28

III.2.3Kalibrasi Parameter Warna Objek ... 30

III.2.3.1 Kalibrasi Parameter Warna Objek pada Intensitas Cahaya 18 Lux ……… 31

III.2.3.2 Kalibrasi Parameter Warna Objek pada Intensitas Cahaya 87 Lux ……… 35

III.2.3.3 Kalibrasi Parameter Warna Objek pada Intensitas Cahaya 138 Lux ……….. 39

III.2.4 Perangkat Lunak ………... 44

III.2.4.1 Algoritma Piranti Lunak ………. 44

(5)

v Universitas Kristen Maranatha

BAB IV ANALISA DAN DATA PENGAMATAN

IV.1 Pengujian Robot Menjejak Bola yang Tidak Bergerak ... 48 IV.2 Pengujian Robot Menjejak Pergerakkan Bola ……… 50 IV.3 Pengujian Pengaruh Sinar Lain Terhadap Penjejakkan Objek ... 56 IV.4 Pengujian Jarak Terdekat dan Terjauh Antara Bola dan Robot ……. 59 IV.5 Pengujian Pengaruh Besarnya Threshold Terhadap Respon Robot ... 60 IV.6 Pengujian Kecepatan Bola Maksimum ………... 60

BAB V KESIMPULAN DAN SARAN

V.1 Kesimpulan ... 62 V.2 Saran ... 62 DAFTAR PUSTAKA ... 63 LAMPIRAN A INSTRUKSI PENGONTROL MIKRO

LAMPIRAN B DATA SHEET

(6)

vi Universitas Kristen Maranatha DAFTAR TABEL

Halaman Tabel 2.1 Jenis Sinyal RS232 ... 12 Tabel 3.1 Tabel Pergerakkan Mobil Berdasarkan Keluaran

Pengontrol Mikro ... 27 Tabel 3.2 Tabel Konfigurasi Baudrate ... 30 Tabel 3.3 Tabel Proses Menjejak Warna dan Parameter Kanal Warna

Bola Merah pada Intensitas Cahaya 18 Lux ... 31 Tabel 3.4 Tabel Proses Menjejak Warna dan Parameter Kanal Warna

untuk Bola Biru pada Intensitas Cahaya Ruangan 18 Lux. .... 33 Tabel 3.5 Tabel Proses Menjejak Warna dan Parameter Kanal Warna

untuk Bola Kuning pada Intensitas Cahaya Ruangan 18 lux. . 35 Tabel 3.6 Tabel Proses Menjejak Warna dan Parameter Kanal Warna

untuk Bola Merah pada Intensitas Cahaya Ruangan 87 Lux. . 36 Tabel 3.7 Tabel Proses Menjejak Warna dan Parameter Kanal Warna

untuk Bola Biru pada Intensitas Cahaya Ruangan 87 Lux. .... 37 Tabel 3.8 Tabel Proses Menjejak Warna dan Parameter Kanal Warna

untuk Bola Kuningpada Intensitas Cahaya Ruangan 87 Lux... 39 Tabel 3.9 Tabel Proses Menjejak Warna dan Parameter Kanal Warna

untuk Bola Merahpada Intensitas Cahaya Ruangan 138 Lux.... 40 Tabel 3.10 Tabel Proses Menjejak Warna dan Parameter Kanal Warna

untuk Bola Birupada Intensitas Cahaya Ruangan 138 Lux..... 42 Tabel 3.11 Tabel Proses Menjejak Warna dan Parameter Kanal Warna

(7)

vii Universitas Kristen Maranatha

Tabel 4.3 TabelMx,My dan Piksel untuk Sinar dari 450 di Atas Bola … 58 Tabel 4.4 Tabel Mx,My dan Piksel untuk Sinar Membelakangi Robot

dan Bola ………...……….... 58 Tabel 4.5 Tabel Mx,My dan Piksel untuk Sinar Datang Dari

Arah Robot………... 58 Tabel 4.6 Tabel Mx,My dan Piksel untuk Sinar Dari Sebelah Samping

Bola ………...……… 58 Tabel 4.7 Tabel Mx,My dan Piksel untuk Sinar Datang 450 Dari

Samping Bola …...……….. 59 Tabel 4.8 TabelJarak Minimum dan Maksimum Kamera ke Objek ….. 59 Tabel 4.9 TabelPengaruh Thresholod Terhadap Respon Sistem ……… 60 Tabel 4.10 Tabel Kecepatan Bola Maksimum untuk Gerakan Maju pada

Robot Mobil ………... 60 Tabel 4.11 TabelKecepatan Bola Maksimum untuk Gerakan Mundur pada

Robot Mobil ... 61 Tabel 4.12 TabelKecepatan Bola Maksimum untuk Gerakan Robot ke

(8)

viii Universitas Kristen Maranatha DAFTAR GAMBAR

Halaman

Gambar 2.1 Mobile Robot (wheel Robot)... 4

Gambar 2.2 Sistem Gerak Differential Drive ... 5

Gambar 2.3Sistem Gerak Trycycle Drive ... 6

Gambar 2.4 Sistem Gerak Synchronous Drive... 6

Gambar 2.5 Penggunaan Roda Omni-Directional... 7

Gambar 2.6 Sistem GerakHolonomic Drive... 7

Gambar 2.7 CMUCam2+ ... 8

Gambar 2.8 Blok Diagram CMUCam2+ ... 9

Gambar 2.9CMUCam Color Tracking... 10

Gambar 2.10Perintah \r ... 12

Gambar 2.11Perintah Reset ………... 12

Gambar 2.12 Perintah TC ... 13

Gambar 2.13Blok Diagram Fungsional ATMega16... 15

Gambar 2.14 Pengontrol Mikro ATmega16 ... 16

Gambar 3.1 Diagram Blok Sistem ... 21

Gambar 3.2 Sketsa Mobil Robot Tampak Depan dan Tampak Samping . 22 Gambar 3.3 CMUCam Board Layout... 23

Gambar 3.4 Skematik Rangkaian Pengontrol Mikro ATMEGA16 ... 25

Gambar 3.5 Skematik Rangkaian Driver L293D... 26

Gambar 3.6 Konfigurasi Kabel Serial CMUCam2+ ke Komputer ... 28

Gambar 3.7 Konfigurasi Serial CMUCam2+ - ATmega16 ... 29

Gambar 3.8 Konfigurasi JumperBaud Rate pada CMUCam 2+ ... 29

Gambar 3.9 Objek Bola yang Dijejak ... 31

Gambar 3.10 Flowchart Program... 45

Gambar 3.10 (a)Flowchart Sub Routine Set Jarak... 45

(9)

ix Universitas Kristen Maranatha

Gambar 3.10 (c)Flowchart Sub Routine Reset ………... 46

Gambar 3.10 (d)Flowchart Sub Routine Run... 47

Gambar 4.1 Robot Menjejak Bola Merah ………. 48

Gambar 4.2 Robot Menjejak Bola Biru ... 49

Gambar 4.3 Robot Menjejak Bola Kuning ... 49

Gambar 4.4 Robot Bergerak Maju Menjejak Bola Merah ... 50

Gambar 4.5 Robot Bergerak Mundur Menjejak Bola Merah ... 50

Gambar 4.6 Robot Bergerak Belok Kanan Menjejak Bola Merah ... 51

Gambar 4.7 Robot Bergerak Belok Kiri Menjejak Bola Merah ... 51

Gambar 4.8 Robot Bergerak Serong Menjejak Bola Merah ... 51

Gambar 4.9 Robot Bergerak dengan Pola Segitiga Menjejak Bola Merah ... 51

Gambar 4.10 Robot Bergerak dengan Pola Melengkung Menjejak Bola Merah... 52

Gambar 4.11 Robot Bergerak Maju Menjejak Bola Biru ... 52

Gambar 4.12 Robot Bergerak Mundur Menjejak Bola Biru... 52

Gambar 4.13 Robot Bergerak Belok Kanan Menjejak Bola Biru... 53

Gambar 4.14 Robot Bergerak Belok Kiri Menjejak Bola Biru... 53

Gambar 4.15 Robot Bergerak Serong Menjejak Bola Biru ... 53

Gambar 4.16 Robot Bergerak dengan Pola Segitiga Menjejak Bola Biru.. 53

Gambar 4.17 Robot Bergerak dengan Pola Melengkung Menjejak Bola Biru ... 54

Gambar 4.18 Robot Bergerak Maju Menjejak Bola Kuning ... 54

Gambar 4.19 Robot Bergerak Mundur Menjejak Bola Kuning... 54

Gambar 4.20 Robot Bergerak Belok Kanan Menjejak Bola Kuning... 55

Gambar 4.21 Robot Bergerak Belok Kiri Menjejak Bola Kuning... 55

Gambar 4.22 Robot Bergerak Serong Menjejak Bola Kuning ... 55

(10)

x Universitas Kristen Maranatha

Gambar 4.24 Robot Bergerak dengan Pola Melengkung Menjejak Bola

(11)

LAMPIRAN - A

(12)

/***************************************************** This program was produced by the

CodeWizardAVR V1.25.3 Professional Automatic Program Generator

© Copyright 1998-2007 Pavel Haiduc, HP InfoTech s.r.l. http://www.hpinfotech.com

Project : Version :

Date : 8/5/2008

Author : Piter Company : lab Comments:

Chip type : ATmega16 Program type : Application Clock frequency : 11.059200 MHz Memory model : Small

External SRAM size : 0 Data Stack size : 256

*****************************************************/

#include <mega16.h>

#asm

.equ __lcd_port=0x18 ;PORTB #endasm

#include <lcd.h> #include <IP.h>

#define RXB8 1 #define TXB8 0 #define UPE 2 #define OVR 3 #define FE 4 #define UDRE 5 #define RXC 7

#define FRAMING_ERROR (1<<FE) #define PARITY_ERROR (1<<UPE) #define DATA_OVERRUN (1<<OVR)

#define DATA_REGISTER_EMPTY (1<<UDRE) #define RX_COMPLETE (1<<RXC)

(13)

#if RX_BUFFER_SIZE<256

if ((status & (FRAMING_ERROR | PARITY_ERROR | DATA_OVERRUN))==0) {

rx_buffer[rx_wr_index]=data;

if (++rx_wr_index == RX_BUFFER_SIZE) rx_wr_index=0; if (++rx_counter == RX_BUFFER_SIZE)

{

if (++rx_rd_index == RX_BUFFER_SIZE) rx_rd_index=0; #asm("cli")

(14)

#pragma used- #endif

interrupt [TIM1_COMPA] void timer1_compa_isr(void) {

for (iw=0;iw<9;iw++) pos[iw]=0;

for (iw=0;iw<30;iw++)tdata3[iw]=tdata2[iw]; pos_pos=0;

for (iw=0;iw<30;iw++) {

if(tdata3[iw]==32)pos_pos++;

if(tdata3[iw+1]!=32)pos[pos_pos]=(pos[pos_pos]*10)+ (tdata3[iw+1]-48); }

}

void main(void) {

TCCR1A=0x00; TCCR1B=0x0B; OCR1AH=0x08; OCR1AL=0x70;

TIMSK=0x10; UCSRA=0x00; UCSRB=0x98; UCSRC=0x86; UBRRH=0x00; UBRRL=0x47; ACSR=0x80; SFIOR=0x00; DDRD.2=1; DDRD.3=1; DDRD.4=1; DDRD.5=1; DDRD.6=1; DDRD.7=1;

lcd_init(16); #asm("sei")

(15)

CmuCamInit();

printf("TC 85 135 8 58 0 41\r"); delay_ms(200);

(16)

delay_ms(500);

printf("TC 0 41 54 104 63 113\r"); delay_ms(200);

(17)

if (((pos[1]<60)&&(pos[1]>40))&&(pos[6]<jarak))//lurus {

(18)

PORTD.7=0; };

if (((pos[1]<40)&&(pos[1]>10))&&(pos[6]<jarak)) //kanan {

if (((pos[1]<60)&&(pos[1]>40))&&(pos[6]>(jarak+15)))//mundur lurus {

(19)

PORTD.3=0;

(20)

lcd_clear(); }

(21)

LAMPIRAN - B

(22)

Features

• High-performance, Low-power AVR® 8-bit Microcontroller

• Advanced RISC Architecture

– 131 Powerful Instructions – Most Single-clock Cycle Execution – 32 x 8 General Purpose Working Registers

– Fully Static Operation

– Up to 16 MIPS Throughput at 16 MHz – On-chip 2-cycle Multiplier

• High Endurance Non-volatile Memory segments

– 16K Bytes of In-System Self-programmable Flash program memory – 512 Bytes EEPROM

– 1K Byte Internal SRAM

– Write/Erase Cycles: 10,000 Flash/100,000 EEPROM – Data retention: 20 years at 85°C/100 years at 25°C(1) – Optional Boot Code Section with Independent Lock Bits

In-System Programming by On-chip Boot Program True Read-While-Write Operation

– Programming Lock for Software Security • JTAG (IEEE std. 1149.1 Compliant) Interface

– Boundary-scan Capabilities According to the JTAG Standard – Extensive On-chip Debug Support

– Programming of Flash, EEPROM, Fuses, and Lock Bits through the JTAG Interface • Peripheral Features

– Two 8-bit Timer/Counters with Separate Prescalers and Compare Modes – One 16-bit Timer/Counter with Separate Prescaler, Compare Mode, and Capture

Mode

– Real Time Counter with Separate Oscillator – Four PWM Channels

– 8-channel, 10-bit ADC 8 Single-ended Channels

7 Differential Channels in TQFP Package Only

2 Differential Channels with Programmable Gain at 1x, 10x, or 200x – Byte-oriented Two-wire Serial Interface

– Programmable Serial USART – Master/Slave SPI Serial Interface

– Programmable Watchdog Timer with Separate On-chip Oscillator – On-chip Analog Comparator

• Special Microcontroller Features

– Power-on Reset and Programmable Brown-out Detection – Internal Calibrated RC Oscillator

– External and Internal Interrupt Sources

– Six Sleep Modes: Idle, ADC Noise Reduction, Power-save, Power-down, Standby and Extended Standby

• I/O and Packages

– 32 Programmable I/O Lines

– 40-pin PDIP, 44-lead TQFP, and 44-pad QFN/MLF • Operating Voltages

(23)

Pin

Configurations

Figure 1. Pinout ATmega16

PDIP

Disclaimer

Typical values contained in this datasheet are based on simulations and characterization of other AVR microcontrollers manufactured on the same process technology. Min and Max values will be available after the device is characterized.

2

ATmega16(L)

(24)

GENERAL

Overview

The ATmega16 is a low-power CMOS 8-bit microcontroller based on the AVR enhanced RISC architecture. By executing powerful instructions in a single clock cycle, the ATmega16 achieves throughputs approaching 1 MIPS per MHz allowing the system designer to optimize power con- sumption versus processing speed.

Block Diagram Figure 2. Block Diagram

VCC

PA0 - PA7 PC0 - PC7

PORTA DRIVERS/BUFFERS PORTC DRIVERS/BUFFERS

GND PORTA DIGITAL INTERFACE PORTC DIGITAL INTERFACE

AVCC

PORTB DIGITAL INTERFACE PORTD DIGITAL INTERFACE

PORTB DRIVERS/BUFFERS PORTD DRIVERS/BUFFERS

PB0 - PB7 PD0 - PD7

(25)

The AVR core combines a rich instruction set with 32 general purpose working registers. All the 32 registers are directly connected to the Arithmetic Logic Unit (ALU), allowing two independent registers to be accessed in one single instruction executed in one clock cycle. The resulting architecture is more code efficient while achieving throughputs up to ten times faster than con- ventional CISC microcontrollers.

The ATmega16 provides the following features: 16K bytes of In-System Programmable Flash Program memory with Read-While-Write capabilities, 512 bytes EEPROM, 1K byte SRAM, 32 general purpose I/O lines, 32 general purpose working registers, a JTAG interface for Boundary- scan, On-chip Debugging support and programming, three flexible Timer/Counters with com- pare modes, Internal and External Interrupts, a serial programmable USART, a byte oriented Two-wire Serial Interface, an 8-channel, 10-bit ADC with optional differential input stage with programmable gain (TQFP package only), a programmable Watchdog Timer with Internal Oscil- lator, an SPI serial port, and six software selectable power saving modes. The Idle mode stops the CPU while allowing the USART, Two-wire interface, A/D Converter, SRAM, Timer/Counters, SPI port, and interrupt system to continue functioning. The Power-down mode saves the register contents but freezes the Oscillator, disabling all other chip functions until the next External Inter- rupt or Hardware Reset. In Power-save mode, the Asynchronous Timer continues to run, allowing the user to maintain a timer base while the rest of the device is sleeping. The ADC Noise Reduction mode stops the CPU and all I/O modules except Asynchronous Timer and ADC, to minimize switching noise during ADC conversions. In Standby mode, the crystal/reso- nator Oscillator is running while the rest of the device is sleeping. This allows very fast start-up combined with low-power consumption. In Extended Standby mode, both the main Oscillator and the Asynchronous Timer continue to run.

The device is manufactured using Atmel’s high density nonvolatile memory technology. The On- chip ISP Flash allows the program memory to be reprogrammed in-system through an SPI serial interface, by a conventional nonvolatile memory programmer, or by an On-chip Boot program running on the AVR core. The boot program can use any interface to download the application program in the Application Flash memory. Software in the Boot Flash section will continue to run while the Application Flash section is updated, providing true Read-While-Write operation. By combining an 8-bit RISC CPU with In-System Self-Programmable Flash on a monolithic chip, the Atmel ATmega16 is a powerful microcontroller that provides a highly-flexible and cost-effec- tive solution to many embedded control applications.

The ATmega16 AVR is supported with a full suite of program and system development tools including: C compilers, macro assemblers, program debugger/simulators, in-circuit emulators, and evaluation kits.

Pin Descriptions

VCC Digital supply voltage.

GND Ground.

Port A (PA7..PA0) Port A serves as the analog inputs to the A/D Converter.

Port A also serves as an 8-bit bi-directional I/O port, if the A/D Converter is not used. Port pins can provide internal pull-up resistors (selected for each bit). The Port A output buffers have sym- metrical drive characteristics with both high sink and source capability. When pins PA0 to PA7 are used as inputs and are externally pulled low, they will source current if the internal pull-up resistors are activated. The Port A pins are tri-stated when a reset condition becomes active, even if the clock is not running.

4

ATmega16(L)

(26)

ATmega16(L)

Port B (PB7..PB0) Port B is an 8-bit bi-directional I/O port with internal pull-up resistors (selected for each bit). The Port B output buffers have symmetrical drive characteristics with both high sink and source capability. As inputs, Port B pins that are externally pulled low will source current if the pull-up resistors are activated. The Port B pins are tri-stated when a reset condition becomes active, even if the clock is not running.

Port B also serves the functions of various special features of the ATmega16 as listed on page 58.

Port C (PC7..PC0) Port C is an 8-bit bi-directional I/O port with internal pull-up resistors (selected for each bit). The Port C output buffers have symmetrical drive characteristics with both high sink and source capability. As inputs, Port C pins that are externally pulled low will source current if the pull-up resistors are activated. The Port C pins are tri-stated when a reset condition becomes active, even if the clock is not running. If the JTAG interface is enabled, the pull-up resistors on pins PC5(TDI), PC3(TMS) and PC2(TCK) will be activated even if a reset occurs.

Port C also serves the functions of the JTAG interface and other special features of the ATmega16 as listed on page 61.

Port D (PD7..PD0) Port D is an 8-bit bi-directional I/O port with internal pull-up resistors (selected for each bit). The Port D output buffers have symmetrical drive characteristics with both high sink and source capability. As inputs, Port D pins that are externally pulled low will source current if the pull-up resistors are activated. The Port D pins are tri-stated when a reset condition becomes active, even if the clock is not running.

Port D also serves the functions of various special features of the ATmega16 as listed on page 63.

RESET Reset Input. A low level on this pin for longer than the minimum pulse length will generate a reset, even if the clock is not running. The minimum pulse length is given in Table 15 on page 38. Shorter pulses are not guaranteed to generate a reset.

XTAL1 Input to the inverting Oscillator amplifier and input to the internal clock operating circuit.

XTAL2 Output from the inverting Oscillator amplifier.

AVCC AVCC is the supply voltage pin for Port A and the A/D Converter. It should be externally con- nected to VCC, even if the ADC is not used. If the ADC is used, it should be connected to VCC through a low-pass filter.

AREF AREF is the analog reference pin for the A/D Converter.

(27)

Features

• Utilizes the AVR® RISC Architecture

• AVR – High-performance and Low-power RISC Architecture – 120 Powerful Instructions – Most Single Clock Cycle Execution – 32 x 8 General Purpose Working Registers

– Fully Static Operation

– Up to 20 MIPS Throughput at 20 MHz

• Data and Non-volatile Program and Data Memories – 2K Bytes of In-System Self Programmable Flash

Endurance 10,000 Write/Erase Cycles – 128 Bytes In-System Programmable EEPROM

Endurance: 100,000 Write/Erase Cycles – 128 Bytes Internal SRAM

– Programming Lock for Flash Program and EEPROM Data Security • Peripheral Features

– One 8-bit Timer/Counter with Separate Prescaler and Compare Mode

– One 16-bit Timer/Counter with Separate Prescaler, Compare and Capture Modes – Four PWM Channels

– On-chip Analog Comparator

– Programmable Watchdog Timer with On-chip Oscillator – USI – Universal Serial Interface

– Full Duplex USART

• Special Microcontroller Features – debugWIRE On-chip Debugging – In-System Programmable via SPI Port – External and Internal Interrupt Sources

– Low-power Idle, Power-down, and Standby Modes – Enhanced Power-on Reset Circuit

– Programmable Brown-out Detection Circuit – Internal Calibrated Oscillator

• I/O and Packages

– 18 Programmable I/O Lines

– 20-pin PDIP, 20-pin SOIC, 20-pad QFN/MLF • Operating Voltages

(28)

Pin Configurations

Figure 1. Pinout ATtiny2313

NOTE: Bottom pad should be soldered to ground.

Overview

The ATtiny2313 is a low-power CMOS 8-bit microcontroller based on the AVR enhanced RISC architecture. By executing powerful instructions in a single clock cycle, the ATtiny2313 achieves throughputs approaching 1 MIPS per MHz allowing the system designer to optimize power consumption versus processing speed.

2

ATtiny2313/V

(29)
(30)

The AVR core combines a rich instruction set with 32 general purpose working registers. All the 32 registers are directly connected to the Arithmetic Logic Unit (ALU), allowing two independent registers to be accessed in one single instruction executed in one clock cycle. The resulting architecture is more code efficient while achieving throughputs up to ten times faster than conventional CISC microcontrollers.

The ATtiny2313 provides the following features: 2K bytes of In-System Programmable Flash, 128 bytes EEPROM, 128 bytes SRAM, 18 general purpose I/O lines, 32 general purpose working registers, a single-wire Interface for On-chip Debugging, two flexible Timer/Counters with compare modes, internal and external interrupts, a serial program- mable USART, Universal Serial Interface with Start Condition Detector, a programmable Watchdog Timer with internal Oscillator, and three software selectable power saving modes. The Idle mode stops the CPU while allowing the SRAM, Timer/Counters, and interrupt system to continue functioning. The Power-down mode saves the register con- tents but freezes the Oscillator, disabling all other chip functions until the next interrupt or hardware reset. In Standby mode, the crystal/resonator Oscillator is running while the rest of the device is sleeping. This allows very fast start-up combined with low-power consumption.

The device is manufactured using Atmel’s high density non-volatile memory technology. The On-chip ISP Flash allows the program memory to be reprogrammed In-System through an SPI serial interface, or by a conventional non-volatile memory programmer. By combining an 8-bit RISC CPU with In-System Self-Programmable Flash on a mono- lithic chip, the Atmel ATtiny2313 is a powerful microcontroller that provides a highly flexible and cost effective solution to many embedded control applications.

The ATtiny2313 AVR is supported with a full suite of program and system development tools including: C Compilers, Macro Assemblers, Program Debugger/Simulators, In-Cir- cuit Emulators, and Evaluation kits.

4

ATtiny2313/V

(31)

ATtiny2313/V

Pin Descriptions

VCC Digital supply voltage.

GND Ground.

Port A (PA2..PA0) Port A is a 3-bit bi-directional I/O port with internal pull-up resistors (selected for each bit). The Port A output buffers have symmetrical drive characteristics with both high sink and source capability. As inputs, Port A pins that are externally pulled low will source current if the pull-up resistors are activated. The Port A pins are tri-stated when a reset condition becomes active, even if the clock is not running.

Port A also serves the functions of various special features of the ATtiny2313 as listed on page 53.

Port B (PB7..PB0) Port B is an 8-bit bi-directional I/O port with internal pull-up resistors (selected for each bit). The Port B output buffers have symmetrical drive characteristics with both high sink and source capability. As inputs, Port B pins that are externally pulled low will source current if the pull-up resistors are activated. The Port B pins are tri-stated when a reset condition becomes active, even if the clock is not running.

Port B also serves the functions of various special features of the ATtiny2313 as listed on page 53.

Port D (PD6..PD0) Port D is a 7-bit bi-directional I/O port with internal pull-up resistors (selected for each bit). The Port D output buffers have symmetrical drive characteristics with both high sink and source capability. As inputs, Port D pins that are externally pulled low will source current if the pull-up resistors are activated. The Port D pins are tri-stated when a reset condition becomes active, even if the clock is not running.

Port D also serves the functions of various special features of the ATtiny2313 as listed on page 56.

RESET Reset input. A low level on this pin for longer than the minimum pulse length will gener- ate a reset, even if the clock is not running. The minimum pulse length is given in Table 15 on page 34. Shorter pulses are not guaranteed to generate a reset. The Reset Input is an alternate function for PA2 and dW.

XTAL1 Input to the inverting Oscillator amplifier and input to the internal clock operating circuit. XTAL1 is an alternate function for PA0.

XTAL2 Output from the inverting Oscillator amplifier. XTAL2 is an alternate function for PA1.

Resources

A comprehensive set of development tools, application notes and datasheets are avail- able for downloadon http://www.atmel.com/avr.

(32)

LAMPIRAN - C

(33)

Tampak depan

(34)

Tampak atas

(35)

1 Universitas Kristen Maranatha

BAB I PENDAHULUAN

Pada bab ini akan dibahas mengenai latar belakang, identifikasi masalah, tujuan, perumusan masalah, tujuan, pembatasan masalah, spesifikasi alat yang dibuat dan sistematika penulisan Tugas Akhir.

1.1 Latar Belakang

Dengan semakin berkembangnya teknologi robotika belakangan ini, meningkatkan kreasi manusia untuk merealisasikan robot dengan berbagai kemampuan yang dapat mendukung kinerja manusia dalam melakukan suatu pekerjaan agar lebih praktis dan efisien. Salah satu perkembangan teknologi robotika adalah perkembangan sensor kamera yang fungsinya seperti mata pada manusia.

Dalam bidang otomasi, mesin harus dapat bekerja menggantikan manusia, ini berarti bahwa mesin juga harus memiliki sensor kamera yang dapat membedakan warna dan menjejak pergerakan objek. Dalam bidang robotika juga terjadi hal yang sama, teknologi robot yang demikian pesatnya pastilah akan menuntut robot harus dapat bekerja menyerupai manusia dalam hal membedakan warna dan menjejak objek.

(36)

BAB I PENDAHULUAN 2

Universitas Kristen Maranatha

1.2 Identifikasi Masalah

Identifikasi masalah pada Tugas Akhir ini adalah merealisasikan sebuah robot beroda yang dapat menjejak pergerakan bola berwarna dan mempertahankan jarak yang sudah ditentukan.

1.3 Perumusan Masalah

Perumusan permasalahan-permasalahan yang akan dibahas dalam Tugas Akhir ini sebagai berikut :

1. Bagaimana membuat robot autonomous ?

2. Bagaimana mengaplikasikan CMUcam untuk mendeteksi warna bola dan menjejak pergerakan bola yang sesuai dengan warna yang diinginkan dengan menggunakan pengontrol mikro untuk menggerakkan robot ?

1.4 Tujuan

Tujuan Tugas Akhir ini adalah membuat sebuah robot beroda yang dapat bergerak mengikuti arah pergerakan bola berdasarkan warna yang diinginkan dan mempertahankan jarak tertentu.

1.5 Pembatasan Masalah

Tugas Akhir ini dibatasi oleh:

1. Robot yang didesain merupakan robot mobil dengan menggunakan 2 buah motor DC sebagai penggerak dengan sistem differential drive.

2. Sensor kamera yang digunakan adalah sensor CMUcam 2+. 3. Masukan warna bola dan besar piksel menggunakan keypad. 4. Warna bola yang diteliti hanya warna merah, kuning, dan biru.

5. Jarak minimum objek bola ke sensor kamera 4 cm dan jarak maksimum 100 cm.

(37)

BAB I PENDAHULUAN 3

Universitas Kristen Maranatha

1.6 Spesifikasi Alat

Spesifikasi alat dalam Tugas Akhir ini adalah :

1. Mampu menjejak bola berdasarkan warna yang diinginkan. 2. Parameter warna objek berupa RGB.

3. Memakai 3 buah roda, dengan 2 roda depan dilengkapi dengan motor DC, dan 1 buah roda bebas di belakang.

1.7 Sistematika Penulisan

Pembahasan laporan tugas akhir ini disusun dengan sistematika sebagai berikut :

1. BAB I PENDAHULUAN

Bab ini memberikan penjelasan mengenai latar belakang, identifikasi masalah, perumusan masalah,pembatasan masalah, tujuan yang mendasari penelitian tugas akhir dan sitematika penyusunan laporan tugas akhir.

2. BAB II LANDASAN TEORI

Bab ini berisi teori-teori dasar yang menunjang perancangan dan realisasi alat yang dibuat. Teori yang dimaksud adalah CMUCam2+ sebagai sensor visual, Pengontrol mikro sebagai pengolah dari keseluruhan system, Motor DC sebagai penggerak robot mobil.

3. BAB III PERANCANGAN DAN REALISASI

Pada bab ini dijelaskan mengenai perancangan robot mobil, perancangan dan realisasi perangkat keras dan juga perangkat lunak yang dilengkapi dengan diagram alir dari perangkat lunak.

4. BAB IV DATA PENGAMATAN DAN ANALISIS

Bab ini berisi hasil uji coba robot mobil dalam menjejak pergerakan bola berwarna dan analisis terhadap alat yang telah dirancang.

5. BAB V KESIMPULAN DAN SARAN

(38)

62 Universitas Kristen Maranatha

BAB V

KESIMPULAN DAN SARAN

Bab ini berisi kesimpulan dari Tugas Akhir dan saran-saran yang perlu dilakukan untuk perbaikan di masa mendatang.

V.1 Kesimpulan

Dengan memperhatikan data pengamatan dan analisis pada bab sebelumnya, dapat disimpulkan bahwa:

1. Robot mobil berhasil menjejak pergerakan bola berdasarkan warna yang diinginkan dengan mempertahankan jarak tertentu.

2. Parameter kanal warna objek berbeda untuk tiap kecerahan lingkungan, oleh karena itu pada saat pengujian kecerahan lingkungan harus konstan. Kecerahan lingkungan yang berubah-ubah dapat mempengaruhi kinerja robot. 3. Pada kecerahan lingkungan yang rendah, CMUCam2+ tidak dapat

membedakan objek yang dijejak dengan objek-objek lain di sekelilingnya.

V.1 Saran

Saran-saran yang dapat diberikan untuk perbaikan dan pengembangan dari realisasi sistem penjejak robot dengan pemandu bola berwarna adalah sebagai berikut:

1. Sistem dapat menjejak objek yang bervariasi, dengan bentuk dan fitur-fitur yang dimiliki objek lebih rumit.

(39)

Universitas Kristen Maranatha

63

DAFTAR PUSTAKA

1. Andrianto, H., Buku Panduan : Pelatihan Mikrokontroler AVR ATmega16,

2008.

2. Budiharto, W., Membuat Robot Cerdas, Jakarta : Gramedia, 2006.

3. Sigit, Riyanto. Robotika, Sensor, Dan Aktuator, Edisi ke-1, Yogyakarta:Graha

Ilmu, 2007.

4. http://cmu-camera.com/cmu.pdf

5. http://id.wikipedia.org/wiki/Robot

6. http://www.acroname.com

7. http://www.atmel.com

8. http://www.avrfreaks.net

9. http://www.cs.cmu.edu/~cmucam/cmucam2/CMUcam2_manual.pdf

10.http://www.cs.cmu.edu/~cmucam/cmucam2/CMUcam2GUI_overview.pdf

11.http://www.gedex.web.id.

12.http://www.parallax.com.

Referensi

Dokumen terkait

Batas ekologis Segitiga Terumbu karang (warna hijau pada Peta ), yang dinamai demikian karena bentuk segitiganya jelas, memiliki hampir 73.000 km2 terumbu karang (29% dari

Dengan perkembangan teknologi, menuntut adanya inovasi untuk menciptakan Perancangan Alat Pendeteksi Pencemaran Udara Pada Ruang Berbasis Mikrokontroller At8535 Dan

Dibandingkan dengan kadar logam berat Pb tersuspensi di perairan Delta Berau pada April 2007 dan Muara Sungai Banjir Kanal Barat Semarang pada September 2005 kadar logam berat

Pengaplikasian program Wingeom dalam sub pokok bahasan balok dan unsur-unsurnya dilakukan dengan cara yang sama dengan bangun ruang kubus.. Demikian juga cara

Berdasarkan fenomena yang ada serta objek penelitian yang telah ditentukan maka peneliti tertarik untuk meneliti lebih dalam mengenai teknik penganggaran modal yang

mengakibatkan perceraian ini biasanya ditenggarai dengan poligami diam-diam tanpa persetujuan isteri pertama. Selain merugikan dan menyakiti isteri pertama, dampak

a) Periodisasi Umur dan kecakapan hukum dalam Islam.. Definisi anak secara bahasa merujuk pada kamus bahasa Indonesia diartikan dengan manusia yang masih kecil atau manusia

melakukan proses ta’aruf sebelum perkawinan, hubungan antara religiusitas dengan kepuasan perkawinan pada wanita wanita yang melakukan proses ta’aruf sebelum