Arduino Uno as an FTDI RS232 to Serial Adapter
I decided to relax a bit and assemble a kit I had lying around for quite a while. It was a SIM Reader Kit v1 from adafruit. Having assembled the tiny board, while searching for a serial cable, I realized that I didn’t have a serial port on my computer to begin with. The board did have FTDI pinouts, but I didn’t have an FTDI adapter available. After dismantling a PIC-based CAN reader that I had luck interfacing with via USB last year, and fiddling around with it to try and get the FTDI chip to transmit and receive I was about to give up.
Then I remembered I had an Arduino Uno that I thought had an FTDI chip. It didn’t, but I did find out that it in tri-state mode (with the Atmel chip in reset) I could send and receive data to pins 0 and 1 (RX and TX respectively) by simply writing and reading from the virtual serial device created by Linux after connecting the Uno via USB.
Alas, nothing, the SIM reader board didn’t seem to respond. After looking online for how SIM cards work, I started reading about the T0 protocol and found out that by default the SIM is idling and will not respond until it is reset (by setting its RST pin to low then to high). This, I think, is usually taken care of using the RTS pin of the FTDI, but unfortunately the Uno doesn’t have one. I had to add a switch that brings the RTS pin of the serial port to ground when connected.
Sure enough, some bytes started flowing in.
- RESET pin on the Uno to any ground on the Uno to enter tri-state mode.
- TX pin 1 on the Uno to TX pin on the SIM reader FTDI breakout.
- RX pin 0 on the Uno to the RX pin on the SIM reader FTDI breakout.
- Ground pin 5 from the serial port (or the FTDI breakout) to any ground on the Uno.
- RTS pin 7 from the serial port via switch to ground.
- You can additionally power the SIM reader via the 5V ouput pin of the Uno.
Everything worked and I was able to enjoy the SIM reader without having an FTDI R232 to UART (serial) board handy or a serial port on my computer thanks to the Arduino Uno.