Help please I have the above set up to make a clock display using the PicoW as the source of time. I have a problem with the setup whilst the program runs it only prints to the computer screen not the display a number which follows a sequence all numbers are of the form .87654 etc.
the display shows nothing.
I have run out of ideas on how to solve the problem, I have obviously done something wrong but am unable to resolve the program problem.
What I cannot understand is how I get nothing on the display.
A link to the display, and posting the code your running will help.
The code I am running is as listed in the Pimoroni list of programs for the display on the Pimoroni site. Having watched the video of using the display the video shows a clock working using one of the displays and also the output from the program which is what I am getting. This means either the display is faulty or the pico w is not talking to the display. Both the display and interstate75w came from Pimoroni.
Did you make sure the code your running is edited correctly for the size and type of display (LED Matrix) your using?
I am using the 32high by 64 wide display I have not altered the code as nowhere does it say to alter it- not being a expert at this what am I supposed to do to the code.
Getting Started with Interstate 75 (pimoroni.com)
Scroll down to âRunning Examplesâ and âUsing Picographicsâ.
And have a look here,
pimoroni-pico/micropython/modules_py/interstate75.md at main ¡ pimoroni/pimoroni-pico (github.com)
You can choose the HUB75 matrix display size that you wish to use by defining display=
as one of the following:
DISPLAY_INTERSTATE75_32X32
DISPLAY_INTERSTATE75_64X32
DISPLAY_INTERSTATE75_96X32
DISPLAY_INTERSTATE75_96X48
DISPLAY_INTERSTATE75_128X32
DISPLAY_INTERSTATE75_64X64
DISPLAY_INTERSTATE75_128X64
DISPLAY_INTERSTATE75_192X64
DISPLAY_INTERSTATE75_256X64
Thank you for all the help attached is the code I am using, I get a scrolling output below showing the calculation but no display on the 64x32. The output on the bottom part of Thonny is as shown
``MPY: soft reboot
Create secrets.py with your WiFi credentials to get time from NTP
0.9986278
0.9986304
0.9986332 this just continues but no output on the display`
Clock example with NTP synchronization
Create a secrets.py with your Wifi details to be able to get the time
when the Interstate75W isnât connected to Thonny.
secrets.py should contain:
WIFI_SSID = âYour WiFi SSIDâ
WIFI_PASSWORD = âYour WiFi passwordâ
import time
import math
import machine
import network
import ntptime
from interstate75 import Interstate75, DISPLAY_INTERSTATE75_64X32
i75 = Interstate75(display=DISPLAY_INTERSTATE75_64X32)
graphics = i75.display
width = i75.width
height = i75.height
try:
from secrets import WIFI_SSID, WIFI_PASSWORD
wifi_available = True
except ImportError:
print(âCreate secrets.py with your WiFi credentials to get time from NTPâ)
wifi_available = False
constants for controlling the background colour throughout the day
MIDDAY_HUE = 1.1
MIDNIGHT_HUE = 0.8
HUE_OFFSET = -0.1
MIDDAY_SATURATION = 1.0
MIDNIGHT_SATURATION = 1.0
MIDDAY_VALUE = 0.8
MIDNIGHT_VALUE = 0.3
create the rtc object
rtc = machine.RTC()
set up some pens to use later
WHITE = graphics.create_pen(255, 255, 255)
BLACK = graphics.create_pen(0, 0, 0)
@micropython.native # noqa: F821
def from_hsv(h, s, v):
i = math.floor(h * 6.0)
f = h * 6.0 - i
v *= 255.0
p = v * (1.0 - s)
q = v * (1.0 - f * s)
t = v * (1.0 - (1.0 - f) * s)
i = int(i) % 6
if i == 0:
return int(v), int(t), int(p)
if i == 1:
return int(q), int(v), int(p)
if i == 2:
return int(p), int(v), int(t)
if i == 3:
return int(p), int(q), int(v)
if i == 4:
return int(t), int(p), int(v)
if i == 5:
return int(v), int(p), int(q)
function for drawing a gradient background
def gradient_background(start_hue, start_sat, start_val, end_hue, end_sat, end_val):
half_width = width // 2
for x in range(0, half_width):
hue = ((end_hue - start_hue) * (x / half_width)) + start_hue
sat = ((end_sat - start_sat) * (x / half_width)) + start_sat
val = ((end_val - start_val) * (x / half_width)) + start_val
colour = from_hsv(hue, sat, val)
graphics.set_pen(graphics.create_pen(int(colour[0]), int(colour[1]), int(colour[2])))
for y in range(0, height):
graphics.pixel(x, y)
graphics.pixel(width - x - 1, y)
colour = from_hsv(end_hue, end_sat, end_val)
graphics.set_pen(graphics.create_pen(int(colour[0]), int(colour[1]), int(colour[2])))
for y in range(0, height):
graphics.pixel(half_width, y)
function for drawing outlined text
def outline_text(text, x, y):
graphics.set_pen(BLACK)
graphics.text(text, x - 1, y - 1, -1, 1)
graphics.text(text, x, y - 1, -1, 1)
graphics.text(text, x + 1, y - 1, -1, 1)
graphics.text(text, x - 1, y, -1, 1)
graphics.text(text, x + 1, y, -1, 1)
graphics.text(text, x - 1, y + 1, -1, 1)
graphics.text(text, x, y + 1, -1, 1)
graphics.text(text, x + 1, y + 1, -1, 1)
graphics.set_pen(WHITE)
graphics.text(text, x, y, -1, 1)
Connect to wifi and synchronize the RTC time from NTP
def sync_time():
if not wifi_available:
return
# Start connection
wlan = network.WLAN(network.STA_IF)
wlan.active(True)
wlan.config(pm=0xa11140) # Turn WiFi power saving off for some slow APs
wlan.connect(WIFI_SSID, WIFI_PASSWORD)
# Wait for connect success or failure
max_wait = 100
while max_wait > 0:
if wlan.status() < 0 or wlan.status() >= 3:
break
max_wait -= 1
print('waiting for connection...')
time.sleep(0.2)
redraw_display_if_reqd()
if wlan.status() == 3:
print("Connected")
try:
ntptime.settime()
print("Time set")
except OSError:
pass
wlan.disconnect()
wlan.active(False)
NTP synchronizes the time to UTC, this allows you to adjust the displayed time
utc_offset = 0
year, month, day, wd, hour, minute, second, _ = rtc.datetime()
last_second = second
Check whether the RTC time has changed and if so redraw the display
def redraw_display_if_reqd():
global year, month, day, wd, hour, minute, second, last_second
year, month, day, wd, hour, minute, second, _ = rtc.datetime()
if second != last_second:
hour = (hour + utc_offset) % 24
time_through_day = (((hour * 60) + minute) * 60) + second
percent_through_day = time_through_day / 86400
percent_to_midday = 1.0 - ((math.cos(percent_through_day * math.pi * 2) + 1) / 2)
print(percent_to_midday)
hue = ((MIDDAY_HUE - MIDNIGHT_HUE) * percent_to_midday) + MIDNIGHT_HUE
sat = ((MIDDAY_SATURATION - MIDNIGHT_SATURATION) * percent_to_midday) + MIDNIGHT_SATURATION
val = ((MIDDAY_VALUE - MIDNIGHT_VALUE) * percent_to_midday) + MIDNIGHT_VALUE
gradient_background(hue, sat, val,
hue + HUE_OFFSET, sat, val)
clock = "{:02}:{:02}:{:02}".format(hour, minute, second)
# set the font
graphics.set_font("bitmap8")
# calculate text position so that it is centred
w = graphics.measure_text(clock, 1)
x = int(width / 2 - w / 2 + 1)
y = 11
outline_text(clock, x, y)
last_second = second
sync_time()
while True:
redraw_display_if_reqd()
# Update the display
i75.update()
I think I must not have something not set up or the display is not working but I do not have the programming skills to take this further.
Ok, so this is the example your using?
pimoroni-pico/micropython/examples/interstate75/75W/clock.py at main ¡ pimoroni/pimoroni-pico (github.com)
# Clock example with NTP synchronization
#
# Create a secrets.py with your Wifi details to be able to get the time
# when the Interstate75W isn't connected to Thonny.
#
# secrets.py should contain:
# WIFI_SSID = "Your WiFi SSID"
# WIFI_PASSWORD = "Your WiFi password"
import time
import math
import machine
import network
import ntptime
from interstate75 import Interstate75, DISPLAY_INTERSTATE75_32X32
i75 = Interstate75(display=DISPLAY_INTERSTATE75_32X32)
graphics = i75.display
width = i75.width
height = i75.height
try:
from secrets import WIFI_SSID, WIFI_PASSWORD
wifi_available = True
except ImportError:
print("Create secrets.py with your WiFi credentials to get time from NTP")
wifi_available = False
# constants for controlling the background colour throughout the day
MIDDAY_HUE = 1.1
MIDNIGHT_HUE = 0.8
HUE_OFFSET = -0.1
MIDDAY_SATURATION = 1.0
MIDNIGHT_SATURATION = 1.0
MIDDAY_VALUE = 0.8
MIDNIGHT_VALUE = 0.3
# create the rtc object
rtc = machine.RTC()
# set up some pens to use later
WHITE = graphics.create_pen(255, 255, 255)
BLACK = graphics.create_pen(0, 0, 0)
@micropython.native # noqa: F821
def from_hsv(h, s, v):
i = math.floor(h * 6.0)
f = h * 6.0 - i
v *= 255.0
p = v * (1.0 - s)
q = v * (1.0 - f * s)
t = v * (1.0 - (1.0 - f) * s)
i = int(i) % 6
if i == 0:
return int(v), int(t), int(p)
if i == 1:
return int(q), int(v), int(p)
if i == 2:
return int(p), int(v), int(t)
if i == 3:
return int(p), int(q), int(v)
if i == 4:
return int(t), int(p), int(v)
if i == 5:
return int(v), int(p), int(q)
# function for drawing a gradient background
def gradient_background(start_hue, start_sat, start_val, end_hue, end_sat, end_val):
half_width = width // 2
for x in range(0, half_width):
hue = ((end_hue - start_hue) * (x / half_width)) + start_hue
sat = ((end_sat - start_sat) * (x / half_width)) + start_sat
val = ((end_val - start_val) * (x / half_width)) + start_val
colour = from_hsv(hue, sat, val)
graphics.set_pen(graphics.create_pen(int(colour[0]), int(colour[1]), int(colour[2])))
for y in range(0, height):
graphics.pixel(x, y)
graphics.pixel(width - x - 1, y)
colour = from_hsv(end_hue, end_sat, end_val)
graphics.set_pen(graphics.create_pen(int(colour[0]), int(colour[1]), int(colour[2])))
for y in range(0, height):
graphics.pixel(half_width, y)
# function for drawing outlined text
def outline_text(text, x, y):
graphics.set_pen(BLACK)
graphics.text(text, x - 1, y - 1, -1, 1)
graphics.text(text, x, y - 1, -1, 1)
graphics.text(text, x + 1, y - 1, -1, 1)
graphics.text(text, x - 1, y, -1, 1)
graphics.text(text, x + 1, y, -1, 1)
graphics.text(text, x - 1, y + 1, -1, 1)
graphics.text(text, x, y + 1, -1, 1)
graphics.text(text, x + 1, y + 1, -1, 1)
graphics.set_pen(WHITE)
graphics.text(text, x, y, -1, 1)
# Connect to wifi and synchronize the RTC time from NTP
def sync_time():
if not wifi_available:
return
# Start connection
wlan = network.WLAN(network.STA_IF)
wlan.active(True)
wlan.config(pm=0xa11140) # Turn WiFi power saving off for some slow APs
wlan.connect(WIFI_SSID, WIFI_PASSWORD)
# Wait for connect success or failure
max_wait = 100
while max_wait > 0:
if wlan.status() < 0 or wlan.status() >= 3:
break
max_wait -= 1
print('waiting for connection...')
time.sleep(0.2)
redraw_display_if_reqd()
if wlan.status() == 3:
print("Connected")
try:
ntptime.settime()
print("Time set")
except OSError:
pass
wlan.disconnect()
wlan.active(False)
# NTP synchronizes the time to UTC, this allows you to adjust the displayed time
utc_offset = 0
year, month, day, wd, hour, minute, second, _ = rtc.datetime()
last_second = second
# Check whether the RTC time has changed and if so redraw the display
def redraw_display_if_reqd():
global year, month, day, wd, hour, minute, second, last_second
year, month, day, wd, hour, minute, second, _ = rtc.datetime()
if second != last_second:
hour = (hour + utc_offset) % 24
time_through_day = (((hour * 60) + minute) * 60) + second
percent_through_day = time_through_day / 86400
percent_to_midday = 1.0 - ((math.cos(percent_through_day * math.pi * 2) + 1) / 2)
print(percent_to_midday)
hue = ((MIDDAY_HUE - MIDNIGHT_HUE) * percent_to_midday) + MIDNIGHT_HUE
sat = ((MIDDAY_SATURATION - MIDNIGHT_SATURATION) * percent_to_midday) + MIDNIGHT_SATURATION
val = ((MIDDAY_VALUE - MIDNIGHT_VALUE) * percent_to_midday) + MIDNIGHT_VALUE
gradient_background(hue, sat, val,
hue + HUE_OFFSET, sat, val)
clock = "{:02}:{:02}:{:02}".format(hour, minute, second)
# set the font
graphics.set_font("bitmap8")
# calculate text position so that it is centred
w = graphics.measure_text(clock, 1)
x = int(width / 2 - w / 2 + 1)
y = 11
outline_text(clock, x, y)
last_second = second
sync_time()
while True:
redraw_display_if_reqd()
# Update the display
i75.update()
The edits I would make are as follows.
DISPLAY_INTERSTATE75_64X32
i75 = Interstate75(display=DISPLAY_INTERSTATE75_64X32)
Which it looks like you have already done. Did you edit anything else in the file?
Did you create a secrets.py file? Even though itâs not needed if connected vis Thonny, I would do it anyway.
I have two 64x32 panels on my i75W so for me itâs.
DISPLAY_INTERSTATE75_128X32
Physically its 64x64, which makes coding for it fun. =(
Iâm just displaying weather info in text. Iâm not using the WIFI.
Double check youâve got the power leads from the i75 to the panel properly connected; also, what are you plugging it into? If itâs a low power USB port (laptop maybe?) you might struggle feeding it enough
Hi Folks
I have found the problem and its not what you think. It appears there are two types of displays and near the end of the Pimoroni âMicro python and Interstate75â information, I found this nugget which cured the problem:-
"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 - some newer panels have a FM6216A driver chip that requires different register settings to work.
`i75 = Interstate75(display=Interstate75.DISPLAY_INTERSTATE75_64X64, panel_type=Interstate75.PANEL_FM6126A)``
You need to change the size of the panel. Having done this all worked as expected.
Thanks for all the help, but it was an ic that was causing the problem!!
So case closed, (a note with the item would have helped) and saved 4 days of frustration.