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?

K-30 CO2 sensor



1 Answer 1


Three possible reasons.

  1. You didn't connect the ground of the battery/sensor to ground of the RPI.

  2. The battery sees too low of a draw and goes to sleep. Common power save feature on newer power banks.

  3. The switching supply on the power bank is too noise for the sensor. Try adding a filter cap or two.

  • \$\begingroup\$ What do you mean by #1? I have the ground of the sensor connected to the ground of the battery. But you're saying one or both should be connected to the RPI? \$\endgroup\$
    – user131482
    Commented Dec 2, 2016 at 20:34
  • \$\begingroup\$ @vince yes. Because without the ground of all three connected, they don't have a common reference point. \$\endgroup\$
    – Passerby
    Commented Dec 2, 2016 at 20:42

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.