RS485 Communication on Orange Pi to Read Gas Analyzer Data

Hello everyone,

I'm currently working on a project where I need to read data from a gas analyzer via RS485 communication using an Orange Pi. The goal is to access the data from the gas analyzer directly through the Orange Pi.

Here's a brief overview of the setup and the issue I'm facing:

  • Hardware Setup: We have a gas analyzer connected to an Orange Pi via RS485 communication using MAX485 modules.
  • Software: Instead of using ModScan, we're attempting to access the data from the gas analyzer directly through the Orange Pi.
  • Desired Outcome: Our aim is to successfully read the data from the gas analyzer and process it on the Orange Pi for further analysis or integration with other systems.
Issue Encountered:

  • Despite our efforts to establish RS485 communication and read data from the gas analyzer using Python scripts on the Orange Pi, we haven't received any response.
  • We've verified the hardware connections and configurations, but we're still unable to retrieve data from the gas analyzer.
Request for Assistance:

  • We're seeking guidance or suggestions on how to troubleshoot and resolve this issue.
  • If anyone has experience with RS485 communication on the Orange Pi or similar setups, your insights would be greatly appreciated.
  • Additionally, if there are any specific Python libraries or configurations that are recommended for RS485 communication on the Orange Pi, we'd love to hear about them.
Any help, tips, or advice would be immensely valuable in moving forward with our project. Thank you in advance for your assistance!

Best regards, [Sairam].
 
What is the specific MAX485 module you're using?

Since you mentioned ModScan, I assume you've already tested communicating to the gas analyzer from a computer using a USB to RS-485 adapter and ModScan. Is this correct?

I recommend using ModSim (which is a Modbus Slave simulator) on a computer with a USB to RS-485 adapter to test the RS-485 communication from the Orange Pi. ModSim will allow you to view the traffic so that you can confirm the requests (if any) that the Orange Pi is sending.

As for python libraries, have a look at PyModbus:
https://github.com/pymodbus-dev/pymodbus
https://pymodbus.readthedocs.io/en/latest/
 
I attached the max485 module image.
But the idea is to read data remotely,not using softwares like modscan or modsim.
Here we are using orange pi , we use putty to login to orange pi and we run python scripts to read data. We are unable to move forward, so we are seeking help . Thank you
 

Attachments

I've dealt with others here having issues with that MAX485 module. You may need to remove R7 from that MAX485 board (and remove or disable any termination connected to the gas analyzer). Also make sure to connect 3 wires (A, B, and GND) between the MAX485 board and the gas analyzer. Please refer to this post (and for much more details, the other post linked in my response in this post)
https://control.com/forums/threads/max485-module-ro-pin-nearing-0v.49218/

I understand that your end goal is to read data remotely, but you first need to confirm that the Orange Pi is properly sending requests and communicating on RS-485. To do this, use ModSim, a computer and a USB to RS-485 adapter. After you've confirmed that the Orange Pi can communicate to ModSim (and assuming you've already confirmed ModScan can communicate with the gas analyzer), you are ready to connect your Orange Pi to the gas analyzer.
 
I've dealt with others here having issues with that MAX485 module. You may need to remove R7 from that MAX485 board (and remove or disable any termination connected to the gas analyzer). Also make sure to connect 3 wires (A, B, and GND) between the MAX485 board and the gas analyzer. Please refer to this post (and for much more details, the other post linked in my response in this post)
https://control.com/forums/threads/max485-module-ro-pin-nearing-0v.49218/

I understand that your end goal is to read data remotely, but you first need to confirm that the Orange Pi is properly sending requests and communicating on RS-485. To do this, use ModSim, a computer and a USB to RS-485 adapter. After you've confirmed that the Orange Pi can communicate to ModSim (and assuming you've already confirmed ModScan can communicate with the gas analyzer), you are ready to connect your Orange Pi to the gas analyzer.
As per your suggestion ,I tried to communicate orange pi and modsim, but there is no response.
But I established connection between orange pi as master and Arduino as slave by using RS485 communication.
 
As per your suggestion ,I tried to communicate orange pi and modsim, but there is no response.
But I established connection between orange pi as master and Arduino as slave by using RS485 communication.
Can you provide details on the specific RS-485 adapters or modules used and all connections made for both scenarios? Keep in mind you sometimes need to swap A and B signals, as some vendors use A as +, while others use B as +.

Did you remove R7 from your MAX485 module?

Also, did you double check all communication settings, such as baud rate, parity, and slave address?
 
Yes , i removed the R7 resistor of max485 module and also i'm using rs485 to usb converter , by default the R7 resistor is removed . And coming to the hardware connections , DI pin and RE pins of max485 are connected to the TX and RX pins of orange pi , and DE and RE pins are short circuited and connected to the PA7 or gpio 7 pin of orange pi , and VCC and GND pins are connected , and A and B pins of max 485 module is connected directly to the A and B pins of rs485 USB converter . Then a python script is cloned to the orange pi and tried to execute it but there was no response.
 
by default the R7 resistor is removed.
I don't understand this statement. From your image in post #3 above, R7 is clearly installed.

DI pin and RE pins of max485 are connected to the TX and RX pins of orange pi , and DE and RE pins are short circuited and connected to the PA7 or gpio 7 pin of orange pi
Did you mean DI and RO pins of MAX485 are connected to the TX and RX pins of the Orange Pi?

Regarding your RS-485 wiring, please see my comment from post #4 above:
Also make sure to connect 3 wires (A, B, and GND) between the MAX485 board and the gas analyzer.
This applies to RS-485 connections between any devices. You should be connecting A, B, and GND (a.k.a COM, REF, SG, 0V).

Did you try swapping your A and B wires at one end (i.e. connecting A from the MAX485 to B of the RS-485 USB converter and B from the MAX485 to A of the RS-485 USB converter)?

What RS-485 converter/module was used on the Arduino for RS-485 when you got communications to work? Is it the same RS-485 USB converter you used with ModSim or something different?
 
I don't understand this statement. From your image in post #3 above, R7 is clearly installed.


Did you mean DI and RO pins of MAX485 are connected to the TX and RX pins of the Orange Pi?

Regarding your RS-485 wiring, please see my comment from post #4 above:

This applies to RS-485 connections between any devices. You should be connecting A, B, and GND (a.k.a COM, REF, SG, 0V).

Did you try swapping your A and B wires at one end (i.e. connecting A from the MAX485 to B of the RS-485 USB converter and B from the MAX485 to A of the RS-485 USB converter)?

What RS-485 converter/module was used on the Arduino for RS-485 when you got communications to work? Is it the same RS-485 USB converter you used with ModSim or something different?
I used both max485 modules one for Arduino and the other one for orangepi ,and without removing the R7 resistor it worked.
 

Attachments

What RS-485 converter/module was used on the Arduino for RS-485 when you got communications to work? Is it the same RS-485 USB converter you used with ModSim or something different?
I used both max485 modules while making communication with Arduino and orangepi , but now I'm using one max485 module by removing R7 resistor and one rs485 to USB converter.
 

Attachments

I used both max485 modules while making communication with Arduino and orangepi , but now I'm using one max485 module by removing R7 resistor and one rs485 to USB converter.
And does communication between the Arduino and Orange Pi work when using one MAX485 module without the R7 resistor and one RS-485 to USB converter?
 
And does communication between the Arduino and Orange Pi work when using one MAX485 module without the R7 resistor and one RS-485 to USB converter?
This was done 3 months back actually, and as I told I used two max485 modules only , no rs485s to USB converter is used and also without removing R7 resistor from the max485 module.The below is the image of left side indicates the values sent from orange pi and right side is the values received from orange pi to arduino
 

Attachments

Yes, RS-485 devices need a common ground. Unfortunately it's not always obvious how to properly establish a common ground, as some devices expose only the + and - signals and no ground signal (as is the case with one of your USB to RS-485 adapters). There are two common methods for making ground connections to RS-485 devices. Explicitly, by using a third wire connected to the GND (a.k.a. COM, REF, SG, etc.) terminals of all devices. Or implicitly by using earth ground.

Most devices that only expose the + and - signals are non-isolated and so their power supply's ground is also the RS-485 circuitry's ground. In many cases, these devices' power supplies are earthed, so earth ground becomes the implicit 3rd wire.

It appears that both of your USB to RS-485 adapters are non-isolated, and so your computer's ground (which should be earthed through the computer's power supply) is the RS-485 ground. Therefore, if you are connecting an RS-485 device to one of your USB to RS-485 adapters, you may not need an explicit 3rd ground wire, for example, if you already have a USB cable connected between your computer and the device or the device is powered by a power adapted that is also earthed, such that it's common with your computer.

Additionally, the 3 terminal USB to RS-485 adapter you show in your picture may also have a 120 ohm termination resistor installed across it's + and - signals that may need to be removed (just like your MAX485 module). While I was unable to find documentation to confirm this, it appears that R5 is the termination resistor on that USB to RS-485 adapter (if so, it would have "121" marked on it).
 
It appears that both of your USB to RS-485 adapters are non-isolated, and so your computer's ground (which should be earthed through the computer's power supply) is the RS-485 ground. Therefore, if you are connecting an RS-485 device to one of your USB to RS-485 adapters, you may not need an explicit 3rd ground wire, for example, if you already have a USB cable connected between your computer and the device or the device is powered by a power adapted that is also earthed, such that it's common with your computer.
Yes, I connect one max485 module which is connected to orange pi is directly connected to the rs485 to USB converter which is connected to the computer, so no need for third wire as ground connection right?
 
Additionally, the 3 terminal USB to RS-485 adapter you show in your picture may also have a 120 ohm termination resistor installed across it's + and - signals that may need to be removed (just like your MAX485 module). While I was unable to find documentation to confirm this, it appears that R5 is the termination resistor on that USB to RS-485 adapter (if so, it would have "121" marked on it).
In this three terminal rs485 to USB adaptor, there is 121 on the R5 . But the problem with this adaptor is ,the port of this adapter is com11 , whereas in the modsim application there are only 9 ports and one tcp / modbus port . Can you please help me in this situation...
 
It depends on how the Orange Pi is powered. If you're powering the Orange Pi through a USB cable connected to your computer, then no, you don't need a 3rd wire for ground in your RS-485 wiring. If you're using a dedicated power supply for the Orange Pi, though, it depends on whether that power supply is isolated or not.
 
Top