Last weekend we got the sensors mounted and tested, but if you read that post, you will have seen the mess of leads connecting up to the I2C pins via a breadboard. And those of you who looked carefully may have noticed that in fact only four of the five sensors were actually connected. (Due to the breadboard strips being five pins wide, and me being too lazy to add jumpers to another row.) Last year we did just connect all the I2C sensors via a breadboard (with jumpers to another row), but this year I wanted something a bit more elegant, so I decided to create a loom.
Each of the ToF sensors has 6 pins, but we’re only using 5 of them. Four are common to all of them (VCC, GND, SDA and SCL), while the fifth has to connect to a different GPIO pin on the Pi for each sensor. (This is used to trigger the sensor to accept a new I2C address. If I didn’t do this, all sensors would have the same address, leading to problems!) I decided to daisy-chain the four common pins in a loom, and use separate jumpers for the control pins. There’s a couple of reasons for this: I just happen to have some fine-gauge wire in four colours, and I’ve got a bunch of existing jumpers (which have much thicker wire) in a range of different colours. In order to connect two wires to a single dupont connector, they need to be fine – I tried doing it with 20awg wire, and it was just too thick. The wire I have is 26awg and only just fits a pair in a connector.
To keep the wires neat, I threaded them through some heat shrink. At this stage I haven’t applied heat, and I’m not sure if I will, because its’s already looking pretty tidy
Ultimately I’m not sure what I’ll do about the control wires… maybe they should go through the loom, because as it is it’s still a bit of a mess. Alternatively, if I trim the wires a bit, making them a good fit rather than the standard length, maybe that will be enough to tidy it up. As it is though, it turns the above into a bit of a mess again:
Nothing like as bad as it was last week, but still lacking some elegance.
The next step of course was to test. I knew from my tests last week that the sensors were working, so I had fingers crossed that they still would with the new loom. Actually, there was a correction needed before this – did you spot it? (Try to spot a difference in wiring between the previous two pictures.)
The correction? Well, VL53L0X sensors come in a range of different packages. We’ve used them for three years now, but used different versions in each of the previous two years. Last year’s version, which we’re reusing this year, have this pin order: VCC, GND, SCL, SDA, GPIO1, XSHUT. The previous year’s sensors had seven pins, which were: VDD VIN, GND, SDA, SCL, XSHUT, GPIO1. Other variants exist… Well, for some reason, I had it in my head that the order had VCC followed by either SDA/SCL (couldn’t remember the order), then GND. So my original wiring had blue and yellow wires bracketed by red and black. It was only when I went to wire up the header for the Pi, where it was important that SDA and SCL were in the right order, that I realised my mistake. Now, colour conventions are just that… it wouldn’t really matter if I used blue for ground and black for SDA, but there’s something about my psyche that just won’t let that happen. So I re-did all of the sockets to put the black wire in the right place!
But anyway, back to testing. Well, the first thing I had to do was add a fifth sensor to my test code, because as I said, last week I only tested four at any given time. Do you want to know the lovely thing? It just worked 😁