Introduction: Simple LiDAR Using the Laser Rangefinder Uni-T UT390b, Arduino and Turbo Pascal

Hello!

Some days ago I bought a laser rangefinder (Uni-T UT390b, f.e.

http://www.dx.com/de/p/uni-t-ut390b-45m-laser-dist...) to realise a simple LiDAR. The rangefinder has an accuracy of +/- 2mm and is able to measure distances up to 45m. This will be enough for my living room ;-)

You'll also need:

* Arduino Mega (because of more than one Serial Outputs)

* 2 Servos

* Servo tilt (f.e. http://physicalcomputing.at/epages/f46ab952-295a-4f65-8ffa-38a4b8eec267.sf/de_AT/?ObjectID=156007)

* LM317 and some other parts for the 3V-power-supply

* 5V/3A power supply for the servos and the voltage Regulator

* cable, different connectors etc.

Step 1: The UT390b Laser Rangefinder and His Outputs

In the web you can find some interesting articles about the UT390b and the serial read out of the data.

* https://github.com/erniejunior/UT390B_Arduino_Library

* http://blog.qartis.com/arduino-laser-distance-mete...

* http://blog.qartis.com/laser-distance-meter-update-serial-commands-timing-measurements/

There's even a special UT390b-library for the arduino.

You just need 3 pins (GND, RX and TX), placed under the batteries on the back of the unit. Open the rangefinder (instruction: http://blog.qartis.com/arduino-laser-distance-meter/) and solder 3 wires on the outputs.

Attention:

* The Tx-signals coming from the arduino have a 5V-level. This is too high for the UT390b and may destroy the electronics. Therefore you'll need a voltage devider with two 10kOhm resistors! The 2.7V-output doesn't need to be connected.

* A further problem is, that the UT390b will sometimes turn automatically off during the measurement or will stop because of an error message (f.e. 190). To be able to continue the measurement without problems you should replace the batteries with an external power supply and a switch for the restart! I use a LM317 as a voltage regulator.

If the UT390b shows an error on its Display you'll just have to switch it off and on again followed by pressing the ON-button. If the UT390 turns off automatically you'll just have to push the ON-button.

Step 2: The Measurement

To start the measurement I have to push a button. Then the two servos move zigzag and for each direction the measured distance and alignment (horizontal angle phi, vertical angle Theta) are sent to the computer. To save the values I use the program teraterm.

Step 3: Visualization of the Data

When you have the data (phi, theta, distance) you want to visualize them. I haven't found a suitable prgram in the Internet to do that. The problem is, that the values aren't regularly. Most of the Commercial programs need regular (x/y)-Points to draw a net.

Luckily I've written a program in Turbo Pascal 20 years ago to visualize 3D-data. The intention was to display topographic surfaces like my hometown. For this I had to read the altitudes of 1600 points in a map ;-)

For the LiDAR I use this program to visualize the detected surrounding. With keys I'm able to Change the Point of view, the magnification and the offset.

Step 4: The Results

Scanning my living room was the first test of my LiDAR. At this time I didn't have the option switching off the UT390b manually yet. Therefore some lines are a bit distorted and displaced, because I had to take the rangefinder out of the mount a few times during the measurement.

Equipped with the external switch and a more stable mounting I'll now produce better results ;-)

Thank's for spending your time. Maybe you're interested in my other projects:

https://www.youtube.com/user/stopperl16/videos

Comments

author
oliverilmagnifico made it! (author)2016-11-17

I also would be interested if someone could find out how to do this with a 390B+. I've had a play but i'm a total noob so didn't get anywhere. One thing I did notice is that my device does not have the tx and rx pads that were pictured elsewhere in the comments.

author
jnissen made it! (author)jnissen2017-01-30

I also purchased one of these. So far the serial RX and TX pins on the back of the board are non responsive. I'd guess that a serial command may be able to unlock the serial mode but that may be wishful on my part.

I did hook a scope and observed the pins while powering on. They don't do anything. Essentially low the entire time. We need to figure out some command or possibly a jumper to enable the serial. Appears to be a knock off of the UNI-T or a no name version of the latest board. I know mine differs slightly in the upper left side of the board vs. pictures I have seen of the 390B+

author
jnissen made it! (author)jnissen2017-01-30

I tried the various commands with an UNO in reset and using the hardware serial to USB of the board. The 390B+ is not responding or putting anything out on the TX or RX pins. I tied a number of commands and various baud rates but nothing. I'll have to spend some time later to see if there is some easy hack or enable of the serial involved.

The pins that are exposed from the battery compartment do look more like the ARM debug port more than anything else. Unfortunately I do not have access to an ARM debug interface.

author
Carlosrhs made it! (author)2017-01-25

Any one with knowledge on the UT390+ ?

author
masc01 made it! (author)2016-11-06

Would also be very interessted in the pins von 390B+! I hope that someone will have success and share the ideas!

author
lemorlenny made it! (author)2016-11-01

Anybody discovered the right pins for 390B+?

author
landger made it! (author)2016-07-22

For those interested in a laser distance meter with HID usb connection look at the sndway SW-S100. It comes with a CD with a basic application but also a list with command codes. It's a bit more expensive (about US$60 on AliExpress). The software does not seem to be very stable on my PC, but it does work - sending a command form the PC to measure and retrieve the distance on the PC. I'm now looking into implementing an application in C#, but I'm not very familiar with HID-USB, so any help is welcome

author
landger made it! (author)2016-06-11

I also got a UT390B+. I opened it and it actually indicates the TXD and RXD on the board. Interestingly, these are not directly connected to the connectors accessible under the battery cover (I measured resistance with any of the connectors and these were all high).

I connected the TDX to the RX and RDX to the TX on an Arduino Due, together with the negative battery lead to ground. Using the UT390B_Arduino_Library as linked to above, I was however not able to read any data.

Has anyone had more luck reading data from the 390+?

UT390B+.pngUT390B+.jpg
author
SimonM83 made it! (author)SimonM832016-07-20

Hi, did you try sending the serial command which the qartis blog used? Nothing received from the Tx pin when executing commands?

author
landger made it! (author)landger2016-07-22

No, I didn't. I think I actually blew up the Tx/Rx connections as I now measure zero resistance between the two...

author
SimonM83 made it! (author)SimonM832016-07-22

I'll check the resistance between mine and put the results on my hackaday project. Link in my other comments here. I posted an update this morning you may find of interest (but I've not cracked it quite yet!)

author
SimonM83 made it! (author)SimonM832016-07-21

Please join in this project to hack the UT390B+
https://hackaday.io/project/12767-peek-inside-uni-t-ut390b

author
SimonM83 made it! (author)2016-07-20

I started a Hackaday project here to try and get the community to find a way to talk to the UT390B+ with microcontrollers. Please get involved and share what you know!

author
SimonM83 made it! (author)SimonM832016-07-21

Seems like hyperlink doesn't appear in instructable app so here's the text:
https://hackaday.io/project/12767-peek-inside-uni-t-ut390b

author
aspic made it! (author)2016-02-17

Hello All

Correction : I have an UT390B+ (not 380).

So I disassemble it.

GND, and power are identified.

It seams to have 1 output, and 2 inputs.

But even trying all RS232 speed, set one input to 1 or 0 during sending command, nothing never append :o(

So at this time, no success.

I order one UT390B (hop to receive it). I will try to compare with ...

So as soon as I found something I'll tell you !....

author
voxelcam made it! (author)voxelcam2016-02-19

Do you have oscilloscope? Have you tried to measure the voltages on those pins? Please post a picture with discovered GND, pwr pinout and internal view.

author
aspic made it! (author)aspic2016-02-20

Yes, I check with the scope.
To open is same as the 390B. Dont' forget to remove stickers to view all screews...
Wire directly sold and comes by the holes.
SO I think that :
- White is power (apply voltage (by a resistor) switch on the unit
- gray is ground (directly connect to battery)
- I think magenta is an output. stay to ON level ( 2.8V) even is pulldown resistor, and make "reset" display if connected to ground :o(
- blue and green are input. Blue is 0v and become 1 with pullup resistor. Green same but reverse (2.8V and become 0 with pulldown resistor)

I will compare with 390B when I will have it...

20160220_165025[1].jpg
author
SimonM83 made it! (author)SimonM832016-07-20

aspic, I have just been sent a UT390B+ instead of the UT390B I ordered. I'm disappointed but decided to open it up like you. On your UT390B+ were there any other pads than the ones in line which can be accessed by the battery compartment? I seem to have a couple labelled Rx and Tx which aren't anything to do with the ones in a line as far as I can see. I'm going to start a hackaday project for anyone who wants to share their findings on the UT390B+

author
voxelcam made it! (author)voxelcam2016-02-20

Thank you!

I will contact that seller to check if they really have "B" model. So many of them just pretend to.

I am thinking - is there the 'hard way' - to attach in place of LCD ? if it is non-graphical we could catch print-out version of readings?

author
voxelcam made it! (author)voxelcam2016-02-19

What a pity! Please give us a link where you are about to order original UT-390B. I've contacted some sellers on aliexpress who listed 390b, but unfortunately all of them eventually said that they only have 390B+ but at 390B price (which is almost +80%!)

author
aspic made it! (author)aspic2016-02-20

I found 390B ! (more expensive I confirm (double than 390B+), but finaly less than a 390b+ can not use ;-))
Have a look here
http://fr.aliexpress.com/item/UNI-T-UT390B-Laser-Range-Finder-Distance-Meter-Area-Volume-LCD-Meter-0-05m-45m-Laser/1823766667.html?spm=2114.06010108.3.19.dGQsJn&ws_ab_test=searchweb201556_1,searchweb201644_4_505_506_503_504_301_502_10001_10002_10017_10010_10005_10011_10006_10003_10004_10009_401_10008,searchweb201560_2,searchweb1451318400_-1,searchweb1451318411_6452&btsid=261d0cd5-81ac-41f4-9d7d-8b31187e7903

author
fbujold made it! (author)2016-05-18

if you can accomplish +-2 mm of 45 m is it thinklable of accomplising sub mm over 1 meter?

author
landger made it! (author)landger2016-06-15

I'm not sure what the specified accuracy actually means, but from the raw measurements given in a comment in one of the links above, which seem to yield sub-mm measurement values, I estimated a standard deviation of about 1.1 mm, which is half the accuracy. This suggests that sufficient repeating and averageing could yield sub mm accuracies. For instance, repeating them 100x would yield an accuracy of 2/sqrt(100) = 0.2 mm.

I actually did this for an ultrasound distance sensor and it worked well, so I don't see why it wouldn't work for this device. Disadvantage is of course the vastly increasing measuring time.

author
fbujold made it! (author)fbujold2016-06-15

What i would like to know is; Since LIDAR technologies are very accurate over long distances, what kind of accuracy can i be expecting for distances in the 1 meter range? Or is this technology not usable for short distances?

ie 3d scanner device. For 3d printing the normal resolution of a print is .1 to .2 mm.

author
landger made it! (author)landger2016-06-15

The laser rangefinder technology is definitely suitable for distances in the 1m range, just not under about 20cm where it becomes inaccurate. The accuracy under 1 meter is not much better than at larger distances, although measuring time may be somewhat reduced.

For high resolution scanning purposes I think it would be far too slow; even if the averageing method would work it would take about 30 seconds per .2 mm accuracy single point measurement. If my calculation is right, that would be about 3 months for a scan of a 100cm2 surface. (At the standard 2mm accuracy this would be less than 1 hour)

Also, the laser spot is quite large, I estimate about 2 by 4 mm at 20-100cm for the UT390B+, reducing spatial resolution. Laser beams can be focussed to sub mm range, but I think this device is not suitable for that.

author
aspic made it! (author)2016-02-08

Hello dir all.

I just buy an UT380B+ (because UT390B not available). So I try to identify the debug pin assignement but except GND and POWER (not the most difficult ;o)), I didn't identify the other... I check all pins at power on but nothing send at the startup. So not possible to simply identify the tx pin :o(

Some one try to use it or knows if it's possible to dial by rs232 (ttl) port ?

Thanks a lot if yes...

author
voxelcam made it! (author)voxelcam2016-02-16

Do you have any progress with ut-390b+ ? Also, do you have disassembled photos?

author
RussellC19 made it! (author)RussellC192016-02-13

Did you manage to get this working? would be really great to know if it works with UT380B+

author
ChrisH234 made it! (author)2015-12-18

Does anyone know the method the UT390b uses for its distance measurement?

“time of flight” , “phase shift” or interferometry”.

author
schalliol1 made it! (author)2015-11-29

Has anyone had success hacking the UT390B+? I have opened the unit, but the port under the battery is oriented parallel to the batteries. I am trying to get the serial port pin out.

author
Alexander Dumbhead made it! (author)2015-11-11

Approximately how much does it cost to build this project?

author
MattisM made it! (author)MattisM2015-11-20

Should be possible for $100

author
tomas75a made it! (author)2015-11-10

Awesome project! And to see someone use turbo pascal is just cool! I love it :)

author
magma1914 made it! (author)2015-11-09

What is the final precision of the scans (for example the room scan - are the wall distances measured correctly?) What is the time of scanning the whole room?

author
magma1914 made it! (author)magma19142015-11-09

I once considered building such a device using stepper motors and small line lasers with camera

author
sinzu made it! (author)2015-11-04

very intereting. I didn't expect that this kind of telemeter had an easily accessible Rx/Tx pinning.

This brings me to think about an adaptation of your system: I need to measures the distance on teta angle on 360° (phi angle always at 0°). However, the teta angle will vary at high speed (>4Hz = 4RPM). Could you tell me what is the maximum time latency you observed to make a measure ?

As the measure is done with the light speed, the latency should be pretty low. But I guess the laser rangefinder itself made some calculation and averages measures before providing the final distance result. These operation should be a bit time consuming.

author
sinzu made it! (author)sinzu2015-11-04

to be more understandable, my idea is to make this kind of detection lidar:

http://www.robotshop.com/media/files/images2/lidar-lite-laser-rangefinder-9.gif

author
stoppi71 made it! (author)stoppi712015-11-06

I'm pretty sure that you can forget that project. When you use the "fire-mode" the UT390b sends a lot of distances within a second but other instructions f.e. for the servos will disturb the data-flow.

And when you recieve f.e. 20 distances/second, how to you select? You just want 1 distance in one direction. So you'd have to find an algorithm to select...

Otherwise when you wait until a correct distance is measured (like I do) and then step foreward it will be definitely too slow. The measure-frequency will then be around 1 distance/second, so quite too slow for your purpose. For your purpose I'd try this laser rangefinder:

http://www.robotshop.com/en/pulsedlight.html

author
sinzu made it! (author)sinzu2015-11-06

Yes I know these robotshop products. But the goal of my question was to know if it could be possible to build a cheaper system with this kind of rangefinder. But you answered my question.

Another solution to get a cheap LIDAR module is to find a broken vacum robot like Neato for few bucks and then dismount it. A lot of hack for these robot are available on the web.

author
Steve-Abx made it! (author)2015-11-03

The measured results that you get are a "point cloud".

You can use just about any 3D design software to load and view a point cloud. Just google point cloud.

author
stoppi71 made it! (author)stoppi712015-11-03

Hi Steve!
Getting a point cloud wouldn't be the problem, even with freeware like gnuplot. The problem is how to get a grid with not-equidistant (x,y)-points like in my case. I'm sure Thatcher there are programs for that but i haven't found one. Luckily i could dig out my old Turbo-Pascal-Program ;-)

author
Steve-Abx made it! (author)Steve-Abx2015-11-03

I don't understand.

What do you want the grid for?

author
stoppi71 made it! (author)stoppi712015-11-04

to create, imitate surfaces like in real... Just points aren't able to do that, I've tried this with my old ultra-sonic-scanner.

author
Steve-Abx made it! (author)Steve-Abx2015-11-04

When we make 3D models for printing we turn a 3d model into an stl file (which is a point cloud). If you import that into a 3d software package it can be treated as having a skin or not, and the skin can be modified. Have a look at the 123D software. It has scanning to and modification functions.

author
stoppi71 made it! (author)stoppi712015-11-03

Of course that and Not (margret Thatcher :-))

author
jeanniel1 made it! (author)2015-11-04

I found this for sale - it ought to work, too, right? How would the resolution be improved and the scan area / size?

http://www.robotshop.com/en/pulsedlight.html

author
stoppi71 made it! (author)stoppi712015-11-04

I've found that models too. They look good and can also be read with an arduino. But I don't know, whether sometimes errors will occur in the same way as with the UT390b.

author
BrenBren made it! (author)2015-11-04

You can also use the Teensy (LC or 3.1 or 3.2) for multiple hardware serial ports. They cost around $15-20 each.

https://www.pjrc.com/teensy/

author
TimothyJ999 made it! (author)2015-11-03

You could make this both easier and more stable by using an inexpensive telescope mount with slow-motion controls. You could use a manual mount and add stepper motors to it, or get a motorized mount and hack into the motor controls. Scope mounts have to be stable with minimal vibration and control backlash, so it would enhance the accuracy of the lidar readings without having to reinvent the wheel.

author
stoppi71 made it! (author)stoppi712015-11-03

Good idea ;-)

About This Instructable

64,571views

597favorites

License:

More by stoppi71:Multi Channel Analyzer for Gamma Spectroscopy With Arduino & Thereminoscanning laser microscope with ArduinoArduino Segway
Add instructable to: