Usage Example for Arduino-USB to TTL Conversion

Sample descripition: The multiplexer board achieve USB to TTL, micro USB interface in A as input and the TTL interface in B as output. The operation is same for USB to 232 and 485.Similarly, the reverse converter B to A is also feasible,such as 232 to USB,485 to USB, TTL to USB.

Hardware Preparation

Software Preparation

Wiring Diagram

According to the following connection diagram,connect it.
Plugin the A to B USB to UNO.

TEL0070_UNO

Mainboard Pin name Converter Pin name
DFRduino UNO R3 TX 1 Protocol Converter RX
DFRduino UNO R3 RX 0 RS485 Sensor TX

Sample Code

void setup()
{
  Serial.begin(115200);
}
void loop()
{
  if(Serial.available()){
  Serial.write(Serial.read());
  }
}

Result

We need a serial monitor for monitoring data. There're lots of good tools like putty,CoolTerm and so on.In this case, we choose CoolTerm to do this.

Please set the baud rate to 115200 bps and com port.Back to the main interface, click Connection--Send String, the following dialog will open.

Send String

You can send the string in this dialog. The string received can be showed in the other port(UNO port).

received

Thus far,you achieve the function USB to TTL.
However, you can test reversed converter based on this function, being B to A converter. You only need to change the UNO code. You will see the change that coolterm will receive data from UNO.

Refer to the test code:

void setup()
{
  Serial.begin(115200);
}
void loop()
{
  Serial.print("Hello,DFRobot!");
  Serial.println();
  delay(500);
}

Other Reference Connection

1.TTL to 232 converter

TTL to 232 converter

PIN RS-232
1 DCD
2 RXD
3 TXD
4 DTR
5 GND
6 DSR
7 RTS
8 CTS
9 RI

2.USB to 485 converter

USB to 485 converter

Was this article helpful?

TOP