USB to Serial TTL V2

by RobBest in Circuits > Microcontrollers

1248 Views, 5 Favorites, 0 Comments

USB to Serial TTL V2

P1040729.JPG

This project may seem familiar and that is true. It is a follow up – or improved version – of the USB to Serial TTL converter that I posted in 2020.

The ‘problem’ with the previous version was that the serial baudrate needed to be selected with jumpers which was not very convenient. Next to that the number of baudrate selections was limited.

In order to improve the ease of use and increase the number of supported baudrates it would be nice if the serial baudrate would be determined by the baudrate settings set by the USB. When building the previous version I had no idea how to do that but after diving deeper in to the JAL USB driver I found out how to do that.

So this version has the following new features:

  • Serial baudrate is configurable via the baudrate settings by the USB. Supported baudrates are 110 baud up and until 230400 baud. Serial settings are always 8 bits, 1 stopbit and no parity
  • LED indicating data transfer from USB to serial (green LED) or from serial to USB (red LED). In the previous version this was not possible since no pins where available for the extra red LED.

I made the following changes to the hardware compared to the previous version:

  • Removal of the jumpers and the related resistors for determining the baudrate settings
  • Adding a red LED with resistor

The Electronics

Schematic_diagram.png

The schematic diagram shows the design of this version. You need the following electronic components for this project:

  • 1 PIC microcontroller 16F1455 with socket
  • Ceramic capacitors: 1 * 470 nF, 1 * 100nF, 2 * 22 pF
  • 1 crystal of 12 MHz
  • 1 Electrolytic capacitor of 10 uF/25V
  • Resistors: 4 * 330 Ohm, 2 * 22 Ohm
  • LEDs: 1 Amber, 1 Yellow, 1 Green, 1 Red
  • 1 female UBB connector
  • 1 header, 4 pins

You can build the circuit on a breadboard, as shown in the picture. The circuit is powered by the USB connection.

The Software

The software performs the following tasks:

  • Handling the USB interface. For this I used a standard JAL USB serial library
  • After the USB to Serial TTL converter is configured, the yellow LED will be turned on. Note that the LED will only be turned on if the chosen baudrate is within the range of 110 baud to 230400 baud
  • When a character is received from the USB it is copied to the serial interface and the green LED will be turned on for a short while, indicating the transfer of data
  • When a character is received from the serial interface it is copied to the USB and the red LED will be turned on for a short while, indicating the transfer of data

The JAL source file and the Intel Hex file for programming the PIC are attached.

The Final Result

Before the USB interface can be used it has to be configured by the host computer. This is done by setting the right serial parameters in the terminal emulator program on the PC. The serial parameters are:

  • 8 bits, 1 stopbit, no parity
  • Baudrate 110, 300, 600, 1200, 2400, 4800, 9600, 14400, 19200, 28800, 38400, 57600, 115200 or 230400 baud
  • Enable RTS/CTS flow control

Note that the serial interface only looks at the USB baudrate settings. The other serial settings are ignored since the serial interface always uses 8 bits, 1 stopbit and no parity.

The final result is almost the same as the previous USB to Serial TTL version so have a look at the Instructables of my previous version.

If you are interested in using the PIC microcontroller with JAL – a Pascal like programming language – visit the JAL website.

Have fun making this Instructable and looking forward to you reactions and results.