Buggy: better obstacle avoiding rover

Teodor Costachioiu
Feb 12, 2016 · 2 min read

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

Welcome to a place where words matter. On Medium, smart voices and original ideas take center stage - with no ads in sight. Watch
Follow all the topics you care about, and we’ll deliver the best stories for you to your homepage and inbox. Explore
Get unlimited access to the best stories on Medium — and support writers while you’re at it. Just $5/month. Upgrade
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