Presentation on theme: "PHY 235 Robotics Workshop Day 6 DC Motors, H-Bridge Board, Simple Lego/Boe Bot."— Presentation transcript:
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
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
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
DC Motor: Brush Motors Brushes Stator (permanent magnets) DC Motors
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.
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)
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
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.
H-Bridge using Transistors D1 1N5817 (Schottky) M M1 DC Brush +9 V Q2 2907A (PNP) R2 1 k B C E R1 1 k D2 1N5817 (Schottky) Q1 2222A (NPN) +9 V Q4 2907A (PNP) R4 1 k B C E R3 1 k Q3 2222A (NPN) D3 1N5817 (Schottky) D4 1N5817 (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 FlowA=1, C=1, B=0, D=0 -> Green Flow
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 M M1 DC Brush +9 V B C E B C E B E C B E C Taken from Intermediate Robot Building by David Cook AABB
SN 754410 H-Bridge Chip M M1 DC Brush OUT B +5 VDD Disconnected or from microcontroller From microcontroller SN754410 1 2 3 4 ENABLE A&B OUTPUT A INPUT A GND 5 6 7 8 INPUT B OUTPUT B V MOTOR V LOGIC OUTPUT C INPUT C GND INPUT D OUTPUT D ENABLE C&D 16 15 14 13 12 11 10 9 M from microcontroller M2 DC Brush Disconnected or from microcontroller From microcontroller 0.1 F 220 F +4.5 to +36 VDC 0.1 F 220 F Taken from Intermediate Robot Building by David Cook V Motor VDD
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.
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.
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.
Motor Controller const p0 as byte = 5 const p1 as byte = 6 const p2 as byte = 7 const 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
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.