raspberry pi

RDK X5 Programming Tutorial: GPIO Control, GUI Design & Thonny IDE Guide

From GPIO Basics to GUI Control: A Practical RDK X5 Python Guide

Last Updated on December 14, 2025 by Engr. Shahzada Fahad

D-Robotics RDK X5:

If you just unboxed your RDK X5 and are looking for a complete RDK X5 programming tutorial, then this article is exactly for you. You might be wondering how to actually use it… how to control a single pin… how to design a simple GUI… or how to edit its code inside Thonny IDE.

RDK X5 GPIO programming with GUI design via Thonny IDE in rdk x5 programming tutorial

In my previous article, I unboxed the RDK X5, went through all the components, and showed you how to install the operating system and get everything running.




Today, I am not repeating any of that.

This time, Meshonology sent me another RDK X5 so I can make a complete, practical tutorial on:

  • How to use the RDK X5
  • How to control a specific pin
  • How to design a basic graphical user interface
  • How to use the Thonny IDE
  • And how to edit or modify existing code

Huge thanks to Meshnology! After my amazing experience with their Heltec LoRa 32 (N35) kit, I highly recommend visiting their website to check out their impressive range of development tools.

Many of the concepts used in this RDK X5 programming tutorial, such as GPIO control, GUI design, and Thonny IDE usage, are similar to Raspberry Pi workflows.
You can also explore our detailed Raspberry Pi GPIO Control, GUI Design & Thonny IDE Guide

Amazon Links:

RDK X5

Top HDMI Screens

Keyboard and Mouse

Other Tools and Components:

ESP32 WiFi + Bluetooth Module (Recommended)

Arduino Nano USB C type (Recommended)

*Please Note: These are affiliate links. I may make a commission if you buy the components through these links. I would appreciate your support in this way!

After reading this article, you will clearly understand how to control anything on the RDK X5.

And once you learn how to control even a single GPIO pin, you can expand this knowledge to control almost anything.

So stay tuned, and don’t skip. Read it completely; it’s simple, beginner-friendly, and step-by-step.



About the OS “Operating System”:

This time, I am using this “rdk_os_3.3.3-2025-9-28” operating system.

The method of flashing the operating system onto the SD card is exactly the same, and I already explained that step-by-step in my getting started tutorial on the RDK X5.

RDK X5 Pinout Chart:

Now before we start controlling any GPIO pin, let me show you this chart.

RDK X5 40-pin header pinout diagram for GPIO wiring in rdk x5 programming tutorial

This is the official RDK X5 40-pin header pinout, and trust me… you will be using this a lot.

At first glance, it looks big and a little complicated, but don’t worry; it’s actually very simple once you understand the layout.

Every row here represents a pin on the 40-pin header, and each column shows what that pin can do.

Some pins support multiple functions, like UART, I²C, SPI, PWM, or general GPIO.

And some pins are power pins; like 5V, 3.3V and ground.

But for this article, we will focus on the GPIO pins, because once you learn how to control even one GPIO pin, you can control LEDs, relays, sensors, motors; basically anything.

So whenever you are working on a project, just check this chart, find the pin number, and see what functions it supports.

We will keep things simple, and I will show you exactly which pin we are going to use and why.

Alright… let’s move to the practical part.



LED Connections:

I have connected an LED to pin number 37.

Controlling an LED with RDK X5 GPIO pins in rdk x5 programming tutorial

For now, I am starting with the LED because it’s simple and we can instantly see the result.

Once this works, you can replace it with a high-power load using the appropriate driver circuit.

System Configuration (srpi-config)

In the RDK X5 40-pin diagram, pin 37 is mapped to GPIO26.

But it also has another function; it can work as SPI2_MISO.

So before we use this pin as a normal GPIO, we need to make sure it’s not configured for a special function like SPI, I²C, or PWM. If a pin is already in a special mode, it won’t behave like a regular GPIO.

To confirm this, open the terminal on your RDK X5.

Simply right-click anywhere on the desktop and select “Open Terminal Here”

Now type this command:

System configuration menu access on RDK X5 shown in rdk x5 programming tutorial

Navigate to 3 Interface Options

RDK X5 interface options overview including GPIO and SPI in rdk x5 programming tutorial

And then select “I3 Peripheral bus config”.

I3 peripheral bus configuration on RDK X5 in rdk x5 programming tutorial

Ensure the pin you want to use is NOT enabled for a special function (like PWM or SPI). You can see SPI2 is disabled.RDK X5 SPI interface configuration and usage in rdk x5 programming tutorial

If all special functions for a pin group are “disabled”, the pins default to standard GPIO mode.

If you changed anything, reboot the board (sudo reboot).



Check Pre-installed Examples

The RDK X5 usually comes with example code pre-installed. You can find them here:

Next command

You should see a file named simple_out.py.

To run it, simply type:

Sample programming examples available on RDK X5 in rdk x5 programming tutorial

And as you can see, the LED has started blinking.

Simple LED blink code demonstration on RDK X5 in rdk x5 programming tutorial

This confirms that our pin is working, and everything is set up correctly.

If you want to open the file and make any changes, you can do that as well.

Just run this command in your terminal:

Inside the code, you will clearly see that pin 37 is being used.

Editing Python code with nano editor on RDK X5 in rdk x5 programming tutorial

You can modify anything you want in this file; adjust the delay, change the pin number, or add more functionality.




It’s completely up to you.

And if you prefer, you can open this same code directly in the Thonny IDE and edit it there.

Thonny makes it easier to write, test, and save your Python scripts.

While you are on the desktop, simply right-click, go to Applications, then Development, and click on Thonny IDE.

Python development environment using Thonny IDE on RDK X5 in rdk x5 programming tutorial

Once Thonny opens, click on the Open button.

Now click on Other locations.

Select Computer.

Open the app directory.

Here you will see the 40pin_samples folder; open this folder.

Python programming environment on RDK X5 board in rdk x5 programming tutorial

And now you can see all the example files right here.

You can open any of them, modify them, save them, or create your own script based on these examples.



Let’s open and run the same simple_out.py example.

Once you open the file in Thonny IDE, making changes becomes very easy.

You can edit the pin number, adjust the timing, or add print statements; whatever you need.

LED blinking Python code in Thonny IDE on RDK X5 in rdk x5 programming tutorial

Anyway, let’s go ahead and run this code.

Controlling external LED hardware with RDK X5 in rdk x5 programming tutorial

The LED started blinking.

I have also written my own version of this script, where I added print messages for LED ON and LED OFF.



RDK X5 LED Blinking Code:

So let’s run that code as well and see the output.

Printing output messages using Python on RDK X5 in rdk x5 programming tutorial



Design the GUI (using Qt Designer) Qt 5:

Now, let’s take this to another level and design a GUI for it.

To do that, we first need to install PyQt5, and the recommended way on the RDK X5 is to install it directly through apt.

This method is the most stable and works perfectly.

Open your terminal and run the following commands:

This will install everything needed for building a basic graphical interface on the RDK X5.

Updating PyQt5 packages using apt commands on RDK X5 in rdk x5 programming tutorial

Verify Installation

To check if PyQt5 was installed successfully, you can run a quick one-line import test.

Great! You can see it printed “PyQt5 is installed.” You can see in the image above.

That means everything is working perfectly.

Now type:

Designer

And press Enter.

This will open the Qt Designer tool, which we will use to visually create our GUI.

PyQt5 Designer interface on RDK X5 for GUI creation in rdk x5 programming tutorial

In the “New Form” dialog, select Main Window and click Create.

On the left side, you can see we have a lot of widgets available.

You can add anything you need for your project.

Building graphical interfaces with PyQt5 on RDK X5 in rdk x5 programming tutorial

For my LED control, I only need one Push Button and one Label, so I can update the LED status on the screen.

I have already created the user interface, so let me quickly open it.

User-friendly GUI designing for RDK X5 projects in rdk x5 programming tutorial

As you can see, I have added one label and one button.

For the button; I set the objectName to btn_toggle.

And I changed the button text to “Toggle LED”.

Now similarly, for the label:

I set the objectName to lbl_status.

And the text is set to “LED is OFF.”

Once your design is complete, go ahead and save the project.

I have saved it with the name led_control.ui.

I have also written the Python code to load this led_control.ui file and control the LED.

Copy and paste the following code in Thonny IDE.

Let’s run this script.




Practical Demonstration:

RDK X5 GUI UI layout demonstration in rdk x5 programming tutorial

As you can see, we can now control the LED through this button; and at the same time, we can also monitor the LED status right here on the screen. You can easily replace this LED with a MOSFET or a relay to control high-amp DC or even AC loads. I only used a single button in this demo, but you can add multiple buttons to control multiple loads without any issues.

So, that’s all for now.



Watch Video Tutorial:

Related Tutorial Videos:

 

 


Discover more from Electronic Clinic

Subscribe to get the latest posts sent to your email.

Engr. Shahzada Fahad

Engr. Shahzada Fahad is an Electrical Engineer with over 15 years of hands-on experience in electronics design, programming, and PCB development. He specializes in microcontrollers (Arduino, ESP32, STM32, Raspberry Pi), robotics, and IoT systems. He is the founder and lead author at Electronic Clinic, dedicated to sharing practical knowledge.

Related Articles

Leave a Reply

Your email address will not be published. Required fields are marked *

Back to top button

Discover more from Electronic Clinic

Subscribe now to keep reading and get access to the full archive.

Continue reading

Electronic Clinic
Privacy Overview

This website uses cookies so that we can provide you with the best user experience possible. Cookie information is stored in your browser and performs functions such as recognising you when you return to our website and helping our team to understand which sections of the website you find most interesting and useful.