The RTK GPIO board allows you to connect the world of physical computing to you desktop PC or laptop. The RTK GPIO board emulates the original Raspberry Pi 40-pin GPIO header allowing you to program for the Raspberry Pi on your computer. The board is fully compatible with Windows, Mac OS and Linux and supports a range of programming languages such as Python, Java and also use with Scratch.
This quick start guide will show you what you need to get started with programming the RTk.GPIO board including downloading and installing the software.
- Desktop/Laptop computer
- RTk.GPIO board
- Micro USB cable
Note: A micro USB cable does not come supplied with the RTk.GPIO board
The following guide has been tested to work with Debian Linux, in particular on the Raspberry Pi computer itself. There are a number of dependencies that also need to be installed such as some Python3 modules. To install the RTk.GPIO library there are just 4 simple steps:
Step 1 – Permission Change
To begin we are going to first add the user to the “dialout” group. This means after installation you don’t have to use sudo to run the python programs.
Open the Linux terminal and type i the following command:
sudo usermod -a -G dialout $USER
Step 2 – Python Requirements
Now we are going to make sure that Python and its libraries are installed. For the RTk.GPIO library we need to use Python3 packages. Open up the terminal and type in the following command:sudo apt-get install python3-pip python3-setuptools python3-wheel
Step 3 – Reboot and Plug i
To make sure everything installed ok and is in sync it is recommended to initialise a reboot. While some aspects will work you may experience issues without a reboot.
After rebooting your Linux OS you can now insert your RTk.GPIO board into your Linux PC or Raspberry Pi. When you insert the USB cable you should see the Red LED light up.
Step 4 – Installing the Library
There are a couple of ways you can install the RTk.GPIO library. The easiest way is to use the Python in Package (PIP) management system. To install the RTk.GPIO library use the following command form the terminal:sudo -H pip3 install RTk
Alternatively if you download this GitHub repository you can run the following command:sudo python setup.py install
Step 1 – Install Drivers
Mac OS does not include the required driver like most Linux operating systems and does not have central driver system like windows, therefore a driver has to be installed to communicate with the UART chipset on the RTk.GPIO board.
The manufacturer of the chipset provides a driver, however it causes issues on the latest version of OS (Sierra). A user on GitHub has a modified fix that has resolved some of those issues. Download the files from https://github.com/adrianmihalko/ch340g-ch34g-ch34x-mac-os-x-driver and install the driver package.
Note: A reboot is required
Step 2 – Reboot and Plug in
After you have rebooted you Mac you can now plug in your RTk.GPIO board using a micro USB cable. When you connect the board you should see the Red LED light up to indicate it has power to the board.
Step 4 – Install dependancies
Open up the terminal window and type (copy/paste) the following:
/usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"brew install python3 sudo -H pip3 install RTk
Step 5 – Installing the library
here are a couple of ways you can install the RTk.GPIO library. The easiest way is to use the Python in Package (PIP) management system. To install the RTk.GPIO library use the following command form the terminal:sudo -H pip3 install RTk
Alternatively if you download this GitHub repository you can run the following command from the Software directory:sudo python setup.py install
The following instruction will work for Windows 7, 8 and 10.
Step 1 – Install Python
You can download the latest Python packages from https://www.python.org/downloads . The RTk.GPIO library was programmed using Python 3.6 but if there is a newer version then please download the latest version. Wait for the download to finish then click on the installer and follow the on-screen instructions to install Python.
A pop up box may appear asking you if you want to allow the app to make changes. Click Yes to install.
Step 2 – Connect your board
Now you can connect the RTk.GPIO board to your computer using a micro USB cable. When you plug it in to your USB port you should see the Red LED light up to indicate it is powered up. When you connect it to a windows computer it should automatically detect and install the drivers automatically for you.
Step 2.5 – Drivers
We’ve had reports that windows now is requiring the drivers to be installed manually, this process is rather simple by doing the following:
Download the drivers from https://github.com/PiSupply/Ryanteck/raw/master/RTK.GPIO/Software/CH341SER.EXE and run the installer. You may be asked to give permissions of which when asked click yes.
Then you should get the following screen appear.
Then click install and it should shortly then pop up to say it’s been installed of which you can close the program and re-plug in the RTk.GPIO.
Step 3 – Install RTk.GPIO Library
To install the RTk.GPIO library you will need to open the command prompt within Windows and type in the following command:pip3 install RTk
Note: PIP installs with Python on Windows platform
There are a number of examples that you can use in the Software > examples folder, however if you wish to program your own Python programs then you will need to either use a text editor from the command line such as nano or a graphical interface such as Atom.
You download the latest version of Atom from http://atom.io
The Python Library requires the following line in your code:from RTk import GPIO
There are a number of examples in our GitHub repository at https://github.com/PiSupply/Ryanteck that you can use to get started with. To download the repository simply click the download button and Download ZIP from the main page.
You can also download the repository from the command line by typing in the following command:git clone https://github.com/PiSupply/Ryanteck.git
Note: You will need to have download GitHub client prior to this command
The easiest way to test you board and whether the RTk.GPIO library has successfully installed is to connect an LED to any of the free GPIO pins on the RTk.GPIO HAT and then run the led-test.py program. The program will cycle through all of the GPIO pins turning them on and off as it goes through them. When your connected LED lights up then you know that the library is working and you are indeed able to connect to your board from your computer.
led-test.py#TrafficHAT KS Demo from time import sleep t = 0.2 import RTk.GPIO as GPIO gpios = [0,1,2,3,4,5,6,7,8,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27] GPIO.setmode(GPIO.BCM) for cGPIO in gpios: print("Testing GPIO %s", cGPIO); GPIO.setup(cGPIO,GPIO.OUT) GPIO.output(cGPIO,1) input("Press enter to continue") GPIO.output(cGPIO,0)&amp;amp;lt;/pre&amp;amp;gt;
You should see your LED light up as per the image below: