Obstacle avoidance

If you don’t know where you are going, any road will take you there

George Harrison

Now, for obstacle avoidance there are (for me) two possibilities. Sonar sensors (as I often use for my Robogals Workshops) or Lasers. Thanks to Pi Wars peers… I just discovered a nice and cute little ToF sensor that uses Pew Pew lasers at @Pimoroni: VL53L1X.

The VL53L1X ToF sensor

For me (used to build huge industrial robots) it is amazing to have a such an accuracy for distance measurement with this tiny sensor. I love it… and when conecting only one to the PI, is pretty straight forward using the libraries for it. The problem started when trying to use 3 (maybe 4, I haven’t decided yet) ToF sensors at the same time as they have the same I2C address. Furthermore, the Raspberry Pi only have one available port and although you can convert normal BCM pins to host I2C, I’ll still be short as motors and PanTiltHat also use I2C.

One problem at the time… I forgot to say in last post that motors and PanTiltHat have (unfortunately) the same I2C address as well 0x15, but since I am using the Thunderborg controller for the motors it was possible (and actually pretty easy) to change the I2C address in case of using several boards. So, problem solved for the first part (changed to 0a)… But with 3 ToF sensors that have as well same I2C address, I needed a multiplexer (MUX).

TCA9548A

I found that the most used one is the TCA9548A from Adafruit (also called I2C expander), with which it is possible to have up to 8 different devices. The MUX have the 0x70 address and the ToF sensor 0x29. First test, just one sensor on the MUX, it literally took me three days (and nights) to figure it out how to get it to see the address for the ToF. I was not able to see the I2C address for the ToF, only for the MUX (see image 1 below). Apparently, I wasn’t “opening” the “gate” properly for the MUX to see the sensor. Once its done, the rest is pretty straight forward. Only thing to take into consideration is that it is not possible to range the three sensors at the “same” time, but kind of “switching” in between them as they kept the same address. So, second problem solved.

This sensors will be really usefull for the Canyons of Mars challenge, allowing to keep the robot within boundaries (hopefully centric). A 6DoF sensor (which is also I2C) will be use to keep turns within the right angle. Furthermore, hopefully with the camera, the robot will be able to find the little green aliens to keep on track!

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s