I am attempting to connect this device to my computer via RS232.
I am debating the simplest way of going about this and was inquiring if my Uno R3 could come into use, turning the analog symbols of 0-5 Vdc and 4-20 mA from the GFM into an output in serial port over a COM port. I have an RS232 to USB and I am just now tasked with completing this.
1 Answer 1
Although it is common for mass flow meters to have a serial interface (which could well be Modbus), this particular model has only analog outputs. If you have an Uno at hand, your simplest option is to use it for reading the 0–5V meter output, and send the data to the PC through the Arduino's serial-over-USB connection.
Connect:
- the meter's pin 3 (0 to 5 VDC common) to the Arduino's GND
- the meter's pin 2 (0 to 5 VDC output indication) to the Arduino's A0
- the Arduino's USB connector to your PC
You don't need the RS-232 to USB converter, as you will not be using RS-232 at all.
The Arduino will simply read the analog voltage, optionally convert it to flow units, and sent that through it's serial port:
const float flow_range = ...; // the meter's full scale
const uint8_t input_pin = A0; // analog input used
const uint32_t print_period_ms = 200; // tune to taste
void setup() {
Serial.begin(9600);
}
void loop() {
float flow = analogRead(input_pin) * (flow_range / 1024);
Serial.println(flow);
delay(print_period_ms);
}
0-5 Vdc and 4-20 mA
... it's0-5 Vdc or 4-20 mA
... they both carry the same informationmodbus
? -- Are you aware that your Arduino is able to measure voltages? What stops you from usinganalogRead()
? -- If you have an attempt of a sketch, please add it. And why it does not work for you. Make sure to format it as source. See the help of the edit box for details.