This tutorial will show you how to control higher voltage devices, e.g., a 12V LED, with Arduino. I will show you how to do it with both relays and transistors. I hope you will find it useful.
Full tutorial can be found here:
If you like this content and you want to support me in creating similar videos go to my Patreon webpage
https://www.patreon.com/MariosIdeas
Or
https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=7PD67JWZ9S3EJ&source=url
Power Amplification: Controlling 12V Devices
You cannot power a robot with a USB cable. The Controlling 12V Devices tutorial is the critical jump from blinking LEDs on a breadboard to spinning massive motors and firing solenoids. It teaches the principle of "The Gatekeeper".
The Problem: Voltage Separation
The ATmega328P chip operates at exactly 5 Volts. Its pins can only output 40 milliamps.
- A 12V PC Fan requires
12 Voltsand500 milliamps. - If you plug the 12V supply into the fan, and the fan straight into an Arduino digital pin to turn it off, the 12V current will literally blow the top off the silicon chip.
- You must separate the "Brains" (5V logic) from the "Brawn" (12V High Current).
Method 1: The Mechanical Relay
Relays are the simplest solution.
- The Arduino sends a safe 5V signal to a coil inside the relay.
- The coil creates a magnet that physically pulls a metal switch closed
*CLICK*. - The 12V power supply flows completely isolated through that physical metal switch into the water pump or motor. The Arduino never touches the 12V line!
- Drawback: You cannot use PWM (fading speed). Relays are strictly ON/OFF.
Method 2: The Logic-Level MOSFET (IRLZ44N)
If you want to fade a 12V LED strip smoothly, you must use a transistor.
- You wire the 12V supply to the LED Strip. You wire the ground of the LED strip to the Drain of the MOSFET.
- You wire the Arduino Pin 9 (PWM) to the Gate of the MOSFET.
- You must tie the Arduino Ground to the 12V Supply Ground (A unified ground is mandatory for transistors).
- The Arduino rapidly pulses a 5V signal. The MOSFET chemically opens and closes thousands of times a second, fading the massive 12V load seamlessly without loud clicking noises!
Base Requirements
- Arduino Uno/Nano.
- 5V Mechanical Relay Module (with optocoupler isolation).
- IRLZ44N N-Channel MOSFET.
- 12V Source (Battery or Wall Wart) and a 12V load to test.