Arduino Leonardo and FT232RL

Hello Guys,

First, thanks for looking! :slight_smile:
I want to make a project, already invented. But unfurtunatly i´ts not working.
I want to copy data from one computer and send to another one but simulating that I typing on the keyboard.
Im using a leonardo and a FT232RL. I leave a link to video that I uploaded-> https://youtu.be/VIgG78R5vmk

And this is the code for debugging (created my chatGPT):

void setup() {
  Serial.begin(9600);   // Start USB Serial communication
  Serial1.begin(9600);  // Start Serial1 communication via TX/RX pins

  // Send an initial debug message
  Serial.println("Arduino Leonardo ready! Waiting for data...");
}

void loop() {
  // Check if data is available from the USB Serial (Serial)
  if (Serial.available()) {
    char character = Serial.read();  // Read the received character from USB
    Serial1.write(character);        // Send the character via Serial1 (TX/RX pins)

    // Debug: Print the character to the Serial Monitor (USB)
    Serial.print("Character received via USB: ");
    Serial.println(character);

    // Debug: Confirm the character was sent via Serial1 (TX/RX)
    Serial.println("Character sent via Serial1 (TX/RX)");
  }
}

what does it do? not compile, link and upload? not give correct results?

for Serial1 test try

// Arduino Leonardo Serial1 test

// Serial leonardo has native USB (uart0)
// Serial1 is hardware serial port pin 1 is Tx and pin 0 is Rx

// for loopback test connect pin 0 to pin 1

// for RS232 shield connect pin 1 to Tx and pin 0 to Rx
// for loopback test connect 9 pin D connector pins 2 and 3

unsigned long time;

void setup() {
  Serial.begin(115200);   // initialise serial monitor port
    while(!Serial);       // wait for serial stream to open
  Serial1.begin(115200);  // initialise Serial1
  Serial.write("Arduino Leonardo Serial1 test -  for loopback test connect pin 1 Tx to pin 0 Rx\n");
}

void loop() {
  if (Serial1.available()) {      // read from Serial1 output to Serial
    Serial.write(Serial1.read());
  }
  if (Serial.available()) {       // read from Serial outut to Serial1
    char inByte = Serial.read();
    //Serial.write(inByte);     // local echo if required
    Serial1.write(inByte);
  }
}

to test connect pin 0 to pin 1 - characters entered on serial monitor keyboard should echo back to display

how have you connected the FT232RL? give a link to it?

Hello Horace,

Thanks for your reply. I connect the PC "A" the one I want to send the data, to leanerdo by USB cable, than the on PIN 0 (RX) of Leonardo I conect it to the PIN TX on the FT232RL.
Leonardo PIN1 (TX) to FT232RL (RX). that the FT232RL to PC "B" with a USB cable. I left a video on the post, I dont know if you saw irt or not, if not please take a look.

Best regards,
Pedro

try

// for RS232 shield connect Leonardo pin 1 to Tx and pin 0 to Rx

for loopback test connect 9 pin D connector pins 2 and 3

Hello horace,

The loopback of leonardo gave me the next message:

this test Im not understanding! But Im not using RS232 connector.

Regards,
Pedro

Anyone!? :innocent:

can you give a link to the device you are using? or a photo?

Hello @horace,

Heres is the photos and I also leave the link to the video that I recorded with all connected:

Thanks

looks like you are connecting to a PC using a FTDI type USB to TTL serial breakout board not a RS232 module

using the program from post 2 with connections
Leonardo pin 1 to FTDI RXD
Leonardo pin 0 to FTDI TXD

photo (note I am using a Things UNO board which is based on a Leonardo not a UNO)

Leonardo serial monitor output

Arduino Leonardo Serial1 test -  for loopback test connect pin 1 Tx to pin 0 Rx
hello from PC
test2 from PC 1234567890
test3 from pc 1111111111111111111111111111111

teraterm terminal emulator on PC

I already done that. Take a look on my configuration:


I also realise that your FTD swith is in 3V3. I also change mine.

But no data in the other computer. :pensive:

good idea - the Leonardo uses 3.3V logic 5V can damage it
EDIT: ignore the above - the Leonardo use 5V logic

what software are you using on the other computer?
I used teraterm with the following parameters

note that flow control is NONE - you may need to set/clear RTS etc depending on your serial software

Hello Horace,

Many thanks and sorry for the late reply.
I already can send data to other computer, thanks to you.

Regards,
Pedro