Recently I acquired one of the matrix led panels selling on Aliexpress or Ebay and started to print some stuff.

Matrix%20Led%20telling%20how%20good%20you%20are%20at%20playing%20Lea%206b4fc4cb232c44a4b7b6c5dfc405bd36/1_LbhCD9qMvkglreRQqP0U3A.gif

Came to my mind that some people, including myself, need some kind of memo to remind how bad (or good huh) they are at League of Legends.

The idea is simple,Ā connect the matrix led to a microcontroller,Ā thenĀ receive some data from a script running on the computerĀ andĀ connected to the League of Legends API.

Matrix%20Led%20telling%20how%20good%20you%20are%20at%20playing%20Lea%206b4fc4cb232c44a4b7b6c5dfc405bd36/Untitled.png

Arduino Side

From the Arduino side, it is possible to connect the matrix like this:

Matrix%20Led%20telling%20how%20good%20you%20are%20at%20playing%20Lea%206b4fc4cb232c44a4b7b6c5dfc405bd36/Untitled%201.png

After having the connections well established, it is time to code. The code used in this project is based on a library from this repository, named MD_Parola. Here is the code to use: MD_Parola/Parola_Scrolling.ino at main Ā· MajicDesigns/MD_Parola (github.com).

After running and testing, the matrix should print some like: ā€œHello! Enter new message?ā€.

PC Side

If it runs smoothly, then everything is ready.Ā Connect the Arduino to the PC through USB cable.

You canĀ open a serial sessionĀ in TeraTerm (or similar software) and this text is what you got from the Arduino. Now, write something and pressĀ enter, the matrix will show whatever you write!

Matrix%20Led%20telling%20how%20good%20you%20are%20at%20playing%20Lea%206b4fc4cb232c44a4b7b6c5dfc405bd36/Untitled%202.png

If you canā€™t find which serial port is Arduino connected to, go toĀ Device ManagerĀ and checkĀ Ports.

OK, now you are good to code in python!

Code in Python

If you can output whatever you write in the serial port, you can now deal with the python code which gives us the ability to know how much time was spent in the last game played, and if the game was won or lost (we know but the computer doesnā€™t!).

Iā€™m not a python developer nor a expert in any way, but I think python is so straightforward that everyone is able to understand quickly!

First, you need python installed, then you need to install theĀ riotwatcher:

pip3 install riotwatcher

After installing riotwatcher, install PySerial in order to control serial port:

python -m pip install pyserial

Having a successful installation is mandatory to execute the python code we are going to use. Run python in the terminal to check if it is installed. Then create a file and import riotwatcher and serial ā€” this allows to check if the libraries are available to be used:

from riotwatcher import LolWatcher, ApiError
import serial

Then run:

python yourfile.py

If this test is successful you are ready to make a small changes in the final code!

Change Serial port (serial_port), API key (api_key), region (my_region) and summoners name (my_summonername).

The program will update every 30 seconds, and, although it can be changed, you can not change it much more, there are some limitations using Riot API ā€” 100 requests every 2 min. So, using 4 requests every 2 minutes we make sure everything works fine.

To change the text shown in the matrix led, change the data inside theĀ ser.write()Ā function, like:

ser.write(bā€œSoloboloā€)
# Note that the desired type is bytes.

If you are some expert in python you can add more exceptions to the code to make it more robust!

Hope you have as much fun as I had during this micro-project!