Mass Flow Meter (RS232/RS485) to Arduino

Hello, I have been trying to connect the Omega Mass Flow Meter (FMA-2600/FVL-2600 SERIES) to my Arduino to receive pressure, flow, and temperature data on the serial monitor, however upon connecting it, I just keep receiving zeros for all the 3 data outputs. The Flow Meter's manual is in here. Page 10 in the manual shows the necessary pins, and I am only using Pin 8 (Ground) and Pin 3 (RS232 / RS485 Input Signal), since I only need to read the data from the flow meter. The code that I am using is as follows:
`#include <SoftwareSerial.h>

#define RX_PIN 0 // Arduino RX pin (receive)

SoftwareSerial deviceSerial(RX_PIN, -1); // Create a software serial object

void setup() {
Serial.begin(19200); // Set the baud rate for Arduino's serial communication
deviceSerial.begin(19200); // Set the baud rate for device's serial communication
}

void loop() {
// Read the pressure, temperature, and flow from the MiniDIN connector
float pressurePSIA = readPressure(); // Read pressure in PSIA
float temperatureC = readTemperature(); // Read temperature in Celsius
float flowSLPM = readFlow(); // Read flow in SLPM

// Display the values
Serial.print("Pressure: ");
Serial.print(pressurePSIA);
Serial.println(" PSIA");

Serial.print("Temperature: ");
Serial.print(temperatureC);
Serial.println(" °C");

Serial.print("Flow: ");
Serial.print(flowSLPM);
Serial.println(" SLPM");

delay(1000); // Delay between readings
}

// Function to read pressure from MiniDIN connector
float readPressure() {
deviceSerial.println("P"); // Send command to request pressure value

// Wait for response
delay(100); // Adjust the delay based on the response time of your device

// Read the response from the device
String response = deviceSerial.readStringUntil('\n');

// Parse and convert the response to a float value (pressure in PSIA)
float pressureValue = response.toFloat();

return pressureValue;
}

// Function to read temperature from MiniDIN connector
float readTemperature() {
deviceSerial.println("T"); // Send command to request temperature value

// Wait for response
delay(100); // Adjust the delay based on the response time of your device

// Read the response from the device
String response = deviceSerial.readStringUntil('\n');

// Parse and convert the response to a float value (temperature in Celsius)
float temperatureValue = response.toFloat();

return temperatureValue;
}

// Function to read flow from MiniDIN connector
float readFlow() {
deviceSerial.println("F"); // Send command to request flow value

// Wait for response
delay(100); // Adjust the delay based on the response time of your device

// Read the response from the device
String response = deviceSerial.readStringUntil('\n');

// Parse and convert the response to a float value (flow in SLPM)
float flowValue = response.toFloat();

return flowValue;
}`
I would appreciate any assistance on this matter. Also would I need to use RS232/RS485 shield?

If the flow meter is sending data using the signal levels of RS232 or RS485, then you need the appropriate RS232 or RS485 adapter module at the Arduino, to convert the signal levels to 0-5V UART/TTL.

Would RS232/RS485 shield work?

Please explain exactly which sensor you have, and how it is configured. Post the full model number. The manual you linked covers several instruments.

Model name is FMA-2620A-I (basically FMA-2600 series model). The manual I linked has the description of pins functions on page 8, and on page 10 regarding the RS232 / RS485 Digital Input Signal.

By following instructions in the manual, you configure the instrument to use either RS232 or RS485 signals.

Choose one of the two, buy an RS232 or RS485 adapter for the Arduino and connect them together. You will need a common ground plus one or two signal wires (only one wire plus ground is required for receive only RS232).

Exposing Arduino inputs directly to RS232 or RS485 signals can destroy the input pins or cause the Arduino to malfunction.

In my case, which RS232 adapter would you recommend?

You seem to be using the Arduino pins that connect to your computer to also connect to your meter device. Use some different pins for the sensor!

Any should work. I use this one from Pololu.

However, after looking a bit harder at the manual, it is not clear to me exactly how one decides between RS232 and RS485 signals. You may have to order the instrument configured as one or the other. Confirm with the seller.

Sorry got a little confused here, so you are suggesting me to change "#define RX_PIN 0 // Arduino RX pin (receive)" to "#define RX_PIN 2 // Arduino RX pin (receive)"?

From my understanding, this flow meter's pins automatically set to either RS232 or RS485 signals, as in the manual it mentions those pins functions with as RS232/RS485. In the configuration of the device itself, you can choose only between analog or serial, as well as baud rate, which I left at default 19200.

I strongly doubt that, but if you can find some documentation that clearly states so, post a link to it.

Regardless, you must have an interface on the Arduino end that supports RS232 or RS485 signal levels, and connect it properly. The docs assume a PC running Hyperterminal, or some other terminal program.

Hi, @mad_vlad
Welcome to the forum.

You need to read pages 30 and 31 carefully.
You need to access the menu on the flowmeter display to set 232 or 485 comms.
Also how you want the data sent, polling or streaming.

Tom.. :smiley: :+1: :coffee: :australia:

This comment on page 31 of the operating manual strongly suggests that the manufacturer configures the unit for either RS232 or RS485.

Changing From Streaming to Polling Mode:
When the meter is in the Streaming Mode (RS485 units do not have a streaming mode), the screen is updated approximately 10-60 times per second

Yes I actually was just looking at that and accessing the COMM SETUP is already set to RS232 Serial.

Great. Sounds like all you need is the RS232 adapter, and get on with your project.

Yes you are correct, this flow meter I have has been set by the manufacturer, so it is only RS232. Also, I have ordered the following RS232 to TTL converter: https://www.amazon.com/gp/product/B07Z5Y1WKX/ref=ppx_yo_dt_b_asin_title_o00_s00?ie=UTF8&psc=1 and USB to RS232 adapter: https://www.amazon.com/gp/product/B0759HSLP1/ref=ppx_yo_dt_b_asin_title_o00_s00?ie=UTF8&psc=1

Also I would want data sent to be in streaming mode, as I want to be able to connect it through arduino and see the incoming data in real time. P.S. I have already changed the setting to streaming mode by setting device ID to "@".

The software serial pin must be something other than pin 0 and pin 1, which are the default connection to the PC. Use some other pins for the serial to the sensor.

I have changed the "#define RX_PIN 0 // Arduino RX pin (receive)" to PIN 2.

Also, now that I got the RS232 converter, I have the following connections (for reference on pins and their functions - page 10 of the manual :

From the flow meter:

  1. Pin 8 (GND) of the 8 pin miniDin connector from the flow meter is connected to the GND pin on the Arduino UNO R3 board.
  2. Pin 3 (Serial RS232RX / RS485(–) Input Signal (receive)) is connected to TXD Pin on this RS232 Converter

From the RS232 Converter:
3. I used this DB9 cable to connect the converter to the laptop. (P.S. also set baud rate to 19200)
4. The GND Pin on the converter is connected to another GND pin on the Arduino board.
5. The RXD Pin from the Converter is connected to Pin 2 on the Digital Side of the Arduino board.
Photo is included for reference as well:

With all these connections, something still seems wrong, since I am still getting 0's on the serial monitor.