Servers by jDrones

Terra Ranger Evo Rangefinder I2C Issues

(James Megariotis) #1

Hi Everyone,

I am having a problem with the Terra Ranger Evo 60m model. I am able to hook it up and receive valid measurements from this sensor, but it seems to interfere with almost every other I2C device on the pixhawk 2.1.

It seems that once I set the parameters to match those required for the Terra Ranger 60m rangefinder, it interferes with initialization of other I2C devices. I am currently testing this rangefinder on a pixhawk 2.1 running Copter 3.6 with a here gps unit. The strange part is, it doesn’t matter if the rangefinder sensor is plugged in, once I set the parameters, all I2C devices seem to malfunction. If I set the parameters back to normal, the errors go away regardless of whether the sensor is still plugged in. I get tons of errors displayed on the hud in mission planner. These errors include:

Error pos horiz variance
Bad compass health
EKF indicator goes red

On the messages tab, I get some pre arm messages I have never seen before including:

PreArm: gyros still settling
PreArm: Waiting for Nav Checks

Yaw does not seem to update at all while the parameters are set as such.

I have no idea what causes this. I can only assume it is an issue with the terra ranger sensor driver. It is worth noting that the same problem is also present in the Arducopter 3.5.5 firmware, but the sensor does not provide valid data.

This problem can most likely be replicated by anyone by setting the parameters to:


I have replicated this issue on multiple pixhawk 2.1 setups, but it is worth noting that they all utilized a here gps unit.

Any help or advice would be greatly appreciated.

James Megariotis

(Mateusz Sadowski) #2

Hi James!

TeraRanger Evo will not work with the default address with ArduCopter < 3.6. In all the previous versions the I2C address of TeraRanger One was hardcoded and I think changing RNGFND_ADDR did not change anything.

I’m surprised about the other issues you see though. I’ll try to reproduce them when I have a free moment.

In the mean time if you want a proper Evo support you have 3 options:

  • Easiest - install the dev version of ArduCopter - in that options the RNGND_ADDR and min and max values are supported and respected
  • Moderately difficult - you can change the Evo i2c address to match the one from TeraRanger One and use 3.5.5. The disadvantage is the minimum and maximum range values will still be the same as TeraRanger One
  • Most difficult depending on your software experience - If you want to remain on 3.5.5 you could pull the code for that version and update it with the driver from the development version.

Feel free to let me know if you have any further questions.


(Steve79) #3

Hi Mat,

can you confirm that if i buy a Teraranger Evo 60m today i can use it with pixhawk 2.1 and latest version of Copter 3.6? Is it supported in both single operation and with hub (2 or three sensors hooked to it)?

Pls reply asap, i’ve some money to burn :slight_smile:

(Steve79) #4

Hi all

bought the Evo and wired up. I have the exact same problems as James: Unit work alone only, if i unplug the GPS (HERE). If i plug the GPS unit, Pixhawk freezes 10 seconds after powering up. Either i have many EKF errors, but i think they are due to missing gps.

Also, Mission Planner shows distance under “sonar distance” only if RNGFND_ORIENT = 25 (down) otherwise it’s always 0,00

BTW i need to set it to “forward” to provide basic obstacle avoidance functionality


(James Megariotis) #5

Hey steve,

I wrote some serial drivers for this rangefinder which fixed this problem. If you are still interested, let me know and I can send you a firmware file or send you a link to some code with the drivers once i put it up on GitHub. The driver will work on any firmware version if you build it yourself.

Sorry for the late response. I haven’t been on the forums in a while.


(Steve79) #6

for sure i’m interested, github w/code would be ok. If you could build a fw to do some quick&dirty tests, it would be useful too.

Many thanks!

(Paul Atkin) #7

did you test during the normal boot what was the address assigned to the compass? it would print it in the mavproxy or in the usb console during reboot. it is either you have 2 devices that sit on the same address, or, the issue may be with i2c bus itself if it is not communicating.

damn, sorry, i did not pay attention to the last post - you fixed it? what was it?

(James Megariotis) #8

The terraranger evo supports both I2C and Serial comms. I switched from I2C to serial and wrote some serial drivers in arducopter for the terraranger evo. For this to work you would just have to rewire the rangefinder for serial comms.

The biggest problem with this rangefinder is you only get about 6 meters of range outdoors. Indoors, you can get much larger readings. I think i got up to 25 meters in our largest building. Outdoors you can only read a few meters. I spoke to a rep from terraranger, and they are aware that outdoors in direct sunlight, the max range is dramatically decreased.

(Paul Atkin) #9

i see, interesting. i did not use it before - i am set on cheaper tfmini lidar - works up to 12m, indoors or outdoors.

it also exists now in the I2C bus version, but i do not think there is a driver for I2C one yet. serial one is well supported, there are several threads about it here on this board.