OLED Displays

OLED displays can be used to show information about the current state of the car. This is especially useful in the when collecting data for training, and when racing.

The OLED display currently displays the following information: * The IP address of the car (eth and wlan) * The number of records collected, for training. * The driving mode.

Supported displays

Examples of displays that are currently supported are:

Hardware Setup

Simply connect the display to the I2C pins on the Raspberry Pi or the Jetson Nano. Use bus 1 so the display can be inserted directly on the pins. Here is an example of what that looks like.

Software Setup

Enable the display in myconfig.py by uncommenting this line USE_SSD1306_128_32 = False by removing the # at the start and change False to True. If you have a 128x32 OLED select resolution 1, if you have 128x64 select resolution 2 and don't forget to remove the # in front of that line, too, to make it active.

This part of your myconfig.py file should now look like this.

USE_SSD1306_128_32 = True    # Enable the SSD_1306 OLED Display
# SSD1306_128_32_I2C_ROTATION = 0 # 0 = text is right-side up, 1 = rotated 90 degrees clockwise, 2 = 180 degrees (flipped), 3 = 270 degrees
SSD1306_RESOLUTION = 2 # 1 = 128x32; 2 = 128x64

Showing your IP address on startup.

One of the cool things about having an OLED screen is that you can show your car's IP address on startup, so you can connect to it. Instructions to set that up are here


If you are unable to start the car, ensure that the Adafruit_SSD1306 package is installed in your virtual environment. This should automatically be installed, if you are using a recent version of donkeycar.

pip install Adafruit_SSD1306

Known Issues

  • The Adafruit_SSD1306 library is incompatible with steering/motor configurations when the Duty Cycle/PWM is supplied directly from GPIO header using the RPI_GPIO pin provider. This is because internally the Adafruit library sets a GPIO pin mode that is incompatible with our GPIO library. In this case you have a couple of options:
  • Use a PCA9685 to generate the necessary duty cycle/PWM for throttle and steering.
  • Use the PIGPIO pin provider to generate the necessary duty cycle/PWM for throttle and steering from the GPIO. See PIGPIO for how to set up the pigpio library.