# erniejunior/UT390B_Arduino_Library

An Arduino library to interface with the cheap UT390B Laser Distance Meter
C++
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Type Name Latest commit message Commit time
Failed to load latest commit information.
examples Aug 19, 2015
.gitignore
UT390B.h
keywords.txt Apr 10, 2015

# UT390B Laser Distance Meter Library for Arduino

This is a library to interface with the cheap but good UT390B Laser Distance Meter using an Arduino. It supports simple blocking measurements and more advanced asynchronous measurements for time critical projects. It is based mostly on information gathered from this blog post and its two follo ups.

## Installation

To install the library just download the .zip file and look here for further instructions. You can also just clone this git repository into you libraries folder:

```cd <yoursketchbook>/libraries/
git clone https://github.com/erniejunior/UT390B_Arduino_Library.git```

After a restart of the arduino IDE you are done!

## Usage

Just have a look at the two examples. They are fairly self explaining.

## Connecting to an Arduino

Be aware, that the UT390B runs at 2.7V. A 5V Arduino or even a 3.3V would fry it when connected directly. Actually somebody else had trouble getting it to work with 3.3V at all. This is how I connected mine to a 5V Arduino:

• The 2.7V can be left free.
• The 2.7V of TX at the UT390B are just enough to trigger a logical 1 at the Arduinos RX. Therefore it can be connected directly.
• The 5V of the TX at the Arduino would fry our UT390B. Therefore we use a simple voltage divider with two equal, high resistors, to step down the TX voltage coming from the arduino to 2.5V which is enough to trigger a logical 1 at the UT390B side. I would recommend a rather high resitance (around 10kΩ) but mainly make sure that R1 and R2 have the same resistance.
• Check here to find out where the RX, TX and GND pins are on the UT390B.
• When you connect something to the main RX, TX pins, you can not use Serial any more for debuggin/sending data to the computer. I therefore recommend an Arduino with more than one hardware serial (like the mega). Unfortunately I remember having trouble with software serial. Therefore this library does not support it.

## Possible Improvements

You can’t perform that action at this time.