180 likes | 387 Views
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.
E N D
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 Brushes 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.
DC Motor: Brush Motors DC Motors Stator (permanent magnets) Brushes
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.
+9 V +9 V R4 1 k R2 1 k E E D2 1N5817 (Schottky) D4 1N5817 (Schottky) B B C Q4 2907A (PNP) C Q2 2907A (PNP) M Q3 2222A (NPN) Q1 2222A (NPN) M1 DC Brush R1 1 k R3 1 k C C D1 1N5817 (Schottky) D3 1N5817 (Schottky) B B E E H-Bridge using Transistors A B C D A=0, C=0 , B=1, D=1 -> Red Flow A=1, C=1, B=0, D=0 -> Green Flow Taken from Intermediate Robot Building by David Cook
+9 V +9 V E E B B C C M M1 DC Brush C C B B E E 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 AA BB Taken from Intermediate Robot Building by David Cook
+5 VDD 220 F 0.1 F SN754410 Disconnected or from microcontroller 1 16 VLOGIC ENABLE A&B From microcontroller From microcontroller 2 15 INPUT C INPUT A 3 14 OUTPUT C OUTPUT A M M 4 13 M1 DC Brush M2 DC Brush GND GND 5 12 GND GND 6 11 OUTPUT D OUTPUT B OUT B from microcontroller From microcontroller 7 10 INPUT D INPUT B +4.5 to +36 VDC Disconnected or from microcontroller 8 9 ENABLE C&D VMOTOR 220 F 0.1 F SN 754410 H-Bridge Chip VDD V Motor VDD Taken from Intermediate Robot Building by David Cook
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.
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.
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.