Category Archives: Hardware

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.

Uno as USB to Serial converter

Sure enough, some bytes started flowing in.

So:

  • 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.



A new, much better home for my code

I have been having trouble with my former low-end VPS provider after two years of quite stable service. They decided to move data centers, and my OpenVZ box ended up being corrupted during the move. I have been looking to move for quite a while now. First of all I started using Arch Linux a while ago, and have been enjoying effortless rolling updates and upgrades every day. My former server was running Ubuntu 10.04 for 2 years, and due to fear of breaking it during updates (yes, it happens more often than one might think) I was stuck with some pretty old libraries, and although I managed to compile PHP and ngnix every six months or so to stay up to date, other newer packages required newer libraries, which in turn required a new kernel, etc.

So I was looking for a VPS provider with Arch images. Amazon AWS is quite expensive, although Arch Linux AMI images are available from Uplink Labs. But besides that, I’ve also been looking to switch to XEN virtualization, to have guaranteed memory, the power of swap and other advantages over OpenVZ and Virtuozzo offered by many companies.

After having tried out several alternatives on the low-end market, it’s been nothing but headaches, for the past month. So I decided to go for a safe, proven and mainstream provider – Linode. Fit my criteria of carrying Arch images (1.8% of deployments are Arch on Linode), XEN virtualization, quite low-end and budget-friendly, 2TB of data transfer, and promised effortless upgrades. The only downside was their lack of support for PayPal payments (very probably justified). So I had to get a prepaid virtual card.

So, as of a couple of days ago, the new home for my dozen of sites, and repositories is a blazingly fast XEN Arch Linux box at Linode. I’m quite sure I wont’ be disappointed.

What have you tried? What do you use now?



ELM327 to RS232 in Linux

I have been having car problems recently. However, these inspired me to dig a little into the car ECU. ECUs (engine control units) are able to give out a myriad of information, like systems’ fault codes, real-time RPM, air-flow, fuel consumption, voltage, exhaust state, and lots more. Most modern cars tap into this information and display it on the dashboard via on-board computers.

OBD2 ELM327 to RS232 Linux

I finally received the long-awaited OBD II (OBD 2) (on-board diagnostics) interpreter based on the ELM327 chip yesterday and all I can say is that it’s been a long night.

Continue reading