Overview:
The purpose of this lab was to use a transistor to control a high-current DC motor from the Arduino using a transistor and to control the direction using an H-bridge and a Relay.Transistor:
When circuits include high-current loads like a DC motor that require more than the Arduino can supply, we need a transistor to control it. A transistor has 3 prongs: the "base" connects to the Arduino's output, the "collector" is attached to the element that has the high current, and the "emitter" connects to ground.
I started by connecting a potentiometer and transistor to the circuit. I then connected the motor to a power supply separate from the Arduino. I then connected a diode to protect my transistor from "back voltage" that occurs when the motor is turned off or changes direction. Finally, code was added to turn the motor on and off every second and then was changed to control speed with the potentiometer!
Direction:
To take the circuit a step further, we wanted to change its direction. To do this, we used an H-bridge which allows us to switch the polarity, changing the motor's direction. I added a switch to the circuit as well as a motor and H-bridge. The H-bridge can be confusing at first because of its many parts and because it looks so similar to the shift registers! I have included a diagram which made connecting it easier. Once the motor was connected to the h-bridge and to an external power source, I added code that turned the motor one way with current was high and the other direction when low.
Relays are devices that can also control large loads. I implemented a relay to also change the direction of the motor, but with a more satisfying "click" when the change is made! To begin, I made a circuit that alternated between turning on 2 LEDs. I then reassembled the wires by reversing the flow of current and attached the motor:
Problems:
When working with the relays, there was a problem with the prongs not reaching far enough to touch the metal in the breadboard. This was frustrating because although the wiring was correct, the desired outcome was not achieved until time was wasted trying to find the problem.
No comments:
Post a Comment