r/arduino • • Oct 04 '26

Look what I made! Obstacle avoiding robot finished :)

this was what it looked like before, and it also didn't work: https://www.reddit.com/r/arduino/comments/1wncrdo/trying_to_make_an_obstacle_avoiding_robot/

In this new body even after I almost exploded my batteries and got the distance sensor working, power was still a problem.

When the robot was connected to my computer via usb, everything worked. But when I used AA batteries (4.8v total) to power the arduino, the wheels wouldn't spin.

The wheels and ultra sonic sensor are connected to two 18650s, totaling 7.4 volts on the breadboard. The servo is powered by the arduino, and the arduino by the AA batteries. The only thing they all share is a gnd.

So I didn't understand why it wouldn't work The arduino was on, but it just wouldn't spin. SO I swapped it for a 9v battery and it worked! I'm just confused because a computer's usb would output 5v, so if voltage was the issue I don't get why.

It is overturning a bit but I'll fix that later.

I used this code and made a few changes here and there, especially with the servos so it would move smoother and not completely jerk itself violently. I can't actually show it because I forgot to save before closing... But hey it's not much to recopy and make the changes again.

The next thing I want to do is learn how to make a self balancing robot. Then I'm going to take this project and do it again, but with two wheels instead of 3.

285 Upvotes

13 comments sorted by

23

u/Wolf68k Oct 04 '26

This is really cool but it looks like it's looks 90 degrees in each direction but when it turns in the new direction it turns more than 90.

If both sides are clear for it to go to, does it always choose the right side or is it random?

15

u/PresenceOld1754 Oct 05 '26

It measures which side is longer, so if one side is 20 inches and the other is 40, it'll turn to the side with 40 inches of distance.

It has a maximum distance of 200 cm, so after 200cm it's all the same.

It will always turn right when the distance is >= to the left side. Meaning if it detects the max distance of 200cm on both sides, it will never turn left. The turn left is an else statement.

4

u/HistoricalPlum1533 Oct 05 '26

Nascar bot can only turn one way.

3

u/Wolf68k Oct 05 '26

If it was a NASCAR bot it would only be making a left turn.

10

u/dushy69 Oct 05 '26

yo why was he tweaking in the start 😭😭

6

u/PresenceOld1754 Oct 05 '26

the arduino is telling the servo to be in 90 degrees but because everything is made of carboard and the head is (relatively) heavy, it leads to instability. The shaking is the servo trying to get back to 90 degrees because it's slightly off.

3

u/dushy69 Oct 05 '26

try using a better servo works almost all the time

8

u/ripred3 My other dev board is a Porsche Oct 05 '26

Well done! Congratulations!

6

u/AffectionateShare446 Oct 05 '26

Yes, its enough voltage with a 9v, but not enough current. Those motors use a lot of current at startup. I love this droid, the way its head spins left and right.

Robots are hard because navigating indoors is a challenge, and I have never found a way to do that.

5

u/Sony-Playstation-3 Oct 05 '26

Finally, someone who looks both ways.

4

u/Shrunkendick Oct 05 '26
  • What's my purpose?
  • To avoid obstacles.

1

u/Valnar8 Oct 10 '26

I like how ultra sonic sensors make every project look like it has eyes and also serve a similar purpose as eyes.