Arduino 4-20mA sensor
By stepSample of connecting a 4-20mA sensor to an Arduino through a simple shunt resistor. Also includes a capacitor for low pass filtering of noisy input signals.
void setup()
{
Serial.begin(9600);
pinMode(A0, INPUT);
pinMode(4, OUTPUT);
digitalWrite(4, HIGH);
}
void loop()
{
int r = analogRead(A0);
Serial.print("A0: ");
Serial.println(r);
if( r > 200 ) {
digitalWrite(4, HIGH);
} else {
digitalWrite(4, LOW);
}
delay(100);
}