Return to Robotics Tutorials

Robot Telemetry Controller with Touchscreen

After successfully controlling my 4WD robot from a 2.8GHz RC Transmitter, I decided to add two-way telemetry control to the robot. This meant replacing the RC PWM transmitter with a custom controller integrating ZigBee (XBee) wireless, a 2.8" TFT touchscreen and telemetry data visualization. The following article describes how I built the controller with a Raspberry Pi and PiTFT using C.

Custom Telemetry Robot Controller
Prototype of Telemetry Robot Controller

Over time, I have explored many options for Robot Remote Controllers. The most advanced solution is the telemetry controller.

Goals for the Robot Controller

The Turnigy 9X 2.8GHz RC Transmitter I had been using for the robot controller was working very nicely. It was far more useable than the PS2 Controller I had started with. The pair of 2-axis joysticks on the R/C Transmitter were much more precise and didn't suffer from the same deadzone problems that the Thumbpad-style PS2 Controller had.

However, using an R/C Transmitter for a robot has some significant disadvantages: lack of telemetry, inflexibility in controller switch mappings and a lack of switches that are suited to the robot.

With the two-way wireless telemetry robot controller, I can now implement a number of advanced features, as shown below.

Features of Telemetry Controller

  • Control Input
    • Multiple two-axis gimbals
    • Multiple potentiometers
    • Toggle switches
    • Calibration of control stick input and deadzone
  • Navigation
    • GPS information (coordinates and speed)
    • Heading
    • Odometry / mapping / SLAM
    • Autopilot decision feedback
    • Inertial measurement (Accelerometer, Gyro, etc.)
  • Motor controls
    • Differential drive
    • Motor current sensing
  • Live Sensor Readout
    • Proximity sensors (IR, Ultrasonic)
    • Battery voltage & current
  • Wireless Control
    • ZigBee (XBee) signal strength

PiTFT 2.8" Capacitive Touchscreen

Reviewing a few of the options available for the display, I settled on the 2.8" PiTFT capacitive display which uses SPI for the 320x240 TFT LCD screen control, I2C for the capacitive touch input and a form-factor that sits nicely atop the Raspberry Pi GPIO pins.

There are also other similar TFT LCDs that range in size from 2.2" to 7.0". While it is tempting to get a larger TFT that offers greater resolution, there are several downsides to consider other than cost:

  • Refresh rate. The higher resolution can dramatically decrease the frame rate of the display since the total pixel count to serial to the display increases. For example, a number of reviews on the 3.8" version of the PiTFT commented on the less favorable refresh rate. That said, if you are not displaying frequently-updated data (such as video), this may be less of a concern.
  • Power consumption: In the example of the 2.8" PiTFT screen, it is reported to consume approximately 100mA from the Raspberry Pi's +5v pin. At 100mA, it is still possible to drive the display from the RPi's primary regulator, but a larger display may require its own separate power input.
  • Form factor: a larger display may not integrate as nicely into a handheld controller.

The 2.8" PiTFT screen attaches to a Raspberry Pi by way of the 40-pin GPIO header. One very nice feature of this particular display is that a second 40-pin header is provided to enable access to the remainder of the pins not used by the display. Be careful using this second GPIO header as it is easy to get the polarity incorrect (I did this at first before realizing it!).

Adafruit sells an attractive faceplate for the PiTFT that includes 4 push-buttons on the side. This faceplate does not provide any means of mounting other than to their custom Pi case, and even then it is only a pressure-fit. Unfortunately, if you want to route a GPIO cable out of the case then you will find that the position of the second GPIO header does not match up with the slot on the side of the case. This meant that I had to cut another slot in the case (on the opposite side) to allow the cable to be routed out (if you don't do this carefully then the pressure-fit of the faceplate is compromised).

Wireless ZigBee Transceiver

XBee Pro S1 + Adapter

The two-way wireless remote control uses a XBee Pro, which is the 60mW version of the Series 1 ZigBee transmitter / receiver module. This module is then mounted atop an Adafruit XBee Adapter board to allow easy interfacing to a breadboard.

I chose the high-power (60mW) version as it offers much greater range (advertised as 300m indoors, or 1.6km outdoors) versus the 1mW version. However, one needs to keep in mind that selecting this high-power version means that your power source and voltage regulation has to be sized accordingly (eg. approx 100mA from 5v source).

On the digital side, the XBee module provides a UART interface which can connect nicely to the Raspberry Pi's UART (TXD and RXD pins). At this point in time I have not hooked up the hardware flow control (ie. CTS pin) but may do so after I have increased the data rate.

Touchscreen GUI / Menu

Custom Robot Telemetry Screen
Custom Telemetry Menu Screen

In order to provide an easy-to-use interface without needing to add a large number of switches and dials, I decided to use a touchscreen menu system. With a robot controller there are countless functions that may need to be configured -- providing a physical switch / control can lead to a confusing array of dials. By offering a touchscreen menuing system, I can hide lesser-used functions behind other pages accessed via the menu.

The most common implementation of a GUI for the PiTFT is PyGame, a fully-featured GUI written in Python. As I want to have all code on my robot (onboard robot CPU, co-processor microcontrollers, telemetry controller, etc.) written in C or C++, I did not follow the traditional PyGame path. Instead, I wrote my own touchscreen menu / GUI library in C, called GUIslice.

GUIslice C library

The GUIslice library is a lightweight GUI / menuing system for LCD / TFT displays, in addition to support for touchscreen operation. The library is written in C and generic enough to use in just about any other application. I intend to release this library for others to use, if there is interest.

Control Inputs

FrSKY 2-axis Joystick / Gimbal

For the initial prototype of the Telemetry Robot Remote Control, I included a pair of 2-axis joysticks and four potentiometers. I plan to add a few toggle switches as well.

2-axis Joysticks / Gimbals

TBD. Gimbal wiring, Potentiometer wiring, A2D conversion.

I searched all over for a suitable set of 2-axis joystick / gimbals for the remote control. Ignoring the professional $100+ models, we are left with a couple high-quality gimbals with the remainder being a cheap pair of potentiometers. The only high-quality 2-axis joysticks I could find in a reasonble price range were:

  • Aurora 9 Gimbal
    (Available from for U$20 each)
    Potentiometer resistance is approx 5kOhms
  • FrSKY Replacement Gimbal for Taranis Transmitter
    (Available from for U$13 each)
    Potentiometer resistance is approx 2.3kOhms

Wiring up the Controller

It was a relatively simple matter to wire up the controller:

  • Joysticks
    Each FrSKY / Taranis gimbal has a pair of potentiometers (variable resistors) with their own independent wiring (Red=VCC, Orange=OUT and Brown=GND). I wired the 3.3v power rail from the Raspberry Pi across all four joystick potentiometers. As each potentiometer has a full-scale resistance of approximately 2.3kOhm, the net result will be a current draw of ~3.3/(2300/4) = 6mA. Note that a higher potentiometer resistance will enable you to run more potentiometers in parallel (for the same current draw).
  • Analog-to-Digital conversion
    Unlike most Arduino / AVR microcontrollers, the Raspberry Pi lacks built-in Analog-to-Digital (A2D) capabilities. So, the variable output voltage of each potentiometer is fed into a ADS1115 4-channel 16-bit A2D converter which provides the sampled voltage via an I2C interface.
  • XBee Transmitter / Receiver
    The XBee Pro S1 is placed on a XBee Adapter board which provides access to the majority of the important module pins. At a minimum, connect up the following:
    • XBee TX ⇒ RPi RXD
    • XBee RX ⇐ RPi TXD
    • XBee +5V ⇐ RPi +5V


CPU Selection

TBD. Currently using Raspberry Pi. Code in C. Interfaces required: Serial UART, I2C.


Reader's Comments:

Please leave your comments or suggestions below!


Leave a comment or suggestion for this page:

(Never Shown - Optional)