Fake-Ambilight for my TV using Arduino.

I’ve got an idea to create Ambilight system for my TV using PC, WS2812B LEDs and arduino. My TV works as a monitor for PC, so i can easily run software to create ambilight effect like here: Cheap DIY Arduino Ambilight 2.0 (Revisited) RGB WS2812b LED Full Build & How-To - YouTube

I’ve got one problem - my TV is placed 10m away from my PC, so i would have to use 10m USB cable for Arduino or LEDs. From what i know, long cables are not a good idea. Would Arduino work fine on 10m USB wire?

There is a code for arduino:

#include "FastLED.h"
#define NUM_LEDS 240
#define DATA_PIN 6

// Baudrate, higher rate allows faster refresh rate and more LEDs (defined in /etc/boblight.conf)
#define serialRate 115200

// 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;

// Initialise LED-array

void setup() {
  // Use NEOPIXEL to keep true colors
  FastLED.addLeds<NEOPIXEL, DATA_PIN>(leds, NUM_LEDS);
  // Initial RGB flash
  LEDS.showColor(CRGB(255, 0, 0));
  LEDS.showColor(CRGB(0, 255, 0));
  LEDS.showColor(CRGB(0, 0, 255));
  LEDS.showColor(CRGB(0, 0, 0));
  // 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()) ;;
  while (!Serial.available()) ;;
  while (!Serial.available()) ;;
  // If checksum does not match go back to wait
  if (chk != (hi ^ lo ^ 0x55)) {
    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;    
    r = Serial.read();
    g = Serial.read();
    b = Serial.read();
    leds[i].r = r;
    leds[i].g = g;
    leds[i].b = b;
  // Shows new values

I’ve got 2 ideas:
a) Arduino stuck on TV, short data wire for LEDs, long usb wire for PC
b) Arduino close to PC, short USB wire, long data wire for LEDs
If its impossible to use long USB wire, what should i do? Can i use longer “data” wire for LEDs and connect my arduino to PC using shorter usb cable?
Do u have any simple (or at least cheap :slight_smile: ) ideas?

I’ve been using USB cables as long as 10 meters without problem. As a matter of fact my Pc uses that length of cable to the router.

On the other hand, I’ve had a printer refuse to work on just a 5m USB cable.


(A USB cable between PC and router?)

It would great if i would need just a long usb cable .... but knowing my luck, it wont even work on 0.5m wire :slight_smile:

On the other hand, I've had a printer refuse to work on just a 5m USB cable.


(A USB cable between PC and router?)

Ehh. Likely a network cable. But I've used a "long" USB cable to my printer.

I have had no trouble with 7 m to printer.