Menu

Time of Flight sensor guide

Thanks to Tej, we now have support for the Pololu time-of-flight sensor in the latest update to TAMProxy. The sensors seem pretty accurate from well past a meter down to around 25mm. They also have a narrow beam width which enables more pinpoint distance measurements.

We recommend powering the sensor off the Teensy's 3.3V pin. If you want more than 1 on your robot, you can connect a bunch of them in parallel on the same I2C bus as long as you connect each sensor's chip enable pin to another digital input pin on the Teensy. In the end, you should have connections for VIN, GND, SDA, SCL, and GPIO0/CE. See the example sketch for an example with two sensors and more details.

If you're interested in upgrading, you'll need to update the TAMProxy firmware on the teensy (a one-time operation) and update the TAMProxy-pyHost python package.

Upgrading the firmware

This can be done on either the NUC or your personal computer, but it might be easier on the NUC since the firmware is already cloned there.

  1. Clone the firmware repo from scratch or pull the latest commit if you already have it cloned (It's at Code/TAMProxy-Firmware on the NUC).
  2. If you already had a previous version cloned and compiling, you'll need to:
    • Make sure the new git submodule (the ToF sensor library) is initialized and updated
    • git submodule update --init, but if that doesn't work try git submodule add git@github.com:gkanwar/vl53l0x-arduino.git libraries/vl53l0x-arduino (adding it manually)
    • Re-copy Makefile_example to Makefile and edit the Makefile to specify the teensy version
      • TEENSY = 35 on line 5
    • Re-copy src/config_example_teensy35.h to src/config.h
    • If you are cloning from scratch, the steps are similar but it's easiest to follow the Quick Start instructions on the github page README
  3. With the repo as your working directory in a terminal, run make
  4. Then run make upload

If you're fairly new to git, these instructions may be a bit confusing, so definitely ask the staff if you have any questions. The main reason for the changes is that we're adding an Arduino library for the sensor as a dependency, which affects the compilation toolchain.

Alternate, simpler way to upgrade the firmware

  1. Download the lates precompiled firmware from the repository's releases page (the .hex file).
  2. Then, with the Teensy Loader application open (appears whenever you program the teensy through the Arduino IDE) open the .hex file and program the Teensy manually through the Teensy Loader

Upgrading the TAMProxy-pyHost

This should be done on the NUC for sure since it's what will command the Teensy during competition. Can also be done on your personal computer.

  1. Navigate to Code/TAMProxy-pyHost on the terminal, where the repo is already cloned
  2. Pull the latest commits from master: git pull
  3. If you're using the tamproxy package installed through pip, update the installation with pip install -e . (note the period)
  4. Try running the tof_read.py sketch to confirm the pyHost is working with the updated firmware.