Robots with Wheels

Enter Your Electronics & Design Project for Your Chance to Win a $100 Shopping Cart!

Back to The Project14 homepage

Project14 Home
Monthly Themes
Monthly Theme Poll

 

I was a bit disappointed to find out that the laser distance sensor I am using doesn't have a narrow 1 cm beam. I am not too surprised as I couldn't understand how they could fit all the optics into the small package of the VL53L0X, I think I assumed it was some sort of electronics magic unknown to me. Unfortunately there isn't any magic and the device has a field of view (FOV) of 25 degrees, which does explain some of the results that I have been obtaining. However, it is still better than ultra-sonics which have wider FOVs.

 

I have now added a micro-servo motor to the front of the RoboBobLet chassis which has a hole cut into it specifically for this purpose. I used 2.5 mm machine head screws to fix the motor to the chassis. The mounting holes in the micro-servo are approximately 2.3 mm diameter so usually 2.0mm nuts and bolts are used but I find with my somewhat stubby fingers that these are a bit small. So the 2.5 mm screws are used to cut a thread into the holes of the micro-servo, effectively this makes them self-tapping. This avoids all the fiddling about with small nuts. The plastic used for the micro-servo motors is fairly brittle but it seems to stand up to this self-tapping process quite well and the screws can be removed and inserted multiple times if needed. There was a certain amount of 'easing' needed to get the second screw in and the trick is to leave the first one only partially screwed in as this allows some movement in the servo motor allowing the other screw to be inserted. You can always thread the holes before inserting the servo motor as this does make the final assembly step a bit easier. I used two small right angle brackets to fix the VL53L0X to the double servo arm provided with the micro-servo motor (so always make sure you buy the micro-servos with these arms, as some suppliers save money by not providing them). I did have to ream out the mounting holes on the laser distance sensor to just take off some of the solder in these plated through holes so that a 3.0 mm machine head screw would fit through. But with a bit of care everything goes together nicely. I used the right angle 1 mm connector strip provided with the VL53L0X so that the connecting pins pointed straight up and it is easy to connect them to the Nano using jumper leads. The operation of the scanning laser distance sensor is illustrated in the video below.

 

 

 

All I needed to do to the Nano was to add a function that would repeatedly rotate or scan the micro-servo motor from 0 degrees to 180 degrees. So this is just a for loop using the VL53L0X to take distance measurements and then outputting to the serial port. I then put this function inside an unending while loop during this testing phase.

 

while(1)

  {

      scan();

      delay(100);

  } /* while */

 

I am using the serial monitor within the Arduino IDE to display the range values which means using a USB cable to connect to RoboBobLet. This avoids the need to keep unplugging the HC06 Bluetooth link every time I re-program the Nano, with the added benefit of providing power to RoboBobLet thereby saving the batteries. It is possible that this might have an impact on the operation of the laser distance sensor, depending on it's current requirement so I am not intending to do any fine tuning of the system until it is all fully battery powered later on. I then just cut the string of numbers from the serial monitor display and paste them into an Excel spreadsheet. I am using the online version of Excel as I am relunctant to pay for a PC copy. It is almost as good but a bit slower in places due to the use of the cloud for storage. Below is a screen dump of the distance data.

 

Sorry about the small text but the online version of Excel seems to restrict the ability to cut and paste images so I am using screen dumps. The first column on the left contains the distance values cut and pasted from the serial monitor display. Then in the next column I have added the angle values, increasing by 2 degrees on each row. The third row contains the angles converted from degrees into radians as the trigonometric functions within Excel use radians. The fourth column is the X value (Rcos(angle) where R is the distance) and the fifth and final column is the Y value (Rsin(angle). By calculating the (X, Y) values then a scatter graph can be inserted into Excel, as illustrated below.

 

 

By using the scatter graph within Excel it is possible to plot a birds eye view of the distance values obtain, scanning anti-clockwise. There is a small spike at the beginning of the scan. I'm not entirely sure what this is but it is always there so it might be some part of the RoboBobLet chassis that is being detected. The main semi-circle is the maximum range set for the distance sensor, currently set to 1000 mm, which shows that not much is being detected. In fact there was only one small object, a 1 cm square wood strip placed at approximately 200 mm in front of RobBobLet, which can be identified by the indentation at approximately 90 degrees (immediately in front of the chassis).

 

This is OK but doesn't seem to provide much information about the object. An alternative way of plotting is to use a different graph within Excel and just plot the distance values. As they are equally spaced at 2 degrees there is no need to use the angle values. This produces the graph shown below.

 

 

Apart from the peculiar spike at the left, this graph clearly shows the detected object. It does have a strange little peak on the right hand edge of the object, which again, I am not sure what this is caused by but it is repeatable so it much be a function of the system somewhere. The distance is shown along the Y axis and indicates that the object is at an approximate distance of 200 mm from the sensor which is correct. It also shows that the beam width of this thin object is 24 degrees. This is what was expected with a FOV of approximately 25 degrees and a thin object. This seems to be a repeatable set of results but further testing at different distances and different object widths is needed in order to gain confidence in these sensor results.

 

And just in case you might be thinking this is a perfect little sensor, let me show you some of the earlier results I obtained, where environmental impacts affected the results. It is the same single object in an otherwise empty plane.

 

 

More about these spurious results in another Blog, as it is tea-time now.