Raspberry Pi Pico W taught this car to avoid objects
Creating an obstacle-avoiding robot car might sound like one of the trickier Raspberry Pi builds you can attempt, what with all the motors, drivers, and sensors you need. But Karam Haddad makes it look easy-peasy in his seven-minute build video.
How does it work?
The brain of the robot car is a Raspberry Pi Pico W, chosen because it’s small enough to hide neatly inside the chassis but packs the necessary processing power to handle the control logic required for navigation. An ultrasonic sensor mounted on a servo motor enables the car to gauge its environment by taking distance readings in all directions. “That wall is seven metres away, so I should stop driving towards it in around 6.9 metres’ time,” is the kind of thing the car would say to itself. The robot is trained always to favour forward movement when the path is clear and only to evaluate alternative paths when an object is detected.
An adjustable DC power supply is powering the robot. A motor driver regulates the direction and speed of the DC motors attached to each wheel of the car.
The physical chassis of the car, including bespoke mounts for the motors and sensors, was 3D printed and hot-glued together.
Uh-ohs and upgrades
Karam had to do some jiggery-pokery to address voltage drops during testing which left the motors without enough power, but after that the robot was ready for a road test around a makeshift obstacle course. The maker would like to explore the possibility of integrating smartphone connectivity, which would let you manually control the robot.
Head to GitHub for all the code, and give Karam’s build video a like on YouTube.