# Interstate 75w Slow with Text Scrolling?

**URL:** <https://forums.pimoroni.com/t/interstate-75w-slow-with-text-scrolling/25065>\
**Category:** Support\
**Created:** [July 5, 2024, 2:04pm UTC](https://forums.pimoroni.com/t/interstate-75w-slow-with-text-scrolling/25065 "2024-07-05T14:04:11Z")\
**Posts on this page:** 20\
**Page:** 1

<div class="post-metadata">

**Author:** ![Smithee11](https://avatars.discourse-cdn.com/v4/letter/s/838e76/32.png) [@Smithee11](https://forums.pimoroni.com/u/Smithee11)\
**Post date:** [July 5, 2024, 2:04pm UTC](https://forums.pimoroni.com/t/interstate-75w-slow-with-text-scrolling/25065/1 "2024-07-05T14:04:11Z")

</div>

Afternoon all,

I have been adapting some code that runs on the Galatic Unicron (an MQTT message scroller)

> **[Galactic-Unicorn-MQTT-Scroller/micropython at main ·...](https://github.com/ucl-casa-ce/Galactic-Unicorn-MQTT-Scroller/tree/main/micropython)**
>
> MQTT Scroller for the Pimoroni Galactic Unicorn (PicoW) - ucl-casa-ce/Galactic-Unicorn-MQTT-Scroller

For the Interstate 75w - it all works but the when a long message comes in (around 3 lines of text) it really slows down. I’m using the same libraires, almost the same code but on a 32x64 matix.

Has anyone got any experience of the interstate75 here? Is it just the number of pixels vs the Picow?

Andy

---

<div class="post-metadata">

**Author:** ![alphanumeric](https://sea2.discourse-cdn.com/flex016/user_avatar/forums.pimoroni.com/alphanumeric/32/2729_2.png) [@alphanumeric](https://forums.pimoroni.com/u/alphanumeric)\
**Post date:** [July 5, 2024, 2:34pm UTC](https://forums.pimoroni.com/t/interstate-75w-slow-with-text-scrolling/25065/2 "2024-07-05T14:34:03Z")

</div>

I have an Interstate 75 here, with two 64x32 panels setup for 64x64. I’m displaying text but not scrolling text. I am far from any kind of expert but I’d be more than happy to run code on mine as a comparison. Or just give your code a look see.  
If you use the preformatted text option, the \</\> button, if will retain your code’s format / layout. It retains all the indents etc.

---

<div class="post-metadata">

**Author:** ![Smithee11](https://avatars.discourse-cdn.com/v4/letter/s/838e76/32.png) [@Smithee11](https://forums.pimoroni.com/u/Smithee11)\
**Post date:** [July 5, 2024, 4:52pm UTC](https://forums.pimoroni.com/t/interstate-75w-slow-with-text-scrolling/25065/3 "2024-07-05T16:52:50Z")

</div>

That would be great! its a script that listens to an open mqtt feed - there are three files that go to the pipico - config.py (just add your wifi details), mqtt\_as.py and interstatescrollbutslow.py  
[https://finchamweather.co.uk/mqttscroll.zip](https://finchamweather.co.uk/mqttscroll.zip)  
It listens for an mqtt feed which gets the time, news and the weather over 5 mins - time will work fine, bbc news and the weather seem very slow…

You will need to edit the main file accordingly for the size of your matrix…

Andy :)

---

<div class="post-metadata">

**Author:** ![alphanumeric](https://sea2.discourse-cdn.com/flex016/user_avatar/forums.pimoroni.com/alphanumeric/32/2729_2.png) [@alphanumeric](https://forums.pimoroni.com/u/alphanumeric)\
**Post date:** [July 5, 2024, 9:50pm UTC](https://forums.pimoroni.com/t/interstate-75w-slow-with-text-scrolling/25065/4 "2024-07-05T21:50:20Z")

</div>

I will give this a try over the weekend, probably tomorrow / Saturday. To much on the go to do it tonight. ;)

---

<div class="post-metadata">

**Author:** ![alphanumeric](https://sea2.discourse-cdn.com/flex016/user_avatar/forums.pimoroni.com/alphanumeric/32/2729_2.png) [@alphanumeric](https://forums.pimoroni.com/u/alphanumeric)\
**Post date:** [July 5, 2024, 10:01pm UTC](https://forums.pimoroni.com/t/interstate-75w-slow-with-text-scrolling/25065/5 "2024-07-05T22:01:23Z")

</div>

One issue for me is, while its physically 64x64, code wise its 128x32.  
`i75 = Interstate75(display=Interstate75.DISPLAY_INTERSTATE75_128X32)`  
What I’ll probably do is go 64x32 and see what happens?  
Thinking back, I was down this road before, scrolling text wise. My port / code is in this thread.  
[Interstate 75 with multiple HUB-75 LED matrix panels - Support - Pimoroni Buccaneers](https://forums.pimoroni.com/t/interstate-75-with-multiple-hub-75-led-matrix-panels/21397/14)

---

<div class="post-metadata">

**Author:** ![Smithee11](https://avatars.discourse-cdn.com/v4/letter/s/838e76/32.png) [@Smithee11](https://forums.pimoroni.com/u/Smithee11)\
**Post date:** [July 6, 2024, 3:33pm UTC](https://forums.pimoroni.com/t/interstate-75w-slow-with-text-scrolling/25065/6 "2024-07-06T15:33:20Z")

</div>

Aw i used your code to port mine :)

Andy

---

<div class="post-metadata">

**Author:** ![alphanumeric](https://sea2.discourse-cdn.com/flex016/user_avatar/forums.pimoroni.com/alphanumeric/32/2729_2.png) [@alphanumeric](https://forums.pimoroni.com/u/alphanumeric)\
**Post date:** [July 7, 2024, 8:10am UTC](https://forums.pimoroni.com/t/interstate-75w-slow-with-text-scrolling/25065/7 "2024-07-07T08:10:21Z")

</div>

I haven’t forgotten about this, some family related stuff messed up and took up most of my day yesterday. =(  
I do have every intension of playing around with your / our ;) code today for sure. I have a nice long custom USB cable for mine that lets me plug it in to my PC without having to move anything. It’s hanging on a wall and viewable from my PC.

---

<div class="post-metadata">

**Author:** ![alphanumeric](https://sea2.discourse-cdn.com/flex016/user_avatar/forums.pimoroni.com/alphanumeric/32/2729_2.png) [@alphanumeric](https://forums.pimoroni.com/u/alphanumeric)\
**Post date:** [July 7, 2024, 10:40am UTC](https://forums.pimoroni.com/t/interstate-75w-slow-with-text-scrolling/25065/8 "2024-07-07T10:40:59Z")

</div>

Not working for me? I did the config.py edit. If I run interstatemqttworksbutslow.py I get no errors, but also nothing on the RGB matrix. If I click stop thorny throws up an error and I have to reset the i75 to reconnect.  
Running the wifi test file from here  
[Connecting to the Internet with Raspberry Pi Pico W](https://datasheets.raspberrypi.com/picow/connecting-to-the-internet-with-pico-w.pdf?_gl=1*yt8q53*_ga*Mzk3MjEzNjY1LjE3MTk0ODc5Mzg.*_ga_22FD70LWDS*MTcyMDM0NzgwNC4xLjEuMTcyMDM0Nzg2My4wLjAuMA..)  
Gets me the following, wifi is working.

```auto
>>> %Run -c $EDITOR_CONTENT

MPY: soft reboot
connected
ip = 192.168.2.48
>>> 

```

---

<div class="post-metadata">

**Author:** ![Smithee11](https://avatars.discourse-cdn.com/v4/letter/s/838e76/32.png) [@Smithee11](https://forums.pimoroni.com/u/Smithee11)\
**Post date:** [July 7, 2024, 1:42pm UTC](https://forums.pimoroni.com/t/interstate-75w-slow-with-text-scrolling/25065/9 "2024-07-07T13:42:36Z")

</div>

It should connect to the MQTT broker and then its blank until a message comes in - approx every 3 mins?

---

<div class="post-metadata">

**Author:** ![alphanumeric](https://sea2.discourse-cdn.com/flex016/user_avatar/forums.pimoroni.com/alphanumeric/32/2729_2.png) [@alphanumeric](https://forums.pimoroni.com/u/alphanumeric)\
**Post date:** [July 7, 2024, 2:32pm UTC](https://forums.pimoroni.com/t/interstate-75w-slow-with-text-scrolling/25065/10 "2024-07-07T14:32:12Z")

</div>

Ok, I’ll just let it run and see what happens.

---

<div class="post-metadata">

**Author:** ![alphanumeric](https://sea2.discourse-cdn.com/flex016/user_avatar/forums.pimoroni.com/alphanumeric/32/2729_2.png) [@alphanumeric](https://forums.pimoroni.com/u/alphanumeric)\
**Post date:** [July 7, 2024, 4:08pm UTC](https://forums.pimoroni.com/t/interstate-75w-slow-with-text-scrolling/25065/11 "2024-07-07T16:08:55Z")

</div>

Nope, not seeing anything displayed?

---

<div class="post-metadata">

**Author:** ![Smithee11](https://avatars.discourse-cdn.com/v4/letter/s/838e76/32.png) [@Smithee11](https://forums.pimoroni.com/u/Smithee11)\
**Post date:** [July 7, 2024, 4:29pm UTC](https://forums.pimoroni.com/t/interstate-75w-slow-with-text-scrolling/25065/12 "2024-07-07T16:29:40Z")

</div>

ok no worries - thanks for trying, I’m assuming you left the mqtt in the config file?

Andy

---

<div class="post-metadata">

**Author:** ![alphanumeric](https://sea2.discourse-cdn.com/flex016/user_avatar/forums.pimoroni.com/alphanumeric/32/2729_2.png) [@alphanumeric](https://forums.pimoroni.com/u/alphanumeric)\
**Post date:** [July 7, 2024, 4:41pm UTC](https://forums.pimoroni.com/t/interstate-75w-slow-with-text-scrolling/25065/13 "2024-07-07T16:41:09Z")

</div>

Yes, all I changed was the WIFI SSID and Password.

---

<div class="post-metadata">

**Author:** ![Smithee11](https://avatars.discourse-cdn.com/v4/letter/s/838e76/32.png) [@Smithee11](https://forums.pimoroni.com/u/Smithee11)\
**Post date:** [July 8, 2024, 2:49pm UTC](https://forums.pimoroni.com/t/interstate-75w-slow-with-text-scrolling/25065/14 "2024-07-08T14:49:03Z")

</div>

Just tried it again here and it works with the MQTT on port 1883 - its open so no need for user names etc. Its still painfully slow with long text. Thanks for trying btw…

---

<div class="post-metadata">

**Author:** ![Smithee11](https://avatars.discourse-cdn.com/v4/letter/s/838e76/32.png) [@Smithee11](https://forums.pimoroni.com/u/Smithee11)\
**Post date:** [July 8, 2024, 4:38pm UTC](https://forums.pimoroni.com/t/interstate-75w-slow-with-text-scrolling/25065/15 "2024-07-08T16:38:31Z")

</div>

An updated version with vertical scrolling text and a smaller outline on the font - this works well - use the config.py and mqtt\_as.py from further up the thread. It should say Checking WiFi integrity.  
Got reliable connection  
Connecting to broker.  
Connected to broker.

Messages then come in every three minutes or so…

```auto
from interstate75 import Interstate75, SWITCH_A, SWITCH_B
from mqtt_as import MQTTClient, config
from config import wifi_led, blue_led
import uasyncio as asyncio
import machine
import time

# Constants for controlling scrolling text
BACKGROUND_COLOUR = (0, 0, 0) # Black background to turn off the screen
HOLD_TIME = 2.0
BLANK_SCREEN_TIME = 5.0
BUFFER_PIXELS = 2 # Increased buffer to ensure full scroll off
SCROLL_SPEED_LEVEL = 7 # Set the desired scrolling speed level (1 to 10)
SCROLL_SPEED = 1 / SCROLL_SPEED_LEVEL # Convert to a delay in seconds

# State constants
STATE_PRE_SCROLL = 0
STATE_SCROLLING = 1
STATE_POST_SCROLL = 2
STATE_BLANK_SCREEN = 3

# Create Interstate75 object and graphics surface for drawing
i75 = Interstate75(display=Interstate75.DISPLAY_INTERSTATE75_64X32)
graphics = i75.display
width = i75.width
height = i75.height

# Display-related functions
def set_background(color):
    graphics.set_pen(graphics.create_pen(*color))
    graphics.clear()

def draw_text_with_outline_multiline(text, x, y, scale=1, text_color=(255, 255, 255), outline_color=(0, 0, 0), line_height=8):
    graphics.set_font("bitmap8")
    lines = text.split('\n')
    for line_num, line in enumerate(lines):
        y_offset = y + (line_num * line_height * scale)
        
        # Draw the outline by drawing the text with minimal offsets
        graphics.set_pen(graphics.create_pen(*outline_color))
        offsets = [(-1, 0), (1, 0), (0, -1), (0, 1)]
        for dx, dy in offsets:
            graphics.text(line, x + dx, y_offset + dy, -1, scale)
        
        # Draw the main text
        graphics.set_pen(graphics.create_pen(*text_color))
        graphics.text(line, x, y_offset, -1, scale)

# MQTT Message Subscription and Display
def sub_cb(topic, msg, retained):
    global STATE_PRE_SCROLL, STATE_SCROLLING, STATE_POST_SCROLL, STATE_BLANK_SCREEN, width, height
    print(f'Topic: "{topic.decode()}" Message: "{msg.decode()}" Retained: {retained}')
    state = STATE_PRE_SCROLL
    shift = 0
    scroll = 0
    DATA = msg.decode('utf-8')
    MESSAGE = " " + DATA + " "
    
    # Split the message into lines
    words = MESSAGE.split()
    lines = []
    current_line = ""
    for word in words:
        if graphics.measure_text(current_line + " " + word, 1) <= width - 2 * (BUFFER_PIXELS + 1):
            current_line += " " + word
        else:
            lines.append(current_line.strip())
            current_line = word
    if current_line:
        lines.append(current_line.strip())
    
    message_lines = "\n".join(lines)
    num_lines = len(lines)
    line_height = 8 # Font height for scale 1
    
    last_time = time.ticks_ms()
    
    while True:
        time_ms = time.ticks_ms()
        
        if state == STATE_PRE_SCROLL and time_ms - last_time > HOLD_TIME * 1000:
            state = STATE_SCROLLING
            last_time = time_ms
        
        if state == STATE_SCROLLING and time_ms - last_time > SCROLL_SPEED * 1000:
            scroll += 1
            if scroll >= num_lines * line_height + height + BUFFER_PIXELS + 1:
                state = STATE_POST_SCROLL
                last_time = time.ticks_ms()
            last_time = time.ticks_ms()
        
        if state == STATE_POST_SCROLL and time.ticks_ms() - last_time > HOLD_TIME * 1000:
            state = STATE_BLANK_SCREEN
            last_time = time.ticks_ms()
        
        if state == STATE_BLANK_SCREEN and time.ticks_ms() - last_time > BLANK_SCREEN_TIME * 1000:
            set_background(BACKGROUND_COLOUR)
            i75.update(graphics)
            break

        set_background(BACKGROUND_COLOUR)
        
        if "Time" in MESSAGE:
            set_background((255, 255, 0))
        elif "News" in MESSAGE:
            set_background((255, 0, 0))
        elif "Weather" in MESSAGE:
            set_background((0, 255, 255))
        
        draw_text_with_outline_multiline(message_lines, x=BUFFER_PIXELS + 1, y=height - scroll + BUFFER_PIXELS, scale=1)
        
        i75.update(graphics)
        time.sleep(0.001)

# Demonstrate scheduler is operational.
async def heartbeat():
    s = True
    while True:
        await asyncio.sleep_ms(500)
        blue_led(s)
        s = not s

async def wifi_han(state):
    wifi_led(not state)
    print('Wifi is ', 'up' if state else 'down')
    await asyncio.sleep(1)

# If you connect with clean_session True, must re-subscribe (MQTT spec 3.1.2.4)
async def conn_han(client):
    # MQTT Subscribe Topic
    await client.subscribe('personal/ucfnaps/led/#', 1)

async def main(client):
    try:
        await client.connect()
    except OSError:
        print('Connection failed.')
        machine.reset()
        return
    while True:
        await asyncio.sleep(5)

# Define configuration
config['subs_cb'] = sub_cb
config['wifi_coro'] = wifi_han
config['connect_coro'] = conn_han
config['clean'] = True

# Set up client
MQTTClient.DEBUG = True # Optional
client = MQTTClient(config)

asyncio.create_task(heartbeat())

try:
    asyncio.run(main(client))
finally:
    client.close() # Prevent LmacRxBlk:1 errors
    asyncio.new_event_loop()

```

---

<div class="post-metadata">

**Author:** ![alphanumeric](https://sea2.discourse-cdn.com/flex016/user_avatar/forums.pimoroni.com/alphanumeric/32/2729_2.png) [@alphanumeric](https://forums.pimoroni.com/u/alphanumeric)\
**Post date:** [July 8, 2024, 7:05pm UTC](https://forums.pimoroni.com/t/interstate-75w-slow-with-text-scrolling/25065/16 "2024-07-08T19:05:37Z")

</div>

Nice, I’ll have a look see when I get a chance.

---

<div class="post-metadata">

**Author:** ![alphanumeric](https://sea2.discourse-cdn.com/flex016/user_avatar/forums.pimoroni.com/alphanumeric/32/2729_2.png) [@alphanumeric](https://forums.pimoroni.com/u/alphanumeric)\
**Post date:** [July 9, 2024, 5:01pm UTC](https://forums.pimoroni.com/t/interstate-75w-slow-with-text-scrolling/25065/17 "2024-07-09T17:01:46Z")

</div>

Where is the MQTT Client located? Is it yours on your network or on the World Wide Web?

---

<div class="post-metadata">

**Author:** ![Smithee11](https://avatars.discourse-cdn.com/v4/letter/s/838e76/32.png) [@Smithee11](https://forums.pimoroni.com/u/Smithee11)\
**Post date:** [July 9, 2024, 8:29pm UTC](https://forums.pimoroni.com/t/interstate-75w-slow-with-text-scrolling/25065/18 "2024-07-09T20:29:50Z")

</div>

It’s open on the web to read under port 1883….

Andy

---

<div class="post-metadata">

**Author:** ![alphanumeric](https://sea2.discourse-cdn.com/flex016/user_avatar/forums.pimoroni.com/alphanumeric/32/2729_2.png) [@alphanumeric](https://forums.pimoroni.com/u/alphanumeric)\
**Post date:** [July 9, 2024, 10:11pm UTC](https://forums.pimoroni.com/t/interstate-75w-slow-with-text-scrolling/25065/19 "2024-07-09T22:11:02Z")

</div>

Ok, still not seeing anything on screen.

---

<div class="post-metadata">

**Author:** ![Smithee11](https://avatars.discourse-cdn.com/v4/letter/s/838e76/32.png) [@Smithee11](https://forums.pimoroni.com/u/Smithee11)\
**Post date:** [July 10, 2024, 7:51am UTC](https://forums.pimoroni.com/t/interstate-75w-slow-with-text-scrolling/25065/20 "2024-07-10T07:51:17Z")

</div>

How odd - I’m running it at the moment over my mobile network so it def works - do you get :

Got reliable connection  
Connecting to broker.  
Connected to broker.

With your config.py including - its open so does not need username/password?

config[‘server’] = ‘[mqtt.cetools.org](http://mqtt.cetools.org)’ # Your MQTT Server

# config[‘server’] = ‘[test.mosquitto.org](http://test.mosquitto.org)’

config [‘port’] = 1883 #Your MQTT Port  
config[‘user’] =‘’ #Your MQTT User Name (  
config [‘password’] =‘’ # Your MQTT Password

and mqtt\_as copied over?

Andy

[Next page](https://forums.pimoroni.com/t/interstate-75w-slow-with-text-scrolling/25065.md?page=2)
