Reactive TV Lights

Ambilight just too expensive or not cutting it for you? Same. I did it myself, and like most of my projects it involves a Raspberry Pi.

Here’s what you’ll need for my setup:

  • Raspberry Pi 4B
  • Pimoroni Mote LED Kit
  • 4K HDMI Splitter
  • HDMI-to-USB 3.0 Capture Card
  • Lots of USB outlets and cables, some included and some not.

I used HyperBian, which is basically Raspbian pre-flashed with Hyperion. This handy image does 90% of the work, so take a moment to appreciate how much you don’t have to do.

Note: Python 2.x has been deprecated and I have therefore updated the scripts/syntax to reflected that as needed.

I’m not gonna mention the parts that are standard, like setting up Mote lights. I will go over the wiring though:

Media > Splitter > HDMI Capture Card > Pi > TV

First, follow these instructions. I’ve listed the relevant portions below as well.

sudo apt-get install python3-dev python3-pip
sudo pip3 install twisted
sudo pip3 install pyserial mote numpygit clone https://github.com/PaulWebster/artnet-unicorn-hat.git
cd artnet-unicorn-hat
sudo nano artnet-server.service
sudo cp artnet-unicorn-hat-mote/artnet-server.service
  /lib/systemd/system/artnet-server.service
sudo systemctl enable artnet-server
sudo systemctl start artnet-server

Before copying over artnet-server.service, modify it with nano, make sure the path to the script matches where it is on your installation.

For me, I had to change the user folder from “osmc” to “pi”. If you try to start or enable the service you’ll probably get the following error:

[Unit]
Description = Artnet/OPC/FadeCandy Server - control of LEDs

[Service]
Type = idle
ExecStart = /usr/bin/python3 /home/osmc/artnet-server.py

[Install]
WantedBy = multi-user.target

Original error was: libf77blas.so.3: cannot open shared object file: No such file or directory.

This can be easily fixed by running the following command:

sudo apt-get install libatlas-base-dev

Go to Hyperion Dashboard. It should be localhost:8090 from your Pi. Set the Capture Input to the USB device detected (the capture card), and the LED output format to “fadecandy”. Set the number of pixels to “64”. Save the settings and everything should work! Don’t forget to configure your lighting orientation to match the placement of your lights!

Build an Autonomous Unmanned Aerial Vehicle

Earlier this year, I set my heart on building a drone that can fly itself. I know I’m not the best pilot, so I wanted something that could more-or-less take care of things on its own. It was (and is) a very long road, which started with me buying a Raspberry Pi 4B.

Since then, I’ve constructed a vehicle that can hold an extremely steady position a few feet above the ground. That’s about the extent of its autopilot so far, but that is a remarkable thing in itself. Your standard remote-control quadcopters may be able to “stabilize” themselves in the air, but they have no idea where they are in relation to the world around them and therefore can’t “stand still”. If the wind blows them, they’ll drift unless the pilot intervenes. It may sound like a small difference but it’s much more substantial when you’re working with precise movement in an area full of obstacles.

Let me also take a moment to say that if anyone reading this is encountering issues with any of the parts or workflows mentioned below, leave a comment and I’ll be happy to help out. So, let me list off the salient components of my project (which I’ve christened W.A.T.N.E. — in honour of the character Mark Watney from the novel The Martian by Andy Weir.

  • The Frame – DJI Flame Wheel F450 ARF Kit. It came with motors, electronic speed controllers (ESCs), a sturdy set of arms, and a top plate + bottom plate.
  • The Flight Controller – Navio2. Most people opt to buy a standalone FC and connect a “companion computer” (usually an SBC like a Raspberry Pi or Nvidia Jetson Nano) over UART. I operated through the path of least resistance and got what I knew best: a Raspberry Pi Hat. RPi Hats are basically daughter boards that connect to the GPIO pins on the Pi and give it extended functionality. In this case, it’s giving my model 4B the capability to be an integrated 2-in-1 flight controller and Linux companion computer. I’ll talk more about the implications of that later, but please do read what I have to say before you invest in a Navio2 or any other FC that runs off the Linux stack.
  • Cellular Uplink: Netgear 340U USB LTE Modem. A rare find and a royal pain to configure for Linux, but I got there in the end.
  • Tracking: Intel RealSense T265 Tracking Camera. (Tests are underway to implement this device for precision landing.)
  • Obstacle Avoidance: Intel RealSense D435i Depth Camera.
  • Intelligent Object Recognition: Intel Neural Compute Stick 2 (not currently set up).
  • Radio Receiver: FrSky R9
  • Radio Transmitter: FrSky Taranis Lite with R9M ACCESS (long-range module).
  • FrSky SBEC
  • PiJuice UPS/Power Management Hat
  • 4S Li-Po High-Discharge Power Cell
  • Lots of cables, wires, connectors, Flex Tape, and hair ties.

I’ll be honest with you, I had little to no clue what I was doing when I started. My dad, who is an Internet Pioneer that founded this blog several years before my birth, raised me with an intermediate understanding of computers. However, this was hitherto my first foray into the world of UNIX commands. I familiarized myself with syntax by messing around with online examples aimed at kids. Like most things, you’ll find that the most intuitive way to learn coding is with the materials aimed at kids. I started off with Scratch by MIT just a few months after its release over a decade and a half ago.

When I thought I was ready to take on the big project (I was woefully misguided, but if I had known what I was in for I may not have started at all), I ordered the frame kit. That was my big initial commitment to the project. Assembling it was easy enough, once I got used to the soldering iron. You only need it for fusing the ESC cables to the bottom-plate. Pretty much everything else is plug-in if you play your cards right.

It’s not hard to build a quadcopter. We live in a blessed era of over-information, we need only have the skill to discern the pertinent from the irrelevant.

  1. Flash an SD card with Emlid Raspbian. You’re stuck with their distro because the Navio2 needs a custom kernel.
  2. Assemble the frame kit. Only put the propellers on when you’re ready to fly it but make sure you know which props go on which motors.
  3. Assemble your Big Brain Module, in my case it’s a Pi and two hats. Oh, and put that SD card in there too.
  4. Connect the ESC wires to the servo rail, and the Navio2 Power Module to the port on the back-right corner of the FC. WARNING: I hate to be the guy to tell you that the boogeyman is gonna get you if you don’t eat your vegetables, but if you don’t follow the wiring diagram exactly, your drone will keep flipping when you try to take off and you’ll never know why. Trust me.
  5. Connect the power module to the flight battery. I mean, you can do it just to make sure power goes through it but all the motors will do is beep at you in a distressed fashion until it gets a data input. Maybe just leave it disconnected for now.
  6. Connect the power module to the bottom-plate. I use XT60 connectors and I had to solder an XT60 connector to my bottom-plate for the power running to the motors.
  7. Connect the radio to the port on the servo rail marked “1”. it’s the column of pins reserved for the only radio so don’t put your motors or anything else there.

That’s it for hardware, assuming everything was done right the first time. A lot of this stuff is trial and error, as it has been since time immemorial. Remember that everything you do is a result of the culmination of thousands of years of societal and technological research and infrastructure. We stand on the shoulders of giants, all of us. We are nothing without the efforts of our predecessors and keeping that in mind seems to temper me when my patience runs thin.

So far, I’ve described how to build something theoretically capable of flight. There’s not much to do software-wise, just some basic calibration done through the ground control application. I use QGroundControl but if you use Windows I’ve heard Mission Planner is way better.

If you configured everything right, you have yourself a remote control quadcopter. It should arm in stabilize mode even without a GPS lock (don’t get me started on GPS just yet).

In the next post I’ll go over all the tweaks and tricks I’ve done to make it do more than just be an RC toy.

Blu-ray Fast Track

I recommend:

A plasma TV or monitor with a native resolution of 1920 × 1080 (1080p), support for 24fps (frames per second) and HDMI 1.3a input. Check out an ordinary standard definition TV signal to ensure it looks good as that is a good measure of the TV’s image processor. Calibrate the picture with a DVD-based calibration program for each video input.

A Blu-ray player with 1080p/24fps video output preferably with a Reon chip for deinterlacing/upscaling non-1080p video and 7.1 bitstream audio output of Dolby Digital, DTS, Dolby Digital Plus, DTS-HD High Resolution, Dolby TrueHD and DTS-HD Master Audio via an HDMI 1.3a output.

An Audio-Video receiver that can accept and pass through a 1080p/24fps picture and decoders for Dolby Digital, DTS, Dolby Digital Plus, DTS-HD High Resolution, Dolby TrueHD and DTS-HD Master Audio. The receiver should be matched to the impedance and power rating of the speakers.

A minimum of five speakers, preferably six or seven and a subwoofer. A pair of front effects speakers are a great add-on for DSP (digital signal processing) effects if your AV receiver supports them.

HDMI 1.3a-certified Category 2 (high-speed) HDMI cables × 2 from the Blu-ray player to the AV receiver and from the AV receiver to the TV, speaker cables × 7 and a subwoofer cable.

Deep Colour (and x.v.Color) support are optional, however having at least the TV and AV receiver future-ready is prudent. A Blu-ray player that can upconvert 8-bit colour to 12-bit colour is a good option if your TV can display 12-bit colour (not just accept 12-bit input and downconvert it back to 8-bit).

If the TV, AV receiver and Blu-ray player all support HDMI-CEC (consumer electronics control), or as Panasonic calls it, EZ Sync (pre-2008) or Viera Link, you are in for a treat. Turning on the AV receiver while watching TV should automatically switch the audio output from the TV speakers to the AV receiver, and your TV’s volume control should then control the AV receiver’s volume. If you are creative you can set up the system such that switching to the AV receiver/Blu-ray input on the TV automatically turns on the Blu-ray player and switches the AV receiver’s audio output accordingly, using HDMI-CEC alone, with no need for a programmable remote.

Read the instructions manuals to understand all the options and directions for the best possible setup, hook everything up, run the calibration programs and you should be good to go.

Newer AV receivers are self-calibrating using the auto setup function, but are not perfect – some falsely report one or more speakers as being out of phase, small instead of large and/or the volume settings do not corroborate the readings of a sound pressure level meter. Some AV receivers are known to overheat, cause popping sounds in the rear speakers with DTS-HD MA or drop audio momentarily with Dolby TrueHD.

© 1996-2024.   All Rights Reserved.