I have a GTD2000-Tx fixed gas sensor with an output of 4-20mA DC. How do I connect it directly to a raspberry pi 3? The power supply is 24 volts and is supplied externally.
Short answer is “you can’t” as the 4-20mA current loop is an analogue signal and the Pi does not have any direct analogue inputs. You can, however, add a device called an Analogue to Digital Converter (ADC) to your Pi that will let you then take analogue measurements.
Typically you’d “drop” the current loop output of you sensor across a 100 or 120 Ohm resistor and measure the voltage generated (V=I×R) with the ADC.
Sometimes the sensor you’re using is “loop powered”, in which case you’d need to supply voltage in to one end of the loop and measure the output on the return path using your small resistor.