neophob / PixelController

(LED) Matrix Control Software, supports various Hardware, Keywords: LED Matrix, OSC, Realtime, VJ, Arduino, Teensy, RPI
www.pixelinvaders.ch
GNU General Public License v3.0
285 stars 103 forks source link

2.1.0-RC1 Firmware does not work on RPi with Teensy++ 2.0 #74

Open neophob opened 10 years ago

neophob commented 10 years ago

But works with the 2.0 Firmware. RPi use the latest firmware. wheezy distro:

Linux pixelinvader 3.12.20+ #685 PREEMPT Fri May 23 18:59:01 BST 2014 armv6l GNU/Linux

Details:

Mai 27, 2014 8:13:42 PM com.neophob.sematrix.core.output.Output <init>
Information: Output created: PIXELINVADERS, Layout: HORIZONTAL, BPP: 5, Gamma Correction: GAMMA_22
Mai 27, 2014 8:13:42 PM com.neophob.sematrix.core.output.pixelinvaders.Lpd6803Serial <init>
Information: Initialize LPD6803 lib v2.2
RXTX Warning:  Removing stale lock file. /var/lock/LCK..ttyACM0
Mai 27, 2014 8:13:42 PM com.neophob.sematrix.core.output.pixelinvaders.Lpd6803Serial <init>
Information: open port: /dev/ttyACM0
Mai 27, 2014 8:13:42 PM com.neophob.sematrix.core.output.transport.serial.SerialImpl openPort
Information: Try to open serial port /dev/ttyACM0
Mai 27, 2014 8:13:44 PM com.neophob.sematrix.core.output.pixelinvaders.Lpd6803Serial waitForAck
Information: got ACK: AK PXI1 ERR: -50
Mai 27, 2014 8:13:44 PM com.neophob.sematrix.core.output.pixelinvaders.Lpd6803Serial <init>
Information: found serial port: </dev/ttyACM0>
Mai 27, 2014 8:13:44 PM com.neophob.sematrix.core.output.PixelInvadersSerialDevice <init>
Information: 
PING result: true

Mai 27, 2014 8:13:44 PM com.neophob.sematrix.core.api.impl.PixelControllerServerImpl setupInitialConfig
Information: Load preset 0
Mai 27, 2014 8:13:44 PM com.neophob.sematrix.core.listener.MessageProcessor loadActivePreset
Information: Load Preset ...
Mai 27, 2014 8:13:44 PM com.neophob.sematrix.core.visual.fader.TransitionManager <init>
Information: Transition Manager created, saved 1 visual output buffer(s)
Mai 27, 2014 8:13:44 PM com.neophob.sematrix.core.listener.MessageProcessor processMsg
Information: Update Transition Manager, output 0 should have new visual 0
Mai 27, 2014 8:13:44 PM com.neophob.sematrix.core.listener.MessageProcessor processMsg
Information: Update Transition Manager, output 0 should have new visual 1
Mai 27, 2014 8:13:45 PM com.neophob.sematrix.core.visual.generator.Blinkenlights loadFile
Information: Load blinkenlights file torus.bml (input torus.bml).
Mai 27, 2014 8:13:46 PM com.neophob.sematrix.core.visual.generator.blinken.BlinkenLibrary loadFile
Information: Loaded file /opt/pixelcontroller-distribution-2.1.0-RC1/data/blinken/torus.bml / 250 frames in 1.294ms (Unmarshall: 1.054ms)
Mai 27, 2014 8:13:46 PM com.neophob.sematrix.core.visual.generator.Image loadFile
Information: new filename does not differ from old: _logo.gif
Mai 27, 2014 8:13:46 PM com.neophob.sematrix.core.listener.MessageProcessor processMsg
Information: Select beat workmode MODERATE
Mai 27, 2014 8:13:46 PM com.neophob.sematrix.core.listener.MessageProcessor processMsg
Information: Shuffler select: 111111111111111111
Mai 27, 2014 8:13:46 PM com.neophob.sematrix.core.listener.MessageProcessor loadActivePreset
Information: Preset loaded in 1811ms
Mai 27, 2014 8:13:46 PM com.neophob.sematrix.core.visual.fader.Fader startFade
Information: Started preset fader CROSSFADE, duration 500, steps 20, new visual 1
Mai 27, 2014 8:13:46 PM com.neophob.sematrix.core.visual.fader.TransitionManager startCrossfader
Information: Started fader for output 0, new Visual: 1
Mai 27, 2014 8:13:46 PM com.neophob.sematrix.core.api.impl.PixelControllerServerImpl run
Information: --- PixelController Setup END ---
Mai 27, 2014 8:13:46 PM com.neophob.sematrix.core.api.impl.PixelControllerServerImpl run
Information: ---------------------------------
Mai 27, 2014 8:13:46 PM com.neophob.sematrix.core.api.impl.PixelControllerServerImpl run
Information: 
Mai 27, 2014 8:13:46 PM com.neophob.sematrix.core.api.impl.PixelControllerServerImpl run
Information: Enter main loop
Mai 27, 2014 8:13:46 PM com.neophob.sematrix.core.output.PixelControllerOutput update
Information: Init output
Mai 27, 2014 8:13:47 PM com.neophob.sematrix.core.api.impl.Framerate setFps
Information: Target fps: 40.75, delay: 24ms
Mai 27, 2014 8:13:47 PM com.neophob.sematrix.core.output.pixelinvaders.Lpd6803Common sendData
Information: <<< [ MissingData: 122/128 ERR: -5 MissingData: 122/128 ERR: -5]
Mai 27, 2014 8:13:47 PM com.neophob.sematrix.core.output.pixelinvaders.Lpd6803Common sendData
Information: <<< [ MissingData: 58/128 ERR: -5]
Mai 27, 2014 8:13:47 PM com.neophob.sematrix.core.output.pixelinvaders.Lpd6803Common sendData
Information: <<< [ MissingData: 58/128 ERR: -5]
Mai 27, 2014 8:13:47 PM com.neophob.sematrix.core.output.pixelinvaders.Lpd6803Common sendData
Information: <<< [ MissingData: 122/128 ERR: -5 MissingData: 58/128 ERR: -5]
Mai 27, 2014 8:13:47 PM com.neophob.sematrix.core.output.pixelinvaders.Lpd6803Common sendData
Information: <<< [ MissingData: 58/128 ERR: -5]
Mai 27, 2014 8:13:47 PM com.neophob.sematrix.core.output.pixelinvaders.Lpd6803Common sendData
Information: <<< [ MissingData: 58/128 ERR: -5]
Mai 27, 2014 8:13:47 PM com.neophob.sematrix.core.output.pixelinvaders.Lpd6803Common sendData
Information: <<< [ MissingData: 58/128 ERR: -5]
Mai 27, 2014 8:13:47 PM com.neophob.sematrix.core.output.pixelinvaders.Lpd6803Common sendData
Information: <<< [ MissingData: 58/128 ERR: -5]
ozett commented 9 years ago

hi, as is wanted to connect a led matrix to pixelcontroller via USB and sorted out my arduinos, because they dont really worked with tpm2ser-firmware (in bugreport: https://github.com/neophob/PixelController/issues/86), you gave me a hint, that there was only teensy 2.0 left to experiment with. no i found this issue/bug. does this mean, also teensy 2.0 doesnt work as tpm2ser-device for pixelcontroller? Than there is no really simple stable hardware left for use as an an usb-device?

as i am still searching for an small lowcost device to put on usb/serial for driving ws2811 ledstrips as a matrix (and i am no coder) i will try to find some interesting devices on the net and hope for a little help here. so maybe you think this ones can do it? -> http://lowpowerlab.com/blog/category/moteino/ https://farm6.staticflickr.com/5570/15269271355_8eaaa18843_o.jpg

as a second thought, i think i must find a board which is supported by fastled2. they support these: (https://github.com/FastLED/FastLED/wiki/Overview#platforms)

Arduino - Pretty much all the official arduino platforms should be supported at this point, 
including the Due (as of FastLED2.1) and the Yún (as of FastLED 3.0.3).
Adafruit Flora/Gemma & Trinket - ATtiny based chipsets for wearable projects
PJRC Teensy 2 & 3 - avr and arm based project boards from PJRC, arduino comparable, but with a variety of extra goodies on them. 
The teensy3 and teensy 3.1 is one of our favorite boards to dev against! 
The Teensy 3.1 is supported as of FastLED2.1 (currently still branched)

the smallest is the adafruit-trinket. What do you think? should i get me one to test againt serial-latency, your tpm2ser-firmware is small ...?

ozett commented 9 years ago

i gave my investigations another 15 minutes and looked (again, by incident) in your development-branch and found an updated readme. this shows another configuration to directly connect ws2801-leds to the spi-dev of the raspberry-pi. WOW!

[PixelController]---<SPI on RPi>---[LED#1]---[LED#2]..

As far as i see, one needs a levelshifter from 3,3V to 5V for the data/clock-lines. called "bridge". But i this all? Does Pixecontroller does all the spi-handling by itself? There is no further information in the readme, if one needs pi-blaster or some python-modules? Am i guessing right, that the bridge is the only hardware on needs to get ws2801 directly running with pixelcontroller on the raspberry-pi? (Than i would give it also a try ... ;-))) WOW!

neophob commented 9 years ago

yes basically all you need is a 3.3v to 5v level shifter

ozett commented 9 years ago

cool! i`ll go for it ...

ozett commented 9 years ago

until today i did not found time to test spi-led-strips on the raspberry, but i am still fascinated by the idea of having led-strips directly connected to the raspberry. as in the meantime i have some raspberry-2 versions, as they feel a bit faster than version 1, i took up agaoin the idea of connecting the led-strips direct to the rasperry.

first i found new libraries to connect ws281x to raspberry gpio... 1) https://github.com/jgarff/rpi_ws281x 2) https://github.com/raspberry-node/node-rpi-ws281x-native

now i will still go for it...and report again...

ozett commented 9 years ago

as i took up the project again, i found my arduino/artnet-client (http://www.deskontrol.net/blog/arduino-based-dmx-artnet-node/) dead today. i have to replace. i worked only with arduino ide 0.23, so i was looking for alternatives. i found an E1.31 Receiver sketch, which looks promising and newer i will give this also a try. (there 2 version for ethernet ENC28J60/Wiznet) if you want too: --> http://auschristmaslighting.com/forums/index.php?topic=6528.0

// E1.31 Receiver and pixel controller by Andrew Huxtable (andrew@hux.net.au)
// This code may be freely distributed and used as you see fit for non-profit
// purposes and as long as the original author is credited and it remains open
// source
//
// Please configure your Lighting product to use Unicast to the IP the device is given from your DHCP server
// Multicast is not currently supported due to bandwidth/processor limitations

// You will need the Ethercard and FastLed Libraries from:
// [url]https://github.com/FastLED/FastLED/releases[/url]
//
// The Atmega328 only has 2k of SRAM.  This is a severe limitation to being able to control large
// numbers of smart pixels due to the pixel data needing to be stored in an array as well as
// a reserved buffer for receiving Ethernet packets.  This code will allow you to use a maximum of 240 pixels
// as that just about maxes out the SRAM on the Atmega328.

// There is deliberately no serial based reporting from the code to conserve SRAM.  There is a **little**
// bit available if you need to add some in for debugging but keep it to an absolute minimum for debugging
// only.

#include <SPI.h>
#include <Ethernet.h>
#include <EthernetUdp.h>
#include "FastLED.h"

//*********************************************************************************

// enter desired universe and subnet  (sACN first universe is 1)
#define DMX_SUBNET 0
#define DMX_UNIVERSE 1 //**Start** universe

// Set a different MAC address for each...
byte mac[] = { 0x74, 0x69, 0x69, 0x2D, 0x30, 0x15 };

// Uncomment if you want to use static IP
//*******************************************************
// ethernet interface ip address
IPAddress ip(10, 0, 0, 10);  //IP address of ethernet shield
//*******************************************************

EthernetUDP Udp;

// By sacrificing some of the Ethernet receive buffer, we can allocate more to the LED array
// but this is **technically** slower because 2 packets must be processed for all 240 pixels.

/// DONT CHANGE unless you know the consequences...
 #define ETHERNET_BUFFER 540 
 #define CHANNEL_COUNT 360 //because it divides by 3 nicely
 #define NUM_LEDS 240 // can not go higher than this - Runs out of SRAM
 #define UNIVERSE_COUNT 2
 #define LEDS_PER_UNIVERSE 120

// The pin the data line is connected to for WS2812b
#define DATA_PIN 7

//********************************************************************************

// Define the array of leds
CRGB leds[NUM_LEDS];

unsigned char packetBuffer[ETHERNET_BUFFER];

void setup() {
  // Using different LEDs or colour order? Change here...
  // ********************************************************
     FastLED.addLeds<WS2812B, DATA_PIN, GRB>(leds, NUM_LEDS);  
  // ********************************************************

  // ********************************************************  
  Ethernet.begin(mac,ip);
  Udp.begin(5568);
  // ******************************************************** 

  //Once the Ethernet is initialised, run a test on the LEDs
  initTest();
}

void loop() {
   //Process packets
   int packetSize = Udp.parsePacket(); //Read UDP packet count
   if(packetSize){
    Udp.read(packetBuffer,ETHERNET_BUFFER); //read UDP packet
    int count = checkACNHeaders(packetBuffer, packetSize);
    if (count) {
      sacnDMXReceived(packetBuffer, count); //process data function
    }
  }
}

void sacnDMXReceived(unsigned char* pbuff, int count) {
  if (count > CHANNEL_COUNT) count = CHANNEL_COUNT;
  byte b = pbuff[113]; //DMX Subnet
  if ( b == DMX_SUBNET) {
    b = pbuff[114];  //DMX Universe
    if ( b >= DMX_UNIVERSE && b <= DMX_UNIVERSE + UNIVERSE_COUNT ) {  
      if ( pbuff[125] == 0 ) {  //start code must be 0
      int ledNumber = (b - DMX_UNIVERSE) * LEDS_PER_UNIVERSE;
       // sACN packets come in seperate RGB but we have to set each led's RGB value together
       // this 'reads ahead' for all 3 colours before moving to the next led.
       //Serial.println("*");
       for (int i = 126;i < 126+count;i = i + 3){
          byte charValueR = pbuff[i];
          byte charValueG = pbuff[i+1];
          byte charValueB = pbuff[i+2];
          leds[ledNumber].setRGB(charValueR,charValueG,charValueB);
          ledNumber++;
        }
      FastLED.show();  //Do it!
      }
    }
  }
}

int checkACNHeaders(unsigned char* messagein, int messagelength) {
  //Do some VERY basic checks to see if it's an E1.31 packet.
  //Bytes 4 to 12 of an E1.31 Packet contain "ACN-E1.17"
  //Only checking for the A and the 7 in the right places as well as 0x10 as the header.
  //Technically this is outside of spec and could cause problems but its enough checks for us
  //to determine if the packet should be tossed or used.
  //This improves the speed of packet processing as well as reducing the memory overhead.
  //On an Isolated network this should never be a problem....
  if ( messagein[1] == 0x10 && messagein[4] == 0x41 && messagein[12] == 0x37) { 
      int addresscount = messagein[123] * 256 + messagein[124]; // number of values plus start code
      return addresscount -1; //Return how many values are in the packet.
    }
  return 0;
}

void initTest() //runs at board boot to make sure pixels are working
{
  LEDS.showColor(CRGB(255, 0, 0)); //turn all pixels on red
   delay(1000);
   LEDS.showColor(CRGB(0, 255, 0)); //turn all pixels on green
   delay(1000);
   LEDS.showColor(CRGB(0, 0, 255)); //turn all pixels on blue
   delay(1000);
   LEDS.showColor(CRGB(0, 0, 0)); //turn all pixels off
}
ozett commented 9 years ago

i post here an update on search for an art-net client replacement. most interesting is now the esp8266 board, flashed with nodemcu, has an lua artnet-client.

https://github.com/flokli/esp8266/blob/master/ws2812/init.lua

must be investigated...