You are on page 1of 18

RUPP TEED

Second Step onto a


Robotics Engineer
Lecturer: Dr. Kwanghoon Kim
Course Layout
• Problem sets
- Once per a week
- Submit Word or PDF, include code and figures
- Some questions optional, but highly recommended.
• Requirements for passing
- Attend over 4/5 lectures
- Complete all homework and a term project
• After finishing this course, you can get
- The certificate of this course
- The chance to go up to the next course
Strategy to get the goal on each step
• Second Step
Comprehension of
Hardware Control(1)
Structure(1)
- Coding Skill - Concepts of Basic
- Device Control Mechanics(Statics)
- Motor Control - Force, Reaction, Supports
- Basic Structure of Trusses

Task Task
1. Build up a 4-wheal vehicle
Build up a truss structure
- 4 modes: go, back, turn left and right
- a Bridge, a Vehicle Frame, a quadruped
2. Build up a quadruped machine
machine
- 5 modes: 4 modes upper + rotation
Hardware Control(1)
Outline
• Device Control (1,2)
• Driving Vehicle (1,2)
• Moving Machine (1,2)
• Motion of Vehicle and Machine by NFC (1,2)
• Simple Simulator (1,2,3)
• Motion of Human Walking (1,2)
• Using ADAMS(Analyzing Tool of Dynamics) (1,2,3)
Functions: I/O
• Digital I/O
digitalRead() / digitalWrite() / pinMode() 

• Analog I/O
analogRead() / analogReference() /analogWrite() 

 https://www.arduino.cc/reference/en/
Digital I/O
EXAMPLE
- Sets pin 13 to the same value as pin 7, declared as an
• digitalRead() input
-Syntax
• digitalRead(pin)
• pin - the pin number for digital signal
• Returns: HIGH / LOW int ledPin = 13; // LED connected to digital pin 13
int inPin = 7; // pushbutton connected to digital pin 7
int val = 0; // variable to store the read value
• digitalWrite()
-Syntax void setup() {
pinMode(ledPin, OUTPUT); // sets the digital pin 13 as output
• digitalWrite(pin,value) :
pinMode(inPin, INPUT); // sets the digital pin 7 as input
• pin - the pin number for digital signal
}
• value – HIGH / LOW

• pinMode() void loop() {


val = digitalRead(inPin); // read the input pin
-Syntax digitalWrite(ledPin, val); // sets the LED to the button's value
• pinMode(pin,mode) : }
• Pin – the pin number for digital signal
• Mode –INPUT / OUTPUT / INPUT_PULLUP
Analog I/O
EXAMPLE
- The code reads the voltage on analogPin and displays it
• analogRead()
-Syntax
• analogRead(pin)
• Pin – the pin number for analog signal
• Returns: 0~1023(10bits) / 0~4095(12bits) int analogPin = A3; // potentiometer wiper (middle terminal)
//connected to analog pin 3
// outside leads to ground and +5V
int val = 0; // variable to store the value read

void setup() {
Serial.begin(9600); // setup serial
}

void loop() {
val = analogRead(analogPin); // read the input pin
Serial.println(val); // debug value
}
Analog I/O PWM(Pulse Width Modulation)
- Description method of an analog value

• analogWrite()
-Syntax
• analogWrite(pin,value)
• Pin – the pin number for analog signal
• Value – 0~255

- Width of each interval: about 2 ms


Task 1
• Control three LEDs by using a push button
- input: 1 pins for a push button
- output: 3 pins for three LEDs
• Conditions
- push on – Blink the green and red LEDs by turns
- push off – Light on the yellow LED
Coding and Making
Task 2
• Control brightness of a LED by using a variable
resistance
- input: 1 pin for a variable resistance
- output: 1 pin for three LED
Coding and Making

PWM  map()
Task 3
• Control RGB LED by using three photo sensors
- input: 3 pin for photo sensors (analog)
- output: 3 pin for three LED (digital by PWM)
• Conditions
- Read the values coming through photo sensors
- Light on RGN LED following the signal values
Coding and Making
Recommendations
• Get your own devices
- Vehicle: Arduino Uno/Mega, 2 DC motors, 1 DC Motor Driv
er, 1 Servo motors, wifi module/Bluetooth module, External P
ower Kit
- Quadruped machine: Arduino Uno/Mega, 8 Servo motors, w
ifi module/Bluetooth module, External Power Kit
• For the next lecture
- Research about how to use DC motor and Servo motor
- Make a strategy for each moving mode
DC Motor driver

M Rotating speed
ot
or

Rotating
direction
M
ot
or

+Arduino Power (+5V)

GND
+ External Power

You might also like