TeraRanger One User manual

Copyright©Terabee2016
Installation and Operation Manual
Firmware 4.0.0 STD
Technical Specifications:
Principle:
Infrared Time‐of‐Flight (ToF)
Range:
Up to 14m indoors (At least 5 to 6m in sunlight)
Update rate:
1000Hz in fast mode (Up to 600Hz in precision mode)
Range resolution:
0.5cm
Accuracy:
± 4cm in precision mode
Field of view:
3º
Supply voltage:
12V DC recommended (10 to 20V DC accepted)
Supply current:
50mA average (110mA peak @12V)
Interfaces:
UART, +5V level, up to 115200,8,N,1. (Factory default when shipped)
TWI (I2C compatible) +5V level (Firmware available on request)
Connector:
15 pin DF13 (open‐ended cable provided)
Weight:
8g (Spider) or 10g (Box)
Terabee Website:
90 Rue Henri Fabre Technical support:
01630 Saint‐Genis‐Pouilly Commercial:

Copyright©Terabee2016
Safety Notes
The TeraRanger One is eyesafe in all conditions, including system failure. However,
please keep a minimum of 20cm distance from your eye when handling the sensor
underpoweranddonotlookintotheLEDswithanykindofopticalinstruments.
Table of Contents
1 AbouttheTeraRangerOne
1.1 InsidethePackage
1.2 USBadapter
1.3 DimensionsandMounting
1.4 AbouttheConnector
1.5 UARTDataInterface
1.6 TWI(I2C)DataInterface
1.7 USBInterface
1.8 DetailsonSupplyVoltage
2 ConnectingtheTeraRangerOneUsingaComputerWithaSerialConsole
2.1 Windows
2.2 MacOS
2.3 Linux
3 RunningtheTeraRangerOneinROS
4 OperatingModes
5 PrintoutModes
6 FlashingFirmware
Terabee Website:
90 Rue Henri Fabre Technical support:
01630 Saint‐Genis‐Pouilly Commercial:

Copyright©Terabee2016
1 About the TeraRanger One
1.1 Inside the Package
YouwillreceivethefollowingitemswhenpurchasingaTeraRangerOne:
● afullyassembledandcalibratedsensor
● aconnectorcablewithopenendsthatcanbesolderedtoyourdevice
1.2 USB adapter
An optional USB adapter is available for simple plug & play connection to a PC or MAC. The
USB adapter provides power to the sensor and data transfer to and from the sensor. It is
idealforevaluationandtestingandformakingfirmwareupdatestothesensor.
TheUSBadaptercanbepurchasedat:
http://www.teraranger.com/product/terarangerusbadapter/
If you have purchased a USB adapter in addition to
your TeraRanger One, you will also receive the
followingitems:
● theUSBadapterboard
● aconnectorcablethatconnectsyourUSB
adapterboardtoyourTeraRangerOne
● aMiniUSBcablethatconnectstheUSB
adapterboardtoyourcomputer
Terabee Website:
90 Rue Henri Fabre Technical support:
01630 Saint‐Genis‐Pouilly Commercial:

Copyright©Terabee2016
1.3 Dimensions and Mounting
The TeraRanger One provides three mounting holes, which are designed for M2.5 screws.
The individual distances between the holes are shown in the following figure which is valid
for the box and spider design of the yellow outer plastic
part. Moreover, the following aspects should be taken into
considerationwhenmountingtheTeraRangerOne:
● Do not remove the plastic cover as this will misalign the
opticsanddegradethesensor’sperformance
● MounttheTeraRangerOneinawellventilatedlocation
● Take the usual precautions for sensitive electronics
such as maintaining a suitable distance to strong electric
and magnetic fields, strong radio emitters, strong heat
sources,etc.
1.4 About the Connector
The TeraRanger One connects to your equipment using a 15pin connector of the Hirose
DF13 series. (The part number of the corresponding female connector is DF1315S1.25C.)
The cable assembly delivered with the TeraRanger One comes with six wires installed:
Ground (GND, pin 1 and 15), positive supply voltage (Vcc, pin 14), UART receive (RXD, pin
12)*, UART transmit (TXD, pin 13)* and reset (pin 7) . Please use the following image and
tabletoidentifythepins:
Pin Function
15 GND
14 Vcc(10V,accepts1020V)
13 Serialout(TXD),5Vlevel
12 Serialin(RXD),5Vlevel
11 TWI**SDA
10 TWI**SCL
9 UserI/O1
8 UserI/O2
7 Arduinocompatibleresetin(toDTR)
6 Resetin(pulltoGNDtoreset)
5 MOSI(forSPIorflashing)
4 MISO(forSPIorflashing)
3 SCLK(forSPIorflashing)
2 +5Vout(useonlytoprovidevoltagelevelstoprogrammingdevices,max.10mA!)
1 GND
Terabee Website:
90 Rue Henri Fabre Technical support:
01630 Saint‐Genis‐Pouilly Commercial:

Copyright©Terabee2016
Note:
● Once connected, DF13 connectors are very reliable and are perfect for robotics and
drone environments where vibrations are common. However, these connectors are
not made for infinite plugging and unplugging. If you need to plug and unplug the
sensorsfrequently,consideraddingamoresuitableconnectorinline.
● Please do not apply shear forces to the connector when pushing it in the socket.
Ideally, press the socket down to the PCB with your thumb and push the connector in
with your other hand. Do not use tools like pliers etc.! You can find good instruction
videosonDF13pluggingandunpluggingonYouTube.
● Additional cables can be purchased from the TeraRanger website or your preferred
TeraRangerreseller.
● Please follow basic rules on ESD*** safety when connecting and touching the
TeraRangerOne!
● DonotapplyforcetotheTeraRangerOnePCBwhilehandlingandinstallingit.
● Do not plug or unplug the sensor under power. Hot plugging and unplugging may
damagethesensor.
*UARTisthedefaultinterface
**TWI(I2Ccompatible)issupportedbyflashingourI2Cfirmware(availableonrequest)tothesensor
***Seeforexamplehttp://en.wikipedia.org/wiki/Electrostatic_discharge
Terabee Website:
90 Rue Henri Fabre Technical support:
01630 Saint‐Genis‐Pouilly Commercial:

Copyright©Terabee2016
1.5 UART Data Interface
The default interface is UART on pins 12 and 13. It needs an input voltage level of 5V (logic
high) to run reliably, the output voltage level is 5V. Please use a serial to USB interface (e.g.
FTDI breakout boards or the TeraRanger USB adapter) to connect the TeraRanger One to
your PC. DO NOT connect the TeraRanger One to a real RS232 port of a PC, the voltage
levelsaredifferentandmightdestroythesensor’selectronics.
The UART is configured to send and receive at 115200 bit/s, 8 data bits, no parity bit and
onestopbit(1152008N1).
To transfer data, select one of the operating modes and printout modes that are explained in
chapters4and5inthismanual.
1.6 TWI (I2C) Data Interface
Another way to connect to your TeraRanger One is the TWI (or better known as NXPs I2C)
interface. Using this interface, you can connect multiple TeraRanger Ones to a TWI master
on the same bus. The TWI mode offers external triggering of a measurement via the bus to
exclude crosstalk, allowing the use of multiple TeraRanger Ones at the same time. Please
keep in mind that the TeraRanger One has a relatively narrow field of view. Hence, multiple
TeraRanger Ones looking into opposite or perpendicular directions can be triggered at the
sametime,allowingasignificantlyincreasedreadoutspeed!
Please refer to chapter 1.4 for the the electrical connections to be made for using TWI. The
signal levels are 5V, the maximum bus speed is 100kHz and the pullup resistors (10kOhms)
are already integrated in the TeraRanger One. If you have a 3.3V system as TWI master,
you can try a direct connection if the inputs of your system are 5V tolerant. This configuration
can work, but we do not recommend it since it is not reliable. An I2C adapter for reliable
voltageleveltranslation is available from our website at:
http://www.teraranger.com/product/terarangeri2cadapter/.
To prepare the TeraRanger One for TWI operation: Please email [email protected],
mention the serial number of your sensor and specify which TWI base address you need.
Multiple addresses are possible if you want to use more than one TeraRanger One on the
same TWI bus. We will then send you the new firmware with I2C and all the necessary
operating instructions. Once you have the firmware file, please upload it to the TeraRanger
Oneasdescribedinchapter6ofthismanual.
In addition you have the option to purchase the TeraRanger Hub. This accessory board
allows you to connect up to eight TeraRanger One sensors and read the data from the
Terabee Website:
90 Rue Henri Fabre Technical support:
01630 Saint‐Genis‐Pouilly Commercial:

Copyright©Terabee2016
sensors via a single serial or USB link. See more at:
http://www.teraranger.com/products/terarangerhub/
1.7 USB Interface
If you have purchased the TeraRanger One USB adapter, you can directly connect the
TeraRanger One to your PC without the need of any additional power supply. In most
modern operating systems, a driver for this interface is already present and the interface will
appear as an FTDI virtual COM port to which you can connect using the settings that were
previouslymentionedinthesubchapterDataInterface.
In case your computer asks you to provide a driver, please download the driver for your
operating system from http://www.ftdichip.com/Drivers/VCP.htm and follow the installer. After
successful installation, unplug the interface for a moment and plug it back in. The virtual
COMportshouldnowbeavailableonyourPC.
Note: Do not plug/unplug the TeraRanger One from the USB interface while the device is
powered,disconnecttheUSBplugfromthePCfirst!
1.8 Details on Supply Voltage
TeraRanger One works with clean, spike and interruption free voltages ranging from 10V to
20V and has an internal voltage regulator for optimal performance. However, to minimise
unnecessary heating, we advise the use of a preregulator down to 12V, and ideally 10V. For
optimal efficiency, this should be a switching regulator (either buck or boost, depending on
thesupplyvoltageavailableonyoursystem)withalargeoutputcapacitorandgoodfiltering.
TeraRanger One is equipped with a safety shutdown to prevent damage from excessive
currents or board temperatures arising from eventual internal failures due to incorrect
mounting, misuse or externally provoked shortcircuits. In case of shutdown triggering, the
sensor resets automatically after reaching normal working conditions and a power cycle of
theexternalpowersupply.
Terabee Website:
90 Rue Henri Fabre Technical support:
01630 Saint‐Genis‐Pouilly Commercial:

Copyright©Terabee2016
2 Connecting the TeraRanger One Using a Computer With a
Serial Console
Your TeraRanger One can interact with any serial console using the following configuration:
115200bit/s,8databits,noparitybitandonestopbit.
2.1 Windows
InWindowsyoucanuseterminalemulationsoftware.WetypicallyuseHTerm.Ifyoudonot
alreadyhaveterminalsoftwaredownloadHTermfromthislink:
http://www.derhammer.info/terminalbeforepluggingintheTeraRangerOneintoyourUSB
portviatheTeraRangerUSBadaptor.
Extractthedownloadedzipfiletothefolderofyourchoice,openitanddoubleclickonthe
“HTerm.exe”document.
NowconnecttheTeraRangerOnetoyourcomputerviatheUSBadaptor.Inordertoselect
theUSBportonwhichtheTeraRangerOneisplugged,refreshtheportlistbyclickingonthe
“R”buttonasshownonthefollowingimage:
Onceyouhaveselectedtheport,clickonthe“Connect”button.
Thedatawillnowappearinthe“Receiveddata”box.
Toshowthedatain“Text”mode,(asshownabove)simplytype“T”inthe“Type”box.For
Binarymode,type“B”.
If you want to change the sensors measurement mode type in the type box: “F” for the fast
mode; “P” for the precision mode. In order to stop measurements simply press the
disconnectbuttoninHTermandthenunplugtheUSBcable.
Terabee Website:
90 Rue Henri Fabre Technical support:
01630 Saint‐Genis‐Pouilly Commercial:

Copyright©Terabee2016
2.2 MacOS
WithMacOS,whenyouconnecttheTeraRangerOnetoyourcomputerthroughtheUSB
adaptor,youwillbeabletouseitthroughyourcomputer’s“Terminal”Application.
Tofindthisapplicationgoto:
Applications>Utilities>Terminal
Youcannowclickontheitemtoentertheterminalandsettheappropriatereadingsettings
bycopyandpastingthisfirstcommandtothepage:
ls/dev/tty.*
ThiscommandwilltelltheterminaltoshowtheUSBdevice’snamethatwillbeusedto
acquiredistancedatafromyourTeraRangerOne.
Example:/dev/cu.usbserialXXXXXXXXX(TheX’swillhaveyourUSBport’sname)
Onceyouhavefoundthis,enterthefollowingcodetothenextline:
MAC:screen/dev/cu.usbserialXXXXXXXX115200(ReplacetheX’swithyourUSB
port’sname)
ThedistancedatawillnowappearontheterminalinBinarymodeandwilllooklikethis:
PressthecommandsShift+Ttoswitchfrombinarymodetotextmode.Thiswilldisplaythe
distancevaluesinmillimeters,asfollows:
Terabee Website:
90 Rue Henri Fabre Technical support:
01630 Saint‐Genis‐Pouilly Commercial:

Copyright©Terabee2016
Tochangethesensorfromitsfastmodetoitsprecisionmode,press:
Shift+Ffor“FastMode”
Shift+Pfor“PrecisionMode”
OnceyouarefinishedusingyourTeraRangerOneandwanttostopthedatameasurement,
press:
Ctrl+AthenK
2.3 Linux
Linux,itisverysimilartoMacOSandalsoworkswithterminal.
Openaterminal(shortcut:ctrl+alt+t):
type:ls/dev/tty*
Usuallythenameis/dev/ttyUSB0butitcanalsobettyUSB1,ttyUSB2,etc…
Inordertoviewthedatastreamfromtheteraranger,type:
screen/dev/ttyXXX115200(replacettyXXXwiththecorrectserialdevicelike
ttyUSB0)
Toseedifferentoperatingmodes,refertotheMacOSsection.Thecommandsarethe
same.
Terabee Website:
90 Rue Henri Fabre Technical support:
01630 Saint‐Genis‐Pouilly Commercial:

Copyright©Terabee2016
3 Running the TeraRanger One in ROS
We provide a ROS (Robot Operating System, http://www.ros.org) node which provides a
topic to access the TeraRanger One data stream. Please note that the sensor has to be
configuredtoworkinBinarymode
.YoucandownloadtheROSnodefrom:
https://github.com/Terabee/TeraRanger_oneROSpackage/tree/master/teraranger_one
TousetheROSnodeyouneedto:
1. CreateaROSWorkspace
2. Copythenodeterarangeronepackageintotheworkspacesrcdirectory
3. Compileusing:catkin_make
4. Runusing:rosrunterarangeroneterarangerone_node_portname:=/dev/ttyUSB0
Note: Remember to execute the daemon roscore before running the rosrun command and
changetheUSBporttotheappropriateone!
Terabee Website:
90 Rue Henri Fabre Technical support:
01630 Saint‐Genis‐Pouilly Commercial:

Copyright©Terabee2016
4 Operating Modes
Two operating modes can be selected by sending the corresponding uppercase character to
the TeraRanger One via the serial port. In TWI mode, the sensor is in precise mode by
defaultandcannotbechangedforthemoment:
P
Precise
mode
TheTeraRangerOneadaptsitsinternalparameterstoachievebest
accuracy. NB: this function can reduce measurement repetition rates and
thusreactiontimes.
F
Fastmode
This mode ensures the fastest measurement repetition rate and reaction
time,eveniftheaccuracyofthereadingsisdecreased.
There is the potential for more operating modes to be implemented in future firmware
versions.Ifyouhavesuggestions,pleasecontactuson[email protected].
Terabee Website:
90 Rue Henri Fabre Technical support:
01630 Saint‐Genis‐Pouilly Commercial:

Copyright©Terabee2016
5 Printout Modes
Two printout modes can be selected by sending the corresponding uppercase character to
theTeraRangerOne:
T
Textmode
The distance information is a message of four to six bytes followed by a
carriage return character and a newline character: xxxxx\r\n. This message
corresponds to the measured value in millimeters. Please be aware that
there is no zeropadding for leading zeros! If the TeraRanger One is unable
to measure a distance, it will output 1\r\n as an error message. Valid
measurementsaredecimalandbetween200\r
\nand14000\r
\n.
B
Binary
mode
The distance information is a message of exactly 4 bytes, the header is the
character T (84 decimal/ 0x54 hex) followed by two bytes for the distance
value in millimeters and message (first three bytes including the T)
checksum CRC8 byte at the end. If the TeraRanger One is unable to
measure a distance, it will output T00CRC (both distance bytes set to zero)
asanerrormessage.Validoutputsarefrom200decimalto14000decimal.
Please note that the default mode is binary. If you need any other output format, speed or
protocol,pleasecontactuson[email protected].
Terabee Website:
90 Rue Henri Fabre Technical support:
01630 Saint‐Genis‐Pouilly Commercial:

Copyright©Terabee2016
6 Flashing Firmware
The sensor includes an Atmel ATmega328 MCU, which can be updated using “avrdude” as
part of the firmware bundle. Please follow the instructions below to update the TeraRanger
One’sfirmware:
1. Ensure you have the flashing tool for your operating system. You can download this
from http://www.teraranger.com/support. Please make sure that you use the avrdude
versionprovidedinthefirmwareupdatebundle(Version5.1.1)!
2. Uncompressthebundlesandmakesurethatallthefilesareinthesamedirectory
3. Runthefollowingcommands:
● MacOS/Linux
cdDIRECTORY_WHERE_YOU_DECOMPRESSED_BUNDLE[Enter]
./avrdudeCavrdude.confpm328pP/dev/ttyXXXb57600D
Uflash:w:TROne.VERSION.hex[Enter]
NB:(1)replacettyXXXwiththenameoftheUSBSerialdevice
(Linux:ttyUSBx,MacOS:tty.usbserialxxxxxxxx)
(2)TROne.VERSION.hexisthenameofthefirmwarefileyou
havereceived
● Windows
Fromstartmenuwrite“cmd”inthe“SearchProgramsandFiles”
cdDIRECTORY_WHERE_YOU_DECOMPRESSED_BUNDLE[Enter]
avrdudeCavrdude.confpm328pP\\.\COMxb57600
DUflash:w:TROne.VERSION.hex[Enter]
NB:(1)replaceCOMxwiththenameoftheUSBSerialdevice(tolistavailable
COMgoto“DeviceManager”andcheck“Ports(COM&LPT)”
(2)TROne.VERSION.hexisthenameofthefirmwarefile
youhavedownloaded
Terabee Website:
90 Rue Henri Fabre Technical support:
01630 Saint‐Genis‐Pouilly Commercial:
Table of contents