Wednesday, 13 February 2013

Raspberry pi ws2801 glediator artnet

this is hardware I did to do this
http://learn.adafruit.com/light-painting-with-raspberry-pi/hardware

and with the help of Scott from 
http://thegreatgeekery.blogspot.ca/

and you can see the video of the final work
https://www.youtube.com/watch?v=ED2u5O7GyEY

apt-get update
apt-get upgrade


sudo aptitude install python-imaging-tk
sudo apt-get install python-dev

#create a file called pixelpi.py and copy the code below


nano pixelpi.py




import sys
import RPi.GPIO as GPIO
import Image
import time
import argparse
import csv
import socket
import gc

def glediator():
spidev = file(args.spi_dev_name, "wb")
print ("Start glediator listener "+args.UDP_IP+":"+str(args.UDP_PORT))
sock = socket.socket( socket.AF_INET, # Internet
socket.SOCK_DGRAM ) # UDP
sock.bind( (args.UDP_IP,args.UDP_PORT) )
while True:
data, addr = sock.recvfrom(2048)
pixels = bytearray(len(data))
u=data[18:]
d=u+"yyyyyyyyyyyyyyyyyy"
for pixel_index in range(len(data) / 3):
pixels[((pixel_index)*3):]=bytearray(d[(pixel_index * 3):((pixel_index * 3) + 3)])
spidev.write(pixels)
spidev.flush()
gc.disable()

gamma = bytearray(256)

parser = argparse.ArgumentParser(add_help=True,version='1.0', prog='pixelpi.py')
subparsers = parser.add_subparsers(help='sub command help?')
common_parser = argparse.ArgumentParser(add_help=False)
common_parser.add_argument('--chip', action='store', dest='chip_type', default='WS2801', choices=['WS2801', 'LDP8806', 'LPD6803'], help='Specify chip type LPD6803, LDP8806 or WS2801')
common_parser.add_argument('--verbose', action='store_true', dest='verbose', default=True, help='enable verbose mode')
common_parser.add_argument('--spi_dev', action='store', dest='spi_dev_name', required=False, default='/dev/spidev0.0', help='Set the SPI device descriptor')
common_parser.add_argument('--refresh_rate', action='store', dest='refresh_rate', required=False, default=500, type=int, help='Set the refresh rate in ms (default 500ms)')
parser_glediator = subparsers.add_parser('glediator', parents=[common_parser], help='glediator Mode - setup pixelpi as a glediator slave')
parser_glediator.set_defaults(func=glediator)
parser_glediator.add_argument('--udp-ip', action='store', dest='UDP_IP', required=True, help='Used for glediator mode, listening address')
parser_glediator.add_argument('--udp-port', action='store', dest='UDP_PORT', required=True, default=6454, type=int, help='Used for glediator mode, listening port')

args = parser.parse_args()
args.func()




# then save the file


sudo chown `id -u`.`id -g` /dev/spidev0.*
sudo modprobe spi_bcm2708



now download the gladiator V1.0.6

now, go to the artnet file on glediator, leave everything the same, just change this

artnet.mumber_of_nodes = 1

artnet.ip_node_0 = 192.168.1.137

artnet.number_of_universes_per_node = 1

artnet.first_universe_id_per_node = 0

artnet.number_of_pixels_per_universe = 615

artnet.pixel_mapping = 40,39,38,37,36,35,34,33,32,31,30,29,28,27,26,25,24,23,22,21,20,19,18,17,16,15,14,13,12,11,10,9,8,7,6,5,4,3,2,1,0,41,42,43,44,45,46,47,48,49,50,51,52,53,54,55,56,57,58,59,60,61,62,63,64,65,66,67,68,69,70,71,72,73,74,75,76,77,78,79,80,81,122,121,120,119,118,117,116,115,114,113,112,111,110,109,108,107,106,105,104,103,102,101,100,99,98,97,96,95,94,93,92,91,90,89,88,87,86,85,84,83,82,123,124,125,126,127,128,129,130,131,132,133,134,135,136,137,138,139,140,141,142,143,144,145,146,147,148,149,150,151,152,153,154,155,156,157,158,159,160,161,162,163,204,203,202,201,200,199,198,197,196,195,194,193,192,191,190,189,188,187,186,185,184,183,182,181,180,179,178,177,176,175,174,173,172,171,170,169,168,167,166,165,164,205,206,207,208,209,210,211,212,213,214,215,216,217,218,219,220,221,222,223,224,225,226,227,228,229,230,231,232,233,234,235,236,237,238,239,240,241,242,243,244,245,286,285,284,283,282,281,280,279,278,277,276,275,274,273,272,271,270,269,268,267,266,265,264,263,262,261,260,259,258,257,256,255,254,253,252,251,250,249,248,247,246,287,288,289,290,291,292,293,294,295,296,297,298,299,300,301,302,303,304,305,306,307,308,309,310,311,312,313,314,315,316,317,318,319,320,321,322,323,324,325,326,327,368,367,366,365,364,363,362,361,360,359,358,357,356,355,354,353,352,351,350,349,348,347,346,345,344,343,342,341,340,339,338,337,336,335,334,333,332,331,330,329,328,369,370,371,372,373,374,375,376,377,378,379,380,381,382,383,384,385,386,387,388,389,390,391,392,393,394,395,396,397,398,399,400,401,402,403,404,405,406,407,408,409,450,449,448,447,446,445,444,443,442,441,440,439,438,437,436,435,434,433,432,431,430,429,428,427,426,425,424,423,422,421,420,419,418,417,416,415,414,413,412,411,410,451,452,453,454,455,456,457,458,459,460,461,462,463,464,465,466,467,468,469,470,471,472,473,474,475,476,477,478,479,480,481,482,483,484,485,486,487,488,489,490,491,532,531,530,529,528,527,526,525,524,523,522,521,520,519,518,517,516,515,514,513,512,511,510,509,508,507,506,505,504,503,502,501,500,499,498,497,496,495,494,493,492,533,534,535,536,537,538,539,540,541,542,543,544,545,546,547,548,549,550,551,552,553,554,555,556,557,558,559,560,561,562,563,564,565,566,567,568,569,570,571,572,573,614,613,612,611,610,609,608,607,606,605,604,603,602,601,600,599,598,597,596,595,594,593,592,591,590,589,588,587,586,585,584,583,582,581,580,579,578,577,576,575,574



#and this is the Cmd to run

sudo python pixelpi.py glediator --udp-ip 192.168.1.137 --udp-port 6454


#anything let me know how works.    Luis

12 comments:

  1. Hello Luis,
    I'm setting up a 25x10 pixel matrix with PixelPi/Raspberry Pi setup.

    I've succesfully tested PixelInvaders but I don't like it very much. I would like to test your solution with glediator, but following your instructions doesn't work for me.
    I setted up artnet protocol in gledietor as you write (version 1.0.6), opened socket in properties but the everything freeze end leds did not light up.

    I've read in thegreatgeekery's blog that new PixelPi release supports artnet protocol natively, but I could not understand how to use it.

    Is something change after your last attempts ?

    Could you please help me?

    ReplyDelete
    Replies
    1. hello.

      setup in the preference on the glediator the matrix dimention 25*10, then the mapping and protocol should be artnet,

      also if you can put here the file of glediator to see it. thank you

      Delete
    2. Thanks for quick reply.
      This is artnet.propertis: http://pastebin.com/qsxWKXC5
      Should I manually map all 250 pixels? My pixels are disposed in a vertical snake, first on bottom left.

      In the newer version of gladietor there is a new gui panel for artner properties. Can I use this instead? http://img829.imageshack.us/img829/5087/96gg.png

      Delete
    3. Yes, you have to manually, you can do it easy in excel microsoft. My pixels are right to left in a horizontal snake, first the up right.

      The problem with the newer version is that you just can do 170 pixel per universe, more than that will not accepted, if you want more than that you will have to have another raspberry pi for the second universe. For some reason in the oldest version you send more than 170 pixel per universe. so with just one raspberry pi you can control as much as you can.

      Delete
    4. From right to left starting up right your mapping should be something like this

      24,23,22,21,20,19,18,17,16,15,14,13,12,11,10,9,8,7,6,5,4,3,2,1,0,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,74,73,72,71,70,69,68,67,66,65,64,63,62,61,60,59,58,57,56,55,54,53,52,51,50,75,76,77,78,79,80,81,82,83,84,85,86,87,88,89,90,91,92,93,94,95,96,97,98,99,124,123,122,121,120,119,118,117,116,115,114,113,112,111,110,109,108,107,106,105,104,103,102,101,100,125,126,127,128,129,130,131,132,133,134,135,136,137,138,139,140,141,142,143,144,145,146,147,148,149,174,173,172,171,170,169,168,167,166,165,164,163,162,161,160,159,158,157,156,155,154,153,152,151,150,175,176,177,178,179,180,181,182,183,184,185,186,187,188,189,190,191,192,193,194,195,196,197,198,199,224,223,222,221,220,219,218,217,216,215,214,213,212,211,210,209,208,207,206,205,204,203,202,201,200,225,226,227,228,229,230,231,232,233,234,235,236,237,238,239,240,241,242,243,244,245,246,247,248,249

      Delete
    5. Yes I've mapped correctly now and I'm glad to say it's perfectly working ! :)
      I like Glediator so much !
      Thank you!

      PS: Do you have managed how to control pixelpi or glediator via OSC or MIDI ?

      Delete
  2. Can we make a bigger screen like 100cm x 40cm with more pixel?

    ReplyDelete
  3. This is awesome, but I'm not sure that I'm up to doing this with what you've blogged. Any chance of a cradle to grave idiots guide?

    ReplyDelete
  4. Hello!
    I try pixelpi.py with glediator 2.0.2 but nothing happens.
    all_off, all_on, fade and chase work fine (whith original pixelpi.py). So the LED strip are working.
    Please help me configure glediator and your pixelpi.
    Thanks.

    ReplyDelete
    Replies
    1. The only way to work is with gladiator V1.0.6 if you are using more that 171 LED. Also is important to configure the preference and the mapping on gladiator.

      Delete
    2. Hello,
      I have Glediator 2 working on a 250 RGB led matrix, on 2 universes.
      I use OLA instead of pixelpi (on Raspberry Pi) and basic Glediator output configuration.
      Check out (google-translated, sorry) http://translate.google.it/translate?sl=it&tl=en&js=n&prev=_t&hl=it&ie=UTF-8&u=http%3A%2F%2Fgrechi.it%2Fblog%2F2013%2F11%2F02%2Fblem-progetto-di-matrice-led-controllata-da-un-raspberry-pi%2F&act=url

      Delete
  5. Hi there,

    What an awesome blog, very informative.Thanks for sharing this informative post.You could find seafood and meats, or you could serve your dairy and produce needs. Whatever it is in regards to food for the day or even the week, you can find it at one of these excellent little stores. This type of store can be found in many locations today.See more at-:patio de comidas

    Thanks & welcome
    Helson steven

    ReplyDelete