Raspberry Pi and 4-20 mA Inputs

Posted by Vytas Sinkevicius on

Most industrial process controls applications still use 4-20mA analog signals for transmitting variable data. The Raspberry Pi does not have an on board analog to digital converter. Here is the Pi-SPi-8AI analog input module specifically designed for the Raspberry Pi that has 8 channels of analog inputs based on the Microchip MCP3208 ADC.

Raspberry Pi Analog Pi-SPi-8AI 4-20mA Input Analog Interface

The versatile input circuit is configured "out of the box" for 4-20 mA inputs. Here is the input circuit:

This input circuit can accept various type of signals. The MCP3208 uses 3.3 VDC as a reference voltage, so the active range is actually 0 to 3.3 VDC or 0 to 4095 AD Counts.

  • 4-20 mA - Rv removed, input mA flows into Rload giving 0.6 to 3 VDC
  • Thermistor Input, Typically 10K 3380 Beta - remove Rload
  • Potentiometer input typically 10K linear taper - wiper to input, either end of potentiometer to +V and Common
  • VDC Input - Remove Rv and replace Rload with 1M ohm load resistor if required. (Without a Rload resistor,  and no input, in the channel may "float") Fro voltages greater than 3.3VDC, replace C2 with a resistor, and R1/C2(resistor) becomes a voltage divider
  • MQ3 Type gas sensor - remove Rv and replace the Rload with the recommended MQ load resistor, typically 4K
  • LDR (Light Dependant Resistor), %RH Sensor, etc.

The Pi-SPi-8DI has a "Spare" chip select line for GPIO22, this gives the RPi the capacity for 16 analog inputs of various types.

Here is the PCB layout for the Pi-SPi-8AI. It comes pre-configured for 8 channels of 4-20 mA inputs. The two load resistors (Rv and Rload from the above circuit) are surface mount resistors in a 1206 package which are easily removed/inserted by hand.

Sample code, schematics and complete specs can be found at this link:

Pi-SPi-8AI

 

 

 

SaveSaveSaveSave

Share this post



← Older Post Newer Post →


Leave a comment

Please note, comments must be approved before they are published.