Hoya Robot

download Hoya Robot

of 38

Transcript of Hoya Robot

  • 7/26/2019 Hoya Robot

    1/38

    http://www.hoyarobot.com

    505-7 1201

    TEL)053-628-5441 FAX)053-628-5440

  • 7/26/2019 Hoya Robot

    2/38

    http://www.hoyarobot.com

    2

  • 7/26/2019 Hoya Robot

    3/38

    http://www.hoyarobot.com

    1. Robot : 1EA

    2. (Li-Polymer) : 1EA

    3. USBISP : 1EA

    4. : 1EA

    5. CD : 1EA >

    > USBISP> >

    1.

    3

  • 7/26/2019 Hoya Robot

    4/38

    http://www.hoyarobot.com1. -1

    Laser

    IR

    IR

    4

  • 7/26/2019 Hoya Robot

    5/38

    http://www.hoyarobot.com1. -2

    LCD

    On/Off

    ATmega128

    5

  • 7/26/2019 Hoya Robot

    6/38

    http://www.hoyarobot.com2.

    6

  • 7/26/2019 Hoya Robot

    7/38

    http://www.hoyarobot.com

    Main Board MCU : ATmega128 8bit processor, /

    Motor : BLDC , , MCU INT, PWM, GPIO (2EA)

    Servo , MCU TIMER (1EA)

    Sensor : IR / (6EA)

    IR 3, 2 (5EA)

    Laser , (1EA)

    : LED, Start , On/OFF

    2.

    LCD : Character-LCD 162 (1EA)

    : Li-Po (1EA)

    7

  • 7/26/2019 Hoya Robot

    8/38

    http://www.hoyarobot.com3.

    , , , , ,

    , LCD , , LCD

    .

    , , ,

    , , ,

    BLDC

    BLDC

    , LCD

    LCD Display

    , LCD

    LCD Display

    & &

    8

  • 7/26/2019 Hoya Robot

    9/38

    http://www.hoyarobot.com3.

    , , , IR

    1)

    IR :

    IR :

    :

    9

  • 7/26/2019 Hoya Robot

    10/38

    http://www.hoyarobot.com3.

    2) IR

    IR : , 5

    : ,

    .

    < IR (:, :)>

    10

    < IR >

  • 7/26/2019 Hoya Robot

    11/38

    http://www.hoyarobot.com3.

    2 BLDC motor

    , , .

    1) Wheel motor BLDC motor

    : BLDC ,

    direction CW/CCW , PWM

    .

    1 GND

    2 12v

    3 1 6, 1 360 ( 1:60)4 PWM(Pulse Width Modulation)

    5 - 0 : CW() 1 : CCW( )

    11

    [Wheel motor I/O ]

  • 7/26/2019 Hoya Robot

    12/38

    http://www.hoyarobot.com3.

    2) Servo m otor

    : PWM RC .

    PWM 20ms , 0.9ms~2.1ms ,

    1.5ms . Laser .

    1 GND

    2 5v

    3 PWM 0.9ms~2.1ms, 1.5ms as center

    12

    [Servo motor I/O ]

    LDC

  • 7/26/2019 Hoya Robot

    13/38

    http://www.hoyarobot.com3.

    13

    ,

    .

    1) ATmega128

    : ATmega128 MCU , AVRISP

    downloader AVR Studio .

    ADC, Timer/Counter, Interrupt, GPIO, UART .

    ATmega128

    Reset

  • 7/26/2019 Hoya Robot

    14/38

    http://www.hoyarobot.com3.

    MCU CU

    14

    GPIO Signal Name Description Direction Note

    PA0 Sensor0 IR Sensor 0 IN LOW :

    PA1 Sensor1 IR Sensor 1 IN LOW :

    PA2 Sensor2 IR Sensor 2 IN LOW :

    PA3 Sensor3 IR Sensor 3 IN LOW :

    PA4 Sensor4 IR Sensor 4 IN LOW :

    PA5 Sensor5 IR Sensor 5 IN LOW : PA6 Reserved GPIO I/O Reserved

    PA7 CPU_STATUS ATmega128 OUT Low : D1(RED) ON

    PB0 Start_SW IN LOW ACTIVE

    PB1 Reserved GPIO I/O Reserved

    PB2 74HC574_CLK D-F/F CLK OUT LOW to HIGH: active

    PB3 Laser_Signal OUT HIGH : ON

    PB4 EL-7L_PWM OUT HIGH : LED ON

    PB5 L_PWM OUT PWM , OC1A

    PB6 R_PWM OUT PWM , OC1B

    PB7 Servo OUT PWM , OC2

  • 7/26/2019 Hoya Robot

    15/38

    http://www.hoyarobot.com3.

    15

    GPIO Signal Name Description Direction Note

    PC0 LCD_DB0 Character LCD DATA 0 OUT

    LCD data line

    PC1 LCD_DB1 Character LCD DATA 1 OUT

    PC2 LCD_DB2 Character LCD DATA 2 OUT

    PC3 LCD_DB3 Character LCD DATA 3 OUT

    PC4 LCD_DB4 Character LCD DATA 4 OUT

    PC5 LCD_DB5 Character LCD DATA 5 OUT

    PC6 LCD_DB6 Character LCD DATA 6 OUT

    PC7 LCD_DB7 Character LCD DATA 7 OUT

    PD0 L_CW/CCW OUT 0 : CW, 1 : CCW

    PD1 R_CW/CCW OUT 0 : CW, 1 : CCW

    PD2 RXD1 USART1 IN DEBUG, RX

    PD3 TXD1 USART1 OUT DEBUG, TX

    PD4 Reserved GPIO I/O Reserved

    PD5 LCD_RS C-LCD Register Select OUTH : Data RegisterL : Instruction Register

    PD6 LCD_RW C-LCD Read & Write OUTH : ReadL : Write

    PD7 LCD_E C-LCD Enable OUT LOW to HIGH : enablePE0 Reserved GPIO I/O Reserved

    PE1 Reserved GPIO I/O Reserved

    PE2 Reserved GPIO I/O Reserved

  • 7/26/2019 Hoya Robot

    16/38

    http://www.hoyarobot.com3.

    16

    GPIO Signal Name Description Direction Note

    PE3 Reserved GPIO I/O Reserved

    PE4 L_Encoder IN External INT4

    PE5 R_Encoder IN External INT5

    PE6 Reserved GPIO I/O Reserved

    PE7 Reserved GPIO I/O Reserved

    PF0 Front_IR IR IN LOW

    PF1 Rear-L_IR IR IN LOW

    PF2 Rear-R_IR IR IN LOW

    PF3 Left_IR IR IN LOW

    PF4 Right_IR IR IN LOW

    PF5 Tilt_X ADC5 I/O Not use

    PF6 Tilt_Y ADC6 I/O Not use

    PF7 SENSOR ADC7 I/O Not use

    PG0 Reserved GPIO I/O Reserved

    PG1 Reserved GPIO I/O Reserved

    PG2 Reserved GPIO I/O Reserved

    PG3 Reserved GPIO I/O Reserved

    PG4 Reserved GPIO I/O Reserved

  • 7/26/2019 Hoya Robot

    17/38

    http://www.hoyarobot.com3.

    17

    C-LCD, LED, DEBUG UART , .

    1) C-LCD

    : MCU C-LCD ASCII .

    .

    2) DEBUG UART

    : COM PORT .

    DEBUG UART

    C-LCD

  • 7/26/2019 Hoya Robot

    18/38

    http://www.hoyarobot.com4.

    18

    (Line : ) + (Tracer : )

    ,

  • 7/26/2019 Hoya Robot

    19/38

    http://www.hoyarobot.com4.

    19

    1

    2

    - 0x01h (0000 0001b)

    3

    ,

    1

    - 0x03h (0000 0011b)

    2, 3

    ,

    3 , , HIGH , LOW .

  • 7/26/2019 Hoya Robot

    20/38

    http://www.hoyarobot.com4.

    20

    3

    4

    - 0x04h (0000 0100b)

    1

    ,

    3

    - 0x06h (0000 0110b)

    1, 2

    ,

    3 , , HIGH , LOW .

  • 7/26/2019 Hoya Robot

    21/38

    http://www.hoyarobot.com4.

    21

    5

    6

    2

    - 0x05h (0000 0101b)

    1, 3

    ,

    - 0x07h (0000 0111b)

    1, 2, 3

    .

    3 , , HIGH , LOW .

  • 7/26/2019 Hoya Robot

    22/38

    http://www.hoyarobot.com5.

    22

    Windows PC Atmel AVR Studio 4 , , AVRISP

    downloader .

    1)

    ATmega128

    AVR gcc compiler WinAVR

    2)

    WinAVR - http://winavr.sourceforge.net/download.html- .

    AVR Studio - http://www.atmel.com/dyn/products/tools_card.asp?tool_id=2725

    - AVR Studio 4 .

    AVRISP driver - http://www.ftdichip.com/Drivers/VCP.htm

    - AVRISP downloader .

    .

    AVR Studio 4

    AVRISP Downloader

  • 7/26/2019 Hoya Robot

    23/38

    http://www.hoyarobot.com5.

    23

    3) (competitional_purpose_robot_av4) .

    .

    4) .

    5) void application_main(void) .

    - .

  • 7/26/2019 Hoya Robot

    24/38

    http://www.hoyarobot.com5.

    24

    AVR Studio VR Studio

    hex

    Program !!

  • 7/26/2019 Hoya Robot

    25/38

    http://www.hoyarobot.com5.

    25

    AVR Studio VR Studio

    ATmega128

    .

    CKOPT .

    BOOTSZ .

    (Boot Flash size=4096 words start address=$F000)

    BODLEVEL .

    (Brown-out detection level at VCC=2.7V)

    SUT_CKSEL .

    (Ext. Crystal/resonator High Freg.; Start-up time:16K CK *64)

    ,

    JTAGEN IR .

  • 7/26/2019 Hoya Robot

    26/38

    http://www.hoyarobot.com6.

    26

    Header file

    Source file

    applications.h applications.c

    common.h

    EXT_components.h ,

    mcu.h MCU ,

    port_io.h Port register

    applications.c application

    EXT_components.c

    HOYAROBOT.c main

    isr.c Interrupt service routines

    mcu.c MCU

  • 7/26/2019 Hoya Robot

    27/38

    http://www.hoyarobot.com6.

    27

    void application_main(void)

    main

    -

    return Reset (soft reset)

    void timer_100msec_callback( void) 100msec

    - ex> 1 LED

    .

    - static . . ( )

    - ex> LCD , DEBUG UART .

  • 7/26/2019 Hoya Robot

    28/38

    http://www.hoyarobot.com6.

    28

    EXT Components

    void EXT_component_init(void)

    , , ,

    BLDC motor :

    void EXT_set_wheel_dir(INT8U direction)

    - direction :

    MOT_FORWARD, MOT_BACKWARD, MOT_LEFT_TURN, MOT_RIGHT_TURN define

    LEFT, RIGHT TURN ,

    , .

    .

  • 7/26/2019 Hoya Robot

    29/38

    http://www.hoyarobot.com6.

    29

    BLDC motor :

    void EXT_set_wheel_speed(INT8U lw_speed, INT8U rw_speed)

    .

    - lw_speed :

    - rw_speed :

    0~255 , 0 , 255

    (, )

    void EXT_wheel_smooth_stop(void)

    -

    - return

  • 7/26/2019 Hoya Robot

    30/38

    http://www.hoyarobot.com6.

    30

    Servo motor :

    void EXT_set_tailmotor( INT8U value)

    - value : 16 ~ 22 16 22

    define TAIL_CENTER .

    -

    TAIL_CENTER 17 ,

    EXT_components.h #define TAIL_CENTER 3 .

    INT8U EXT_get_tailmotor(void)

    - return :

  • 7/26/2019 Hoya Robot

    31/38

    http://www.hoyarobot.com6.

    31

    C-LCD

    void EXT_lcd_str(char *str)

    LCD

    - str :

    > EXT_lcd_str(TEST); - TEST

    2> EXT_lcd_str(TEST\nTEST2); - TEST, TEST2

    void EXT_lcd_data(char data)

    LCD - data :

    void EXT_lcd_clear(void)

    LCD

    void EXT_lcd_gotoxy(unsigned char x, unsigned char y)

    LCD - x : x - y : y

    void EXT_lcd_right_shift(void)

    LCD void EXT_lcd_left_shift(void)

    LCD

    6

  • 7/26/2019 Hoya Robot

    32/38

    http://www.hoyarobot.com6.

    32

    IR sensor

    float EXT_get_ir_distance(INT8U Index)

    IR

    - index : IR

    IR_FRONT, IR_REAR_L, IR_REAR_R, IR_LEFT, IR_RIGHT define

    - return : (80m )

    Line tracer sensor

    INT8 SENSOR_DATA(void)

    - return : 0, 1

    6 , 0011 1111

    , 0001 1111 1 .

    6

  • 7/26/2019 Hoya Robot

    33/38

    http://www.hoyarobot.com6.

    33

    Start button

    void EXT_wait_key(INT8U display)

    - display : TRUE LCD "PUSH THE BUTTON" . FALSE

    - ( )

    Laser pointer

    void LASER_POINTER(INT8U stat)

    on, off

    - stat : define ON, OFF

    void EXT_laser_delayed_off(INT16U msec)

    on off

    - msec : msec

    6

  • 7/26/2019 Hoya Robot

    34/38

    http://www.hoyarobot.com6.

    34

    DEBUG UART

    char mcu_getchar1(void)

    UART

    - return : ASCII

    char mcu_putchar1(char c)

    UART

    - c : ASCII

    char mcu_putstring1(char *s)

    UART

    - s :

    6

  • 7/26/2019 Hoya Robot

    35/38

    http://www.hoyarobot.com6.

    35

    void EXT_set_wheel_dir( INT8U direction)

    MOT_FORWARD, MOT_BACKWARD, MOT_LEFT_TURN, MOT_RIGHT_TURN

    . void EXT_set_wheel_speed(INT8U lw_speed, INT8U rw_speed)

    0 : , 255 :

    void EXT_wheel_smooth_stop(void)

    void EXT_set_tailmotor( INT8U value)

    16~22 , TAIL_CENTER : 17(3 )

    LCD / void EXT_lcd_str(char *str) / void EXT_lcd_clear(void)

    IR float EXT_get_ir_distance( INT8U Index)

    IR_FRONT, IR_LEFT, IR_RIGHT, IR_REAR_L, IR_REAR_R

    INT8 SENSOR_DATA(void)

    . void EXT_wait_key(INT8U display)

    TURE : PUSH THE BUTTON FALSE : LCD

    on off void EXT_laser_delayed_off(INT16U msec)

    ... ...

    6

  • 7/26/2019 Hoya Robot

    36/38

    http://www.hoyarobot.com6.

    36

    1. .

    2. LCD .

    3. PUSH Button .

    4. IR

    (LCD IR )

    5. PUSH Button .

    6. .

    ( )

    7. IR .

  • 7/26/2019 Hoya Robot

    37/38

    http://www.hoyarobot.com

    37

    1. . (OFF)

    2. .

    3.

    .

    (

    !!)

    AVR Studio Program

    MCU .

  • 7/26/2019 Hoya Robot

    38/38

    http://www.hoyarobot.com

    505-7 1201

    TEL)053-628-5441 FAX)053-628-5440

    http://www.hoyarobot.com