More Range Finding

Well I spent ages this weekend messing about with my cute little VL53L0X time-of-flight distance sensors. Why? To get them working together, we need to set their i2c addresses to be unique – they default to 0x29. In order to do this, one needs to shutdown all sensors except the one that you want to set the address on. They have a pin to do this (XSHUT). The problem is, we’re using Lego connectors… with just 4 wires. VIN, GND, SCL and SDA. Makes them look very snazzy.

img_20170205_163925154

Unfortunately, precludes the use of XSHUT. Peter had the clever idea of setting the address of one, then adding another, setting that, and so on until all devices are added, but sadly that doesn’t seem to work. Which sort of makes sense to me, as it seems that the address setting seems to happen in some sort of broadcast mode, but Peter insists that I must be doing it wrong and once the address of the first sensor has been changed, the next address change should only go to the next added sensor. Except that practical experimentation shows this doesn’t work. One nice discovery that I did make towards the end of the weekend was that just after last weekend’s decision to interface my python to the manufacturer’s C driver code, someone else has done this already! And it’s very nice code too. Of course I spent most of the weekend wading through C code before I discovered this resource, but digging into the depths of the driver code was a good way of understanding it.

Anyway, now we need to decide what to do about setting these addresses. I’ll have a bit more of a dig through the C code to see if we really can’t do what Peter would like to do, but otherwise we’re going to need to figure out some way to connect up those XSHUT pins.

The other thing we’ve been playing with this weekend is a battery monitor – we’re using LiPo batteries, and during the week all teams received an email to say we needed to have a low battery indicator fitted if using these batteries. It’s something I wanted anyway, but this made it a priority. Looks like it’ll be pretty good. (You can see that I’m not using these batteries in the pic above. That battery is fine for coding and testing the sensors, but we need something more for the motors.)

Ho-hum. I would have liked to actually do a straight-line trial this weekend, but it didn’t happen. I could have done it with just the one sensor, so don’t really know why I didn’t… except that I got too caught up in the other issues!

Advertisements

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 )

Twitter picture

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

Facebook photo

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

Google+ photo

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

Connecting to %s