K33 CO2 sensor + Motor driver

Hi,

I am working on a project designed to measure oceanic CO2 levels, and for this I need to be able to run an air pump and a K33 sensor off of an arduino. The set up I have turns on the air pump for 15 seconds (via a Drok 7A output motor driver), turns it off, takes a CO2 reading, waits a bit, and then turns the air pump back on.

However, I have run into a problem.

I have made a functional unit, but the next three I built don't work. The motor driver code works fine, and the sensor code works fine, but if I set any digital pins on the arduino to "high" the sensor quits. It seems to be able to take one reading which it repeatedly spits out to the serial monitor, but judging by the lights on the sensor not turning on.

I used a I2C scanner code I found to check if it's finding an adreess and it is (though not very consistently) and if I manually make sure the K33 sensor is taking data, the arduino seems able to read it (there is a little pin that, if shorted, will turn the thing on for a little while).

What I don't understand is why the one unit works. The wiring seems to be the same on all the units I have created, but it's possible that I am missing something. If there is a wiring mistake that would commonly create this problem that I could just be overlooking on the units I made more recently? Is this a known issue for K33 sensors? Is there something up with the I2C bus? Has anyone else had a similar issue?

I will attach the code that I use for the sensor only which always works, and the code I use to control both the sensor and the motor that works for only one unit I have built.

sensor_motor_code_june29.ino (7.6 KB)

sensor_code.ino (6.69 KB)

Post a wiring diagram of your setup and a link to the K33 sensor you're using (there is more than one version available). The I2C scanner should print consistent results otherwise the wiring is not correct. What model of Arduino are you using? The sensor does not work on a 5V Arduino without level converter.