Control a DC Motor with an Ultrasonic Sensor and Arduino

Control a DC Motor with an Ultrasonic Sensor and Arduino

6.479 Lượt nghe
Control a DC Motor with an Ultrasonic Sensor and Arduino
Ever wanted to make your DC motor respond to an object or person based on distance like it has a mind of its own? In this Arduino tutorial, I’ll show you how to control a 12V wiper motor (or any DC motor) using an ultrasonic sensor and an Arduino Uno—because why should robots have all the fun? First, we’ll demystify ultrasonic sensors (they measure distance using sound waves, like a bat). Then, I’ll show you how to wire it up to your Arduino and connect a XY-160D motor driver to control a wiper motor. Then, I’ll walk you through two code examples: 1. One that triggers the motor when an object reaches a specific distance. 2. One that ramps up the motor speed the closer an object gets—perfect for building interactive props, robots, or spooky Halloween scares! By the end of this video, you’ll have a motor that responds to distance like it’s Daredevil. So grab your Arduino and let’s get coding! 🔗 Full Tutorial & Code: https://racheldebarros.com/arduino-projects/control-a-dc-motor-with-an-ultrasonic-sensor-and-arduino/ 📬 GET ALL MY ARDUINO CODE & PROJECTS ▶︎ https://racheldebarros.com/newsletter ▶︎▶︎ Subscribe for Arduino Tutorials & Projects Delivered to Your Inbox • Crystal-clear wiring diagrams • Copy-paste ready code •.Pro tips for troubleshooting • Code packs to inspire epic builds 🤖🎨 NEED PERSONALIZED HELP with your project? ▶︎ https://racheldebarros.com/members ▶︎▶︎ JOIN my Engineering Artists Discord Community • Live Workshops • Arduino Project Build & Code-alongs • Small Group Office Hours • Personalized Project Support 🛒 BUILD YOUR OWN Ultrasonic Sensor and DC Motor with Arduino Project: Arduino Uno: https://amzn.to/3Ylh2fg Ultrasonic Sensor: https://amzn.to/3FppEeT 12V DC Motor: https://amzn.to/4hA9zjO XY-160D Motor Driver: https://amzn.to/4kvnDy0 Breadboard: https://amzn.to/3AaO3CR Jumper Wires: https://amzn.to/4e5CLNU 12V Power Supply: https://amzn.to/3QCilTw Female DC Jack Adapter: https://amzn.to/3DlVGaX 🎬 VIDEO CHAPTERS: Control a DC Motor with Ultrasonic Sensor and Arduino 0:00 Welcome 0:56 How Ultrasonic Sensors Work 2:34 How to Wire an Ultrasonic Sensor to an Arduino Uno 3:34 How to Wire a Motor Driver to an Arduino Uno 7:13 Arduino Code: Trigger a DC Motor at a Specific Distance 16:40 Arduino Code: Accelerate DC Motor Based on Distance 20:18 Join my Community for Live Events & More Code! 💬 Have any questions or want to share your own experiences, tips and advice about using an ultrasonic sensor and DC motor with Arduino? Drop a comment below – I love hearing from you! 🔔 If you find this video helpful, please hit that like button 👍 and consider subscribing to my channel for more Arduino/props/robot tutorials, tips, and tricks. Your support helps me create more content like this! ---------------------------- Some links here (Amazon) might earn me enough nuts and bolts (aka commission) to keep the LEDs blinking and servos turning. No extra cost to you, just a lil' fuel for my caffeine-powered nights of DIY-ing and passing on what I learn to all of you. I only feature stuff that's survived my "Did-it-Explode?" test. Build on, and thanks for the recharge! #arduino #ultrasonicsensor #dcmotors #arduinocode #arduinoproject #arduinotutorial #arduinoprogramming