USB2Usart - How to Convert USB Signals Into a Full RS232 Port and Vice Versa
USB <-> RS232 Converter
With this design you can convert the USB signals in a RS232 complete port and vice versa, therefore you can equip your Notebook with a RS232 serial port, or equip your device with an USB port, by the simple use of the UART of your microcontroller.
There are several possibilities in order to realize the project (see the link from the last page) but the choice is made on the FTDI integrated, simple, of immediate realization, it does not need programming and the USB driver or PC are available for free.
You have to remember, moving apart the misunderstandings, that the USB connection is a DEVICE.
The full documentation in PDF here --->> DOWNLOAD
Buy the GERBER file for the realization of the printed circuit (PCB) --->> usb2usart.zip
Schematic

The schematic is very simple, practically the FT232BM integrated does everything. As a particularity you notice the feeding VCC=5V directly taken from the USB port and the optional 93C46 memory, for saving an eventual identification and therefore to distinguish the card from other similar devices connected to the USB port.
Moreover, in the upper right I have inserted a SN75176 (RS485 driver) that through the JP1-4 bridge allows you to modify the card into USB-RS485 converter.
Part List
Item Qty Reference Part Description Code Farnell
_________________________________________________________________________
1 1 CN1 CN-USB 4PIN 61729-0010B 152-754
2 9 C1,C4,C5, 100nF Cer Cap SMD 0805 422-7189
C6,C8,C9,
C10,C11,C12
3 1 C2 10nF Cer Cap SMD 0805 422-7153
4 1 C3 33nF Cer Cap SMD 0805 755-771
5 1 C7 10uF/25V Tant Cap Size 'C' 197-518
10uF/100VEl Cap P2.54 mm 320-1855
6 1 DL1 TLMA3100 Led SMD YELLOW 359-9942
7 1 DL2 TLMC3100 Led SMD GREEN 359-9954
7 1 L1 INDUCTOR MLS0805 4S4-300 305-6510
8 1 R1 470R Res SMD 0805 911-811
9 1 R2 120R Res SMD 0805 911-744
10 1 R3 1K5 Res SMD 0805 911-872
11 2 R4,R5 27R Res SMD 0805 911-665
12 1 R6 220R Res SMD 0805 911-770
13 1 R7 2K2 Res SMD 0805 911-896
14 1 R8 10K Res SMD 0805 911-975
15 1 SKT1 DB9 CON 9PIN 90°FEM 335-6036
J1 CON3 MORS P3.81mm 370-4580
16 1 U1 SN75176BD DIF BUSTransce. 571-167
17 1 U2 FT232BM USB-Serial -
18 1 U3 ADM213EAR CMOS RS-232 687-583
19 1 U4 93C46/SN CMOS EEPROM 793-632
20 1 Y1 6.00 MHZ RESON PBRC-6.00HR 574-041
// RESON KBR-6.00MKS 573-991
Buy now from Farnell (24h delivery).
The J1 connector and the U1 integrated serve for an eventual USB<->RS485 conversion and therefore they can be mounted instead of the SKT1 connector.
The U4 memory is optional.
Moreover, both for the C7 and for Y1 alternatives are provided (smd or traditional)
Printed Circuit PCB

The Layout of the Printed Circuit was planned for CNM-0413 container from PacTec.
Useful resources and links for the realization of the USB2USART plan (USB <-> RS232 converter)
FTDI --->> Producer of the FT232 integrated for the conversion of the RS232 USB signals
FTDI Driver --->> Driver for PC that allows the functioning of the FT232 integrated realizing a VCP (Virtual COM Port) on your PC that doesn't have a serial COM port
Application Note FTDI --->> Very useful for a better understanding of the management of the USB feeding at +5V
Schematics FTDI --->> All the schematics. A precious point to start
VINCULUM --->> If you have to realize converters also USB HOST
Maxim --->> Producer of the MAX213 integrated and different transceivers (RS232 - TTL signal converters)
AnalogDevice --->> Producer of the ADM213 integrated and different transceivers (RS232 - TTL signal converters)
SiliconLabs --->> USB to UART Bridge (CP2101) and 8051 microcontroller with USB (C8051F32x)
MosChip --->> USB <-> UART converters
MICROCHIP USB Device --->> Microcontrollers with integrated USB
TexasInstruments --->> Devices UsbDevice UsbHost ed i nuovi UsbOnTheGo
CYPRESS --->> UsbDevice, UsbHost, Hubs. USB Wireless leader
The full documentation in PDF here --->> DOWNLOAD
Buy the GERBER file for the realization of the printed circuit (PCB) --->> usb2usart.zip
- Chris's blog
- 9524 reads





FTDI question... maybe
Cristian,
Like everyone else, I want to thanks for you posting this code. There is no telling if I would have found it or not without this article. I am an Electrical Engineering student and I have no experience with VBA or API at all. I wouldn't even consider myself to be that good of a programmer, but here's my setup.
I am trying to devolop more or less a data acquisitionor. We are using an Xbee module to transmit some voltages and logic levels of a circuit to a laptop while the circuit is running. Ideally, I would like to get this values into excel in realtime to graph the data as it occurs. From what I've read, the Receiver USB Xbee module uses an FTDI chip to convert UArt to USB (part #FT232RL). We have it setup to transmit data every 0.1 seconds now, and I would like to have the macro wait until it receives some the data, then checks to see it it is valid, then place it in cells in Excel.
I think I have aplan that will work for placing the data where I want it and splitting the string received on the comport into graph-able data, but I have not figured out how to get it to wait for data to be received on the comm port.
Anyway, will this code work for that end goal? Some comments suggest not. If not, do you have any suggestions on how to accomplish this? I'm a hardware guy and I've never written anything like this before. I am very ignorant on the topic. Any help would be greatly appreciated!
Thanks again for the wonderful article! Below is my preliminary untested code (I do not have access to the XBee module right now). Cut me some slack please, it is most likely terrible and inefficient. The large file from the article is included with no modifications to the workbook.
-EEKizzle
=============================================================================
Sub Button2_Click()
Dim intPortID As Integer ' Ex. 1, 2, 3, 4 for COM1 - COM4
Dim i As Integer
Dim j As Integer
Dim rawData As Long
Dim serialData As String
Dim begin As String
Dim elFin As String
Dim dataValid As String
Dim check As String
Dim data As Variant
intPortID = 1
'----------------Open COM port------------------
rawData = CommOpen(intPortID, "COM" & CStr(intPortID), _
"baud=9600 parity=N data=8 stop=1")
'------Wait for Signal from Electrical Box------
' Do Until begin = "Begin"
' rawData = CommRead(intPortID, begin, 5) Continuously waits for begin command from box
' Loop
'------------------Collect Data------------------
For i = 6 To 10000 ' Sets row to place data in. Also loops until session is over. 10000 is just an absurdly large value. No run through will have this many data points.
rawData = CommRead(intPortID, check, 1) ' Read data and check for end condition or valid data
If check = "-" Then ' Indicates data collection is complete
i = 10000 ' sets i to 10000 to exit loop
ElseIf check = "+" Then ' Indicates that the line contains data we wish to graph
rawData = CommRead(intPortID, serialData, 15) ' reads string of data to be graphed
data = Split(serialData, ",") ' cuts string into individual values for graphing
For j = 2 To 6 ' sets column to place data in
Cells(i, j) = data(j - 1) ' places acquired serial data in the correct cell for graphing
Next j ' iterate column
End If ' end if statement
Next i ' iterate row
' Close COM port
Call CommClose(intPortID)
End Sub
=============================================================================
RE: FTDI question... maybe
Hi EEKizzle,
Please note that the following article might be helpful:
http://dev.emcelettronica.com/serial-port-communication-excel-vba
However, be aware that nobody has tried the code in this article with a USB to serial converter so it might not work. Actually, if you look at the following comment:
http://dev.emcelettronica.com/serial-port-communication-excel-vba#commen...
you might draw the conclusion that one user tried it, but is having problems. One alternative to VBA might be C#. Take a look at this:
http://dev.emcelettronica.com/serial-port-communication-c
It definitely works with the FTDI chips, in case the Virtual Com Port drivers are used. The compiler for C# is free and somehow C\ seems friendlier to the beginner programmer than VBA (at least this is my opinion).
Regards,
Cristian
Post new comment