VL6180X ToF range sensor - how to have several chips on the same I2C bus
Erlend
Posts: 612
Finally I have built and tested a simple way of having serval VL6081s on the same bus. The chip comes with the address set to hex29, but the address is reprogrammable - BUT it looses any new address when power is lost. So this makes it awkward to have many chips on the same bus. I came up with the idea to utilize the chip's GPIO0 which when held low prevents the chip from booting. My scheme is to connect the several chips (tested with 3) to the bus, where each chip has it's GPIO0 (boot pin) connected high through a 47k and low through a capacitor, forming an RC time delay circuit. If each chip has a different value capacitor, the time to boot will be different for each chip, and therefore the time before the chips comes 'online' on the bus and responds to a call. To take advantage of this, there is a code running which repeatadly looks for a chip answering on the default address (29) and then writes a new address to this chip, then continues calling for the next one to come 'online', and so forth. After this sequence every chip has gotten a new individual address on the bus. Problem solved. In order to make this a bit more practical and controllable I have chosen to instead tie all the GPIO0s to one Prop PIN through diodes, such that this pin tie them all low until the scan-and-readdress code is ready to run.
I need to polish up my VL6180Driver.spin before I am ready to share.
Erlend
DIRA[PINpwr]:= 0 REPEAT UNTIL tries > 1000 OR (NewAddr > ChipAddr + 10) IF bus.ReadChipA16(ChipAddr, $00, bus#NAK) bus.WriteChipA16(ChipAddr, $212, NewAddr) pst.Str(String("New address (HEX):")) pst.Hex(NewAddr, 4) pst.Chars(pst#NL, 2) NewAddr++ tries++
I need to polish up my VL6180Driver.spin before I am ready to share.
Erlend
Comments
Erlend