Testing Distance Sensors

I’m working on a project involving the need to precisely move a tool based on the measured distance to an object. Okay, yeah, it’s a CNC mill. Anyway, I’d heard of time of fight sensors and decided to get one to test out, but also to be thorough I wanted to include other distance sensors as well: a Sharp digital distance sensor as well as a more sophisticated proximity/light sensor. I plugged them all into a breadboard and ran them through their paces, using a frame built from aluminum beams as a way of holding the target materials at a specific height.

Reflected-Light Sensors

I started with the Sharp GP2Y0D810Z0F digital distance sensor in a Pololu breakout board. It sports sample rate of 400 Hz, which seems more than adequate–I think my project wouldn’t need anything nearly that fast.

It’s basically a small-format replacement for light-based proximity senors, it works the same way, by shining a infrared light and looking for it to bounce back. The down side is that it doesn’t return a distance to the microcontroller–it’s binary, and triggers only when an object enters its field of view between 2 cm and 10 cm. If I were to have this sensor on my toolhead, it could tell if something was blocking the beam, but it couldn’t tell how close the tool was to the material.

Next I checked out the VCN4010 on a breakout board from Adafruit. Like the Sharp it’s more of a proximity sensor than a distance sensor. Adafruit’s testers found it worked best at around 10 mm to around 150 mm, or around 7.5″ and under. One advantage over the Sharp, the VCN4010 has a light sensor built into it. It has some nice features, like the product now supports I2C and interrupts, but I still found it to be not right for the application.

When you use the sensor it returns two numbers: ambient and proximity. The board’s chip has both a light sensor (the ambient number) and an infrared proximity sensor (the other number) and basically pings both sensors continuously and the data is viewable on the serial monitor.

Time of Flight

Forget infrared and parallax, the VL53L0X time-of-flight distance sensor uses an actual laser and measures how long it takes the light to bounce back. Adafruit put it on a board with a lev

el shifter and lux sensor, but you can find breakout boards from eBay or build your own.

It should provide accurate measurements up to 1200 mm (about 4 feet) which is clearly more than I need. On the other end, the VL52L0X isn’t rated to take measurements smaller than 50 mm, or two inches. I don’t think that’s a deal killer. If I have the sensor mounted on the toolhead and shining down, with a chuck and a bit in between, two inches might be alright. Adafruit has another breakout that only measures betw

een 5 mm and 200 mm. To be honest, I’ll never have the sensor in a position where it would need four feet of space to work.

Both time-of-flight sensors have a very tight cone of measurement. Forget an ultrasonic’s tendency to spray sound everywhere, bouncing off of the wrong things and theoretically polluting other ultrasonics. The ToF shoots a little laser beam out and it’s very directional; it senses what is in front of it and nothing else.

On the downside, you also need to point the laser at something that will reflect it properly. I tested out the ToF with a variety of materials, and it definitely likes white and gray. For my project I might need to ensure there’s a swatch of something reflective but not too reflective, at which to aim the laser. Ambient lighting and a reflective white surface improves the accuracy to around +/-3%, while less ideal environments lowerthis to worse than 10%. For my project, with precision important, 10% could mean the difference between the tool touch the material and it missing completely.

Another downside, and this one is minor, is that you can only connect one sensor to your I2C bus because they have a single hard-coded I2C address. There are hacks to work around this, and there’s even a dedicated I2C address-translation chip that’ll get you out of this particular jam. The good news is that I wasn’t planning to use more than one sensor anyway.

I had a lot of fun testing out the sensors and getting a feel for what their capabilities. And while I am intrigued by the proximity sensing properties of the Sharp and VCN4010, I feel like my application needs more precision. I need to know precisely how far to lower the toolhead, and the ToF’s precision seems perfect for my purposes.

Source link

Leave a Reply

Your email address will not be published. Required fields are marked *