collapse

Welcome!



Welcome to Robot Rebels, an online robot maker community.

Register today to post your projects, ask questions, share knowledge and meet like-minded people from around the world.


The RobotRebel.org Community

Author Topic: Double_ing up the "Time of Flight" sensors  (Read 99 times)

Gareth

  • Member
  • ****
  • Posts: 52
Double_ing up the "Time of Flight" sensors
« on: November 07, 2018, 03:42:30 AM »


Two is better than one...... (or 4 or 8 etcetcetc).

Following successful experiments with 1 single Time of Flight distance sensor mounted to Stepper, watching the scan process its seems to lend its self to setting the scan to just 180° and mount two sensors back to back to extract the whole 360°...... (or 90° scan with 4 sensors, hope you see where I am going with this :-)

Generally I2C devices come with a fixed address, so doubling up the same I2C animals with the same I2C address is not possible...... unless Slave address's are implemented.

The VL53LOX sensor has a trick up its sleeve ... the "XSHUT" pin   (aka... reset pin!).

#include <Wire.h>
#include <VL53L0X.h>

#define XSHUT1 4
#define XSHUT2 5

#define TOF1_I2Caddress 41
#define TOF2_I2Caddress 42

VL53L0X TOF1;
VL53L0X TOF2;

void setup()
{
  Serial.begin(115200);
  Wire.begin(21,23);
  pinMode(XSHUT1, OUTPUT);  pinMode(XSHUT2, OUTPUT);

// the magic part happens here .....
  TOF1.setAddress(TOF1_I2Caddress); pinMode(XSHUT1, INPUT); delay(10);
  TOF2.setAddress(TOF2_I2Caddress); pinMode(XSHUT2, INPUT); delay(10);
 
  TOF1.init(); TOF1.startContinuous(); 
  TOF2.init(); TOF2.startContinuous();
}

void loop()
{
  Serial.print(TOF1.readRangeContinuousMillimeters());
  Serial.print(':');
  Serial.println(TOF2.readRangeContinuousMillimeters());
}

During runtime it is possible to slip any address you wish to each individual sensor.

The TOF comes with a default I2C address of 00101001BIN

The above code is generic so if you have multiple TOF's then the code is easily expanded.....

If you are just using 2 TOF's the simplified code can be used below due to one TOF defaulting to address 41 :-

#include <Wire.h>
#include <VL53L0X.h>

#define XSHUT2 5

// no need to program I2C address of TOF1 as it defaults to 41 anyways \ö/
#define TOF2_I2Caddress 42

VL53L0X TOF1;
VL53L0X TOF2;

void setup()
{
  Serial.begin(115200);
  Wire.begin(21,23);
  pinMode(XSHUT2, OUTPUT);
 
  TOF2.setAddress(TOF2_I2Caddress); pinMode(XSHUT2, INPUT); delay(10);
 
  TOF1.init(); TOF1.startContinuous(); 
  TOF2.init(); TOF2.startContinuous();
}
void loop()
{
  Serial.print(TOF1.readRangeContinuousMillimeters());
  Serial.print(':');
  Serial.println(TOF2.readRangeContinuousMillimeters());
}


My stepper has a hollow spindle shaft... 5 wires will pass easily through... a 360° rotation would screw the wires up... a 180° rotation would only half screw the wires up... however a 90° rotation would be even better... (i.e. eliminating need for WiFi/BlueTooth OTA data transfer ...FlyByWire becomes an interesting solution again).

maelh

  • Member
  • ****
  • m
  • Posts: 24
Re: Double_ing up the "Time of Flight" sensors
« Reply #1 on: November 11, 2018, 05:22:23 AM »
Nice! I also got a couple of theses sensors a couple weeks ago. I have yet to solder the pins on and use them.
To create a point cloud I think a Intel Realsense would be better.

Curious to see where you go with this!

P.S.: You could use a slip ring instead of a wireless connection.
« Last Edit: November 11, 2018, 05:57:46 AM by maelh »

Gareth

  • Member
  • ****
  • Posts: 52
Re: Double_ing up the "Time of Flight" sensors
« Reply #2 on: November 13, 2018, 04:05:02 AM »
P.S.: You could use a slip ring instead of a wireless connection.
ermmm 100% no  :P
As this project started with the idea of Cost effective LIDAR  (with my aversion to having a slipped disk)......
evolution went so :-
LIDAR with Hollow shaft Stepper     Workio
LIDAR with WIFI Mesh                    Workio slow unstable                   (trashed)
LIDAR with Bluetooth                     Workio Slow solid                        (trashed)
LIDAR 360° Wired Ping-pong style  Workio Fast however twisty wires   (trashed)
LIDAR*2 180° Wired Ping-pong      Workio Fast                                 (Current)

 

* Search


* Recent Topics

Time of Flight >>> Rounded Corners !!! by Gareth
[November 15, 2018, 03:21:51 PM]


Double_ing up the "Time of Flight" sensors by Gareth
[November 13, 2018, 04:05:02 AM]


Point cloud anyone !!! maybe 3D scanner by maelh
[November 11, 2018, 05:38:33 AM]


removable magnetic print surface by Gareth
[November 09, 2018, 10:53:45 AM]


Robot Cop by Valeriex
[November 07, 2018, 05:48:20 AM]


it's lukeyes by Valeriex
[November 07, 2018, 05:47:16 AM]


TOF gets a local DEBUG screen by Gareth
[November 07, 2018, 03:47:29 AM]


BlueTooth elves choose "BlueTeeth" by Gareth
[November 07, 2018, 03:40:19 AM]


Yup, it is me... ...CtC by ZeroMax
[November 05, 2018, 07:14:09 PM]


Four Motor Leg Module by DWRobotics
[November 04, 2018, 05:15:49 PM]


MKS Gen L 1.0 by terragady
[November 02, 2018, 12:15:09 PM]


Do you think he pushed the train in the last lap, G? by Gareth
[November 01, 2018, 05:57:58 PM]


IBM buys Red Hat by jinx
[October 30, 2018, 04:09:07 AM]


QTC - quantum tunneling composite. Can we make our own sensors? by OddBot
[October 27, 2018, 02:14:52 PM]


[ Firmware ] Klipper - the cool firmware for 3d Printers by tinhead
[October 03, 2018, 12:29:14 PM]

* Recent Posts

Re: Time of Flight >>> Rounded Corners !!! by Gareth
[November 15, 2018, 03:21:51 PM]


Re: Time of Flight >>> Rounded Corners !!! by Gareth
[November 15, 2018, 03:13:11 PM]


Re: Time of Flight >>> Rounded Corners !!! by MEgg
[November 14, 2018, 06:26:08 PM]


Re: Time of Flight >>> Rounded Corners !!! by MEgg
[November 14, 2018, 05:57:24 PM]


Re: Time of Flight >>> Rounded Corners !!! by Gareth
[November 13, 2018, 04:07:31 AM]


Re: Double_ing up the "Time of Flight" sensors by Gareth
[November 13, 2018, 04:05:02 AM]


Re: Time of Flight >>> Rounded Corners !!! by Gareth
[November 13, 2018, 03:53:46 AM]


Re: Time of Flight >>> Rounded Corners !!! by Gareth
[November 13, 2018, 03:45:41 AM]


Re: Time of Flight >>> Rounded Corners !!! by MEgg
[November 12, 2018, 01:01:49 PM]


Re: Point cloud anyone !!! maybe 3D scanner by maelh
[November 11, 2018, 05:38:33 AM]


Re: Time of Flight >>> Rounded Corners !!! by maelh
[November 11, 2018, 05:25:15 AM]


Re: Double_ing up the "Time of Flight" sensors by maelh
[November 11, 2018, 05:22:23 AM]


Re: removable magnetic print surface by Gareth
[November 09, 2018, 10:53:45 AM]


Re: Robot Cop by Valeriex
[November 07, 2018, 05:48:20 AM]


Re: it's lukeyes by Valeriex
[November 07, 2018, 05:47:16 AM]