Starting My First 2...
 
Notifications
Clear all

Starting My First 2WD Robot – Motor Control & Sensor Tips?

8 Posts
5 Users
0 Reactions
214 Views
(@getawaycar)
Member
Joined: 1 month ago
Posts: 2
Topic starter  

Hi all,

I’ve recently started building a basic 2-wheel drive (2WD) robot using an Arduino Uno, L298N motor driver, and a pair of geared DC motors. The idea is to eventually expand it with autonomous navigation and perhaps Bluetooth or Wi-Fi control down the line.

Right now I’m focusing on getting smooth motor control and basic obstacle avoidance with ultrasonic sensors. A few questions I’d love your input on:

Is it worth implementing PID control for such a simple robot, or is PWM speed control good enough at this stage?

For precise distance sensing indoors, I used the HC-SR04, but it was a bit noisy at times. Has anyone tried combining IR and ultrasonic for short-range precision?

Also, any tips on powering the whole setup (motors + logic) efficiently from a single battery pack?

I’ve been learning a lot from other related videos — they’ve really helped a lot. Looking forward to hearing from you!


   
Quote
TFMcCarthy
(@tfmccarthy)
Member
Joined: 12 months ago
Posts: 354
 

Posted by: @getawaycar

I’ve been learning a lot from other related videos

What videos did you looked at? Did you look in this forum for similar projects?

Bill has a provided a good introduction with: Controlling DC Motors with the L298N H Bridge and Arduino

I thought Xenophon's project: Robot car with ESP32-CAM controlling L298N via RC receiver seemed like a pretty good match.

For a first-time car, I'd try to replicate an existing project.

The one who has the most fun, wins!


   
ReplyQuote
THRandell
(@thrandell)
Brain Donor
Joined: 4 years ago
Posts: 285
 

Hi @getawaycar

It’s always great to hear from someone else interested in autonomous robots.  Thanks for posting!

This is a differential drive robot, right?  Do you have any pictures that you can post?

Posted by: @getawaycar

Is it worth implementing PID control...

Hmmm, you might find that creating an autonomous robot that cruises around and doesn’t get stuck challenging enough without diving into PID controllers on your first robot.  Maybe you could try that in version 2, or not.  How are your math skills?

From the things I’ve read on PID, it seems that the calculations are simpler when you can read your sensors at a consistent frequency.  So you might think about how you can build that into your main processing loop.

Posted by: @getawaycar

Has anyone tried combining IR and ultrasonic for short-range precision?

Nope.

Posted by: @getawaycar

Also, any tips on powering the whole setup (motors + logic) efficiently from a single battery pack?

What batteries are you using to power this bad boy?  What does efficiently mean here?  Are you concerned about the heat your voltage regulator is putting out?

Posted by: @getawaycar

I’ve been learning a lot from other related videos...

I usually learn from books so I can’t recommend any videos to help you with your questions, although @triform posted a video of David Anderson’s work with autonomous robots on this DroneBot topic: https://forum.dronebotworkshop.com/user-robot-projects/autonomous-robots-and-ai/ and it's great!

 

Tom

To err is human.
To really foul up, use a computer.


   
ReplyQuote
(@aliarifat)
Member
Joined: 11 months ago
Posts: 99
 

Posted by: @getawaycar

Hi all,

I’ve recently started building a basic 2-wheel drive (2WD) robot using an Arduino Uno, L298N motor driver, and a pair of geared DC motors. The idea is to eventually expand it with autonomous navigation and perhaps Bluetooth or Wi-Fi control down the line.

Right now I’m focusing on getting smooth motor control and basic obstacle avoidance with ultrasonic sensors. A few questions I’d love your input on:

Is it worth implementing PID control for such a simple robot, or is PWM speed control good enough at this stage?

For precise distance sensing indoors, I used the HC-SR04, but it was a bit noisy at times. Has anyone tried combining IR and ultrasonic for short-range precision?

Also, any tips on powering the whole setup (motors + logic) efficiently from a single battery pack?

I’ve been learning a lot from other related videos — they’ve really helped a lot. Looking forward to hearing from you!

The HC-SR04 can be noisy, especially on soft surfaces (carpet, curtains), at angles (sound bounces away), or near electronic interference.

Combining IR + Ultrasonic is a good idea:

IR sensors (like Sharp GP2Y0A21YK) are better for short-range (10–80 cm) and give more stable readings indoors.

https://www.dfrobot.com/product-328.html

Ultrasonics (like HC-SR04) are better for medium range (~10–400 cm), but less precise up close.

https://www.theengineeringprojects.com/2017/08/ultrasonic-sensor-arduino-interfacing.html

 


   
ReplyQuote
THRandell
(@thrandell)
Brain Donor
Joined: 4 years ago
Posts: 285
 

Hi @getawaycar

Did you ever get anywhere with your question about combining distance sensors?

I picked up a pdf copy of “Introduction to Autonomous Robots“ (3E) by Nikolaus Correll and I thought that chapter 7 on Sensors might help you find some answers.  Anyway, here’s a link to the 3E of the book https://www.dbooks.org/introduction-to-autonomous-robots-1493773070/

 

Tom

To err is human.
To really foul up, use a computer.


   
ReplyQuote
(@getawaycar)
Member
Joined: 1 month ago
Posts: 2
Topic starter  

@thrandell 
Hi Tom,

Thanks so much for following up — and for sharing the book! I really appreciate it. I haven’t made a ton of progress on combining IR and ultrasonic yet, but I did some basic testing and still find the HC-SR04 a bit inconsistent in tight spaces. So I’m thinking of trying out a short-range IR sensor alongside it to see if I can filter or fuse the data for better reliability.

I’ll definitely check out Chapter 7 — sounds like exactly what I need right now. Have you tried any sensor fusion approaches yourself?

Thanks again for the resource — really helpful.

Best,
getawaycar


   
ReplyQuote
robotBuilder
(@robotbuilder)
Member
Joined: 6 years ago
Posts: 2343
 

@getawaycar 

I haven’t made a ton of progress on combining IR and ultrasonic yet, but I did some basic testing and still find the HC-SR04 a bit inconsistent in tight spaces. So I’m thinking of trying out a short-range IR sensor alongside it to see if I can filter or fuse the data for better reliability.

Will be following any follow ups on your project with interest and experimenting with fusing IR + sonar data when I get the chance. I have been out of it for a while including the last 2 weeks in hospital where I got my first infection of the covid virus after all these years of avoiding it! Sonar doesn't seem to be a choice with robot vacuums relying on other sensors instead.

@thrandell

I picked up a pdf copy of “Introduction to Autonomous Robots“ (3E) by Nikolaus Correll

Just downloaded a copy. Interesting coverage of the current state of the art of robotics.


   
ReplyQuote
THRandell
(@thrandell)
Brain Donor
Joined: 4 years ago
Posts: 285
 

Hi @getawaycar

The datasheets that I’ve found on the HC-SR04 have always seemed a little sketchy to me.  Here’s a quote from ElecFreaks:

When tested objects, the range of area is not less than 0.5 square meters and the plane requests as smooth as possible, otherwise ,it will affect the results of measuring.”

Then when I read the one from Parallax I get this:

“The PING))) sensor cannot accurately measure the distance to an object that: a) is more than 3 meters away, b) that has its reflective surface at a shallow angle so that sound will not be reflected back towards the sensor, or c) is too small to reflect enough sound back to the sensor. In addition, if your PING))) sensor is mounted low on your device, you may detect sound reflecting off of the floor.”

The reason I point this out is I’m wondering if you have ever tried raising your HC-SR04 above the floor by a foot or so to see if your distance readings improve?

Tom

Here’s a link to the Parallax datasheet.   https://www.pololu.com/file/0J214/PING_documentation.pdf

To err is human.
To really foul up, use a computer.


   
ReplyQuote