Controlling a Motor with Cascading Switches transistor relay DC Motor
DISCLAIMER & USAGE The content of this presentation is for informational purposes only and is intended for students attending Louisiana Tech University only. The authors of this information do not make any claims as to the validity or accuracy of the information or methods presented. Any procedures demonstrated here are potentially dangerous and could result in damage and injury. Louisiana Tech University, its officers, employees, agents and volunteers, are not liable or responsible for any injuries, illness, damage or losses which may result from your using the materials or ideas, or from your performing the experiments or procedures depicted in this presentation. The Living with the Lab logos should remain attached to each slide, and the work should be attributed to Louisiana Tech University. If you do not agree, then please do not view this content. boosting application-focused learning through student ownership of learning platforms
normally open contacts Wiring Setting the digital output on the Arduino to HIGH switches on the transistor The transistor allows current to flow through the relay coil, closing the relay contacts Power from Vin actuates the motor, allowing the shaft to spin 5V C B E Arduino digital pin 1kΩ diodes normally open contacts M coil SPST relay + - Vin
Flyback Diode Why Use the Flyback Diode? When the digital pin on the Arduino goes HIGH, electricity is conducted through the coil of the relay, inducing a magnetic field in the coil Energy is stored in the coil as a magnetic field When the digital pin on the Arduino goes LOW, the decay of the magnetic field induces a current that can be harmful to our electronics (can arc across contacts or send a surge through the system) The diode allows a circular current to be set up in the coil / diode loop so that the magnetic energy stored in the coil can be safely dissipated C B E 5V Arduino digital pin 1kW C B E 5V Arduino digital pin 1kW Bad Wiring Good Wiring
Power Considerations Power to switch transistor Power to switch relay source: max current per digital I/O pin: Power to switch relay source: max current from the voltage regulator: coil current for relay: Power to motor source: max current: Arduino digital I/O pin 20 mA 5V from Arduino (from the on-board voltage regulator) 800 mA 40 mA Vin (6 AA Batteries, 9V) depends on battery type (often lithium ion or NiCad) and remaining life
Implementation + - M 5V Arduino digital pin normally open contacts transistor wire to digital pin 8 5V Diode – silver stripe toward positive side void setup() { pinMode(8, OUTPUT); } void loop() { digitalWrite(8, HIGH); delay(500); digitalWrite(8, LOW); delay(2000); SPST Relay 5V C B E Arduino digital pin 1kΩ coil normally open contacts SPST relay + - Vin M Vin coil leads contact leads