Ultrasonic Sensor

MoonCampaign by Praneel (10 years)

At Moonpreneur, we empower students through hands-on product building, transforming their ideas into reality. Our Mooncampaign highlights their creativity, and innovations while fostering leadership, entrepreneurship, teamwork, and communication. Join us in shaping the future, one idea at a time!

Likes

Rating

22 days left

Your support will go a long way in encouraging Praneel and taking their innovation Ultrasonic Sensor to new heights.
Ultrasonic Sensor
terms and conditions
:

Ultrasonic Sensor

:

:

Show and Tell

:

Show n Tell

:

Coming Soon

About the Innovator

Praneel’s Ultrasonic Sensor project turns the Arduino Uno into a dodging robot for a teen learning to code. An ultrasonic sensor spots obstacles, wheels roll to steer clear, and it’s a thrilling way to build a mini autonomous bot with coding.

Want your child to be part of an innovative and creative competition?

STORY

Total Views:

I was racing my toy cars and wanted to make one that avoids crashes by itself, so I built my Ultrasonic Sensor project with my Arduino Uno—my first coding try! I used a sensor to see things in the way and wheels to move my robot around them, like a smart little racer. It’s so cool watching it dodge stuff like a real autonomous bot!


I wired an HC-SR04 ultrasonic sensor to pins 6 (trigger) and 7 (echo), and hooked up a motor driver (like an L298N) to pins 9 and 10 for two wheels. In void setup(), I set pinMode(6, OUTPUT), pinMode(7, INPUT), and motor pins as OUTPUT. In void loop(), the sensor pings—digitalWrite(6, HIGH), delayMicroseconds(10), duration = pulseIn(7, HIGH)—and calculates distance with distance = duration * 0.034 / 2. If something’s close—if (distance < 20)—the wheels stop with digitalWrite(9, LOW) and digitalWrite(10, LOW), then turn left by running one motor. If it’s clear, it rolls forward. The robot spun wildly at first, but I tweaked the motor timing with delay(500), and now I cheer when it swerves around my toy cars!


I’m stoked to make it slicker next time! Maybe I’ll add a buzzer to beep when it stops, or make it back up before turning. I could even give it LEDs to flash like a race car! I really like coding this with my Arduino, and I can’t wait to race my friends’ robots and see who dodges best!


Future applications for this project could be epic! I could turn it into a tiny delivery bot that drops off snacks without bumping tables, like the tiling robots you mentioned. Or maybe a vacuum cleaner bot that maps my room, or a patrol droid that guards my desk, making my gadgets as smart as SAM the brick-laying robot!

Every child is gifted. Discover how yours can innovate and lead

Comments

You Might Also Like

Every child is gifted. Discover how yours can innovate and lead