Elegoo Smart Robot Car Β· V4 Β· Session 4

Make Your Car Dodge Obstacles

Give your robot car "eyes" so it drives forward on its own and turns away the moment something gets in its path.

45 min Beginner Ages 11+

What you'll build πŸŽ‰

Welcome back, club! So far you've been the one driving β€” the car only goes where you point the remote. Today is different and a little bit magical: you'll set the car loose and let it drive itself. No coding today (that's coming up next session!) β€” the program is already inside the car, and one button on the remote switches it on.

Right now your car only goes where you tell it. In this mission you'll turn it into a little explorer that drives by itself and steers around walls, chair legs, and your shoes β€” without ever bumping into them. The secret? A tiny sensor that listens for echoes, just like a bat.

Here's the behavior you're about to unlock β€” watch a car roam and dodge on its own:

A behavior demo: the car detects an obstacle, stops, scans both ways, and turns toward the most open direction. Concept clip from DroneBot Workshop (a V3 car β€” the behavior is the same as your V4, even though the car looks a little different).

How does it "see"? πŸ¦‡

Your car uses an ultrasonic sensor β€” the part that looks like two little eyes. One eye sends out a sound too high for us to hear. When that sound hits something, it bounces back, and the other eye listens for it. The car measures how long the echo took to return and uses that to figure out how far away the object is. Sound travels about 340 meters every second, so the math is quick!

Diagram of how the ultrasonic sensor measures distance with sound echoes
How the ultrasonic sensor measures distance β€” from the ELEGOO V4 "Obstacle-avoidance Mode" tutorial (p.2).
Fun fact: Bats and dolphins find their food the exact same way. It's called echolocation.

Let's go!

1

Check the sensor is mounted and plugged in

Make sure the ultrasonic "eyes" sensor is mounted on the front of the car and facing straight forward (not tilted up or down). Its cable should be pushed firmly into its socket on the board. That's the part that lets the car "see," so it has to be connected for any of this to work.

Good news: the obstacle-avoidance program is already loaded inside your car from the factory β€” there's nothing to install or code today. We just need to switch it on with the remote!
2

Put it on the floor and switch it ON

Set the car on a clear patch of floor with space around it (not a table β€” it doesn't know about edges and will drive right off!). Slide the power switch to ON, then let go and count one… two… three so it can learn which way is straight.

Battery check: a hungry car drives slowly and turns badly. If it acts sluggish, switch it off and charge it up first.
3

Press the "Obstacle-avoidance" key on the remote

Pick up the IR remote, point its front at the car, and press the Obstacle-avoidance key. That tells the car: "stop waiting for me β€” go explore on your own, and turn away from anything you get close to." Then set the remote down and let the car do its thing! πŸ€–

Where's that key? It's one of the four mode buttons on the remote (alongside Line-tracking, Stop, and Auto-follow). If you ever want it to freeze, just press Stop.
4

Watch it roam and dodge

The car should now drive forward by itself and turn away whenever you put your hand or a box in front of it. Here's the plan it follows over and over, many times per second: it checks the distance, and if something is too close, it backs up and turns; otherwise it keeps rolling forward.

Flowchart showing the obstacle-avoidance decision logic
The decision the car makes β€” from the ELEGOO V4 "Obstacle-avoidance Mode" tutorial (p.6).
5

Experiment!

Now play scientist. Wave your hand in front of it and watch it dodge. Build a little maze out of books or boxes and see if it can find its way through. Try a wide-open space versus a tight one β€” does it behave differently? When you're done, press Stop on the remote and switch the car off.

If something's not working

The car drives straight into the wall

The sensor probably isn't reading. Check that the ultrasonic sensor is firmly pushed into its socket on the board and facing forward (not tilted up or down).

Nothing happens when I press the remote key

Point the front of the remote right at the car and get a bit closer β€” the remote uses invisible light, so it needs a clear line to the car. Make sure the car is switched on, and press the Obstacle-avoidance key once and firmly. If the remote is brand new, pull the plastic tab out of its battery.

The car spins or won't drive straight

Make sure all four motor wires are connected and the wheels turn freely. Low batteries can also make motors behave oddly β€” charge them up.

Level up πŸš€

Want to change how close it stops before turning? That number lives in the car's code β€” and learning to change it is our next lesson! For now, see how the car handles different challenges: a narrow doorway, a circle of boxes, a pet (a gentle one!). Next session you'll open up the program and start telling the car exactly what to do.