Closed dl2ocb closed 6 years ago
With this Code i got this: https://www.youtube.com/watch?v=Tz9S7Wzy13w
I changed this: options.multiplexing =2 options.row_address_type =2
import time
number_of_rows = 16
number_of_panels = 1
parallel =1
number_of_columns = 32
def rgbmatrix_options():
options = RGBMatrixOptions()
options.multiplexing =2
options.row_address_type =2
options.brightness = 50
options.rows = number_of_rows
options.cols = number_of_columns
options.chain_length = number_of_panels
options.parallel = parallel
options.hardware_mapping = 'regular'
options.inverse_colors = False
options.led_rgb_sequence = "RGB"
options.gpio_slowdown = 4
options.pwm_lsb_nanoseconds = 130
options.show_refresh_rate = 0
options.disable_hardware_pulsing = True
options.scan_mode = 1
options.pwm_bits = 11
options.daemon = 0
options.drop_privileges = 0
return options
options = rgbmatrix_options()
display = RGBMatrix(options=options)
def transformer(x, y, red, green, blue):
scan_rate = number_of_rows / 4
new_x = ((x / (number_of_columns/4)) * (number_of_columns/2)) + (x % (number_of_columns/4))
if y & scan_rate == 0:
new_x += number_of_columns/4
new_y = ((y / (number_of_rows/2)) * scan_rate) + (y % scan_rate)
display.SetPixel(new_x, new_y, red, green, blue)
for x in range(0, number_of_columns * number_of_panels):
for y in range(0, number_of_rows * parallel):
transformer(x, y, 0, 255, 0)
time.sleep(0.1)
used your code and got a slightly different output: https://youtu.be/hUMNfH5TPKk
I forgot to tell to try this options my friends in rows an chain_length to work.
from rgbmatrix import RGBMatrix, RGBMatrixOptions import time
number_of_rows = 16 number_of_panels = 1 parallel = 1 number_of_columns = 32
def rgbmatrix_options(): options = RGBMatrixOptions() options.multiplexing = 0 options.row_address_type = 0 options.brightness = 100 options.rows = number_of_rows/2 options.cols = number_of_columns options.chain_length = 2*number_of_panels options.parallel = parallel options.hardware_mapping = 'adafruit-hat' options.inverse_colors = False options.led_rgb_sequence = "RGB" options.gpio_slowdown = 4 options.pwm_lsb_nanoseconds = 130 options.show_refresh_rate = 0 options.disable_hardware_pulsing = True options.scan_mode = 1 options.pwm_bits = 1 options.daemon = 0 options.drop_privileges = 0 return options
options = rgbmatrix_options() display = RGBMatrix(options=options)
def transformer(x, y, red, green, blue): scan_rate = number_of_rows / 4
new_x = ((x / (number_of_columns/4)) (number_of_columns/2)) + (x % (number_of_columns/4)) if y & scan_rate == 0: (4 spaces)new_x += number_of_columns/4 new_y = ((y / (number_of_rows/2)) scan_rate) + (y % scan_rate) display.SetPixel(new_x, new_y, red, green, blue)
for x in range(0, number_of_columns number_of_panels): for y in range(0, number_of_rows parallel): transformer(x, y, 0, 255, 0) time.sleep(1)
I forgot to tell to try this options my friends with another transformer in rows an chain_length to work also.
from rgbmatrix import RGBMatrix, RGBMatrixOptions import time
number_of_rows = 16 number_of_panels = 1 parallel = 1 number_of_columns = 32
def rgbmatrix_options(): options = RGBMatrixOptions() options.multiplexing = 0 options.row_address_type = 0 options.brightness = 100 options.rows = number_of_rows/2 options.cols = number_of_columns options.chain_length = 2*number_of_panels options.parallel = parallel options.hardware_mapping = 'adafruit-hat' options.inverse_colors = False options.led_rgb_sequence = "RGB" options.gpio_slowdown = 4 options.pwm_lsb_nanoseconds = 130 options.show_refresh_rate = 0 options.disable_hardware_pulsing = True options.scan_mode = 1 options.pwm_bits = 1 options.daemon = 0 options.drop_privileges = 0 return options
options = rgbmatrix_options() display = RGBMatrix(options=options)
def transformer(x, y, red, green, blue): scan_rate = number_of_rows / 4
xoffset = (number_of_columns / 4) (x / (number_of_columns / 4)) yoffset = ((y + scan_rate) % (number_of_rows / 2)) / scan_rate new_x = x + (number_of_columns / 4) yoffset + xoffset new_y = (y % scan_rate) + scan_rate * (y / (number_of_rows / 2)) display.SetPixel(new_x, new_y, red, green, blue)
for x in range(0, number_of_columns number_of_panels): for y in range(0, number_of_rows parallel): transformer(x, y, 0, 255, 0) time.sleep(1)
Use only one panel 16x32 Dear friend Schuetzirol connected to raspberry to test the last two codes options I send. Thank you my friend and send the two videos to see if it works changing the rows and chain_length options.
The last two codes leave the Panel Black.
Dear friend Schuetzirol are you using only one panel 16x32?
yes. I think i got 16x16 Pannels. I just connected 2 panels for 16x32.
The one panel 16x16 have another transformer Dear friend Schuetzirol.
from rgbmatrix import RGBMatrix, RGBMatrixOptions import time
number_of_rows = 16 number_of_panels = 1 parallel = 1 number_of_columns = 16
def rgbmatrix_options(): options = RGBMatrixOptions() options.multiplexing = 0 options.row_address_type = 0 options.brightness = 100 options.rows = number_of_rows/2 options.cols = number_of_columns options.chain_length = 2*number_of_panels options.parallel = parallel options.hardware_mapping = 'adafruit-hat' options.inverse_colors = False options.led_rgb_sequence = "RGB" options.gpio_slowdown = 4 options.pwm_lsb_nanoseconds = 130 options.show_refresh_rate = 0 options.disable_hardware_pulsing = True options.scan_mode = 1 options.pwm_bits = 1 options.daemon = 0 options.drop_privileges = 0 return options
options = rgbmatrix_options() display = RGBMatrix(options=options)
def transformer(x, y, red, green, blue): scan_rate = number_of_rows / 2
new_x = ((x / number_of_columns) number_of_columns 2) + (7 - (x % (number_of_columns / 2))) if (x / (number_of_columns / 2)) & 1: new_x += number_of_columns if (y & scan_rate) == 0: new_x += number_of_columns / 2 new_y = ((y / (number_of_rows / 2)) * scan_rate) + (y % scan_rate) display.SetPixel(new_x, new_y, red, green, blue)
for x in range(0, number_of_columns number_of_panels): for y in range(0, number_of_rows parallel): transformer(x, y, 0, 255, 0) time.sleep(1)
this code with 16x16:
from rgbmatrix import RGBMatrix, RGBMatrixOptions
import time
number_of_rows = 16
number_of_panels = 1
parallel = 1
number_of_columns = 16
def rgbmatrix_options():
options = RGBMatrixOptions()
options.multiplexing = 0
options.row_address_type = 0
options.brightness = 100
options.rows = number_of_rows
options.cols = number_of_columns
options.chain_length = number_of_panels
options.parallel = parallel
options.hardware_mapping = 'regular'
options.inverse_colors = False
options.led_rgb_sequence = "RGB"
options.gpio_slowdown = 4
options.pwm_lsb_nanoseconds = 130
options.show_refresh_rate = 0
options.disable_hardware_pulsing = True
options.scan_mode = 1
options.pwm_bits = 1
options.daemon = 0
options.drop_privileges = 0
return options
options = rgbmatrix_options()
display = RGBMatrix(options=options)
def transformer(x, y, red, green, blue):
scan_rate = number_of_rows / 4
new_x = ((x / (number_of_columns/4)) * (number_of_columns/2)) + (x % (number_of_columns/4))
if y & scan_rate == 0:
new_x += number_of_columns/4
new_y = ((y / (number_of_rows/2)) * scan_rate) + (y % scan_rate)
display.SetPixel(new_x, new_y, red, green, blue)
for x in range(0, number_of_columns * number_of_panels):
for y in range(0, number_of_rows * parallel):
transformer(x, y, 0, 255, 0)
time.sleep(1)
i get this output: https://youtu.be/DtoryrJB19M
Use this transformer Dear friend Schuetzirol and the before code I send for one panel 16x16:
def transformer(x, y, red, green, blue): scan_rate = number_of_rows / 2
new_x = ((x / number_of_columns) number_of_columns 2) + (7 - (x % (number_of_columns / 2))) if (x / (number_of_columns / 2)) & 1: new_x += number_of_columns if (y & scan_rate) == 0: new_x += number_of_columns / 2 new_y = ((y / (number_of_rows / 2)) * scan_rate) + (y % scan_rate) display.SetPixel(new_x, new_y, red, green, blue)
@schuetzirol Hi, you used the wrong hardware option ... options.hardware_mapping = 'regular' ... think you need to have the adafruit hat here. I have different HW (The active Hat from @hzeller )
@angelogoncalve This Code:
import time
number_of_rows = 16
number_of_panels = 1
parallel =1
number_of_columns = 32
def rgbmatrix_options():
options = RGBMatrixOptions()
options.multiplexing =0
options.row_address_type =2
options.brightness = 50
options.rows = number_of_rows/2
options.cols = number_of_columns
options.chain_length = 2*number_of_panels
options.parallel = parallel
options.hardware_mapping = 'regular'
options.inverse_colors = False
options.led_rgb_sequence = "RGB"
options.gpio_slowdown = 4
options.pwm_lsb_nanoseconds = 130
options.show_refresh_rate = 0
options.disable_hardware_pulsing = True
options.scan_mode = 1
options.pwm_bits = 11
options.daemon = 0
options.drop_privileges = 0
return options
options = rgbmatrix_options()
display = RGBMatrix(options=options)
def transformer(x, y, red, green, blue):
scan_rate = number_of_rows / 4
new_x = ((x / (number_of_columns/4)) * (number_of_columns/2)) + (x % (number_of_columns/4))
if y & scan_rate == 0:
new_x += number_of_columns/4
new_y = ((y / (number_of_rows/2)) * scan_rate) + (y % scan_rate)
display.SetPixel(new_x, new_y, red, green, blue)
for x in range(0, number_of_columns * number_of_panels):
for y in range(0, number_of_rows * parallel):
transformer(x, y, 0, 255, 0)
time.sleep(0.1)
Output is here:
Try this:
from rgbmatrix import RGBMatrix, RGBMatrixOptions import time
number_of_rows = 16 number_of_panels = 1 parallel = 1 number_of_columns = 32
def rgbmatrix_options(): options = RGBMatrixOptions() options.multiplexing = 0 options.row_address_type = 0 options.brightness = 100 options.rows = number_of_rows/2 options.cols = number_of_columns options.chain_length = 2*number_of_panels options.parallel = parallel options.hardware_mapping = 'adafruit-hat' options.inverse_colors = False options.led_rgb_sequence = "RGB" options.gpio_slowdown = 4 options.pwm_lsb_nanoseconds = 130 options.show_refresh_rate = 0 options.disable_hardware_pulsing = True options.scan_mode = 1 options.pwm_bits = 1 options.daemon = 0 options.drop_privileges = 0 return RGBMatrix(options=options)
display = rgbmatrix_options() height = display.height width = display.width
def transformer(x, y, red, green, blue): scan_rate = number_of_rows / 4
xoffset = (number_of_columns / 4) (x / (number_of_columns / 4)) yoffset = ((y + scan_rate) % (number_of_rows / 2)) / scan_rate new_x = x + (number_of_columns / 4) yoffset + xoffset new_y = (y % scan_rate) + scan_rate * (y / (number_of_rows / 2)) display.SetPixel(new_x, new_y, red, green, blue)
for x in range(0, width): for y in range(0, height): transformer(x, y, 0, 255, 0) time.sleep(1)
Hello @angelogoncalve and @hzeller ... i think that was a step into the right direction.
The Panel fills in Blocks from left to right. But there are two Block (4x4) ahead of the others and the Pixels start to fill from row 5 to 8 then 1-4, 13-16 and last 9-12.
When the first four columns are filled the Pattern looks like this:
12345678
1 oooo
2 oooo
3 oooo
4 oooo
5 oooo
6 oooo
7 oooo
8 oooo
9 oooo
10 oooo
11 oooo
12 oooo
13 oooo
14 oooo
15 oooo
16 oooo
If all of the tranforming has been setup right the Panel should fill from Top down and column for column to the right direction ... is this right ?? It should look this way:
1234
1 oooo
2 oooo
3 oooo
4 oooo
5 oooo
6 oooo
7 oooo
8 oooo
9 oooo
10 oooo
11 oooo
12 oooo
13 oooo
14 oooo
15 oooo
16 oooo
This was the Code i used for the Test, i changed the "options.row_address_type = 0" line to "options.row_address_type = 2" because only with this Option i get usefull results.
from rgbmatrix import RGBMatrix, RGBMatrixOptions
import time
number_of_rows = 16
number_of_panels = 1
parallel =1
number_of_columns = 32
def rgbmatrix_options():
options = RGBMatrixOptions()
options.multiplexing =0
options.row_address_type = 2
options.brightness = 50
options.rows = number_of_rows / 2
options.cols = number_of_columns
options.chain_length = 2*number_of_panels
options.parallel = parallel
options.hardware_mapping = 'regular'
options.inverse_colors = False
options.led_rgb_sequence = "RGB"
options.gpio_slowdown = 4
options.pwm_lsb_nanoseconds = 130
options.show_refresh_rate = 0
options.disable_hardware_pulsing = True
options.scan_mode =0
options.pwm_bits = 11
options.daemon = 0
options.drop_privileges = 0
return options
options = rgbmatrix_options()
display = RGBMatrix(options=options)
def transformer(x, y, red, green, blue):
scan_rate = number_of_rows / 4
xoffset = (number_of_columns / 4) * (x / (number_of_columns / 4))
yoffset = ((y + scan_rate) % (number_of_rows / 2)) / scan_rate
new_x = x + (number_of_columns / 4) * yoffset + xoffset
new_y = (y % scan_rate) + scan_rate * (y / (number_of_rows / 2))
display.SetPixel(new_x, new_y, red, green, blue)
for x in range(0, number_of_columns * number_of_panels):
for y in range(0, number_of_rows * parallel):
transformer(x, y, 0, 255, 0)
time.sleep(0.05)
Look at the Video of the Result here: https://youtu.be/qOF7UOmbtms
@hzeller I have some problems to implement this Transformer into the multiplexing-transformers. Maybe you can help to implement this into your Framework.
@schuetzirol Is your Panel running the right way now ?
I modified your code a little bit and gets this result:
from rgbmatrix import RGBMatrix, RGBMatrixOptions
import time
number_of_rows = 16
number_of_panels = 1
parallel = 1
number_of_columns = 16
def rgbmatrix_options():
options = RGBMatrixOptions()
options.multiplexing =0
options.row_address_type = 0
options.brightness = 50
options.rows = number_of_rows / 2
options.cols = number_of_columns
options.chain_length = 2*number_of_panels
options.parallel = parallel
options.hardware_mapping = 'regular'
options.inverse_colors = False
options.led_rgb_sequence = "RGB"
options.gpio_slowdown = 4
options.pwm_lsb_nanoseconds = 130
options.show_refresh_rate = 0
options.disable_hardware_pulsing = True
options.scan_mode =0
options.pwm_bits = 11
options.daemon = 0
options.drop_privileges = 0
return options
options = rgbmatrix_options()
display = RGBMatrix(options=options)
def transformer(x, y, red, green, blue):
scan_rate = number_of_rows / 4
xoffset = (number_of_columns / 4) * (x / (number_of_columns / 4))
yoffset = ((y + scan_rate) % (number_of_rows / 2)) / scan_rate
new_x = x + (number_of_columns / 4) * yoffset + xoffset
new_y = (y % scan_rate) + scan_rate * (y / (number_of_rows / 2))
display.SetPixel(new_x, new_y, red, green, blue)
for x in range(0, number_of_columns * number_of_panels):
for y in range(0, number_of_rows * parallel):
transformer(x, y, 0, 255, 0)
time.sleep(0.05)
@dl2ocb For ease of implementation, can you have a look at the https://github.com/hzeller/rpi-rgb-led-matrix/tree/pixel-mapper branch ? I am currently working on that branch to make it simpler to define such Transformers, in the future named "PixelMapper".
The new multiplex mappers are defined in lib/multiplex-mappers.cc in that branch, and they are much simpler as you essentially only have to extend a class, implement a single method and then register it with one line in CreateMultiplexMapperList()
@hzeller @angelogoncalve Can you help to get the Transformation for my Panel fixed ? I think there is only a small step to go. I tested around but i didn't get closer to the Goal.
Am i right that the Pixels must light up from top left to bottom right Column by Column ??
@hzeller The PixelMapper thing look really good ... i will try to implement that. MANY Thanks for your Work and please tell me how i can help / donate you.
Am i right that the Pixels must light up from top left to bottom right Column by Column ?? - Yes you are right this is the correct positions mapping pixels in your panel 16x32.
Try this transformer but with my options:
def transformer(x, y, red, green, blue): scan_rate = number_of_rows / 4 new_x = ((x / (number_of_columns/4)) (number_of_columns/2)) + (x % (number_of_columns/4)) if y & scan_rate == 0: (4 spaces)new_x += number_of_columns/4 new_y = ((y / (number_of_rows/2)) scan_rate) + (y % scan_rate) display.SetPixel(new_x, new_y, red, green, blue)
or this transformer but with my options:
def transformer(x, y, red, green, blue): scan_rate = number_of_rows / 4 xoffset = (number_of_columns / 4) (x / (number_of_columns / 4)) yoffset = (y % (number_of_rows / 2)) / scan_rate new_x = x + (number_of_columns / 4) yoffset + xoffset new_y = (y % scan_rate) + scan_rate * (y / (number_of_rows / 2)) display.SetPixel(new_x, new_y, red, green, blue)
@angelogoncalve Thanks for your help !
Here are the Results of the two Transformers.
First one:
from rgbmatrix import RGBMatrix, RGBMatrixOptions
import time
number_of_rows = 16
number_of_panels = 1
parallel =1
number_of_columns = 32
def rgbmatrix_options():
options = RGBMatrixOptions()
options.multiplexing =0
options.row_address_type = 2
options.brightness = 50
options.rows = number_of_rows / 2
options.cols = number_of_columns
options.chain_length = 2*number_of_panels
options.parallel = parallel
options.hardware_mapping = 'regular'
options.inverse_colors = False
options.led_rgb_sequence = "RGB"
options.gpio_slowdown = 4
options.pwm_lsb_nanoseconds = 130
options.show_refresh_rate = 0
options.disable_hardware_pulsing = True
options.scan_mode =0
options.pwm_bits = 11
options.daemon = 0
options.drop_privileges = 0
return options
options = rgbmatrix_options()
display = RGBMatrix(options=options)
def transformer(x, y, red, green, blue):
scan_rate = number_of_rows / 4
new_x = ((x / (number_of_columns/4)) * (number_of_columns/2)) + (x % (number_of_columns/4))
if y & scan_rate == 0:
new_x += number_of_columns / 4
new_y = ((y / (number_of_rows/2)) * scan_rate) + (y % scan_rate)
display.SetPixel(new_x, new_y, red, green, blue)
for x in range(0, number_of_columns * number_of_panels):
for y in range(0, number_of_rows * parallel):
transformer(x, y, 0, 255, 0)
time.sleep(0.1)
Video of the Result: https://youtu.be/Ax_7Wh-3j04
Second one:
import time
number_of_rows = 16
number_of_panels = 1
parallel =1
number_of_columns = 32
def rgbmatrix_options():
options = RGBMatrixOptions()
options.multiplexing =0
options.row_address_type = 2
options.brightness = 50
options.rows = number_of_rows / 2
options.cols = number_of_columns
options.chain_length = 2*number_of_panels
options.parallel = parallel
options.hardware_mapping = 'regular'
options.inverse_colors = False
options.led_rgb_sequence = "RGB"
options.gpio_slowdown = 4
options.pwm_lsb_nanoseconds = 130
options.show_refresh_rate = 0
options.disable_hardware_pulsing = True
options.scan_mode =0
options.pwm_bits = 11
options.daemon = 0
options.drop_privileges = 0
return options
options = rgbmatrix_options()
display = RGBMatrix(options=options)
def transformer(x, y, red, green, blue):
scan_rate = number_of_rows / 4
xoffset = (number_of_columns / 4) * (x / (number_of_columns / 4))
yoffset = (y % (number_of_rows / 2)) / scan_rate
new_x = x + (number_of_columns / 4) * yoffset + xoffset
new_y = (y % scan_rate) + scan_rate * (y / (number_of_rows / 2))
display.SetPixel(new_x, new_y, red, green, blue)
for x in range(0, number_of_columns * number_of_panels):
for y in range(0, number_of_rows * parallel):
transformer(x, y, 0, 255, 0)
time.sleep(0.09)
Video of the Result: https://youtu.be/hqX-1K6IpbI
Use for both transformers options.row_address_type = 0 to see what happens in the panel 16x32.
@angelogoncalve OK, here we go ...
First Test with this Code:
from rgbmatrix import RGBMatrix, RGBMatrixOptions
import time
number_of_rows = 16
number_of_panels = 1
parallel =1
number_of_columns = 32
def rgbmatrix_options():
options = RGBMatrixOptions()
options.multiplexing =0
options.row_address_type =0
options.brightness = 50
options.rows = number_of_rows / 2
options.cols = number_of_columns
options.chain_length = 2*number_of_panels
options.parallel = parallel
options.hardware_mapping = 'regular'
options.inverse_colors = False
options.led_rgb_sequence = "RGB"
options.gpio_slowdown = 4
options.pwm_lsb_nanoseconds = 130
options.show_refresh_rate = 0
options.disable_hardware_pulsing = True
options.scan_mode =0
options.pwm_bits = 11
options.daemon = 0
options.drop_privileges = 0
return options
options = rgbmatrix_options()
display = RGBMatrix(options=options)
def transformer(x, y, red, green, blue):
scan_rate = number_of_rows / 4
new_x = ((x / (number_of_columns/4)) * (number_of_columns/2)) + (x % (number_of_columns/4))
if y & scan_rate == 0:
new_x += number_of_columns / 4
new_y = ((y / (number_of_rows/2)) * scan_rate) + (y % scan_rate)
display.SetPixel(new_x, new_y, red, green, blue)
for x in range(0, number_of_columns * number_of_panels):
for y in range(0, number_of_rows * parallel):
transformer(x, y, 0, 255, 0)
time.sleep(0.1)
Video is here: https://youtu.be/3cXjAh9jOv8
Second Test with this Code:
from rgbmatrix import RGBMatrix, RGBMatrixOptions
import time
number_of_rows = 16
number_of_panels = 1
parallel =1
number_of_columns = 32
def rgbmatrix_options():
options = RGBMatrixOptions()
options.multiplexing =0
options.row_address_type = 0
options.brightness = 50
options.rows = number_of_rows / 2
options.cols = number_of_columns
options.chain_length = 2*number_of_panels
options.parallel = parallel
options.hardware_mapping = 'regular'
options.inverse_colors = False
options.led_rgb_sequence = "RGB"
options.gpio_slowdown = 4
options.pwm_lsb_nanoseconds = 130
options.show_refresh_rate = 0
options.disable_hardware_pulsing = True
options.scan_mode =0
options.pwm_bits = 11
options.daemon = 0
options.drop_privileges = 0
return options
options = rgbmatrix_options()
display = RGBMatrix(options=options)
def transformer(x, y, red, green, blue):
scan_rate = number_of_rows / 4
xoffset = (number_of_columns / 4) * (x / (number_of_columns / 4))
yoffset = (y % (number_of_rows / 2)) / scan_rate
new_x = x + (number_of_columns / 4) * yoffset + xoffset
new_y = (y % scan_rate) + scan_rate * (y / (number_of_rows / 2))
display.SetPixel(new_x, new_y, red, green, blue)
for x in range(0, number_of_columns * number_of_panels):
for y in range(0, number_of_rows * parallel):
transformer(x, y, 0, 255, 0)
time.sleep(0.1)
Video is here: https://youtu.be/7x4bKsI9XEU
@dl2ocb you have matrix with direct adressing. You'd use options.row_address_type = 2
. See #509
Can you make two additional videos without any transform?
for y in range(0, display.height):
for x in range(0, display.width):
display.SetPixel(x, y, 128, 128, 128)
time.sleep(0.5)
First with following parameters:
options.multiplexing =0
options.row_address_type = 2
options.rows = number_of_rows
options.cols = number_of_columns
options.chain_length = 1
Second with following parameters:
options.multiplexing =0
options.row_address_type = 2
options.rows = number_of_rows/2
options.cols = number_of_columns*2
options.chain_length = 1
@vapiper OK, here are the Tests:
First test:
from rgbmatrix import RGBMatrix, RGBMatrixOptions
import time
number_of_rows = 16
number_of_panels = 1
parallel =1
number_of_columns = 32
def rgbmatrix_options():
options = RGBMatrixOptions()
options.multiplexing = 0
options.row_address_type = 2
options.brightness = 50
options.rows = number_of_rows
options.cols = number_of_columns
options.chain_length = 1
options.parallel = parallel
options.hardware_mapping = 'regular'
options.inverse_colors = False
options.led_rgb_sequence = "RGB"
options.gpio_slowdown = 4
options.pwm_lsb_nanoseconds = 130
options.show_refresh_rate = 0
options.disable_hardware_pulsing = True
options.scan_mode =0
options.pwm_bits = 11
options.daemon = 0
options.drop_privileges = 0
return options
options = rgbmatrix_options()
display = RGBMatrix(options=options)
for y in range(0, display.height):
for x in range(0, display.width):
display.SetPixel(x, y, 128, 128, 128)
time.sleep(0.1)
Video: https://youtu.be/HLxnOVvc0vs
Second Test:
from rgbmatrix import RGBMatrix, RGBMatrixOptions
import time
number_of_rows = 16
number_of_panels = 1
parallel =1
number_of_columns = 32
def rgbmatrix_options():
options = RGBMatrixOptions()
options.multiplexing = 0
options.row_address_type = 2
options.brightness = 50
options.rows = number_of_rows / 2
options.cols = number_of_columns * 2
options.chain_length = 1
options.parallel = parallel
options.hardware_mapping = 'regular'
options.inverse_colors = False
options.led_rgb_sequence = "RGB"
options.gpio_slowdown = 4
options.pwm_lsb_nanoseconds = 130
options.show_refresh_rate = 0
options.disable_hardware_pulsing = True
options.scan_mode =0
options.pwm_bits = 11
options.daemon = 0
options.drop_privileges = 0
return options
options = rgbmatrix_options()
display = RGBMatrix(options=options)
for y in range(0, display.height):
for x in range(0, display.width):
display.SetPixel(x, y, 128, 128, 128)
time.sleep(0.1)
@dl2ocb The last video is corrupted, but I think the second test is closer to the truth. You can try this:
def transformer(x, y, red, green, blue):
shift_even_quarter = 0
shift_odd_quarter = 0
if ((y / 4) % 2) == 0:
shift_even_quarter = 4
else:
shift_odd_quarter = 4
mx = x + ((x + shift_even_quarter) / 8) * 8 + shift_odd_quarter
my = y % 4 + 4 * (y / 8)
display.SetPixel(mx, my, red, green, blue)
for y in range(0, number_of_rows):
for x in range(0, number_of_columns):
transformer(x, y, 128, 128, 128)
time.sleep(0.1)
@vapiper OK, here is the Result of this Code:
from rgbmatrix import RGBMatrix, RGBMatrixOptions
import time
number_of_rows = 16
number_of_panels = 1
parallel =1
number_of_columns = 32
def rgbmatrix_options():
options = RGBMatrixOptions()
options.multiplexing = 0
options.row_address_type = 2
options.brightness = 50
options.rows = number_of_rows / 2
options.cols = number_of_columns * 2
options.chain_length = 1
options.parallel = parallel
options.hardware_mapping = 'regular'
options.inverse_colors = False
options.led_rgb_sequence = "RGB"
options.gpio_slowdown = 4
options.pwm_lsb_nanoseconds = 130
options.show_refresh_rate = 0
options.disable_hardware_pulsing = True
options.scan_mode =0
options.pwm_bits = 11
options.daemon = 0
options.drop_privileges = 0
return options
options = rgbmatrix_options()
display = RGBMatrix(options=options)
def transformer(x, y, red, green, blue):
shift_even_quarter = 0
shift_odd_quarter = 0
if ((y / 4) % 2) == 0:
shift_even_quarter = 4
else:
shift_odd_quarter = 4
mx = x + ((x + shift_even_quarter) / 8) * 8 + shift_odd_quarter
my = y % 4 + 4 * (y / 8)
display.SetPixel(mx, my, red, green, blue)
for y in range(0, number_of_rows):
for x in range(0, number_of_columns):
transformer(x, y, 128, 128, 128)
time.sleep(0.1)
Video:https://youtu.be/434IO9t2NMQ
Is this filling Pattern how it should be ? Or should it fill from upper left Corner to lower right Corner, Column by Column ?
@dl2ocb At the last video is the correct filling pattern. It is according to the programm.
Let's try to simplify the code:
def transformer(x, y, red, green, blue):
odd_quarter = ((y / 4) % 2)
shift_even_quarter = (1 - odd_quarter) * 4
shift_odd_quarter = ((y / 4) % 2) * 4
mx = x + ((x + shift_even_quarter) / 8) * 8 + shift_odd_quarter
my = y % 4 + 4 * (y / 8)
display.SetPixel(mx, my, red, green, blue)
@vapiper OK this transformer does the same as the one before, so its OK.
Nice, Now you have the transformer for your matrix. Can you take a photo of the back of the matrix?
OK, i started to implement it into the Code like this (old style, not Pixelmapper):
In multiplex-transformers.cc:
/********************************/
/* My New Transformer Canvas */
/********************************/
class P10outdoorTransformer::TransformCanvas : public BasicMultiplexCanvas {
public:
TransformCanvas(int panel_rows, int panel_cols) : BasicMultiplexCanvas(panel_rows, panel_cols) {}
void SetDelegatee(Canvas* delegatee);
virtual void Clear();
virtual void Fill(uint8_t red, uint8_t green, uint8_t blue);
virtual int width() const;
virtual int height() const;
virtual void SetPixel(int x, int y, uint8_t red, uint8_t green, uint8_t blue);
private:
Canvas *delegatee_;
};
void P10outdoorTransformer::TransformCanvas::SetDelegatee(Canvas* delegatee) {
delegatee_ = delegatee;
}
void P10outdoorTransformer::TransformCanvas::Clear() {
delegatee_->Clear();
}
void P10outdoorTransformer::TransformCanvas::Fill(uint8_t red, uint8_t green, uint8_t blue) {
delegatee_->Fill(red, green, blue) /* add any necessary transform of color here */;
}
int P10outdoorTransformer::TransformCanvas::width() const {
return delegatee_->width() /* add any necessary transform of width here */;
}
int P10outdoorTransformer::TransformCanvas::height() const {
return delegatee_->height() /* add any necessary transform of height here */;
}
void P10outdoorTransformer::TransformCanvas::SetPixel(int x, int y, uint8_t red, uint8_t green, uint8_t blue) {
int display_new_x;
int display_new_y;
int odd_quarter = ((y / 4) % 2);
int shift_even_quarter = (1 - odd_quarter) * 4;
int shift_odd_quarter = ((y / 4) % 2) * 4;
display_new_x = x + ((x + shift_even_quarter) / 8) * 8 + shift_odd_quarter;
display_new_y = y % 4 + 4 * (y / 8);
return delegatee_->SetPixel(display_new_x, display_new_y, red, green, blue);
}
P10outdoorTransformer::P10outdoorTransformer(int panel_rows, int panel_cols)
: canvas_(new TransformCanvas(panel_rows, panel_cols)) {
}
P10outdoorTransformer::~P10outdoorTransformer() {
delete canvas_;
}
Canvas *P10outdoorTransformer::Transform(Canvas *output) {
assert(output != NULL);
canvas_->SetDelegatee(output);
return canvas_;
}
In multiplex-transformers-internal.h:
// P10Outdoor Transformer for 1/4 scan Panels.
//
class P10outdoorTransformer : public CanvasTransformer {
public:
P10outdoorTransformer(int panel_rows, int panel_cols);
virtual ~P10outdoorTransformer();
virtual Canvas *Transform(Canvas *output);
private:
class TransformCanvas;
TransformCanvas *const canvas_;
};
And in the options-initialize.cc added an Option --led-multiplexing=5
In led-matrix.cc:
switch (params_.multiplexing) {
case 1:
ApplyStaticTransformer(internal::StripeTransformer(params_.rows * 2,
params_.cols / 2));
break;
case 2:
ApplyStaticTransformer(internal::CheckeredTransformer(params_.rows * 2,
params_.cols / 2));
break;
case 3:
ApplyStaticTransformer(internal::SpiralTransformer(params_.rows * 2,
params_.cols / 2));
break;
case 4:
ApplyStaticTransformer(internal::ZStripeTransformer(params_.rows * 2,
params_.cols / 2));
break;
case 5:
ApplyStaticTransformer(internal::P10outdoorTransformer(params_.rows * 2,params_.cols / 2));
break;
}
Anything else todo ??
Using the MultiplexMapper
class is easier then CanvasTransformer
. You'd add code in only one place.
@hzeller @angelogoncalve @vapiper @schuetzirol Final Video ... MANY Thanks for your Help !!!
@hzeller Maybe you can add this Transformer to your Codebase.
Can you take a photo of the back of the matrix?
@vapiper Here are the Pictures of the Backside of the Panel:
hey @dl2ocb i tryed your code with little changes.
from rgbmatrix import RGBMatrix, RGBMatrixOptions
import time
number_of_rows = 16
number_of_panels = 1
parallel =1
number_of_columns = 16
def rgbmatrix_options():
options = RGBMatrixOptions()
options.multiplexing = 0
options.row_address_type = 0
options.brightness = 50
options.rows = number_of_rows / 2
options.cols = number_of_columns * 2
options.chain_length = 1
options.parallel = parallel
options.hardware_mapping = 'regular'
options.inverse_colors = False
options.led_rgb_sequence = "RGB"
options.gpio_slowdown = 4
options.pwm_lsb_nanoseconds = 130
options.show_refresh_rate = 0
options.disable_hardware_pulsing = True
options.scan_mode =0
options.pwm_bits = 11
options.daemon = 0
options.drop_privileges = 0
return options
options = rgbmatrix_options()
display = RGBMatrix(options=options)
def transformer(x, y, red, green, blue):
shift_even_quarter = 0
shift_odd_quarter = 0
if ((y / 4) % 2) == 0:
shift_even_quarter = 4
else:
shift_odd_quarter = 4
mx = x + ((x + shift_even_quarter) / 8) * 8 + shift_odd_quarter
my = y % 4 + 4 * (y / 8)
display.SetPixel(mx, my, red, green, blue)
for y in range(0, number_of_rows):
for x in range(0, number_of_columns):
transformer(x, y, 128, 128, 128)
time.sleep(0.1)
but I got this result, would be very nice if you can have a look at it. https://youtu.be/RpXMVdCVrZw
@dl2ocb Can you test the new MultiplexMapper
at the branch pixel-mapper
?
@vapiper Yes i'll try it as soon as i can. Ttyl.
Dear Dl2ocB in the multiplex-transformers.cc you need to put this wright? Thank you for your help my friend.
int P10outdoorTransformer::TransformCanvas::width() const { return delegatee_->width() / 2 / add any necessary transform of width here /; }
int P10outdoorTransformer::TransformCanvas::height() const { return delegatee_->height() 2 / add any necessary transform of height here */; }
@angelogoncalve Yes thats right.
With the factor number multiplication for the with() function and the divide number factor for the height() function wright Dear Dl2ocb? Thank you for your attention.
How do i use the new MultiplexMapper, pixelmapper ?
It is not documented yet, hence it is in the separate branch @schuetzirol - but if you look at the code, it is pretty self-explanatory; the relevant part is in multiplex-mappers.cc.
From the user point-of-view, nothing changed, the multiplexing can be still be selected with --led-multiplexing=xx
FYI, the pixel-mapper branch is now merged into master. So just a plain checkout witll get you there.
Looks like this is fixed ?
I can't run it, is this the library? even though the circuit is the same. please help me set the position for NTP clock and date in one panel p10 rgb 16x32 1/4 scan
Greetings
share your options and your circuit/pinout
Greetings
share your options and your circuit/pinout
WiFiClient client; DHT dht(DHTPIN, DHTTYPE);
Ticker display_ticker;
// Pins for LED MATRIX
//JAM const char ssid = "thubatatto"; const char password = "12345678"; const long utcOffsetInSeconds = 76060; char daysOfTheWeek[7][12] = {"Sunday", "Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday"};
//TANGGAL String months[12]={"January", "February", "March", "April", "May", "June", "July", "August", "September", "October", "November", "December"};
// Define NTP Client to get time WiFiUDP ntpUDP; NTPClient timeClient(ntpUDP, "asia.pool.ntp.org", utcOffsetInSeconds);
// This defines the 'on' time of the display is us. The larger this number, // the brighter the display. If too large the ESP will crash // uint8_t display_draw_time=10; //10-50 is usually fine
//PxMATRIX display(matrix_width,matrix_height,P_LAT, P_OE,P_A,P_B,P_C); PxMATRIX display(32, 16,P_LAT, P_OE,P_A,P_B,P_C,P_CLK,P_R1); //PxMATRIX display(64,64,P_LAT, P_OE,P_A,P_B,P_C,P_D,P_E);
// Some standard colors uint16_t myRED = display.color565(255, 0, 0); uint16_t myGREEN = display.color565(0, 255, 0); uint16_t myBLUE = display.color565(0, 0, 255); uint16_t myWHITE = display.color565(255, 255, 255); uint16_t myYELLOW = display.color565(255, 255, 0); uint16_t myCYAN = display.color565(0, 255, 255); uint16_t myMAGENTA = display.color565(255, 0, 255); uint16_t myBLACK = display.color565(255, 255, 255);
uint16_t myCOLORS[8]={myRED,myGREEN,myBLUE,myWHITE,myYELLOW,myCYAN,myMAGENTA,myBLACK};
uint8_t display_draw_time=10; //10-50 is usually fine
// ISR for display refresh void display_updater() { display.display(display_draw_time); }
void display_update_enable(bool is_enable) {
if (is_enable) display_ticker.attach(0.002, display_updater); else display_ticker.detach();
}
void setup() { Serial.begin(115200); // Define your display layout here, e.g. 1/8 step display.begin(4);
display.setCursor(1,1); display.println("connecting"); WiFi.begin(ssid, password); while ( WiFi.status() != WL_CONNECTED ) { delay ( 500 ); Serial.print ( "." ); }
timeClient.begin(); // Set offset time in seconds to adjust for your timezone, for example: // GMT +1 = 3600 // GMT +8 = 28800 // GMT -1 = -3600 // GMT 0 = 0 timeClient.setTimeOffset(25200);
dht.begin(); dht.readTemperature(); dht.readHumidity();
}
void loop() { display.clearDisplay(); timeClient.update(); display.setCursor(0,0); display.fillRect(1, 1, 4, 4, display.color565(0, 0, 0)); display.setFont(&kongtext4pt7b); Serial.print(daysOfTheWeek[timeClient.getDay()]); Serial.print(", "); Serial.print(timeClient.getHours()); Serial.print(":"); Serial.print(timeClient.getMinutes()); Serial.print(":"); Serial.println(timeClient.getSeconds()); //Serial.println(timeClient.getFormattedTime());
delay(1000);
//TANGGAL unsigned long epochTime = timeClient.getEpochTime(); //Get a time structure struct tm ptm = gmtime ((time_t )&epochTime);
int monthDay = ptm->tm_mday; // Serial.print("Month day: "); // Serial.println(monthDay);
int currentMonth = ptm->tm_mon+1; // Serial.print("Month: "); // Serial.println(currentMonth);
String currentMonthName = months[currentMonth-1]; // Serial.print("Month name: "); // Serial.println(currentMonthName);
int currentYear = ptm->tm_year+1900; // Serial.print("Year: "); // Serial.println(currentYear);
//Print complete date: String currentDate = String(monthDay) + "/" + String(currentMonth) + "/" + String(currentYear); Serial.print("Current date: "); Serial.println(currentDate);
Serial.println("");
delay(2000);
//SUHU float h = dht.readHumidity(); float t = dht.readTemperature(); // or dht.readTemperature(true) for Fahrenheit
if (isnan(h) || isnan(t)) { Serial.println("Failed to read from DHT sensor!"); return; } Serial.print("Kelembaban udara = "); Serial.print(dht.readHumidity()); Serial.print("% "); Serial.print("Suhu = "); Serial.print(dht.readTemperature()); Serial.println(" C "); delay(2000);
}
I want to be like @greatproject's project but I'm using p10 rgb 16x32 1/4scan
Hello,
i got some of this nice P10 Outdoor Panels too.
They are 1/4 Scan Panels and i inserted the Code for the P10 Transformation provided by VolkerGoeschl (many many Thanks).
My HW-Config is a Raspberry Pi 3 with the active Adapter for 3 Chains and 1 Panel connected for testing.
I tested the demo Application after inserting the following Line into it:
... Upper Code .... if (rotation > 0) { matrix->ApplyStaticTransformer(RotateTransformer(rotation)); }
// INSERTED by DL2OCB -------------------------------------------------- matrix->ApplyStaticTransformer(P10outdoorTransformer()); //------------------------------------------------------------------------------------
printf("Size: %dx%d. Hardware gpio mapping: %s\n", matrix->width(), matrix->height(), matrix_options.hardware_mapping); ... more Code ....
If i got it right, this should transform the Matrix to be displayed the rigth way on an 1/4 Scan P10 Panel.
I used this commandline:
sudo ./demo -D3 --led-rows=8 --led-chain=4
The Output of the Panel looked like this:
I dont know what went wrong ... @hzeller can you give me a hint please ?
I also tried the --led-multiplex=4 Option without success.
I can provide you a Panel for testing if you need.
Many thanks for the nice Lib !!