Distance measurement using laser sensor — Part 1
Easy-to-use sensor that enables machine learning and artificial intelligence in automated systems
Distance measurement is one of the most important measurements for different tasks, mostly related but not limited to robotic or other automatic systems. Tasks could include room mapping, park sensors, speed measurement, movement detection, 3D modeling, and similar.
In this short series of articles, I will show you how to measure distance using laser sensor Hokuyo UTM-30LX-EW and connect it with your application. In this article, we will create a setup for using the sensor, and in the next article, you will learn how to integrate this sensor into your custom applications.
Well, here is the sensor!
We can see basic parts on the front side:
- Power LED — an indication of the power (on/off).
- Operation status led — different behavior depending on status (ex. always on if operates without errors).
- Light transmission and reception plane — the sensor is inside this plastic cover. It has two planes, transmission, and reception planes.
And the backside:
- Ethernet cable — used for communication wit the computer.
- Power cable — for providing power to the sensor. It has three wires: brown (DC 12V), blue (0V-GND), and green (OUT). The sensor requires around 1A for normal operations.
- IP reset switch — used for resetting the IP configuration.
Here are some important characteristics related to distance measurement and sensor’s limitations:
- Field of view: 270°
- Angular resolution: 0.25°
- Measurement steps: 1080 (270/0.25=1080)
- Max. distance: 30 m
Before setting up the sensor, please consult the official user manual.
1. Power supply
The sensor is powered through a power cable which includes three wires: brown (DC 12V), blue (0V-GND), and green (OUT). The sensor can draw a maximal current of 1A. I have used an old PC power supply for sensor testing purposes.
In this article, we will show how to connect the sensor with an ethernet cable. The sensor has an initial IP setup of 192.168.0.10. To be able to communicate with the sensor, the PC must be in the same network. On Windows PC, you can do it by following this tutorial. For example, you can use the IP address 192.168.0.100 with subnet mask 255.255.255.0
After powering the device and connecting it to the PC, we can start with measuring the distance!
For that, we will use Urg Viewer application. It is a simple application used for visualization of the measurements and exporting the results. There are two options for connecting with the sensor using Ethernet or Serial connection (button in the upper right corner).
After connecting to the sensor, distance measurements are shown as a table (left plane) and the blue dots (right plane). In the image below, you can see the result of the distance measurement in my apartment.
In this article, the usage and basic setup for measuring the distance using a laser sensor are shown. You can use this kind of sensors for many projects like alarm systems, parking sensors, or creating the map for mobile robots.
Stay tuned for the next article in this series, where you will learn how to integrate this sensor into your custom applications.
If you have any questions or suggestions, feel free to comment or contact me!
The sensor is provided by the Laboratory for Intelligent Transport Systems at Faculty of Transport and traffic sciences, University of Zagreb, Croatia.
- Hokuyo UTM-30LX-EW user manual, https://www.hokuyo-aut.jp/search/single.php?serial=170
- Changing the IP address of a PC, https://support.microsoft.com/en-us/windows/change-tcp-ip-settings-bd0a07af-15f5-cd6a-363f-ca2b6f391ace