Mobilní robot

Z MediaWiki SPŠ a VOŠ Písek
(Rozdíly mezi verzemi)
Přejít na: navigace, hledání
(Založena nová stránka: ==Zadání:== # Proveďte teoretický rozbor možností řešení vývoje autonomního robota # Vyberte vhodné řešení #* Nakreslete blokové schéma #* Jednotivé blo...)
 
 
(Není zobrazeno 11 mezilehlých verzí od 1 uživatele.)
Řádka 1: Řádka 1:
 +
 
==Zadání:==
 
==Zadání:==
  
Řádka 12: Řádka 13:
 
# Zpracujte ppt prezentaci pro účely obhajoby  
 
# Zpracujte ppt prezentaci pro účely obhajoby  
 
# Propagujte výsledky své práce - např. vyhotovte [[poster]], je možné se přihlásit na [[SOČ]], zhotovit www stránky apod.
 
# Propagujte výsledky své práce - např. vyhotovte [[poster]], je možné se přihlásit na [[SOČ]], zhotovit www stránky apod.
 +
 +
==Fotogalerie:==
 +
 +
[[Soubor:mobilni-robot-17.jpg|200px]]
 +
[[Soubor:mobilni-robot-08.jpg|200px]]
 +
[[Soubor:mobilni-robot-09.jpg|200px]]
 +
[[Soubor:mobilni-robot-10.jpg|200px]]
 +
[[Soubor:mobilni-robot-11.jpg|200px]]
 +
[[Soubor:mobilni-robot-12.jpg|200px]]
 +
[[Soubor:mobilni-robot-13.jpg|200px]]
 +
[[Soubor:mobilni-robot-14.jpg|200px]]
 +
[[Soubor:mobilni-robot-15.jpg|200px]]
 +
[[Soubor:mobilni-robot-16.jpg|200px]]
 +
 +
[[Soubor:mobilni-robot-02.jpg|300px|thumb]]
 +
 +
[[Soubor:mobilni-robot-03.jpg|300px|thumb]]
 +
 +
[[Soubor:mobilni-robot-04.jpg|300px|thumb]]
 +
 +
[[Soubor:mobilni-robot-06.jpg|300px|thumb]
 +
 +
==Program:==
 +
 +
<source lang="C">
 +
/**************************
 +
Chip type              : ATmega16
 +
Program type            : Application
 +
AVR Core Clock frequency: 18,423000 MHz
 +
Memory model            : Small
 +
External RAM size      : 0
 +
Data Stack size        : 256
 +
**************************/
 +
 +
#include <mega16.h>
 +
#include <stdio.h> 
 +
#include <stdlib.h>
 +
#define F_CPU 18423000
 +
#include <delay.h>
 +
 +
#define ADC_VREF_TYPE 0x60
 +
int hrana;
 +
bit por0;
 +
 +
//Deklarace globálních proměnných
 +
unsigned int read_adc(unsigned char kanal)  {
 +
ADMUX=kanal; 
 +
    ADCSRA|=0x40; 
 +
    while ((ADCSRA & 0x10)==0); 
 +
    ADCSRA|= 0x10; 
 +
return ADCW;
 +
}
 +
 +
 +
void main(void)
 +
{
 +
 +
// Input/Output Ports initialization
 +
// Port A initialization
 +
PORTA=0x00;
 +
DDRA=0x00;
 +
 +
// Port B initialization
 +
PORTB=0x00;
 +
DDRB=0x00;
 +
 +
// Port C initialization
 +
PORTC=0x00;
 +
DDRC=0xC0;
 +
 +
// Port D initialization
 +
PORTD=0x00;
 +
DDRD=0b11111111;
 +
 +
// Timer/Counter 0 initialization
 +
// Clock source: System Clock
 +
// Clock value: Timer 0 Stopped
 +
// Mode: Normal top=0xFF
 +
// OC0 output: Disconnected
 +
TCCR0=0x00;
 +
TCNT0=0x00;
 +
OCR0=0x00;
 +
 +
// Timer/Counter 1 initialization
 +
// Clock source: System Clock
 +
// Clock value: Timer1 Stopped
 +
// Mode: Normal top=0xFFFF
 +
// OC1A output: Discon.
 +
// OC1B output: Discon.
 +
// Noise Canceler: Off
 +
// Input Capture on Falling Edge
 +
// Timer1 Overflow Interrupt: Off
 +
// Input Capture Interrupt: Off
 +
// Compare A Match Interrupt: Off
 +
// Compare B Match Interrupt: Off
 +
TCCR1A=0x00;
 +
TCCR1B=0x00;
 +
TCNT1H=0x00;
 +
TCNT1L=0x00;
 +
ICR1H=0x00;
 +
ICR1L=0x00;
 +
OCR1AH=0x00;
 +
OCR1AL=0x00;
 +
OCR1BH=0x00;
 +
OCR1BL=0x00;
 +
 +
// Timer/Counter 2 initialization
 +
// Clock source: System Clock
 +
// Clock value: Timer2 Stopped
 +
// Mode: Normal top=0xFF
 +
// OC2 output: Disconnected
 +
ASSR=0x00;
 +
TCCR2=0x00;
 +
TCNT2=0x00;
 +
OCR2=0x00;
 +
 +
// External Interrupt(s) initialization
 +
// INT0: Off
 +
// INT1: Off
 +
// INT2: Off
 +
MCUCR=0x00;
 +
MCUCSR=0x00;
 +
 +
// Timer(s)/Counter(s) Interrupt(s) initialization
 +
TIMSK=0x00;
 +
 +
// USART initialization
 +
// USART disabled
 +
UCSRB=0x00;
 +
 +
// Analog Comparator initialization
 +
// Analog Comparator: Off
 +
// Analog Comparator Input Capture by Timer/Counter 1: Off
 +
ACSR=0x80;
 +
SFIOR=0x00;
 +
 +
// ADC initialization
 +
// ADC Clock frequency: 575,719 kHz
 +
// ADC Voltage Reference: AVCC pin
 +
// ADC Auto Trigger Source: Free Running
 +
// Only the 8 most significant bits of
 +
// the AD conversion result are used
 +
ADMUX=ADC_VREF_TYPE & 0xff;
 +
ADCSRA=0xA5;
 +
SFIOR&=0x1F;
 +
 +
// SPI initialization
 +
// SPI disabled
 +
SPCR=0x00;
 +
 +
// TWI initialization
 +
// TWI disabled
 +
TWCR=0x00;
 +
 +
DDRC=0b00000011; //bity 7. až 3. nastaveny jako vstupní, ostatní výstupní = připojeny LED
 +
DDRA=0b00000000; //všechny bity vstupní
 +
PORTC=0b00000011; // na bitech 1. a 0. připojeny LED  log. "1"
 +
delay_ms(200);
 +
PORTC=0b00000001; // na bit 0. log. "1"
 +
delay_ms(200);
 +
PORTC=0b00000010; // na bit 1. log. "1"
 +
delay_ms(2000);
 +
hrana=(read_adc(0)+read_adc(1))/2;
 +
PORTC=0b00000000;
 +
      while(1){
 +
      if ((read_adc(0)<hrana)*(read_adc(1)<hrana)*(read_adc(2)<hrana)*(read_adc(3)<hrana)){
 +
      PORTD=0b00100111; //0000 - 00L00PLP
 +
      };
 +
      if ((read_adc(0)>hrana)*(read_adc(1)<hrana)*(read_adc(2)<hrana)*(read_adc(3)<hrana)){
 +
      PORTD=0b01101011; //1000 – OPL000LP
 +
      };
 +
      if ((read_adc(0)<hrana)*(read_adc(1)<hrana)*(read_adc(2)<hrana)*(read_adc(3)>hrana)){
 +
      PORTD=0b01101011; //0001 – 0PL000LP
 +
      };
 +
      if ((read_adc(0)<hrana)*(read_adc(1)>hrana)*(read_adc(2)<hrana)*(read_adc(3)<hrana)){
 +
      PORTD=0b01011011; //0100 – 0P0L00LP
 +
      }
 +
      if ((read_adc(0)<hrana)*(read_adc(1)<hrana)*(read_adc(2)>hrana)*(read_adc(3)<hrana)){
 +
      PORTD=0b00100111; //0010 - 00L00PLP
 +
      };
 +
      if ((read_adc(0)<hrana)*(read_adc(1)<hrana)*(read_adc(2)>hrana)*(read_adc(3)<hrana)){
 +
      PORTD=0b00100111; //0010 - 00L00PLP
 +
      };
 +
        if ((read_adc(0)>hrana)*(read_adc(1)>hrana)*(read_adc(2)>hrana)*(read_adc(3)> hrana)){
 +
        if (por0){
 +
            PORTD=0b01011011; //1111 – 0P0L00LP
 +
            delay_ms(100);
 +
            PORTD=0b01101011; //1111 – 0PL000LP
 +
            delay_ms(2000);
 +
            por0=0;}else{     
 +
          PORTD=0b00100111; //1111 – 00L00PLP
 +
            delay_ms(200);
 +
            por0=1;
 +
            };
 +
          };
 +
        if ((read_adc(0)<hrana)*(read_adc(1)>hrana)*(read_adc(2)>hrana)*(read_adc(3)<hrana)){
 +
      PORTD=0b01100011; //0110 – 0PL000LP
 +
      };
 +
      if ((read_adc(0)>hrana)*(read_adc(1)>hrana)*(read_adc(2)<hrana)*(read_adc(3)<hrana)){
 +
      PORTD=0b01010001; //1100 – 0P0L000P
 +
      };
 +
      if ((read_adc(0)<hrana)*(read_adc(1)<hrana)*(read_adc(2)>hrana)*(read_adc(3)>hrana)){
 +
      PORTD=0b00100110; //0011 – 00L00PLP
 +
      };
 +
      if ((read_adc(0)<hrana)*(read_adc(1)>hrana)*(read_adc(2)>hrana)*(read_adc(3)>hrana)){
 +
      PORTD=0b00100110; //0111 – 00L00PL0
 +
      };
 +
      if ((read_adc(0)>hrana)*(read_adc(1)>hrana)*(read_adc(2)>hrana)*(read_adc(3)<hrana)){
 +
      PORTD=0b00100101; //1110 – 00L00P0P
 +
      };     
 +
}
 +
 +
 +
 +
</source>
 +
 +
 +
 +
==www:==
 +
 +
[[Soubor:mobilni-robot-vznika-na-VSPJ.jpg|300px]]  [http://vspj-robot.blogspot.com/ Projekt "Mobilní robot" vzniká na VŠPJ]
 +
 +
[[Soubor:mobilni-robot-07.jpg|300px]] [http://shop.snailinstruments.com/index.php?main_page=product_info&cPath=81_84&products_id=346 Výkonový IO L298N]
 +
 +
[[Soubor:D10 HW 034.jpg |200px]] [http://shop.snailinstruments.com/index.php?main_page=product_info&cPath=77&products_id=382 Podvozek MOB-03]

Aktuální verze z 1. 5. 2011, 14:09

Obsah

Zadání:

  1. Proveďte teoretický rozbor možností řešení vývoje autonomního robota
  2. Vyberte vhodné řešení
    • Nakreslete blokové schéma
    • Jednotivé bloky kompletně popište
  3. Navrhněte el. schéma a DPS
  4. Obvod realizujte
  5. Naprogramujte robota pro jízdu v bludišti
  6. Otestujte funkčnost
  7. Zpracujte dokumentaci dle metodického návrhu
  8. Zpracujte ppt prezentaci pro účely obhajoby
  9. Propagujte výsledky své práce - např. vyhotovte poster, je možné se přihlásit na SOČ, zhotovit www stránky apod.

Fotogalerie:

Mobilni-robot-17.jpg Mobilni-robot-08.jpg Mobilni-robot-09.jpg Mobilni-robot-10.jpg Mobilni-robot-11.jpg Mobilni-robot-12.jpg Mobilni-robot-13.jpg Mobilni-robot-14.jpg Mobilni-robot-15.jpg Mobilni-robot-16.jpg

Mobilni-robot-02.jpg
Mobilni-robot-03.jpg
Mobilni-robot-04.jpg

[[Soubor:mobilni-robot-06.jpg|300px|thumb]

Program:

 
 /**************************
 Chip type               : ATmega16
 Program type            : Application
 AVR Core Clock frequency: 18,423000 MHz
 Memory model            : Small
 External RAM size       : 0
 Data Stack size         : 256
 **************************/
 
 #include <mega16.h>
 #include <stdio.h>  
 #include <stdlib.h>
 #define F_CPU 18423000
 #include <delay.h>
 
 #define ADC_VREF_TYPE 0x60
 int hrana;
 bit por0;
 
 //Deklarace globálních proměnných
 unsigned int read_adc(unsigned char kanal)  {
 ADMUX=kanal;  
    ADCSRA|=0x40;  
    while ((ADCSRA & 0x10)==0);  
    ADCSRA|= 0x10;  
 return ADCW;
 } 
 
 
 void main(void)
 {
 
 // Input/Output Ports initialization
 // Port A initialization
 PORTA=0x00;
 DDRA=0x00;
 
 // Port B initialization
 PORTB=0x00;
 DDRB=0x00;
 
 // Port C initialization
 PORTC=0x00;
 DDRC=0xC0;
 
 // Port D initialization
 PORTD=0x00;
 DDRD=0b11111111;
 
 // Timer/Counter 0 initialization
 // Clock source: System Clock
 // Clock value: Timer 0 Stopped
 // Mode: Normal top=0xFF
 // OC0 output: Disconnected
 TCCR0=0x00;
 TCNT0=0x00;
 OCR0=0x00;
 
 // Timer/Counter 1 initialization
 // Clock source: System Clock
 // Clock value: Timer1 Stopped
 // Mode: Normal top=0xFFFF
 // OC1A output: Discon.
 // OC1B output: Discon.
 // Noise Canceler: Off
 // Input Capture on Falling Edge
 // Timer1 Overflow Interrupt: Off
 // Input Capture Interrupt: Off
 // Compare A Match Interrupt: Off
 // Compare B Match Interrupt: Off
 TCCR1A=0x00;
 TCCR1B=0x00;
 TCNT1H=0x00;
 TCNT1L=0x00;
 ICR1H=0x00;
 ICR1L=0x00;
 OCR1AH=0x00;
 OCR1AL=0x00;
 OCR1BH=0x00;
 OCR1BL=0x00;
 
 // Timer/Counter 2 initialization
 // Clock source: System Clock
 // Clock value: Timer2 Stopped
 // Mode: Normal top=0xFF
 // OC2 output: Disconnected
 ASSR=0x00;
 TCCR2=0x00;
 TCNT2=0x00;
 OCR2=0x00;
 
 // External Interrupt(s) initialization
 // INT0: Off
 // INT1: Off
 // INT2: Off
 MCUCR=0x00;
 MCUCSR=0x00;
 
 // Timer(s)/Counter(s) Interrupt(s) initialization
 TIMSK=0x00;
 
 // USART initialization
 // USART disabled
 UCSRB=0x00;
 
 // Analog Comparator initialization
 // Analog Comparator: Off
 // Analog Comparator Input Capture by Timer/Counter 1: Off
 ACSR=0x80;
 SFIOR=0x00;
 
 // ADC initialization
 // ADC Clock frequency: 575,719 kHz
 // ADC Voltage Reference: AVCC pin
 // ADC Auto Trigger Source: Free Running
 // Only the 8 most significant bits of
 // the AD conversion result are used
 ADMUX=ADC_VREF_TYPE & 0xff;
 ADCSRA=0xA5;
 SFIOR&=0x1F;
 
 // SPI initialization
 // SPI disabled
 SPCR=0x00;
 
 // TWI initialization
 // TWI disabled
 TWCR=0x00;
 
 DDRC=0b00000011; //bity 7. až 3. nastaveny jako vstupní, ostatní výstupní = připojeny LED
 DDRA=0b00000000; //všechny bity vstupní
 PORTC=0b00000011; // na bitech 1. a 0. připojeny LED  log. "1"
 delay_ms(200);
 PORTC=0b00000001; // na bit 0. log. "1"
 delay_ms(200);
 PORTC=0b00000010; // na bit 1. log. "1"
 delay_ms(2000);
 hrana=(read_adc(0)+read_adc(1))/2;
 PORTC=0b00000000;
       while(1){
       if ((read_adc(0)<hrana)*(read_adc(1)<hrana)*(read_adc(2)<hrana)*(read_adc(3)<hrana)){
       PORTD=0b00100111; //0000 - 00L00PLP
       };
       if ((read_adc(0)>hrana)*(read_adc(1)<hrana)*(read_adc(2)<hrana)*(read_adc(3)<hrana)){
       PORTD=0b01101011; //1000 – OPL000LP
       };
       if ((read_adc(0)<hrana)*(read_adc(1)<hrana)*(read_adc(2)<hrana)*(read_adc(3)>hrana)){
       PORTD=0b01101011; //0001 – 0PL000LP
       }; 
       if ((read_adc(0)<hrana)*(read_adc(1)>hrana)*(read_adc(2)<hrana)*(read_adc(3)<hrana)){
       PORTD=0b01011011; //0100 – 0P0L00LP
       }
       if ((read_adc(0)<hrana)*(read_adc(1)<hrana)*(read_adc(2)>hrana)*(read_adc(3)<hrana)){ 
       PORTD=0b00100111; //0010 - 00L00PLP
       }; 
       if ((read_adc(0)<hrana)*(read_adc(1)<hrana)*(read_adc(2)>hrana)*(read_adc(3)<hrana)){
       PORTD=0b00100111; //0010 - 00L00PLP
       };
        if ((read_adc(0)>hrana)*(read_adc(1)>hrana)*(read_adc(2)>hrana)*(read_adc(3)> hrana)){
         if (por0){
            PORTD=0b01011011; //1111 – 0P0L00LP
            delay_ms(100);
            PORTD=0b01101011; //1111 – 0PL000LP
            delay_ms(2000);
            por0=0;}else{       
           PORTD=0b00100111; //1111 – 00L00PLP
            delay_ms(200);
             por0=1;
             };
           };
        if ((read_adc(0)<hrana)*(read_adc(1)>hrana)*(read_adc(2)>hrana)*(read_adc(3)<hrana)){
       PORTD=0b01100011; //0110 – 0PL000LP
       };
       if ((read_adc(0)>hrana)*(read_adc(1)>hrana)*(read_adc(2)<hrana)*(read_adc(3)<hrana)){
       PORTD=0b01010001; //1100 – 0P0L000P
       };
       if ((read_adc(0)<hrana)*(read_adc(1)<hrana)*(read_adc(2)>hrana)*(read_adc(3)>hrana)){
       PORTD=0b00100110; //0011 – 00L00PLP
       };
       if ((read_adc(0)<hrana)*(read_adc(1)>hrana)*(read_adc(2)>hrana)*(read_adc(3)>hrana)){
       PORTD=0b00100110; //0111 – 00L00PL0
       };
       if ((read_adc(0)>hrana)*(read_adc(1)>hrana)*(read_adc(2)>hrana)*(read_adc(3)<hrana)){
       PORTD=0b00100101; //1110 – 00L00P0P
       };       
 }


www:

Mobilni-robot-vznika-na-VSPJ.jpg Projekt "Mobilní robot" vzniká na VŠPJ

Mobilni-robot-07.jpg Výkonový IO L298N

D10 HW 034.jpg Podvozek MOB-03

Osobní nástroje
Jmenné prostory
Varianty
Akce
Rychlá navigace
NEJ aktivity
Nejlepší předměty
Nejlepší MCU
SW-HW
Ostatní
Utility
Nástroje
Tisk/export