Google Analytics

Friday, December 9, 2016

DIY Ambilight version 3.1 (and 3.0)

Hey everyone!  I've updated my DIY Ambilight and wanted to share some of the details!




   

   


In 2011 I published my instructions for a DIY Ambilight.  This was a few months before Phillip Burgess published instructions on Adafruit's site.  So while I may have been one of the first to build this, others certainly did a MUCH better job than me.

I wanted to put instructions out for anyone that is is looking to build their first one or wanting to upgrade the one that they already have.  I'm really happy with the LED mount that I was able to put together and wanted to share that as well.  Now on to the tech!

I recently got a new TV which made it necessary to upgrade my DIY Ambilight. I had strand of 25 LEDs, but I added another 50 which necessitated a new build.  The display is 44.4" x 25.8" so I decided to make the LED mount roughly 40" x 23" to center on to the back of the display.  I used choice lumber from Lowe's for its finish and light weight.  The boards I used were 1x2s which are effectively 3/4" x 1 1/2".

Just like practically any other project like this, we start with an Arduino sketch.  I had some serious flickering issues with Adafruit's LEDStream sketch and started googling for a solution.  I tried changing the timing to a lot of different values with limited success.  Somewhere (and I cannot find it again) someone had posted a copy of the LEDStream sketch modified to use the FastLED library.  I found that it worked flawlessly.  If I track down the original author will will certainly give them credit.  You can find the modified file here: LEDStream with FastLED lib.

Once you have that loaded on your Arduino, you can hook up your LED strand and start pushing values.  I use boblight still and you can find an amazing Boblight Configuration Maker here.  If you are on Windows, I have a setup for a friend that works amazingly well using Prismatik.  You can find a 50 LED Prismatik configuration as well as my 75 LED boblight configuration in the same GitLab repo as the Arduino sketch.

Now to the really fun part - the LED mount. Please observe my first and terrible attempt at a 75 LED mount:

Version 3.0.  I'm not happy with this at all.

Pointing the LEDs straight at the wall "worked" but it could be a lot better.  I wanted the LEDs pointing out at a 30° angle from the back of the display. After a lot of experimentation, I found that building such a setup was not obvious.  I had a miter saw but not much experience with it.  Then I found that a miter saw calculator existed!  If I cut the boards with a blade angle of 37.8° and a miter angle of 26.6°, I could make exactly what I wanted.  The depth side of the frame boards came together at a 90° angle while the width of the boards is angled out at a 30°.  It's hard to explain, but here are some photos.
Then I needed 2 boards to attach to those angled boards in order to attach it to the VESA mounts on the display. This required building a 60° jig.






 Here's how everything fits together.






Additional components needed:
  • A 4+ Amp power supply.  I like the ones from uxcell like this
  • A relay to turn the LEDs off when the TV is off. I plug it in to the USB port on the TV and the TV powers the port down when you turn it off. You can go the homemade route or buy one.  The uxcell power supply whines when the DC power is cut off so I'm going to switch the relay from breaking the DC circuit to the LEDs to breaking the circuit on the AC line. Be sure your relay can handle the load you will put to it!
  • Hot glue.  I really like the Gorilla Glue hot glue sticks. They are perfect for attaching the LEDs without damaging them so you can repurpose your LEDs later. You could also drill 2 small holes on each side of the LED and attach them with zip ties.
  • A way to mount the components to the frame.  I like Command Strips with velcro. 
  • 4x metric bolts for the VESA holes in the TV
The final setup looks like this.






Thanks for checking out my project!  Please post any questions and I'll do everything I can to help.


Wednesday, October 26, 2016

Wish you bed had LEDs that turned on when you got up so you didn't stub your toes on your dresser?

Duh.



Here's how I did that.

A rough diagram explaining the components.

My bill of materials

  • Pi Zero (With USB Wifi dongle and MicroSD card)
  • 2 PIR sensors
  • 2 momentary push buttons 
  • 5v 5A power supply
  • Strip of Neopixels (150/5meters)

The premise is simple.  Detect motion, use math to figure out if it's dark outside, and if so, turn the lights on until there is no motion for about 5 minutes.  2 buttons have been added so you can turn it on and off on demand.  

You can find a the code and documentation here: Dhowdy on GitHub



And, of course, a video of the LEDs turning off


Please post any questions below!  Enjoy!

Monday, May 23, 2016

Update to VM_URL_Passer

Adding a simple bit of authentication to the VM URL Passer scripts.

Edit: Updated code can always be found on my github: https://github.com/dhowdy/VM-URL-Passer/


I got tired of network scans causing my script to open new Chrome windows, so I'm adding a bit of authentication.  Keep in mind that all of the data is still passed in cleartext, so this is not making it more secure to people wanting to force you to check out a website with a horrible photo but rather causing innocuous port scanners to not cause random popups.  

The updated client and server is as follows:

VM_URL_Passer_Server.pl

#!/usr/bin/perl
use IO::Socket::INET;

# auto-flush on socket
$| = 1;

# creating a listening socket
my $socket = new IO::Socket::INET (
    LocalHost => '0.0.0.0',
    LocalPort => '7777',
    Proto => 'tcp',
    Listen => 5,
    Reuse => 1
);
die "cannot create socket $!\n" unless $socket;
print "Running on port 7777\n";

while(1)
{
    # waiting for a new client connection
    my $client_socket = $socket->accept();

    # get information about a newly connected client
    my $client_address = $client_socket->peerhost();
    my $client_port = $client_socket->peerport();
    #print "connection from $client_address:$client_port\n";

    # read up to 1024 characters from the connected client
    my $data = ""; 
    $client_socket->recv($data, 4096);
    my @datastring = split('~~',$data);
    if ($datastring[0] eq "myweakasspassword"){
         print "received data: $datastring[1]\n";
         system("'/usr/bin/google-chrome' \"$datastring[1]\"");
    }else{
         print "Wrong password.";
    }   

    # write response data to the connected client
    $data = "ok";
    $client_socket->send($data);

    # notify client that response has been sent
    shutdown($client_socket, 1); 
}

$socket->close();

url_tcp_client.pl

#!/usr/bin/perl
use IO::Socket::INET;

# auto-flush on socket
$| = 1;

# create a connecting socket
my $socket = new IO::Socket::INET (
    PeerHost => '192.168.100.100',#IP of the host machine
    PeerPort => '7777',
    Proto => 'tcp',
);
die "cannot connect to the server $!\n" unless $socket;
print "connected to the server\n";

# data to send to a server
my $req = "$ARGV[0]";
my $pass = "myweakasspassword";
my $data = "$pass\~\~$req";
my $size = $socket->send($data);
#print "sent data of length $size\n";

# notify server that request has been sent
shutdown($socket, 1);

# receive a response of up to 1024 characters from server
#my $response = "";
#$socket->recv($response, 1024);
#print "received response: $response\n";


$socket->close();


The only real change is that the client now sends a "password" to the server separated by two tilde (~~).  The server splits the string into an array on "~~" and treats the first part as a password and the second as the actual data.  

Again: this isn't secure, but it doesn't really need to be.  Just a quick hack to make VMs a little bit more usable.