Data transfer (RX-TX) Arduino UNO to OpenCM9.04

Hello everyone, I am trying to transfer some data from Arduino UNO to OpenCM board using the below example sketch (Arduino IDE software). It seems the OpenCM9.04 is not receiving any data, however the same code is fine while using with two arduino boards (UNO, and Mega). The hardware connection of Arduino UNO and OpenCM9.04 is shown in figure.

Hardware connection

Example Code

> //Serial_communication_sender code
>      char mystr[5] = "Hello"; //String data
>      char k[3]="345";
 
void setup() {
  // Begin the Serial at 115200 Baud
  Serial.begin(115200);
}

void loop() {
  Serial.write(mystr,5); //Write the serial data
  Serial.write(k,3);
  delay(1); 
}

.

//Serial communication receiver code 
    char mystr[10]; //Initialized variable to store received data
        char k[3];

    void setup() {
      // Begin the Serial at 115200 Baud
      Serial.begin(115200);
    }

    void loop() {
      Serial.readBytes(mystr,5); //Read the serial data and store in var
      Serial.readBytes(k,3);
      
      Serial.println(mystr); //Print data on Serial Monitor
      Serial.println(k); 
      delay(100);
    }

It would be grateful if anyone can suggest or help me that where I am doing wrong and how the data can be transferred between these two boards. Thanks in advance

You just wrote the device's name. Nothing else. This forces your potential helpers to do work that you could have done yourself to make it easier for your potential helpers to help:

providing a link to the documentation of the device.

with a quoogling I found this
https://emanual.robotis.com/docs/en/parts/controller/opencm904/
it shows which connector to use and which IO-pins are used for serial communication.

by the way: the OpenCM seems to be a 3.3V device while the Uno is a 5V device.
You may have damaged your OPemCM through directly connecting it to 5V

best regards Stefan

1 Like

That's wrong; you need to keep space for the terminating '\0'.

@StefanL38

Thanks for the suggestions, and I apologise, I couldn't attach links.

Yes I know these serial communication pins and have tried with TX1-RX1 to TX3-TX3 pins but none of them worked.

The both boards (UNO and OpenCM) are powered through their USB ports, therefore there is no any connection of voltage between them. Only he GND, TX and RX pins are connected between them to transfer the data from one board to the other.

I really don't have any idea why the data is not transferring, still struggling with it. and thanks again.

Hi thanks for the comment and I will update this. basically this is an example code which is working well between two arduino boards but it is failed for OpenCM board.

I was explaining this not detailed enough.
The IO-pin of an Arduino-Uno "sends" out 5V but the serial interface-IO-pins of the OpenCM is build for only 3.3V.
This means the Arduino TX-pin "feeds" a too high voltage into the OpenCM-Rx pin and this might have damaged the OpenCM

The microocntroller-world is not superstandardised like USB-devices.
In the micrcontroller-world you yourself have to take care of a lot of more things than "does the plug fit into the socket?"

best regards Stefan

1 Like

Again thanks for detailed explanation, I got it completely now.

Yes, I am not good at Electronics, I have to learn a lot.