OREGON STATE UNIVERSITY

You are here

TekBots

TXB0108 8-channel Bi-Directional Logic Level Shifter

Using the TXB0108 Logic Level Shifter this quick start will show how to connect a UART channel between Beagle Bone Black (logic level 3.3V) and a Teensy 2.0 (logic level 5V). To validate the connection we will send an “a” from the Beagle Bone Black to the Teensy 2.0 and the Teensy will automatically respond with “Hello World”.

Materials:

      • TXB0108 logic level shifter
      • Male header
      • Female to female jumper wires
      • Teensy 2.0 microcontroller
      • USB to USB-mini
      • Beagle Bone Black (BBB)

Steps:

      1. Solder male header pins on the module. If you have not assembled the Teensy 2.0 board yet, do it now.

Level Shifter

      1. Using the jumper wires connect all devices: 
        *Note: You must have a common Ground between all devices. I used a breadboard to make a common ground node.

Level Shifter Level Shifter

      1. Load the example code RS232.hex on to the teensy using the Teensy bootloader.

Level Shifter

      1. Open Putty on your PC and connect to your BBB. If you do now know how to connect your beagle bone via Putty, follow this tutorial.
      2. Once you are connected to the internet and have Putty running execute the following commands:
        • sudo apt-get update
        • sudo apt-get install build-essential python-dev python-setuptools python-pip python-smbus –y
        • sudo pip install Adafruit_BBIO pyserial
      3. In a text editor create the following program on your BBB or import the teensy.py file provided:
        import
        serial
        import
        Adafruit_BBIO.UART
        as
        UART
        UART
        .setup("UART2")
        #initialize BBB UART to use UART 02 
        ser
        =
        serial
        .Serial(port
        =
        "/dev/ttyO2", baudrate=9600, timeout=4)
        #open comms with the teensy
        if
        ser
        .isOpen():
        #check if we can write something to serial
        print
        "Teensy serial is open!"
        ser
        .write("a")
        #send to teensy
        buf
        =
        ser
        .readline()
        #grab the response from the teensy
        print
        buf ser.close()
    
      1. Execute the following command:
        • python teensy.py
        • Enter “a” to initiate communication

Level Shifter

    1. Congratulations you have successfully used the TXB0108 Logic Level Shifter to make a UART channel between your BBB and Teensy 2.0!