Serial ports on Opta

Hi, I'm trying to use an existing code for Arduino on Opta Wifi . Key part of this code is the use of UART to communicate to an external sensor on RS485, using a proprietary protocol (unfortunately it is NOT Modbus).

I have two problems:

  1. I don't know which of the serial ports of the microcontroller is used for RS485 interface on Opta
  2. I'm not sure if there is a way to "bypass" Opta OS and write directly on the UART in the same way I do with Serial1 or Serial2 on Arduino Mega2560.

I'm using Arduino IDE.
Thank you for your help!

According to the pins_arduino.h file, the RS485 port is driven by Serial2.

But I want RX/TX pins mapped to any of I1-I8 from Serial3 if possible. Still trying to work out if I can achieve this. Looks like Serial -> USB, Serial1->Wifi, Serial2->RS485 but no idea what Serial3 is physically wired to. The pins file states

#define SERIAL3_TX			PB_9
#define SERIAL3_RX			PH_14
#define SERIAL3_RTS			PA_15
#define SERIAL3_CTS			PB_15

Will report back if I find anything out.

Same question here. I wanto to make use of serial port of this PLC, not RS485 Modbus, my question would be: ¿ Can i use the serial2 to program serial comm on the arduino ide? Do i have to use a RS485-RS232 converter in order to use the UART? Please help.

Ive been thinking using serial libraries in serial2 and use a RS485-RS232 converter to connect to a the RS232 device. Could this do the trick?

1 Like

Hi @gibo_23

Have you found a solution to use any serial ports on Arduino Opta?

Thanks,
marian

In the OPTA WiFi documentation, I found information that the AUX connector for the expansion module has RX and TX pins. I haven't figured out how to use them yet. If anyone knows which Serial it is, please help.
From what I understand, the connections marked in red are located on upper side, and those in blue are on lower side of the board.

I am also trying to connect a 3.3V TTL device (RX/TX) to the RS485 via a converter. I will let you know if I succeed.

EDIT
I just discovered that AUX is Serial1 (UART 3V3), so you can read data using as simple code as follows:

void setup() {
  Serial.begin(9600);
  Serial1.begin(9600);
}

void loop() {
  if (Serial1.available() > 0) {
    char received = Serial1.read();
    Serial.print(received);
  }
}
3 Likes

So how did you connect rx and tx pins to it? Or how did you connect to it in general?

Maybe this can help. It shows the TX and TX pin is location on the Expansion Port.

3 Likes

For testing purposes, I simply soldered the wires to the AUX. I don't have any knowledge about a socket that fits this connector.

3 Likes

This kind of connections are 'edge board connections'. PCB boards are usually 1.6mm thick. Take into account strips pacing. There are models very afforadable to wire.

https://octopart.com/it/search?q=009159010061916&currency=USD&specs=0

and for the pcb:

2 Likes

Update: I ran a series of tests with the edge connector using the COM1 serial port connected to an RS485 converter module. Using the native RS485 port with Arduino’s official library, I encountered several issues related to data packet frame errors in both data transmission and reception. Using the serial port provided by the edge connector, I’m experiencing the same issues. Testing the same code on an Arduino Zero board, everything works perfectly. At this point, there seems to be an issue with the libraries. Has anyone had similar experiences?

Eric

void setup() {
  // Inizializza la comunicazione seriale sulla porta Serial1 a 9600 baud
  Serial.begin(9600);
  Serial1.begin(9600);
}

void loop() {
  if (Serial.available() > 0) {
    String datiRicevuti = Serial.readStringUntil('\r');              //Read command from Usb port 
    String datiSpediti =  datiRicevuti + '\r';                       //Add carriage return
    Serial1.print(datiSpediti);                                      //Send to turbo pump
    Serial.println("Sended command: " + datiSpediti);                //Echo in serial monitor
  }
  if (Serial1.available() > 0) {
    String receivedData = Serial1.readStringUntil('\r');
    String responseData = "Received answer: " + receivedData;
    Serial.println(responseData);
  }
}

Did you open the Opta case to solder? If so how did you open it? Do the tabs push inwards? I don't want to break them. Thanks!

To open the PLC casing, you need to carefully pry open the latches located at the bottom of the casing. I managed to do this using a few small flathead screwdrivers. The latches are positioned on the sides (2 or 3 on each side) and there is one latch each at the top and bottom. Be aware that the top and bottom latches are particularly prone to breaking.

Once the casing is removed, you will have access to the boards, which are connected using goldpin strips. It’s important to note that if RTC (Real-Time Clock) was configured in any of the previous projects, disconnecting the boards will result in the loss of this data. Also, exercise caution when reconnecting the boards, as it is easy to misalign them and connect the wrong pins together.

2 Likes

Got it - thanks a lot for the info.

1 Like

I built a multi-Arduino machine a couple years ago where the MCUs breakup tasks, to control multiple stepper motors, etc. For that I used Arduino R3s and Megas. Worked great.

For my second version of the machine I wanted to try OPTA because I have to control a whole bunch of pneumatic valves that require relays.

I'm having a hard time with the OPTA when trying to use the AUX serial RX/TX pins from the base OPTA (non-expansion module). I ordered a digital scope to try to see what's going on but it doesn't arrive for a few days.

Anyways, I have a Nextion 10.1" and am trying to send a simple button tap command via the built in "Send Component ID" which worked great in my previous project.

Nextion simulation debugger shows the hex is being sent. On the Opta side nothing ever seems to come through. I've tried Serial1 and Serial 2.

Should the Ardino IDE show a second serial port when going to Tools > Port?

Also how should the Nextion config file "NexConfig.h" be setup for the OPTA?

I've tried your simple Serial1 read example as a test and can't get that working either.

Side note I'm using UTM Virtual Machine with Windows on a Mac to upload the TFT created in Nextion Editor. No issues on that front though.

Thanks -

FWIW, just hooked up an Arduino R4 Wifi as a test and the Nextion talks to it just fine on RX and TX pins (Serial1).

Also for the OPTA setup I'm using a 3.3v to 5v level shifter (HW-221)

Took the case apart, soldered directly to the board to get RX/TX access and it works now. Must have been a connection issue.

1 Like