I have a K-30 CO2 sensor connected to a Raspberry Pi 3 model B. When I connect the sensor to the Pi via serial and power the sensor with the Pi, my program works fine: the CO2 concentrations are displayed on the screen.
On the other hand, when I try to power the sensor with a portable battery, the program does not work: the Pi recognizes that the sensor is connected, but it doesn't read any values from the sensor.
I know the sensor is receiving power from the battery because there is a light blinking on the sensor and the Pi recognizes that the sensor is there. Also when I measured the voltage running through the wires from the battery, it says 5.3 V, which is sufficient for the sensor according to the data sheet.
I have the sensor ground and power ports connected to the ground and power wires of a USB cable, which then plugs into the battery.
Any ideas as to why this isn't working?