Buggy: better obstacle avoiding rover

Teodor Costachioiu
Feb 12, 2016 · 2 min read
Image for post
Image for post

The first version of the obstacle avoiding rover made around the MikroElektronika Buggy has proven to be nearsighted: the VCNL4010-based proximity click has a detection range of less than 20cm. With such a short detection range the rover had to be very quick to stop before hitting the walls, so I set the detection threshold at the maximum distance. Another drawback was the poor performance of the proximity sensor when the rover was approaching the walls at an angle.

Today it’s time to improve the eyesight of the Buggy: the IR distance click that I’m going to use has a detection range of over 120cm. As the detection distance increases there’s plenty space to do fancy things: now I can slow down as the rover approaches a wall, then brake, and then finally when it’s really close I can make it turn back. Moreover, the Sharp GP2Y0A60SZ0F sensor has a wider field of view, so no more banging on the walls when approaching at an angle.

The hardware is as usually deceptively simple: one Buggy with a Clicker2 for PIC18FJ as brain and one IR distance click placed in the front mikroBUS socket #1.

The GP2Y0A60SZ0F is analogue sensor, providing a higher output voltage as we approach the obstacle. The thresholds to be used for slowing down, braking and turning back were determined experimentally, using one USB UART click installed on socket #2 on the Cliker2 for PIC18FJ. Further I will use UART1 for sending the distance data to PC, using the USART terminal in MikroC to display the results. I have chosen the mikroBUS socket #2 as this leaves the USB cable unobstructed, and it’s easier to work this way.

Over the first version there are several improvements:

  • as the detection range has increased, there is also more room to brake efficiently, As such the rover can run at an increased speed.
  • a slow down phase was introduced, so at an early detection the rover will move slower
  • as the braking takes place also early, it’s possible that the rover stops before the threshold for turning back is reached. An extra check was introduced, and if the rover stops prematurely after a small time it goes automatically back.

As in the first version, the code relies on the BUGGY_PIC18_FUNCTIONS.c code, which is the same as in the fist rover example.

Originally published at https://electronza.com on February 12, 2016. Moved to Medium on May 5, 2020.


DIY electronics projects and more

Medium is an open platform where 170 million readers come to find insightful and dynamic thinking. Here, expert and undiscovered voices alike dive into the heart of any topic and bring new ideas to the surface. Learn more

Follow the writers, publications, and topics that matter to you, and you’ll see them on your homepage and in your inbox. Explore

If you have a story to tell, knowledge to share, or a perspective to offer — welcome home. It’s easy and free to post your thinking on any topic. Write on Medium

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store