กลับไปหน้ารวมไฟล์
tutorial-on-how-to-control-12v-devices-with-arduino-a77aeb-en.md

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 Volts and 500 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.

  1. The Arduino sends a safe 5V signal to a coil inside the relay.
  2. The coil creates a magnet that physically pulls a metal switch closed *CLICK*.
  3. 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!
  4. 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.

  1. You wire the 12V supply to the LED Strip. You wire the ground of the LED strip to the Drain of the MOSFET.
  2. You wire the Arduino Pin 9 (PWM) to the Gate of the MOSFET.
  3. You must tie the Arduino Ground to the 12V Supply Ground (A unified ground is mandatory for transistors).
  4. 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.

ข้อมูล Frontmatter ดั้งเดิม

apps:
  - "1x Arduino IDE"
author: "Dziubym"
category: "Basic Electronics"
components:
  - "1x KY-018"
  - "1x Linear Potentiometer"
  - "1x Arduino Nano R3"
  - "1x 12V Light bulb"
  - "1x PIR Motion Sensor (generic)"
description: "The power barrier! Learn the absolute most important hardware skill in robotics: utilizing relays and MOSFETs to safely control high-voltage appliances from a 5V microchip."
difficulty: "Easy"
documentationLinks: []
downloadableFiles: []
encryptedPayload: "U2FsdGVkX1+RMQW2PZc5xIFVdLSzw27d8GKvimZF/GOZDL6y8y4sQu+8DNptHvsyIw75uoKr5l6aRanhT10VjlVLeU64uQtHVXmzU0GKKuk="
heroImage: "https://cdn.jsdelivr.net/gh/bigboxthailand/arduino-assets@main/images/projects/tutorial-on-how-to-control-12v-devices-with-arduino-a77aeb_cover.jpg"
lang: "en"
likes: 10
passwordHash: "db4ad4489c1513d7dfacf5c3c821c611020da4c482ab0f843e68fe993b050c13"
price: 299
seoDescription: "Learn how to control 12V Devices with Arduino using a Relay or Transistor. Compare both methods in this tutorial."
tags:
  - "relay"
  - "transistor"
title: "Tutorial on how to control 12V Devices with Arduino"
tools: []
videoLinks:
  - "https://www.youtube.com/embed/XiOcxyyTxy4"
views: 63362