The answer is No. Never place anything inductive on an arduino pin. You need a relay either solid state or mechanical. You are switching AC, placing that on a 5V pin will make your Arduino supplier happy because you will blow it. Here is some helpful information:
Gil's Crispy Critter Rules for Processor Hardware:
- Rule #1: An Arduino is NOT a Power Supply!
- Rule #2: Never connect anything inductive (motors, speakers) directly to an Arduino!
- Rule #3: Avoid connecting or disconnecting wires while the power is on.
- Rule #4: Do not apply power to any pin unless you are certain of what you're doing.
- Rule #5: Do not exceed the maximum voltage ratings.
- Rule #6: Many Arduinos cannot power transmitters directly.
- Rule #7: Before powering your project, take a break and double-check the wiring.
LaryD’s Corollaries:
- Coro #1: When starting out, add a 220Ω resistor in series with both input and output pins to protect against shorts.
- Coro #2: Invest in a Digital Multi-Meter (DMM) to measure voltages, currents, and resistance.
Note: Violating these rules can turn your Arduinos into crispy critters. For optimal performance, keep your wires under 25 cm (10 inches).
Additional Tips:
- The L293 motor driver, though common, is inefficient as it can lose around 3V as heat when driving both legs of a motor. Consider using a motor driver with MOSFET outputs to reduce heat loss and conserve battery power.
- For more on powering Arduino boards, explore this guide: Powering Alternatives for Arduino Boards.