Arduino Uno Rx sensor simulator

I want to simulate the output of a serial sensor via the Arduino Uno’s TX (pin 1) output and read it on another datalogger that has an Rx input. Before connecting the serial output, I wanted to test the output by connecting the Tx line to a DB9 that is connected back to the PC via a USB serial adapter and running Putty. I have set up my test as follow:

  1. Programmed the ARDUINO UNO to output a value of 0 as per the example below.
    void setup() {
    Serial.begin(9600);
    }
    void loop() {

Serial.println(“0”);
delay(500);
}

  1. I connected a wire from pin 1 (TX) on the Arduino to pin 2 of a DB9 serial cable that is the Rx line.
  2. The DB9 is connected to a USB serial cable connected to a PC using Putty.
  3. Putty is programmed with the same Baud rate and configuration 8,N, 1

Problem: Uno’s Tx light flashes accordingly and I can see the data correctly using the Serial monitor. Data received on Putty shows as garbage but at the correct delay sequence. I have tried several settings but I cannot seem to get the correct ASCII string.

A sample of the garbage may be helpful.

Output seen on Putty. I must add that the program sends Serial.Println("0), then Serial.Println(10..100) in subsequent lines with a delay of 500 per line. Just wanted to keep the programming message short.

▒V▒dV▒▒V▒g▒V▒V▒gV▒▒V▒fV▒▒V▒eV▒▒V▒dV▒▒V▒g▒V▒V▒gV▒▒V▒fV▒▒V▒eV▒▒V▒dV▒▒V▒g▒V▒V▒gV▒▒V▒fV▒▒V▒eV▒▒V▒dV▒▒V▒g▒V▒V▒gV▒▒V▒fV▒▒V▒eV▒▒V▒dV▒▒V▒g▒V▒V▒gV▒▒V▒▒▒R▒▒C4▒?▒▒p▒▒▒▒Ё$▒▒▒▒▒@E▒

What is the resting voltage on pin 2 of a DB9 serial cable?

O Volts measuring at pin 2 and ground on the DB9 serial cable.

"O Volts measuring at pin 2 and ground on the DB9 serial cable."

Then you may need a level shifter between the tx/rx lines.

DB9 more or less implies RS232 levels. In that case you need a RS232-to-TTL converter between the DB9 and the Arduino; e.g. a MAX232.

It would have been easier if you would use an USB-to-TTL converter.

Thank you. I was hoping that I could go direct from the Arduino but I understand now the need for the MAX232.

If you have some basic electrical components, you can make level shifters like below if needed.

rs232-ttl31.jpg