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 858 times)

Gareth

  • Member
  • ****
  • Posts: 54
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: 25
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: 54
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

Fun Fact by Impala
[February 13, 2019, 11:05:01 PM]


Animabot Rev3 - Advanced Hexapod Robot by Smashley
[February 05, 2019, 03:41:50 PM]


MKS Gen L 1.0 by printergreg
[February 03, 2019, 12:41:10 PM]


Finally tried out a Chinese PCB service by Bajdi
[February 02, 2019, 08:40:49 AM]


PLX-DAQ by BaldwinK
[January 16, 2019, 06:44:18 AM]


Four Motor Leg Module by BaldwinK
[January 09, 2019, 04:55:14 PM]


Android Adware by Diegotorry
[January 08, 2019, 05:34:48 AM]


Hi, Mushroom glue here. by Diegotorry
[January 08, 2019, 05:31:52 AM]


Solid Works maker license 1 year Free!! by maelh
[January 04, 2019, 01:50:08 PM]


Merry Christmas by Protowrxs
[December 28, 2018, 11:44:25 PM]


Ultralite or flying car of sorts by Impala
[December 27, 2018, 09:30:02 PM]


Web TIme API - by Gareth
[December 07, 2018, 04:34:37 PM]


API Directory by Gareth
[December 06, 2018, 03:34:16 PM]


The Original Prusa I3 Mk3 by tinhead
[November 30, 2018, 02:49:52 PM]


Email notifications by CraigCox
[November 28, 2018, 10:26:06 PM]

* Recent Posts

Re: Fun Fact by Impala
[February 13, 2019, 11:05:01 PM]


Re: Animabot Rev3 - Advanced Hexapod Robot by Smashley
[February 05, 2019, 03:41:50 PM]


Re: MKS Gen L 1.0 by printergreg
[February 03, 2019, 12:41:10 PM]


Re: Finally tried out a Chinese PCB service by Bajdi
[February 02, 2019, 08:40:49 AM]


Finally tried out a Chinese PCB service by jscottb
[February 01, 2019, 11:26:19 AM]


Re: MKS Gen L 1.0 by jinx
[January 29, 2019, 07:31:47 AM]


Re: MKS Gen L 1.0 by printergreg
[January 26, 2019, 04:03:15 PM]


Re: MKS Gen L 1.0 by jimmyeao
[January 20, 2019, 12:15:32 PM]


Animabot Rev3 - Advanced Hexapod Robot by Nemesis
[January 17, 2019, 09:34:32 AM]


PLX-DAQ by BaldwinK
[January 16, 2019, 06:44:18 AM]


Re: Four Motor Leg Module by BaldwinK
[January 09, 2019, 04:55:14 PM]


Re: Android Adware by Diegotorry
[January 08, 2019, 05:34:48 AM]


Re: Hi, Mushroom glue here. by Diegotorry
[January 08, 2019, 05:31:52 AM]


Re: Solid Works maker license 1 year Free!! by maelh
[January 04, 2019, 01:50:08 PM]


Solid Works maker license 1 year Free!! by tinhead
[January 02, 2019, 06:15:07 AM]