Arduino Microcontroller Workshop UMBC Institute of Electrical and Electronics Engineers Arduino UMBC IEEE Sekar Kulandaivel sekark1@umbc.edu Week 3: Motor Control w/ H-Bridges Technical Skills Series Presentation April 15th – 16th, 2014
Topics to Cover Diodes & Transistors External Voltage Sources MOSFETs and H-Bridges Motor Control (Speed & Direction)
Metal-Oxide-Semiconductor Field-Effect Transistor (MOSFET) Gate Source Drain
Battery Motor Made with Fritzing.org
Using Transistors Create constants and variables. Set inputs and outputs for setup() function. Read from switch and write to transistor pin.
Important Functions int val, time; void setup() { … } void loop() { … } Serial.begin(9600); Serial.print(“Hello”); Serial.println(“Hi”); delay(1000); pinMode(8, INPUT); pinMode(9, OUTPUT); val = digitalRead(8); digitalWrite(9, out); val = analogRead(A0); analogWrite(9, out); time = millis(); map(var, testLow, testHigh, mapLow, mapHigh);
Motor Driver (H-Bridge) Enable 1,2 VCC1 Input 1 Input 3 Output 1 Output 3 GND GND GND GND Output 2 Output 4 Input 4 Input 2 VCC2 Enable 3,4
Input 1 Input 2 M Vin Output 1 Output 2 Design from Wikipedia
Input 1 Input 2 M Vin Output 1 Output 2 Design from Wikipedia
Input 1 Input 2 M Vin Output 1 Output 2 Design from Wikipedia
Battery Motor Made with Fritzing.org
Using H-Bridges Create constants and variables. Set inputs and outputs for setup() function. Read from on-off and direction switch. Changing the direction. Going in one direction Going in other direction. Enabling the H-bridge. Start or stop.
Important Functions int val, time; void setup() { … } void loop() { … } Serial.begin(9600); Serial.print(“Hello”); Serial.println(“Hi”); delay(1000); pinMode(8, INPUT); pinMode(9, OUTPUT); val = digitalRead(8); digitalWrite(9, out); val = analogRead(A0); analogWrite(9, out); time = millis(); map(var, testLow, testHigh, mapLow, mapHigh);
Color 1st Digit 2nd Digit Multiplier 4th band is Tolerance. L R Color 1st Digit 2nd Digit Multiplier Black 100 Brown 1 101 Red 2 102 Orange 3 103 Yellow 4 104 Green 5 105 Blue 6 106 Violet 7 107 Gray 8 108 White 9 109
330Ω 3 x 101 = 10kΩ 1 x 103 = 2kΩ 2 x 102 = 1MΩ 1 x 105 =