Maker.io main logo

Getting Started with Interstate 75

257

2022-06-23 | By Pimoroni

License: See Original Project

Courtesy of Pimoroni

Guide by Pimoroni

Interstate 75 is a RP2040-powered driver board for HUB75-style panels - the ‎LED matrix panels that you sometimes see making up big fancy billboards or ‎scrolling LED signage. We've made it so it can slot tidily into the back of a ‎panel, with minimal extra hardware required.‎

This tutorial will show you how to plug things in and how to start making things ‎light up, and it includes basic getting started instructions for both MicroPython ‎and CircuitPython.‎

What You'll Need

  • An Interstate 75
  • A USB-C cable (for programming)‎
  • One (or more) RGB LED matrix panels
  • If your project involves multiple panels, lots of brightness or you just ‎want to run it untethered from your computer, you'll need an external 5v ‎power supply attached to Interstate 75's screw terminals. An easy way ‎to breakout wires from a barrel jack power supply is with a screw ‎terminal block (the kind with a socket).‎

panel_1

Power

You can power Interstate 75 and attached panels either through the screw ‎terminals or (if you're drawing a modest amount of power) via the USB-C ‎connector. LED matrix panels are hungry beasties - officially a 64x64 panel ‎can consume up to 4 amps of electricity. Unofficially, you will probably get ‎away with a lot less ampage than this if you're using it for things like displaying ‎text or numbers and not driving the panels hard - we've had our clock and ‎scrolling text examples running on four 64x64 panels from a 2A supply.‎

If your panels are in need of a power supply upgrade you might see glitching, ‎flickering or find your Interstate 75 is constantly rebooting.‎

Connecting Up One Panel

For this tutorial, we're going to assume that you have a single panel and ‎you're powering everything through the USB-C connector on Interstate 75. ‎We've not had any problems powering a single panel from our computer, but if ‎you want to ensure that your computer's expensive USB ports are protected ‎from an excess of current, plug Interstate 75 into a powered hub or hook up ‎an external 5V power supply to the screw terminals.‎

If your project involves multiple panels, it's probably a good idea to start off ‎hooking up a single panel to make sure everything's working.‎

HUB75 panels have 16 pin data in and data out connectors on the back - ‎you'll need to plug Interstate 75 into the data in connector. The backs of the ‎panels should all have arrow markings which you can use to see the direction ‎in which the data should be flowing through the panel.‎

Here are the backs of the panels we stock with the data in connector marked ‎in red. Markings and layouts may vary slightly from batch to batch!‎

batch_2

Go ahead and plug the pre-soldered socket header on Interstate 75 into the ‎data in connector on your panel. The data connector has a nubbin on one side ‎of it so you can only plug it in one way.‎

plug_3

Connecting the Power Cable

To power the panel, you'll need to connect the fork connectors on the red and ‎black power cable that came with the panel to the screw connectors on ‎Interstate 75, red to + and black to -. Make sure you have the polarity correct! ‎Loosen up the screws and slot the fork in-between the screw and the metal ‎post, then tighten up the screws and give the wires a little tug to check they're ‎securely held in place.‎

connect_4

The other end of the cable has a white plug on it - plug this to the power ‎connector on your panel (marked 'power' on some panels, or just VCC and ‎GND on others). The clippy part of this connector means it should also only go ‎in one way round, though there's no harm in checking that the red wires go ‎into VCC and the black wire is connected to GND.‎

cable_5

We've also attached the little magnetic feet that you get with the panel - ‎they're useful if you want to stick your project to a metal surface like a ‎noticeboard or your fridge.‎

Connecting Up Multiple Panels

We're not going to go a huge amount of detail about chaining multiple panels ‎in this tutorial, but you can use the grey ribbon cables that come with the ‎panels - just plug one end of this cable into the vacant data out connector on ‎the first panel, and the other end into the data in connector of the next panel ‎into the chain.‎

Each panel will need powering, so you'll either have to connect another fork ‎connector to the screw terminals or come up with some sort of custom wiring ‎harness arrangement, like the double ended cable power cable in the photo ‎below. We used some bits of Lego and M3 12mm screws to fasten these two ‎‎64x64 panels together, which makes for a nice rigid join that would be easy to ‎expand into a little stand.‎

power_6

If you're using more than one panel, we'd definitely recommend hooking up ‎an external power supply whilst you program Interstate 75 (or disconnecting ‎power from the panels), though modern computers and power supplies should ‎have circuitry to protect themselves from USB over-current mishaps.‎

MicroPython

The LED matrix drivers in our C++/MicroPython build make use of RP2040's ‎programmable IOs and DMA to update the LEDs quickly in the background, ‎minimising CPU usage and maximising colour depth. Our library will let you ‎set individual pixels to a RGB or HSV colour value (and we've included some ‎examples of how to use these simple functions to do interesting things, like ‎clocks and scrolling text).‎

INSTALLING OUR CUSTOM MICROPYTHON BUILD

If you're brand new to Raspberry Pi Pico/RP2040s, you might find the step by ‎step instructions in our Getting Started with Raspberry Pi Pico ‎tutorial useful - it will show you how to install our custom MicroPython build ‎and goes into more detail about how to use Thonny . Here's a quick TLDR!‎

  • Download the most recent MicroPython .uf2 from the Releases page of ‎our pimoroni-pico Github repository (either version, with Blinka or ‎without, will work).‎
  • Hold down the BOOT button of Interstate 75, and then press, and ‎release, the RESET button. This will put it into bootloader mode, and it ‎should appear as a drive on your computer called RPI-RP2.‎
  • Copy the .uf2 file to the RPI-RP2 drive - once you've done that Interstate ‎‎75 will reboot running Pirate brand MicroPython (it won't show up as a ‎drive anymore).‎
  • Install Thonny
  • Open up Thonny. Make sure the interpreter (shown in the box on the ‎bottom right corner) is set to 'MicroPython (Raspberry Pi Pico)'. If ‎everything's working as it should look something like this. The flashing ‎cursor next to the >>> in the 'Shell' box tells you that Interstate 75 is ‎talking to your computer and is ready to accept instructions!‎

thonny_7

LIGHTING UP THE ONBOARD RGB LED

As a test that the board is working properly and you have the correct version ‎of MicroPython installed, you can light up Interstate 75's onboard RGB LED ‎red with the following code - you can enter it line by line in the REPL (that's ‎the bottom 'Shell' box in Thonny) or copy and paste the whole thing into the ‎top box and hit the green run button to save the code to your Interstate 75. If ‎you choose to save it, you'll be prompted for a filename.‎

Copy Code
import hub75
from pimoroni import RGBLED

led = RGBLED(hub75.LED_R, hub75.LED_G, hub75.LED_B)

led.set_rgb(255, 0, 0)

The three numbers after set_rgb are an RGB (Red Green Blue) colour code, ‎and each number should be between 0-255.‎

RUNNING THE EXAMPLES

You can find the MicroPython examples here - the generic examples are good ‎to start with as they don't need any dependencies. If you click on the raw ‎button, it makes it easy to copy and paste them into the top box in Thonny.‎

Some examples require font_8x12.py or font_10x14.py to be saved on your ‎Interstate 75 - copy and paste 'em into Thonny and click Save As > Raspberry Pi Pico. ‎Make sure you give them the same filename as they have on Github!‎

LIGHTING INDIVIDUAL LEDS ON THE MATRIX

If you're new to matrices and want to start from the basics we'd recommend ‎playing around with the REPL to get to grips with things (that's the bottom box ‎in Thonny, where you enter code line by line). First, we need to initialise the ‎matrix. Here's how to do that for a 64 x 64 panel - enter the following code line ‎by line, changing the width and height to match your panel size.‎

Copy Code
import hub75

WIDTH = 64
HEIGHT = 64

matrix = hub75.Hub75(WIDTH, HEIGHT)

matrix.start()‎

To light a pixel in a particular colour, we have to do two things: first, we have ‎to use the set_rgb function to specify which pixel we want to light and in what ‎colour and, second, we have to use the flip() function to update the matrix and ‎actually display the pixel that we set.‎

Pixels are organised by their x/y coordinates from the top left-hand corner, so ‎the top left pixel is 0, 0 and the bottom right pixel is 16, 6. Remember that, in ‎Python, things are numbered from 0 rather than from 1.‎

The colours of pixels are specified by an RGB colour value. Each colour can ‎be represented by mixing a particular amount of Red, Green, and Blue, from 0 ‎to 255, meaning that you can get over 16 million different colours!! As an ‎example, pure red is 255, 0, 0 and white is 255, 255, 255.‎

Let's light the top left pixel red. Type the following:‎

Copy Code
matrix.set_rgb(0, 0, 255, 0, 0)
matrix.flip()

To clear any pixels that you've set, you can use the clear() function, followed ‎by flip():‎

Copy Code
matrix.clear()
matrix.flip()

LIGHTING ALL OF THE PIXELS USING A FOR LOOP

To light all of the pixels, it's just a matter of repeating the process we just did ‎once for each of the pixels. We can make this really quick and easy by using ‎two for loops: one to loop through each column, and another to loop through ‎each pixel in each of those columns.‎

This time, we'll light the pixels cyan, which is a mix of pure blue and pure ‎green and so can be represented by the RGB colour 0, 255, 255.‎

Type the following (the four space indents are important, but Thonny should ‎add them automatically):‎

Copy Code
for x in range(WIDTH):
for y in range(HEIGHT):
matrix.set_rgb(x, y, 0, 255, 255)

You might need to press enter twice to tell the interpreter you're done with ‎your for loop and get the >>> prompt back. Then type:‎

Copy Code
matrix.flip()

MAKING IT BLINK!‎

Now we're going to add a while loop to make all the pixels blink pink. All we ‎have to do is continuously light all of the pixels pink, using the technique we ‎just learned, and clear them again, with a short delay, maybe a quarter of a ‎second in between.‎

Type the following (we'll need to import time for this one, so here's the whole ‎thing again):‎

Copy Code
import hub75
import time

WIDTH = 64
HEIGHT = 64

matrix = hub75.Hub75(WIDTH, HEIGHT)

matrix.start()
while True:
for x in range(WIDTH):
for y in range(HEIGHT):
matrix.set_rgb(x, y, 255, 0, 255)
matrix.flip()
time.sleep(0.25)
matrix.clear()
matrix.flip()
time.sleep(0.25)

Again, if you're using the REPL you might need to press enter twice to break ‎out of the loop.‎

This is just the same as in the example where we made all of the pixels light in ‎cyan, except we changed the RGB colour to 255, 0, 255 and we added a couple ‎of lines to sleep for a quarter of a second - time.sleep(0.25) - and to clear all of ‎the pixels - matrix.clear().‎

There are also functions in the library to set a pixel to a HSV value rather than ‎a RGB value, and to remember colours so that the RP2040 doesn't have to ‎calculate the colour value every time - using these can radically improve ‎performance. Find them in the quick reference!‎

USING THE BUTTONS

Our MicroPython build includes shared helper functions to make it easy to use ‎the buttons and onboard LED (you might be familiar with these if you've been ‎playing with a Plasma 2040). This example makes the LED light up green ‎when you press the A button, and blue when you press the BOOT button.‎

Copy Code
import hub75
from pimoroni import RGBLED, Button

led = RGBLED(hub75.LED_R, hub75.LED_G, hub75.LED_B)

button_a = Button(hub75.BUTTON_A)
button_boot = Button(hub75.BUTTON_USER)

led.set_rgb(0, 0, 0)

while True:
if button_a.read():
led.set_rgb(0, 255, 0)
if button_boot.read():
led.set_rgb(0, 0, 255)

TROUBLESHOOTING

If you're getting a weird, glitchy top row on your matrix or if the right LEDs ‎aren't lighting up, try initialising your matrix like this:‎

Copy Code
matrix = hub75.Hub75(WIDTH, HEIGHT, stb_invert=True)

If your matrix isn't lighting up at all when you run the examples (and if you ‎aren't getting any errors in Thonny), first double check that Interstate 75 is ‎plugged into the data in connector on your matrix. If it is, it might be worth ‎giving this option a go - we found a few 64 x 64 panels with a non-standard ‎FM6216A chip that require different register settings to work.‎

Copy Code
matrix = hub75.Hub75(WIDTH, HEIGHT, panel_type=hub75.PANEL_FM6126A)

CircuitPython

CircuitPython drivers are designed to work on a bunch of different ‎microcontrollers, so you won't get the fancy RP2040-architecture specific ‎tweaks that you'll find in our library. You will get access to Adafruit's mighty ‎DisplayIO library though, which gives you lots of tools for displaying all sorts of ‎different kinds of text, shapes and even simple images.‎

INSTALLING CIRCUITPYTHON AND LIBRARIES

To install CircuitPython -‎

  • Download the Interstate 75 CircuitPython .uf2. You'll probably also ‎need the CircuitPython driver bundle (be sure to grab the one that ‎matches the version of CircuitPython that you just downloaded)‎
  • Hold down the BOOT button of Interstate 75, and then press, and ‎release, the RESET button. This will put it into bootloader mode, and it ‎should appear as a drive on your computer called RPI-RP2
  • Copy the CircuitPython .uf2 to the RPI-RP2 drive. After a few seconds, it ‎should reappear as a drive called CIRCUITPY
  • With CircuitPython, you always save your code as code.py, and it will run ‎automatically. You don't need to use Thonny, you can edit code.py with ‎any text editor. Using Mu as your editor is handy though, as it lets you ‎view the serial console which can be useful for debugging error ‎messages

RUNNING THE EXAMPLES

You can find some RGB matrix code examples in RGB LED Matrices with ‎CircuitPython. To use them with Interstate 75, just point them at the right ‎pins when initialising your matrix object, like this:‎

32 X 32 OR 32 X 64 MATRIX‎

Copy Code
matrix = rgbmatrix.RGBMatrix(
width=64, height=32, bit_depth=6,
rgb_pins=[board.R0, board.G0, board.B0, board.R1, board.G1, board.B1],
addr_pins=[board.ROW_A, board.ROW_B, board.ROW_C, board.ROW_D],
clock_pin=board.CLK, latch_pin=board.LAT, output_enable_pin=board.OE)

64 X 64 MATRIX‎

Copy Code
matrix = rgbmatrix.RGBMatrix(
width=64, height=64, bit_depth=6,
rgb_pins=[board.R0, board.G0, board.B0, board.R1, board.G1, board.B1],
addr_pins=[board.ROW_A, board.ROW_B, board.ROW_C, board.ROW_D, board.ROW_E],
clock_pin=board.CLK, latch_pin=board.LAT, output_enable_pin=board.OE)

USING THE BUTTONS AND LED

Here's a quick example of how to use Interstate 75's buttons and RGB LED in ‎CircuitPython (you'll need to grab adafruit_rgbled.py and simpleio.mpy from the ‎library bundle and pop them in your lib folder on CIRCUITPY).‎

Copy Code
import board
import digitalio
import adafruit_rgbled
import busio

button_boot = digitalio.DigitalInOut(board.USER_SW)
button_boot.direction = digitalio.Direction.INPUT
button_boot.pull = digitalio.Pull.UP

button_a = digitalio.DigitalInOut(board.SW_A)
button_a.direction = digitalio.Direction.INPUT
button_a.pull = digitalio.Pull.UP

led = adafruit_rgbled.RGBLED(board.LED_R, board.LED_G, board.LED_B, invert_pwm = True)

def button_read(button):
return not button.value

while True:
if button_read(button_a):
led.color = (0, 255, 0)
if button_read(button_boot):
led.color = (0, 0, 255)

Next Steps

Now that you know how to drive an LED matrix with a RP2040, how about ‎hooking up a Breakout Garden breakout and using it to display sensor data, ‎like temperature and humidity You could attach an encoder and make an ‎RGB Etch-A-Sketch. Or a real-time clock so that your giant holiday ‎countdown timer keeps track of time when it's powered off?‎

That's all folks!

Mfr Part # PIM584
INTERSTATE 75
Pimoroni Ltd
14,93 €
View More Details
Mfr Part # 5362
64X64 RGB LED MATRIX PANEL - 2MM
Adafruit Industries LLC
47,14 €
View More Details
Mfr Part # PIM582
PLASMA 2040
Pimoroni Ltd
13,98 €
View More Details
Mfr Part # PIM472
BME280 BREAKOUT - TEMPERATURE, P
Pimoroni Ltd
13,72 €
View More Details
Mfr Part # PIM522
RGB ENCODER BREAKOUT
Pimoroni Ltd
10,47 €
View More Details
Mfr Part # PIM449
RV3028 REAL-TIME CLOCK BREAKOUT
Pimoroni Ltd
12,78 €
View More Details
Mfr Part # 368
ADAPT TERM BL 2POS TO 2.1MM JCK
Adafruit Industries LLC
1,72 €
View More Details
Add all DigiKey Parts to Cart
Have questions or comments? Continue the conversation on TechForum, DigiKey's online community and technical resource.