9.d. Serial ASCII-to-Binary App


This app uses the Wixel’s two UARTs to convert between ASCII characters and “binary” data with arbitrary bytes. This can be useful if you are programming a controller with a serial interface that is limited to only transmitting ASCII characters, but you want to control a device with a serial interface that requires you to send arbitrary bytes between 0x00 and 0xFF. This app can act as a translator between your controller and such a device.

Installation Instructions

Download the Serial ASCII-to-Binary App (v1.0) (17k wxl). Open it with the Wixel Configuration Utility, choose your parameters, and then write it to a Wixel. See Section 4 for more information on how this is done.


Pin Function
P0_3 ASCII_TX Serial output, transmits ASCII (0–3.3 V)
P0_2 ASCII_RX Serial input, receives ASCII (0–3.3 V, not 5 V tolerant)
P1_6 BINARY_TX Serial output, transmits arbitrary bytes (0–3.3 V)
P1_7 BINARY_RX Serial input, receives arbitrary bytes (0–3.3 V, not 5 V tolerant)

ASCII-to-Binary conversion

ASCII characters are received on the ASCII_RX pin, converted into the appropriate bytes, and then transmitted on BINARY_TX. If you want the Wixel to send a particular byte on the BINARY_TX line, then you should send an ASCII ‘H’ character to the ASCII_RX pin, followed by the two hex digits representing the byte. For example, if you want the Wixel to transmit the byte 0xFA on BINARY_TX, send the three-byte ASCII string “HFA” to the ASCII_RX line. This example can be described as:

ASCII string “HFA” → ASCII_RX → ASCII-to-binary conversion → BINARY_TX → byte 0xFA

The delimiting ‘H’ character can be omitted, but we recommend sending it at the beginning of each transmission to make sure the Wixel is in sync with the device transmitting the ASCII. For example, to send the two bytes 0xFA and 0x1C, you could send the five-byte ASCII string “HFA1C”.

Uppercase and lowercase hex digits are both recognized. You do not need to send any newlines or other ending delimiters to the ASCII_RX line. The Wixel transmits each byte as soon as the second hex digit is received.

Binary-to-ASCII conversion

Arbitrary bytes are received on the BINARY_RX pin and an ASCII representation of them is transmitted on BINARY_TX. Whenever a byte is received on BINARY_RX, the Wixel will transmit three bytes on the ASCII_TX line: the delimiting character ‘H’ is transmitted first, followed by the two hex digits representing the byte. For the digits A–F, upper case is used. For example, if the Wixel receives 0xFB on BINARY_RX, it will transmit the three-byte ASCII string “HFB” on ASCII_TX. This example can be described as:

Byte 0xFB → BINARY_RX → Binary-to-ASCII conversion → ASCII_TX → ASCII string “HFB”

The Wixel does not ever omit the delimiting character ‘H’ when transmitting on the ASCII_TX pin.

Serial specifications

The serial interfaces of this app are non-inverted and they use 8 data bits with 1 stop bit. This is called 8-N-1. Any serial devices connected to the Wixel should use these same settings.


  • ascii_baud_rate: The baud rate of the ASCII interface (ASCII_RX and ASCII_TX), in bits per second. The default value is 9600 bps. We recommend not exceeding 115200.
  • binary_baud_rate: The baud rate of the binary interface (BINARY_RX and BINARY_TX), in bits per second. The default value is 9600 bps. We recommend not exceeding 115200.


  • If data is received on the ASCII_RX or BINARY_RX pins too quickly, it could result in the internal buffers filling up and data loss. This app has 512 bytes of buffer space for the ASCII-to-binary conversion and 512 bytes of buffer space for the binary-to-ASCII conversion.

Caution: The Wixel’s I/O lines are not 5V tolerant. You must use level-shifters, diodes, or voltage dividers to connect the Wixel to outputs from 5V systems. Also, avoid drawing more current from an I/O line than it can provide (see the discussion of maximum pin current in Section 1.a). Avoid connecting multiple output pins together.

The Wixel does not support the RS-232 voltage levels typically used by DB9 serial ports. The Wixel’s I/O lines, including the RX and TX lines, operate on voltages between 0 and 3.3 V. To connect the Wixel to an RS-232 serial signal, you will need additional level-shifting and inverting hardware like the Pololu 23201a serial adapter (RS-232 serial is inverted; the Wixel’s serial interface expects non-inverted serial).


Related Products

Wixel Programmable USB Wireless Module
Wixel Programmable USB Wireless Module (Fully Assembled)
Log In
Pololu Robotics & Electronics
Shopping cart
(702) 262-6648
Same-day shipping, worldwide
Shop Blog Forum Support
My account Comments or questions? About Pololu Contact Ordering information Distributors