Written by ZEDO 2016 1 1. Zumo with Shield(1/2) Pololu(https://www.pololu.com) 사용자가 다양하게 변경할 수 있는 zumo tank kit 을 제공함https://www.pololu.com 1. Zumo Robot.

Slides:



Advertisements
Similar presentations
Lecture 1 – Arduino Basics
Advertisements

Lab7: Introduction to Arduino
Mini-SumoBot Construction and Programming
Embedded Sumo 1T4 – 1T5 UTRA.
Re-programming the Simon Says with Arduino Linz Craig, Brian Huang.
Introduction to Arduino Programming January MER-421:Mechatronic System Design.
ELCT 201 week 13 Analog ON/OFF control system conversion to Digital ON/OFF control system.
Intro to Programming and Microcontrollers. Activity Group into pairs and sit back-to-back. Pick one person who is going to draw. The other person will.
Beginning Arduino Session 2 AN INTRODUCTION TO HACKING THE WORLD’S MOST POPULAR MICROCONTROLLER PLATFORM
Embedded Programming and Robotics Lesson 2 C Programming Refresher C Programming1.
Basic Circuits – Lab 2 Arduino and Sensors Xmedia Spring 2011.
Embedded Programming and Robotics
Parallax 4x20 LCD (part number 27979) with Arduino Duemilanove
ARDUINO PROGRAMMING Working with the Arduino microcontroller.
ARDUINO 1 Under Development. Arduino  Arduino is an open-source electronics prototyping platform based on flexible, easy-to-use hardware and software.
Arduino Part 2 Topics: Serial Communication Programming Constructs: functions, loops and conditionals Digital Input.
Lecture 9: Microcontrollers – part 1 BJ Furman 29OCT2012.
chipKit Sense Switch & Control LED
ARDUINO 1 Under Development. Arduino  Arduino is an open-source electronics prototyping platform based on flexible, easy-to-use hardware and software.
Microcontroller Hands-on Workshop #3 Ahmad Manshad New Mexico State University Institute of Electrical and Electronics Engineers November 7, 2009.
Project Futura.
ARDUINO 1 Under Development. Arduino  Arduino is an open-source electronics prototyping platform based on flexible, easy-to-use hardware and software.
Khaled A. Al-Utaibi  The Push Button  Interfacing Push Buttons to Arduino  Programming Digital Inputs  Working with “Bouncy”
Franz Duran INTRODUCTION TO A RDUINO PROGRAMMING & INTERFACING Engr. Franz Duran, MEP-ECE RapidSignal Electronics.
Tweaking Your Simon Adding a photoresistor and changing code Instruction by Pete Lewis and Linz Craig.
Sparkfun Electronics ATtiny85 Arduino Quick Reference Sheet
Good LED Circuit 5V0 GND. What Voltage Does Meter See? Answer: 5 V.
LECTURE 2 – INPUTS THIS LECTURE WILL INTRODUCE HOW TO INPUT SIGNALS INTO AN ARDUINO.
Youn-Hee Han, In-Seok Kang {yhhan, Laboratory of Intelligent Networks Advanced Technology Research Center Korea University of Technology.
ARDUINO 1. Basics  Comments  /* * Blink * * The basic Arduino example. Turns on an LED on for one second, * then off for one second, and so on... We.
Arduino Circuits and Code. int ledPin = 9; void setup() { pinMode(ledPin, OUTPUT); } void loop() { digitalWrite(ledPin, LOW); delay(1000); digitalWrite(ledPin,
(Icommand & Processing). NXT The NXT is the brain of a MINDSTORMS® robot. It's an intelligent, computer- controlled LEGO® brick that lets a MINDSTORMS.
Microcontrollers, Microcomputers, and Microprocessors
INTERNET OF EVERYTHING SDU 2016 Week 4. Simple Digital and Analog Inputs  The Arduino’s ability to sense digital and analog inputs allows it to respond.
Photoresistor resistance changes dramatically with light level living with the lab Using Photoresistors with an Arduino © 2011 LWTL faculty team.
Microcontroller basics Embedded systems for mortals.
Lecture 9: Introduction to Arduino Topics: Arduino Fundamentals, Bean Date: Mar 22, 2016.
Programming in Arduino Materials:Arduino Board Casperelectronics Pre Pres. Notes Photos from workshop?
Introduction to Arduino A very basic intro to Arduino, the IDE and the Servos class.
Arduino + Bluetooth TYWu. Connection Arduino + Bluetooth Module.
ARDUINO 실습 과제 보 고서. PWM 은 아날로그 출력이라는 함수를 사용하게 되는데 이 출력에는 3, 5, 6, 9, 10, 11 번의 핀만 사용 가능. ( 숫자 옆 에 ~ 표시 )
Istituto Tecnico Industriale A.Monaco EURLAB Moving a robot simple example program to control a DC-Motor Next - Press the button (left)
Pulse-Width Modulation: Simulating variable DC output
Session 6 John Wolf (WolfDenElectronics.com). Objectives – We’ll Learn  Code to Voice  PIR sensors – motion detection  Quadrature Encoders  Audio.
Written by ZEDO MiniQ - 개요 DFRobot( 에서 MiniQ 2WD 기반에 Romeo V2 All-in-one 컨트롤러 사용하여 사 용자가 다양한 컨스터마이징 작업을 수행할 수 있도록 제공함
Pulse Width Modulation Instructor Dr Matthew Khi Yi Kyaw.
Raspberry Internet Rover Dipto Pratyaksa
Introducing the Arduino Uno Presented by Dave Mawdsley, DACS Member, Linux SIG Member (wiring, programming and running a cute traffic light simulation)
Having fun with code, using Arduino in a middle school CS classroom
Embedded Systems Intro to the Arduino
Lab 7 Basic 1: Game of Memory
Application of Programming: Scratch & Arduino
Sparkfun Electronics ATtiny85 Arduino Quick Reference Sheet
Assist. Prof. Rassim Suliyev - SDU 2017
Microcontroller basics
Val Manes Department of Math & Computer Science
Microcontroller basics
Manual for Arduino Kit v1.0
Microcontroller basics
Get Your Project Started with Arduino
Lab 1: Arduino Basics Topics: Arduino Fundamentals, First Circuit
Arduino Part 1 Topics: Microcontrollers Programming Basics
INC 161 , CPE 100 Computer Programming
Roller Coaster Design Project
Servos and Stepper Motors
CS-4540 Robotics - Lab 05 Switch inputs to the Arduino Uno
Introducing the Arduino Uno
Programming 2: The Arduino IDE & First Sketches
Arduino Practice: Photoresistors, PWM, Potentiometers, Motors
Setting up a basic program with Arduino
Presentation transcript:

Written by ZEDO Zumo with Shield(1/2) Pololu( 사용자가 다양하게 변경할 수 있는 zumo tank kit 을 제공함 1. Zumo Robot Kit for Arduino (No Motors)2. Zumo Shield for Arduino 3. Basic Sumo Blade for Zumo Chassis 4. Two 75:1 HP micro metal gearmotors

Written by ZEDO Zumo with Shield(2/2) 최종 완성후 아두이노 연결한 모습

Written by ZEDO Shield(1/2) Buzzer 제어 단자 3 개 연결한다.(Default Off) UNO : 328P 방향 Leonardo : 32U4 방향 사용자 정의 LED DIO 13 번 사용 DIO 12 번 사용 D7 오른쪽 모터 방향 (HIGH, LOW) D9 오른쪽 모터 속도 (0~255) D8 왼쪽 모터 방향 (HIGH, LOW) D10 왼쪽 모터 속도 (0~255) Leonardo D2/D3(Compass/Gyro), D6(Buzzer), D7~10(Motor), D12(Button), D13(LED) 사용됨 Buzzer 의 경우 DIO 3(UNO), DIO 6(Leonardo) Compass/gyro I²C 센서에서 Default 로 On 되어 있으며 UNO 는 SCL(Clock) A5, SDA(Data) A4 Leonardo 의 경우 SCL D3, SDA D2 사용한다. Uno 에서 SCL, SDL 정상 동작하기 위하여 A5, A4 을 연결해야 한다.

Written by ZEDO Shield(2/2) Leonardo D2/D3(Compass/Gyro), D6(Buzzer), D7~10(Motor), D12(Button), D13(LED) 사용됨 PINZumo Shield functionUNOLeonardoNotes/alternate functions D0digital I/OO RX for programming and serial communication on Uno and ol der Arduinos D1digital I/OO TX for programming and serial communication on Uno and old er Arduinos D2digital I/O (front expansion) OI²C SDA on Leonardo and A-Star 32U4 Prime D3digital I/O O optional jumper to buzzer control line for Uno and older Arduin os I²C SCL on Leonardo and A-Star 32U4 Prime D4digital I/O (front expansion) 블루투스용으로 사용 예정 ( 죽어 있음 ) D5digital I/O (front expansion) 블루투스용으로 사용 예정 (RX) D6digital I/OOO optional jumper to buzzer control line for Leonardo and A-Star 32U4 Prime D7digital I/OOOright motor direction control line D8digital I/OOOleft motor direction control line D9digital I/OOOright motor PWM control line D10digital I/OOOleft motor PWM control line D11digital I/O (front expansion) Servo 모터 제어용으로 사용하려 했으나 블루투스 TX 로 전환 D12digital I/OOOuser pushbutton (pressing pulls low) D13digital I/OOOyellow user LED (high turns LED on) A0analog input and digital I/O (front expansion) A1analog input and digital I/O (front expansion) optional jumper to battery level voltage divider A2analog input and digital I/O (front expansion) A3analog input and digital I/O (front expansion) A4analog input and digital I/O (front expansion)O I²C SDA on Uno and older Arduinos A5analog input and digital I/O (front expansion)O I²C SCL on Uno and older Arduinos

Written by ZEDO Bluetooth (1/4) : zumo extension HC-06 Bluetooth 모듈을 작성하기 위하여 zumo 의 확장 패널을 사용하며 D11(TX), D5(RX) 사용한다. 블루투스 모듕 (HC-06) 연결을 위하여 4 개의 소켓 납땜을 해 둔다.(4 번 죽어 있음 ) UNO 에서 Compass/gyro I²C 의 SDA(Data) 를 A4 에 연결하기 위한 잭을 납땜한다. UNO 에서 Compass/gyro I²C 의 SCL(Clock) 를 A5 에 연결하기 위한 잭을 납땜한다. Leonardo 에서는 A4, A5 사용 가능함 확장을 고려해 D11 연결 가능하게 하여 블루투스 TX 에 사용 HC-06 블루투스 모듈

Written by ZEDO Bluetooth (2/4) : Bluetooth Adaptor Bluetooth Adaptor Mini 는 PC 나 노트북에서 Bluetooth 연결이 가능하게 한다. Bluetooth standard 2.0 * USB Interface: USB2.0 standard In the 2.4GHz to 2.483GHz frequency band operation between the use FHSS (Frequency Hopping Spread Spectrum) technology Open space under the operational range of about 10 meters Intuitive software user interface, without complicated settings For Windows 98SE/ME/2000/XP or Mac OS X or higher operating system Sensitivity <-85 dBM Data transfer rate up to 3M bps Features PC 에 아답터를 연결하면 Windows Update 에서 해당 드라이브를 설정함 Bluetooth Adaptor 설치 완료

Written by ZEDO Bluetooth (3/4) : Connection PC 에서 zumo Bluetooth 모듈과 연결시 기본 비밀번호는 “1234” 로 입력함 PC 의 Task Bar 에서 Bluetooth 아 이콘을 Click 함 zemo 의 Bluetooth 장치를 추가함 (HS-06) Paring Code 입력 을 선택함 4 Paring Code “1234” 입력함 5 장치관리자에서 COM10 포트 설정된 것을 확인 가 능함 HC-06

Written by ZEDO Bluetooth (4/4) : Connection Arduino 의 D11-TX, D5-RX 대응시켜 테스트를 수행하며, PC 와 USB 가 연결된 상태에서 가능하지만 두개가 동시에 연결될 수는 없다. #include int TxPin = 11; int RxPin = 5; int ledPin = 13; SoftwareSerial BTSerial(TxPin, RxPin); void setup() { BTSerial.begin(9600); Serial.begin(9600); //initial the Serial pinMode(ledPin,OUTPUT); } void loop() { if (BTSerial.available()) { char cmd = (char)BTSerial.read(); Serial.println("BTSerial ok"); if(cmd == '1') { digitalWrite(ledPin,HIGH); } else if(cmd == '0') { digitalWrite(ledPin,LOW); } CoolTerm 의 설정 1, 0 입력하여 LED 를 제어함

Written by ZEDO Code : zumo shield LED // zemo 는 13 번 DIO 핀을 사용자 LED 로 사용한다. int ledPin = 13; //10 번 지정 void setup() { pinMode(ledPin, OUTPUT);//LED 지정 Serial.begin(9600); //Set serial baud rate to 9600 } void loop() { digitalWrite(ledPin, HIGH); // 키기 delay(1000); //1 초 지연 digitalWrite(ledPin, LOW); // 끄기 delay(1000); // 1 초 지연 } Zumo Shield 의 사용자 LED 는 D5 입력단자를 이용하여 제어 가능함 노락색 LED 가 1 초 간격으로 켜지고 꺼진다.

Written by ZEDO Code : zumo shield User Button Zumo Shield 의 사용자 LED(D13) 를 사용자가 버튼 (D12) 을 누르면 켜지도록 하자 // zumo D13 사용자 LED 로 사용한다. // zumo D12 사용자 Button 으로 사용한다. int ledPin = 13; //13 번 지정 int buttonPin = 12; //12 번 지정 void setup() { pinMode(ledPin, OUTPUT);//LED 지정 pinMode(buttonPin, INPUT);//Button 지정 Serial.begin(9600); //Set serial baud rate to 9600 } void loop() { if (digitalRead(buttonPin) == LOW){ digitalWrite(ledPin, HIGH); // 키기 Serial.println("Button is pressed."); //delay(100); } else{ digitalWrite(ledPin, LOW); // 끄기 Serial.println("Button is off."); //delay(100); } 노락색 LED(D13) 가 1 초 간격으로 켜지고 꺼진다. Butto(D12)n 은 기본적으로 On(High) 상태이며 버튼을 누르면 Off(Low) 상태가 된다

Written by ZEDO Code : zumo Shield Moter Control(1/2) //Standard PWM DC control // zumo shield 1.2 int S1 = 9; //Speed Control( 오른쪽 ) int S2 = 10; //Speed Control( 왼쪽 ) int D1 = 7; //Direction Control( 오른쪽 ) int D2 = 8; //Direction Control( 왼쪽 ) void stop(void) //Stop { analogWrite(S1,0); digitalWrite(D1,LOW); analogWrite(S2,0); digitalWrite(D2,LOW); } void advance(char a,char b) //Move forward { analogWrite (S1,a); //PWM Speed Control digitalWrite(D1,HIGH); analogWrite (S2,b); digitalWrite(D2,HIGH); } Zumo Shield 의 PWM 직렬 모터 제어는 2 개의 디지털 IO 핀 (7, 8) 과 2 개의 PWM 핀 (9, 10) 으로 구성됨 Bluetooth 연결시, SoftwareSerial BTSerial(TxPin, RxPin) 을 통하여 동일한 제어 가능함 7 D7 오른쪽 모터 방향 (HIGH, LOW) D9 오른쪽 모터 속도 (0~255) D8 왼쪽 모터 방향 (HIGH, LOW) D10 왼쪽 모터 속도 (0~255) 오른쪽 왼쪽 PC 에서 USB 로 연결하여 테스트 수행하는 경우 zumo shield 의 전원이 On 된 상태에서 동작이 가능 When the Arduino is connected to a computer via USB, it will receive power (and supply 5V and 3.3V to the shield) even w hen the Zumo Shield’s power switch is off. This can be useful if you want to test your Arduino program without allowing the motors to run, since turning the power switch off disconnects motor power (VBAT).

Written by ZEDO Code : zumo Shield Moter Control(2/2) void back_off (char a,char b) //Move backward { analogWrite (S1,a); digitalWrite(D1,LOW); analogWrite (S2,b); digitalWrite(D2,LOW); } void turn_L (char a,char b) //Turn Left( 왼쪽으로 빙빙 돌기 ) { analogWrite (S1,a); digitalWrite(D1,HIGH); // 오른쪽 모터가 앞으로 돌기 analogWrite (S2,b); digitalWrite(D2,LOW); // 왼쪽 모터가 뒤로 돌기 } void turn_R (char a,char b) //Turn Right( 오른쪽으로 빙빙 돌기 ) { analogWrite (S1,a); digitalWrite(D1,LOW); // 오른쪽 모터가 뒤으로로 돌기 analogWrite (S2,b); digitalWrite(D2,HIGH); // 왼쪽 모터가 앞으로 돌기 } void setup(void) { int i; for(i=7;i<=10;i++) pinMode(i, OUTPUT); Serial.begin(9600); //Set Baud Rate Serial.println("Run keyboard control"); // 키보드로 제어하기 analogWrite(S1,LOW); analogWrite(S2,LOW); } Zumo Shield 의 PWM 직렬 모터 제어는 2 개의 디지털 IO 핀 (7, 8) 과 2 개의 PWM 핀 (9, 10) 으로 구성됨 void loop(void) { if(Serial.available()){ char val = Serial.read(); if(val != -1) { switch(val) { case 'w'://Move Forward Serial.println("Move Forward"); advance (255,255); //move forward in max speed break; case 's'://Move Backward Serial.println("Move Backward"); back_off (255,255); //move back in max speed break; case 'a'://Turn Left Serial.println("Turn Left"); turn_L (255,255); break; case 'd'://Turn Right Serial.println("Turn Right"); turn_R (255,255); break; case 'z': Serial.println("Hello"); break; case 'x': Serial.println("Stop"); stop(); break; } else stop(); }

Written by ZEDO Code : Pololu Zumo Shield Libraries(1/2) #include /* * This example uses the ZumoBuzzer library to play a series of notes on * the buzzer. It also uses Pushbutton library to allow the user to * stop/reset the melody with the user pushbutton. */ #define MELODY_LENGTH 95 // These arrays take up a total of 285 bytes of RAM (out of a limit of 1k (ATmega168), 2k (ATmega328), or 2.5k(ATmega32U4)) unsigned char note[MELODY_LENGTH] = { NOTE_E(5), SILENT_NOTE, NOTE_E(5), SILENT_NOTE, NOTE_E(5), SILENT_NOTE, NOTE_C(5), NOTE_E(5), NOTE_G(5), SILENT_NOTE, NOTE_G(4), SILENT_NOTE, NOTE_C(5), NOTE_G(4), SILENT_NOTE, NOTE_E(4), NOTE_A(4), NOTE_B(4), NOTE_B_FLAT(4), NOTE_A(4), NOTE_G(4), NOTE_E(5), NOTE_G(5), NOTE_A(5), NOTE_F(5), NOTE_G(5), SILENT_NOTE, NOTE_E(5), NOTE_C(5), NOTE_D(5), NOTE_B(4), NOTE_C(5), NOTE_G(4), SILENT_NOTE, NOTE_E(4), NOTE_A(4), NOTE_B(4), NOTE_B_FLAT(4), NOTE_A(4), NOTE_G(4), NOTE_E(5), NOTE_G(5), NOTE_A(5), NOTE_F(5), NOTE_G(5), SILENT_NOTE, NOTE_E(5), NOTE_C(5), NOTE_D(5), NOTE_B(4), SILENT_NOTE, NOTE_G(5), NOTE_F_SHARP(5), NOTE_F(5), NOTE_D_SHARP(5), NOTE_E(5), SILENT_NOTE, NOTE_G_SHARP(4), NOTE_A(4), NOTE_C(5), SILENT_NOTE, NOTE_A(4), NOTE_C(5), NOTE_D(5), SILENT_NOTE, NOTE_G(5), NOTE_F_SHARP(5), NOTE_F(5), NOTE_D_SHARP(5), NOTE_E(5), SILENT_NOTE, NOTE_C(6), SILENT_NOTE, NOTE_C(6), SILENT_NOTE, NOTE_C(6), SILENT_NOTE, NOTE_G(5), NOTE_F_SHARP(5), NOTE_F(5), NOTE_D_SHARP(5), NOTE_E(5), SILENT_NOTE, NOTE_G_SHARP(4), NOTE_A(4), NOTE_C(5), SILENT_NOTE, NOTE_A(4), NOTE_C(5), NOTE_D(5), SILENT_NOTE, NOTE_E_FLAT(5), SILENT_NOTE, NOTE_D(5), NOTE_C(5) }; Pololu 사에서 제공하는 Zumo Shield Libraries 을 Arduino 라이브러리 디렉토리에 설치한다. zumo( libraries(C:\Arduino\libraries) Zumo 가 노래를 부르게 하자 (C:\Arduino\libraries\ZumoBuzzer\examples\ZumoBuzzerExample)

Written by ZEDO Code : Pololu Zumo Shield Libraries(2/2) unsigned int duration[MELODY_LENGTH] = { 100, 25, 125, 125, 125, 125, 125, 250, 250, 250, 250, 250, 375, 125, 250, 375, 250, 250, 125, 250, 167, 167, 167, 250, 125, 125, 125, 250, 125, 125, 375, 375, 125, 250, 375, 250, 250, 125, 250, 167, 167, 167, 250, 125, 125, 125, 250, 125, 125, 375, 250, 125, 125, 125, 250, 125, 125, 125, 125, 125, 125, 125, 125, 125, 250, 125, 125, 125, 250, 125, 125, 200, 50, 100, 25, 500, 250, 125, 125, 125, 250, 125, 125, 125, 125, 125, 125, 125, 125, 125, 250, 250, 125, 375, 500 }; ZumoBuzzer buzzer; Pushbutton button(ZUMO_BUTTON); unsigned char currentIdx; void setup() // run once, when the sketch starts { currentIdx = 0; } void loop() // run over and over again { // if we haven't finished playing the song and // the buzzer is ready for the next note, play the next note if (currentIdx < MELODY_LENGTH && !buzzer.isPlaying()) { // play note at max volume buzzer.playNote(note[currentIdx], duration[currentIdx], 15); currentIdx++; } // Insert some other useful code here... // the melody will play normally while the rest of your code executes // as long as it executes quickly enough to keep from inserting delays // between the notes. // For example, let the user pushbutton function as a stop/reset melody button if (button.isPressed()) { buzzer.stopPlaying(); // silence the buzzer if (currentIdx < MELODY_LENGTH) currentIdx = MELODY_LENGTH; // terminate the melody else currentIdx = 0; // restart the melody button.waitForRelease(); // wait here for the button to be released }