Buggy: better obstacle avoiding robot

0

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.

Buggy: better obstacle avoiding rover

Buggy: better obstacle avoiding rover with Clicker2 for PIC18FJ and IR distance click

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.

Sensor calibration

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.

The MikroC for PIC code used to determine the thresholds is as follows:

Code for obstacle avoiding rover

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. For convenience, here’s the code listing again :

All code listings and accompanying .hex file can be downloaded here. Have fun!

Share.

Leave A Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.