BeagleBoard UART2. Interfacing to RFID reader ID-12

Recently we've been exploring the Beagleboard Expansion Header on our old BeagleBoard C3 board running Ubuntu 11.10. We installed Ubuntu following the instructions on http://elinux.org/BeagleBoardUbuntu#Oneiric_11.10. Then we explored the GPIO pins in the header (http://papermint-designs.com/community/node/205) finding out how to use them as inputs and outputs and later we tried the I2C bus (http://papermint-designs.com/community/node/210) using just a couple of components for those of us that do not want to invest a lot of money on simple tests.

Let's go serial!. The UART2 is available on pins 6 (Tx) and 8 (Rx) and it is exposed to the GNU/Linux operating system as /dev/ttyO1. Basically it is a 1.8V serial port and, therefore, as we know from our experience with the I2C bus we will need to convert these 1.8V signals to something else.

For our initial test we use this device (http://www.watterott.com/en/FTDI-Breakout-Reloaded-V11)

FTDI Breakout ReloadedFTDI Breakout Reloaded

This little thingy is very handy as we can work with 3.3V and 5V devices. Unfortunately the BeagleBoard uses 1.8V signals (as mentioned above) and we do need a logical level converter anyway. We will use again the Sparkfun level convertor (http://www.sparkfun.com/products/8745), but this time we can go on with 5V so no additional voltage regulator is needed. A 5V rail is available in the BeagleBoard Expansion Header pin 2.

BeagleBoard UART2. Logical level ConversionBeagleBoard UART2. Logical level Conversion

The brown cables are GND and the grey cables are power. The grey one on the right is the 5V rail coming from PIN 2 and the other one in the left is the 1.8V coming from PIN 1.

So the first test to perform is to connect the Beagleboard to a PC using the UART2, and for that purpose we just need to connect the output from our level converter to our FTDI board. This is a picture of the connections.

BeagleBoard UART2. FTDI connections detailBeagleBoard UART2. FTDI connections detail

The green cable goes to the Rx pin in the FDTI board and to the Tx pin in the BeagleBoard header through the level converter, effectively building a null-modem connection.

Now it is time to try our setup, just running any terminal emulator. We had used minicom in the PC side where the FDTI breakout board we are using pops-up as /dev/ttyUSB0. In the BeagleBoard we use something called miniterm.py because it seems to be available by default in Ubuntu. As already mentioned, the UART2 is known as /dev/ttyO1 in the Beagle.

Make sure that the RTS/CTS handshaking is disabled. It might already be disabled but, just in case, use the command stty -F /dev/ttyO1 -crtscts. At this point, whatever you write in one terminal should be shown in the other one (you might like to activate local echo, and make sure the speed is the same in booth sides).

So our setup is working OK. Let's move to interface to some serial device. We are going to used a RFID reader ID-12 and a breakout board for it (the pins in the ID-12 are not suitable for breadboard prototyping). For this specific device we only need the Rx pin. Whenever an RFID tag is exposed to the reader, it dumps the associated tag value through the serial port. This is a picture of the whole setup.

RDID Reader ID-12 to BeagleBoard UART2RDID Reader ID-12 to BeagleBoard UART2

The connections in the ID-12 are as follows:

  • PIN 1 and PIN 7 goes to GND
  • PIN 2 and PIN 11 goes to 5V
  • PIN 9 goes to the BeagleBoard Rx pin output in the level conversion

PIN 2 is used for resetting the reader. When wired to Vcc whenever a tag is detected the value is reported but no new reading is performed until the tag is removed. Controlling this pin with an GPIO allows for continuous tag reading.

The tags are reported in the serial port following the format:

02 ASCIITAG \n 03

In order to visualise the 02 and 03 codes with miniterm.py we need to use the debug mode. This is an example of the output of the setup and the command line used for that.

BeagleBoard reading RFID tags through miniterm.pyBeagleBoard reading RFID tags through miniterm.py

Another view of the setup to finish this blog entry.

BeagleBoard RFID reading through UART2BeagleBoard RFID reading through UART2

cheers
The picoFlamingo Team