I've been poking around in the threads for a while and solved most of my setup issues doing so. I'm at the point where I'm still just testing Hyperion's direct control over the WS2812 strip before I start diving into the video capture portion of the setup. I'm trying with two different arduinos and getting the same behavior from both, so I can verify the source of the problem. 99% of the testing I'm doing is using direct terminal commands over ssh rather than using the HyperCon software as I tend to lean toward CLI stuff anyway.
Testing setup:
- Raspberry Pi 3 running Raspbian Stretch Lite (who needs a GUI on there anyway?)
- Arduino Pro mini 16mhz 5v // Arduino Mega 2560
- WS2812b LED strip (currently utilizing only 10 LED's for testing purposes)
Raspberry pi config.txt parameters set for this project:
# Disable Bluetooth
dtoverlay=pi3-disable-bt
# neopixel arduino setup
init_uart_clock=14745600
enable_uart=1
dtparam=spi=on
hdmi_force_hotplug=1
hdmi_force_edid_audio=1
core_freq=250
Alles anzeigen
Arduino sketch used:
#include "FastLED.h"
// How many leds in your strip?
#define NUM_LEDS 10
// For led chips like Neopixels, which have a data line, ground, and power, you just
// need to define DATA_PIN. For led chipsets that are SPI based (four wires - data, clock,
// ground, and power), like the LPD8806 define both DATA_PIN and CLOCK_PIN
#define DATA_PIN 10
//#define CLOCK_PIN 13
#define COLOR_ORDER GRB
// Adalight sends a "Magic Word" (defined in /etc/boblight.conf) before sending the pixel data
uint8_t prefix[] = {'A', 'd', 'a'}, hi, lo, chk, i;
// Baudrate, higher rate allows faster refresh rate and more LEDs (defined in /etc/boblight.conf)
#define serialRate 115200
// Define the array of leds
CRGB leds[NUM_LEDS];
void setup() {
// Uncomment/edit one of the following lines for your leds arrangement.
// FastLED.addLeds<TM1803, DATA_PIN, RGB>(leds, NUM_LEDS);
// FastLED.addLeds<TM1804, DATA_PIN, RGB>(leds, NUM_LEDS);
// FastLED.addLeds<TM1809, DATA_PIN, RGB>(leds, NUM_LEDS);
// FastLED.addLeds<WS2811, DATA_PIN, RGB>(leds, NUM_LEDS);
// FastLED.addLeds<WS2812, DATA_PIN, RGB>(leds, NUM_LEDS);
FastLED.addLeds<WS2812B, DATA_PIN, RGB>(leds, NUM_LEDS);
// FastLED.addLeds<NEOPIXEL, DATA_PIN>(leds, NUM_LEDS);
// FastLED.addLeds<UCS1903, DATA_PIN, RGB>(leds, NUM_LEDS);
// FastLED.addLeds<UCS1903B, DATA_PIN, RGB>(leds, NUM_LEDS);
// FastLED.addLeds<GW6205, DATA_PIN, RGB>(leds, NUM_LEDS);
// FastLED.addLeds<GW6205_400, DATA_PIN, RGB>(leds, NUM_LEDS);
// FastLED.addLeds<WS2801, RGB>(leds, NUM_LEDS);
// FastLED.addLeds<SM16716, RGB>(leds, NUM_LEDS);
// FastLED.addLeds<LPD8806, RGB>(leds, NUM_LEDS);
// FastLED.addLeds<WS2801, DATA_PIN, CLOCK_PIN, RGB>(leds, NUM_LEDS);
// FastLED.addLeds<SM16716, DATA_PIN, CLOCK_PIN, RGB>(leds, NUM_LEDS);
// FastLED.addLeds<LPD8806, DATA_PIN, CLOCK_PIN, RGB>(leds, NUM_LEDS);
// initial RGB flash
LEDS.showColor(CRGB(255, 0, 0));
delay(500);
LEDS.showColor(CRGB(0, 255, 0));
delay(500);
LEDS.showColor(CRGB(0, 0, 255));
delay(500);
LEDS.showColor(CRGB(0, 0, 0));
Serial.begin(serialRate);
Serial.print("Ada\n"); // Send "Magic Word" string to host
}
void loop() {
// wait for first byte of Magic Word
for(i = 0; i < sizeof prefix; ++i) {
waitLoop: while (!Serial.available()) ;;
// Check next byte in Magic Word
if(prefix[i] == Serial.read()) continue;
// otherwise, start over
i = 0;
goto waitLoop;
}
// Hi, Lo, Checksum
while (!Serial.available()) ;;
hi=Serial.read();
while (!Serial.available()) ;;
lo=Serial.read();
while (!Serial.available()) ;;
chk=Serial.read();
// if checksum does not match go back to wait
if (chk != (hi ^ lo ^ 0x55))
{
i=0;
goto waitLoop;
}
memset(leds, 0, NUM_LEDS * sizeof(struct CRGB));
// read the transmission data and set LED values
for (uint8_t i = 0; i < NUM_LEDS; i++) {
byte r, g, b;
while(!Serial.available());
r = Serial.read();
while(!Serial.available());
g = Serial.read();
while(!Serial.available());
b = Serial.read();
leds[i].r = r;
leds[i].g = g;
leds[i].b = b;
}
// shows new values
FastLED.show();
}
Alles anzeigen
hyperion config (devices section only as the rest is currently default generated by HyperCon
// DEVICE CONFIGURATION
"device" :
{
"name" : "Test",
"type" : "adalight",
"output" : "/dev/ttyAMA0",
"rate" : 115200,
"delayAfterConnect" : 0,
"colorOrder" : "grb",
"leds" : 15
},
Alles anzeigen
Things that are working:
- Test light pattern upon arduino boot up (both behave the same)
- Rainbow swirl upon hyperion service start
- When arduino is configured for the test number of LED's of 10 AND when running at 115200 baud
- Serial connection over GPIO UART ttyAMA0 @ 115200 baud
- Serial connection over ttyUSB0 @ 115200 baud (only tested using ATMega2560)
What's not working:
- Serial control at the recommended 460800 baud on any interface
- Attempted control over direct SPI using a 1k ohm resistor, GPIO18
- Rainbow Swirl upon hyperion service start
- When Ardiuno is configured for full strip use (108 LED's) and it's running at 115200 b, the led updates come in around 5-7 "fps"
So the big problem I'm seeing is that when I set the arduino sketch to use 108 LED's as I expect to need on my TV, the color transitions become very "choppy" regardless if hyperion is configured to use 108 LED's or just the original 10 LED's.
I'm pretty sure this has to do with the serial communication rate as I'm thus far unable to get my RPi to work over anything higher than 115200 baud. As you can see in the config.txt above I did try to set the serial clock rate higher, but I'm not sure if that's actually working, or how to check the current clock rate.
Any help would be apprecaited!