Tuesday, December 19, 2023

Making my environment more portable

 I have a bit more than a few Linux hosts on my LAN and most of my work's computer systems are Linux as well. I wanted to have something to synchronize my bash, tmux, and vim settings everywhere I work. I crafted a simple "env" project with a setup script which replaces these configuration files with softlinks to files in the project. I use git to first clone the project and then run setup to get everything in place.

I also found that I was occasionally updating these setting files. Obviously I used git to keep track of these changes. I took this a step further and put a function in my bash profile to check if the env project has any upstream changes to pull. This is a very rudimentary synchronization system and does quite nicely to keep my environment consistent wherever I roam.

Monday, December 18, 2023

Watering the cat




 I took some time off at the end of 2023. I had a chance to resurrect some of my old projects including the notorious water fountain for the cat. I've been enjoying accomplishing various things with resources I already have on hand, so I dusted off a raspi3 and the Intel Movidius stick I have and set to work putting the project back together. This time around I already had a hole in the countertop, so I wasn't going to bother with the wireless or battery power aspects of the concept.

I had bought a nice fountain with an infrared sensor which worked very well for the past 4 years (except for just one tubing blowout that happened when I was home, and the manufacturer was extremely responsive sent a new tube and it never happened again). However, nowadays I often find myself occupying that section of my counter (espresso workstation), and so the cat fountain would often trigger. Also it ate counterspace.

I used a very quick and dirty setup to accomplish the task, looping the control through home assistant via an MQTT sensor published by the raspi, which was linked through a simple automation to a Zigbee relay. With the sensor state and relay state coupled, all I had to do was resurrect the old stream_ty python script and ask ChatGPT to make me a nice MQTT sensor class to send updates to Home Assistant. I had to make sure to ask for the class to do LWT and keepalive and to retry if it lost connection. I also had to make sure it sent a config json to the config topic for automatic discovery.

Since I already had the water spout and under-sink plumbing, valve and a new hole in the counter (from plumbing the espresso machine), I was able to check the box on this task in a couple of days (after screwing around with a raspi zero, which didn't work in the end...). It's interesting that when I looked into running tiny yolo on the raspi 3 it seems like I could probably have done this without the Movidius... maybe I'll try someday.


Saturday, June 25, 2022

Complete home theater overhaul

I decided to upgrade my home theater setup after 5-6 years. The previous iteration consisted of a rear-throw projector, a large AV shelf system, an HD compatible receiver for a 5.1 system, with a PS4 and Chromecast serving as the primary media inputs. Why did I decide to upgrade?

First, aesthetics, the look of the AV shelf systems, the large floorspeakers, the dented projector screen, the overhanging projector (it was a huge Epson system), I wanted to switch to something more minimalist, reclaiming living space, and head in the direction of more compact form-factors. 

Original setup, D2 rocks.

Also the projector indicated lamp replacement was imminently necessary.

Finally, Dune came out. I went and saw it twice in IMAX, during a COVID surge, because it was so good. The auditory experience was the highlight for me. The impactful bass, and sharp cutting clarity of the Zimmer soundscape in IMAX changed my awareness of what sound could be. I tried rewatching Dune at home and found I could now hear all the inadequacies of compressed sound codecs. After some learning I decided to upgrade my entire AV system so I could get closer to the way things sounded in the theater. I needed an uncompressed codec, and that meant upgrading my system to something supporting eARC.

So I developed the following requirements:

  1. Larger screen, going from 80" to 100"
  2. Capable of an uncompressed codec
  3. 4k
  4. Laser light-source for longer lifetime
  5. Ultra-short throw to get the projector off the wall over my head
  6. More compact soundsystem
  7. Fully enclose all AV equipment, and reduce visible cabling
  8. Support day-time/ fully lit viewing with minimal reduction in quality

I settled on the following equipment:

  1. BenQ v7050i, a 4K UST Laser-TV
  2. Elite Screens Starling CLR 3 Tab-tensioned screen
  3. Sony HT-A7000 with subwoofer (rear-channels to come soon)
  4. A skylight shade (433MHz control, installed months before this project to help with keeping the house cooler).

Using MS Visio I developed a design for the system.

Visio is a great tool.

 

I looked for a new piece of furniture for the UST projector but there wasn't much that met all the requirements. There is a air-return register on the floor where the new AV system would sit, and I wanted to avoid blocking it at all. Most media centers completely obstructed or at least partially obstructed the grate. I didn't want to make my own furniture either. Luckily Ikea came to rescue with the Besta floating cabinetry. I was able to easily customize my cabinets, complete with a neat faux-concrete material for the doors. The whole solution cost 50% of the best media center furniture option I was looking at. This brought much joy.

Plenty of clearance over the register.
With the furniture selected the design started to come together. Again using Visio I dimensioned the cabinets, projector, and a sliding shelf for the projector. I also used Visio to confirm the location of the projector and screen, determining the required extension of the shelf, and ensuring the throw of the projector would be compatible with the arrangement. Visio also provided a sense of how everything would look once installed. As you can see the doorway is partially obstructed, alas this is the cost of having a BFS.

I fabricated the shelf using plywood.

Anyone familiar with Ikea furniture can tell you it's mostly hollow, which made the shelf mounting somewhat tricky. You can't just drill some holes and hope for the best. So I reinforced the slide mounting screws using plywood glued to the inside of the cabinets.

Plywood reinforcement.

After getting the furniture all arranged, I installed the screen and soundbar. It ended up looking very nice.

Very nice.

Now I just needed to automate the crap out of it.

Automation

I built everything into the shelf.

It looks pretty hacked, but it works! My favorite part is the zip-tie breadboard.

For the shelf mover, I used a cheap linear actuator from Amazon. It can push and pull 220lbs. Super overkill and probably bad engineering... but it was $40 and more importantly it was the only encapsulated mover with the range I needed. The driver is just a simple Adafruit DRV8871. The limit switches are from Amazon. So is the RS232 line driver, HiLetGo. 

For power I used a 12V 6A Meanwell supply with a DC-DC step-down for 5V to power the controller. The controller is an ESP32 Wroom board from Sparkfun

I tinkered for a bit with trying to get a 433MHz transmitter working to control the skylight shade. This was the part that took the longest to get working and in the end I gave up on it. I did everything. Used my Analog 2 analyzer and a 433MHz receiver, and even at one point hooked directly to the remote to figure out what the protocol was.

Trying to ascertain the protocol. I wrote some Javascript to interpret the pattern to display binary.

I got deep on this thing.

 

I even tried to hijack just the radio from the remote, disconnecting the chip and using the ESP to drive the pattern. Even after all of this the system stubbornly refused to work. My grand vision of having a single RF transmitter to control the screen and shade fizzled out. I suspect the drive circuit of the ESP GPIO (push-pull), was somehow the wrong thing to drive the radio, and probably the transmitter I had was just slightly off on the wrong frequency. Sigh. In the end I just used open-drain outputs to simulate button presses and soldered wires to the remote to interface it with the ESP. Messy, but functional, a true hack.

For the projector screen a simple NPN drain (as it ran on 5V which is not compatible with the esp).

Then a bit of configuration code using ESPHome and I had integrated controls with Home Assistant. A few more steps and I had everything working just as I had envisioned. A simple cast of a video to the Chromecast and boom, the projector boots, the shelf extends (they move at the same speed so it just looks like the cover of the projector is staying still), the shade closes, the screen drops, and the soundbar activates. The soundbar control is also nicely integrated into Home Assistant. It's a symphony of automation, and all just so I can watch TV.

I love this hobby.