Changing I2C Addresses with Code

I'm trying to connect multiple SparkFun Qwiic MicroPressure Sensors but I need to permanently change the slave I2C addresses of the sensors. How would I go about changing them?

It looks like the I2C address for the sensor is fixed. See the data sheet page 14.

You may need to use an I2C multiplexer.

Yes, they are fixed, but there are many different I2C addresses based on the Honeywell part number. Guess you need to specify the part number when you order.
Paul

Looking at the documentation, the SparkFun board uses a Honeywell pressure sensor that is available in 8 different I2C addresses or SPI. However SparkFun only sells it with one of the sensors. You need an I2C switch, TCA9548, to solve the problem but you lose out on the convenience of being able to daisy chain everything.

I'm trying to use a Teensy 4.1 for this project, are there any I2C multiplexers which can be used with it? I seem to only be finding arduino multiplexers.

I2C is the same for Teensy as Arduio, I believe.

Can the need for a multiplexer be worked around by using SPI for one of the sensors and separate I2C buses on the Teensy to interact with the sensors?

Do those sensors come in SPI interface? You cannot just hook an I2C sensor up the SPI and expect it to work.

Does the Teensy have more than one I2C bus?

The Teensy has 3 I2C buses and the sensor has a SPI layout on data sheet page 7.

Here's the pin layout.

I think that the sensor would have to be ordered with the SPI interface.

I think it might be able to use both based on this schematic.

According to the schematic of the Sparkfun board, it almost seems as if the SPI bus can be used. However, the SS and MISO are not available on the board, so you can't use them.

According to the datasheet, the sensor has to be ordered with either the SPI bus or one of eight I2C addresses. That means the sensor can not do both. That is confirmed in the rest of the datasheet where they write about a "SPI sensor" and "I2C sensor" as two different things.

If you have three of those sensors and you can use all three of the Teensy 4.1 I2C busses, then it will work.
If you have more than three sensors, then do as everyone does: use a I2C multiplexer, as mentioned already. There is no other way, there is no smart trick.
There is a possibility to use a software I2C bus. Most of the Software I2C libraries allow to use multiple I2C buses.

The easiest solution might be to buy an other sensor.
Can you tell more about your project ? What are the sensors used for ?

The sensors are being used for monitoring the pressure of a pneumatic system. The system is controlled using air pressure and the sensors are to monitor the pressure after going through valves. The data from the sensors is used to control the opening and closing of the valves, increasing and decreasing the system's pressure.
There are 4 sensors. I have a week to complete my project and the current design is based around the MicroPressure Sensor so I don't think I'll be able to change it.

How long are the wires for the I2C bus ?
If you, for example, use a flat ribbon cable with SDA next to SCL, then 20 cm might already be too long.
Do you have a library or code to retrieve the data from the sensor ? Can you show it ? You probably need to change that for any of the three options (Teensy multiple I2C buses, I2C multiplexer, Software I2C).

Did Sparkfun really not add in the capability to use multiple of the same sensor to their Qwiic connectors? That sounds like something you'd want if you can daisy chain sensors together.

I'm using the library from Sparkfun on the MicroPressure Sensor. As of right now I'm trying to see if I can use SoftI2CMaster or something similar to not have to use a multiplexer. My current wires are a few inches long but I can make the system's tubing longer or shorter.

They really did not.

They have the I2C multiplexer board with those Qwiic connectors, to use up to 8 of the MicroPressure sensors. A I2C multiplexer is a normal and common way that everyone uses when using sensors with the same I2C address.

I think the SlowSoftWire is the most compatible Software I2C library. It might not work on a very fast Teensy 4.1 board. You might even be the first one to try that.
I made this list of the software I2C libraries.

They have the I2C multiplexer board with those Qwiic connectors

Would I be able to use their Qwiic multiplexer board by just going from pin headers to the multiplexer?
What software I2C library modifies how Arduino IDE's code works the least? (If you can answer off the top of your head)

Yes, the I2C bus is SDA and SCL (and GND of course).
One of the eight (sub) I2C busses is selected by sending a simple I2C command to the multiplexer chip.