PHY 235 Robotics Workshop Day 6 DC Motors, H-Bridge Board, Simple Lego/Boe Bot.

18
PHY 235 Robotics Workshop Day 6 DC Motors, H-Bridge Board, Simple Lego/Boe Bot

Transcript of PHY 235 Robotics Workshop Day 6 DC Motors, H-Bridge Board, Simple Lego/Boe Bot.

Page 1: PHY 235 Robotics Workshop Day 6 DC Motors, H-Bridge Board, Simple Lego/Boe Bot.

PHY 235 Robotics Workshop

Day 6

DC Motors, H-Bridge Board, Simple Lego/Boe Bot

Page 2: PHY 235 Robotics Workshop Day 6 DC Motors, H-Bridge Board, Simple Lego/Boe Bot.

Robotics Motors - Servos

• So far we have used servos to propel our robots. • Advantages:

• High torque• Feedback and gearing built in• Direction and speed controlled by simple pulse command.

• Disadvantages:• Limited speed• Not easily integrated with Lego structures

Page 3: PHY 235 Robotics Workshop Day 6 DC Motors, H-Bridge Board, Simple Lego/Boe Bot.

Robotics Motors – Simple DC

• So far we have used servos to propel our robots. • Advantages:

• Simple to use – two wires• There is a Lego DC motor • Direction and speed directly related to voltage

• Disadvantages:• Requires gearing and feedback• Not as easy to precisely control speed, as compared to servos

Page 4: PHY 235 Robotics Workshop Day 6 DC Motors, H-Bridge Board, Simple Lego/Boe Bot.

DC Motors

When the coil is powered, a magnetic field is generated causing the coil to be pushed away from the left magnet and drawn towards the right. The charge is reversed when the coil becomes horizontally aligned and the process continues with the coil spinning.

Brushes

Page 5: PHY 235 Robotics Workshop Day 6 DC Motors, H-Bridge Board, Simple Lego/Boe Bot.

DC Motor: Brush Motors

Brushes

Stator (permanent magnets)

DC Motors

Page 6: PHY 235 Robotics Workshop Day 6 DC Motors, H-Bridge Board, Simple Lego/Boe Bot.

DC Motors - Demo

• The instructor will demo a “dissected” DC motor and also show how the motor is powered by a simple DC voltage source.

• Note that the motor reverses direction when the polarity of the voltage source is changed.

Page 7: PHY 235 Robotics Workshop Day 6 DC Motors, H-Bridge Board, Simple Lego/Boe Bot.

DC Motors and ZX-24a Control

• We will be using a Lego DC motor to control the Lego Robot we will build for the RoboPong contest.

• To control this DC motor, we need a way of controlling the power to the motor by using the ZX-24a I/O pins (output = 0 or 1 (0V-5V)).

• One idea: Just send a 1 (=5 volts) value on an I\O pin connected to the motor.• Problem: DC motors consume a lot of current

(~amps) – the I\O pins can output only a small amount of current (~millamps)

Page 8: PHY 235 Robotics Workshop Day 6 DC Motors, H-Bridge Board, Simple Lego/Boe Bot.

H-Bridge

• Solution: Use an H-Bridge control circuit. In its simplest form, this circuit can be

built with 4 switches, as shown: • SW1 and SW4 on will cause the motor to turn one direction• SW2 and SW3 on will cause the motor to turn the other direction

Page 9: PHY 235 Robotics Workshop Day 6 DC Motors, H-Bridge Board, Simple Lego/Boe Bot.

H-Bridge using Relays

• Relays are switches which can be turned on by small signals. Here we have 4 inputs: A, B, C, D. The table shows how the choice of signals controls the motors.

Page 10: PHY 235 Robotics Workshop Day 6 DC Motors, H-Bridge Board, Simple Lego/Boe Bot.

H-Bridge using Transistors

D11N5817

(Schottky)

M

M1DC Brush

+9 V

Q22907A(PNP)

R21 k

B

C

E

R11 k

D21N5817

(Schottky)

Q12222A(NPN)

+9 V

Q42907A(PNP)

R41 k

B

C

E

R31 k

Q32222A(NPN)

D31N5817

(Schottky)

D41N5817

(Schottky)

B

E

C

B

E

C

A

C

B

D

Taken from Intermediate Robot Building by David Cook

A=0, C=0 , B=1, D=1 -> Red Flow A=1, C=1, B=0, D=0 -> Green Flow

Page 11: PHY 235 Robotics Workshop Day 6 DC Motors, H-Bridge Board, Simple Lego/Boe Bot.

H-Bridge Simplified

• Note that we can simplify the control of this circuit if we use one signal to set A,C and another signal to set B, D. Thus, we can use inputs AA and BB.

• AA=0, BB=1 Motor turns one direction• AA=1, BB=0 Motor turns other direction

MM1

DC Brush

+9 V

BC

E

+9 V

BC

E

B

E

CB

E

C

Taken from Intermediate Robot Building by David Cook

AA BB

Page 12: PHY 235 Robotics Workshop Day 6 DC Motors, H-Bridge Board, Simple Lego/Boe Bot.

SN 754410 H-Bridge Chip

MM1DC Brush

OUT B

+5 VDD

Disconnected or from microcontroller

From microcontroller

SN

754410

1

2

3

4

ENABLE A&B

OUTPUT A

INPUT A

GND

5

6

7

8

GND

INPUT B

OUTPUT B

VMOTOR

VLOGIC

OUTPUT C

INPUT C

GND

GND

INPUT D

OUTPUT D

ENABLE C&D

16

15

14

13

12

11

10

9

M

from microcontroller

M2DC Brush

Disconnected or from microcontroller

From microcontroller

From microcontroller

0.1 F220 F

+4.5 to +36 VDC

0.1 F220 F

Taken from Intermediate Robot Building by David Cook

V Motor

VDD

VDD

Page 13: PHY 235 Robotics Workshop Day 6 DC Motors, H-Bridge Board, Simple Lego/Boe Bot.

SN 754410 H-Bridge Chip

• We will use this chip to enable the ZX-24a to control two Lego DC motors.

• These are the motors we will use for the RoboPong competition.• We will build a circuit board that will implement the

connections on the previous slide. The board will follow the schematic on the next slide.

Page 14: PHY 235 Robotics Workshop Day 6 DC Motors, H-Bridge Board, Simple Lego/Boe Bot.

Motor Controller

Page 15: PHY 235 Robotics Workshop Day 6 DC Motors, H-Bridge Board, Simple Lego/Boe Bot.

Motor Controller

• We will construct this circuit on a small circuit board.• The parts for this board will be distributed by the

instructor. He will explain the construction details.

Page 16: PHY 235 Robotics Workshop Day 6 DC Motors, H-Bridge Board, Simple Lego/Boe Bot.

Motor Controller

• To test out the board, we will connect the CPU I/O connections (ZX-24a I/O 4-pin header) to Pins P0, P1, P2, and P3 on the Boe-Bot. The two Lego motors should be connected to the motor out 4-pin header.

• The two-pin headers should be connected to Vdd and ground. Make sure the polarity is correct.

• Your instructor will show you a Boe-bot with all of the connections.

• To test out the motors, we can use the code on the next slide.

Page 17: PHY 235 Robotics Workshop Day 6 DC Motors, H-Bridge Board, Simple Lego/Boe Bot.

Motor Controllerconst p0 as byte = 5const p1 as byte = 6const p2 as byte = 7const p3 as byte = 8

Sub Main()do ' Motors rotate one direction call putpin(p0, 1) call putpin(p1, 0) call putpin(p2, 1) call putpin(p3, 0) call delay(0.5)

' Motors rotate the other direction

call putpin(p0, 0)

call putpin(p1, 1)

call putpin(p2, 0)

call putpin(p3, 1)

call delay(0.5)

loop

End Sub

Page 18: PHY 235 Robotics Workshop Day 6 DC Motors, H-Bridge Board, Simple Lego/Boe Bot.

Simple Lego Bot

• For the rest of today, your team task is to create a basic (simple) Lego vehicle using the two Lego Motors and controlled by the ZX-24a board and batteries.

• You should unscrew the board and battery pack from the metal Boe-bot chassis and construct your Lego bot so that it has a place for the green BOE board and battery pack to be situated.

• Then, re-implement some of your basic navigation routines (forward, back, etc) using the Lego motors.