soirée pratique build your own robot
TRANSCRIPT
Soirée PratiqueBuild your own robot
Motor control
Download: http://www.ieee-sb-leuven.be/soireepratique2014
11/1/14
Nick Vanthienen
Sumo Robots:Roadmap 2014-2015
1) Brains: Arduino2) Muscles: motor and power (03/11)3) Eyes: sensors (24/11)
4) More brains: programming (2nd sem)5) Training session (2nd sem)6) Sumo Competition Leuven (2nd sem)
If you dare: WELEK Competition in Gent (30/04/2015)
11/1/142
Information
● https://www.facebook.com/groups/1713711248854304/
● http://www.ieee-sb-leuven.be/soireepratique2014
● Motors:
– http://powerfunctions.lego.com/en-us/ElementSpecs/8882.aspx
– http://www.philohome.com/pf/pf.htm
● Motor Controller:
– http://www.pololu.com/product/2511
The game
Dohyō (Dohyō (土俵土俵 ))
Some examples
Some examples
Some Examples
Competition Rules
Detailed 2013 rules can be found on http://www.ieee-sb-leuven.be/soireepratique2014
Rules will be approximately the same this year, however:
24x24cm dimensions instead of 25x25cm, to comply with new rules of Ghent.
11/1/148
Competition rules: most important robot specifications● Autonomous = no human commands● Harmless to other robots / humans / Doyho● Dimension limits: w x l= 24cm x 24 cm →only
at the start of the round● Unlimited height● Max. 1500g
Ask us first before you try something special :-)
Today
MotorsMotor Control
Power
Motors: Lego XL Motor
11/1/1411
We use the 2 middle wires of the 4 wire lego cables+9V = forward-9V = backwardPWM = control speed
Unused
Unused
Used
Motors: Lego XL Motor
11/1/1412
cut off the lego motor connector- or -
cut optional extension cable in half
H-Bridge
The motor controller: TI DRV8835 Chip
Dual-H-bridge motor driverMotor supply voltage: 2–11 VLogic supply voltage: 2–7 VOutput current: 1.2 A continuous (1.5 A peak) per motorTwo possible interface modes: IN/IN (outputs mostly mirror inputs) or PHASE/ENABLE (one pin for direction and another for speed)
11/1/1414
Motor controller 2013
11/1/1415
Arduino
BatteriesArduino
MM
M
+9v GND (-)
Motor Controller 2014
B
A
Option to power arduino from motor controller Remove blue jumper when USB connected!
9 Motor A Enable
7 Motor A Phase8 Motor B Phase
10 Motor B Enable
Batteries
Arduino + 5V and GND(Logic Power)
Motor Control 2014
● Motor A Phase (pin 7), Motor B Phase (pin 8)
– HIGH: Forward
– LOW: Backward● Motor A Enable (pin 9), Motor B enable (pin 10)
– HIGH: On, 9V
– LOW: Off, 0 V
– PWM: switch on/off rapidly, 0-9V, control speed
Motor Controller
● Soldering● Ask help when it's your first time● Don't toast your controller :-)
Motor Controller: soldering
Motor Controller: soldering
Example code: setup
int enablePinA = 9; // enable of motor A connected to digital PWM pin 9int phasePinA = 7; // phase of motor A connected to digital PWM pin 7int enablePinB = 10; // enable of motor B connected to digital PWM pin 10int phasePinB = 8; // phase of motor B connected to digital PWM pin 8
void setup() { pinMode(phasePinA, OUTPUT); pinMode(phasePinB, OUTPUT);}
11/1/1421
Example code: loopint turn_direction = HIGH;
void loop() {
digitalWrite(phasePinA, turn_direction); // set turn direction digitalWrite(phasePinB, !turn_direction);
// turn faster from min to max speed in increments of 5 points: for(int fadeValue = 0 ; fadeValue <= 255; fadeValue +=5) { analogWrite(enablePinA, fadeValue); // sets PWM value (range from 0 to 255) analogWrite(enablePinB, fadeValue); delay(30); // wait for 30 milliseconds to see the effect } // turn slower from max to min speed in increments of 5 points: for(int fadeValue = 255 ; fadeValue >= 0; fadeValue -=5) { analogWrite(enablePinA, fadeValue); // sets the value (range from 0 to 255) analogWrite(enablePinB, fadeValue); delay(30); // wait for 30 milliseconds to see the effect }
// switch turn direction turn_direction = !turn_direction;}
11/1/1422
Three ways to power your Arduino
USB5VMax 500 mA
Power Jack7-12VMax 1A
Between Vin and Gnd7-12V
Three ways to power your Arduino
USB power disabled when Vin > 6.6V
Compare Vin/2 with 3.3VVoltage RegulatorIn: 7-12V Out: 5V
Power Jack
Vin Pin
Power Arduino + Motor
● It is not possible to power the motors through the arduino!
● Therefore, the motor controller has a separate power supply
● It is possible to power the arduino through the motor controller: by adding the blue jumper
Power Arduino + Motor
Blue Jumper (removable)
MM
M
+9v GND (-)
Motor Controller 2014
B
A
Option to power arduino from motor controller Remove blue jumper when USB connected!
9 Motor A Enable
7 Motor A Phase8 Motor B Phase
10 Motor B Enable
Batteries
Arduino + 5V and GND(Logic Power)
Power Arduino + Motor
● Always OK: no blue jumper, USB connected
● Always OK: blue jumper, USB not connected
● OK: blue jumper, USB connected, batteries connected and > 6.6V
● NOT OK: blue jumper, USB connected, batteries connected and < 6.6V
– (the motors are powered through usb, and through the voltage regulator in reverse direction = fail!)
USB and low or no battery power, but motor shield connected to Vin (blue jumper)
USB power enabled when Vin < 6.6V
Compare Vin/2 with 3.3V Voltage RegulatorReverse FlowNot Allowed!
Vin PinTo motor controller
Batteries
Next session (24/11)Sensors
Bring sensors or order them with us
See you all next session!
11/1/1431